Make a Scene using Code

@Bouh yeah I have seen the wiki page and have done everything exactly like it says but really this only helps for the visualization of perlin noise not any real world creation etc.

Don’t make statements that you haven’t checked. I have a scene spawning about 700 tiles on start. The loading is almost instant.
Aside from that, generating a thousand scenes before exporting the game would just bloat it needlessly.
All you need is events to spawn your game elements on the go within predefined parameters (be they random or loaded from save).

@Gruk I have tested it! (to be fair my laptop is pretty trash not even having a graphics card and a intel celeron) I have tested it on my phone too and it took about 5 seconds for loading a 100x100
blocks scene so I don’t really know :grimacing:

Btw my phone is an iPhone 7

Could that be because of the way you are loading & creating your scene?

@MrMen Idk. I don’t think so. I have literally copied what is on the procedural generation wiki page, so I really don’t think so.

100*100 makes 10,000. :scream:
So if it took you 5 secs, that would mean 1 sec for 2,000.

Let’s not forget though 10,000 instances of 1 object with only 5 small images or less, with no behaviours and no complex calculations to complete for each instance at the beginning of the scene is not the same as 100 instances of 100 different objects with multiple animations, behaviours and complex calculations on each instance like collision, position and distance check to make sure the fishes are in the water and trees are on the ground and not inside the houses…etc.

So depends on how complex the objects and level generation is and the CPU of course, 5 seconds loading time doesn’t sound realistic to me unless you make some sort of 8bit game with some colour tiles only, it can more likely become 5 minutes in a complex scenario like Minecraft, Starbound, Terraria with cave systems, vegetation, cities, npc’s. collectables to make sure player can reach…etc

Creating 10000 objects with multiple behaviors and events are going to slow down the performance of any scene, regardless of whether they’re being randomly generated or not.

However, the loading time listed here doesn’t make any sense, as I can take the platformer example and have it create 10,000 new slime enemies at the start of the scene with random locations, and it only takes a second to start. Example video below. This is with an entire external event sheet worth of events attached to these object, including the platform character behavior.

Something with less intensive events (such as just world blocks, or events that don’t run every frame) should load even faster, and perform better.

However, if you’re going for true procedural generation in GD5, you will really need to do Minecraft style “World chunks” and not generate and/or display the entire world at once. Even in Minecraft’s case, on the new Xbox Series X, it still takes about 45 seconds to generate the world and load their initial world chunk. So I’m not sure what numbers are being expected here, but I wouldn’t expect miracles and beating out those load times.

@Silver-Streak well there is a difference between simple enemy AI and complex calculations for perlin noise and btw I am having the blocks 2 px wide and height (I know this is overkill) and changing the opacity of them based on what their value is in perlin noise using the extended math extension. So yea

No, not really. I’ve now done the same test with 10k objects using the Perlin/Noise Generation extension instead of RandomInRange(), and the load time is still less than 1 second.

Additionally, this is with still having the Platformer behavior on each one (which involves much more math than the perlin noise extension due to checking collisions/forces/etc every frame), and having the entire event sheet worth of events that check every frame.

So again, I’m not sure what may be going on for your use case, or what times you’re expecting, but it doesn’t seem to be anything specific to random generation or the engine as far as I can see.

1 Like

@Silver-Streak Well again I do have a very bad laptop with a processor from like 2014 which is a celeron so I guess it is my hardware issue probably.