Commit Graph

47 Commits

Author SHA1 Message Date
Paul Chote
d967c564a2 Remove TargetActor and TargetLocation from order issuing. 2017-10-15 19:07:46 +02:00
reaperrr
98b1468801 Clean up Harvester TickIdle a bit
Triggering UnblockRefinery each idle tick is bogus.
2017-08-17 22:58:37 +01:00
reaperrr
406f482a19 Cache INotifyHarvesterAction trait look-ups 2017-08-17 22:58:37 +01:00
reaperrr
bac8d3233a Streamline Harvester.SetProcLines return check 2017-08-17 22:58:37 +01:00
Paul Chote
afd8b9ab86 Rework harvester resource claiming:
* Maintains lists of claims, and only restricts
   reservations for friendly units.
 * Removes OnNotifyResourceClaimLost; it's not
   clear whether that is still useful, and it
   prevents future necessary cleanups.
 * Moves other code without changing behaviour.

This fixed stale claims from dead units and enemy
claims from preventing otherwise valid harvest
activities.
2017-07-18 01:09:19 +02:00
Paul Chote
875d215662 Unhardcode harvester queue behaviour parameters. 2017-01-29 17:20:28 +00:00
Taryn Hill
43317e0f5d Update copyright notice year to 2017 2016-12-31 23:46:13 -06:00
reaperrr
f550c3b762 Merge pull request #12315 from obrakmann/activities-pt1
Activities re-write, part 1 (aka the boring bits)
2016-11-18 13:52:06 +01:00
Oliver Brakmann
3e9bf7aa4d Turn Actor.GetCurrentActivity into a property 2016-10-31 18:46:27 +01:00
reaperrr
4af7134115 Require explicit ISpeedModifier implementation
Plus misc "collateral" explicit interfaces.
2016-10-30 20:22:16 +01:00
reaperrr
ce52bc9d7b Some more misc explicit interface implementations
'Fallout' from working on other things.
2016-10-30 19:17:41 +01:00
reaperrr
a6b09342bc Make INotifyBuildComplete require explicit implementation 2016-10-22 18:21:52 +02:00
reaperrr
b8c04a0887 Move INotifyBlockingMove to Common and require explicit implementation 2016-10-20 18:58:40 +02:00
Paul Chote
365bd5b9bd Rename ResourceType trait fields for consistency. 2016-09-25 17:04:18 +01:00
Paul Chote
1ae86f34f8 Overhaul Carryall behaviour, adding support for manual control. 2016-08-27 15:42:18 +01:00
Paul Chote
acab6f1f4b Fix custom order generators for left-click targeting. 2016-04-09 11:59:54 -04:00
Sean Hunt
c18987e293 Allow empty harvesters to be ordered to refineries
The primary reason is to fix OpenRA/ra2#161. Rather than make the
harvester trait more complicated by making this behaviour configurable,
this commit just applies to all harvesters.
2016-03-28 12:44:23 -04:00
Jonathan Ling
2d4c3f715f Refactored ticks to delay per issue #9810 2016-03-22 17:03:37 -04:00
Paul Chote
e71225496b Clarify GPL version. 2016-02-21 16:30:48 +00:00
Paul Chote
b396965fd9 Update licence header year. 2016-02-21 16:27:31 +00:00
reaperrr
1f35a1c010 Let harvesters tick idle for a while before queueing Wait activity 2016-01-29 16:08:28 +01:00
reaperrr
75736cb127 Clean up Harvester and FindResources unblocking 2016-01-29 02:57:43 +01:00
Paul Chote
124c0ea041 Make CanTarget modifiers a ref parameter. 2015-11-16 20:38:53 +00:00
atlimit8
b6f17df260 Add ActorsHavingTrait<TTrait>([Func<TTrait, bool]) 2015-10-28 16:36:45 -05:00
atlimit8
09984683a7 Add ActorInfo.TraitInfo[OrDefault]<T>() requiring ITraitIfo types 2015-09-19 09:56:14 -05:00
atlimit8
6970959ef1 .Trait[OrDefault]<Trait> => .Info.Traits.Get[OrDefault]<TraitInfo> where applicable 2015-09-19 09:49:24 -05:00
atlimit8
85fab45451 Remove Actor.HasTrait<T>() 2015-09-19 09:49:23 -05:00
Matthias Mailänder
c0dd9c4566 Merge pull request #9359 from RoosterDragon/fix-pathfinder-layer-pooling
Fixed pooling of layers used for pathfinding
2015-09-19 13:07:33 +02:00
atlimit8
be010249d7 Replace only use of Linq syntax 2015-09-18 10:31:41 -05:00
RoosterDragon
519be4374c Fixed pooling of layers used for pathfinding.
The previous implementation:
- Was failing to dispose of pooled layers.
- Was using a finalizer to allow undisposed layers to be reused.

This means all pooled layers are kept alive indefinitely until the map changes. If the finalizer is slow for any reason then the pathfiinder will allocate new layers when the pool runs out. Since these new layers are eventually stuffed back into the pool when the finalizer does run, this can theoretically leak unbounded memory until the pool goes out of scope. In practice it would leak tens of megabytes.

The new implementation ensures layers are disposed and pooled correctly to allow proper memory reuse. It also introduces some safeguards against memory leaks:
- A cap is set on the number of pooled layers. If more concurrent layers are needed than this, then the excess layers will not be pooled but instead be allowed to be garbage collected.
- No finalizer. An implementation that fails to call dispose simply allows the layer to be garbage collected instead.
2015-09-16 21:25:46 +01:00
atlimit8
8250f223c4 More HashSet trait fields & Lint support 2015-09-05 16:59:30 -05:00
Matthias Mailänder
2a21c7d1f2 don't let bots do 2x the amount of path searches 2015-08-24 21:03:46 +02:00
RoosterDragon
d415d3ba4e Reduce allocations in the main game loop.
- Cache the shroud projection even for flat maps to avoid allocating single element arrays.
- Avoid LINQ in shroud and map projection queries to avoid enumerator allocations.
- Avoid LINQ in calculation of sync values.
- Cache enumerables in ProductionQueue.
- Cache delegate in HackyAI.
2015-08-18 21:17:28 +01:00
reaperrr
61c0b5d59b Make refinery unblock cell customisable 2015-07-22 02:31:29 +02:00
David Jiménez
787609d51e Improved the performance and intelligence of resource harvesting by
refactoring the Harvesters' pathfinding. Now they in first place assess
which is the closest resource inside their search area and then a path is
calculated

Changed the way harvesters find resources by always trying to find the
closest resource to their refinery.

Changed the strategy of finding to find resources in Annulus.
2015-07-22 02:31:26 +02:00
reaperrr
0ef5312931 Minor cosmetic cleanups for Harvester and BasePathSearch 2015-07-12 23:36:59 +02:00
reaperrr
ba2181e523 Make delay for re-checking for available refinery customisable and increase default 2015-07-12 23:36:58 +02:00
reaperrr
c8661ca2f9 Cache FindResources trait lookups in constructor 2015-07-12 23:36:56 +02:00
reaperrr
8253573ced Cache lookups in DeliverResources constructor
Only re-check for refinery every 5 seconds instead of every second.
2015-07-12 22:36:24 +02:00
reaperrr
27c6f5d6d6 Cached Mobile in constructor
...and removed redundant 'var harv'.
2015-07-12 19:19:32 +02:00
reaperrr
1baae6653c Remove InitialActivity 2015-07-08 02:14:44 +02:00
Matthias Mailänder
50e5e9df24 check voice actor references 2015-06-20 12:09:58 +02:00
Paul Chote
585a43fd8f Rename Actor.Destroy/Destroyed to Dispose/Disposed. 2015-05-29 19:08:38 +01:00
Paul Chote
8c4ea20636 Merge pull request #7430 from Rydra/upstream/pf-optimized
[Discussion PR] Complete refactor of Pathfinder
2015-03-03 19:50:25 +00:00
David Jiménez
54ae572303 - Introduced Unit Testing capabilities to the PathFinder trait and algorithm.
Introduced also a small Unit test project to prove it.

- Separated caching capabilities from PathFinder class to increase cohesion and maintainability.
Refactored the pathfinding algorithm by extracting methods based on responsibilities like
calculating costs and reordering functions. These changes should provide a in average a small increase in
pathfinding performance and maintainability.

- Optimized the pathfinder algorithm to reuse calculations like the
MovementCost and heuristics.

- Introduced base classes, IPathSearch and IPriorityQueue interfaces,
and restructured code to ease readability and testability

- Renamed the PathFinder related classes to more appropriate names. Made the
traits rely on the interface IPathfinder instead of concrete PathFinder
implementation.

- Massive performance improvements

- Solved error with harvesters' Heuristic

- Updated the heuristic to ease redability and adjustability. D can be
adjusted to offer best paths by decreasing and more performance by
increasing it

- Refactored the CellLayer<CellInfo> creation in its own Singleton class

- Extracted the graph abstraction onto an IGraph interface, making the
Pathfinder agnostic to the definition of world and terrain. This
abstraction can help in the future to be able to cache graphs for similar
classes and their costs, speeding up the pathfinder and being able to feed
the A* algorithm with different types of graphs like Hierarchical graphs
2015-03-03 20:11:11 +01:00
Bynnar18
0abe8f9b2b Fixes issues with support powers and adds property to all IOrderGenerator classes to determine priority over selection in the left-click order scheme. 2015-03-01 14:58:19 -06:00
penev92
494b600ed8 Move refinery and harvester logic to Mods.Common;
Remove unused interface IAcceptOreDockAction
2015-02-06 13:23:07 +02:00