Log In  


Cart #hofusewoni-9 | 2019-09-18 | Code ▽ | Embed ▽ | License: CC4-BY-NC-SA
4

You are the god of this planet, unfortunately your powers are limited to the control of gravity in this patch of the galaxy. Do everything in your might to keep the planet at temperatures that can sustain organic life. To guide you, the habitable zone of each system is shown in green on the playing field.

Remark: the solar systems are auto-generated from the seed given at the start of the game. I tried to make it so all generated solar systems have a good starting position, but if you encounter a particularly bad system just restart with a different seed.
Also: After hitting start in the menu, the game may take a while to actually start. The calculation of the habitable zone is not very optimized and takes a while, so just be patient, there's nothing wrong with your browser. ;)

Controls

in-game:
up/down - Zoom in/out
left/right - increase/decrease force of gravity
x - turn gravity on/off

menu:
up/down - change active menu items
left/right - change value of active item
x - press button

Post

Hey everyone, a few days ago I posted here in the WIP section a basic gravity simulation. At that point I wasn't sure if I'd progress much further on that, but since I'm on holiday at the moment, I actually got the time to sit down and turn it into an actual small game.

The goal is simple: keep the planet at temperatures where organic lifeforms can thrive for as long as possible. If your planet gets too cold or too hot, you fail and the game will tell you how long your planet survived.
To give orientation, the habitable zone of the solar system (where you essentially receive as much power as you're emitting and thus your temperature should stay stable) is calculated dynamically at the beginning of each game and plotted via green points. Keep the planet outside of the habitable zone and your planet will slowly cool down, keep the planet too close to the stars and it will heat up.

There are two main UI elements:

  • The slider in the bottom indicates the current strength of gravity via the red indicator. Left means low gravitational constant, right means high gravitational constant. It also doubles as an indicator whether gravity is active at all or not (gravity can be toggled via x), if the planet reacts to gravity then there is a blue background, if not then not.

  • The "thermometer" in the bottom right indicates the current temperature of the planet. If it goes all the way to the bottom, or all the way to the top, you lose. To the left of the thermometer, there's a second scale that shows your current heat up/ cooldown rate. If the red indicator is at the green position, you're essentially keeping your current temperature, if it goes below, you're cooling down and if it goes above you're heating up.

Additionally, the planet itself also kinda acts as a UI element, as it will change color based on how cold/hot it is.

In case you're curious: the "ideal temperature" in green is within the code calculated as 300 Kelvin (approx 27°C, no idea how many Fahrenheits, sorry), you lose if the planet gets hotter then 375 Kelvin (102°C, so basically the point where the water on the planet would boil away) or colder then 225 Kelvin (-48°C, no real reason why exactly at this temperature, I just wanted it to be symmetrical on both sides).

4


Very interesting "serious game" in a very cute package!

Do you plan to extend the simple gameplay mechanic ?
Is the game aspect complete?


This reminds me of Big Generations Orbit for Gameboy Advance, but with a different take on the mechanics. Good stuff. :D


@freds72:
Well, I would certainly like to extend it, I've got a few ideas on how to turn this into a more complete game. But in the end the codebase got quite messy (I have trouble planning for the "reset" after a game finishes when I start programming, so the restart function is now a mess. Deleting objects that would be garbage collected anyway and resetting global variables that I never should have altered in the first place etc.), so I might have to clean up the code first and with my holidays ending tomorrow and a very busy schedule coming up at work (lots of overtime, night shifts and weekend work coming up all throughout october), I'm not sure if I'll find the time for an increase of the scope.

@hseiken:
Funny you mention that game. I actually went back and looked at some footage of Bit Generations Orbit on youtube before coming up with a game mechanic for my simulation to check how they managed to make a game out of a similar theme. ;)


sure! not putting any pressure on scope creep!

your code base is quite good, you are already using functions to create objects. Just wrap all your global in a ‘game’ table and the reset/restart will be ‘free’.
Abuse of the lua GC!


@freds72:
Thanks, so you mean I should make a create_globals() function that generates a table containing all the global variables that then gets called upon _init()?

I'm mostly used to scientific Python programming, so I'm kinda writing my Lua code in a way like I would use my classes in python (though I didn't yet dabble with class inheritance in Lua, so I did not yet look into the metatable stuff).


yes (and no need for metatables).



[Please log in to post a comment]