Tuesday, October 30, 2012

Hopkins FBI Linux Demo is now completable

Well, another milestone has been reached in the development of the Hopkins engine. The Linux demo, upon which I've been basing the engine implementation, is now officially completable! Yes, you can now guide the intrepid FBI agent through the start of his case, and deal with a bank robbery. I think it's a considerable happy achievement, given how recently I started work on it, and how little time I've had available to spend on it, given work commitments,

So what comes next?

Well, there are still some graphic glitches to sort out. For example, implementing proper savegame thumbnails, and the cursor drawing of actively selected inventory objects isn't clearing itself correctly when the cursor moves. I'll be concentrating next on identifying the cause of these problems and resolving them, which hopefully shouldn't take long.

There is also a need for refactoring. Now that the engine has stabilised into a usable state, I need to start reviewing code and giving proper names to all the structures that currently have names like 'field2' and 'field4'. Likewise, method parameter values and locals will also need better names. I also need to review the current separation of code I've done into various manager classes and move methods more appropriate to different managers into their appropriate manager.

Those two are the immediate short-term goals. Once they're done, there are still the two big ones remaining:

Firstly, supporting the actual full game. Whilst the game does have some basic scripting mechanisms, the bulk of the code seems to be in a massive method called 'Traduction', at least in the demo. This method consists essentially of a massive switch statement that handles all the game logic. It'll be interesting to see if this is done the same way in the full game as well. Strangerke is currently looking for someone with a copy of the Linux version of the game, that we can use as a basis of comparing against the demo version to get the changes. Hopefully, the core engine will remain pretty much identical, and we can just drop in a full game 'Traduction' method to properly support the full game.

And secondly, of course, there's the old hairy chestnut of sound support. I'm hopeful that the music, voice, and sound effects are in a standard format and that, similiar to what was done in Tony (and other) engines, I can use existing ScummVM functionality for sound playback. I really don't relish an extended period trying to re-implement sound drivers for Hopkins, like I had to do for tSage.

So, all in all, we should hopefully soon have Hopkins in a fit state as yet another game playable under ScummVM. :)




Sunday, October 7, 2012

Making progress in Hopkins

Well, the last few weeks have been very busy for me at work, and it looks like things will be getting even busier as we get towards the end of the year. Despite this, I've made rapid progress in converting over the disassembled source code. I've now reached a point where I've done an initial conversion/implementation of all the method relied on by the demo, with the exception of the sound routines, which I tend to leave to last, since large chunks can frequently be replaced by existing ScummVM playback code.

There is, however, a bunch of code left in the executable that isn't directly called. This is particularly noticeable due to the way I did the conversion - starting with the decompiled code, I converted the single main method, removing it from the decompiled source file,, then added it into the ScummVM project and created stubs for any sub-method that that method called. I then proceeded to gradually convert those stubbed methods, creating new stubs as necessary. That way, for each method I converted, I could ensure that the code correctly compiled before moving onto the next.

The result of this is that at the end of this process, I have a decompiled source file that still has a lot of code remaining in it, even ignoring all the sound methods that I haven't implemented. I haven't done any analysis of it yet, but I'm presuming that some of the code is related to the full game executable, and whatever compiler they used didn't actually remove it when the executable was required.

Since I've spent the last week cramming the conversion, I figure to leave the unused code alone for now, and return to working on running the code and fixing bugs in the result. I'll also start doing renaming of the data structures as I understand things better. I'm hoping that despite my haste in converting the methods over, I'll be be able to rapidly see some in-game results.

I'll try to make more frequent progress reports to make up for the previous absence of postings. :)