[Request] One Point Collision

Discussion and feedback on Construct 2

Post » Thu May 23, 2013 12:39 am

I was thinking we could need one point collision which is designed to RTS, Puzzle and game uses a lot of objects. One point collision is related to origin point.

We can't have less than 3 collision poly points, currently this method could affect the performance.

Technically, a point of collision equals the distance from other objects, adjust the distance depends on intended according to sprite size or variable defines the numbers could do trigger. Applies to all objects with this option.
B
96
S
25
G
20
Posts: 3,052
Reputation: 22,638

Post » Thu May 23, 2013 12:43 am

Good point! ...

+1
As long as I can move left, right and fire, I'm Happy...
B
42
S
15
G
11
Posts: 655
Reputation: 12,260

Post » Thu May 23, 2013 4:44 pm

How much does it affect performance?
B
44
S
15
G
9
Posts: 1,096
Reputation: 11,013

Post » Thu May 23, 2013 5:05 pm

Could this not be done using disabled collisions and distance expression?
ImageImageImageImage
B
140
S
58
G
36
Posts: 2,547
Reputation: 31,170

Post » Thu May 23, 2013 5:20 pm

What we need is a sprite condition like "is (x,y) in collision polygon of object A" or a system condition like "is (x,y) solid".
B
45
S
16
G
18
Posts: 845
Reputation: 13,673

Post » Thu May 23, 2013 5:24 pm

You can disable collisions and start checking the distance between objects.

That's how I did the collision system of Golden Lotus.
ImageImageImageImageImageImage
B
92
S
19
G
12
Posts: 1,192
Reputation: 18,276

Post » Thu May 23, 2013 8:43 pm

For performance C2 would be better off with a anything but a bruteforce collision detection. There is

Binary Space Tree
Qaud Space Tree
and Oct Space tree

the idea is to put objects into a sorted branching tree. Only when 2 objects are using the same space/branch would there even be a collision check possible. In this model if the system wanted to compare bullet against enemy. it would check to see if bullet is in the same tree branch. if "no" there is nothing to further check against.

Where as the current model. the bullet needs to check against every enemy. even if the enemy is on the other side of the screen or map.
jayderyu2013-05-23 20:57:09
B
87
S
18
G
9
Posts: 2,455
Reputation: 14,834

Post » Sun May 26, 2013 10:04 am

@jayderyu http://www.mikechambers.com/blog/2011/03/21/javascript-quadtree-implementation/

I would like to know is possible to do with C2Joannesalfa2013-05-26 10:04:50
B
96
S
25
G
20
Posts: 3,052
Reputation: 22,638

Post » Sun May 26, 2013 11:22 am

disable collisions and check position or distance, and if your game is tile based, you can use an array instead.
B
31
S
7
G
2
Posts: 157
Reputation: 3,735

Post » Sun May 26, 2013 6:12 pm

@Joannesalfa
Implementing a quadtree into C2 wouldn't be that hard; especially as there is an API ready to be turned into a behaviour. The down side is that like C2 Physics which is Box2D, it's an entirely different collision check.

This means that like the Platform/Solid/Jumpthru/Bullet behaviours this Quadtree would not be compatible :( You couldn't take advantage of say Bullet Bounce off wall, and use Solid. Those are built to work together. Where as Bullet and Physics won't.

However, if you don't need Platform and Jumpthru. It can be created and implemented to good effect. The best solution is for Ashley to implement a quadtree into the natural behaviours. Might even be possible to slip it right into the basic object collision making the overhead minimal. Maybe next time there is a poll we should suggest it :)

But in the mean time maybe someone or myself if given the time can look into a behaviour.


So I tried the demo. One of the options is 500 objects. In a brute force model wich C2 uses. That would be 252,000 = 500 x 504 (+4 for walls). That's a lot of collision checks. Where as in this it looks like maybe 200-500 checks or something like that. Certainly not 200k+
B
87
S
18
G
9
Posts: 2,455
Reputation: 14,834

Next

Return to Construct 2 General

Who is online

Users browsing this forum: Google [Bot] and 15 guests