Friday, May 26, 2006

Friday 26th

Took a slight diversion from FishEd today, in order to start working on... FishEd. The Blitz Max version, that is. :) With work on FishEd coming to a close, naturally I've been thinking about what comes next, and with Max sitting idle on my hard drive, I was intrigued to see how much of a task lay ahead; after a couple of hours work, I already had the main window, tabbers, panels, and menus implemented, and it was only a few more minutes' work to get maps loaded and displayed.

While this may seem frivolous (especially as there are bugs to be fixed and docs to be written!), I'm hoping that the next evolution of FishEd will very quickly replace the current one (i.e. people who purchase version 0 will receive a fee upgrade to version 1, the latter being written in Blitz Max as opposed to Blitz Plus). In other words, I'd rather get the Max version up and running than continue to maintain the old version.

The Max version will be faster, smoother, and more powerful, and already I see the potential for more flexible zoom functions, layer transparency and tinting effects, and even enemy placement and so forth. Additionally, I also want to make FishEd available to the Mac community, which is something I can do very easily with a Max version.

Thursday, May 25, 2006

Thursday 25th

Polished off the I/O code today, including all the relevant variables in the Project Load and Save code (a fairly painless process now that I have a system worked out). Once this was done, I set about stripping out the redundant I/O routines ready for the Demo Version. It seems quite strange to finally expose the Editor to the outside World (even though, ironically, that's the whole point of writing it). All that now remains before release is Undo/Redo code, some tweaks to the MiniMap system, bug fixing, and general tidying up and optimising. There's even a chance I might get this done by the end of May; famous last words, I know... :)

Wednesday, May 24, 2006

Wednesday 24th

Today's tasks involved some pretty laborious work, as I needed to sift through the New Project code and the Project I/O code to ensure that all relevant variables were being initialised, loaded, and saved (I'd added a bunch of variables after the code was written, plus I'd noticed a few variables not being set/saved properly). This was a somewhat lengthy and tedious process, but exposed a few bugs and tweaks which needed to be rectified.

Now that I'm pretty close to releasing a Demo Version, I set about tidying up some of the interface loose-ends, mainly adding keyboard shortcuts to the menus and finalising some of the keyboard controls. As a result, I ended up restructuring my Control routine, adding a few extra checks to ensure that the code handles a standard keypress, Shift+keypress, Ctrl+keypress, and Shift+Ctrl+keypress properly.

Tuesday, May 23, 2006

Tuesday 23rd

Tackled the Brush Thumbnail system today, as there were still plenty of issues with several routines. The main problem was, what if the program tries to load a Tileset (as part of a Project file) but cannot find it? Ordinarily, after loading the Tileset, the thumbnails for any stored Brushes need to be calculated - this isn't possible if the Tileset isn't found. Plus, what happens if a Brush Thumbnail is defined, but then the user elects to close the Tileset?

Essentially, when a Brush is grabbed from a Layer and stored in a buffer, the thumbnail is generated from the Tileset assigned to the currently-selected Layer (and thus, each thumbnail could potentially be from a completely different Tileset). However, if the Tileset isn't loaded or gets closed, no thumbnail exists and thus, errors creep in.

The first task was to therefore add an array which tracks which Tileset was used to generate the thumbnail. Next, I added some checks to the thumbnail display code, which prevented any un-generated thumbnails from being displayed (along with an appropriate "Thumbnail Error" message). Next, I tweaked the thumbnail routine so that I can tell it precisely which Tileset to use (up until now, it had assumed the same Tileset). And finally, the Load Project code required a few tweaks to integrate these various checks and trap any errors.

The upshot of all this extra work yields the following results; a Brush grabbed from a given Layer and subsequently stored will generate a thumbnail image only if a Tileset is loaded - if not, the Brush is still stored, but an appropriate message is displayed. Should the user close a Tileset used to generate a thumbnail, again an appropriate message is displayed in place of the thumbnail. And finally, when the user loads a Project FIle but a Tileset is missing, any associated Brushes are loaded but not displayed. In any of these instances, as soon as a Tileset is loaded into the right spot, the thumbnails are generated and the error messages disappear. Phew!

Needless to say, today's session was very intense, and what I term an "out of your seat" day (i.e. you spend more time pacing and drinking tea than you do at the keyboard). Thankfully, it nudged me ever closer to getting the Editor out of the door, and threw out a couple of nice tweaks I want to include after Beta.

The final task of the night involved a few tweaks to the Drawing Modes, as I'd neglected to include error trapping if the user, for example, chooses Line Mode while in the middle of drawing a Box. Thankfully, this was as easy as clearing a few variables, and as an added bonus, it's rather nice to be able to change your mind after starting to draw something.

Monday, May 22, 2006

Monday 22nd

The past few days have been spent bashing the docs into shape ready for the release of a demo version (which will hopefully be within the next week or so). I'd already compiled a huge amount of information, but as I'm planning to put the documentation online, I needed to transfer the docs from Word into FrontPage (this has the added benefit of allowing me to style the website exactly like my Scary Fish website, for maximum consistency).

One of the interesting things about writing the docs is, you tend to forget all the tiny tricks and neat touches you struggled so hard to include. It also highlights additional ideas for areas that may have room for improvement, and helps to flush out obscure bugs.

One such problem surfaced today; when a Layer is flipped, the user is always prompted with a warning that the action affects all Layers when, in actual fact, it doesn't. This prompted the idea of including a menu option to specify whether or not the Flip/Rotate commands affect just the current Layer or all Layers (aside from to 90-degree rotations, which affect all Layers regardless).

Monday, May 15, 2006

Monday 15th

Not much progress today; started off by tweaking the Test Map system to ensure that the map always starts at the top-left corner (dabbling with different Tile and Map sizes threw up a few instances where the map wasn't being displayed properly). Next came an extension of the Project Stats system, which now allows the user to dump the Project Stats to a text file. Yes, I know I'm not supposed to be adding features at this stage, but time was of the essence, so quick tasks were the order of the day. :)

Friday, May 12, 2006

Friday 12th

Managed to finally conquer my Shift/Scrolling issues today, with a LOT of help from Muttley from the YakYak forum who very kindly knocked up a testbed in Blitz Max. Essentially, I wanted the user to be able to scroll the map freely, but only one block at a time if Shift is held. I was getting close, but no cigar, until (thankfully!) Muttley came up with a very tight piece of code that did the job perfectly. Note to self: don't code when exhausted!

Thursday, May 11, 2006

Thursday 11th

Today's first task involved a tweak to the Zoom function, as I'd noticed yesterday that zoomed tiles weren't being masked (and therefore, their transparent colour wasn't actually transparent). The fix was relatively simple, except that the image resizing (required to created a smaller, "zoomed-out" tileset) interferes with the mask colour and thus, leaves a slight fringe on certain tiles. Sadly, there's not much I can do about this unless I write my own resize routine from scratch.

Next came a slight tweak to the Save routines (specifically for Maps, Map Sets, and Projects). Whenever an edit is made to a Layer, an asterisk appears next to the Layer to illustrate the fact; whenever a Map, Map Set, or Project is saved, these asterisks should clear automatically; thankfully the problem was down to the text routine not being called, partly because I'd inserted some extra checks to ensure that text is only updated when values change. I'm too efficient for my own good. :)

The next task involved getting the Window resizing sorted out once and for all. After taking numerous screenshots and making various measurements in PhotoShop, I managed to get the routines working; now, when the <> keys are used in conjunction with Shift or Ctrl, the user can increase or decrease the size of the Editor in steps of 128 (this is so that no matter what the Tilesize, the main canvas always remains at an acceptable size). I'm still not 100% happy with the centring of the Window - mainly because it isn't precisely centred - but this is something I can hopefully tweak.

The final task of the night involved a slight tweak to my various popup dialogue boxes; I discovered the hidden flags for buttons, which allows Return to act as the OK button and Escape to act as the Cancel button - a few keypresses later, and the GUI is much more intuitive.

Wednesday, May 10, 2006

Wednesday 10th

More bugfixing on today's agenda (indeed, the majority of the remaining tasks are all bugs or tweaks of some kind). First up was a slight problem with the Project I/O, which was failing to save a couple of important variables - this in itself is no big headache, as I've plenty of variables to add to the load and save routines, but it does mean that I'll need to methodically step through every variable to ensure that, if needed, it's included.

While testing some code, a bug in the Map resizing code reared its ugly head once again (it was a relatively obscure problem which I though I'd seen the back of). The main problem with bugs at this point in development is the fact that so many bits of code are inter-dependant; smaller, more modular routines are called in various places by different functions, and thus, when code is added or tweaked it's very easy to break things that once worked perfectly.

This particular bug, thankfully, turned out to be a small cut & paste error (I'd copied a chunk of code but neglected to change all the variable references). I discovered that, due to the fact I tested the routines in a very linear fashion, the bug only surfaced when I did something I wouldn't try normally. Hopefully my Beta Testers are reading this...!

Sunday, May 7, 2006

Sunday 7th

Delved into the Drawing Modes once again today, after spotting a small problem with the existing routines. Firstly, the Symmetry values were being derived from the shape being drawn - if part of the shape was masked by a Mask tile, the reflected tile wouldn't be displayed. So, the first step was to ensure that shape tiles and reflected tiles check for Masked tiles independently. Confused? I was. :)

Next came the task of splitting a couple of pieces of logic; rather stupidly, I'd put a check in to stop tiles off the edge of the map from being processed, which also caused reflected tiles to disappear. Thankfully, this was a case of simply moving some checks outside of other checks. Finally came the task of ensuring that all tiles and reflected tiles didn't attempt to Peek or Poke values outside of the current map (again, the logic was there, just in the wrong places due to the countless tweaks and additions I've made over the last 18 months).

So, after a few hours' tinkering, the Editor looks pretty much the same as it did, but thankfully the Symmetry system and Drawing Tools are much more robust than they were before.

Saturday, May 6, 2006

Saturday 6th

More debugging and tweaking on today's agenda: started by further investigating the Brush Thumbnail problem, which will require more than a few braincells to fix - luckily, the problem only occurs (noticeably!) when the user tries to load a Project file but a Tileset is missing; at all other times, there's already significant error-checking in place.

At the risk of running out of creative steam, I turned my attention to some other bugs and issues on my list. First came a tweak to the Duplicate checking system, to ensure that Duplicates can only be checked on Tilesets that are actually loaded (oops, fumbled the ball on that one). Next, a small tweak to the status update ensures that when a Project file is loaded the relevant filename is displayed at the top of the screen.

Next I tinkered with the map scrolling, following a suggestion from a Beta Tester that variable scroll speeds might be a useful addition; however, when the speeds were slowed down (even by half), the result was jerky and ugly. The Editor does feature a Shift-based modifier to the scrolling, which allows you to step through the map a Tile at a time, so I suppose this will have to suffice for now.

The next task involved a small tweak to the existing Drawing Modes to allow a shape to be moved while in mid-draw (for instance, in PhotoShop, the starting point of a shape can be moved at any point by holding Shift). I'd wanted to emulate this for some time, mainly because it's an immensely handy feature, but shied away from it due to the sheer amount of code I'd have to wade through.

However, it proved relatively simple to add to the code (and since I'd already calculated the size of the shape being drawn for use on the Info Panel, all I had to do was throw in a couple of extra checks). Hit a small problem with the code that checks for Masked Tiles, but a simple re-ordering of the logic and everything was working perfectly. There's a possibility that the Line mode may need a tiny tweak, but in general the day's session was extremely fruitful. :)

Friday, May 5, 2006

Friday 5th

Today's first task was to sort out some of the error trapping which is sadly lacking in a few important areas (like, for instance, what if the user tries to load a Project file but the Editor cannot find any of the requisite Tilesets and so forth?). A few gentle nudges from the Blitz Forum pointed me in the direction of a suitable method, now all I need to do is inform the user in a graceful way.

After digging deeper into potential "What Ifs?", it also became clear that the Brush Thumbnail system was also prone to errors if there is no Tileset loaded - the only way around this will be to store the Tileset used to generate each thumbnail, and check this prior to display.

The final couple of tasks for today involved adding the current cursor mode to the Info Panel (when in Tile Grab Mode, the cursor can either be set to Coarse or Smooth), followed by a small tweak to ensure that the Layer copy/paste buffer is cleared after a Layer is resized or rotated.