I am developing a top down shooter and I want the map to be generated randomly, this way everytime the game is played the map will be different. Any tutorials on how to do it?
I know this isn’t exactly what you’re asking, but I like this article
If you can get your head around how it works, I’m sure you’d be able to work something out
Do you mean with tiles, or something different?
With tiles, I think. I can try to explain. For example, I want to randomly generate a map. So for example, let´s say I have tiles for water, ground, some obstacles,etc. What I am looking forward to do is the map to be generated randomly but it has to be possible to beat, so I don ´t get trapped with water by all sides, etc
I’m not a pro with procedural generation, but I could help you with tiles
thanks . I will be only doing this next week when the next sprint begins
There are some things you need to do first if you want something that looks decent.
The tiles themselves need to be organised and probably extra tiles generated
The reason for this is you don’t want hard edges between tiles.
So the best way to do it is assign a bit pattern to the tile types.
Water = 0b0000000001; Sand = 0x0000000010; Ice = 0x0000000100; Rock = 0x0000001000;
Then when your random generation code has filled the map, run a second pass over it adding transitions
I generally use this bit pattern to modify the Y value in the texture fetch
So all the base tiles are at Y=0, all the water tiles are at X=0, all the sand tiles are at X=sprite_width
Base + Water is at Y = sprite_height
Base + Sand is at Y = sprite_height * 2
This idea not only makes random generation a lot easier , it makes the result look a lot better