21 May 2020, 21:48 | #1 |
Fernando Cabrera
Join Date: Oct 2013
Location: Spain
Posts: 106
|
Hardware collision detection
I'm making a simple hardware collision detection test. I've read about it through the AHRM and Amiga System Programmers Guide but I still can't make it work. I've got a 4-colour playfield, sprite 0 pointing to some data and the other 7 sprites pointing to null sprites. I thought that to detect collision between sprite 0 and playfield 1, CLXCON would have to be $0000, meaning: no interested in detecting collision for odd sprites, no required values for any bitplane. Sprite 0 is positioned over an area of the playfield filled with colour 0. If I set it that way CLXDATA is always $81fe, meaning that every hw sprite is colliding with both playfields (¿?). If I set some mask bits on CLXCON it does detect collision over the masked colour.
Isn't it possible to detect collision between a hw sprite and any non transparent pixel of the playfield? I would appreciate any advice to point me in the right direction. NOTE: I'm thinking mostly in a dual-playfield scenario where PF1 is in front of PF2 and colour 0 is transparent. I remember Toni saying there was some little differences between single and dual-playfield, and even reading a piece of pseudocode explaining how WinUAE deals with all this but I didn't understand that completely though. NOTE2: I'm reading again this thread (http://eab.abime.net/showthread.php?p=1335382&nojs=1) and I think it's not possible to do what I wanted. It still surprises me that you cannot set a value in CLXCON to detect collisions with any non transparent pixel of PF1, at least in dual-playfield mode. Please, correct me if I'm wrong... Thanks! Last edited by nandius_c; 22 May 2020 at 07:44. |
21 May 2020, 23:18 | #2 |
Fernando Cabrera
Join Date: Oct 2013
Location: Spain
Posts: 106
|
I found this text in the specs doc for Denise:
"NOTE: Disabled Bit Planes cannot prevent collisions. Therefore if all Bit Planes are disabled, collisions will be continuous, regardless of the match values." That's exactly what I get, but then again: how do you detect collision with ANY non-transparent pixel of the playfield? Isn't it possible? |
21 May 2020, 23:29 | #3 | |
Registered User
Join Date: Oct 2017
Location: Sunderland, England
Posts: 2,702
|
Quote:
So when I read the HRM and I want to detect collisions between sprite 0 and bitplanes 1 & 2 (4 colours) then I would set CLXCON to $10c3. I haven't tried it but this would match: Bit 12 for Enable Sprite 0 & 1. Bits 6 & 7 for enable bitplanes 1 & 2 Bits 0 & 1 for match required on bitplanes 1 & 2 Geezer |
|
21 May 2020, 23:48 | #4 | |
Fernando Cabrera
Join Date: Oct 2013
Location: Spain
Posts: 106
|
Quote:
With that CLXCON value it only detects the collision when the sprite is over the colour with index 3 (plane 1 = 1, plane 2 = 1), because those are the required values (bits 0 & 1 in CLXCON). As an example, if you keep bits 6 & 7 set, but clear 0 & 1, I guess it will signal a collision when the sprite touches the colour with index 0. That doesn't make much sense to me as why would you want to check collisions against colour 0? Sprites don't collide on their transparent colours. This part of the amiga hardware is somehow weird . Last edited by nandius_c; 22 May 2020 at 07:14. |
|
23 May 2020, 05:32 | #5 | |
Registered User
Join Date: Jan 2019
Location: Brisbane
Posts: 99
|
Quote:
|
|
Currently Active Users Viewing This Thread: 1 (0 members and 1 guests) | |
Thread Tools | |
Similar Threads | ||||
Thread | Thread Starter | Forum | Replies | Last Post |
Fast (bounding box?) Collision detection | Tigerskunk | Coders. Asm / Hardware | 99 | 25 May 2020 22:16 |
Possible problem with Collision detection ! | amilo3438 | support.WinUAE | 5 | 11 January 2017 18:35 |
Collision Detection | sandruzzo | Coders. General | 5 | 10 June 2016 12:50 |
Hardware collision detection in Amiga games? | nandius_c | Coders. Asm / Hardware | 25 | 29 April 2016 23:56 |
Collision detection: 2 doubts | nandius_c | Coders. Asm / Hardware | 6 | 30 November 2014 00:53 |
|
|