ARGH!
Thursday, 29th September 2005
Fire Track (on the BBC Micro) is probably the fastest, hardest, most adrenaline-packed space shooter I've ever played!
I'm playing my way through the extended version to try and work out the game mechanics a bit more. I've been using an ancient "infinite lives" cheat disk with it, but even so... whew, this game is tough.
I have saved state images for Levels 1 to 22, though, at last. My nerves are shot to pieces, in any case!
It appears that I have to rethink the way enemies are handled. Currently, I store a list of 8 enemies and assume they all follow the same pattern. Wrong. For most of the game, you can have lots of enemies on-screen, each from a different pattern! Or the patterns can overlap, even. What I think I'll do instead is have a list of enemies with ID (attack type - I'll use the sprite number), (X,Y) coordinate (if it's (0,0) it means the slot is free, no enemy) then 5 bytes of extra storage that the enemy attack handler for that enemy can do whatever the Hell they like with. If I have a timer that decreases and fires off the next enemy whenever it underflows (either a predetermined one from a table of enemy attacks or just picking a random one - or, for some of the bonus levels, none at all). Plus, I can rewrite it without lots of use of the slow IX register.
I have, however, added mine support. There's a function to add a mine at a particular (x,y), where it gets set up correctly and will drift towards you (the DX and DY are set up when you add the mine). They aren't part of the collision detection routines yet (I'll add them with the enemy system rewrite) but already scare me
The above is the worst-case scenario - there are not usually more than 4-5 mines on screen at any one time.
As you can probably also see, there is still no black bar at the top of the display. I can't quite work out how to enable/handle line interrupts from the VDP, but have found a nice part of the VRAM that isn't being written to that is just the right size for use as an alternate name table. The way this'll work is that I switch the background layer to another location in VRAM for which tiles to use that is all blacked out, wait until I hit a scanline 8 pixels down then switch back to the name table which contains my real background layer. I don't have to deal with cutting out any sprites as I have 8 sprites dedicated to the score at the top, and as you probably know by now from my constant moaning about it there is an 8-sprite-per-scanline limit hence my score will stop anything else from being drawn in the sprite layer at the top.
Finally, here's a picture of the biggest pest I know - linkified for the spider-haters. These buggers are not very large (5-8cms, biggest approaching 10cms) but very annoying - they seem to like following set paths, and will run around back and forth on the edge of my vision. This particular one was very reluctant to be picked up and lobbed out of the window...
Fading
Wednesday, 28th September 2005
I spent a while last night on a reusable routine to fade between two different palettes.
→
→
→
It just happens to be one of the muckiest pieces of code written so far. You can see it in action in a video I've knocked together here (262KB). [I haven't put together a video for a while, so any old excuse, eh?]
I rejigged a few bits of the code, including neatening up the core sprite routines (so they are now much faster, huzzah!)
I ran a test on what it would look like if I added 8 "mines" (sprite limit and all that). The result? Sprite flicker is very very low! Looks like I'll be able to add the mines without issue...
These mines are rather evil. You get varying numbers of them, starting with very few in the early levels and going up to 8 in the later levels (well, as far as I've managed to get!). As enemies appear on screen they "lay" a trail of mines that drift towards you.
(Screenshot from BeebEm).
VGM Player now works!
Tuesday, 27th September 2005
Lots of fixes...
Download here! (New package includes loading music from Fire Track as a sample)
- Fixed reading of files. I'd used 'char' instead of 'unsigned char'. Files that played back as plain silence now play back fully, also play at correct speed. What a stupid mistake - it's amazing it worked at all! I ended up rewriting the entire PSG emulation thinking it was that that was to blame... evidently not! - Halved frequency of noise channel by only switching output once on 2 clocks. It was an octave too high before! - Fixed odd jumping/incorrect (after loop) seek bar. - Changed [x] exit button to use 'x' character rather than the cross symbol - the cross appeared as a "Pt" sign under Windows 2000. - Removed display of Japanese tags. - VGM files that loop back to the exact start of the file are now looped rather than ignored. - Added display of system name for noise mode and very stupid autodetection. - Sound output is now averaged inside each 44100Hz sample to "antialias" the output. Sound output that relies on channels at 0 outputting fully now work. Sampled audio still sounds a bit noisy/weird. Sound is now output at 16-bit. - Option to enable/disable sound channels individually. - Accelerated seeking considerably.
Scoring
Monday, 26th September 2005
- Fixed drunk pilots. New algorithm is about 20 lines shorter, 10 times faster, 5 times simpler. Reason for drunk pilots: drunk coder.
- Implemented scoring, including:
- Variable points for shooting enemies.
- Variable points for shooting objects on the ground.
- Display of score at top of screen.
- Updated pause screen, all sprites now remain on-screen, background is less wavy.
- Trimming of enemy attack times so they follow on from eachother nice and quickly.
- Numerous minor bugfixes and tweaks.
The score might look nice there, but it really needs to be stuck on a background - any sprites trying to come in are cut off and look really odd popping into existance 8 pixels down from the top of the screen (8 sprite limit, and I have 8 digits in my score). For example, see this:
Look at the top - you can see the nose of a ship appearing, and it looks horribly wrong.
Drawing a black bar might be achieved by swapping name table addresses when I hit a certain scanline, but that's mucky and so far the best result has been 3 or 4 VRAM timing errors per frame and a jumping area of the screen that shows junk. Wonderful!
Download the new build and source.
I also did some more work on my VGM player. It now emulates the PSG correctly! There is one problem still - playback of VGM files that have a specific delay specified. The default timings (1/50th second, 1/60th second) both work beautifully... *sighs* The others play waaaay too fast.
Thankfully, this affects very few VGM files I've tried it with. I also ripped out the tacky visualisations (it's now just a boring console app), improved the seeking code to be time rather than file position based (more accurate) and added support for VGZ files (GZipped-up VGMs) using ZLIB.
If you're in the mood for excellent chiptunes, download the above and the VGM pack to a classic Sega game from SMS Power! - I'm particularly fond of the music from "The Flash". (Ristar's music is also excellent).
And now for something completely different
Friday, 23rd September 2005
I felt like a different project for the evening, so started work on a console-based VGM player.
Click to download. [193KB] (Comes with a few sample tunes).
There are a number of (mainly minor) bugs listed in the readme.txt file, but it's not too shabby. It uses SDL to produce the sound (directly writing to the primary buffer). I'd be interested to hear any feedback!
Oh, Fire Track... Well, there's a rip of the BBC Micro version's in-game music (just recorded directly from an emulator, hence the sfx over the top) in the above zip file. Give that a listen!