Not NaNo – Game Overview

This is less of a blog post and more of a scratchpad or notes about the game and the ideas for mechanics I’m implementing.

The basic goal of this game is a hex based hybrid between base-builder, tower-defence and RTS on an infinite hexagonal map.

Framing Device

While games don’t need framing devices, they can help to make mechanics less abstract.

I like post-apocalyptic science-fiction settings, so the game will take place on a world (probably not Earth) with post scarcity levels of technology. The planet was covered in a network of cities, and each city had a city core under it harnessing the planet’s geothermal energy and using it to transform matter into anything the population desired.
That is until one day the AI controlling things fractured into two AIs, the good AI and the bad AI. The bad AI started attacking everyone with hard light constructs (creeps) because it was forcefully uploading them to a simulation (or something, I’m still working on this).
The good AI was pushed back to a single city where the survivors were able to stop the advance.

Mechanics

You’re part of the good AI working on restoring all of those uploaded people and civilization. You do this by capturing city cores by connecting them to your network.

A city core produces resources you need: defences take energy  and a network connection to run, and require energy and materials to build. You can’t lose your first city core, and possibly other city cores.

Creeps can spawn on any ground you don’t control that is within range of a uncontrolled city core. Your city cores have a sizable area around them that is safe, which is the same sized area enemy creeps can spawn in from uncontrolled cores. Creeps won’t spawn in your safe area, and creeps can’t cross it to attack your infrastructure. Outside your safe city area, you can build protective buildings that keep the creeps from spawning inside their protected area, but creeps can still cross the area once they spawn to attack your protective towers.

To protect your infrastructure, you need to build defences. Towers that can shoot at the creeps.

As towers need energy and a network connection to run, you’ll need to build an energy distribution network, and your control network. Creeps will be trying to attack your energy distribution network, and infiltrate the control network. A successful infiltration of the control network will allow the creeps to either destroy, disable or take over the connected infrastructure (I haven’t decided which, will likely need playtesting).

In order to stop creeps from infiltrating your control network, firewalls can be built that will stop a creep infiltration attempt at them. This will require careful network design.

Weapons will be a mix of long-range (long-range, high-damage but slow), close in (short-range and fast) and AoE weapons (very short range, but always active).

RTS elements will include having units that can scout outside your area of control, though I’d like this to be optional. You can expand your control by pushing out your base and defences.

Further Mechanics

These are potential mechanics to add that may make things more fun, but aren’t necessarily required for a basic game.

Creeps can be pure energy creeps, physical constructs or a mix of energy and physical. Weapons will be able to disrupt one type of creep, but not both, so a mix of different weapons will need to be constructed. The creeps that are both energy and physical will need both types of damage to destroy, because one aspect can quickly regenerate the other aspect.

Network connections will have capacities. A trunk energy “pipe” may be able to move 100 units of energy, but a leaf “pipe” connected to a single weapon may only move 1 unit. This will add some depth and challenge to network planning. This would apply similarly to the control network, where buildings have a certain number of control points they consumer.

More complex types of connections, such as the need to build “switches” to convert from higher capacity control networks to lower capacity ones. Also wireless links, that are longer range and don’t require networks built in between, but are also much easier for an enemy creep to infiltrate.

Ability for networks to be over-provisioned, that is, you can build 20 energy worth of consumption but only build a 10 energy “pipe” assuming that you’ll never all of the consumption running at once. This leads to also having battery storage, to help smooth out over-capacity issues.

Special weapons, such as an orbital strike, or similar.

Fog-of-war, because the good AI can’t see everywhere without sensors, and the enemy AI sure isn’t sharing. City cores had some area around them that they can sense, units can see a short (or moderate distance, based on the unit) around them and sensor towers can statically increase the viewable area. When a unit or tower is destroyed, this information will be lost.

Possible Mechanics

This will need to be playtested to make sure they’re fun and the right level of complex and challenging.

Population grows in the cities, and taking a city allows you to restore some population. Potentially population is part of score, and you need to manage the population to keep them from contending too much for your offensive/defensive resources.

For score, I’m not a huge fan of scores, but they can be helpful to have an idea of how you’re doing at a specific point in time. So score might be population divided by time. This will it’ll always be in a range and not some ever increasing number.

City cores only produce a finite amount of power, material and control points at a time. They could be upgraded to allow more.

You can build resource production buildings independently of your city cores.

Weapon upgrades and some sort of research or tech tree.

Endgame?

It’s nice to have an end point, even with open-ended games, where you’ve essentially won. In Terraria, it’s defeating the last boss, in Factorio, it’s building that rocket and KSP it’s exploring all of the planets (Eve is probably the last one). You can play the game afterwards, but you’re “done” it and have “won” and can move on if you chose.

I’m not sure what that would look like for this game, but Terraria style boss gating may be a good solution. Have bosses or certain milestones that need to be satisfied to get access to the next tier of weapon or network connection, and then a final sort of boss after which the game plateaus and you’re just working to control all of the area.

Not NaNo Day 3

Today was working on buildings, my goal was to be able to place and remove buildings. Just displaying them and the underlying code needed to track them and state changes. Nothing actually affecting game state, yet, but they need to draw and be tracked before I can do that. Another issue I had, that I haven’t tracked down yet, is the buildings don’t seem to be respecting the Alpha settings of my PNGs, they draw black where they should be transparent. I know that this does work properly, because my selection cursors use the alpha channel of the PNG to set transparency.

Right now I can draw buildings on the map that are already generated along with the terrain, but the mouse code should make it easy to add/remove them. The A, B and two half tiles are placeholders for buildings right now in the picture below.

offset selection
The selection is definitely offset from the mouse. Picture on my laptop, with 300% UI scaling, the offset issue is even more pronounced than at home.

I’ve also been trying to figure out why my sprites seem to have extra pixels added to them, and I came across a Stack Overflow post suggesting that it was a pyglet (the OpenGL library underlying cocos2d) issue with image scaling. Disabling the autoscaling made my images look better, but the still don’t quite align properly. I still think the alignment issue is a rounding issue rather than a cocos2d issue directly.

autoscale fix
No more artifacts on the edges of sprites as they’re being resampled/resized, but they still don’t quite align properly.

I didn’t spend much time working on my game as I was participating in Extra Life today, playing games, rather than working on one.

Not NaNo Day 2

One of the main problems I had with Panda3D was around Z-ordering, because conceptually everything is in one layer, even if I wanted to draw things on top of each other and not deal with Z-ordering. And even when I got that figured out, it never quite got figured out, and resulted in some massive z-fighting happening. Even when it shouldn’t be. This was one of the main reasons I decided to use cocos2d, because it’s a dedicated 2D engine, with the ability to make sure layers are always rendered above other layers.

So once I got that figured out, and it took quite a bit of figuring, I was able to move on to other things. The first thing I started working on was mouse input. I was trying to have a selection cursor follow the mouse cursor, but I started working on making a hex selected when you click it first because it was easier to test. Unselecting the hex proved to be more challenging, but made sense once I got a better understanding for how cocos2d’s node graph worked. I needed to remove the old nodes from the graphs, and then I was able to properly have the selection follow my mouse.

cocos2d hex selection.png
The magenta outlined hexes were selected by mouse click.

So now I can actually interact with the map. Yay! This will be the groundwork for being able to build buildings, move units, and similar.

cocos2d hex mouse.gif
Hex hover and selection animation. It looks better on my computer, but WordPress seems to have resampled it. Created with ScreenToGif.

However, there are a couple things still bugging me about it, but I feel they’re more for a polish stage, rather than actually trying to get something working. Namely, the selection doesn’t perfectly align with the underlying hexes, and the hexes themselves don’t align perfectly, likely a due to rounding errors.

The second thing I started working on better generation of the map. As one of the things I want is an infinite map, generating it on the fly will need to happen, because it’s computationally (read: impossible) to pre-generate and store everything. My plan is to generate approximately window sized “round” chunks, try to reconcile the edges with their neighbours (which I’m thinking is going to be harder than I assume) and then add them to the ever growing map.

As an aside, I’d also like to blog some about the project I started in Panda3D, a re-implementation of SimCity 2000 for modern systems, with optional enhancements, and the reverse engineering I did to figure it out.

Not NaNo Day 1

My GitHub repo is called panda3d-game, because I’d originally intended to use Panda3D as the game engine due to wanting to get to know it better for another project. But I decided to not attempt full isometric right off the bat and rather do top down. Panda3D is a 3D engine, and doing 2D stuff with it was sort of painful.

First Hex Drawn.png
A single hex in Panda3D.

After fiddling with Panda3D, I decided to try out FIFE, but I couldn’t even get the examples running. I set myself a time budget of 90 minutes to get it working, and after I hadn’t, I decided to move on. Which is a shame, because it looks like it’d do basically everything I’d like it to be doing, and more.

In the past, I’ve looked at using Kivy/Kivent to do similar things, but it was a nightmare to get working properly, and after FIFE, I decided I didn’t want to sink more time into it. So I tried out the next choice, cocos2d. I was able to get examples running within minutes, so I decided to dive in further and see what I could come up with.

cocos2d hexes.png
Hexes in cocos2d, there are some alignment issues with them. The tiles don’t mean anything right now and are randomly generated. It sort of looks like Catan.

Within about three hours, I had some hexes displaying. I can’t scroll the view, and they have some alignment issues, but it’s certainly more progress than I made trying to bludgeon Panda3D into doing what I wanted. We’ll see if this ends up being the right choice.

Not NaNoWriMo

I’ve done (and won) NaNoWriMo 8 years, including most recently in 2017, but I’m not doing it this year. It’s harder to prioritize it when I know I can do it (including 100k+ words in 24 days in 2011), so I decided to take the spirit on NaNo and apply it somewhere else.

So, given that the point of NaNoWriMo is to write that novel you never quite get around to writing, I decided to work on a game idea I’ve had bouncing around in my head. My goal it to get at least a playable prototype done. The graphics won’t look good and only the basic mechanics will be there.

I loved the Command & Conquer series of games, and always found myself more interested in building bases than the combat. And Creeper World 3 was mostly about building bases to take out the creeper. But they’re always on limited maps.

So what I want in a game is some sort of base-builder/RTS/Tower Defence hybrid. Right now I’ve got some general ideas, including a science fiction setting, and that I want it to be hex based.

I’ve got a post that I’ll update as game mechanics evolve, but it’s mostly notes and thoughts rather than a full-fledged design doc right now. Find it: here.

Work in progress on GitHub.

Part of the spirit of NaNo is that public word count, so I’m going to publicly document my progress on this blog. Included at the end of this post is links to each day’s update, which I’ll try to keep doing.

Updates Index

Game Overview

Day 1

Day 2

Day 3

Day 4 / Part 2

Day 5

Day 6

Day 7

Day 8

Day 9

Day 10

Day 11

Day 12

Day 13

Day 14

Day 15

Day 16

Day 17

Day 18

Day 19

Day 20

Day 21

Day 22

Retrospective

 

Blog Intention

I don’t really have an intention for this blog, mostly I’d like to document personal projects, mostly technical in nature. This may be electronics, or programming, or something else.

I’m also likely to post some pictures I’ve taken, mostly of birds. The header image is of a Hairy Woodpecker, near Kimberley BC.

DSCN9885.jpg
A Barn Swallow, taken in Denmark.