How do I manage fps/collisions?

Get help using Construct 2

Post » Sat Oct 04, 2014 8:16 am

Hello

i have been thinking about this since i started this project.
Can you please take a look at this? Fps looks fine but there are too many collisions.

http://i59.tinypic.com/2vmiz4z.png
Image

12161 collisions in total and 248/tick. Isn't that too much or is this just normal?
poly checks 504 in total 10/tick

and numbers will roughly be doubled when im done with this project.
Do i need to worry about this and look for solutions or is that ok? :|
B
22
S
5
G
2
Posts: 210
Reputation: 3,382

Post » Sat Oct 04, 2014 8:53 am

That shouldn't be a problem. I got games with even more working fine.

Read this release note to understand how it works:
https://www.scirra.com/blog/ashley/6/co ... on-in-r155

Else you should describe why you need these collisions? Show screenshots of your code or share capx files.

Always good is to give collision checks an "every 0.5 seconds" instead of "every tick" but that depends on the game if possible. Sometimes you really need per tick. :-)
B
34
S
9
G
3
Posts: 206
Reputation: 7,851

Post » Sat Oct 04, 2014 9:20 am

piszozo wrote:Hello

i have been thinking about this since i started this project.
Can you please take a look at this? Fps looks fine but there are too many collisions.

http://i59.tinypic.com/2vmiz4z.png
Image

12161 collisions in total and 248/tick. Isn't that too much or is this just normal?
poly checks 504 in total 10/tick

and numbers will roughly be doubled when im done with this project.
Do i need to worry about this and look for solutions or is that ok? :|

Difficult to say what is normal, it depends on what content your game holds.

1 object needing collision detection against another object, will do 60 checks per sec and ~1/tick
So depending on how many objects and events you have that requires collision checks this number will increase.

An example:

1. Your player have path finding and on the screen you have 1 solid object and no events that need to check for collisions. Then you will have a collision check / sec of 0 and ~0/tick

2. Same as above but this time you have one event that checks for overlaps with the solid object, which would give you a collision check / sec of 60 and ~1/tick

3. Same as above but now you have 4 solid objects and 3 events that checks for collisions, which gives you 720 collision checks per sec and ~12/tick

So whether you have to many or not is hard to say, it depend on you having events that are not needed or to many objects on the screen that wouldn't need to be there. however as you can see from the last example, which doesn't really have a lot of collision objects or events the count is already at 720 checks per second. So 12000 checks is not a lot and in above example it can be achieved by increasing the number of solid objects to 20 and the event count to 5 as that would give you 12000 checks as well.

So if you have some enemies, a player some bullets etc that need collision detection the count will go up rather fast.
B
44
S
11
G
2
Posts: 1,182
Reputation: 6,848

Post » Sat Oct 04, 2014 10:37 am

MACPK wrote:That shouldn't be a problem. I got games with even more working fine.

Read this release note to understand how it works:
https://www.scirra.com/blog/ashley/6/co ... on-in-r155

Else you should describe why you need these collisions? Show screenshots of your code or share capx files.

Always good is to give collision checks an "every 0.5 seconds" instead of "every tick" but that depends on the game if possible. Sometimes you really need per tick. :-)



Thanks a lot, yes i have seen that link, kind of a relief :)
B
22
S
5
G
2
Posts: 210
Reputation: 3,382

Post » Sat Oct 04, 2014 10:38 am

nimos100 wrote:
piszozo wrote:Hello

i have been thinking about this since i started this project.
Can you please take a look at this? Fps looks fine but there are too many collisions.

http://i59.tinypic.com/2vmiz4z.png
Image

12161 collisions in total and 248/tick. Isn't that too much or is this just normal?
poly checks 504 in total 10/tick

and numbers will roughly be doubled when im done with this project.
Do i need to worry about this and look for solutions or is that ok? :|

Difficult to say what is normal, it depends on what content your game holds.

1 object needing collision detection against another object, will do 60 checks per sec and ~1/tick
So depending on how many objects and events you have that requires collision checks this number will increase.

An example:

1. Your player have path finding and on the screen you have 1 solid object and no events that need to check for collisions. Then you will have a collision check / sec of 0 and ~0/tick

2. Same as above but this time you have one event that checks for overlaps with the solid object, which would give you a collision check / sec of 60 and ~1/tick

3. Same as above but now you have 4 solid objects and 3 events that checks for collisions, which gives you 720 collision checks per sec and ~12/tick

So whether you have to many or not is hard to say, it depend on you having events that are not needed or to many objects on the screen that wouldn't need to be there. however as you can see from the last example, which doesn't really have a lot of collision objects or events the count is already at 720 checks per second. So 12000 checks is not a lot and in above example it can be achieved by increasing the number of solid objects to 20 and the event count to 5 as that would give you 12000 checks as well.

So if you have some enemies, a player some bullets etc that need collision detection the count will go up rather fast.


Thanks a lot for answer, game is a jumper platformer, there are 7-9 kinds of obstacles in all levels and only 1 event sheet for all levels :)
B
22
S
5
G
2
Posts: 210
Reputation: 3,382


Return to How do I....?

Who is online

Users browsing this forum: No registered users and 7 guests