Download

Random mine field

I set up a mine field in my game, but I would like to make the mine placement random so the player can’t memorize the route. Is this done procedurally? is there an easy way to do this?

Yea dude, this tutorial is really cool and covers that somewhere in the middle. Using a volume to spawn objects at random points inside of it.

https://www.youtube.com/watch?v=mSRov77hNR4&list=PLkOZHZ-iJ8Af3OM9c5DvV_yKHGbSGlgOy&nohtml5=False

Tutorials is for C++, not everybody wants to start with C++.

For random minefield you need to program it yourself.
Easiest way is to make grid blueprint that spawns same actor in grid like from -x to +x and from -y to +y, with defined space between grid cells.
When you have spawning those tiles. make some random spawning and check for doubles in same grid cell.
Or instead checking do random for probability if cell should have mine or not. Like random from 0 to 99 and if its more that 80 spawn a mine.
Then go trough all cells in loop, like you did in grid spawner.

Here is how it is done within the level blueprint

Create a generic cube with whatever dimensions you want the mine’s to spawn into. set your mine class in the spawn actor. Put that in a loop and loop it however many times you want a mine.