Commit Graph

54 Commits

Author SHA1 Message Date
tovl
3790169db9 Make Tick return bool 2019-07-03 20:42:19 +02:00
tovl
b9c302a73a Move ChildActivity handling into base Activity class. 2019-07-03 20:42:19 +02:00
reaperrr
a10af382b4 Add plumbing for notifying traits of movement
More precisely, about start and stop of movement.
2019-03-30 16:24:47 +00:00
tovl
a17cd0fa06 Replaced Canceled state with Canceling state. 2019-03-09 21:47:43 +00:00
tovl
8191a6566b Add missing self and optional pretick parameters to Queue, QueueChild and PrintActivity methods.
This means sequenceActivities needs to accept self as well.
2019-03-09 21:47:43 +00:00
tovl
2e5e7c22f4 Make Mobile a PausableConditionalTrait 2019-03-07 02:50:43 +01:00
reaperrr
117dde32ba Removed unused sanity checks from pathfinding
These haven't been active and used in years.
2019-02-22 19:59:41 +00:00
reaperrr
5166b8cd5d Add missing closing bracket in Move comment 2019-02-22 19:59:41 +00:00
Paul Chote
83212b100e Pause actor movement between cells when Mobile is disabled. 2019-02-03 20:21:51 +01:00
abcdefg30
cadbd0d9ab Change the year number in all cs headers from 2018 to 2019 2019-01-26 23:15:21 +01:00
Chris Forbes
dcf93203ea Get rid of unit pathing delay completely 2018-07-26 13:19:31 +01:00
reaperrr
6984c0ec10 Add AlwaysConsiderTurnAsMove plumbing to Mobile
Can be used to make walker units like the TS mechs display move animations while turning on the spot.
2018-07-19 22:09:43 +02:00
reaperrr
4c239d4ebc Set Mobile.IsMoving to "true" if queueing a turn that takes only a single tick
At the end of L-turns, actors often end up with an internal facing not 100% matching the direction of the next cell on their path.
As a result, if they haven't reached their destination yet, Move queues a quick Turn as ChildActivity, which previously was not considered as IsMoving.
However, we don't want those mini-turns to interrupt move animations, so we now consider them a move as well. Additionally, to avoid any issues, we make these mini-turns non-interruptible, just like the MovePart activities already are.
2018-07-01 15:33:30 +01:00
reaperrr
96377a99c4 Fix losing a tick when next Move.ChildActivity is Turn
While the first tick of the MoveFirstHalf child would run at the parent Move tick (see 2nd-to-last line in Move.Tick), this was not the case for Turn.
As a result, this Move tick would get wasted if a Turn was necessary, which at least contibuted to that visible jerk at the end of each L-turn (actors usually don't have the exact facing needed for the next move at the end of an L-turn).
2018-07-01 15:33:30 +01:00
reaperrr
81343926b6 Split Locomotor trait from Mobile
Add GrantConditionOn*Layer traits

This allows to
- drop some booleans from Locomotor
- drop a good part of the subterranean- and jumpjet-specific code/hacks from Mobile
- grant more than 1 condition per layer type (via multiple traits)
- easily add more traits of this kind for other layers
2018-05-03 10:49:21 +02:00
Arular101
8a60918841 Update copyright notice year to 2018 2018-01-17 00:47:34 +01:00
Forcecore
d49c98ce18 Move activity implementation now uses ChildActivity 2017-11-12 19:46:05 +01:00
Paul Chote
4e493f265f Revert TicksBeforePathing move from Mobile to Move.
This partially reverts commit 11c8cda0c38ad0ac71c58557d34480925307cebd.
2017-08-13 13:31:58 +02:00
Paul Chote
4040863707 Fix queued move activities. 2017-06-18 20:55:50 +02:00
rob-v
fb1d8d780f Fix Service Depot Rally point path finding (+rename ignoredActor) 2017-05-06 19:49:40 +02:00
Oliver Brakmann
f9951f76ca Allow cancelling an activity without aborting the entire queue 2017-04-30 19:07:50 +01:00
Paul Chote
0b0f8bc51e Require cancelled move orders to exit tunnels before completion. 2017-04-17 22:34:21 +01:00
Paul Chote
22fad046a0 Fix units warping to 0,0 when doing a 180 degree turn. 2017-01-29 18:58:35 +00:00
Paul Chote
2bd5a392d1 Add plumbing for custom movement layers. 2017-01-29 18:58:33 +00:00
Taryn Hill
43317e0f5d Update copyright notice year to 2017 2016-12-31 23:46:13 -06:00
Oliver Brakmann
2c66ee8c13 Add native support for uninterruptible activities
This pattern occurs a few times throughout the code, so it makes sense to bake it into the Activity class itself.
2016-10-31 18:46:27 +01:00
Paul Chote
7ffdd53abb Disable smooth turning for 180 degree turns. 2016-08-26 20:15:55 +01:00
Matthias Mailänder
f5d57e361a Merge pull request #11788 from pchote/fix-smooth-moves
Make turning-while-moving actors follow curved paths.
2016-08-19 22:11:28 +02:00
Paul Chote
03e2fa5d55 Lerp turning-while-moving mobile actors along an arc. 2016-08-07 19:53:38 +01:00
Paul Chote
bb0fda41d2 Check terrain cost when testing pathable cells. 2016-08-06 19:01:04 +01:00
Paul Chote
30dcbeb873 Remove legacy Move constructor. 2016-06-25 16:29:47 +01:00
reaperrr
099c44f6f9 Remove ActorExtensionsForMove
And use IMove.IsMoving instead.
2016-06-04 16:34:47 +02:00
Paul Chote
e79fbe1bb9 Reference SubCells directly from MapGrid. 2016-03-16 18:57:07 +00: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
teees
65e1e301f4 Added Gates
FIXUP: account for full gate footprint when updating neighbours.

FIXUP: gate-wall connection adjacency yaml.
2016-01-25 09:14:00 +01:00
Paul Chote
0039a2bdbf Split out an ActivityUtils class. 2016-01-19 23:34:13 +00:00
RoosterDragon
8e89a6a696 Simplify names, remove unused usings, remove redundant casts. 2016-01-17 21:35:36 +00:00
atlimit8
c827dbe183 Replace IDisableMove with upgradability 2015-12-04 19:26:49 -06:00
atlimit8
0fc04b7a4a Make Mobile upgradable 2015-12-04 19:22:23 -06: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
Pavel Penev
cdedfe6931 Don't get stuck in deployed mode because of an impossible move order 2015-09-01 20:19:29 +03:00
Matthias Mailänder
413baf9d8b rename WDist.Range to WDist.Length 2015-07-09 10:55:38 +02:00
Matthias Mailänder
7447e0bf93 rename WRange to WDist 2015-07-09 10:55:38 +02:00
Matthias Mailänder
e86b8d0dde avoid an unneccessary and frequent trait lookup 2015-07-02 20:22:36 +02:00
RoosterDragon
fb0cab7481 Cache results of TraitsImplementing calls.
If a class is caching the TraitsImplementing enumerable, instead cache the results of enumerating it to an array. The avoids having to enumerate the sequence each time it is needed.
2015-04-25 20:42:27 +01:00
RoosterDragon
500a33b590 Cache some trait lookups that occur frequently. 2015-04-25 20:41:49 +01:00
RoosterDragon
1515ac54f6 Enforce a line length limit. 2015-03-19 17:20:34 +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
Taryn Hill
0dc65e5cf3 Merge pull request #7301 from abcdefg30/yearnumbers
Updated year numbers in all files.
2015-01-10 17:57:42 -07:00