Re: [stella] Collision detection

Subject: Re: [stella] Collision detection
From: Mark De Smet <de-smet@xxxxxxxxxxxxxxx>
Date: Thu, 4 May 2000 21:50:00 -0500 (CDT)
> Take any game that reuses sprites, though.  If one "pseudosprite" collides 
> on a given scanline and during the same frame, another "pseudosprite" 
> collides, how do you track this?  Both would be the same player, but you 
> need to track collisions independently in order to treat the player as two 
> virtual sprites.

Never used them, but here's what I understood about them:

The latches are not in anyway linked to where in the frame drawing process
you are. The latches probably could detect collisions in the overscan or
vertical blank if you don't turn off the drawing circuit(by setting
vertical blank). 

The latches will be set _every_ time the two objects are on at the same
time.  They will stay set until you punch CXCLR.

CXCLR clears the latches no matter what is going on, or when you do it.

You can theoretically do different collision check every scan line, but
you are of course limited by the cycles available.  So, if you want to
check for collisions seperately in the top of the screen, and at the
bottom, you simply read off the colision registers in the middle, and do a
CXCLR.  If you do a CXCLR once per frame(such as just before the beginning
of the frame), then check the CX registers at the end of the frame, there
will be no way you can tell if the objects colided once, or 50 times, or
even where in the screen they collided. All you know is if they collided
at least once.

In order to check for multiple collisions between the same two objects in
a screen, you have to check the CX register, then CXCLR it between when
you think the collisions occur.

Here is an example.  Air-Sea battle.  I don't know if they used collision
detections, but here is how it may be done:

Assume that each balloon/plane/boat is P0, reused every (let's say, I
didn't count) 16 or so scan lines. In order to tell which one of the
targets is hit, the program needs to read CXM0P and CXM1P every 16 lines
and then after dealing w/ that(probably saving to RAM), punching CXCLR.
This process needs to be done between every vertical segment that you want
to check for collisions between.

If you are flickering, you simply check for one of your flickered objects
on one frame, then the other object on the next frame.

The ability to do funky things like using the collision registers many
times per frame is, IMHO, one of the things that make the VCS so flexable. 

Mark


--
Archives (includes files) at http://www.biglist.com/lists/stella/archives/
Unsub & more at http://www.biglist.com/lists/stella/

Current Thread