new GFX card

Page 18/20
11 | 12 | 13 | 14 | 15 | 16 | 17 | | 19 | 20

By MagicBox

Master (198)

MagicBox's picture

30-09-2008, 12:16

I've been thinking more about the sprite collision detection system. And yes, I'm going to implement the category system. It's reasonably easy to do so and it offers both flexibility and simplicity in detecting collision types, which is indeed what you want. Figure out what type / category of sprites have collided.

To implement this, I am forced to upgrade the SAT to 8 bytes per sprite (64 bits) in order to accomodate all the desired attributes. It will not cost more CPU time to fill, on the contrary, because attributes will not be 'packed' into one byte any more, you won't need to read-mask-modify-write. Just point to the appropriate attribute field and write it. This gives room to chose between 16 categories. (4 category bits per sprite)

By PingPong

Prophet (3833)

PingPong's picture

30-09-2008, 12:50

I've been thinking more about the sprite collision detection system. And yes, I'm going to implement the category system. It's reasonably easy to do so and it offers both flexibility and simplicity in detecting collision types, which is indeed what you want. Figure out what type / category of sprites have collided.

To implement this, I am forced to upgrade the SAT to 8 bytes per sprite (64 bits) in order to accomodate all the desired attributes. It will not cost more CPU time to fill, on the contrary, because attributes will not be 'packed' into one byte any more, you won't need to read-mask-modify-write. Just point to the appropriate attribute field and write it. This gives room to chose between 16 categories. (4 category bits per sprite)
and about fpga sprite performances? do you need to pay for this upgrade?
(categories are not 16, because some patterns are not suitable, like 0001 and 0101 -> 0101), but even with 4 cats i think is fine....

By MagicBox

Master (198)

MagicBox's picture

30-09-2008, 12:56

No, True 16 categories. The collision status register will be 16 bits. But well, maybe 8 categories (1 status byte) is better and sufficient. I have to examine the performance penaly if all, still. As I was working on the sprite engine pattern cache processor (the thing that loads all the current patterns for the 128 sprites from VRAM into internal RAM) I have to rewrite parts anyways. Designing VDPX is just an exercise where one has to go through tons of optimization / upgrade iterations.

It's all looking very promising so far.

Edit: the 4 category bits in the SAT would just specify the category for the sprite (0 - 15). The collision status register would have 16 corresponding bits. As a result, a sprite can belong to only one category.

By PingPong

Prophet (3833)

PingPong's picture

30-09-2008, 13:03

Umh that's unclear to me... how can 4 bits became 16? Question However i think 8 cats are more than needed..

By MagicBox

Master (198)

MagicBox's picture

30-09-2008, 13:44

4 bits become 16 when they are decoded, 4 -> 16 decoder. 0000 would equal 0000000000000001, 1111 would equal 1000000000000000. It's the decoded bits that would be OR'ed. Not the encoded category bits.

By PingPong

Prophet (3833)

PingPong's picture

30-09-2008, 13:57

4 bits become 16 when they are decoded, 4 -> 16 decoder. 0000 would equal 0000000000000001, 1111 would equal 1000000000000000. It's the decoded bits that would be OR'ed. Not the encoded category bits.
@MagicBox: thx, now it's clear... Big smile

By MagicBox

Master (198)

MagicBox's picture

01-10-2008, 01:02

Update on the final sprite attribute table:

       7  6  5  4  3  2  1  0   |
   0 : x7 x6 x5 x4 x3 x2 x1 x0  |  x8 - x0 : X Coordinate (0 - 511)
   1 : -  -  -  -  -  -  -  x8  |  y7 - y0 : Y Coordinate (0 - 255)
   2 : y7 y6 y5 y4 y3 y2 y1 y0  |  p9 - p0 : Pattern Index (0 - 1023)
   3 : -  -  -  -  -  -  -  -   |  l2 - l0 : Layer Priority (0 - 7)
   4 : p7 p6 p5 p4 p3 p2 p1 p0  |  c2 - c0 : Collision Category (0 - 7)
   5 : -  -  -  -  -  -  p9 x8  |  en      : Enable (1 = visible, 0 = off)
   6 : -  -  -  -  -  l2 l1 l0  |  fx      : X-axis Flip (1 = flip, 0 = normal)
   7 : en c2 c1 c0 -  -  fx fy  |  fy      : Y-axis Flip (1 = flip, 0 = normal)

Plenty room for extension and as you can see, the mandatory registers don't need to be read-masked-modified-written Smile

By PingPong

Prophet (3833)

PingPong's picture

01-10-2008, 01:28

GREAT.

By Trebmint

Champion (294)

Trebmint's picture

01-10-2008, 02:10

Can a Sprite not be negative then, so it can be partly off the left hand / top side of the screen?

By Salamander2

Expert (124)

Salamander2's picture

01-10-2008, 08:26

good, very good

Page 18/20
11 | 12 | 13 | 14 | 15 | 16 | 17 | | 19 | 20