Commit Graph

37 Commits

Author SHA1 Message Date
abcdefg30
8ca61aa917 Updated all year numbers 2015-01-09 21:18:05 +01:00
Oliver Brakmann
58dc61e6ed Merge pull request #7262 from RoosterDragon/actormap-partitioning
Fix ActorMap spatial partitioning to actually work.
2015-01-04 18:48:01 +01:00
Oliver Brakmann
75808c365a Merge pull request #7269 from abcdefg30/general-polish
Some general polish
2015-01-04 16:54:37 +01:00
Matthias Mailänder
bc3acfeee7 StyleCop clean OpenRA.Game 2015-01-04 15:38:54 +01:00
abcdefg30
f2e224dd72 Fix a crash in RemoveProximityTrigger 2015-01-04 13:06:06 +01:00
RoosterDragon
a0737ccbf3 Fix ActorMap spatial partitioning to actually work.
The bin partitioning in ActorMap worked by dividing the map up into a few chunks of cells, each of which would contain some actors. Unfortunately, the bins were accessed directly in world coordinates which are on a scale 1024x greater than cell coordinates. This lead to all actors being placed into the bottom right bin. When checking for actors in a box, only this bottom right bin would be iterated for actors. Thanks to the fact this bin indeed contained all the actors, some clamps on the input ranges and filtering required per bin anyway, this actually returned correct results. Effectively, it was as if there was no spatial partitioning at all.

Not surprisingly however, this is fairly inefficient. By correcting the spatial partitioning to actually partition we see a 7x speedup in ActorsInBox on the RA shellmap.
2015-01-04 02:35:16 +00:00
Hellhake
5a97a4b63b Fix StyleCop warnings in OpenRA.Game 2015-01-02 12:11:01 +01:00
abcdefg30
e29adf5f4f Added proximity triggers 2014-11-23 13:31:39 +01:00
Guido L.
ae4ee0926a AnyUnitsAt: Ignore destroyed Units 2014-11-09 03:15:33 +01:00
Paul Chote
0652d338f8 Add proximity trigger plumbing. 2014-10-04 14:01:45 +13:00
Paul Chote
a61fdba44d Implement cell triggers. Closes #4400. 2014-09-30 19:25:09 +13:00
Paul Chote
ee77db1831 Add some additional robustness against bogus cell queries in ActorMap. 2014-09-24 22:36:59 +12:00
Matthias Mailänder
44d134afe0 don't update the actor map outside the map borders 2014-09-21 10:52:44 +02:00
atlimit8
8ad1140921 Reduce ICrushable trait lookup & drop -SubCell suffix.
Replace `a.HasTrait<ICrushable>()` with a.TraitsImplementing<ICrushable>().Any() or equivalent.
2014-08-30 04:43:57 -05:00
atlimit8
e29b9edfc1 Changes to map.cs, rename IPositionable.IsLeaving{ => Cell}, add IPositionable.GetValidSubCell 2014-08-29 23:30:16 -05:00
atlimit8
63c28ee4d7 Refactored in new enum SubCell 2014-08-29 23:00:53 -05:00
atlimit8
27ad5208fb Fixed Mobile.SetPosition & other FixUnloadCargo touch-ups
Fixed Mobile.SetPosition
Finally removed old SubCell enum
Folded MobileInfo.CanEnterCell overloads into one
Renamed IPositionable.{IsMovingFrom => IsLeaving}
Changed Crate.IsLeaving to use crate lifetime
2014-08-29 23:00:53 -05:00
atlimit8
b2c9064545 Refactored [sub-]cell availability logic in IPositionable & ActorMap
Moved the logic from IPositionable.CanEnterCell & integrated sub-cell selection.
Added IPositionable.IsMovingFrom(CPos location, int subCell = -1) - to detect transient actors
Renamed IPositionable.{GetDesiredSubcell => GetAvailableSubcell} - since it checks for available sub-cells
Reduced IPositionable.CanEnterCell to one method that usually uses IPositionable.GetAvailableSubcell
Added actor checking to ActorMap.{HasFreeSubCell, FreeSubCell, AnyUnitsAt} - used by [sub-]cell availability logic
2014-08-29 23:00:53 -05:00
atlimit8
fe57417aa8 Added int subCell = -1 to IMove.MoveIntoWorld & IPositionable.SetPosition(Actor self, CPos cell) 2014-08-29 23:00:53 -05:00
atlimit8
898bf4959a Remove sub-cell offset bounds checking 2014-08-04 18:09:26 -05:00
atlimit8
9b30c21f93 Load subcells and default subcell index from mod.yaml 2014-08-04 18:09:26 -05:00
atlimit8
43478dd500 enum SubCell => int & Dictionary<SubCell, WVec> => WVec[] 2014-08-04 18:09:26 -05:00
RoosterDragon
ffd2e8ea9d Sped up ActorMap.ActorsInBox.
- By ensuring both the add and remove actor lists are sets, we ensure the partitioning bins will contain only distinct actors. We can remove the HashSet and Distinct in ActorsInBox and ActorsInWorld which provides a nice speedup for queries. ActorsInBox sees nearly a 3x speedup in the RA shellmap.
2014-07-09 18:43:40 +01:00
Paul Chote
5560f276ca Map: Rename IsInMap -> Contains. 2014-06-27 22:07:03 +12:00
Paul Chote
8dc0967d2e Use CellLayer for ActorMap. 2014-06-27 22:07:02 +12:00
Paul Chote
bbd1331536 Clean up actor selection in WorldInteractionControllerWidget. 2014-06-27 19:20:44 +12:00
RoosterDragon
8a60880cf1 Tackle the last of the low hanging fruit for memory allocations in the main game loop.
- Avoid calling string.Split twice in SprintFont.Measure.
- Change ActorsInBox method of ActorMap and ScreenMap to avoid allocating and intermediate list. As a bonus this allows the sequence to be lazily consumed. Also avoid LINQ in these methods.
- In FrozenUnderFog.TickRender, the method exits early if no players are visible so the attempt at lazy generation was not needed.
- Unwrap a LINQ Any call in ClassicProductionQueue.Tick.
- Merge some successive Where calls in ProximityCapturable into single predicates.
2014-06-22 17:29:45 +01:00
ScottNZ
dbffce81a6 Remove unused usings 2014-06-15 22:16:40 +12:00
RoosterDragon
b8b8b1e2df Minor changes to reduce allocation.
- Cache a predicate in ActorMap.
- Use short circuiting to skip a call to HasTrait in AttackBase.
- In AutoTarget.ScanForTarget, move the check for the scan time above the calculations since we can skip them if it's not time yet.
- In AutoTarget.ChooseTarget, merge four Where calls into one.
2014-06-12 05:32:44 +01:00
RoosterDragon
2bd8778c55 Changed removeActorPosition field in ActorMap into a set.
This is because it's purpose is to be queried via Contains when actors needed to be removed.
2014-05-23 08:30:45 +01:00
ScottNZ
00ec1ca87a Remove unused usings 2013-11-12 19:39:33 +13:00
Paul Chote
4f354e1474 Batch ActorMap add/removes and filter invalid ActorsInBox. Fixes #3897. 2013-10-05 13:19:47 +13:00
Paul Chote
85f854ccde Clean up ActorMap. 2013-10-05 12:59:54 +13:00
Paul Chote
3f8d75a1ac Remove SpatialBins. 2013-09-27 15:36:51 +12:00
Paul Chote
e03ec690ff Track actor positions in ActorMap. 2013-09-27 15:36:51 +12:00
Paul Chote
b00cc6108d Make ActorMap addition explicit. 2013-09-27 15:36:51 +12:00
Paul Chote
4a2a747556 Pull ActorMap back out into a trait. 2013-09-27 15:36:49 +12:00