Sunday, August 9, 2015

Abiathar Online - Decompression and Rendering!

Today I finished up the decompression code for Abiathar Online. It wasn't terribly difficult, especially because I already had a working implementation in FleexCore2 and the ModdingWiki has a good description of the algorithm. There were a couple silly bugs in my first JavaScript implementation, but they were easily fixed with the Chrome debugging tools.

I then started on the tricky part, the rendering. After slapping a <canvas> tag onto editor.aconf, I started writing some drawing code. The new renderLevel method will be responsible for the drawing of levels and tilesets, but today I just wrote the level handling code. All the real work is done in the carveImage function, which carves an individual tile image out of the appropriate tileset and applies transparency as called for. That was actually fairly difficult to accomplish; it required tweaking image data with JavaScript. Getting the locations of tiles based on tile sheet width (i.e. graphics program) was fairly easy since I could copy it from Abiathar.

I have not yet implemented the infoplane hex composite part of carveImage, but everything else (background, foreground, infoplane icons) is rendering! Tomorrow I'll see about those hex composites and get level switching going.


No comments:

Post a Comment