v0.0.0.33 - Power and O2 systems



Second update to  my prototype space station builder. Didnt think my initial upload needed a devlog post as was just a very minimal wall/floor construction really, and just wanted a couple people to test it.

However with this release, i've got some actual power generation from solar panels, which can be stored in batteries and that power now runs an O2 system.

Pretty interesting work, and quite a bit of thought needed on both power and O2. Here's a little run through of what i went through

Power - So my plan was to have connectors attach to walls, and then panels would connect to these and power would run through to the ship.  This was quite straightforward, until i needed to work out what was connected to see how much power is available.  Break down of my algorithm is a long the lines of:-

  • Find Connectors attached to walls - set to connected
  • Propagate through connectors setting connected, if next to connected
  • Find Solar Panels next to connected Connectors
  • Again run through panels setting connected

This worked until i discovered connector between panels, wouldn't be discovered, so an additional test is needed for connectors next to connected panels, and then run through the lot again!

So i then could add power to any batteries and use that for my O2 system. Wrong! Thinking about this if you are receiving power, it doesnt need a battery unless you need to build up a certain amount.  So available power is generated + stored, so that needed an update during development. 

Life Support - I probably shouldnt of started with O2 generation  as my first powered item (initially im thinking along the lines of droids as workers, they wont need oxygen!) but i had seen some ideas about how to do  o2 spreading over tiles , so  added a method.  At this point my life support system generates O2, fills the ship with oxygen and then stores any  extra.  

This is a little confusing, as what i would really want is O2 being generated from asteroid ore being bought to the ship (water/oxygen extractor?) and then put into o2 storage tanks and a life support system would actually be the pumping station / recycler / co2 scrubber component. 

In any case my initial life support system  if powered generates o2, which is pumped into the ships rooms until full, and then  excess stored. Couple of interesting issues to consider.

  • How to decide where to pump O2 - i went with calculating the average oxygen level, and pumping o2 to those lower (unless zero!).  
  • If a door is opened to space, and a room becomes low in O2, if we close the door but arent generating O2, then you would think that O2 from other rooms would eventually equalise. So i added in a method for that.
  • What happens if youve got no more capacity to store O2? There are lots of ways to handle this, initially i just went with continue generating (i guess the O2 is wasted/vented into space), but that doesn't make much sense. So i went with a low power mode, where O2 generation stops, power usage is reduced, but is ready to go back to producing/normal power if O2 needed.

If anyone has any questions, feel free to ask.

Cheers

Nick

 

Files

spacegame-v0.0.0.33.zip 9.2 MB
Jun 23, 2020

Get Deep Space Outpost

Download NowName your own price

Leave a comment

Log in with itch.io to leave a comment.