XMLGameEngine

XMLGameEngine is a VGDL (video game description language) and an engine for running games completely contained within an XML file.

View the Project on GitHub beefviper/XMLGameEngine

Sounds

Sounds are written as notes, the bleeps and tunes of an 8-bit sound chip; nothing is loaded from a sound file. A <play> or a state’s <music> starts one.

<sounds>
  <sound name="wall" wave="square">
    <note pitch="A3">0.04</note>
  </sound>
  <sound name="gameover" wave="square">
    <volume>0.4</volume>
    <note pitch="G4">0.2</note>
    <note pitch="E4" to="D#4">0.5</note>       <!-- slides down -->
    <rest>0.1</rest>
    <note pitch="2000" wave="noise">0.15</note>
  </sound>
  <sound name="thrust" wave="noise">
    <loop />                                   <!-- until silenced -->
    <note pitch="150">1</note>
  </sound>
  <sound name="start">
    <part wave="square"> <note pitch="C5">0.1</note> ... </part>   <!-- a tune -->
    <part wave="triangle"> <note pitch="C3">0.2</note> ... </part> <!-- over its bass -->
  </sound>
</sounds>

Parts of a sound

Part Meaning
wave= square (default), triangle, sawtooth, sine or noise (a high pitch hisses, a low one rumbles). On a sound, part or note; the nearest wins
<loop /> first: plays over and over (playing)
<volume> a value from 0 to 1; default 0.3
<note pitch to wave>seconds</note> pitch is a note and octave (C4 middle C, A4 440 Hz, F#3, Bb5) or hertz; to slides there evenly in semitones. Length above 0, at most 10
<rest>seconds</rest> silence
<part wave> a voice of its own: a sound’s parts play at once. Parts add up, so keep the volume down. Parts or loose notes, not both

Playing