Entropy's picture

LinkSphere

LinkSphere is my current project.

LinkSphere is a shmup/RTS/music game.

LinkSphere is something like a cross between Rez, Darwinia and Gate 88.

Ideally, it will be playable on-line, and customiseable for music and other aspects of the game.

A friend of mine is handling the actual music - hopefully, while the rest of his course mates are handing in their soundtrack pieces on CD's this coming May, he'll be handing in a (probably single-player) LinkSphere Alpha release and saying "Play this!"

I'm not releasing source code at the moment for a number of reasons -- not least that it's embarrassingly messy and probably follows poor C# conventions (should I really be using so many public static classes?) -- but see the screens below.

At the moment, a separate thread plays a steady "thump, thump, thump, thump" at 120 BPM, with off-beat hiihats playing when the Avatar moves. Eventually, I'd like every entity in the game to play part of a tune when they are close enough to the Avatar, mixing together along with the sound effects to make the music. Most movements and some of the Avatar's more intricate movements will happen on the beat, so the player should feel like they are playing "to the beat".

For on-the-fly music generation, I obviously need a pretty accurate timing thread, so I'll have to be careful to optimise the code. If anyone's feeling helpful, do the have advice on how to keep accurate timing? Obviously, Thread.Sleep(...) isn't the most accurate, and in my experiments is liable to throw everything out of sync if for some reason the thread executes a moment too late. I keep reading that DateTime.Now.Ticks is reportedly inaccurate and slow to call. I'm working on a possible solution right now, which I'll post tonight if I can, as I'd like some feedback on how well people think it'll work.

Edit: Screens (apologies for the glitching - looks like "Print Screen" is capturing the image in mid-refresh)


AttachmentSize
LinkSphere1.jpg32.47 KB
LinkSphere2.jpg27.61 KB
LinkSphere4.jpg52.56 KB

Comments

Comment viewing options

Select your preferred way to display the comments and click "Save settings" to activate your changes.
Entropy's picture

Thanks to all for the advice people offered on streaming playback. LinkSphere still progresses.

I took the time clean up my code for the MusicManager library I wrote to solve the problems I was encountering above. It's attached.

Note the teh Clip class uses a half-implementation of the Utilities.WaveReader class. However, the sound pops when you use the AudioReader.ReadSamples(...) method, so I just extracted the raw data in full and used it directly, through some "unsafe" code. This way, there's no popping. I only noticed the StreamingPlayback example after writing this library, but from the comments on that class, it seems to suffer from the same popping problem I encountered.

I'll post more on LinkSphere itself tonight, but for now here's the MusicManager library. I use it along side my RunBPM method, above.

AttachmentSize
MusicManager.7z367.77 KB