Tuesday, 22 May 2012

A picture says more than a thousand words

...which should put this blog entry far beyond 10 000 words. There has been a bit of progress with the Wintermute-engine, preliminary support for graphics, sound and I/O is in place, but it is far from perfect, or finished in any way, shape or form.

Right now, the sound system only allows playback of OGG-files, and it only does Play() for them, which was a rather simply task to add in, simply to verify that the sound system still works after having been stripped down from WinterMute Lite, either way no further work is planned on that part for atleast a few weeks.
I also added in some quick hacks to make the engine draw inside ScummVM, right now this is done in 24 bit hardcoded blitting, and was mainly done to see what had to be done. At this point it might be worth noting the work that was done on WME Lite prior to attempting to merge it into the ScummVM-tree as a branch. I started off by forking the original WME-Lite repos onto Github, then I went on to strip out all the dependencies (BASS, Boost, SDL2), as well as removing as much as possible of the "forbidden"-bits (ScummVM doesn't allow direct usage of the C-APIs for file-accesses and random number generation among other things). As I went on, i ported over as much as possible of the ScummVM common code to WME Lite, until I reached the point where I might as well move the WME source over into my ScummVM-fork. 

One of the things I did quite early, was to try to use the ScummVM-image loaders, as opposed to the SDL2-code that was used already in WME Lite, I made that kind of work, but transparency proved problematic for now. I picked the game Dirty Split as a test case for the moment, here is how it looks:

Inventory in the original WME Lite
This is how the inventory in Dirty Split looks in the original prebuilt WME Lite
... and this is how it looks in my modified WME Lite-version, that uses the ScummVM image loader.
Now, for the first ever image of a Wintermute-game running inside ScummVM:

Yup, this is ScummVM, although it isn't really obvious from the headline. Notice how the fence is wrong, and the transparency is off in all sorts of different ways.

The reason for all those interesting artifacts, is mainly that I only added a quick-fix for the colour-keyed transparency, but didn't do anything for the alpha-channel stuff yet. Keen eyes might also notice that the character is a lot bigger in ScummVM, although this is the very same scene, with no movement done yet. This is another case of missing features, right now any bitmap that asks to be drawn, is drawn at it's full size, no matter what it actually says about the wanted size. This gives a few rather odd behaviours at the moment, as for instance, walking away from the screen isn't really obvious:
This is how walking up to the door looks in WME Lite (with a few of my modifications)
... and this is how it looks in ScummVM at the moment.
Clearly, the model's need to scale appropriately, but, atleast input works well enough to get the character to move over there. The action-menu for Dirty Split reveals a few more of the transparency-quirks:

In ScummVM

In WME Lite (with my modifications)
I'll be looking into solving these issues as I implement a more proper drawing-solution in the weeks to come.

Oh well, that's about it for now, I'm off to do my exams, so what better way to end of, than to show how the three variations of the game look when you try to close it? Yes, there are a few minor differencies her, as I didn't go through the menu in ScummVM, but simply Ctrl-C-ed the terminal session.


Modified WME Lite

Original WME Lite


  1. Regarding the transparency.

    I recommend to take a look at the code of RenderedImage::blit() in engines/sword25/gfx/image/renderedimage.cpp

    Probably it could be worth of refactoring this code into Common::Graphics, so it could be reused by both engines.

  2. And same file has scaling routine too: Graphics::Surface *RenderedImage::scale()