Briley Witch RPG Diary – 10/06/2018

SprEd, My Sprite Editor.

A few things have happened recently while coding my C64 RPG, one of them being my own sprite editor, one I’ve (rather boringly) named SprEd.

I’d been meaning to code one for a while, ever since I started my recent C64 work, so I decided to stop work on the game to code one. Took me about 3 weeks to write it, but most of the work is done. Okay, so there are a few minor bugs, as well as a few features I’d like to add at a later date, but it’s functioning really well!

Since I’d already coded a character/map editor, I used that editor as the basis for SprEd. My character/map editor already had an undo/redo system, so all I had to to was cut out all the map and block editing functions and change the character editor into a sprite editor. With the basics in place, I could work on the rest.

I used code from the old block editor and turned that into a sprite set editor, so that didn’t take too long.

One feature I did need was multiple overlapping sprites. All the existing editors I’ve looked at only allow one hires overlay, but I needed more. I made SprEd able to use any number of overlay sprites, but limiting the display to show one base sprite plus up to four hires overlays. I figured that should be enough. Overlay editing does complicate the editor internally a bit, but it’s so worth it in the end, and I feel for the end user, the system I’m using is effortless. SprEd also allows independent multi-colours per sprite, so multiple sprite sets using different colours can be held in one file.

Next came the animation editor. At first it was going to be a later addition, but after a thought (while having a bath). I had a rather easy idea how to do it. SprEd is Win32 based (using my own custom windows library), so it occurred to me all I had to do was use the built-in windows timers. I could create a timer to trigger a windows WM_TIMER message every 50th of a second, and then update the animation frame counters, triggering a window refresh if an animation changed a sprite frame. Sounds easy, and it is!

For maximum flexibility, I use a system of adding sprite frames to an animation, utilising a film-strip idea to display the whole animation for editing. Frames can then be swapped, or more sprites easily added.

Another useful addition is multi-sprite editing. Most editors only allow one sprite at a time to be edited, a pain when you wish to edit an object consisting of multiple sprites. SprEd lets the user specify any combination from 1×1 up to 3×3. It could easily be modified to do 4×4, so I might add that at some point…

Not only does SprEd allow multi-sprite editing, but it also works with overlays! So it’s possible to edit a 3×3 object that uses any number of overlays per sprite.

Sadly, the animation editor doesn’t support multi-sprite frames (yet), but that’s on my to-do list for the future…

Okay, back to coding the game!

 

Advertisements

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out /  Change )

Google+ photo

You are commenting using your Google+ account. Log Out /  Change )

Twitter picture

You are commenting using your Twitter account. Log Out /  Change )

Facebook photo

You are commenting using your Facebook account. Log Out /  Change )

Connecting to %s