Wednesday, 6 June 2007

Radar added and bug fixed

I've been ill the past few days and spent them away from work recovering and so spent some time doing more development on the Freeform Space project in Flash. I've created a new blog here (which you may already be reading, but I'm echoing all Freeform Space information on Spectre Software too so there are two ways of getting to it). The upshot of this is the development of the radar system, firing and playing of sound files from within the engine.

The radar system wasn't half as tricky to implement as for previous projects (such as the original Freeform). This is because, using a top down approach to the main flight engine, the radar is itself another 2D representation of the same thing. The fact that it is circular meant I had to use some really basic trigonometry to check if a blip should be drawn on there or was out of the bounds of the display. Because this was so easy to develop I expanded on it a bit - if you load up the demo here and fly far enough away from the planet, you will see that the planet blip itself will shrink and then eventually "lock" against the edge of the radar when it is no longer in range of the radar - to give you an idea of the general direction you would have to go in to get to the planet.

I've also now get a firing routine in there (clicking the mouse fires the lasers on each wing of the fighter vessel) and of course a laser noise which is triggered at the same time. The noise is an external MP3 to the flash movie (actually, almost all of the assets are external, except for the vapour trail and laser) or generated dynamically (such as the star fields), which means that the first time the laser is fired there is a slight delay on the laser sound playing until it is downloaded by the player. I'm not sure what to do about this as I'm trying to avoid embedding any assets into the flash movie unless I absolutely have to. I may tie the laser graphical response in with the sound loaded event so there is a delay on both happening the first time and not just a delay on the sound. Subsequent firing seems much better. For reference, the laser sound is an MP3 file 16kb in size.

Any feedback on any of this would be appreciated.

No comments: