Godot Version
Godot 4
Question
So I am making a game where a player has control of a certain territory in a map but I don’t know how to actually implement that. I also want the player in that terrain in 2D to have the ability to control military divisions like tanks to invade other countries in the country/terrain they chose. Can you guys help me implement these features?
That seems like a tall order… So I’ll just give you some hand wavy direction.
You will need a data structure to keep track of what countries a player owns. It is probably going to be a global data structure so there are no conflicts between two or more players that say they own a country. The country itself could have that responsibility of who owns it.
For military units these can be spawned as children of the player. ownership can be tracked through the tree they reside under. But also can be convenient to also store ownership within a base class of the unit.
1 Like
But how would I split the territory and specifically mention that territory to be controllable for the player on a map? Thanks.
Idk… what is the territory? Is it an image, is it a polygon? Is it a square on a grid map. Is it a text field, is it a number? Is it a sprite?
How do you want to control a territory? Can the boarders advance and shrink? can a territory move (floating territories)? Is there a theme change?
We need details about how you want the game to look and act. We can’t see into your head.
I probably won’t be much help, I’m not interested in writing your game for you.
Anyway here is the first thing I found on YouTube.
I’m a bit unexperienced with the Godot engine but thanks for trying to help
1 Like
I would suggest then to get use to Godot via an existing tutorial, get used to reading the documentation ( the editor has nice a built in doc search under the scripting tab).
Here is a project of risk if you want to take a poke around with how they do things.
Game making is not easy and there are infinite ways of doing things. Just be clear with your needs in a very detailed manner.