Could anyone help me with a random world generator?

I am making a Top Down, Open World, zombie survival game but i’m trying to make a random world generator and I cant find a way to do it. Does anyone know how?

3 Likes

You would have to make some sort of procedural generation, kinda like Minecraft

you could maybe do this by having “chunks” made up of random objects and randomly placing them around the map

2 Likes

Ill try to do that. DO you mean like it spawns random blocks on chunks that are loaded

ive wanted this before and there is no actual good way of doing this or at least not in flow lab idk exactly how to explain it but ive asked this question before and @grazer explained it to me in flowlab you cant exactly make a random world generator but more so a random version generator so you make 1 level and then have it change position of objects randomly based off that world, again not the best explanation but @grazer can explain this better.

you should probably try not to ping Grazer unless absolutely nessecary

2 Likes

Ok thank you! This might work

2 Likes

oh its ok grazer just wants to help no matter what especially with people who need it and besides he would be better help then me i mean he did make the website afterall

Hey, @OxolotlGames this is a simple version I’m still working out how I’m gonna do the “infinite” version of it… just waiting until grazer makes it so background repeated objects use code still.

Its fine I figured out A way to do it. Every time the game starts it changes the position of the block randomly in the map.

Random generation is easy if you know what you’re doing. There are 2 main ways of doing this.

  1. Generate the map when the player loads in (So a predefined size so it doesn’t lag)
  2. Generate the map in chunks so that when the player walks over to a place it will load in

So for the first option let’s say you want to spawn in trees, you can place a random amount of them randomly, or you can place an object that places the trees in a small area to create a kind of mini forest, which might give a more unified and possibly cleaner look. This gets more complicated the more things you add, for example, if you have a town that you want to spawn in, it’s best to place a second object to place them all in, but with a few prearranged layouts and with the buildings in random spots. It seems complicated at first, but as I said before, as long as you know what you’re doing it’s really easy.

For the second option, it allows for a larger/infinite world because it’s loading in the chucks as the player travels. To do this, have two objects in the UI layer in the top left and the bottom right sides of the screen. (They should be farther from the screen to work the best). Now UI objects don’t have Ray Casts in their “Components” area, but you are still able to Import the behavior in and it works fine (A nice little trick I discovered a while ago). So the top left object will have a Ray Cast pointing UP and another one pointing LEFT. When the ray cast pointing to the LEFT does not hit anything load in a chunk to the LEFT of it (Some calculations are needed to make sure everything lines up properly, they should be relatively easy to figure out) That will make the map continue to the left, do the same for the ray cast pointing UP. Then repeat this for the other object but with the ray casts pointing RIGHT and DOWN.

If you need any more help feel free to @ me :llama:. I haven’t thought about this much until the ~8 minutes I spent writing this so there could be a slight flaw/oversight in these systems, so if you notice any just tell me.

(Btw I know you said you solved it already but

2 Likes