Some useful tricks for game programming

All 680x0 related coding posts in this section please.

Moderators: simonsunnyboy, Mug UK, Zorro 2, exxos, Moderator Team

Postby leonard » Tue Nov 20, 2007 5:27 pm

When using convex 3D objects, you just have to test if an object is visible with 2 multiplications, then all lines that go down are right borders, and all lines that go up are left borders (if you use clockwise order).
Once you computed all left and right borders, you just have to fill horizontal lines.


You are right. And even faster you can compute left and right border at the same time you are filling objects (routine is not so easy to code but a bit faster, because you save many read/write to memory). TCB use that great trick with another one in their "flashback" 3d introduction. TCB use a great trick for speed up polygons where lines are "almost vertical". If the two left/right border does not change, they "jump" directly in the same filling routine.

I use it in my really fast ARM polygon filler used for a speed contest with a friend. it's actually (I guess) the fastest flat-shaded polygon filler on GBA (ARM7) :-)
Leonard/OXYGENE.
User avatar
leonard
Moderator
Moderator
 
Posts: 529
Joined: Thu May 23, 2002 10:48 pm

Postby leonard » Tue Nov 20, 2007 5:28 pm

So we don't know who invented ADDX.L ?

Maybe we could find into games. Can someone post a list a famous 3d games and their release date, so we can check with emulator debugger if they use ADDX ?
Leonard/OXYGENE.
User avatar
leonard
Moderator
Moderator
 
Posts: 529
Joined: Thu May 23, 2002 10:48 pm

Postby terence » Tue Nov 20, 2007 8:55 pm

do you remember that 3D game on ST if i remember well, with loopings, some kind of cars run ? i don't remember the name.
All i remember is that you (JC/Mcoder) told me that the 3D coding was intersting in this game.

i think i remember that you checked the code on Amiga or ST.

was it the source of addx ?
terence
Atari nerd
Atari nerd
 
Posts: 46
Joined: Fri Jul 01, 2005 11:36 am

Postby unseenmenace » Tue Nov 20, 2007 10:30 pm

terence wrote:do you remember that 3D game on ST if i remember well, with loopings, some kind of cars run ? i don't remember the name.

Hard Drivin?

http://www.atarilegend.com/games/games_detail.php?game_id=24
UNSEEN MENACE
Several STFM's, 4MB STE, 2MB TT with 1.2GB Hard Drive and 14MB Falcon with 540MB Hard Drive,
Lynx 2 and Jaguar with JagCD
Member of GamebaseST and AtariLegend team
Check out my website at http://unseenmenace.110mb.com
User avatar
unseenmenace
Atari God
Atari God
 
Posts: 1958
Joined: Tue Sep 21, 2004 9:33 pm
Location: Margate, Kent, UK

plop

Postby C-Rem » Tue Nov 20, 2007 10:35 pm

or stunt car ?
C-Rem
Captain Atari
Captain Atari
 
Posts: 385
Joined: Wed May 01, 2002 6:45 pm

Postby leonard » Tue Nov 20, 2007 10:42 pm

terence wrote:do you remember that 3D game on ST if i remember well, with loopings, some kind of cars run ? i don't remember the name.
All i remember is that you (JC/Mcoder) told me that the 3D coding was intersting in this game.

i think i remember that you checked the code on Amiga or ST.

was it the source of addx ?


I guess the game you mention is "Hard Drivin". I just download it and look at the code using SainT Debugger. and.... it does NOT use ADDX.L :-) It use quite "traditional"

add.w d0,d1
addx.w d2,d3
move.w d3,(a0)+

this is not the modern form

addx.l d0,d1
move.w d1,(a0)+

Btw the way I just download and look at "Stunt Car" racer. I have to admit the game is very good but it's the loosiest polygon filler I've ever seen. (tons of DBF used in the inner scanline loop, etc).

And I looked the the "Interphase" code (very good routines) but I can't find the edge computation routine :-( Maybe the computation is mixed with the rasterizer. Have to look more carefully..

ADDX.L historical problem is still open :-)
Leonard/OXYGENE.
User avatar
leonard
Moderator
Moderator
 
Posts: 529
Joined: Thu May 23, 2002 10:48 pm

Postby leonard » Tue Nov 20, 2007 11:16 pm

Ok I checked Interphase... It does NOT use ADDX.L. Instead it uses some classical

add.l dn,dn
swap dn
move.w dn,(a0)+
swap dn

(the code is better than this by writing left and right edge wit one MOVE.L, but that's the idea)

So who invented ADDX.L ???
Leonard/OXYGENE.
User avatar
leonard
Moderator
Moderator
 
Posts: 529
Joined: Thu May 23, 2002 10:48 pm

Postby bullis1 » Tue Nov 20, 2007 11:49 pm

Check No Second Prize, Frontier, Hunter, and Trex Warrior. Those are quite famous (except Trex Warrior).
User avatar
bullis1
Fuji Shaped Bastard
Fuji Shaped Bastard
 
Posts: 2235
Joined: Tue Dec 12, 2006 2:32 pm
Location: Canada

Postby leonard » Wed Nov 21, 2007 12:08 am

bullis1 wrote:Check No Second Prize, Frontier, Hunter, and Trex Warrior. Those are quite famous (except Trex Warrior).


I just checked No-Second-Prize (written by Michael Bitner, remember the famous madmax tune) ?)

It does not use ADDX.L, but it uses a very good routine, and it's a surprise to me: that's almost the same routine than TCB in flash-back demo! As Michael Bittner wrote 3d rout very early (Union Demo), I guess Nick/TCB get Micheal ideas when they worked at Thalion (it's only a guess, if someone know anything about the story I'm very interested).
Nick's routine has small improvments (using MOVEM.L instead of MOVE.L) but it's almost the same routine as no second prize.
Leonard/OXYGENE.
User avatar
leonard
Moderator
Moderator
 
Posts: 529
Joined: Thu May 23, 2002 10:48 pm

Postby earx » Wed Nov 21, 2007 9:36 am

ah, no second prize.. an old friend of mine once checked NSP and modified this routine to do without self modifying code. he even said it was slightly faster that way. afaik, it was Nick's routine.

btw, why use scan tables at all? i don't need em and my routs are just as fast (at the cost of more complicated code, sadly, hahah :))
User avatar
earx
Captain Atari
Captain Atari
 
Posts: 353
Joined: Wed Aug 27, 2003 7:09 am

Postby bullis1 » Wed Nov 21, 2007 3:37 pm

leonard wrote:
bullis1 wrote:Check No Second Prize, Frontier, Hunter, and Trex Warrior. Those are quite famous (except Trex Warrior).


I just checked No-Second-Prize (written by Michael Bitner, remember the famous madmax tune) ?)

It does not use ADDX.L, but it uses a very good routine, and it's a surprise to me: that's almost the same routine than TCB in flash-back demo! As Michael Bittner wrote 3d rout very early (Union Demo), I guess Nick/TCB get Micheal ideas when they worked at Thalion (it's only a guess, if someone know anything about the story I'm very interested).
Nick's routine has small improvments (using MOVEM.L instead of MOVE.L) but it's almost the same routine as no second prize.


That Madmax tune was indeed excellent :)

I'm quite confident that Hunter (and maybe Frontier) will not use any crazy commands such as ADDX.L, but Trex Warrior might. It's from the makers of No Second Prize and uses (apparently) even more optimized code, so it's worth a shot.
User avatar
bullis1
Fuji Shaped Bastard
Fuji Shaped Bastard
 
Posts: 2235
Joined: Tue Dec 12, 2006 2:32 pm
Location: Canada

Postby jazz » Wed Nov 21, 2007 6:42 pm

Actually, No second prize was coded by Chris Jungen while, indeed, Trex Warrior was masterminded by Michael Bittner.

A funny (?) extract from the realtime article wrote during the STNICCC 90 :

"I just had some food and I suddenly feel considerably better than I did about 1 hour ago. Just now I saw a 3D demo by Ziggy Stardust and M-Coder plus some other guy whose name I did not catch. They were very proud of the demo, and rightly so. The design and objects in it were really well thought out. The routines were really fast too, but not that fast, they still don't know a few tricks that I do and that I know Nick does too. These alone would save quite a bit of processor time. The routines of Niclas and also those of Chris Jungen are still quite considerably faster.

I feel inspired perhaps I will code some more 3D after all. After all if they say it takes 50 years to get as good as they are then it must be right mustn't it???????

Manikin ".
jazz
Atari User
Atari User
 
Posts: 34
Joined: Wed May 18, 2005 12:11 pm

Postby mcoder » Wed Nov 21, 2007 7:24 pm

unseenmenace wrote:
terence wrote:do you remember that 3D game on ST if i remember well, with loopings, some kind of cars run ? i don't remember the name.

Hard Drivin?

http://www.atarilegend.com/games/games_detail.php?game_id=24


Yes, I think it's Hard Drivin.
If I recall correctly, the code is very impressive !

Edit: In fact, I realized that it may be a discovery of Algernon and myself.
We had frequent meetings, where we exchanged ideas, by working on different demos (no, Ziggy was not here at this moment).
It's when you discover that you can use such an instruction that you feel very happy !
(I still remember with pleasure the ABCD/MOVEP.L tricks for the BCD->ASCII score conversion, along with ROL.L/ROR.L for 2 planes sprite shifting)
mcoder
Atari maniac
Atari maniac
 
Posts: 90
Joined: Thu Oct 04, 2007 6:42 pm
Location: France

Postby terence » Wed Nov 21, 2007 8:32 pm

yes this is hard drivin.

funny comment from manikin above.
terence
Atari nerd
Atari nerd
 
Posts: 46
Joined: Fri Jul 01, 2005 11:36 am

Postby earx » Fri Nov 23, 2007 12:14 pm

hehe, that manikin comment makes me think i should take a look at NSP again..
User avatar
earx
Captain Atari
Captain Atari
 
Posts: 353
Joined: Wed Aug 27, 2003 7:09 am

Postby Gunstick » Sat Nov 24, 2007 12:09 am

also note that bresenham routine (that's what we are talking about here) for polygons or lines is also very useful to play modfiles. Maybe addx was first used for music players. That's where I first heard about it.
Gunstick
Captain Atari
Captain Atari
 
Posts: 230
Joined: Thu Jun 20, 2002 6:49 pm
Location: Luxembourg

Re:

Postby TAD_uk » Wed Jan 07, 2009 9:11 am

Gunstick wrote:also note that bresenham routine (that's what we are talking about here) for polygons or lines is also very useful to play modfiles. Maybe addx was first used for music players. That's where I first heard about it.


Thats where I used to use the ADDX trick to step through the sample at different rates.

Using 16.16 fixed point maths to store the position (offset.part = 32 bits) and step (integer.fraction = 32 bits) a 'normal' 16.16 fixed point add.l would be like this:

d0 = (offset.0) << 16 + (part)
d4 = (integer.0) << 16 + (fraction)

add.l d4, d0

but you'll need a swap to access the top 31..16 bits of d0 (the offset.0 value)

swap d0 ; swap offset <--> part
move.w d0, (a0)+ ; store the offset value
swap d0 ; restore d0 value

If you are careful you can also chain multiple ADDX together for more than 1 polygon edge OR sample voice step.

(example from my memory, so hopefully correct)

move.w d0-d3, (a0)+ ; store the integer offsets d0,d1,d2,d3
addx.l d4, d0
addx.l d5, d1
addx.l d6, d2
addx.l d7, d3

the set up of the d4 to d7 register use bits 31-16 as fractional step and bits 15-0 as the integer step BUT not in the normal way !!

If you set up your registers something like this:-

d0 = (part.1) << 16 + (offset.0)
d1 = (part.2) << 16 + (offset.1)
d2 = (part.3) << 16 + (offset.2)
d3 = (part.0) << 16 + (offset.3)


and STEP value like this:-

d4 = (fraction.1) << 16 + (integer.0)
d5 = (fraction.2) << 16 + (integer.1)
d6 = (fraction.3) << 16 + (integer.2)
d7 = (fraction.0) << 16 + (integer.3)

NOTE: The part.0 ... part.3 and fraction.0 ... 3 are 'out of sync' so one ADDX will increment both integer.X value as well as fraction.x+1 value.

Hope this all makes senses.

Cheers

TAD_uk
TAD_uk
Retro freak
Retro freak
 
Posts: 12
Joined: Sat Jan 03, 2009 10:08 pm

Re: Some useful tricks for game programming

Postby keops » Mon Feb 16, 2009 4:37 am

Mcoder : does the yahoo group / wizfrog list still exist ? (the one we used ages ago with ST CNX and the other french guys)

I don't have access to my old account so I have no idea if this list is still used.
User avatar
keops
Atari Super Hero
Atari Super Hero
 
Posts: 515
Joined: Mon Jul 26, 2004 3:39 pm
Location: Canada

Re: Some useful tricks for game programming

Postby mcoder » Mon Feb 16, 2009 8:30 am

keops wrote:Mcoder : does the yahoo group / wizfrog list still exist ? (the one we used ages ago with ST CNX and the other french guys)

I don't have access to my old account so I have no idea if this list is still used.


Never heard about this group.
After a quick look the group is pretty lethargic:
http://fr.groups.yahoo.com/group/wizfrog/

I just registered, and will post one message as soon as I have access to it.
mcoder
Atari maniac
Atari maniac
 
Posts: 90
Joined: Thu Oct 04, 2007 6:42 pm
Location: France

Re: Some useful tricks for game programming

Postby keops » Mon Feb 16, 2009 12:41 pm

I was pretty sure I saw emails from you on this group back then but it must have been Ziggy then :)

Back in 2000 it was already quite inactive so I would not be surprised if it was not used anymore.
User avatar
keops
Atari Super Hero
Atari Super Hero
 
Posts: 515
Joined: Mon Jul 26, 2004 3:39 pm
Location: Canada

Re: Re:

Postby illegal » Thu Aug 19, 2010 1:12 am

Well i saw this post only in 2010... from Mcoder => he says

"I quitted in bad terms with Illegal, because he cracked Toki, with a lame intro. I have been very patient with him, and he didn't deserve my time.
So f*ck him !"

For this i will say : mcoder was a developer working for ocean france and we were in a kind of friendly relation. I was very glad to benefit from the experience of a such gifted developer in fact. To be honest, a very good developer, not the best i've known, but better than me, yes. However, he promised me on toki to put a protection of my own on the game. That never happened, he did not fulfill his promise, even tough i made the protection and so on. JC thinks he is the smartest and mathematics is his world. But to be honest, i think that no one deserve JC in fact... except a compression algorithm, maybe.

He says also =>
Pascal died several years ago. He was quite young.
The official reason was an home accident, but I think he committed suicide.

In the atari scene we were all liking very much pascal as a so nice and so clever man. i do not know why he's dead, and i do not want to (even if i know some facts about it). but, i think we all should respect his memory. I regret his death like many of us. JC you should not write this kind of things.

Cheers to you all ... except JC of course, because he is so pissed off by my TOKI Crack - no i'm just joking - not as stupid as this hehe... hey JC you should reread your post and see how stupid it is, after all these years!!!. Stéphane
User avatar
illegal
Atari Forever
 
Posts: 55
Joined: Sat Dec 06, 2003 12:53 pm

Re: Re:

Postby mcoder » Thu Aug 19, 2010 7:58 am

illegal wrote:Well i saw this post only in 2010... from Mcoder => he says
For this i will say : mcoder was a developer working for ocean france and we were in a kind of friendly relation. I was very glad to benefit from the experience of a such gifted developer in fact. To be honest, a very good developer, not the best i've known, but better than me, yes. However, he promised me on toki to put a protection of my own on the game. That never happened, he did not fulfill his promise, even tough i made the protection and so on. JC thinks he is the smartest and mathematics is his world. But to be honest, i think that no one deserve JC in fact... except a compression algorithm, maybe.


It was not my decision to not include your protection, and I was very pissed by Mard D.'s cowardice for not including it !

I never thought I was the best in anything in the world (except at the moment where I met you, since I had so much complexes), because I encountered so many people more brilliant than me.
What I'm very proud of is to have been able to regroup some of the best coders to work on 3D on the Atari ST (that includes Ziggy, Algernon, and in a lesser measure Zarathoustra and Altair).

illegal wrote:In the atari scene we were all liking very much pascal as a so nice and so clever man. i do not know why he's dead, and i do not want to (even if i know some facts about it). but, i think we all should respect his memory. I regret his death like many of us. JC you should not write this kind of things.

Cheers to you all ... except JC of course, because he is so pissed off by my TOKI Crack - no i'm just joking - not as stupid as this hehe... hey JC you should reread your post and see how stupid it is, after all these years!!!. Stéphane


Yes, I was (and still am) pretty pissed by the finger you showed in your crack, and yes, I took it personally.

About Pascal, I really liked this guy.
Every wednesday, we went to restaurants near his appartment at rue Monge.
These were great moments, but I don't think we should hide our feelings towards his death, even though I don't want to enter into details of his death.
mcoder
Atari maniac
Atari maniac
 
Posts: 90
Joined: Thu Oct 04, 2007 6:42 pm
Location: France

Re: Some useful tricks for game programming

Postby illegal » Fri Aug 20, 2010 1:16 am

ok. you are humble guy. I know this. you have explained this, alright. let me explain
the finger was not intended to you, but to the people who betrayed me on this protection story.
and you konw how fool we were when we were with cameo/replicants together we had this bad idea, taking the opportunity there was a camera in a copy party while i was cracking toki... i sincerely regret to have hurted you

You know you have been at my eyes someone brilliant and you gave me one of my favourite intro. I have much respect of you for this and for you are a clever guy.

I apologize for having hurted you with the intro.

JC i hope you accept this because i have never wanted to hurt you, never, and i would like that we forget this incident to remember what has been good in our relation.
User avatar
illegal
Atari Forever
 
Posts: 55
Joined: Sat Dec 06, 2003 12:53 pm

Re: Some useful tricks for game programming

Postby illegal » Fri Aug 20, 2010 1:22 am

for pascal, i have thought about this question so many times.
i do not know the truth, but just thinking of this makes me disturbed
God bless Pascal because he was a great man in my eyes and my heart, and for so many people who were close to him
God bless also milan bedov, another friend of pascal who's died in a car accident
User avatar
illegal
Atari Forever
 
Posts: 55
Joined: Sat Dec 06, 2003 12:53 pm

Re: Some useful tricks for game programming

Postby illegal » Sun Aug 22, 2010 1:13 am

and there is no response... once more mcoder you are showing me you do not deserve the friendship we had. who's patient ?
User avatar
illegal
Atari Forever
 
Posts: 55
Joined: Sat Dec 06, 2003 12:53 pm

PreviousNext

Return to 680x0

Who is online

Users browsing this forum: CommonCrawl [Bot] and 2 guests