this post was submitted on 28 Aug 2025
41 points (100.0% liked)

Godot

7009 readers
43 users here now

Welcome to the programming.dev Godot community!

This is a place where you can discuss about anything relating to the Godot game engine. Feel free to ask questions, post tutorials, show off your godot game, etc.

Make sure to follow the Godot CoC while chatting

We have a matrix room that can be used for chatting with other members of the community here

Links

Other Communities

Rules

We have a four strike system in this community where you get warned the first time you break a rule, then given a week ban, then given a year ban, then a permanent ban. Certain actions may bypass this and go straight to permanent ban if severe enough and done with malicious intent

Wormhole

!roguelikedev@programming.dev

Credits

founded 2 years ago
MODERATORS
 

After a bit of searching, I found that the best way to create an Area2d using a map was the built in function to create CollisionPolygon2Ds hidden in the "Sprite2D" tab. Took a bit of looking around to find that. After doing that, I grouped relevant territories together into Area2Ds (e.g. Australia + Tasmania, most of the Indonesia islands).

The only issue I have with it now is that it combines a bunch of the countries, particularly America (the continent) and Afro-Eurasia. It was pretty bang on for most of the islands though, see Australia, Japan, Madagascar, and New Zealand. Greenland got a bit of Canada so I'll need to fix that.

I've also made a small script that draws a Polygon2D with the correct map colour for . The default is red, so you can see that I have currently set America blue, Afro-Eurasia purple, the British Isles pink, Australia and New Zealand green (the latter being slightly bluer), and Japan yellow. These colours are just for testing and I think it looks pretty good.

I will probably find individual maps for each country and create collision shapes using those for the countries in Afro-Eurasia and America (i.e. almost all of them...). One thing of note, I have split the collision shape of Papua into West and East by duplicating it and manually deleting the points on either side, then putting each half into separate Area2Ds. This is obviously not feasible for Afro-Eurasia and America, but I might do that for Ireland to split the north and south.

One annoying thing is that I can't seem to select multiple points and delete them all at once in Godot. Anyone know what button to press to do that? Is there some sort of toggle? Another really annoying thing was adding the "territory(dot)gd" script to each and every Area2D, you can select multiple objects and remove their scripts, but not attach (you have to attach one by one...).

here's what my project looks like:

edit: replaced .gd with (dot)gd...just in case

top 6 comments
sorted by: hot top controversial new old
[–] M1ch431@slrpnk.net 4 points 1 day ago* (last edited 1 day ago) (1 children)

Awesome job. How are you intending the final experience to be - singleplayer or multiplayer like HOI4? Just curious, no need to promise anything.

[–] sbeak@sopuli.xyz 4 points 1 day ago

Singleplayer definitely. I'm intending this game to be a weird mix of HOI4, the cold war, and Pokemon.

[–] dontmindmehere@programming.dev 5 points 1 day ago (1 children)

I haven't tried, but there's probably an automated way to get countries shapes with openstreetmap https://wiki.openstreetmap.org/wiki/Shapefiles

[–] sbeak@sopuli.xyz 4 points 1 day ago

Yeah, there's a bunch of ways you could do that, including with OSM. Unfortunately, I don't think they, nor most map data providers, have data for the cold war era.

[–] goatbeard@beehaw.org 4 points 1 day ago (1 children)

Great work so far. Are you doing a provinces system like PDX does? Or just full nations? I want to make a similar game but with the ancient world instead of cold war

[–] sbeak@sopuli.xyz 3 points 1 day ago

Currently there aren't any provinces, I might try to do that at some point in time. Probably not though. This game isn't meant to be historically accurate at all, it's going to be a mix of HOI4 and Pokemon with turn-based battles rather than moving the troops on the ground. One goal I have with this game is to make it playable on controller, so moving divisions around wouldn't be fun with that. Pokemon-style turn-based battles were originally designed for a controller, so that's what I'm doing. It will also make my game slightly more unique :D