I’m unsure exactly how I would approach the creation of a city construction game. Or, more accurately, I have an idea, but I’m wondering what would be the most efficient method of doing so. Well, actually, there is another layer to the game that makes it a bit more difficult for me to figure out exactly how to approach it- The buildings will be run by NPCs with various stats and the stats of those NPCs will affect the output of the buildings. I’m unsure how to make this function as I want it to. Perhaps someone could point me in the right direction as to constructing this construction game?
Unfortunately, there’s not really going to be a tutorial or guide for what you’re looking to accomplish. However, from a base concept level, I’m pretty sure you can build the game you want.
My biggest recommendation would be to break down the idea into the base parts. Learn about/understand timers and build a test to make sure your city building can occur on an interval (or however you want it to occur). Figure out making NPCs with custom stats that behave differently.
THEN figure out how to combine them into the game you’re wanting, and you can eventually work on making them actually output things.
You can learn more about timers here: Timers [GDevelop wiki]
I’d think you’d want your stats to be stored as variables so you can change them if needed, so you can learn more about variables here: Variables [GDevelop wiki]
Well I’ve already sort of gotten it broken down into parts. The map won’t be randomly generated so I don’t have to worry about that, it is in fact the blending of the two that I need help with. Would I need to use nested variables? The method with which I planned to use for the monsters involved a slot variable with which to manipulate the storage functions such as saving the species value to “SpeciesMonster” + VariableString(Slot) and reloading the storage values whenever a different monster is selected but that won’t work here since I’ll need all of them at least partially loaded at any give time, unless, perhaps, the relevant stats of the monster toward the building and the monster ID are stored as variables in the building object… Is this an effective way of approaching the issue?
Child Variables (Nested variables) would probably be the best way to go, yes.
Something like “MonsterData” as the primary structure variable, with a child variable for each ID (so if you have Monster A, and it has an ID variable of 1, you’d then have MonsterData.1.HP and match up the ID varaible, so like, MonsterData[MonsterObjectName.Variable(ID)].HP to pull its HP)