Francois Lanciault wrote, on 25/Sep/12 04:03 | Sep25:
Hi Thorsten,
I had the idea for this project after designing a gimbal for an antenna on a
satellite at work. I had to work with 3D transformation matrices for the beam
pointing, especially rotation matrices. Having this renewed knowledge of all
the mathematics involved in 3D transformation I felt ready for a 3D program,
something I always wanted to do since I first put my hands on a zx81 a long
time ago.
I started with implementing a few basic 3D routines in Superbasic. When everything was working, I
switch to "C" programming for more speed. I wrote the complete 3D engine without even
compiling my code once. Then I wrote the point and line algorithm also in C. After correcting all
the bugs that pop out during compiling, I tried the speed of my new line drawing capabilities by
drawing a few hundred lines on screen. I told myself "Basic is slow, my C version will be much
faster!" To my surprise, my version was 2X slower than basic. This was a bad news. Line
drawing must be much faster than basic for this to work. My next version was in assembler. I was
hopping to get a 10X speedup compare to the C version, I got 12X. Good. I also wrote the line
removal routines in assembler.
This was last Friday. I was ready to test the engine. Took me half a day to
remove the bugs. It worked but the speed was terrible, but I was expecting
this. The reason this time was the speed of the double precision floating point
calculations in C. Again, Superbasic is faster than C (But C has more
precision). In a 3D engine, there is a lot of trigonometric functions involved
and these are quite slow. So again, I recoded everything using integer
arithmetics with new machine code trigonometric function. That is when I got 30
frame per second...
BTW when I am done with this, I will put the 3D engine in the public domaine,
if anyone wants to play with it.
Sorry for the long mail.
Absolutely not long enough!
This sounds a mightily interesting project. I *hate* these sort of
shoot up games though (8-)#
... but is magnificent work.
I bet it will be even slicker under QPC.
You talking of frame rates reminds me of this lecture in Berlin a couple
of years ago:
http://blip.tv/jsconfeu/ben-firshman-lessons-learnt-pushing-browsers-to-the-limit-4300940
The games are http://fir.sh/projects/jsnes/ .
Simon Goodwin gave him some good info about sound.
Ben wrote it first when he was 13, but only completed and released it,
with sound, at Uni.
One of the most interesting aspects was his direct dialogue with both
Firefox and Safari developers. Microsoft also modified MSIE but not one
contact with him direct.
Firefox actually majored on speed-up code for one release.
It is a classic example of the importance of optimisation in screen
drawing, which I am sure guys like that unpronounceable Jan Mrsik Flogel
(or something like that) used.
Tony
--
t...@firshman.co.uk http://firshman.co.uk
Voice: +44(0)1442-828254 Fax: +44(0)1442-828255 Skype: tonyfirshman
TF Services, 29 Longfield Road, TRING, Herts, HP23 4DG
_______________________________________________
QL-Users Mailing List
http://www.q-v-d.demon.co.uk/smsqe.htm