Welcome to the Creatures Wiki! Log in and join the community.


From Creatures Wiki
Revision as of 22:23, 30 December 2004 by GreenReaper (Talk | contribs) (Add content.)

Jump to: navigation, search

This article is actively undergoing a major edit.
As a courtesy, please do not make edits to this article while this message is displayed, in order to avoid edit conflicts. If you need to know who is working on the article and when the edit session began, please check the edit history.


Music in the Creatures series of games started out in Creatures 1 as a variety of synthesized chimes, chords, bloops and other non-specific sounds. For Creatures 2, a far more capable system was created, as outlined below. This information was gained by User:GreenReaper during a university project and should not be considered official - no details of the MNG format were ever released by Creatures Labs, only a three-page article ([The Music of Creatures]) describing some features.


Music is stored in 'Munge' files, with the extension MNG (at the time, the MNG extension was not in use - it was later appropriated as a replacement for PNG). The music is formed of separate samples in a partial WAV format combined with a script which is interpreted by the music engine.

File Structure







 Number of samples




 Position of script

 Zero-based byte position



 Length of script

 Length in bytes



 Position of first sample

 Zero-based byte position



 Length of first sample

 Length in bytes



 Position of second sample

 Zero-based byte position





 N * 8 + 8


 Position of last sample

 N is the number of samples

 N * 8 + 12


 First sample

 Followed by the rest of the samples

Script Encryption

The music scripts of MNG files are saved in a 'scrambled' format, encrypted with an XOR function. This function works on a byte level, with a starting operand value of 0x5 and an increment of 0xC1. Sample routines follow - as XOR is a reversible operation, they can be used to both scramble and descramble scripts.

Visual Basic Routine

Private Function Scramble(ByVal data As Byte()) As Byte()
  Dim hb as Byte, count as Integer
  hb = 5
  For count = 0 to data.Length – 1
    data(count) = data(count) Xor hb
    If hb < &H3F Then
      hb = CByte(hb + &HC1)
      hb = Cbyte(hb + (&HC1 - &H100))
    End If
  Next count
  Return data
End Function

Assembly Routine

.text:00543400 sub_0_543400    proc near               .text:00543400 
.text:00543400 arg_0           = dword ptr  8
.text:00543400 arg_4           = dword ptr  0Ch
.text:00543400                 push    ebp
.text:00543401                 mov     ebp, esp
.text:00543403                 push    esi
.text:00543404                 mov     esi, [ebp+arg_4]
.text:00543407                 xor     eax, eax
.text:00543409                 mov     cl, 5
.text:0054340B                 test    esi, esi
.text:0054340D                 jle     short loc_0_543424
.text:0054340F                 mov     edx, [ebp+arg_0]
.text:00543412                 push    ebx
.text:00543413 loc_0_543413:   ; CODE XREF: sub_0_543400+21
.text:00543413                 mov     bl, [eax+edx]
.text:00543416                 xor     bl, cl
.text:00543418                 add     cl, 0C1h
.text:0054341B                 mov     [eax+edx], bl
.text:0054341E                 inc     eax
.text:0054341F                 cmp     eax, esi
.text:00543421                 jl      short loc_0_543413
.text:00543423                 pop     ebx
.text:00543424 loc_0_543424:   ; CODE XREF: sub_0_543400+D
.text:00543424                 pop     esi
.text:00543425                 pop     ebp
.text:00543426                 retn
.text:00543426 sub_0_543400    endp