View Single Post
Old 31 August 2017, 11:27   #1
Registered User

Join Date: Dec 2013
Location: Auckland
Posts: 1,699
Blue Thunder and TimeGal - General concepts and Blitz implementation

The two FMV games I worked on were coded in Blitz, I thought it might be worthwhile briefly going over how the engine was developed. Please let me know if there's any specifics you'd be more interested in.

Unlike the CDXL format (which is designed for streamed playback), the FMV in those two games are broken up into numerous files to be loaded into buffers - I've given this custom format the extension ".bank" as it's literally just files intended to be used with Blitz bank commands.

There are advantages to this approach: Playback can be more reliable than CDXL - as, in a worst case scenario, the game will pause until the Bank is fully loaded (rather than immediately running into audio and graphical issues). It's also fairly easy to understand and implement.

But also disadvantages: Starting from a specific frame is difficult, also instant playback is impossible as an entire bank needs to be loaded first.

Each .bank file is made up of:
- 1 or more frames, as raw uncompressed bitmaps of fixed size, simply appended end to end. These can each be assigned to a Blitz Bitmap object using CludgeBitmap.
- An IFF audio file appended to the end. This can be assigned to a Blitz Sound object using DecodeSound.

Say, if the game was configured to play back at 10FPS, and a .bank contained ten frames, then the .bank would also contain one second of audio. So each .bank file contains a fixed-length section of the full FMV video.

The engines can be configured with an arbitrary number of buffers (Blitz Bank objects that are constantly reused), but at least two are needed - one is fully loaded before the game can be started, and the others are loaded from disk to memory.

The core game loop is handled inside a VBLANK interrupt (SETINT 5), which includes:
- Testing for input (aborting the game and jumping to the game over screen if the correct input is not received)
- Updating the frame counter and displaying the current frame on screen
- Playing audio from the currently loaded bank
- Display onscreen control hints (just using Hardware sprites, as this is the easiest way to overlay graphics over top of HAM)

Outside of the main game loop, only one function is performed - there's a simple While loop that constantly checks if all of the buffers are in use. If a buffer is free (a buffer is marked is free as soon as the game has finished playing the audio and video from that .Bank file), it immediately loads the next .Bank into that free buffer.

Creating the .Bank files themselves was bit of a frankenstein approach - Windows utilities chopped up the source .AVI into individual frames and short sound clips and converted those files into more Amiga friendly formats, and then a custom Blitz tool glued them back together as the .Bank files.
earok is offline  
AdSense AdSense  
Page generated in 0.04069 seconds with 11 queries