New demo uploaded: 3d wire frame animated spaceship

All aspects of programming on the Commander X16.
User avatar
desertfish
Posts: 1097
Joined: Tue Aug 25, 2020 8:27 pm
Location: Netherlands

New demo uploaded: 3d wire frame animated spaceship

Post by desertfish »




3d wire frame animated spaceship




View File






3d animated Cobra MK3 ship from Elite!  Uses 16 bits integer math and has hidden-line removal..

This is an almost 1-to-1 conversion of the same program I wrote for the C64, but it runs a lot faster on the CommanderX16 ?

Here is the (prog8) source code https://github.com/irmen/prog8/blob/master/examples/cx16/cobramk3-gfx.p8

 

I haven't figured out how to wait for the Vertical blank yet, to reduce the flickering perhaps...






 
User avatar
AndyMt
Posts: 326
Joined: Sun Jun 21, 2020 3:02 pm
Location: Switzerland

New demo uploaded: 3d wire frame animated spaceship

Post by AndyMt »


Oh nice! I can already see something like "Elite" coming...

User avatar
desertfish
Posts: 1097
Joined: Tue Aug 25, 2020 8:27 pm
Location: Netherlands

New demo uploaded: 3d wire frame animated spaceship

Post by desertfish »


Ok you put me on a mission ?   I now have to at least put all Elite's ship models into that program  https://www.c64-wiki.com/wiki/Elite#Spaceship_types

And we also have text mode Elite http://www.elitehomepage.org/text/index.htm

So who knows ?

 

edit: Right, that same site hosts various 3d model source files of the Elite shipts. I cobbled up a quick model viewer in Python....  Going to use that to convert the data into binary arrays that I can read into my 6502 program !

image.png.d6460d71e9a0aa0b7251f95f6ec31fdc.png

User avatar
desertfish
Posts: 1097
Joined: Tue Aug 25, 2020 8:27 pm
Location: Netherlands

New demo uploaded: 3d wire frame animated spaceship

Post by desertfish »


Yay, the exported ship data works in the Commander X16 version!  Attempt for the next version to implement hidden line removal in this version too.

image.png.e8c53ac95066247fc8d8e593fed75d70.png

User avatar
Cyber
Posts: 482
Joined: Mon Apr 27, 2020 7:36 am

New demo uploaded: 3d wire frame animated spaceship

Post by Cyber »


Wow! Are you serious about Elite?

User avatar
desertfish
Posts: 1097
Joined: Tue Aug 25, 2020 8:27 pm
Location: Netherlands

New demo uploaded: 3d wire frame animated spaceship

Post by desertfish »


Nah, I'm not going to recreate Elite, the game. That would be way too much work.    The 3d code is not a full 3d engine but just capable of showing one spinning object in the center of the screen ?   I'm not going to expand that. I do want to add hidden line removal to it though  and the other dozen or so ship models. As a separate project maybe to compile or convert that text-mode Elite trading program.    That should be doable and will result in a fun little space trading game program (without fancy graphics though)

User avatar
Cyber
Posts: 482
Joined: Mon Apr 27, 2020 7:36 am

New demo uploaded: 3d wire frame animated spaceship

Post by Cyber »


I see. You can add spinning 3D ships to the same project as an encyclopedia entries.

Nickenstein
Posts: 3
Joined: Mon Aug 31, 2020 6:05 pm

New demo uploaded: 3d wire frame animated spaceship

Post by Nickenstein »


Awesome! ?

I'm new here, and I don't have time to experiment until the weekend, but something I wanted to try was making a fixed-point math library with some vector-matrix-mult routines. I think you have beaten me to the punch on that! ?

User avatar
desertfish
Posts: 1097
Joined: Tue Aug 25, 2020 8:27 pm
Location: Netherlands

New demo uploaded: 3d wire frame animated spaceship

Post by desertfish »


For this program I am not using a fixed point math library perse.  The math library that I use only has primitives for calculations on byte and word values.

The program   (written in prog8) does the actual 3d calculations taking fixed-point scaling into account.  So a hand written math library with 3d routines as well is still useful as it will be quite a bit faster that my generated assembly code I can imagine.

User avatar
desertfish
Posts: 1097
Joined: Tue Aug 25, 2020 8:27 pm
Location: Netherlands

New demo uploaded: 3d wire frame animated spaceship

Post by desertfish »


Slight update, I'm slowly working towards adding that hidden line removal. The actual math required isn't in there yet but I think I have the ship model data complete for it.

image.png.43d232d5e1232f0ea1137eeca00f2e90.png

Also I've looked at the source code of the text-Elite and it seems a lot more work to convert it to Prog8 than I anticipated. It is still something I would like to complete though, if only to validate the practical applicability of the language.

Post Reply