The Daily Click ::. Forums ::. Klik Coding Help ::. level timed with the music?
 

Post Reply  Post Oekaki 
 

Posted By Message

siven

I EAT ROCKS

Registered
  03/11/2008
Points
  604

Wii OwnerVIP Member
9th December, 2012 at 09/12/2012 16:22:44 -

so ive seen people make levels that are in time with the music, like the level 2 demo that was posted here a while back.how do you do this? id like to incorporate it into my latest game with a few different levels

 
[Game design makes my brain feel like its gonna explode.]

Neuro

Ludologist

Registered
  29/10/2006
Points
  437

Game of the Week WinnerVIP MemberI'm on a BoatPokemon Ball!
9th December, 2012 at 09/12/2012 23:29:12 -

The Level 2 demo you say? I might know a thing or two about that

I used the Direct Show object, and you can add conditions with it so that event happens at certain times in the track. Since it's based off time, any significant framerate lag will cause things to go out of sync. The longer your track, the more chance it's going to fall out of sync as it goes on (this happened a lot during development, lots of weird things started happening just before getting to the boss).

There's the basic condition, if you add new condition directly from the Direct Show object (Direct Show > General > Compare Time Position), which uses the default mmf2 time sliders and you can test if it's greater or less than the time you specify. For Level 2, I had it test between two different times only a few hundredths of a second so that a given event would only trigger once (e.g. greater than 01"-10 and less than 01"-15).

You can also use time position in expressions, in Direct Show > General > Compare Time Position. I found that having a 'compare two general values' and trying to get the exact millisecond (it works in ms, so 1 second is a value of 1000 for 'GetPosition') did not trigger events consistently, if at all, due to those milliseconds passing inbetween actual game frames/loops. If you wanted to be more flexible, I'd use this in the same way as the basic condition (e.g. if greater than 12000 and less than 12100, do your action - that would happen at around 12 seconds) so that you can get values from alt values or arrays, rather than have to set the time manually for every event with those sliders. This is how I had the level 'built' for level 2 - with an array that had times (in ms) stored for each segment of the song. When the segment times were reached, it advanced to the next segment.

That's the general jist of it anyway, I think I could elaborate more if need be but it's not that fresh in my mind.

Good luck with it

Edited by Neuro

 
n/a

siven

I EAT ROCKS

Registered
  03/11/2008
Points
  604

Wii OwnerVIP Member
14th December, 2012 at 14/12/2012 11:56:08 -

Thanks! very interesting. it may be a while before i start working on those though, thanks for the info

 
[Game design makes my brain feel like its gonna explode.]

jamesh



Registered
  28/02/2012 15:24:25
Points
  381
25th January, 2013 at 25/01/2013 10:02:13 -

You might also want to think about the BPM of the music.

60 BPM = 1 beat per second. This is, however, super slow.
120 BPM = 2 beats per second, and is quite a standard speed for 'popular music'

These are just easy, discrete quantities, (like if you want stuff happening every x seconds), but the arithmetic for making other speeds fit with other intervals shouldn't be too tricky.

 
n/a

Jake G



Registered
  06/03/2010
Points
  782

Wii OwnerVIP Member
27th January, 2013 at 27/01/2013 12:14:17 -

I love the idea of levels in time to music

Does anyone here have a Wii U? Download the Rayman Legends demo and there is a level called "Castle Rock" timed to a re-done version of "Black Betty" performed by the level's enemies. It's a really good example of this and a joy to play

 
Visit www.voltic.com.au - you probably won't regret it!

~Gradually getting less bad at making games~
   

Post Reply



 



Advertisement

Worth A Click