Best practice for scene loading

jackatthekilnsjackatthekilns Posts: 1Member
in 2D

This may have been covered somewhere already, but I am working on an original Legend of Zelda clone and I am wondering what the best way is to handle all of the overworld screens. I have the camera moving with the player in a consistent manner to the original game. but something tells me having a 4352x1408 timemap with however many enemies is not the most memory efficient path.

Any thoughts or advice on how Godot allocates memory? I don't want to do anything convoluted if it won't make any difference from a memory usage standpoint.

Any help would be appreciated. I am just getting started with Godot

Comments

  • KequcKequc Posts: 121Member

    Have you tried the giant tile map? It's best to use the most straight forward simplest solution and then modify it where you run into problems. For example if it uses too much memory. At least I've found that's usually the best approach.

    I'll often find where I expect to see bottle necks, they are somewhere else entirely. Maybe all you need for example is to load and unload enemies across the map unless they are within range.

  • TwistedTwiglegTwistedTwigleg Posts: 2,831Admin

    Welcome to the forums @jackatthekilns!

    In addition to what @Kequc suggested, another approach you can take is break your world up into chunks/tiles by creating individual scenes that cover a certain amount of ground, and then spawn/despawn these chunks/tiles as the player moves around the world. I know this is how older open world games handle creating massive worlds (like the Elder Scrolls Morrowind for example). I don't know how easy or hard it would be to make such a system though.

    @Kequc said:
    I'll often find where I expect to see bottle necks, they are somewhere else entirely. Maybe all you need for example is to load and unload enemies across the map unless they are within range.

    Same here: I find that often what I thought was a bottleneck or performance issue in the code turns out not to be, and rather some other part is causing the issue. The worst is when you figure out that a part of the code you thought was optimized and clever is the code causing the issue :lol:

  • KequcKequc Posts: 121Member

    Especially because when you optimise code it's more complicated and so harder to work with. Bleh. Simplest solution first always.

Leave a Comment

BoldItalicStrikethroughOrdered listUnordered list
Emoji
Image
Align leftAlign centerAlign rightToggle HTML viewToggle full pageToggle lights
Drop image/file