It is currently Mon Dec 18, 2017 3:59 am

All times are UTC - 7 hours





Post new topic Reply to topic  [ 11 posts ] 
Author Message
PostPosted: Sun Jan 02, 2005 8:06 pm 
Offline
User avatar

Joined: Mon Sep 20, 2004 4:07 pm
Posts: 34
Location: South Dakota
I haven't had anything else to do for the last three days, so I put together a little 3D demo for the NES. The methods I used are far from optimal, but the code seems to be stable and runs correctly on every emulator I've tested.

Features include:
- 1-8 moving objects, selectable
- 1-3 axes of rotation, selectable
- hex display of rotation matrix
- frame rate counter

Framerate ranges from 6 to 60 FPS, depending on how many objects and how many matrices are in use. I do plan to rewrite this sometime in the future to use a faster multiplication algorithm, and faster 3D transformations. (I really need to get into GBA assembly...)

The ROM is available on my temporary website. (my main website is currently being redesigned)

Would anyone with an NROM devcart be willing to test this on hardware?

_________________
- abonetochew


Top
 Profile  
 
PostPosted: Sun Jan 02, 2005 8:49 pm 
Offline

Joined: Mon Nov 22, 2004 3:24 pm
Posts: 162
Location: Sweden
Nice work, I'm impressed! There's nothing quite like watching hex dumps in a tech-demo =)

The depressing thing is that there's some insane C64 demos out there than beat the crap out of anything we mere mortals could ever write. Dawnfall somehow manages to rotate 250 points in full framerate on a machine half as fast..


Top
 Profile  
 
 Post subject:
PostPosted: Mon Jan 03, 2005 6:45 am 
Offline
Site Admin
User avatar

Joined: Mon Sep 20, 2004 6:04 am
Posts: 3488
Location: Indianapolis
Awesome! I wanted to write something like this a while back, but I suck too much at math. I tried, but only ended up with some neat sinewave-based 2D patterns, heheh.

I'll test this on my cart later and let you know how it went. I might be able to make it run faster, it could be a good test for Squeedo's hardware multiplier feature.


Top
 Profile  
 
 Post subject:
PostPosted: Mon Jan 03, 2005 11:20 am 
Offline
Site Admin
User avatar

Joined: Mon Sep 20, 2004 6:04 am
Posts: 3488
Location: Indianapolis
It works. I'll try something to speed it up a little.


Top
 Profile  
 
 Post subject:
PostPosted: Mon Jan 03, 2005 3:43 pm 
Offline
User avatar

Joined: Mon Sep 20, 2004 4:07 pm
Posts: 34
Location: South Dakota
Yay! I've written a NES demo that actually works on hardware! Happiness! Glee!
... Now that I'm done with that, where might I be able to find some of these C64 demos? I need to study the techniques of the immortal coders...

_________________
- abonetochew


Top
 Profile  
 
 Post subject:
PostPosted: Mon Jan 03, 2005 3:54 pm 
Offline
Site Admin
User avatar

Joined: Mon Sep 20, 2004 6:04 am
Posts: 3488
Location: Indianapolis
There were some really good 3D articles in a few C=Hacking issues also (I forgot which ones, there's an index tho).
http://www.ffd2.com/fridge/chacking/


Top
 Profile  
 
 Post subject:
PostPosted: Mon Jan 03, 2005 4:49 pm 
Offline

Joined: Mon Nov 22, 2004 3:24 pm
Posts: 162
Location: Sweden
abonetochew wrote:
Yay! I've written a NES demo that actually works on hardware! Happiness! Glee!
... Now that I'm done with that, where might I be able to find some of these C64 demos? I need to study the techniques of the immortal coders...

Try watching through the top demos at http://noname.c64.org/csdb.
Seeing Deus Ex Machina for the first time is something of a revelation, I just didn't want to believe it was possible until I saw it on hardware.
Oh, and I meant One-Der, not Dawnfall (both are 64 kB intros by Oxyron).


Top
 Profile  
 
 Post subject:
PostPosted: Tue Jan 04, 2005 11:07 am 
Offline
User avatar

Joined: Mon Jan 03, 2005 10:36 am
Posts: 2983
Location: Tampere, Finland
An ok demo, tho I think much more could be taken out of NES 3D-wise :)

It's not worth comparing NES with C64... they're pretty different. NES was designed to be easy to write games with, whereas C64 (as it seems to me) is much more versatile. There's also much more information for C64 available and also many more developers developing for C64.


Top
 Profile  
 
 Post subject:
PostPosted: Wed Jan 05, 2005 7:09 am 
Offline

Joined: Mon Sep 20, 2004 6:47 am
Posts: 48
and ever important the c64 has MUCH more ram available


Top
 Profile  
 
 Post subject:
PostPosted: Wed Jan 05, 2005 6:25 pm 
Offline
User avatar

Joined: Mon Sep 20, 2004 4:07 pm
Posts: 34
Location: South Dakota
I rewrote my multiplier subroutine, and the demo now runs at 15 FPS at XYZ/8.

old routine:
sign-extend mul_a and mul_b from 16 to 32 bits
loop through the 32-bit add-and-shift loop 32 times

new routine:
don't sign-extend
if mul_a is negative, negate it and toggle neg_flag
if mul_b is negative, negate it and toggle neg_flag
loop through the hybrid 16/32 bit add-and-shift loop 16 times
if neg_flag is set, negate mul_c

I still think there has got to be a better way to multiply 8.8 fixed point numbers (without using any cartridge hardware), but I'm not going to figure it out any time soon. I'm also going to restructure the 3D "pipeline" to avoid those nasty 27-multiply matrix operations. This would be a lot easier if I had sources for some of those C64 demos to leech off of. :)

_________________
- abonetochew


Top
 Profile  
 
 Post subject:
PostPosted: Wed Jan 05, 2005 6:49 pm 
Offline

Joined: Mon Nov 22, 2004 3:24 pm
Posts: 162
Location: Sweden
abonetochew wrote:
I still think there has got to be a better way to multiply 8.8 fixed point numbers (without using any cartridge hardware), but I'm not going to figure it out any time soon. I'm also going to restructure the 3D "pipeline" to avoid those nasty 27-multiply matrix operations. This would be a lot easier if I had sources for some of those C64 demos to leech off of. :)

How about combining a couple of these (http://www.ffd2.com/fridge/math/fastmult) 8-bit multiplies?
Do you really need 16-bit precision at all? The vertices really shoudn't need them and a rotation matrix should only contain fractional values (almost anyway).

There's a proud tradition in the C64 scene of disassembling the works of the masters instead of giving out source codes.
Otherwise there's an explanation of the plotter from One-Der somewhere on the CSDB forum, I'll do a quick scan over the topics list and see if I can find it for you. I don't think it actually did any multiplies at all (per vertex anyway) but had everything precalculated instead.

edit: I managed to find the relevant thread (http://noname.c64.org/csdb/forums/?roomid=11&topicid=13369#13381).
Apparently everything is based on LUTs, there's no perspective at all, it's uses a bunch of speedcode, there's no pixel masking, and the display mode is hacked togheter with raster interrupts. Neat =)


Top
 Profile  
 
Display posts from previous:  Sort by  
Post new topic Reply to topic  [ 11 posts ] 

All times are UTC - 7 hours


Who is online

Users browsing this forum: No registered users and 3 guests


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 post attachments in this forum

Search for:
Jump to:  
Powered by phpBB® Forum Software © phpBB Group