Skip to main content
added 64 characters in body
Source Link
House
  • 73.5k
  • 17
  • 188
  • 276

I read many variants today and get some knowledge in general, so here is a steps of mine thoughts in pictures (horrible paint.net ones)
We.

We need to develop grid system, so we check only thing near, perform simple check to cut out deep check, and at - last deep check like per-pixel collision check.

  1. Step 1 - let p1Let p1, p2p2 are some sprites let atlets first just check with circle collision - because large distance between p1p1, p2p2 this failfails and of course so we don't need test more deeply. But if we have not 2, but 20 objects, why we need to even circle test something so far outside of our view.

  2. Step 2 - addAdd basic column system, now we don't bother with p2 itp2 if it's in a column which differ much of p1 colfar from p1 column, so we even don't do circle test. But p3p3 is in the same col, so let do circle test, which of course will fail.

  3. Step 3 - letsLets improve colcolumn system to the grid system with grid cell size just like p1p1, p2p2, p3p3 collision boxes, so we cut out things much top or below p1p1. And this is all great until comes BIG OBJs which is some kind of platforms. They are much bigger then grid cell.
    enter image description here

enter image description here

Circle test for will be successful, but deep check for whole big obj will fail

And that the part iI can't get.

How do I store the grid position of big object? Like 4 grid coords for big object vertexes? And if one of them close to p1p1 do circle check for centre of big object then a deep one if succeed? Am iI do it wrong?
my possible solution - again sorry for links to pictures.

My possible solution:

enter image description here

I read many variants today and get some knowledge in general, so here is a steps of mine thoughts in pictures (horrible paint.net ones)
We need to develop grid system, so we check only thing near, perform simple check to cut out deep check, and at - last deep check like per-pixel collision check.

  1. Step 1 - let p1, p2 are some sprites let at first just check with circle collision - because large distance between p1, p2 this fail and of course so we don't need test more deeply. But if we have not 2, but 20 objects, why we need to even circle test something so far outside of our view.

  2. Step 2 - add basic column system, now we don't bother with p2 it in column which differ much of p1 col, so we even don't do circle test. But p3 is in the same col, so let do circle test, which of course will fail.

  3. Step 3 - lets improve col system to the grid system with grid cell size just like p1, p2, p3 collision boxes, so we cut out things much top or below p1. And this all great until comes BIG OBJs which is some kind of platforms. They much bigger then grid cell.
    enter image description here

Circle test for will be successful, but deep check for whole big obj will fail

And that the part i can't get.

How store grid position of big object? Like 4 grid coords for big object vertexes? And if one of them close to p1 do circle check for centre of big object then a deep one if succeed? Am i do it wrong?
my possible solution - again sorry for links to pictures.

I read many variants today and get some knowledge in general, so here is a steps of mine thoughts in pictures (horrible paint.net ones).

We need to develop grid system, so we check only thing near, perform simple check to cut out deep check, and at - last deep check like per-pixel collision check.

  1. Step 1 - Let p1, p2 are some sprites lets first just check with circle collision - because large distance between p1, p2 this fails and of course so we don't need test more deeply. But if we have not 2, but 20 objects, why we need to even circle test something so far outside of our view.

  2. Step 2 - Add basic column system, now we don't bother with p2 if it's in a column far from p1 column, so we even don't do circle test. But p3 is in the same col, so let do circle test, which of course will fail.

  3. Step 3 - Lets improve column system to the grid system with grid cell size just like p1, p2, p3 collision boxes, so we cut out things much top or below p1. And this is all great until comes BIG OBJs which is some kind of platforms. They are much bigger then grid cell.

enter image description here

Circle test for will be successful, but deep check for whole big obj will fail

And that the part I can't get.

How do I store the grid position of big object? Like 4 grid coords for big object vertexes? And if one of them close to p1 do circle check for centre of big object then a deep one if succeed? Am I do it wrong?

My possible solution:

enter image description here

I read many variants today and get some knowledge in general, so here is a steps of mine thoughts in pictures (horrible paint.net ones)
We need to develop grid system, so we check only thing near, perform simple check to cut out deep check, and at - last deep check like per-pixel collision check.

  1. Step 1 - let p1, p2 are some sprites let at first just check with circle collision - because large distance between p1, p2 this fail and of course so we don't need test more deeply. But if we have not 2, but 20 objects, why we need to even circle test something so far outside of our view.

  2. Step 2 - add basic column system, now we don't bother with p2 it in column which differ much of p1 col, so we even don't do circle test. But p3 is in the same col, so let do circle test, which of course will fail.

  3. Step 3 - lets improve col system to the grid system with grid cell size just like p1, p2, p3 collision boxes, so we cut out things much top or below p1. And this all great until comes BIG OBJs which is some kind of platforms. They much bigger then grid cell.
    step 3 - imgur image link - low reputation for images sorry.
    Circle test for will be successful, but deep check for whole big obj will failenter image description here

Circle test for will be successful, but deep check for whole big obj will fail

And that the part i can't get.

How store grid position of big object? Like 4 grid coords for big object vertexes? And if one of them close to p1 do circle check for centre of big object then a deep one if succeed? Am i do it wrong?
my possible solution - again sorry for links to pictures.

I read many variants today and get some knowledge in general, so here is a steps of mine thoughts in pictures (horrible paint.net ones)
We need to develop grid system, so we check only thing near, perform simple check to cut out deep check, and at - last deep check like per-pixel collision check.

  1. Step 1 - let p1, p2 are some sprites let at first just check with circle collision - because large distance between p1, p2 this fail and of course so we don't need test more deeply. But if we have not 2, but 20 objects, why we need to even circle test something so far outside of our view.

  2. Step 2 - add basic column system, now we don't bother with p2 it in column which differ much of p1 col, so we even don't do circle test. But p3 is in the same col, so let do circle test, which of course will fail.

  3. Step 3 - lets improve col system to the grid system with grid cell size just like p1, p2, p3 collision boxes, so we cut out things much top or below p1. And this all great until comes BIG OBJs which is some kind of platforms. They much bigger then grid cell.
    step 3 - imgur image link - low reputation for images sorry.
    Circle test for will be successful, but deep check for whole big obj will fail

And that the part i can't get.

How store grid position of big object? Like 4 grid coords for big object vertexes? And if one of them close to p1 do circle check for centre of big object then a deep one if succeed? Am i do it wrong?
my possible solution - again sorry for links to pictures.

I read many variants today and get some knowledge in general, so here is a steps of mine thoughts in pictures (horrible paint.net ones)
We need to develop grid system, so we check only thing near, perform simple check to cut out deep check, and at - last deep check like per-pixel collision check.

  1. Step 1 - let p1, p2 are some sprites let at first just check with circle collision - because large distance between p1, p2 this fail and of course so we don't need test more deeply. But if we have not 2, but 20 objects, why we need to even circle test something so far outside of our view.

  2. Step 2 - add basic column system, now we don't bother with p2 it in column which differ much of p1 col, so we even don't do circle test. But p3 is in the same col, so let do circle test, which of course will fail.

  3. Step 3 - lets improve col system to the grid system with grid cell size just like p1, p2, p3 collision boxes, so we cut out things much top or below p1. And this all great until comes BIG OBJs which is some kind of platforms. They much bigger then grid cell.
    enter image description here

Circle test for will be successful, but deep check for whole big obj will fail

And that the part i can't get.

How store grid position of big object? Like 4 grid coords for big object vertexes? And if one of them close to p1 do circle check for centre of big object then a deep one if succeed? Am i do it wrong?
my possible solution - again sorry for links to pictures.

Source Link
user14832
user14832

Big level objects collision system for 2d game

I read many variants today and get some knowledge in general, so here is a steps of mine thoughts in pictures (horrible paint.net ones)
We need to develop grid system, so we check only thing near, perform simple check to cut out deep check, and at - last deep check like per-pixel collision check.

  1. Step 1 - let p1, p2 are some sprites let at first just check with circle collision - because large distance between p1, p2 this fail and of course so we don't need test more deeply. But if we have not 2, but 20 objects, why we need to even circle test something so far outside of our view.

  2. Step 2 - add basic column system, now we don't bother with p2 it in column which differ much of p1 col, so we even don't do circle test. But p3 is in the same col, so let do circle test, which of course will fail.

  3. Step 3 - lets improve col system to the grid system with grid cell size just like p1, p2, p3 collision boxes, so we cut out things much top or below p1. And this all great until comes BIG OBJs which is some kind of platforms. They much bigger then grid cell.
    step 3 - imgur image link - low reputation for images sorry.
    Circle test for will be successful, but deep check for whole big obj will fail

And that the part i can't get.

How store grid position of big object? Like 4 grid coords for big object vertexes? And if one of them close to p1 do circle check for centre of big object then a deep one if succeed? Am i do it wrong?
my possible solution - again sorry for links to pictures.