ogrady / mw3

Metal Warriors 3
2 stars 0 forks source link

Usage of some sort of trees for collisions #26

Closed ogrady closed 10 years ago

ogrady commented 10 years ago

As for now, collision-detection puts some heavy load on the game, as whenever an entity moves, it will check for collisions with all other entities. Even if they are not near themselves. This slows the game down considerably, even in a 50x50 map (=2500 tiles to check) with some flying bullets and just one Mech. As we are planning on larger maps and multiplayer-support (= a multitude of bullets and mechs at a time), do you think it would be feasible to maintain a (B+-)Tree over the coordinates of entities in addition to the current list? Especially in regards to having to update the tree whenever an entity moves.

ogrady commented 10 years ago

This looks promising as well: http://gamedevelopment.tutsplus.com/tutorials/quick-tip-use-quadtrees-to-detect-likely-collisions-in-2d-space--gamedev-374

ogrady commented 10 years ago

I am currently in on implementing QuadTrees and using them for the map-collisions.

ogrady commented 10 years ago

http://gameprogrammingpatterns.com/spatial-partition.html this might also be interesting for entities, like bullets and mech, when collision-detection should still be an issue after employing the quadtree for the map.

ogrady commented 10 years ago

done in ca50ca1e536b6b39a0f34ba45d195b872b67300e