Saturday, January 29, 2011
Object Explosions - Scrolling issues.
Got the object collisions and explosions worked out around 90% (there are a couple of bugs I'm trying to work out - but I think I've tracked down most of them).
Some of them came down to a rather dumb oversight that might cost me a bit of time - the scrolling.
The method I chose was one I was familiar with from the scrolling text demo days that lets you scroll forever by making a workscreen twice as wide as the visible and updating both sides of it, when you get to the end you jump back to the start again and scroll across.
Static objects (like missiles) are also drawn this way (as background tiles) in order to save frame time (they take advantage of being scrolled with the landscape - and so dont have to be redrawn each frame). The problem of course is that they have to be erased twice also (otherwise they reappear when the screen jumps). All these blits will quickly add up as more objects and enemies are added... So before things get TOO complicated, I'm going to redo the scroll routine. One that lets static objects continue to take advantage of the scrolling, while not having the jumpback problem.
How to do that?
Well, seems simple enough - just don't jump back to the beginning of the screen - allow it just keep on scrolling through memory.
'But you can't do that!' Sure I can! - for every 40 bytes (320 pixels) I scroll it's the same as going down ONE line of screen. So, add one LINE of screen mem for each full screen I scroll.
The current system uses a double width screen (640 pixels) - so that's 200 screens!
But theres more.. I don't JUST have an entire extra screen - I have an entire extra screen of 5 bitplanes. So - 200 x 5 ... this is 1000 screens.
And more still.
The playable area of the screen is 11 tiles high - that's 160 pixels, not 200. This works out around about 1250 screens of scrolling.
The original Arcade game has a 11406 pixels of map from start to finish on a level. That's around 35.5 screens. Lets call it 36.
So, you'd have to go through the entire original map approx 35 times, WITHOUT LOSING A LIFE (because you reset to the start of screen memory and redraw the start of the stage when you blow up) to reach the end of the memory (as it stands now).
Not impossible, but highly improbable. Just in case, in the final game I'm going to do a cut-screen every 5 times through the map with a 'Good Luck Commander' or some such - award a bonus or something. This will make that improbable, impossible.
At some point I'll tidy it up somewhat (change the screen/blit modulos) but for now I'm going to 'just make it work' and bug free.
Subscribe to:
Post Comments (Atom)
No comments:
Post a Comment