Pretty much any 3d game stores its objects like Elite, there's no other real way to do it. Yes it is a list of coordinates, the "matrix" part comes in when you make it 3d.
A matrix in the general sense used in a 3d routine is a multiplication matrix that you need to rotate and move each object in your 3d world, not just each object in fact but each point of each object. This involves a crap load of multiplication and that's one of the things that makes 3d stuff slow on the poor old 1mhz C64, that AND the line draw. Looking at how fast both are and replacing both would be the best way to speed it up.
btw, if a draw routine goes to 255, that's 0-255 = 256
exactly. I'd add that in demos, clearing the screen is a huge bottleneck aswell. in games its percentage is probably less due to all the extra stuff a game has to do over a demo effect.
regarding speedup, it would be easyer to slow down the part of the game which counts time (if any?) and crank up the speed in an emulator
probably the lineroutine is not superoptimised, but it will be sub demo line drawer speed no matter what, coz demos use shitloads of memory to speed lines up, and I guess elite does not have that.
255 or 256 pixels wide: I bet its 256, but dont forget coders start counting from 0. so there's no problem adressing it.
so 256 pixels width makes it possible to draw into character sets instead of bitmap, which with column based char arrangement allows for faster liens.
anyway I recognise this topic as "daydreaming" probably noone will ever do anything about it.
When using lookup tables like these one should be able to get away with a minimum amount of calculation per pixel. Perhaps Elite already does something like that? Then locating the tables might make it (relatively) easy to find the line-draw routines.
the fastest way is not even using tables a fast lineroutine has code for each pixel column, one after the another in memory, you only have to adjust the Y coord while drawing the line, which can be the Y register on a cleverly organized character screen. to set the start end of the line, you jump into this code at the right place, and selfmod an rts to get out at the right place.
and you can go even faster than that, its possible to set more than 1 pixel at a time in a byte (small horizontal segments of liens), you could use the SID to calculate the slope for you, etc.
btw, if a draw routine goes to 255, that's 0-255 = 256
But, but... what if the draw routine starts from a pixel >=1 for some weird reason? [/quote]
in machine code 0 is a valid value like 1. and your first x coord is 0, and not 1. so you have 0 1 2 3 4 instead of 1 2 3 4, which explains how you get 256 different numbers.
If someone was really interested in doing this one of the guys over on the Atariage forum has disassembled the beeb version well enough to reassemble on other platforms (in this case Atari800) so it would be worth getting that source from him.
I might get laughed at but I'll throw my hat into the ring.
The fastest way to have all the coordinates rotations pre-calced into a look up table.
I think Elite did something like this from what I saw on the other page.
They in effect changed the coordinates into vectors. That would reduce your typical 9 multiplications and 3 additions to a single multiplication...since the matrix has all the coordinate's rotations pre-calced
Problem is you lose angle resolution since its a rough 3d matrix and the larger/further the objects get the less the amount of fine accuracy. So the matrix would have to be pretty large. I think I read the a Fast Fournier Transform could be used for interpolation in order to get around that.
Also, that's a nice line algorithm site (been there a few times) but there's the symmetric line algorithm where you only draw half the line then copy its other half saving rendering time...I heard that's pretty fast on top with the classics mentioned there.
That's what I'd do...but then I'm not a scener...not by any stretch.
Joined: 07 Jan 2003 Posts: 289 Location: Grimstad, Norway
Posted: Mon Oct 26, 2009 10:37 pm Post subject:
BTW, I seem to remember reading somewhere that for the C= 64 version they converted some of the maths to use logarithmic based code (which I believe gives you adds instead of multiplication for something) because it was a slower cpu. I'm guessing it used more space though.
Well, you'd have to think from Ian Bell's perspective that all of the old Elite stuff is now free to use for non-profit purposes. His e-mail might not work, but I contacted him on Facebook and he was very approachable.
Braben's a different story by all accounts. If you ask him I'm pretty sure the answer will be no.
This involves a crap load of multiplication and that's one of the things that makes 3d stuff slow on the poor old 1mhz C64, that AND the line draw. Looking at how fast both are and replacing both would be the best way to speed it up.
Multiplications can be done fast as hell on 6502. What's really slow is the clipping of the lines (divisions), and ofcourse the fact that you won't get away with 8 bit math for a game like Elite.
Joined: 21 Jan 2009 Age: 44 Posts: 21 Location: England
Posted: Tue Jul 13, 2010 5:27 pm Post subject:
Double Buffering would make a big difference but that's 25% of the 64's memory gone on the screen buffer/display when using a bitmap screen. Mercenary does this, the first thing I thought when I saw this pic was look at all that memory being used up!
Using char's seems to be the best option for speed and double buffering but I can't remember too many games using that method.
Joined: 26 May 2002 Posts: 829 Location: Edinburgh, UK
Posted: Tue Jul 13, 2010 5:41 pm Post subject:
Would that matter about so much of the memory being used up?
Because in the end there isn't much to Elite is there? It's just an illusion. Aren't all the names and descriptions of the planets just mashed together from some basic table of limited descriptions and .. eh .. syllables?
You cannot post new topics in this forum You cannot reply to topics in this forum You cannot edit your posts in this forum You cannot delete your posts in this forum You cannot vote in polls in this forum
Tip: Get C64 Forever for super-comfy C64 emulation with pre-installed games, demos and other goodies!