There’s a long list of things I’ve done to the game this week. It seems like now that the hard stuff (networking, the core of the engine, etc.) has been done, I can add features at a rate of about one per day.

These new features work seamlessly on networked multiplayer.

Loading screens

Loading screens appear while the game is doing something in the background and the view is waiting on it - e.g. when reading save files, or retrieving a scene from the multiplayer server.

Player death

I finally made it possible for the player to die! When this happens, the save menu shows up:

Fall damage

The holes in the ground work now. Most mobs that fall into them die, but in the case of the player, the mob is moved back to where it first appeared on the screen and takes some damage.

Breakable tiles

I added a new tile to the map that the sword can interact with. Bushes can be cut down, and stay cut down while there is a player in the scene.

Map-editing tools

I implemented one of the map-editing tools I’m planning – the Diamond Pickaxe. This clears the data for the tile it is pointed at, destroying rocks, bushes and holes. Unlike the sword’s effect on bushes, the effect of the pickaxe is permanent.

Performance

I made some improvements to performance by caching colorized sprites and tiles.

All graphics are designed in grayscale PNG images, and these are colorized on the fly by the code. This seems to be quite common in NES and Gameboy Color games, and it allows you to use the same resources for different entities - e.g. dungeons can use the same tiles but be colored differently, and differently colored enemies can use the same sprites.

The problem with doing this in Java is that the best way to do it is to write a custom BufferedImageOp, which is quite slow. Actually, I can still get hundreds of FPS with BufferedImageOp, but there seems to be some unpredictable lagginess at times when limiting the frame rate. Caching the results of the custom filter smooths this out completely.

I also experimented with Java’s BufferStrategy, but this seemed to be much slower than my own double-buffering (presumably due to the weird way my threads and locks are set up).



blog comments powered by Disqus

Published

25 February 2012

Tags