It’s Alive!

Troy Corbin Developer Updates Leave a Comment

Hello everyone. We’re back in the saddle after a two month hiatus. A lot of other obligations came rushing at me at once and unfortunately Angular Velocity just had to take a back seat.

While I have made a number of changes, none of them are particularly sexy. Here’s a breakdown of what I’ve done since we last spoke:

  • Major changes to the sound system. Angular Velocity runs on top of lwjgl which provides OpenAL support. Unfortunately the code I had written to interface with this ( Foley ) was buggy and inefficient. So I’ve taken the time to rewrite major sections. What we have now plays every sound when it’s supposed to and uses less memory too. Huzaa!
  • Major changes to the World class and Chunk management. Instead of keeping a rigid grid of chunks loaded in a multidimensional array as we did before, our chunks are now kept in a HashMap, dynamically loaded when necessary from a separate thread, with the beginnings of a garbage collection routine created. This will have a number of long term benefits, not the least of which is more efficient collision detection ( only testing collision with local chunks where before we tested against every chunk in memory per test ). In addition it provides more robust handling of missing chunks which CAN and will happen once we go multiplayer across the internet.
  • We can now load and save the world to disk! Previously the world was always dynamically generated every time we loaded up. Not true anymore!

In addition to that work, I’ve also completely updated my development environment. The hardware is the same, but we are now developing on the latest Eclipse Juno 64 bit release, 64 bit JDK with JRE 7 support, and I installed JVM Profiler which should help tremendously as we try to keep performance and memory usage minimal.

In fact, that profiler has already caused one change. I had been using my Vector3D class extensively for anything that needs X Y Z coordinates. While it was fine for that, it did come with a number of non-static functions for 3D math. Well all that code adds up in memory when you have several hundred thousand Vector3Ds loaded into memory. Often all that math isn’t necessary, especially when the Vector3Ds only job is to hold coordinates for a Tile object in the world map. So I created a striped down version called a Position that only held the three doubles X Y Z. In C this would have been a struct, but in Java it must be a class. This helped reduce memory usage. I also had the Vector3D extend Position making it easier to use them interchangeably.

Next on my To Do list will be finishing the chunk garbage collector, followed by separating out packages that will be common between the client and server into a shared library. I know it’s all boring behind the scenes stuff, bu most games are built atop a lot of this kind of work. Hopefully we can have some sexy new screenshots or videos for you before the month is out.

Troy CorbinIt’s Alive!

Leave a Reply

Your email address will not be published. Required fields are marked *

This site uses Akismet to reduce spam. Learn how your comment data is processed.