Re:New 3D FPS released for 1979 Atari 800
by legoxx on Thursday November 04, 2021 @04:59AM
(#29104816)
8kb table for logs would consider 16% of 64kb that you have for engine, game, intro and end sequence.
Re:New 3D FPS released for 1979 Atari 800
by fstrthnscnd on Thursday November 04, 2021 @06:11AM
(#29105261)
> for example, just to add two numbers you have to shift mantissas and 6502 has no fast way to do it
How much work is there to do beside shifting mantissa? (A shift is also necessary for many fixed point calculations).
6502 cannot multiply or divide (division is a costly operation even on modern CPUs) so I would use adding or subtracting logarithms for this purpose. 12-bit precision logarithm table requires just 8 Kb RAM (and you can get 13-bit precision with interpolation).
The disadvantage of this approach is that every time you convert a number from linear to logarithm or vice versa you get approximately up to 0.3% error (for 12-bit logarithm). So multiplying or dividing several numbers in a row is fine, but if you have to alternate multiplication with additions you will accumulate an error. So I would look for formulas that avoid this. But for a game a little error in calculations is not noticeable.
Also one might think that the most time-consuming part for pseudo-3D game is math and calculations. I doubt that. The most of CPU cycles are usually spent in rasterisation and applying textures. Is is easy to calculate positions of 3 vertices of a triangle, but it takes a lot of time to draw it line by line, pixel by pixel, and if you want to have textures this time can be multiplied 5x-10x.