Collision detection during lag

For questions about using Classic.

Post » Wed Sep 21, 2011 2:50 am

So I have a game with a lot of enemies in it, and they're using a custom movement that makes them bounce around on the screen. If they collide with a solid object, they bounce on it and change direction.

This works as it should in most situations. However, I've noticed that if the things happening on the screen become too intense, some collisions are dropped as the computer does not seem to keep up with all the detection work. If I have twenty enemies in the same room bouncing on the walls, they will sometimes just fly through the walls and become lost. It also happens frequently if the game is lagging, or if the room with the enemies in it is very small - with a lower distance between walls, the bounces happen more frequently, so the computer has to handle more collision events and some of them are lost.

Obviously, I don't want this to happen; I want the enemies to bounce on every solid object in the game without fail. Even if the game is lagging, I want things to progress as they should, and not cause odd behavior due to some events being lost. How do I solve this issue?
B
4
S
1
G
6
Posts: 28
Reputation: 2,056

Post » Wed Sep 21, 2011 4:02 pm

this is happening because custom movement automatically takes timedelta into account. To not have it automatically affected, you have to enable the option "override timedelta" in application properties -> advanced. Be aware that this option makes the game framerate dependant (runs at different speeds depending on framrate), so you should use fixed framerate mode if you do this. If you still want to use timedelta and v-sync, then there's an option to set the minimum fps next to the override. This will make the game slowdown (by modifying timedelta) when the framrate drops below a certain threshold, so that objects don't move too far in a frame.
B
25
S
3
G
6
Posts: 1,197
Reputation: 5,620


Return to Help & Support using Construct Classic

Who is online

Users browsing this forum: No registered users and 1 guest