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::String, replace 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.

GSoC Week 3

GSoC 2017: Sludge Engine Week 3

Week task conclusion

Generally, this 3rd week of GSoC project was good: milestone 1 is completed as we are able to display texts and play sounds(wav, ogg) now, although not all sound system works because of the need of implementing advanced module file decoders for XM, IT, S3M formats, which is not a small task at all. So we decided to leave it for later.

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

week-3-text.png

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

Tasks completed:

  1. Display texts in sludge
  2. Play wav/ogg sounds
  3. Loop wav/ogg sounds
  4. Loop a wav/ogg sound list

And :

  1. Some platform specific code removed, code compiles on all platforms now
  2. Replace sludge color conversion functions by scummvm PixelFormat functions

For later (They don’t have much effects for now):

  1. XM, IT, S3M decoders
  2. replace utf8 functions by common/ustr.cpp

 

A minor problem that may not have much effect:

  1. The way I implement “loop sound list’ doesn’t give the exactly same result for the particular case that several same sounds loop together at different time intervals. But I guess it’s something we’ll never really do in games.

What’s for next week: Cursor & Input

In order to have a playable game, we will move to input stuff next week :

  1. Get cursor displayed
  2. Replace sludge input event by scummvm ones, all of which are well covered

Some findings about sludge

How texts work

Every font is represented by a series of sprites for characters. Every sprite includes 2 parts:

  • the black background that gives a black border for texts: so all texts in sludge have black borders
  • a white overlay image, whose colors can be changed by shaders. This effect can be reproduced by changing input parameters of scummvm blit funtion

Screenshot from 2017-06-10 22-44-32.png

How audios work

There are 5 sound formats supported by sludge: .WAV, .OGG and .XM, .IT, .S3M. Every sound is played by a call in the game script:

  • playSound(…) for WAV and OGG
  • startMusic(…) for module sound formats : .XM, .IT, .S3M

We also have the possibility to loop a list of sounds in sludge, which is done by building a circled linked list beforehand and at the end-of-stream callback function, “the next sound” in the linked list is played.