Map randomization.

To make things more interesting, I was thinking to add some random objects in a level before gameplay started.
What would be the best approach to this?

  1. Maybe have “World generation” UI, where user can add some parameters for randomization.
  2. Execute level creation:
    2.1 Load default map.
    2.2 Place random Actors.
    2.3 Save as a map/level.
  3. Start playing?

Is this sound okay? Do I miss something.

Well one approach I think might work is to have blueprints that are in place and then have them generate a random object where they are

Thanks, That should work. I was thinking something like that approach. Just need to make sure somehow that this BPs will execute only once, on first load.

Sounds like the level blueprint’s “Event BeginPlay” might work for you. That’s what the strategy sample uses, I believe.

If you keep a collection of spawnable actors, then you just have to loop over that collection and spawn an actor if the random number generator gives you a value > x, where x is your random probability.

I’m not sure where your save level step fits in. Is that just serializing it out for the game’s save file or something?

Thanks for suggestion but I thinking “Event BeginPlay” is too late. Is there a way to load a map, then execute some sequence which will spawn actors, and then save the map with those actors spawned.
So the user can save that random map and resume playing with actors already placed in the map. I just trying to avoid spawning every time you resume playing.