Posted November 08, 2018 by PhobosLabs
#postmortem #Unity #Unity3D #3D #Game Development #Game #Development
Surviving Mars was created in 7 days for the 7DFPS game jam. I used Unity to create this game and a host of asset packs to speed up production in time-intensive areas as I was working solo. I will list those assets below.
My goal was to create an interactive experience of trying to survive on the surface of Mars, stranded and with limited resources. I wanted to simulate the struggles that existing on an alien world could pose in a semi-realistic way. I was inspired to make this after watching the TV series MARS on the national geographic channel as well as from reading The Martian. The side goal was to have no guns, at most only tools you’d use to repair things.
My initial concept was to simulate the basic survival requirements and the depths of simple tasks such as breathing. Those goals were:
The next goal I had was to simulate having a livable habitat and managing the intricacies involved with that. These are the goals I had for the habitat:
My final big goal was the need to explore Mars surface to scavenge resources scattered around the landscape to make sure you could survive as long as possible.
For simulating breathing I looked online to figure out how often a person breaths per minute, then figure out the amount of oxygen consumed per breath and co2 created per breath. And average adult at rest breaths between 12 and 20 times a minute. Per breath, a person breaths in 20% oxygen and breaths out 15 % oxygen, a consumption of 5% and converted to CO2.
My simulation update would happen every second rather than every frame, so I needed to convert all this down to simpler numbers to use in the simulation calculations every second. I figured a person would take .2 breaths per second and simplified the oxygen and co2 into what I referred to as ‘units of air’ so that every breath consumed 5 units of o2 and created 5 units of co2, which meant for each update tick 1 unit of o2 was consumed and 1 unit of co2 was created.
I added multipliers to be applied when the user was walking or running on top of if they were exerting themselves by carrying something. Walking had a multiplier of 1.15 while sprinting had a multiplier of 1.5 and exertion had a 1.25 multiplier. So if the user was sprinting while holding something they would consume 1.875 units of o2 and create 1.875 units of co2 per update.
The next part of the breathing simulation was having a supply of oxygen to pull from and an equippable CO2 filter for you suit that would degrade over time. The CO2 scrubber could only remove 1.4 units of CO2 per update tick, so running meant you would slowly build up CO2 in your suit and had to manage that as well as your O2 supply.
I used these same calculations for the habitat as well, just applied the source of o2 and co2 to the habitat.
The habitat started with a certain amount of O2 already in the habitat with no reserves of O2 and no CO2 filters installed. Power was only used if there was CO2 that needed to be scrubbed and O2 that needed to be added to the habitats atmosphere. If you were not in the habitat, power wasn’t pulled for use of those components and wouldn’t drain the battery unnecessarily. The base passively consumed 1 unit of power per update tick. Each area only drew 1 unit of power each to simplify it down.
A big goal of mine was to have an interesting and interactive way of connecting solar panels and power supplies to the habitat that was more than just inventory based management. It took some doing but I created the system where you could grab the plug off the back of the power supply and walk and plug it into the base. You could connect up to 6 power units, each produced 1 unit of power per update tick. Thanks to the simple time of day calculations I did, when it was night the solar power’s power generation dropped to 0. The power generators produced 1 unit of power as well but they worked during the night so they were superior and worth finding.
Finally, I created random item generators that I placed around the map that would create loot boxes containing randomly generated amounts of food & water or filters & air canisters. I also created random solar panel / power generator spawners. This would create a more dynamic play experience as the survival struggle would be different for each player and one may struggle with low food supplies and not enough habitat O2 containers while another might have a whole bunch of habitat O2 containers but not enough CO2 scrubbers.
Towards the end I added in a rocket ship that would spawn after surviving for 7 days, and reaching it would win the game.
My final task was adding in some HUD notifications such as the ship had landed, and that hitting Q would toggle your suits atmosphere on and off while in the habitat. At the last minute I added in a paginated tutorial guide on how to play the game as early players had no idea what the controls were or how to interact with the world which made playing nearly impossible.
When I began the project I was planning on making all my own art / 3D models but quickly realized I would end up spending all my time making art and would end up not having any actual gameplay to show for it. So I turned to the Unity asset store to help me out. Some of the assets I used were: