Post news RSS Dev Diaries: Ghost Lasers of New York

Hi, I am Olly, one of Nuclear Dawn’s two lead coders. This month, I’d like to talk to you about how the best things in life are those that you just take for granted every day, such as your sanity, and working power distribution systems.

Posted by on

Hi, I am Olly, one of Nuclear Dawn’s two senior coders. This month, I’d like to talk to you about how the best things in life are those that you just take for granted every day, such as your sanity, and working power distribution systems.

The most challenging aspect of Nuclear Dawn is that there are no hidden mechanics in the game. There are no magical buildings mushrooming out of the future’s scarred concrete soil, and no elves that come out at night and restock your ammo supplies.

Nearly everything with a physical presence has been represented and coded in-game, so that buildings are produced in actual factories and need to be placed, and deployed according to specific logistics mechanism. Ammo depots have to be restocked, and everything needs to be kept powered up, else the enemy are going to be ramming rockets down your throat before you can finish admiring the detailed, apocalyptic landscapes.

The most challenging aspect of Nuclear Dawn’s coding odyssey has so far taught me an important lesson: lasers are hard to kill.


The Empire uses relay towers to transmit power across its web-like base. Every Imperial forward base has to be placed within range of these towers, which use focused laser beams as a way to power everything from turrets to the gravity sleds that deliver new structures.

Each building can be powered up by more than one tower, every tower can be connected to the main power plant in a variety of ways, and after a few relay nodes are established, things can get pretty hairy with keeping track of everything.
The first shot we took at solving the Imperial power system resembled closely the packet systems that are used to route data through the internet, and while that solution sang to our coding souls with its clean lines and neat code, it carried way too much overhead and work to be made practical, and just didn’t have the kind of robust adaptability that we needed.

Second up, came a simple solution that was staggering in its magnificent elegance, and proved to be just as spectacularly flawed. The laser shows were pretty, but just a tad distracting, and more than a bit seizure-inducing.


Finally, we did what every good coder would have done, and cheated our way through it, by implementing a system that has each new structures send out messages for power, hoping that a relay or reactor nearby takes pity on it, and decides to grant its humble request. In this new system, the power grid is only updated when a structure changes status (such as when it’s switched off, or blown to bits by Consortium artillery barrages), and that keeps things nicely balanced between giving us the flexibility we need to update the power grid often, and just keeping it as is to reduce net overhead when the Consortium just can’t get their act together.

The catch? Of course there was one. For some devilish reason that had half to do with new code grafted on an older system, and half with the fact that all programming languages were basically invented by the devil, the lasers would not go off. The initial versions of our power system had permanent lasers that would just not die, even after both the power source and all relay towers in a mile radius had been obliterated. It made for interesting, albeit creepy forests of ghost lasers, which looked kind of pretty in the ghost town of old Manhattan.

That particular issue was solved, and now Imperial forces can safely use their lasers without fearing their ghosts, so that they only have to worry about those pesky Consortium forces and their Star Crush orbital cannons...

Olly, Senior Programmer

Comments
Varsity
Varsity

I wouldn't call that cheating. It's how electricity flows. ;-)

Reply Good karma Bad karma+1 vote
Post a comment
Sign in or join with:

Only registered members can share their thoughts. So come on! Join the community today (totally free - or sign in with your social account on the right) and join in the conversation.