Rendering of the in-game galaxy generation


A simple (not that that was what I was going for, but...) console-based hard-scifi space trading game. Buy things where there's lots of them, take them to where there's not, sell them there, fry anyone who tries to stop you with 100MW laser cannons.


Tar Bomba
Presented by rdb

Award Give While Waiting For pip to Install
Presented by wezu

award for the most required packages in a single game
Presented by speedlimit35

To boldly scope
Presented by zwerver

The James T.Kirk Award for Space Related Gaming and Exploration
Presented by ntoll

Give this entry an award


Ratings (show detail)

Overall: 2.4
Fun: 2.3
Production: 2
Innovation: 3

8% respondents marked the game as not working.
Respondents: 11


File Uploader Date
Rendering of the in-game galaxy generation
schilcote 2019/03/31 23:29
Competition version source - install dependencies with pip install -r requirements.txt
schilcote 2019/03/31 17:38

Diary Entries

Idea dump

This is all I have so far; hopefully this will clarify what I'm going for with this (for anyone who'se interested)

RPG battle system
Dungeon crawling that leads to the RPG battles
Space travel simulator that leads to the dungeon crawling
Spaceship management game that underlies the space travel
Relationship/management simulator /w crew that underlines the spaceship management
Space combat simulator that the space travel leads in to

So - six games deep, playing with six characters.


    RPG battle system:
        100% text based
        Largeish variety of enemies
        Largely inventory item based; it's sort of like playing Slay the Spire
        Or, make it XCOMlike?
        Yeah, I like xcomlike better
        Still can't draw it; could do ASCII-style
    Dungeon crawling:
        Maybe bring in that 5D stuff?
        See enemies coming, look like Pathways Into Darkness maybe?
            No, I can't draw that. Will have to be extremely basic because
            of unavailability of art.
        Theme it as space stations and ship salvage?
        Theme battles too, then?
        Given the change from RPG battles to tactical battle, maybe should be
        a boarding mechanic for the ship fights
        Boarding in ship fights, and salvaging after ship fights and random encounters
        If I get enough time, add narrative missions on stations/planets
    Spaceship travel:
        TEOS clone
        Fly to stations, buy and sell things, try to identify good trade routes,
        randomly get in to fights or discover abandoned stations
        Can buy systems and parts and fuel for the spaceship management
        Realistic economy, where NPC ships also discover trade routes and opportunities
        get saturated/fixed if you don't jump on them?
    Spaceship management:
        Ship is made of systems, parts randomly break down or are broken by fighting
        Can be fixed by crew or replaced by spares
        Oregon Trail like
        Random events with consequences for crew and resources?
        Also need to make sure you have enough food and fuel
    Crew management:
        Not sure what to do with this.
        Crew are involved in other systems (every other system?), they are the PCs in the tactical fight,
        provide solutions for problems in spaceship management
        Interact with NPCs through spaceship travel game?
    Space combat:
        Real time with pausing, like FTL
        Ties in to the spaceship management game, systems give your ship the ability
        to do things (weapons attack, shields prevent damage, armor absorbs damage, etc.)
        See ships on a screen flying around each other, some systems & accuracy of shots
        depends on relative position, can right click to pause (or slow?) game and bring
        up list of actions that can be taken; can right click on position and move there,

Add a comment


I had to visualize the galaxy generation, so I figured as long as I'm making images I may as well show them off. Here's what a galaxy with 10,000 stars looks like (the scale is in parsecs, by the way):
And with 100,000 stars:

I'm only 25% happy with the generation algorithm right now, but I need to stop messing with it and move on. I'm shocked I stumbled on something as good as this, honestly.

I'm holding off on deciding the scale of the game until I have more pinned down and can see how the performance scales; I can generate 100,000 star positions in a fraction of a second, but once each star has planets and stations and ships... we'll see. I mean, having a full-size 200 billion star replica of the Milky Way would be awesome, but overkill.

Add a comment


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...

Add a comment

"You can always get a good deal on a shipment of gadolinium in Ymizgafpabfilfaxtegwefekjwrrovkad."

This is another all-text post, so uhh... here's what the galaxy looks like now:

So, when I planned this all out, I had six things to do, and six days to do them (plus 1 day dedicated to testing & debugging.) So now, uh... step 1 is done. Mostly.

I was going to say I should have realized that generating element quantities and simulating things being made out of elements wasn't going to add enough depth to the gameplay to be worth the effort, but I'm not so sure after thinking about it... I think it just came out to bad luck, I made a lot of hard-to-debug mistakes that sucked up all my time fixing them, that I don't see any way I could have avoided. The biggest thing is that I should have wrapped the periodictable.Element instead of trying to make everything work with both IndustrialProductType and Element. That, and astropy's units handling; while it caught a couple bugs that would have been hard to find otherwise, I think the time I saved was cancelled out by the time I had to spend wrestling with it.

I think the minimum I can reduce the game to is the trading, space combat, and character interaction (the last being absolutely necessary to be considered on theme...) The trading is... done-ish, it should be a simple change to simulate metallicity gradients (elements heavier than iron are only created in supernovae, so planets closer to the core or in clusters around the galaxy, where there are more stars end up with more gold, platinum, etc.) which will hopefully add some level of strategy to it above "fly around till you find cheap stuff, buy it, fly around till you find someone who wants to pay a lot for it, sell it."

The characters are far from done but I think the hard part is complete, it's just straightforward implementation of the character creation menu, adding more text for them to say, that sort of stuff. Characters are hooked in to what I called the "interjection" system; characters can say lines in response to things that happen. So, for example, when you enter a system, a character who is an experienced trader will say "I've been here before, this system usually has a surplus of carbon, we should buy some plastic."

I don't think the trading game can be satisfying gameplay on its own, so... hopefully I can get the ship-to-ship combat minigame in before the deadline. In order for the ship-to-ship combat to work I need to implement ship systems, which is probably gonna take more time than I have. Certainly can't get it done and have a day to test. AND, hopefully, I can get a graphical view/controller working, so I don't have to submit the text-based prototype I have now. I guess we'll see.

Alright, last galaxy pic: this one took several hours to render, with 200 million stars; it's pretty, but it also really emphasizes the imperfections in the star placement code. It's concentrating a ton of stars at the beginning of the arms, making them brighter than the bar. Ah well.

Add a comment

Notes for reviewers

So, uh, a few notes:

There's no save system, so, uh, don't close the game if you don't want to start over.

Game requires Python 3.7.

So, I managed to completely break combat by accident; I made a last-second change 'cos everyone was way too fragile, and instead made combat completely stake-less. Too late to fix it now.

Really do read the readme, the game is a little bit obscure as it is.

Add a comment