• Projects
  • Planetary Defense - Colonization and defense, with a focus on infrastructure and transport

Early work in progress, but basic mechanics are playable.

Game Idea

The aim of this project is a large-scale, turn-based economy and transport simulation game with tower defense-like elements.

The player lands on an uninhabited planet and tries to build a well-fortified civilization defying planetary and extra-planetary threats.

Build and grow cities. Manage their surrouding's land use to produce vitally needed food and resources. Build a transport network to supply cities and military facilities. Repel asteroids, alien invasions and other yet unknown dangers.

Screenshot

Features

  • Grand strategy sci-fi empire building and economy simulation
  • Sophisticated procedural planet generator with elevation, climate and vegetation zones
  • Configurable planet characteristics
  • Macro-scale economy and logistics
  • Cities with automated of manual land use management and production
  • Multiple commodities: food, resourced, products and energy (TODO)
  • No storage of commodities: everything must be produced just when needed (i.e. static state economy)
  • Transport network with agent-based solver to mediate supply and demand on network with limited capacity
  • Almost everything needs supplies, so transport infrastructure is critical

Great! I love generated spherical maps :) And this one looks very sophisticated. Looking forward to see the further development :+1:

I couldn't figure out how to play (no workers) but it seems really cool. I like how smooth the planet zooms in and the stylized graphics. I know it's early, but it probably needs like an intro tutorial cause the game is quite complex. But it seems very promising.

I used to play this game called Nations at War, which is no longer online. It was all text based, I guess sort of like an MMO (except there were only like 100 of us playing, it wasn't very popular). Anyhow, the whole thing was based on resource management. So you could build a city, or as many cities as you wanted (if you had the money). You'd have to build factories, like to make metal or concrete or whatever. You could recruit an army and you'd have to feed your troops. Build tanks and planes and all sorts of stuff.

Then you could attack other cities and steal their resources. But it would be a battle and you could lose troops or your tanks, etc. And if your troops left your city, you couldn't send them all, since someone else might attack your city while you were gone and overtake it. And it was all real-time. So if you sent tanks to another city, they would have to travel the actual distance, it could take several days in real life for the battle to happen.

And you could form alliances. When the game was at it's peak I think there were 3 main alliances, and we would all fight. So you would private message people and coordinate an attack on a particular city. But again, you had to be careful because the world map was public. So everyone could see tanks and planes moving and prepare for an attack (or counter attack while you were gone). It was insane for a text-based game, no graphics.

Many thanks for the feedback!

@cybereality Thanks for giving it a try!

I also noticed that the very early game may be hard to get into. A tutorial would probably help, but getting started should generally be easier.

I opened an issue the explains the currently necessary steps.

@mlange-42 Didn't try it out yet but I will as soon as I get time. I'm interested in your generator :) But watch out with complexity and getting the player into the game. Couple of weeks ago I went on to try the EarthX demo, which is somewhat similar in concept and screenshots looked great, but the game lost me in about 10 minutes and I haven't returned to it anymore. A shame because I really like the concept of spherical maps... for some reason :)

Yeah, I think for something like this you almost want a scripted mobile-style introduction. Like have the player start with a reasonable amount of money, then highlight certain buttons, explain what they do and disable all other UI (and maybe dim it) so the player is forced to follow the script. It doesn't have to be long or explain every single button, but enough for them to get the idea and start playing. After the tutorial finishes, they will at least have their city, a road, a few workers, crops, or whatever, so it's not an intimidating blank map. This would be the way I would do it.

@xyz Would be really pleased if you gave it a try!

The game start difficulty is not primarily complexity, but the fact that two cities need to "cooperate" to take the first hurdle. So I think this is primarily balancing.

I will definitely have an eye on complexity. I want to keep it large-scale, and without much micro management. Therefore only 3 commodities that form a production chain (food, resources and products; probably later electricity). Automatic flow on the network that the player cannot influence direcly. Automatic worker assignment if wanted by the player.

The challenge to make such a relatively automated simulation a game worth playing is probably providing the players with the right information, so they can purposefully manipulate the system.

And of cource I know how easy it is to get lost in complexity as a developer... :wink:

Spherical maps are definitely interesting per se, but it is not for its own sake.

I definitely want to give the spherical map a meaning. I hope there will at some point be orbital defenses, space elevators, orbit-hopping aliens, or what not. And to a certain extent, I want it realistic. So no free cruising in space, as everything is tied to orbits as in reality (sun orbits are ok, too :wink:).

Gave it a spin. Pun intended. It's quite playable for this early stage.

It took some time to figure out the roads are essential as I didn't build any at first and my cities couldn't grow beyond 4 workers. I still don't fully understand how roads function. Is it all one big pool when connected or distances/routes play a role in distribution of resources? I also didn't get what exactly causes the population growth.

Here are some other remarks. Just writing off the top of my head

  • Little boxes that signify city area and/or structure placement flicker when there is overlap between cities.
  • It's not clear how airbase supply works. My bases just sporadically went out of supply and then aliens wiped out my desert outposts I installed with grandiose plan to extract oil.
  • If a city population is wiped out by an alien attack, looks like there is no way to revamp that city. It just stays empty. There should be a way to repopulate it.
  • End turn should be allowed no matter in what submenu you currently are.
  • When selecting another city the existing land usage button should stay pressed since you typically tend to distribute the same type of usage in succession.

All in all, it's enjoyable to tinker with although once you get the hold of things it doesn't bring any new challenges. As you already said, more of a simulator than a game in its current state. But it's still fun to go around the globe and plant new cities. Looking forward to see how it develops further.

Oh, and planet generator works beautifully.

@xyz Thanks a lot for testing and feedback! Great to see that you already built up quite a large city network, and seemingly found most features.

First for the feedback, then for city growth and roads...

Feedback

Little boxes that signify city area and/or structure placement flicker when there is overlap between cities

Didn't notice that for cities yet. I normally avoid it by different height offsets of markers, which is obviously not a good solution for markers of the same kind (i.e city). But a city could avoid drawing its borders when these cells are occupied by another city.

In the long term, there will be little factory geometries etc, and an outline rather than grey dots.

It's not clear how airbase supply works. My bases just sporadically went out of supply and then aliens wiped out my desert outposts I installed with grandiose plan to extract oil.

Each air base required 2 units of products per turn. I guess that you don't produce enough of them, which is also indicated by the orange city labels (not fully supplied). You can check this in the flows view:

Under "Products", the left-most number is the production potential, and the right-most one is the total demand. If the former is smaller than the latter, something will go out of supply (cities will have reduced growth if not fully supplied).

Another reason for an out of supply air defense could be used up road capacity, which seems not the case here for the defenses.

For how things are distributed spatially (i.e. what exactly goes out of supply), see the explanation on roads below.

If a city population is wiped out by an alien attack, looks like there is no way to revamp that city. It just stays empty. There should be a way to repopulate it.

Was not aware of that, thanks. Will either change growth calculation, or one worker always survives.

End turn should be allowed no matter in what submenu you currently are.

Good idea!

When selecting another city the existing land usage button should stay pressed since you typically tend to distribute the same type of usage in succession.

Sounds useful, too.

once you get the hold of things it doesn't bring any new challenges

Yes, it needs more challenges (like more structured attacks that come in waves, and all the other threats). Also, there should be more incentives to colonize certain areas of the planet, like your "grandiose plan to extract oil".

City growth

First, a city has to be fully supplied with food to grow (and for all workers to work).

The growth probability is then reduced by the share of products demand satified (which is population/2).

Growth is further reduced through: High unemployment (no growth anymore at 25%) "Crowding", i.e. the share of used land

Maybe it would be helpful to display the current growth probability of each city, potentially even with the contributing components.

Roads

The road network is an incarnation of a Multi-commodity flow problem. So flow from sources to sinks, along the network edges, which each has a capacity.

However, 1. The problem is solved stochastically, and imperfect (which is intentional) 2. Commodities can "spawn" other commodities when arriving at the sink (like a factory)

It is basically all done using pathfinding.

So we start with a network where each edge has a capacity, a cost (its length), and a flow of 0. For the solver, it is further necessary that there is only one source and one sink for each commodity. So there is a "super-source" and "super-sink" for each commodity, which are connected to the actual (game) source and sink nodes:

         Actual
         network
        .[*---*].
       / [   / ] \
 Source  [  /  ]  Sink
       \ [ /   ] /
        '[*---*]'

The edges from super-sources / to super-sinks also have a capacity, which reflects the potential production/consumption of each source/sink node.

The algorithm processes commodities in random order and each time tries to send a single "package" from the super-source to the super-sink. It does so by finding the least-cost path (which is the path with the shortest distance, at start).

After each package successfully sent, the flow of each edge used along the path is increased, which decreases the remaining capacity. Of course, nothing can be sent along edges that have no capacity left.

But now comes the trick: the closer the accumulated flow approaches the capacity, the more expensive the edge becomes for the pathfinder. Thus, later packages may take a different path. Note that this is all from super-source to super-sink, so the different path could use diffenent source and/or sink nodes, too.

Finally, the super-source/-sink edges also have a cost/length, which allows to adjust the fairness of distribution. Thus, not only the paths on the network become more expensive, but is also becomes more expensive to ship to a sink node that is almost saturated. This way, not only the closest sink will be served. And the same for sources (but this is not that important).

Note that the increased cost for the pathfinder on crowded edges is not reflected by the costs the player has to pay for transports. Those are just calculated from path total length.

You probably noticed the reddish color of roads, which indicates the share of used capacity (which is 25).

Hope this explanation is understandable...


Oh, and there is still a lot of potential to make the planet generator even more diverse.

Many thanks again for your very helpful feedback! Maybe I should put the above explanation somewhere into the docs.

@xyz said: Here are some other remarks. Just writing off the top of my head

  • Little boxes that signify city area and/or structure placement flicker when there is overlap between cities.

z-fighting?

@Megalomaniak Yeah, looks like it.

z-fighting?

@Megalomaniak definitely!

But I already solved it through rendering city borders as lines rather than points. This looks better anyway.

Screenshot

Imho the important thing regarding the supply flow algorithm is how much of it needs to be communicated to the player (presented as "game rules") and how best to do it directly in-game through gui. Have in mind that your player's initial concept of supply flow might not go beyond imagining trucks delivering goods from A to B at the start of turn.

In general, most of the things you've written in the answer to my questions should be communicated using visual means in gui, to a degree that's possible of course. If you're thinking to develop this into a serious product (either a game with more challenges, or a simulator toy), teaming up with a competent infographic designer in the future might be a good idea.

Line city borders work much better.

Btw I really like how mouse navigation is handled. Feels smooth and effortless. My intuition calls for inverted wheel directions, though.

Oh, and one suggestion for the atmosphere as it's a bit depressing to look at the black sky. Nothing fancy; just blend the background color between black and blue depending on how low the camera is.

@xyz Thanks again for your valuable feedback!

Did a graphics and usability initiative the past days, and also implemented all your great suggestions. It looks like this now:

(which also shows that lighting on the southern hemisphere is suboptimal, as the "sun" alwasy stays at the latitude of the equator)

It is now also easier to get started through some balancing of numbers.

Please find attached a Windows build for the this version. (.exe excluded, you can download it from the last release on GitHub). Upload denied.

For your latest suggestions: will add wheel inversion as an option added background color blending

Here is the changelog since the initial post:

Changelog

Added

  • Cheat to schedule an attack on a city for the next turn
  • Oil well land use for oil extraction on land
  • Geometries for all land uses and facilities
  • Pointer geometries and build indicator for setting land use in cities
  • Highlight the currently selected city by differently colored outline
  • Information on what is missing in messages for unsupplied facilities
  • Notification when a resource deposit is depleted
  • Sky color transition to blue when zooming in
  • Independent visibility settings for city and defense ranges

Changed

  • Moved the next turn button to the top-level GUI to make it accessible from everywhere
  • Keep selected tool when switching between cities in city management
  • Draw outlines instead of only vertices for all ranges (build, city, air defense)
    • Even draw bands with alpha gradient
  • Increase resource amounts in deposits
  • Make starting up growth and production easier:
    • Reduce number of workers for factory to 2
    • Let cities grow up to 5 without requiring products
  • Reduced maintenance costs for ports, air defense, roads and transport
  • Reduced basic city growth probability from 25% to 20%

Bug fixes

  • No more flickering city labels [#51]
  • Cities now regrowth after complete wipe out [#119]

Looking much better. Changes to the rules also sound good. I'll give it another go as soon as I get time.

Umfortunately, I could not upload the files. Not the time for a new release yet, but I will provide a download link the next dayt. Thanks again!

After the completely fresh graphics, I did a complete GUI rework over the weekend

The new ?Version 0.4.0? is now available for download.

Screenshot

The GUI highlight are:

  • Reworked, clearer layout
  • Icons instead of text where adequate
  • Most information now accessible in any GUI state (city stats, land use/vegetation information, production and finance stats)
  • All modes accessible from everywhere (e.g. jump directly from city management to build mode)

For more details, see the release page, or the CHANGELOG for a complete list of changes.

@xyz Thanks again for your feedback, it was a real motivation for the graphics and GUI reworks.

Played it a bit. It's much more satisfying now and I like the new icons. The main thing that bothers me is the constant need to switch between build and inspect modes. I think the interaction could be streamlined so there is only one main modality that unifies build and inspect functionality and reacts contextually... something to think about.

Some other thoughts and encountered bugs: - Maybe give airbases more range on high elevations, that way mountains wouldn't be useless. - Had a problem with road drawing: couldn't draw again on hexes the road was previously deleted from. - Do something about duplicate city names. It appears that node names are used and in case of duplicate names Godot will inserts its @name@xxx notation which looks ugly. Either disallow duplicate names, or add numeration. - When a port is built on a hex that's half sea half land it doesn't register as being built although the building is displayed. - At one occasion I grew a city but the old range outline remained alongside the new one (Pforzheim on the pic below) - Content of the bottom-left window that displays city status should be linked to the selected city as it was in the previous version. Otherwise you can't inspect it using mouseover tooltips, which is helpful at start when you try to figure out what the numbers mean.

Dang, the game just doesn't want to use the name of the only German city I've ever been in; Leipzig. Although it did use Halle in this last session :)

@xyz Many thanks again!

one main modality that unifies build and inspect functionality and reacts contextually... something to think about

I'm alreasing considering that, as it bothered me too.

Maybe give airbases more range on high elevations

This is a really cool idea! Goes to the TODOs...

Had a problem with road drawing...

Another tester had that problem too. Could not reproduce it so far. Comes on the list...

Do something about duplicate city names.

This is already solved and comes with the next release. No more duplicate city names in the automatic suggestions, and also prevention of custom duplicate names.

When a port is built on a hex that's half sea half land it doesn't register as being built

Hm, will also try that. However, there are (from the logic) no half sea half land tiles. the center is always either/or. It only appears like that due to the terrain mesh.

At one occasion I grew a city but the old range outline remained alongside the new one

That's strange, as each city has a single range node that is only altered, never added or removed.

Content of the bottom-left window that displays city status should be linked to the selected city as it was in the previous version.

Was considering that also, and is probably the better solution. Also goes to the TODOs.

Dang, the game just don't want to use the name of the only German city I've ever been in; Leipzig.

Cool, that's were I am based. And it is definitely in the list. A selection for the city name list to use (different languages, sci-fi names) will also come.

If you have detailed bug reports, issues on GitLab are warmly welcome!

As an update: currently working on better traffic visualizations. Here is an impression:

Screencast

Traffic visualization looks great. It really makes things feel alive. :+1: