Some updates on the project

Coordinator
Oct 3, 2012 at 4:01 PM
Edited Oct 3, 2012 at 4:13 PM

Hey everyone,

I had finally some time this week to work on the project. Here are some parts that I have modified:

  • I have modified the script engine so we can now use the scumm boot parameters of the various games to load the correct room with proper variables initialisation. You can find the various boot parameters here: http://wiki.scummvm.org/index.php/Boot_Params

    If you want to load a different state, just put the correct boot parameter in the "ScummEngine.cs" file. (Maybe we can add this as a command line parameters later)

    Now that the script engine is loading the correct room for a specific boot parameter, I think we can work on the other stuff, object loading, secondary actor loading, etc.)
     
  • I have added extensive logging of the script engine. When you run the program, you will find the file "Scumm.log" in the application directory. This file try to translate the opcodes into readable code. Here is an example of some log informations:

    Script Engine [150A] (ED) Actor1.RoomID = 31
    Script Engine [150F] (81) Actor1.PutActor(160, 100)
    Script Engine [1516] (18) goto [1524]
    Script Engine [1528] (0A) RunScript(23)

    This log file is really important to implement more opcodes because without it, it is impossible to know what is going on. It is important to understand that the log file doesn't contain the decompiled code of all the scripts, but only the script code that was really executed by the engine. (So it will vary if you change the boot parameters for example)

    If you implement more opcodes, please add logging via the util methods. (see ScriptV5.cs)

    Please note that I have changed the way the opcode delegates are registered in the ScriptV5.cs file. The opcode numbers are now written in Hexadecimal because it is more simple to compare it with the scummvm log file.
     
  • Finally, I have re-written all the costume loading code. The COST format is really a mess even with the really helpful documentation found on the scummvm wiki. For debugging purpose, I have written temporary code to output all the frames of all the animations in a debug folder : "DebugAnims". It is located in the application directory and contains a list of PNG files.

    Just to explain what is going on with the costume loader, basically, each frames is made of several "layers" that can have different coordinates. For example, for the stand animation of Guybrush, it has 2 "layers", one for the body and one for the head. They have done that to re-use a maximum the image data. Because we are working with textures pre-loaded, we need to take those "layers" and merge them into one texture. The class "LayeredImageData.cs" is handling that.

    ScummVM and the original scumm engine reload the data needed to draw a costume at each frame because they are drawing the image by setting each pixels individually.

    If you look at the PNG generated when you run the app, you will see that the "standing animations" doesn't have a head and the "talking animation" only have the head. I suppose that for the talk animations, those 2 animations are drawn together but I don't know yet what is going on here.

I think we can work on various different tasks now. If you want to work on a specific area please answer in this thread. :) :)

 

 

Coordinator
Oct 5, 2012 at 6:49 PM

Hey,

Congratulations, it looks great. As I mentioned, I haven't had time to work on the project in the last 3 months (I was doing an internship in Switzerland). I have a job interview on Tuesday (09/10) for which I have to prepare, but after that I intend to work on charset/text loading.

Coordinator
Nov 20, 2012 at 2:20 PM

Hi,

I have some time now to work on the project. I think I will try to continue the work on the costume format so we can handle animations.

Coordinator
Nov 20, 2012 at 2:59 PM

That's great. I've loaded verbs and text, I intend now to work on charset loading to make text look reasonable and remove the content project. 

Coordinator
Nov 27, 2012 at 8:46 AM
Edited Nov 27, 2012 at 8:47 AM

I think I'm moving forward with the character animations. I'm currently working on a way to handle the local room scripts that are just a big infinite loop. Those scripts are resumed at each frames and continue their work. Some opcode like WaitForActor() seems to be spread also across several frames.

One example of a script like that is in the prison, where Otis walk in the cell. (Room 31, local script 200)

Script# 200
[0000] (13) ActorOps(4,[TalkAnimNr(4,5)]);
[0006] (07) setState(406,0);
[000A] (1E) walkActorTo(4,73,118);
[0010] (AE) WaitForActor(4);
[0013] (1E) walkActorTo(4,21,122);
[0019] (AE) WaitForActor(4);
[001C] (18) goto 000A;
[001F] (A0) stopObjectCode();
END

I will try to keep you up to date with my progress because I still have to do a lot of work before making a check-in.

Coordinator
Nov 27, 2012 at 3:23 PM

You should absolutely make check-ins of work in progress unless the code stops compiling or running , it makes merging easier in the future.

I didn't have time this weekend, but I intend to continue next weekend with charset loading. There's already a first implementation of this type of behavior (infinite loop scripts) where paused scripts are run again by using "RunActiveScripts". It doesn't work very well though, I still do not understand the different script types in Scumm VM.

Coordinator
Nov 27, 2012 at 4:00 PM

I really want to check-in my changes but even if my code compile for now, the game runs though an infinite loop because of those special scripts. :) (I have already tried to modify the RunActiveScripts method to make it work with the new features I try to implement but if I commit now, you will not be able to work properly)

Maybe we could start a topic on each parts of the scumm engine that are little less known by us for the moment. We could talk with some links to the great scummvm wiki for a start.

Coordinator
Nov 27, 2012 at 5:24 PM

You should know :)

About the new topic, that's a nice idea. I have half a mind to buy a domain for the project and write reasonable documentation at some point in the future.

Coordinator
Dec 3, 2012 at 2:26 AM

I get a little worried because I was also doing all sorts of stuff while trying to load charsets properly. I am afraid we will have problems merging the two codes - which version are you working on?

Right now, I think I'll wait until you commit what you're doing (the infinite loop scripts are very important for almost everything that we need to do). Maybe I could do something with the sound too, that's somehow enclosed in some classes.

 

Coordinator
Dec 3, 2012 at 2:38 AM

Also, I'd be happy to try and help you out on this task (which I think is one of the hardest we'll have for the first goal of having MK1 running).

Coordinator
Dec 4, 2012 at 5:04 PM

I've decided to work on loading objects. Hope to hear from you soon.

Coordinator
Dec 4, 2012 at 5:53 PM

Sorry for the delay but I'm in London for work right now and I was quite busy. I have commited/merged my code and all seems to work.

It seems that the important opcode for the local scripts that do a loop is the wait opcode. It has a sub opcode that do different things based on it and put the script into "paused" mode after certain conditions are met.

This opcode is working for the actor movement sub opcode but we still need to implement the others. I will now continue to work on the actor movemements by computing the correct paths and outputing the correct animation frames.

I will try to participe on the other thread you launched when I will get back a WIFI connection :)

 

Coordinator
Dec 4, 2012 at 11:41 PM

It looks really nice. I'll be working on loading objects - I also found out some things about the infinite loop scripts, which I'm now adding to our code, but I'll post it on the other thread.

Coordinator
Dec 10, 2012 at 1:49 PM
Edited Dec 10, 2012 at 1:51 PM

I saw you have refactored the image loading code. It looks nice like that.
When I started the project, I only focused on the room image loading but I can now see there are some différences between object and room images.

Concerning the characters animation, I have restarted working on it now I'm back at home. Actors are moving at the correct positions (without the correct frames for now). I don't know yet how to handle the delta time between each updates so our engine handle animations at the correct speed. (I will create a new discussion on this)

In the Prison room, only guybrush seems to not be positionned correctly. I think it is because he needs to be scaled and we don't support this yet.

Coordinator
Dec 12, 2012 at 3:27 PM

Right now, I'm working on finishing the object loading (to load the other states and fixing one crazy bug on image loading) and I'm also going to finish some stuff on charset loading - positioning it right, having the right color, not showing verbs always... for example.

I thought that for the z-buffer thing, we probably want to use a shader - I'm not sure how the z-buffer works in XNA for 2D. In the end, it's probably translated into orthographic 3D, so it shouldn't be a problem. Any comments on that?