dynamic music system (pieterNotSilly's Worklog)

working on my graduation project which will be a dynamic music system RSS Feed

System working

I had so many distractions last couple of years that i keep procrastinating graduation and everything. I've been working on a graduation project about music that is altered compared to the action that happened on the screen, AKA dynamic music. It's still in an early phase. I've been working on making an engine first. All objects and the music is scripted with lua scripts. In fact the scripts are very easy to work with and test things. I can even change a script on the run. The level editor i worked on has just a few lines of scripting code, most of them initializing code.

Example for a tilemap scroll window
Code:
map = tilemap:new( 500, 500, 1 )
map:load("mytilemap.map")
g_Scroll[ 0 ].map = map
g_Scroll[ 0 ].active = true
g_Scroll[ 0 ].x1 = 0
g_Scroll[ 0 ].x2 = 640
g_Scroll[ 0 ].y1 = 0
g_Scroll[ 0 ].y2 = 400
g_Scroll[ 0 ].file = loadFile( "tiles.pic" )
g_Scroll[ 0 ].graph = 1   --graph 1 contains all tiles
g_Scroll[ 0 ].tileWidth = 32
g_Scroll[ 0 ].tileHeight = 32
g_Scroll[ 0 ].camera = process:new("player.lua", this )


Graphics are done with opengl. All you have to do is place all your graphics numbered in a directory, e.g. tiles\1.png, tiles\2.png and then run "graphicmaker.exe tiles" to make a tiles.pic file that you can use.
Then all a script has to do is for example
Code:
this.m_File = loadFile ( "tiles.pic" )
this.m_Graph = 1
function frame()
   if ( Mouse.left ) then
      this.m_Graph = this.m_Graph + 1
   end
   if ( Mouse.right ) then
      this.m_Graph = this.m_Graph - 1
   end
   this.m_X = Mouse.x;
   this.m_Y = Mouse.y;
end

The same goes for music scripting where i'll make my dynamic music code(and the actual graduating for me)
Code:
this:playMidiTrack( "test.mid", 1 )
this:ChangeInstrument( MUS_ACOUSTICGUITAR )
while( true ) do
   this:noteOn( 80 );
   this:wait( 1 );
   this:noteOff( 80 );
end



I based the programming a bit on div games studio even though some things are bit more complicated because of the way lua works. There are still some extra advantages like placing processes in subgroups where each subgroup has a different function( game paused, main menu, game, level editor ), so it's very easy to program these things compared to div games studio.

A feature i want is that the picture files also contain static 3d models and have them a graphic number assigned to them. The testing game will be a 2D platform game(my favorite game genre).
I'll probably continue working on it even after graduating with a full working engine.
(Posted on August, 16th 2008, 13:58)

Comments


Sandman said:
I don't quite understand the concept of dynamic music and also not what exactly is the dynamic part in the piece of code you provided. Could you elaborate a bit?
(Posted on August, 16th 2008, 14:25)


Rincewind said:
Good to see you're still alive Pieter! Like Sandman I also wonder about the meaning of 'dynamic music'.
(Posted on August, 17th 2008, 11:29)


pieterNotSilly said:
dynamic music is also called adaptive music. Most games use tricks like channel muting or picking different music loops to give you this impression. For example right now the main menu plays a midi and it will increase the tempo if you move the mouse more and will decrease if you don't move the mouse.
I try to go a step further by actually generating a melody.
And the examples are just to give an impression. playing a midi file is not very adaptive :P.
(Posted on August, 24th 2008, 14:28)


Sandman said:
Okay I like the sound (HAHA) of that; could be brilliantly for atmospheric games like in the horror genre.
(Posted on August, 26th 2008, 11:14)

Post New Comment

You must log in or register to post comments.

Copyright © 2005 Booleansoup.com
Questions? Comments? Bug reports? Contact us!