I’ve completely overhauled the game’s online editor in anticipation of letting people create their own worlds. In doing so, I’ve finally coded up some of the basic widget functionality they need – windows that can be dragged around, constraints so they can’t be dragged off-screen with no way of getting them back, local storage so the game remembers where you put everything. All the items and blocks and light level management packed into separate subwindows. It’s beginning to look pretty nifty, but all the on-screen windows make response a bit sluggish. Hope that’s just my ancient computer. 5 is ancient in laptop years, right?
Next I need to add a way for people to teleport away from the current world back to a “safe” world, and preferably to any world that they can edit. Unfortunately, that means I’ll probably have to write scroll-bar code, and possibly pull-down menu code.
Then I can get back to fun stuff like coding aggressive monster behaviour that will allow the “Dalek” game functionality. Although… sigh… I really should create a “damage region” list before people start creating regions with lots of monsters. Currently, whenever an item moves, there’s lots of redrawing the surrounding squares to take into account changed viewpoints, lighting, etc. A single square could be redrawn dozens of times as it responds to each moved item. A damage region approach would just create a list of the squares that need updating, move everything, then update everything once.
I’ve been coding up a storm on the game, though none of it will be visible; at least not for a while. I finally wrote some drag ‘n’ drop code for the windows, and reworked the editing interface to be more intuitive. The “destroy the database when you include a double-quote in someone’s speech” bug is gone, which is quite nice. And my friend PJ has started creating some graphics for me.
Soon people will be able to edit their own worlds. Sooooon.
I put in a good few hours of bug fixing on the weekend. The Firefox 3.x version bug was particularly frustrating because Firebug is flaky when you try to run 3.x and 7.01 on the same machine. alert() got me enough of the way to realise the problem.
The barrels now don’t disappear when you stand on them, and items that are hidden due to low light levels (rather than point of view being blocked) are rendered as black rather than not at all, which was the original intention. Should make everything visually less confusing.
As for the zombie bug – ah, that was one of my favorites, an iteration through an array that was changing. I was previously looking at the square the avatar was on to see if any zombies could see it, and then moving the zombies. However, the fact that the zombies moved changed the “this is what can see this square” list. So it was a real bug. I decided to fix the movement algorithm anyway, because it violated my design principle that all the levels should be deterministic and that the determinism should be apparent to the player.
So, here’s an example of the problem. You’ve got two zombies that want to move into the same square. Which one gets to move into it?
a) a random zombie (bad!)
b) the zombies are in a fixed order, and that order is apparent to the user (eugh)
c) the northern-most one goes first, then the eastern one, the southern one, then the western one. Or some variant. This is deterministic but a pain in the neck for the user to remember.
d) neither zombie. They are very polite (ok, but perhaps something a little less peaceful?)
e) both zombies. They occupy the same space (yuck)
f) both zombies. They kill each other. (cool!)
Actually, I went for a combination of d) and f), with the side benefit that the polite monsters will give way to the aggro monsters. I want an algorithm that doesn’t just work for zombies, of course. Some of the monsters will give way. Some of the monsters will happily fight other monsters. So I wanted some generic parameters I could attach to each monster type that determines its behaviour.
I also wanted the monsters to be able to choose when there was more than one target. If all its enemies were in roughly the same direction, it should head towards them.
It was quite a bit of work, even with the most basic of “as the crow flies” path finding. I could no longer go through a list and move each monster. I had to compile a list of where everything wanted to go and resolve any conflicts. Anyway, it all seems to work now, but I’m really going to have to write some regression tests soon. Testing is a pain.
So, this is why I do releases like this – I discover all sorts of new an exciting bugs.
It looks like the game has a bug in the Firefox 3.x version (but not Firefox 7.01) that means the zombie always gets you: it has two moves for your every one move. That, um, totally shouldn’t happen. I’ll look at that this weekend.
Another bug people have noticed are that the barrels disappear when you stand on them. That’s something I must have introduced in the last day or two of coding, dammit.
There are also some times when boulders disappear just because you can’t see them – a little disconcerting. That is supposed to just make them black instead of removing them altogether. On the other hand, the first zombie is visible even though there’s a boulder between you and him. Odd. Didn’t used to happen.
Dammit. I’m sick today (at home, lying in bed) so I’m not doing the release today. In fact, since tomorrow is my wedding anniversary and Von and I are taking the day off together (so we can be sick together, yay!) the release is postponed to Thursday. I’m coordinating the release so that I get to show the lunchtime gang first, for reasons that may become more apparent later.
Sorry Dave, hope the breath-holding can last a bit longer…
She’s very, very close. Today she was walking while trying to hold my hand, but I was only letting her rest her hand on mine, and kept moving it around, and swapping hands. She kept going just fine.
A last burst of enthusiasm is clearing away some long-standing bugs in the secret project. However, in the process of eliminating bugs, I managed to add one – an important image stopped being displayed. Puzzling. I tried reverting, but the bug was still there. Okay, that’s very weird. I went to older code, where I *knew* the image had been displaying fine, but the bug was still there.
Huh. Oh! They all use the same database! Went to a different database. Bug was still there. WHAT THE HELL.
Turned out to be an actual bug in Firefox 7.01. It’ll be fixed in Firefox 8 (released Nov 8th), but meanwhile I have to scramble for an alternate way of presenting this rather crucial bit of data…