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.

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

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.