Saturday, December 21, 2013

FMod - Just a Side Project

Time to start another large project! Now I have four ongoing: HigherPower (suspended until Forge updates), Logofrag (never made it to the add frag screen), NetBLAM (unsure where to go now), and this.

What's this? It's FMod: a total mod creator for Commander Keen. My vision is for this to be able to do all operations necessary to creating a Keen mod - tiles, levels, sprites, texts, behaviors, and other miscellaneous stuff. I really want this to just be a side project that I work on when I genuinely don't have anything else to do. Unfortunately, it will probably usurp all my free time like my other projects initially did.

Anyway, I started by creating a class for Vorticons-engine levels. Since it was essentially ripped from FleexCore, it wasn't that hard to write the original code. The trouble came when I tried to remove extraneous functionality and use streams instead of VB6-style files for the IO. I deleted a bunch of unnecessary code, cleaning it up quite a bit. In the process, I moved all the number-shifting functions (e.g. converting an unsigned 16-bit integer to a byte array for writing) to their own module, accessible to any class.

When I tested the new class, it worked - kind of. When it resaved the level, everything was shifted two tiles to the right. I had no idea what was going on, but continued adjustments to various numbers and addresses created a different problem. Tiles weren't shifted, but sprites were going completely crazy, having a million junk sprites covering the top half of the level, shifting the real ones down. It took a hex editor and Mindbelt to figure it out, but I finally noticed that I had forgotten to multiply the area by two in calculating the plane size. With that fixed, the test succeeded. It's very important to remember variable sizes.

Here we go!

No comments:

Post a Comment