The Unexpected: Quantum asteroids, replicating rocks, and Spaceships made of gas


Oftentimes in programming something weird will happen in your program and you'll initially have no idea why. Sometimes something weird will happen and you'll immediately know why, and sometimes something weird will happen but you won't even know it's happening.

For context, every entity in the game is made of components, and each component has an action to add another entity group upon its destruction. In the case of asteroids (which only have one component), they add a group of smaller asteroids when they've taken enough damage. In the case of ships, they'll add specific pieces of debris, or just get detached from the ship's body.

Here's a few of the chaotic effects of that system:

Crazy ship movement

Each entity-component in the game is made of a mix of molecules, determining mass and density. If a component has a lot of mass, it takes more effort to move it. If it has a higher density, it's tougher (though each molecule is also given a tensile yield strength for impacts). At one point, all the ships in the game started acting a little crazy, but all the asteroids and other entities were fine. I assumed something was off with the code for movement, but after much searching, I found nothing. After a little investigation elsewhere, I found that most of the ship parts were partially made from hydrogen when the data files specified titanium. In my wisdom, I'd decided to rename "Titanium" to "TItanium Alloy" in a data file, but neglected to change the molecule name internally. The game found no reference to titanium alloy, so just defaulted to the first molecule: hydrogen gas. 

Almost infinite asteroids

When a certain type asteroid impacted at high speed, it created a smaller group of asteroids as debris, but those were still travelling at speed and so impacted too, broke up, and the process repeated. An error in the data meant that there was a change that one of the smaller asteroids could spawn one of the larger asteroids, leading to a loop of thousands of rocks appearing, exploding apart, and grinding the physics engine to a halt.

Huge asteroid is removed and then recreates itself every frame

This one wasn't even noticeable since there was no visual tell: the surface of the base asteroid Ara is counted as an asteroid in the game's logic (as opposed to a building, ship, or structure). Asteroids are removed from the stage once they leave the bounds of the stage. In stage 2, Ara was slightly out of bounds, so it was removed, but then it left itself as debris (as is the default action for most options), but as it was removed and not destroyed it basically just came back.

Files

AraCore Astromining Ventures 2024-09-05.zip 44 MB
Sep 05, 2024

Get AraCore Astromining Ventures (demo)

Leave a comment

Log in with itch.io to leave a comment.