rickbatka / co-op-engine

A prototype engine for our planned co-op game. This is where we will make it work, make it network, and make it feel fun. No AI, level design, etc.
2 stars 0 forks source link

Physics bug... it's a tough one #26

Closed reddenx closed 10 years ago

reddenx commented 10 years ago

Problem comes from objects not being able to be inserted into a quad during a split, seems to happen most often during a notify on a collision or phys update... it's transient and deep in recursion... so yay...

reddenx commented 10 years ago

Holy crap what a bug, turns out to be some bad timing coupled with a weird edge case. When A and B collide where A moved into B's quad and B moved out of it's quad, the insert of A into B's quad attempts to split, which assumes that B is still in the quad and attempts to insert it into the new children, B won't fit into any of the children cause it's not in the original quad so it falls out of the quad tree. The current remedy is a temp fix which will need to be fixed cause it's not efficient and causes some serious detriment to the total amount of object we can have on screen. The fix is to master insert the object if it doesn't fit into any of the split quads.