Godot Version
4.4
Question
Hello, I’m new to Godot and I’m trying to create a simple incremental Idle Game to learn it. It will consist of different systems working together to create always bigger numbers, nothing fancy. It will be mostly UI based, with each system having its own UI section etc. All systems will mostly run concurrently, with let’s say a bunch of Timer nodes handling the generation of currencies or whatever these systems do. My current setup looks like this (simplified):
RootNode:
- Some global managers (currencies, save system…)
- UI (with a tab node):
- System 1 UI
- System 2 UI
- …
My question is, where is in your opinion the best place to put the systems’ logic in? Taking an example, my first system will be a simple battle loop, where the player character auto battles enemies, giving rewards upon defeating them. It will then have to include some sprites/animation/UI logic. The game logic in this case will be things like handling the attacks from both parties with timers, consequences of a battle, progression in this system etc. From what I’ve gathered, I can either:
- Have all the logic directly in the relevant UI nodes (but I’m not sure if having UI/game logic fully mixed is a great idea)
- Have the logic in a singleton in my game root and have the UI respond to it through signals (one or more per system)
- Have a mix of both, for example handling the characters attacks and their direct consequences in their nodes and having the more global logic in a system manager singleton
For now I’m thinking that generally the third option might be the most practical, and maybe the second one in some specific cases. If I understood correctly, it’s not an issue having some game logic in the UI in my case as long as all my systems’ scenes are loaded, so they can run in the background.
To continue with the same example, it would be something like this:
RootNode:
- Some global managers
- System 1 global manager(s)
- UI (with a tab node):
- System 1 UI
- Some UI
- Player (Sprite, Timer, Stats, Animation…)
- Enemy (Sprite, Timer, Stats, Animation…)
- System 1 UI
I would love to get some perspectives on this as I’m mostly designing this on the top of my head based on docs/tutorials. Let me know if anything isn’t clear. Thanks!