Spawn Actors on a generated maze

Hi Community.

I am currently generating a maze from a text file. It works well, however I would like to automate the process of filling the maze with pickup Actors. I tired pawning a pickup when ever I created an instance of the floor tile. I was wondering if anyone knows of a better approach to doing this?

Without any code i am not sure exactly if you have a coding question or if it was simply just a theoretical question. So i will answer it as if it was a theoretical question as that will allow me to answer fairly quickly.

there are 3 scenarios i see you could be asking about:

  1. You only want the Pickups to spawn in certain areas.
    You could do this by marking these areas in the maze text file as a different type of floor. and then proceeding with suggestions 2 and 3 with just a smaller set of tiles.

  2. You just want it to spawn in a random location that it can be picked up by the user
    You could do this by simply finding all floor tiles picking one and then spawning it there

  3. You want to spawn it randomly but not within the same area as a pickup that already exists or something along those lines
    You could do the same as 2 but then when picking a tile also check the distance between other pickups and then sort tiles based on their distance from other pickups.

Depending on how elaborate you want to make your spawning “algorithm” you could go as far as to look at this as a search problem in which you are searching for the best tile to spawn the pickup. And then you can just define what the “best” tile would be. This could be as simple as any random tile or as complicated as an A* algorithm that uses some complicated heuristic to determine cost of the tile and what not.

Hope this helps!

Tyler

P.S. I would probably be able to give a more specific answer with more context :slight_smile:

Thank you for this wonderful answer. I believe the first one is what I am looking for. I am trying to spawn a pickup on each tile.