GSoC 2017 Summary

GSoC 2017: Sludge Engine

Summary

Project description

During GSoC 2017, I worked for the org ScummVM, which is a program that allows running some classic graphical point-and-click adventure games on multiple platforms (Win, MacOS, Linux, Android, etc.), with game data file provided.

My project has been importing the Sludge engine into ScummVM and adding full support at least for the game Out Of Order. At the start, I had Sludge engine source code as base to work on, which is an open source project licensed under GNU LGPL version 2.1.

Goals achieved

Now I’d like to make a summary of what I’ve achieved:

1. Sludge engine

Sludge engine has largely been imported into ScummVM now with capability to run the games below:

  • Out of Order
  • Frasse and the Peas of Kejick
  • The Interview
  • Life Flashed By
  • The Game That Takes Place on a Cruise Ship
  • Cubert Badbone, P.I.
  • Robin’s Rescue (Tutorial game for sludge engine)

I tested the game Out Of Order from the beginning to the end and the first scenes in other games. There doesn’t seem to be serious problems.

2. Other features

    1. CMD :
      • As the entry barrier for GSoC program, I made a PR for the command line to get games detected and added. This feature has been polished and enriched by two other summvm members criezy and tobiatesan later.
    2. GRAPHICS :
      • I added Multiply blend mode for Transparent Surface: PR.
      • I fixed a minor bug about off-screen clipping handling for Transparent Surface : PR
    3. IMAGE :
      • I made a small modification to make it possible to write png from surfaces of 4-byte pixel format : commit 1 2

Future work

      • Unimported Sludge features :
        • Play movie
        • Color transition animation
      • Continue to track down game bugs
      • Code objectifying for sludge
      • I’m still working on adding support for .mod .s3m and .xm tracker sounds in my own fork.

Code

The code for sludge engine is in an individual folder in the repo:

https://github.com/scummvm/scummvm/tree/master/engines/sludge

The commits that I made :

https://github.com/scummvm/scummvm/commits?author=yinsimei

GSoC Week 12

GSoC 2017: Sludge Engine Week 12

Week task conclusion

Generally, this week is still focused on bug fixing and primary study of sound decoder.

Again, thanks to my mentors _sev(Eugene Sandulenko), t0by(Tobia Tesan) and all scummvm team members that has helped me during this week.

To make a brief conclusion about what we have achieved for this week :

  1. Bugs Fixed :
    1. Sprite darkness level bug
    2. Save&load looping sound bug
    3. zBuffer bug when burn sprites to backdrop
  2. A local branch in my fork for sound decoder has been created

As for the sound decoder, we’ve decided to use the the library micromod for it, which is a library including a converter from s3m, mod, xm to wav format. We find it impressive for its size and its capability to create a common loading structure for all three formats.

(Link to the repo on github : https://github.com/martincameron/micromod)

 

What’s for next week: Importing micromod sound decoders & Bug fixing

Tasks for next week :

  1. Import the micromod sound decoder into scummvm
  2. make the 3 win-only games work

GSoC Week 11

GSoC 2017: Sludge Engine Week 11

Week task conclusion

Generally, this week is focused on further bug fixing for the game Out Of Order and we are able to play from the begin to the end now.

Again, thanks to my mentors _sev(Eugene Sandulenko), t0by(Tobia Tesan) and all scummvm team members that has helped me during this week.

To make a brief conclusion about what we have achieved for this week :

  1. Bugs Fixed :
    1. Sprite depth
    2. Add thumbnail
    3. Save & load interface
      1. Add thumbnail
      2. Add saved file list
  2. Lightmap: 3
  3. Multiply blend mode for transparent surface

Things not achieved yet:

  1. Bugs left to be solved:
    1. Sometimes the menu can’t be called out by esc. This can be solved by restarting scummvm. Not sure when this bug will occur yet.
    2. The character sprite can be too dark sometimes.
    3. Save&Load game can cause some loop sound that shouldn’t be played there played
    4. When the credits show in the end, the zBuffer of the last scene remain
    5. At the beginning of the game, there is a moment the zbuffer doesn’t work. Don’t know why it is.
  2. The end of the game Out Of Order contains a short movie, so we’ll also need to see how to play it in scummvm
  3. By the way, the parallex is not used anywhere in any game. So I think it’s not necessary to implement it now.
  4. Still don’t know why the windows-only games don’t work.

What’s for next week: XM, IT, S3M Sound decoders

Tasks for next week :

  1. Fix the bugs that remain
  2. XM, IT, S3M sound decoders

GSoC Week 10

GSoC 2017: Sludge Engine Week 10

Week task conclusion

Since I didn’t have time to work on Sludge last week, I make this week the 10th week of GSoC Generally, this week is focused on bug tracking for the game Out Of Order. As the objectifying took longer than planned, we decided to back to it when we have time later and concentrate on bug fixing.

Again, thanks to my mentors _sev(Eugene Sandulenko), t0by(Tobia Tesan) and all scummvm team members that has helped me during this week.

To make a brief conclusion about what we have achieved for this week :

  1. Bug Fixing
    1. Backdrop bug :
      1. Clear screen
      2. Fix backdrop loading
      3. Fix crash when loading game
    2. zBuffer :
      1. zBuffer order bug
      2. Reset zBuffers when blank back drop
    3. Fix Off-screen cliping handling for Transparent Surface (in PR at present)
    4. Others :
      1. Quit game buit-in
      2. Correct pixel format for png writing
  2. New game situations :
    1. Out Of Order : Bugs concerning backdrop and z-Buffers are fixed
    2. The Interview : The crashing bug has been fixed with the update
    3. Life Flashes By: The bug concerning save & load file detection is unsolved, as it is not related to the built-in function FileExists as I expected. So still need to track down this problem.

What’s for next week: Bug fixing & Lightmap & Parallax

Tasks for next week :

  1. Test Out Of Order thoroughly and fix the bugs that remain
  2. Test other games and track bugs
  3. Add lightmap shader effect to sprite displaying
  4. Test and add parallax in Out Of Order (haven’t seen it in Out Of Order till now, maybe it is used in the scenes later)
  5. If time permits, try to figure out why the windows game doesn’t work. This may be something convoluted, the reason is still unknown

And for the week after the next, we will focus on making the decoder for multi-track sounds

GSoC Week 9

GSoC 2017: Sludge Engine Week 9

Week task conclusion

Generally, this 9th week of GSoC project is focused on objectifying the code and adding new games. The objectifying takes more time predicted and I think I will continue to work on it next week and debug for new games.

Again, thanks to my mentors _sev(Eugene Sandulenko), t0by(Tobia Tesan) and all scummvm team members that has helped me during this week.

To make a brief conclusion about what we have achieved for this week :

  1. Objectify the code
    1. Timer
    2. Language Manager
    3. Resource Manager
    4. Object Manager
    5. Graphics Manager : 1 2 3
    6. Event Manager
    7. Sound Manager
    8. Text Manager
    9. Cursor Manager
  2. Add new games
    1. Out Of Order : playable without any mechanic bugs in the first scenes, I didn’t test it to the end though. However, there are several graphic bugs with backdrops and z-buffers that need to be fixed
    2. Frasse and the Peas of Kejick : playable without bugs in the first scenes
    3. The Interview : There is a crush concerning backdrop size when we go to scene 2, need to check
    4. Life Flashes By: There is a bug concerning save & load file detect. I think implementing the fileExists built-in function will solve it.
    5. A few windows-only games, with blank screen or only main menu works. I can’t understand why there’s windows-only sludge game. I think I’ll need the source code to have a check

 

The data files of the games mentioned above can be found in the repo : https://github.com/yinsimei/sludge-test-games

What’s for next week: Fix games & Finish code objectifying

Tasks for next week :

  1. Finish code objectifying :
    1. Character Manager
    2. Stack Machine Manager
  2. Fix games
    1. Fix the animation issue in Robin’s Rescue : This issue is here for several weeks, didn’t have time to look deep into it as it’s a rather wierd one. This bug only exists in this game. No such bug in other games.
    2. The issues mentioned above

GSoC Week 8

GSoC 2017: Sludge Engine Week 8

Week task conclusion

Generally, this 8th week of GSoC project consists of a lot of code fixing and cleaning in order to merge it into the upstream.

The great news it that it’s been successfully merged and I’m able to contribute directly to the main repo now, which is quite cool. Which also means to be more careful about every commit from now on. Also, Sludge engine has been announced in the facebook page of scummvm.

Again, thanks to my mentors _sev(Eugene Sandulenko), t0by(Tobia Tesan) and all scummvm team members that has helped me during this week.

 

Before diving into the code objectifying, we find it’s better to do a thorough code cleaning first, remove the useles if 0’s and complete some critical functions.

To make a brief conclusion about what we have achieved for this week :

  1. Multi-lingual system added
    1. Multiple detection entries
    2. Change fallback detection
  2. Read/Write float to stream
  3. Replace char * by Common::Stringreplace sprintf
  4. Complete some graphic functions
    1. Parallax (not finish yet): Parallax layers can scroll at different speeds to the background image, giving the illusion of depth to a scene as it moves.
    2. Credit Scrolling
    3. Burn sprite to backdrop
    4. Paste sprite to backdrop
  5. Other code fixing and cleaning

 

What’s for next week: More games & Code objectifying

We gave a less priority to the code objectifying during this week but I think we are ready to start it from the next week, as the code cleaning has been generally finished.

Also, as there are a number of functions still untested, we think it’s better to test them with more games.

Tasks for next week :

  1. Add all sludge existing sludge games into detection list (include Out Of Order)
  2. Objectify the code and create classes
  3. Fix the animation issue in Robin’s Rescue

GSoC Week 7

GSoC 2017: Sludge Engine Week 7

Week task conclusion

Generally, this 7th week of GSoC project consists of a number of minor tasks to fix and improve the current code: most bugs have been cleared for Robin’s Rescue and Load & Save system has been added.

Again, thanks to my mentors _sev(Eugene Sandulenko), t0by(Tobia Tesan) and all scummvm team members that has helped me during this week.

To make a brief conclusion about what we have and have not achieved for this week :

 

Tasks completed:

  1. Add game timing
  2. Correct the text color bug for png font
  3. Add transparency check for character clickable zone : the area is not clickable if transparent
  4. Add blank screen effect
  5. Save Graphics::Surface as png data stream: extend png writing function for 4-byte surfaces
  6. Load & Save System
  7. Use U32String to replace sludge utf8 library

 

To resolve later:

  1. The bug that character animation is too slow in Robin’s Rescue is still being tracked.
  2. the thumbnail and snapshot is used nowhere at present, so left in #if 0 #endif

What’s for next week: Code objectifying

As in sludge, all codes have been written in a non OOP way, which means all are implemented using global variables and functions. It’s necessary to objectify the code and create classes

Tasks for next week :

  1. Clear the animation issue in Robin’s Rescue
  2. Objectify the code and create classes

GSoC Week 6

GSoC 2017: Sludge Engine Week 6

Week task conclusion

Generally, this 6th week of GSoC project was good: the first mid-term evaluation has been validated and Robin’s Rescue is playable on ScummVM (still having some bugs to fix, though).

Again, thanks to my mentors _sev(Eugene Sandulenko), t0by(Tobia Tesan) and all scummvm team members that has helped me on bug fixing during this week.

 

To make a brief conclusion about what we have and have not achieved for this week :

 

Tasks completed:

  1. Load headless png files : flag to skip signature check + modify image loader
  2. FIx bugs related to loading background after loading zbuffer
  3. Other minor bug fixes …

 

To resolve later:

  1. There is still a problem with game’s timer, which is slower than expected
  2. Characters’ animation are very slow as well
  3. The text color is not 100% right

What’s for next week: Save & Load System

Tasks for next week :

  1. Clear the rest of issues in Robin’s Rescue
  2. Get save & load system up

Some findings about sludge

Sludge engine use headless png files (without 8 byte signature) for sprites.

GSoC Week 5

GSoC 2017: Sludge Engine Week 5

Week task conclusion

Generally, this 5th week of GSoC project was going smoothly: The z-Buffer zone (multi-layer effect) has been reproduced and fall back detection has been added

Again, thanks to my mentors _sev(Eugene Sandulenko), t0by(Tobia Tesan) and all scummvm team members that has helped me on z-Buffer during this week.

To make a brief conclusion about what we have and have not achieved for this week :

Tasks completed:

  1. z-BufferZone : load z-Buffer sprites + reproduce multi-layer effects
  2. fall back detection for sludge games

 

To resolve later:

  1. There is a segmentation fault when Robin’s Rescue starts. It may result from the game logo reading in the initilization, which is not implemented yet

What’s for next week: Bug fixes in Robin’s Rescue

Tasks for next week :

  1. Fix the segmentation error in Robin’s Rescue
  2. Clear all bugs in Robin’s Rescue

Also, the first GSoc evaluation will take place next week.

Some findings about sludge

z-Buffer Zone

In sludge, z-Buffer zones are different areas of a scene which can obscure character graphics, such as foreground silhouettes, doorframes and furniture. Their display has been ordered by a y-value to create different image layers (up to 16).

The above room image has the following z-buffer image (3 layers) :

  

And characters will change the image layer it lies in, when its own y-value changes. To reproduce this effect in scummvm, we used an array of 16 Lists for different layers.

GSoC Week 4

GSoC 2017: Sludge Engine Week 4

Week task conclusion

Generally, this 3rd week of GSoC project was good: the input works and we are able to reallly “play” the game. Bugs are cleared for the game demo Verb Coins now and there are only z-Buffer stuff left to get it fully work.

Again, thanks to my mentors _sev(Eugene Sandulenko), t0by(Tobia Tesan) and all scummvm team members that has helped me on input and bug fixes during this week.

   

To make a brief conclusion about what we have and have not achieved for this week :

Tasks completed:

  1. game input
  2. freeze/unfreeze scene
  3. Add character interaction
  4. object inventory = dark screen effect + paste image to background

To resolve later:

  1. When setting opacity for transparent surface blitting, we need to modify the second parameter of TS_ARGB() instead of the first one, which is strange. Related line

What’s for next week: z-Buffer Image & new game

Tasks for next week :

  1. Get Z-Buffer up: it is used for different areas of a scene which can obscure character graphics, such as foreground silhouettes, doorframes and furniture.
  2. Add game fallback detection
  3. Add game Robin’s rescue and test

Some findings about sludge

Sludge input

Sludge input is using common sdl input functions

Freeze and unfreeze game scene

In sludge, whenever a dialog, reaction menu is popped up, the scene get frozen. The principle is that they make a screenshot of every thing on the background and copy interactive elements to a temporary variable and set them to null. Then, when we unfreeze, we restore them all.