Home > aen's Blog

Doodads

smee, build 4

Build 4 of SMEE brings with it four miscellaneous additions, including a toggleable grid, map zooming, a New Map menu item, and proper file picker dialogs for the Load and Save menu items.

Covering a full-fledged VERGE 3 map loader and all of its associated editing components turned out to be a problem larger than what I could comfortably produce over one weekend. But that's okay! There are many topics along the way to which I would like to devote individual discussions.

The most likely candidate for perhaps the next few days will be event-based programming and how better to take advantage of it in SMEE's codebase. As an application grows, there comes a time, which SMEE is fast approaching, when you need to start taking full advantage of the event-based model.

Instead of cramming all of your actions into temporary inner classes with excessive amounts of validation and repaint management, you need to start crafting classes which issue events and others which listen to them. It's a great way to decouple the actions you are taking from the code that triggers them, and can greatly reduce code duplication and increase maintainability (not to mention comprehensibility.)

If you fiddle around with the current incarnation of SMEE, you'll also notice there are speed issues at various zoom factors and map sizes. Optimization for speed will provide further interesting discussion.

After those two items have been given some attention, we can start getting into the more interesting aspects of a useful map editor. Multiple layers, a more comprehensive set of plotting tools, clipboard interaction, brushes... a lot of cool stuff. At some point we'll toss tile animations back in there too.

By the by, I found out what was causing such odd scroll pane behavior in Java 1.6! Apparently you can't override paint() anymore in your components without consequences. You need to instead override paintComponent(). The funny thing is I'd been doing it wrong all this time! I remember reading that paintComponent() was the proper way to write custom rendering code for components at some point, but apparently since 1.5 was lenient in that regard, I never made a habit of it.

You'll also notice none of the tiles in Build 4 of SMEE have transparency. I temporarily made them all solid after encountering some odd troubles with amazingly slow scrolling after plotting a few trees. Even when plotting the non-translucent tree. Perhaps there was a translucent pixel in there somewhere. At any rate, that will also get some attention when speed is covered.

More tomorrow!