How to store building, enemy, ... data? Use resources or not?

Godot Version

4.x

Question

I have a small 2D game where the player can construct buildings in multiple maps. These buildings can be upgraded or downgraded.
There are 3 types of buildings, which have their own specific character. For example: one building increases your defence, the other your strength, … and so on.

Currently, I have 1 scene “building”, in which I pass the type of building, and handle the rest in the linked building script. I then add them as nodes to my mainscene when building, assign the map the player is building on to the building, and last I add (save) them to a json file.

When starting the game, I load a json file which has all the information about the buildings stored, I iterate over it and place the buildings on the linked map.

Should I rather work with resources here and create 3 scenes (for each building type a new scene) or am I going in the right direction the way I’m doing it now?

They way I save / load my data: is it a good practice? I’m was going to link it up to Firebase, since I have a lot of experience with this software, and think this would be the way in Godot?

Same story for enemies: I spawn random enemies on the map, but each of them can have different stats… Should I work with resources or is the above mentioned way of development useable?

I’m trying to get it all clear in my head before going all in on development…
Thank you very much!

The explanation isn’t totally clear on how you construct your buildings. But I’d rather not get into the details and talk philosophy.

I assume you are here because you are unsure if your approach will hinder you later.

You have this approach and it works, and you are about to start expanding it, and here lies your concern.

Now, I would ask you how painful it is to expand? How hard is it to create different structures with similar features? Can you accept the current difficulties for such questions?

There are general principles (not rules) to software development. With OOP, as Godot is, you should follow the SOLID principles the first and most important being Single responsibility. Decoupling practices and modularity are great for avoiding a deadlock in game development. Signals and inheritance being your greatest tools.

That being said you will not easily learn to use these principles if you don’t encounter the issues they try and solve for yourself.

So if you think you can live with your code now, press on and learn as you go. Refactoring your code later is also a great skill to learn when the need arises.

Good luck