Looking for best practices

Godot Version



Hello everyone!

I’m reaching the end of developing my first game in Godot (very simple sudoku-like game).

I was intending to learn Godot this way (and I absolutely learnt a lot!). However my code is a mess, definitely not maintainable, not very scalable, tight coupling everywhere, globals everywhere…

It’s yucky!

I’d like to share with you some of the problems I’m still facing by the end of development and maybe you can point me towards useful resources to tackle those issues.

FYI I’ve been a professional Java developer for 18 years so don’t be afraid to use advanced terms ^^

#1: Tight coupling between objects
So I’ve done some research and it seems signals are the way to go, and the root tree should be the one connecting emitters and receivers is that correct?

#2: Loading time for the levels is quite long
I have a certain number of generated levels as text files (generated with some java code) that I import as assets in my game. There’s approximately 4000+ levels and creating the level selection screen is therefore quite long.
I think the time of creating each button for each level is what takes the longest time. Or maybe it’s the opening / reading of all the files?
I tried multithreading but failed to implement it correctly.
Any resources on this kind of problematic?

#3: Loading save games
To give the possibility to continue a puzzle, I save the state of the puzzle. I convert each object tile as Json and then save it.
The problem is when I load back the file, it is loaded as a dictionary. I’m quite used to Jackson libraries (auto converting from and back to Json / Objects).
Any similar mechanism in Godot?

#4: Code organization
This one is quite simple: how do you guys organize your files in the folder hierarchy? What is the best practice as to regrouping scenes / scripts / assets?

Those are the main questions that still remains (I have a lot more but if I could have an answer for those ones It would really help)

Thanks for reading!

Have you read Best practices — Godot Engine (latest) documentation in English

1 Like

Hey sorry I wanted to reply earlier but I’m still reading this documentation you sent me it’s really dense!
I’ll keep you posted if I found all my answers or not, thanks for the link though :slight_smile:

1 Like
  1. Yes, signals are the way to go to reduce or remove object coupling. Do not get yourself into the mindframe that the tree root needs to be involved in connecting objects. It does not. It all depends on the structure of your game.

  2. There could be a number of reasons for the delay, but what you typed seems like a reasonable place to look.

  3. I don’t use JSON, so I can’t help here.

  4. I organize by logical association. This is intentionally vague, as there is no single right way to organize. It depends on the needs of the game.