Commit Graph

6525 Commits

Author SHA1 Message Date
RoosterDragon
2d45e67bca Teach HierarchicalPathFinder about Immovable actors.
By tracking updates on the ActorMap the HierarchicalPathFinder can be aware of actors moving around the map. We track a subset of immovable actors that always block. These actors can be treated as impassable obstacles just like terrain. When a path needs to be found the abstract path will guide the search around this subset of immovable actors just like it can guide the search around impassable terrain. For path searches that were previously imperformant because some immovable actors created a bottleneck that needed to be routed around, these will now be performant instead. Path searches with bottlenecks created by items such as trees, walls and buildings should see a performance improvement. Bottlenecks created by other units will not benefit.

We now maintain two sets of HPFs. One is aware of immovable actors and will be used for path searches that request BlockedByActor.Immovable, BlockedByActor.Stationary and BlockedByActor.All to guide that around the immovable obstacles. The other is aware of terrain only and will be used for searches that request BlockedByActor.None, or if an ignoreActor is provided. A new UI dropdown when using the `/hpf` command will allow switching between the visuals of the two sets.
2022-08-31 23:12:42 +02:00
RoosterDragon
77779023d5 Notify of shroud state changes when using DevVisibility cheat.
When this cheat is used by notifying of shroud changes we invoke the usual logic that would occur if the visibility had been granted by units. Without this change any cached information about the visibility is not refreshed. Without this refresh actors with different visibility may not act correctly.

One aspect this improves is frozen actors. Using the visibility cheat will show up all actors on the map. If the cheat is then disabled than frozen actors will appear in their place. Prior to this change a frozen actor would fail to appear if the cheat had caused it to be revealed. Healthbars and selection boxes are also made consistent for similar reasons.
2022-08-31 23:31:48 +03:00
RoosterDragon
1fc1bdc849 Fix frozen actors lacking tooltips if they have the cloak ability.
Since bbf5970bc1 we update frozen actors only when required.

In 8339c6843e a regression was fixed where actors created in line of sight would be invisible.

Here, we fix a related regression where cloaked units that are revealed, and then frozen when you move out of line of sight would lack tooltips.

The fix centers around the setting of the Hidden flag. In the old code this used CanBeViewedByPlayer which checks for visibility modifiers and then uses the default visibility. The bug with this code is that when a visibility modifier was not hiding the actor, then we would report the default visibility state instead. However the frozen visibility state applies here which means if the frozen actor is visible, then we consider the actor to be hidden and therefore tooltips will not appear. In the fixed version we only consider the modifiers. This means a visibility modifier such as Cloak can hide the frozen actor tooltips. But otherwise we do not consider the frozen actor to be hidden. This prevents a frozen actor from hiding its own tooltips in some unintended circular logic. Hidden now becomes just a flag to indicate if the visibility modifiers are overriding things, as intended.
2022-08-31 23:31:48 +03:00
Vapre
215898c7ec ScriptActorInterfaces, unbind on actor destroy. 2022-08-30 21:44:39 +02:00
Gustas
c40675cfba Include map.png into uid generation 2022-08-30 20:03:40 +02:00
Vapre
6e547469d6 Shroud, combine IsVisible and IsExplored into a single function. 2022-08-28 18:50:51 +02:00
Gustas
ce254f8b46 Add per player mutes 2022-08-20 14:52:49 +02:00
Gustas
58fcffa429 Add anti-flood protection 2022-08-20 10:24:25 +02:00
tomas
ac623d784a Remove Do() and replace with foreach() 2022-08-19 22:38:38 +02:00
Matthias Mailänder
2c8c6e50da Code cleanup 2022-08-14 16:11:51 +02:00
Gustas
10ac07bf9f Fix ChooseInitialMap 2022-08-13 17:14:21 +02:00
abcdefg30
f49536ea12 Use Attribute.IsDefined over GetCustomAttributes 2022-08-12 20:14:54 +02:00
darkademic
e827e9952e Additional performance graph colors so same color is not used multiple times. 2022-08-06 22:33:27 +02:00
abcdefg30
d830bca706 Fix force fire opportunity targets not being persisted properly 2022-08-06 15:38:46 +02:00
RoosterDragon
5a8f91aa21 Add a hierarchical path finder to improve pathfinding performance.
Replaces the existing bi-directional search between points used by the pathfinder with a guided hierarchical search. The old search was a standard A* search with a heuristic of advancing in straight line towards the target. This heuristic performs well if a mostly direct path to the target exists, it performs poorly it the path has to navigate around blockages in the terrain. The hierarchical path finder maintains a simplified, abstract graph. When a path search is performed it uses this abstract graph to inform the heuristic. Instead of moving blindly towards the target, it will instead steer around major obstacles, almost as if it had been provided a map which ensures it can move in roughly the right direction. This allows it to explore less of the area overall, improving performance.

When a path needs to steer around terrain on the map, the hierarchical path finder is able to greatly improve on the previous performance. When a path is able to proceed in a straight line, no performance benefit will be seen. If the path needs to steer around actors on the map instead of terrain (e.g. trees, buildings, units) then the same poor pathfinding performance as before will be observed.
2022-08-03 23:12:42 +02:00
Vapre
3f3687f71d Widget, avoid copying child list when reverse iterating. 2022-07-31 22:10:49 +02:00
teinarss
999af0c05b Add OrderBuffer and time synchronisation. 2022-07-26 15:09:08 +03:00
Gustas
b597c000d6 Update LobbyLogic to use the new MapCache map tracking 2022-07-17 22:23:13 +02:00
Gustas
6bcf194874 Add map update tracking to MapCache and fix crash when restarting a game 2022-07-17 22:23:13 +02:00
AspectInteractive2
a1a50d6c98 Added rotation logic to the renderer to enable the use of Interpolated Facings. 2022-07-17 17:03:53 +02:00
Sieds Aalberts
e060d6eb05 CellLayer TryGetValue. Return a value if within cell layer bounds. 2022-07-15 20:41:26 +03:00
tomas
5f4ed5f16b Update TextNotificationsManager to use Ui.Send 2022-07-15 19:19:09 +03:00
tomas
b0329aad35 Add Mediator for UI notifications 2022-07-15 19:19:09 +03:00
Gustas
a03e794140 Add an option to disable chat in replays 2022-07-08 19:40:04 +02:00
Matthias Mailänder
834de4efbe Port to Linguini 2022-07-02 22:32:37 +01:00
Sieds Aalberts
f5de8be3f0 Rectangle equals, trivial optimization. 2022-07-02 23:40:01 +03:00
abcdefg30
82692b9d7f Fix crashes in WeaponInfo when warheads or projectiles cannot be created 2022-06-26 23:46:51 +01:00
abcdefg30
d1f7fb8fb8 Serialize the actor generation for network orders 2022-06-25 18:18:49 +02:00
abcdefg30
13145557c8 Fix the switch-case formatting in Order.Deserialize 2022-06-25 18:18:49 +02:00
Ivaylo Draganov
5f42c7c8df Add support for readonly hotkeys and expose chat input hotkeys 2022-06-24 19:42:53 +01:00
Paul Chote
d050fe9f26 Move UnitOrderGenerator to Mods.Common. 2022-06-12 11:57:38 +02:00
Paul Chote
6eb8a4568b Allow mods to replace UnitOrderGenerator with their own default. 2022-06-12 11:57:38 +02:00
Paul Chote
bbe068f6cb Move IOrderGenerator to OpenRA.Orders namespace. 2022-06-12 11:57:38 +02:00
RoosterDragon
c9ee902510 Fix issues preventing suboptimal path searches.
Two different issues were causing a path search to not explore cells in order of the cheapest estimated route first. This meant the search could sometimes miss a cheaper route and return a suboptimal path.

- PriorityQueue had a bug which would cause it to not check some elements when restoring the heap property of its internal data structure. Failing to do this would invalidate the heap property, meaning it would not longer return the items in correct priority order. Additional tests ensure this is covered.
- When a path search encountered the same cell again with a lower cost, it would not update the priority queue with the new cost. This meant the cell was not explored early enough as it was in the queue with its original, higher cost. Exploring other paths might close off surrounding cells, preventing the cell with the lower cost from progressing. Instead we now add a duplicate with the lower cost to ensure it gets explored at the right time. We remove the duplicate with the higher cost in CanExpand by checking for already Closed cells.
2022-06-07 15:47:02 +02:00
penev92
c1cb9ea6be Removed an using, redundant when building on Mono 2022-06-03 21:43:43 +02:00
abcdefg30
6a31b1f9f3 Update the copyright header year 2022-05-28 00:35:10 -05:00
Matthias Mailänder
709512b166 Add Lua API export in EmmyLua syntax. 2022-05-24 21:07:54 -05:00
abcdefg30
7ec74749be Remove the deprecated WAngle.Range accessor for Lua 2022-05-22 10:57:30 -05:00
abcdefg30
c827d1a4ab Remove deprecated integer facing handling for Lua 2022-05-22 10:57:30 -05:00
abcdefg30
660130653c Use TryGetValue instead of ContainsKey and a lookup for cached sounds 2022-05-22 10:39:27 -05:00
abcdefg30
ea04a7fec5 Clear cached notifications when initializing a new map/mod 2022-05-22 10:39:27 -05:00
abcdefg30
9d481854f3 Make currentSounds readonly 2022-05-22 10:39:27 -05:00
Eduardo Cáceres
aa998a46d9 Simplify collection initialization 2022-05-18 11:42:36 -05:00
Eduardo Cáceres
cae43808d9 Optimize string comparison 2022-05-18 11:42:36 -05:00
Eduardo Cáceres
2677e9c013 Use pattern matching 2022-05-18 11:42:36 -05:00
Eduardo Cáceres
aed2b8afae Remove unnecessarily interpolated strings 2022-05-18 11:42:36 -05:00
Eduardo Cáceres
7eb64ea6fc Use read-only autoimplemented property when possible 2022-05-18 11:42:36 -05:00
Eduardo Cáceres
79f321cb44 .Any(), .Count() -> .Count or .Length 2022-05-18 11:42:36 -05:00
Ivaylo Draganov
6a1a6b6397 Add platform override support for hotkeys and unhardcode editor hotkeys 2022-05-07 20:55:49 +01:00
Ivaylo Draganov
f0e69c3f64 Add hotkey filtering functionality (by name and by context) 2022-05-03 22:22:55 +02:00