Few questions.

Post Reply
DEElekgolo
Posts: 2
Joined: Tue Apr 26, 2011 5:47 am

Few questions.

Post by DEElekgolo » Tue Apr 26, 2011 5:55 am

So I am tired of sniffing around for information so here are a few direct questions.

How would I manage making a file system INSIDE of my .nds file rather than reading from the flash cart? Retail games seem to be able to do this and I require a more manageable way of handling my assets rather than having it stored alongside my machine code.

When looking into the display list commands I have a hard time understanding some of the data types:
400048Ch - Cmd 23h - VTX_16 - Set Vertex XYZ Coordinates (W)

Parameter 1, Bit 0-15 X-Coordinate (signed, with 12bit fractional part)
Parameter 1, Bit 16-31 Y-Coordinate (signed, with 12bit fractional part)
Parameter 2, Bit 0-15 Z-Coordinate (signed, with 12bit fractional part)
Parameter 2, Bit 16-31 Not used
I am unsure about how it manages float variables. I would imagine something along the lines of storing two integers and then dividing the two to create a float variable but I would imagine how this would act at run-time in a game.

How would one manage vertex skinning on the ds? Would I have to process each vertex on the CPU and update each frame?

Discostew
Posts: 103
Joined: Sun Mar 08, 2009 7:24 pm

Re: Few questions.

Post by Discostew » Fri Apr 29, 2011 12:32 am

Check out the Nitro File System under the nds example folder for having the files contained with the program.

-----------------------------------------------------

For that vertex explanation, the input is not float-based, but integer-based in the form of a FIXED-POINT value. If you don't know how FIXED-POINT math works, then you should concentrate on that, as it is used extensively on the DS. For input in this case, the first 16 bits of the 32-bit input forms the X coordinate, with 1 bit for the sign, 3 bits for the whole number, and 12 bits for the fraction. The latter 16 bits forms the Y coordinate. With both X and Y together in one value, you can simply do this...

Code: Select all

 VTX_16 = X | ( Y << 16 );
Of course, the values of X and Y must be 16-bit, or you'll have problems. To add the Z coordinate, you simple send in the Z coordinate alone. As noted, the last 16 bits from the 2nd input are ignored. There are macros that will allow you to convert from a float to a FIXED-POINT value, but because the DS doesn't have an FPU, processing floats will be slow. Once you become comfortable with FIXED-POINT values, it's suggested that you work with them instead of floats. Having the values in hexadecimal form helps me work with them.

----------------------------------------------------

I hadn't done any work on skinning for a long time, but I can tell you that there isn't a simple method for skinning on the DS. There are techniques that can help reduce the amount of processing you'd have to do, but it would still be pretty intensive.

Post Reply

Who is online

Users browsing this forum: Ahrefs [Bot], Bing [Bot] and 4 guests