jorisvddonk / operation_rm

Operation RM is a space shooter game in which you fight your own filesystem, inspired by Operation: Inner Space.
Other
1 stars 0 forks source link

Improve hit detection algorithm #12

Open jorisvddonk opened 7 years ago

jorisvddonk commented 7 years ago

As per index.js:

The actual hit detection is rather basic and naïve. It's a simple point-box test between ALL bullets and ALL files. As there are probably not that many bullets active at any given point, and the number of files is probably not that great, this should be okay for now. An easy way of improving this would be to divide the game world up into sectors and only checking for hit detections within a sector and its eight neighbors.

jorisvddonk commented 7 years ago

Also, currently hit detection does not take bullet movement into account. Bullets that move fast might therefore 'phase through' objects.