Jump to content



2

What is the best method for collision with Multisprite Kernel (Not DPC+)


11 replies to this topic

#1 disjaukifa OFFLINE  

disjaukifa

    River Patroller

  • 2,088 posts
  • Berzerker In Training
  • Location:Southwest Virginia

Posted Thu Sep 29, 2011 9:03 PM

Hey Guys,

Just as the title says, I'm trying to figure out the best way to do collision detection with the Multisprite Kernel. I've read Random's page on Multisprites several times tonight, and I just need some clarification/insights on the best way to do it. I'm trying to see if player1 has collided with players 2 ~ 5. I've got player0 collision down.

Thanks

#2 Random Terrain ONLINE  

Random Terrain

    Visual batari Basic User

  • 20,923 posts
  • Controlled Randomness
    Replay Value
    Nonlinear
  • Location:North Carolina (USA)

Posted Thu Sep 29, 2011 9:37 PM

if somebody posts something really good here, I'll put it on the bB page.

#3 disjaukifa OFFLINE  

disjaukifa

    River Patroller

  • 2,088 posts
  • Berzerker In Training
  • Location:Southwest Virginia

Posted Thu Sep 29, 2011 9:52 PM

View PostRandom Terrain, on Thu Sep 29, 2011 9:37 PM, said:

if somebody posts something really good here, I'll put it on the bB page.

I have to admit Random, I'm really glad you said that and didn't just reference to something that was already on your site because I have been reading it all night.

#4 Random Terrain ONLINE  

Random Terrain

    Visual batari Basic User

  • 20,923 posts
  • Controlled Randomness
    Replay Value
    Nonlinear
  • Location:North Carolina (USA)

Posted Thu Sep 29, 2011 10:09 PM

View Postdisjaukifa, on Thu Sep 29, 2011 9:52 PM, said:

View PostRandom Terrain, on Thu Sep 29, 2011 9:37 PM, said:

if somebody posts something really good here, I'll put it on the bB page.

I have to admit Random, I'm really glad you said that and didn't just reference to something that was already on your site because I have been reading it all night.
Yeah, I don't know much about the Multisprite Kernel. It was too limited and weird, so I mostly avoided it. I was hoping that something like the DPC+ stuff would come along. Once batari gets the DPC+ stuff fixed, I probably won't use anything else. Every game will be DPC+.

#5 disjaukifa OFFLINE  

disjaukifa

    River Patroller

  • 2,088 posts
  • Berzerker In Training
  • Location:Southwest Virginia

Posted Thu Sep 29, 2011 10:13 PM

View PostRandom Terrain, on Thu Sep 29, 2011 10:09 PM, said:

View Postdisjaukifa, on Thu Sep 29, 2011 9:52 PM, said:

View PostRandom Terrain, on Thu Sep 29, 2011 9:37 PM, said:

if somebody posts something really good here, I'll put it on the bB page.

I have to admit Random, I'm really glad you said that and didn't just reference to something that was already on your site because I have been reading it all night.
Yeah, I don't know much about the Multisprite Kernel. It was too limited and weird, so I mostly avoided it. I was hoping that something like the DPC+ stuff would come along. Once batari gets the DPC+ stuff fixed, I probably won't use anything else. Every game will be DPC+.

That does make sense, and the DPC+ kernel is fantastic even in its current state of development, there is a certain amount fun and challenge to making a game that will fit into 2~4K. I wanted to see if I could do this. If I can get the collision figured out, I think I can do it. I'm going to have flicker problems which are just inherent with the multi-sprite kernel, but I'm doing this for the challenge and fun of it.

Edited by disjaukifa, Thu Sep 29, 2011 10:14 PM.


#6 disjaukifa OFFLINE  

disjaukifa

    River Patroller

  • 2,088 posts
  • Berzerker In Training
  • Location:Southwest Virginia

Posted Fri Sep 30, 2011 7:10 AM

I had a thought this morning when I woke up. When you are geting the x, y coordinates of a sprite, where exactly is it located? I'm thinking of manual building an array that has the dimensions of each of my sprites and makes my own collision routine to see if they have collide.

I've got a way to do it now, its just not that forgiving, they have to have the EXACT same coordinates which is kind of annoying.

if player1x = player2x && player1y = player2y then  . . .

For what I'm doing the Y is actually not the issue, I'm fine with y being set to what it is, what I'd like to adjust is the x values. I rather not put a bunch of if statements in there but I will if that is the only way to do it.

#7 Byte Knight OFFLINE  

Byte Knight

    Moonsweeper

  • 369 posts
  • Robinett Rules!
  • Location:Waconia, MN

Posted Fri Sep 30, 2011 4:52 PM

Here's the way I did it with an earlier version of DPC+ that didn't have the collision detection between the virtual sprites. I don't think you the temp1-temp6 variables available in the multisprite kernel, so you may have to use other variables...

#8 disjaukifa OFFLINE  

disjaukifa

    River Patroller

  • 2,088 posts
  • Berzerker In Training
  • Location:Southwest Virginia

Posted Mon Oct 3, 2011 9:45 AM

Thats Byte Knight! I took your example and modified it a bit to suit my needs. It actually works quite well however the more complex the sprite the more difficult the collision defection. I'll post later tonight my solution which is based on yours if anybody here can use it in the future.

#9 theloon OFFLINE  

theloon

    Stargunner

  • 1,015 posts

Posted Fri Oct 7, 2011 7:47 AM

This question seems to be answered but here is a generic soft collision example modified from another BASIC dialect:

	function softcol
	if x1 > x4 then return 0
	if x2 < x3 then return 0
	if y1 > y4 then return 0
	if y2 < y3 then return 0
	return 1
end

I realize this could be optimized and I haven't explained anything about the code. Sorry :P

Edited by theloon, Fri Oct 7, 2011 7:51 AM.


#10 Mr SQL OFFLINE  

Mr SQL

    Chopper Commander

  • 121 posts

Posted Wed Oct 12, 2011 1:45 PM

The soft collision dection routine from CityScape works similarly:

rem piggyback: seed d with a non zero value if opponent gets hit (frozen delay)
rem h is the playfield x
b=(player1x-10)/4:if b=h && d=0 then d=25
b=b+1:if b=h && d=0 then d=45
b=b-2:if b=h && d=0 then d=35

Description:

In the routine I'm using playfield pixels as missile sprites and need to detect collision with a hardware sprite but other playfield pixels exist so I couldn't use hardware collision; I'm also translating between playfield pixels and real pixels (/4) and use a range so that an exact hit is not required (it can be just behind or just in front).

#11 8bitgnome OFFLINE  

8bitgnome

    Space Invader

  • 23 posts
  • Location:Philladelphia

Posted Mon Oct 24, 2011 7:14 AM

Where can i learn to use multisprite kernals?

#12 disjaukifa OFFLINE  

disjaukifa

    River Patroller

  • 2,088 posts
  • Berzerker In Training
  • Location:Southwest Virginia

Posted Mon Oct 24, 2011 8:25 AM

View Post8bitgnome, on Mon Oct 24, 2011 7:14 AM, said:

Where can i learn to use multisprite kernals?

Random Terrain's Bible to bB Programming! Here is the section to Multisprite Kernel.




0 user(s) are reading this topic

0 members, 0 guests, 0 anonymous users