Industry

Last night I decided that the Elite clone subgame is the most core part of this game, and would probably be the fastest to get to a playable state, and so, I started on it first. My code is sloppy as heck and full of #TODOs for if I come back to this post-competition, but I think I have the idea down. It's hard to balance ambition with the need to meet the deadline, but that's the whole point of a game jam, right?

To support the trading game, we need things to trade, so we need some basic simulation of industry. When the game starts, we generate star systems; star systems contain space stations, a star, planets, and asteroid belts. (Multi-star systems might be a postcomp thing.) The game picks a mass for the star randomly, and the rest of the system has a mass budget of 0.01% of the star's mass. We make planets until we run out of budget, and then dump the leftovers, if there are any, in an asteroid belt. The star provides energy, and asteroids and planets provide elements.

For now planets and asteroid belts are interchangable: the only difference is that planets are bigger. In reality, asteroids would have different materials (lots of water on Earth, not much water on asteroids... comets though...) and it'd be way, way cheaper to get stuff from an asteroid to a space station than from a planet in to space. I might get to simulating factories, workers, having to mine and launch and transport the resources, etc... postcomp. As it stands, atoms just sorta teleport on to stations and magically reconfigure themselves in to products.

Elements become raw materials, i.e. steel is iron and carbon, wires are copper, superconductors are yttrium, barium, copper, and oxygen, water is hydrogen and oxygen, etc..., and raw materials can be combined to make components, which can themselves be combined to make other components. Players (and hopefully NPCs, if I have time) buy and sell these. If I have time, I'll make manufacturing things take energy as well, so stars actually matter, but that's not necessary to get the game playable.
 
The amount of each element each planet/asteroid has is semi-randomised, and things are cheaper in systems where there are more of the elements needed to make the raw materials needed to make the thing. So, you can go to the system that got all the yttrium and buy fusion reactors, sell them in the system that got all the copper and gold, buy copper wiring and gold bars and take them somewhere else, etc etc etc. NPCs can do this too, so if those systems are right next to each other you won't be able to make money because there's a million other people who have the same idea; you have to explore and find where the good trade routes are. Assuming, of course, that I get time to implement NPCs.

In theory, we don't have to actually store any of this: store the RNG seed for each system instead, and re-generate everything every time you enter the system, like the original Elite did... but I don't think I need to bother with that for the competition version. No-one's gonna play this for more than an hour or so, they won't notice the memory leak. :P

I think I was wrong about the trading game being the fastest one to get playable...