0ad/source/simulation2/helpers
Yves 8e30410109 Improve PickEntitiesAtPoint
First, do a ray intersection test with the bounding-sphere for all
entities on the map and then check the more detailed selection shape for
the remaining candidates. Do checks that require component lookups after
the ray intersection tests because these are relatively expensive.
The old method for figuring out which entities are below the mouse
cursor was incorrect because it does a 2D check to filter out the first
candidates which can lead to incorrect results with lower camera angles
and high buildings or buildings with a large footprint. Such problems
were avoided with quite a large radius for this 2D test and resulted in
a large number of candiate entities after this first test (200-500).
Also rename PickEntitiesAtPoint to PickEntityAtPoint and make it return
only one (the closest) match.

I've tested performance with the tracelogger by starting a map and then
moving the mouse in circles for one minute. The results were relatively
stable. I've compared the total time percentage of input.js:836, which
spends nearly all of the time in PickEntityAtPoint.
Ardennes Forest - Normal size:       Original: 41.46%    Patched: 31.6%
Ardennes Forest - Giant size:        Original: 40.59%    Patched: 51.55%

As we see, it's faster on normal map sizes but slower on giant maps with
a lot of entities.
This approach can be further improved with some kind of spatial
subdivision for the culling (like an octree), which would help the unit
renderer too. This way it should be possible to make it faster (and
still correct) on all map sizes and with a large total numbers of
entities.

This was SVN commit r16098.
2015-01-01 23:05:26 +00:00
..
Geometry.cpp Pretty unit selection overlay rings. Fixes #824. 2012-04-22 04:04:02 +00:00
Geometry.h Pretty unit selection overlay rings. Fixes #824. 2012-04-22 04:04:02 +00:00
Grid.h of course, 7a3b1fe47e can be simplified 2014-01-06 23:23:18 +00:00
Player.h Set svn:eol-style=native, fix some inconsistent line endings 2013-12-06 00:42:50 +00:00
Position.h Rename CELL_SIZE to TERRAIN_TILE_SIZE, to free up the term "cell" for other concepts. 2012-01-12 12:51:10 +00:00
PriorityQueue.h # New dynamic territories design 2011-07-24 11:42:35 +00:00
Render.cpp Add support for OpenBSD. Fixes #1463. 2012-06-13 20:43:56 +00:00
Render.h Pretty unit selection overlay rings. Fixes #824. 2012-04-22 04:04:02 +00:00
Selection.cpp Improve PickEntitiesAtPoint 2015-01-01 23:05:26 +00:00
Selection.h Improve PickEntitiesAtPoint 2015-01-01 23:05:26 +00:00
SimulationCommand.h # Add initial basic player AI framework. 2011-01-12 12:29:00 +00:00
Spatial.h Revert RedFox's changes to Spatial subdivisions in the simplest possible way (hopefully won't cause OOS, but at least we'll get reports). Fixes #2573, Refs #2430 . There probably are opportunities to remove more things. 2014-08-06 09:21:00 +00:00