ID:1909110
 
After going through what feels like a major reformatting of my brain, I have a different look on programming. And I have made a thing!



This was pretty easy to pull off. All terrain in the world (derived from /turf) contani a variable called "autojoin_icon." When the terrain's autojoin() proc is called, it looks for similar terrain around it with the same autojoin_icon. It then changes its icon_state depending on the adjacent terrain using bitwise addition (north=1, east=2, south=4, west=8).

The terrain then calls refresh_autojoin() on the adjacent terrain (instead of calling autojoin() because recursive loops are a huge no-no). This simply sends a number to the adjacent terrain to refresh its state by adding it via bitwise OR (icon_state of 2 (10) | 5 (101) = 7 (111)).



My, how you've grown!

What Cosmos is doing is iterating to a different terrain each update tick. It then does a little check to see if the current terrain (by default "stars") has any rubble (the rock) next to it. The chances of it becoming rock are strengthened by the adjacent tiles. By default stars have a 0.10% chance of becoming rock from nothing, and an 80% chance of becoming rock if the north and east tiles are rock. The reason why I didn't include the south and west tiles is because it could affect the next tile in the iteration, causing long vertical or horizontal strings of rock.


Things looks a bit different now. The crust and rubble are the innards of the top layer of a planet. Lava exists below (using the auto-join feature akin to the rock, using its own autojoin icon).

The idea for this game was to be able to leave a server running forever and allow the game to replenish supplies and stuff without any administrative interaction.


I had originally thought for this to be a mining game in space, but it feels more cool to have it set on the surface/crust of a planet. Three ship graphics exist to show three different vehicles a player could man for exhibitions:

* Shooter - Move/Shoot in any direction, sensitive to crust edges and cannot land appropriately.
* Lander - (Lunar Lander style) shoots directly downwards and uses an accelerometer to keep itself upright.
* Rover - Can glide across the crust without getting damaged. Can shoot horizontally.
Looks awesome. I love the grainy lava.