Tuesday, December 5, 2017

Resource Networks


One of the core mantras I really want to come across in this game is the 6 P's (proper preparation prevents piss-poor performance).  Players who think through the design of their ship will always win versus players who slap a lot of guns on a box and hope for the best.  One of the most important factors in how a ship will perform in combat will be how well it can withstand damage.

Unlike most voxel-based games, damage to blocks will not necessarily make them disappear (this will only happen where a specific DR for the block is beat, mostly from very heavy weapons).  When the exterior blocks take hits, they will have a probability of causing damage to interior blocks.  This damage can include starting fires, bursting pipes, severing data links, causing atmosphere leaks, etc.  For example, if the communication link between CIC and a gun is severed, that gun will need to switch to local control (which will incur penalties).

This suggests that there are pipes to burst and conduits to break.  In order to provide the player the ability to build redundancy into their design (e.g. so a single hit to the wrong place won't knock out power to half the ship) I had to implement a system of piping and wiring.  This system is called Resource Networks

Foreground: Water pump (left), Fuel pump (right)
Background: Circuit breaker (left), Reactor (right)

In the images you can see a simple version of an engine room with its various connections.  These include fuel and water tanks, engines, a reactor loop (reactor, steam turbines, condenser), and pumps.

Every resource system tile (4 per regular tile) can have a conduit traveling through it in 2 of 3 directions (e.g. if a pipe it going lengthwise and widthwise, nothing can go vertically).  Certain types of conduits can also jump others on the same level, as you can see in the very center of the top image where the grey power cable goes through the red pipe.  I haven't implemented specific geometry to illustrate this jump yet, so right now they just clip through each other.

Equipment can have Resource Connections at positions in the grid.  These are divided into Sources, Sinks, and Storage.  Every tick sources output a resource into the net, and sinks consume that resource.  If there is more demand than supply, connections become starved and the block may stop functioning.  Special types of sinks with the "CanPull" flag set can also draw from storages.  A pump, for example, is implemented as a can-pull sink and a source, allow equipment connected to the output to receive resources stored in tanks they wouldn't be able to pull themselves.

No comments:

Post a Comment