The last week has become an intense few days of refactoring Pixel Vision 8's core loading and exporting logic. I've been putting this off since I first migrated all of the code from Unity to MonoGame. I first noticed that my green threading
solution for parsing was failing on large images such as the tilemap.png when I was building Reaper Boy
during the last Ludum Dare game jam
. Early last week I realized that I couldn't move forward unless I addressed the root of the problem and that meant I had to rewrite all of the parsing logic completely.
Refactoring isn't easy to sum up in animated gifs. I only have a few this week. The challenge with good refactoring is that everything should work the same as it did before. But in the case of the parsers, I could easily isolate situations where a single png image would lock up PV8 for minutes while it tried to parse it. To combat the problem, I decided to add a new tool to PixelVision OS, the Image Preview Tool.
Here you can see the new Image Preview Tool in action. It's not very impressive, but it serves an essential function. Since PV8 games are primarily made up of text files and images, managing the later resource wasn't very easy. To keep the experience self-contained, I needed to build this tool. Case in point, if you are in a project and delete the game's data file, the Workspace Explorer no longer recognizes the folder as a game and reverts the colors, sprites, and tilemap back to png files.
Once I created this tool, it highlighted the issue PV8 has loaded and displaying larger PNGs. Long story short, I spend the past few days completely rewriting the core PNG parser from scratch. Now when PV8 loads up a PNG instead of turning it into a MonoGame Texture2D file I can then convert into a set of colors and color references, I parse the data directly into a format PV8 can work with quickly. The difference in loading time is night and day. And better yet, I was able to move all of the image parsings into its thread, so the UI no longer locks up when a tool is trying to load artwork to work with.
I'm getting close to my end of the month deadline for a preview build of PV8. I'm working as fast as I can to get it ready, but given the monumental task I set out to complete by rewriting everything from scratch, I may delay for a few more weeks, so it's ready. I know a lot of people are eager to get their hands on the new tools but trust me; you'll thank me for the extra polish and time I'm putting into it. I can't wait to share all my hard work with you!