Hello - hopefully I've posted this in the right spot.

I want to learn/migrate to Godot - and I'm coming from an OOP background - specially prior to this I've been putting small games together in Pygame.

I'm having trouble wrapping my head around when to divide various elements into their very own scenes. I'm going to have trouble even explaining what I'm having trouble with - so I'll ask some specific questions:

If I wanted to make something like Dwarf Fortress, or Rim World, or Minecraft..... a map is drawn using varying elements such as grass, dirt, fire, cement, water, etc. If each of these elements has different properties:

ie:
Water slows you down and can drown you. It can also be collected if the player has a bucket. Fire can damage the player if they don't own specific armor, and burns out after a time. Dirt can be dug out and will be replaced by an item called Dirt that a player could pick up.

-- do each one of these elements get it's own scene?

Although they are all - terrain or an element on the map, they are all so different.

In this case - would I make a scene for each and every type of element?

Would I do the same for items, npcs, monsters, etc?

I can make a mario typer player run through a level of sprites easy enough - but I'm really having trouble understanding the layout of a large game - any help greatly appreciated and I hope I asked the question clearly enough.

It is hard to say and really depends on how you want to structure your project. I have done a few larger projects with Godot, and I have found that the biggest factor in deciding scene/object structure is performance and personally preference.

Here are my thoughts based on what I've read. Please keep in mind I am not a Godot expert in any means, and what works for me may not work for you or someone else.


For general terrain rendering, you probably do not want to use a separate scene for each individual block/tile/voxel, as that would require instancing hundreds to thousands of nodes. While a couple thousand nodes may work, depending on what you are doing, it can impact performance due to Godot having to initialize and update each node individually.

For a game like Minecraft, you probably want to dynamically generate your terrain using Voxels and break the world up into chunks. Each chunk would represent a small portion of the game world, like 16x16x16 individual voxels. Then the chunk would handling updating and rendering the terrain.

There the Godot_Voxel module for generating several different types of Voxel terrains. I have also written a tutorial on generating Voxel terrain in Godot using the SurfaceTool. There are also a lot of interesting development logs/posts on social media if you search "Godot Voxel Terrain" that might be helpful.

For a game like DwarfFortress, you probably want to use a TileMap node for the world. If you want to have background/foreground tiles, then you will likely need to use multiple TileMap nodes, where each of the TIleMap nodes have different Z-Index values so they are drawn on different layers relative to the scene. Unfortunately, I do now of any references for this type of world creation right off...

Here are some references for 2D that might be helpful:


For handling things like fire, water, sand, etc, that is where it gets a little bit tricky and honestly I'm not sure what the best way to handle this would be.

For voxel terrain, I would probably generate an Area node and have voxels like fire/water/etc generate their collision shapes into the Area node. Then I would probably do a check if _physics_process that goes through every node within the Area, checks which voxel they at by converting form world-space to voxel-space, and then call a function that handles what happens when the in a certain voxel. It is not ideal and I'm not sure how feasible it would be, but that is probably the route I would take initially.

For 2D terrain, I'm not sure. I do not really do much 2D Godot development so I have little experience. For one of my jam games, Paralysis Platformer, I used a TileMap for the static terrain and instanced scenes for the Water, Lava, enemy spawner, and enemies in the game. That said, the levels in my jam game are fairly small and the terrain cannot be modified, so I'm not sure it would work when trying to make a game like Dwarf Fortress.


Making a game like Minecraft, Dwarf Fortress, or RimWorld is complicated and I'm sure the design structure of all those games changed as development went along. None of those games were made quickly and I'm sure the initial prototype/plan for the game and the finished result look very different.

I think the best advice I can give is to keep making games and see what works best for you. One of the biggest factors when trying to make bigger projects, especially if you are not used to it, is to not get discouraged! Game development is hard and takes time, experience, and lots of trial and error!

Hopefully this helps a bit :smile: (Side note: Welcome to the forums!)

I have a main scene that has a root controller object, canvas layers for the various visual effects/interface scenes to get plugged in and out of and a viewportContainer with my fog of war canvas, then I have things like Tilemap nodes that are separate, so i can load and switch out levels whenever. Same with mobs, skills etc. I find I run into less issues if I don't bloat the main scene and keep everything as separate scenes, or if it's stuff like skill/effect information I just keep those as c# objects.

If I could start my roguelike over I would have planned the save/load system and the main scene out a lot more carefully before I got too far. I've had to completely redo both.

I actually have no idea what I am doing though so I'm kind of interested to hear how other people keep things organized.

Thanks very much folks.

Twisted: I maybe should have mentioned for clarification, I'm doing all 2d, though I think my issue would be the same in 3d. The 2d minecraft link you mentioned will be helpful, thank you. I'll go through all of the links you provided in detail.

I don't think I have any delusions regarding how much sweat and time I'll need to sink into this - Starbound, Stardew Valley, Rimworld, and most of my favorite indie games seem to have taken around 4 to 5 years - and many of those guys and gals seem to have had a strong head start before they even began their projects in terms of programming knowledge. My plan is to just create a sandbox world for my own entertainment -- I've been going back and forth on different game engines for the last 10 years with mixed success on small projects - but it looks like to me - time invested in GoDot now can pay of later, even if it's years from now. It seems to do heavy lifting in the areas I have no interested in re-inventing. Thanks again, I'll read everything you link to.

Zoey: I do believe you are describing a scene manager, which I'm not good at - but will need to be. Your issue now with save/load is what I'm trying to avoid - I'd like to start off on the right foot, if that's possible with no hind sight.

3 years later