Discussion:
Epoch Math
(too old to reply)
fadden
2020-09-24 20:20:57 UTC
Permalink
I've posted a mostly-complete disassembly of Epoch. If you're not familiar, it's an Apple II space shooter with a remarkably high pixel fill rate.

The reason it's incomplete is that I haven't figured out how the main math tables work. The game does some of the usual 3D stuff -- rotation, perspective projection -- but does them in atypical ways. I know generally what it's doing, but it's doing it in a way I haven't encountered before.

Epoch has proven difficult to disassemble, for a number of reasons. It has a lot of distractions, like copy-protection booby traps and a smattering of code that accomplishes nothing (looks like conditional assembly that was poorly delimited), but mostly it just does things in ways I don't expect.

For example, the code that spawns new objects will sometimes scan the list of existing objects, and change the spawn location if a certain value matches. This didn't make any sense until I realized that the enemy ships and bases don't actually shoot at you. The game just spawns a "ship projectile" or a "base projectile", and then goes looking for a ship or base to use as a point of origin. If it can't find one, it drops the projectile into a random place and points it at the player.

When the player rotates, the X/Y positions of objects are updated, but not Z. So as objects are rotated away from the center of the screen, they get farther away. But objects are visually scaled by Z coordinate, not distance, so their appearance doesn't actually change. Two "wrong" things balance each other out (...mostly).

On more than one occasion I made the mistake of assuming that the code must do a certain thing, and then either being confused when it didn't or making incorrect assumptions about code that did something similar. So it took a little longer to get it all straight.

If anybody is curious and feels like poking at it, I have a fairly detailed explanation on the "Epoch Graphics Engine" page, along with the math tables in C++. It also goes into detail on the high-speed rendering routines should that be a topic of greater interest.
Michael 'AppleWin Debugger Dev'
2020-09-25 11:21:28 UTC
Permalink
If anybody is curious and feels like poking at it, I have a fairly detailed explanation on the "Epoch Graphics Engine" page, along with the math tables in C++. It also goes into detail on the high-speed rendering routines should that be a topic of greater interest.
Direct Link for those curious:
https://6502disassembly.com/a2-epoch/engine.html
TomCh
2020-09-26 16:45:11 UTC
Permalink
I've posted a mostly-complete disassembly of Epoch. If you're not familiar, it's an Apple II space shooter with a remarkably high pixel fill rate.
The reason it's incomplete is that I haven't figured out how the main math tables work. The game does some of the usual 3D stuff -- rotation, perspective projection -- but does them in atypical ways. I know generally what it's doing, but it's doing it in a way I haven't encountered before.
Epoch has proven difficult to disassemble, for a number of reasons. It has a lot of distractions, like copy-protection booby traps and a smattering of code that accomplishes nothing (looks like conditional assembly that was poorly delimited), but mostly it just does things in ways I don't expect.
For example, the code that spawns new objects will sometimes scan the list of existing objects, and change the spawn location if a certain value matches. This didn't make any sense until I realized that the enemy ships and bases don't actually shoot at you. The game just spawns a "ship projectile" or a "base projectile", and then goes looking for a ship or base to use as a point of origin. If it can't find one, it drops the projectile into a random place and points it at the player.
When the player rotates, the X/Y positions of objects are updated, but not Z. So as objects are rotated away from the center of the screen, they get farther away. But objects are visually scaled by Z coordinate, not distance, so their appearance doesn't actually change. Two "wrong" things balance each other out (...mostly).
On more than one occasion I made the mistake of assuming that the code must do a certain thing, and then either being confused when it didn't or making incorrect assumptions about code that did something similar. So it took a little longer to get it all straight.
If anybody is curious and feels like poking at it, I have a fairly detailed explanation on the "Epoch Graphics Engine" page, along with the math tables in C++. It also goes into detail on the high-speed rendering routines should that be a topic of greater interest.
Epic work, Galactic Emperor! :-)

A fun game I played as a child - I'd often play together with a friend to make it easier to control!

Your write up and reverse-engineering is impressive and very interesting.

Thank you.
Tom

Loading...