Yet Another Thing I Wish I Had Known Before Starting Ladon

The first time I decided to make Ladon was somewhere around 2010, I think. It was just an idea for a hobby project then. I was working full time at an engineering start-up and had a very small amount of time each day to work on a hobby project. I made some progress but abandoned it pretty quickly.

Continue reading “Yet Another Thing I Wish I Had Known Before Starting Ladon”

What Happens If I Actually Finish This Project?

I finished another really difficult chunk of work. Enemies can now damage your ship, the damage done is saved, and lots of bugs are fixed. It was so exhausting that I don’t even feel like going into all the details!

Instead, I just want to mention this incredibly insightful and somewhat saddening bit of wisdom that I came across:

Continue reading “What Happens If I Actually Finish This Project?”

The Trade-Off Between Realism and Playability

Everyone who has played Ladon, so far, has mentioned that it’s difficult to tell which way they’re moving. My initial thought on that was, “well, yeah, that’s what it’s like in space.” It’s true; there isn’t any way to measure velocity in space, unless there’s an object nearby. I hesitated to add the grid because I wanted the player to feel that enormous emptiness of space. In the end, though, having a game that’s fun to play is more important than having a 100% accurate simulation of reality. So the compromise I went with is a big glowy grid, which I can explain away as being generated by the ship’s navigation system, a hologram, yadda yadda. And for the realism purist, there’s an option to turn off the grid in the menu.

Try version 0.4.5.1 on the releases page.

Here be Dragons! Or Maybe Just Some Annoying Triangle Things

It took about a month to get all the “foundation” pieces built, like procedural generation and entity state management. With those done, I was finally able to add some enemies to battle. They are loaded and saved along with all the space rocks, using all that foundation stuff.

They can’t hurt you yet, because the player’s ship has no collisions and no hitpoints. But they’re fun to shoot at and they have a nice explosion effect. Mining and combat are the two big pieces of gameplay, and those are both working now. That’s a relief, but I am way behind schedule. The end of March will be the half-way point and this game is not half done.

Mine some resources *AND* blast some baddies in version 0.4.4.1.

Saving the State of an Infinite Procedural World

The last thing I got working was procedural generation of the game world. It will generate random rocks no matter how far you fly in any given direction, until the algorithm finally breaks down because the random seeds get too big (I really curious how far that is).

Now that I can generate the this enormous game world, the question becomes “How do I save the state of a practically infinite world!?” I obviously can’t save an infinite number of objects. I’ve peeked around a little inside Minecraft save-games, and I understand the basic approach used there. The world is divided up into “chunks” and only chunks that have actually been visited by the player are saved. No need to save stuff that the player hasn’t even seen yet. As a result, there’s no limit to how large the save-game can grow, but it only grows as much as the player roams around the map.

I decided to take a similar approach, but with a slight change that suits my world generation algorithm a little better. I only save the “diff” of what the player has done. Space is divided up into “sectors,” which are just square areas of space. As the player flies around, I generate rocks inside these sectors. But I don’t actually save any information about those rocks until the player does something to them (e.g. mines them). For example, if a rock is completely destroyed, I just add an entry to the saved state that says “rock 123 destroyed.” If the player ever comes back to that sector, I just generate all the rocks as I normally would, but when I come to rock 123, I skip it. Or if it has been partially mined, I’ll have some saved state that says “rock 123 mined, now has 500 hitpoints, next resource drop is 5 silicon,” etc…

So, the save-game can grow indefinitely, but it will stay about as small as possible. For now, I’m just saving the game in localStorage, which is essentially a browser cookie. I don’t think that will work as the permanent solution because localStorage tends to just randomly be erased. There are no guarantees about how much space you can use or how long it will last. The best idea I have for something better is to let the user download a save file and save it locally on their system. We’ll cross that bridge when we get to it.

Try out version 0.4.2.2. on the releases page. In this version, I’m currently saving any rocks that you completely destroy, any drops that you leave floating around (but their positions are all wrong), and your ship (where it is and what you’ve built).

How I Solved the “Far Lands” Problem in Ladon, Kinda

Minecraft veterans all know about the legendary “Far Lands.” This was where the game’s terrain generation would fall apart and the world would start to look like the image at the top of this post. I’m not certain, but I believe this has been fixed in modern versions of the game. It used to happen at a distance of about 12.5 million units (12500 km) from the center of the world, where the player is spawned. By some really weird coincidence, that’s roughly the diameter of the Earth.

Continue reading “How I Solved the “Far Lands” Problem in Ladon, Kinda”