Paradroid Redux
"A high-tech toilet," Andrew reminisces when you ask him where the name Paradroid came from. "That's what Technobots always reminds me of... We were messing around with some names and somehow we came up with Technobots. I even had it on the title screen for a while," he continues. "But then Paradroid came along and saved the day. It's a play on PARAnoid anDROID - everyone's out to get you."
TheOne: Work in Progress - Paradroid '90
Plan
- Fix bugs
- Take everything that is good and keep it
- Take everything that is bad and see if it can be made good
- Very, very carefully implement new ideas
Design problems
- all ships are identical (because of single load)
Code problems
- Delta calculation for visibility check took way too much time when droid was near or touching:
Luckily it could be replaced with slightly longer but much faster code:
For comparison, here is minimum time taken by old routine:
- Original screen redraw took ~18 000 cycles.
Rewriting it would cut it down to ~13 000 but requires updating visible dynamic elements in screen in addition to level map.
Optimized slightly, now it's ~15 000 cycles without need for separate update. - VIC-II writes weren't buffered, causing erratic sprite behavior.
Now everything is moved at the same time. Sprite register writes are delayed one frame to be in sync with screen redraw.
Bugs
- Enemy laser 1 / laser 2 damage was swapped.
fixed - Rarely droid mode wasn't initialized correctly, making some droids explode when entering level.
fixed - Player could go through walls by abusing asymmetry in wall collision check.
fixed - Droid exploding simultanously with other events had multiple problems:
- Transfer with such droid resulted in droid 402 (index $40, explosion).
fixed - Player droid in multiple collision. This might also lose one of exploding enemy droids.
fixed - Player droid bumped off from explosion, thinking it was 402-type droid.
fixed
- Transfer with such droid resulted in droid 402 (index $40, explosion).
- DroidNear() returned true for some faraway droids.
fixed - Waypoints had multiple problems too:
- Droids might lose waypoints if bumped into when they were just leaving one. This resulted in droid reversing its direction and going where no droid has gone before.
fixed - Droids ignored waypoints if they paused (either they fired or were bumped into) at the exact same time they entered waypoint.
fixed - Game checked for waypoints twice as often as necessary. (And how much did it help...)
fixed
- Droids might lose waypoints if bumped into when they were just leaving one. This resulted in droid reversing its direction and going where no droid has gone before.
- Non-visible area scanned was different in each direction.
fixed - Hardware collision checks are basically crap. Originally game tried to handle this by checking the topmost colliding sprites, ignoring others.
fixed - Interrupts didn't clear decimal flag, causing sound corruption every now and then.
fixed (This was also fixed in the Heavy Metal Paradroid) - The very last waypoint of the very last deck (maintenance) sent droids to wall.
fixed
Ideas to consider
- Doors:
- Triggered doors - can be made with waypoints
Player going through such door unlocks it for all droids
- Triggered doors - can be made with waypoints
- Each ship can specify separate font
- Each deck can specify separate floor/crate graphics
- Check Paradroid 90 for more:
- Stationary guard robots (waypoints with no exits) - needs changes to droid randomizer to reserve some waypoints for certain droids
- Low energy enemy droids seek energizers
- Environmental damage !
- Raiders - a lot like 834, but have stronger armor and move in packs. After 15 minutes of play they break ship hull and enter some deck, then start spreading through the ship. Prefer shooting player but don't hesitate attacking other droids as well.
- Transport pads - this might lead into some "interesting" visibility issues
Grenades/mines- not feasible. What to do when droid explodes a mine but there are no free sprites?
Current status
Download beta (22.8.2010)
- All code disassembled and relocated. Most of it is under $4000, the rest at $e000. All data is assembled into program with incbin, which makes moving it around much easier. There were many small fragments after binary patches, now they are all collected together.
- All ship data moved to $e800 and repacked. After adding couple of pointers it is finally possible to load more data from any kernal compatible device.
- Title screen, subgame screen and status area packed as well.
- Droid info organized more tightly, saving another 600 bytes.
- There is ~1 KB of free memory after giving ship data 6 KB (2 KB more than original). All that memory is now under $4800.
- Some bugs fixed, more cycles saved. It looks like there might not be need to rewrite DrawScreen() after all as the game runs almost stable 25 Hz. It only rarely drops to every third frame - this requires several firing droids.
- CalcDelta() does proper "n=int(255/max(dx,dy)); m=n*min(dx,dy);" instead of original shift-add pair (which took ~4500 cycles in worst case). Table lookup + 4-bit multiply takes ~100 cycles.
Multiply can be ditched if AddBullet() is rewritten to handle 9 bit speed. - Non-critical game elements re-ordered for better performance.
- Frame limiter added. No more 200% speed at top/bottom edges. Fixed to work with delayed VIC-II writes.
- Screen split rewritten, background graphic change is nearly perfect, sprites might be delayed one line. Now it's NTSC compatible too.
- Font rearranged for the above to work, I did complete reorganization while I was at it. Sprites rearranged too, resulting in faster animation routines and getting all free memory in single chunk below $4800.
- Assembly generates program file automatically for testing on real hardware. Easier than freezing VICE snapshot. Addendum: freezing wouldn't work anymore anyway, screen split crashes if timer is out of sync.
- Simple deck editor ready. Handles waypoints but not lifts. Need to improve this to give beta testers some fun work too.
- Sprite collision system rewritten! As a result it's slightly easier to kill 999 as you can shoot the droid it's overlapping and 999 gets caught in the explosion. On the other hand you are no more invulnerable to droid fire when there are colliding droids.
- Most of screen switching flicker is gone. Droid library rewritten for easier browsing.
- Sprite register writes are buffered. Yet another collision detection routine, this time completely without VIC-II collision register.
- DrawScreen() slightly unrolled and uses undocumented "lax abs,y" instruction, gaining ~3000 cycles per game frame.
- Timer init fixed, now game runs on old NTSC machines too. Now (finally!) it should be Drean compatible too, but I don't have means to check that.
- Sound FX player shortened by ~200 bytes, that made player faster too. This was the last unmodified part of code. Hooray!
- High score load/save debugged, this one should work with pretty much every device except datassette.
- ~100 more free bytes gained by code optimization and combining many small areas. By shrinking SFX table and utilizing low memory ~200 bytes more can be used, but after that I need to start removing cheats to fit more code into memory.
- Running far away droids now take ~10 raster lines, near droid is 8-32 lines more depending on the visibilty check.
- 520 bytes under I/O freed by compressing intro text. While I added unpacking behind title screen I also enabled sound there. Actually I did that a while ago but forgot to activate sfx driver...
- TestLine() is now down to 26-29 cycles per char for dy>dx lines, 18-24 cycles for dx>=dy. Init time is also shorter, but that required 432 byte table. Remember that the original routine used 81 cycles for each char!
- Background sound in console added. Lift still needs this done, but that one may require moving bg sound logic into interrupt.
- Waypoints are marked with "magic chars" so droids don't waste time checking if they are on one. Waypoints can be placed on four different tiles, one of them can be different for each deck.
- Droid behavior tweaked to be a bit more unpredictable under red alert.
- Some background stars added, needs tweaking. NTSC-fixed already, but should be randomly placed and with different colors if it stays.
- C128-specific bugs fixed. All these introduced by myself, not in the original. I blame too fast code.
- Object data doesn't have to be moved any more everytime object is removed. This allows more droid-specific data which speeds up the game.
- First steps towards droid AI when its visibility changes. For now droids may pause and reconsider whether to flee (when the become visble) or pursuit player (when they get out of sight).
- Metal Edition graphics selectable in the same executable.
Added features
- Built-in cheat mode:
- invulnerabilty (1)
- instant kill (2)
- fast fire (3)
- fast droid (4)
- automatic transfer (5)
- X-ray vision (6)
- radar for all droids (7)
- cheat lift (8)
- complete deck (D)
- complete ship (S)
- droid selection (+-)
- Game pauses out-of-view droids if it finds it's running out of time for current frame.
Removed temporarily. - Game tries to avoid droid losing when there are no more sprites available by teleporting droids away
- #droids remaining on deck/ship shown in console
- Disruptor and bullet no longer restart explosion, but bullets are still absorbed by it
- Game statistics
Statistics for previous game can be viewed during intro sequence by pressing F3. Run-stop to exit. - Radar for droids equipped with one: all class 7-9 droids except 751. It only works if there are no droids in visual range and player has been stationary for two seconds. Energizer disables it too.
- Support for second fire button. Press it while title screen is shown to start game in two-button mode. Use second button to go into transfer mode, first button for everything else. This should now work with weird button configurations too.
- Scoring:
- Alert scoring adjusted to match instructions. Alert decay rate slowed down to compensate for that, now it takes 60 seconds to drop one level.
- Ship clear bonus is now up to 5000 points based on accuracy + extra 500/1500 points if you complete ship under amber/red alert.
- If you complete a ship without shooting you get 2500 point bonus. Shooting voids pacifist bonus for any later decks. Bumping is allowed.
- Worst score of the day replaced with all time high score.
- High score saver added.
- High score entry remembers previous initials.
- F7/F8 during the intro secuence selects start ship from any previously visited ships. This info is saved to disk so you can carry on from your last game.
- Droid AI:
- Lower class droids try to run away from visible player, especially if damaged. Class 6-9 droids go towards player, radar equipped droids do that even if player is not visible. Both flee and pursuit behavior are strengthened by alert status.
- Droids use energizers if needed and they happen to wander onto one.
- Droid fire probability goes up when alert rises above yellow. Red alert equals normal probability on next level, amber is halfway between current and next level.
- Door to bridge requires at least class 6 droid to open. It doesn't have to be player droid though. There can be max. 64 security doors on a single ship.
- Damage:
- Droids getting hit by friendly fire sustain same damage than from player with the exception that type 1 laser damages 834 and above too.
- Droid-in-explosion damage adjusted slightly, now droids have a bit better change of surviving.
- Droid-droid collision randomizes droid priority, this eliminates "three droid deadlock" where the middle droid keeps two other droids paused. Player droid can still be stuck between two enemy droids.
- Droid waypoint changes:
- Droid starting points randomized each time you enter deck. This now knows how to handle split levels.
- Some waypoints near lifts are excluded from valid droid starting points. This makes many decks much safer to enter.
- Decks can have "spawning point" separate from waypoints. This is the point where player starts a new ship. This avoids exluding top left waypoint from droid starting points and allows specifying possible starting decks with data, instead of using hardcoded limits.
- Deck sections completely separated from each other. One section can power off while there are still droids in the other one. Bonus is only awarded when the while deck is empty.
- Shooting droids lowers their pulser count in subgame. Remember that you have to survive with damaged droid if you plan using this for your advantage.
- Optional Competition Mode: ships are populated with seeded pseudorandom generator, so all decks have predetermined droids. Player starting position is fixed as well. That reduces the effect of luck when game is played in high score competition. High score screen has 883 droid when in Competition Mode.
Notes
- Development blog
- tiles & chars:
- Collision detection (needs pictures)
- Some strategy hints