satellite-game / Satellite

A multiplayer WebGL space warfare game centered around moon bases and space stations
http://satellite.io
BSD 2-Clause "Simplified" License
72 stars 15 forks source link

Hit Detection Optimizations #181

Open alujs opened 10 years ago

alujs commented 10 years ago

Problem: Each bullet inserts itself into the update cycle which causes the system to bog down when many shots are fired. Furthermore, we have heavier client load due to occulus rift and newer features such as bots / AI logic. This issue is no longer an optimization but a necessity.

Solutions proposed: 1) Do the right thing - use spatial calculations to tag things that could possibly be hit and check against those rather than every object in the game. R-trees/Quad-trees + ray casting is the preferred way.

2) Use a single bullet rather double shot .

3) Use phasors/lasers/instant or near instant hit weapons - give it an offset to help with detection.

lazd commented 9 years ago

This is fixed in Satellite-Mobile by using Cannon.js. You can fire the shit out of bullets and it's still ~50FPS on a 3rd generation iPad under iOS 8.