Minicraft Mod: Teleporters

It lives!

Yes, this blog is not dead. I have simply been doing loads of stuff and was way too busy to write about them. Just to give you an impression, I spent between 3 days and two weeks a time in 7 different countries in between this post and the last one…

But this post comes back to the core of this blog. In some small pauses in between all the other things I have started the idea of small programming projects on the side again. And to get into this again, I decided to make a mod of Minicraft, the Ludum Dare entry of famous Minecraft-developer Notch. After finishing Portal 2 recently (I didn’t get around to posting it – I loved it!) the simple idea was to add a teleporter object to the game. Here’s how it looks in the game:

Minicraft1

After building a teleporter (or GATEWAY, as the number of characters your item name can have is pretty limited) by combining 5 iron ingots and 2 units of glass), you can deploy it in the world. After you have deployed a second one, they are connected with each other, and using one of them will teleport you to the location of the other one. (Adding more teleporters will make the first one disappear.)

A couple of small notes from this project:

Notch seems to be opposed to the idea of comments. The only comments I can actively remember are commented out parts of the code. On the upside, the code is relatively clear, so after some prodding around and taking the bump of finding out how positions and orientations are saved, adding the rest of the code to the class hierarchy was straightforward.

In general it’s interesting to read other people’s game code, especially for a 2D game. I’m planning to do this more often, especially with source code to several interesting games available (including the other recent Mojang game, Catacomb Snatch).

The only part I couldn’t figure out from looking at the code alone is the way colours are implemented. Especially since the code leads you in the wrong direction when you first look at it. This blog post by mrspeaker helped me a lot there.