Timeline for Organizing movement, collision detection, and collision resolution
Current License: CC BY-SA 3.0
6 events
when toggle format | what | by | license | comment | |
---|---|---|---|---|---|
Jul 13, 2016 at 12:58 | comment | added | Felsir | The iteration is the absolute lowest cost in this: it merely loops through all objects. The number of operations is the same in both options. Say you have 100 objects. Option A 1 forloop, 100x movement logic, 100x99 collisionchecks and up to 100 collisionresolves. Option B 3 forloops and the same number of moves, checks and potentially less collisions. So in the end option B is probably much efficient if it just saves one collision due to the ball example A provided. | |
Jul 8, 2015 at 20:55 | comment | added | Wingblade | Only doing 1 iteration was the reason why I used Approach A in those games, it is faster. However aslong as the number of objects is small there should be little difference. Thank you for your answer! | |
Jul 8, 2015 at 20:38 | comment | added | Honeybunch | Approach A is much faster. 1 iteration vs 3. If you're not aiming for accuracy or your game is just much smaller and slower it could be a nice optimization. That said if you're not sure I would always start with B. | |
Jul 8, 2015 at 20:38 | vote | accept | Wingblade | ||
Jul 8, 2015 at 20:00 | comment | added | Wingblade | Are there any cases at all where Approach A is better than B? I've made games with only mobile to static collisions (player characters and stage), so the problem you mentioned didn't apply. Is B still better in those situations? | |
Jul 8, 2015 at 17:36 | history | answered | Honeybunch | CC BY-SA 3.0 |