Commit Graph

7392 Commits

Author SHA1 Message Date
Gustas
7b01204eed Spawn aircraft landed and occupying land or at cruise altitude 2024-07-20 18:47:58 +02:00
Gustas
734afd8bcf No need for dummy value 2024-07-20 18:47:58 +02:00
Matthias Mailänder
5ddc7b1177 Localize the faction dropdown. 2024-07-18 22:10:03 +03:00
Gustas
dccab8fd21 Fix PortableChrono not working 2024-07-17 20:36:57 +03:00
RoosterDragon
a5dd4ffe36 Cache teams in observer logic
The player state and teams are fixed after the game starts, so it is safe to cache the resulting teams in the observer logic rather than re-evaluating them each time.
2024-07-16 13:01:27 +03:00
RoosterDragon
0d84804d81 Reduce lag spikes from SquadManagerBotModule.
Updating squads is the most expensive part of SquadManagerBotModule. It involves ticking the current squad state. This usually involves finding nearby enemies and evaluating the fuzzy state machine to decide whether to interact with those enemies. Since all the AI squads for a player get ordered on the same tick, this can result in a lag spike.

To reduce the impact, we'll spread out the updates over multiple ticks. This means overall all the AI squads will still be refreshed every interval, but it'll be a rolling update rather than all at once. By spreading out the updates we avoid a lag spike from the cumulative updates of all the squads. Now the lag spike is reduced to the worst any single squad update can incur.
2024-07-08 18:20:33 +03:00
RoosterDragon
b3168928c6 Remove unused previous state in AI StateMachine
The StateMachine offered a feature to remember the previous state and allow reverting to it. However this feature is unused. Remove it to allow the previous states to be reclaimed by the GC earlier.
2024-07-08 17:44:02 +03:00
RoosterDragon
c1de85f700 Improve performance of path-debug command.
If a long path was being visualized with the path-debug command it would generate renderables for everything on the path, even for parts of the path that would be offscreen. Add some simplistic culling so the performance impact is reduced.
2024-07-08 17:30:46 +03:00
Matthias Mailänder
387554acbb Fixed a crash on empty mission options. 2024-07-05 16:11:20 +03:00
michaeldgg2
446d37b832 WithDockingAnimation: remove unnecessary dependency on Harvester trait 2024-07-01 23:26:52 +03:00
Gustas
e9e6c4b988 Fix multiqueue 2024-07-01 23:13:13 +03:00
RoosterDragon
2ed0656d1b Introduce MoveCooldownHelper to prevent lag spikes from failed pathfinding
Several activities that queue child Move activities can get into a bad scenario where the actor is pathfinding and then gets stuck because the destination is unreachable. When the Move activity then completes, then parent activity sees it has yet to reach the destination and tries to move again. However, the actor is still blocked in the same spot as before and thus the movment finishes immediately. This causes a performance death spiral where the actor attempts to pathfind every tick. The pathfinding attempt can also be very expensive if it must exhaustively check the whole map to determine no route is possible.

In order to prevent blocked actors from running into this scenario, we introduce MoveCooldownHelper. In its default setup it allows the parent activity to bail out if the actor was blocked during a pathfinding attempt. This means the activity will be dropped rather than trying to move endlessly. It also has an option to allow retrying if pathfinding was blocked, but applies a cooldown to avoid the performance penalty. For activities such as Enter, this means the actors will still try and enter their target if it is unreachable, but will only attempt once a second now rather than every tick.

MoveAdjacentTo will now cancel if it fails to reach the destination. This fixes MoveOntoAndTurn to skip the Turn if the move didn't reach the intended destination. Any other derived classes will similarly benefit from skipping follow-up actions.
2024-07-01 15:56:11 +03:00
tjk-ws
fe35c42ead Make InstantlyRepairs properly support multiple types 2024-06-29 14:47:05 +03:00
tjk-ws
a16542e052 Always complete FlyAttack for a zero MaximumRange to avoid stalling 2024-06-29 14:15:39 +03:00
tjk-ws
387e594f4a Allow hotkeying completed buildings whose icons are not visible on the production palette 2024-06-29 00:00:50 +03:00
Matthias Mailänder
0d97f3374c Fix a crash when the target is destroyed. 2024-06-26 21:46:30 +03:00
N.N
ccb1bd7a74 Enable paying upfront
Fix tab availability on low money

Co-Authored-By: Gustas <37534529+PunkPun@users.noreply.github.com>
2024-06-17 13:21:42 +03:00
tjk-ws
2a3271b0d0 Fix autotarget not checking all attack traits for targets 2024-06-17 12:01:07 +03:00
tjk-ws
6a7159e9a1 Fix aircraft that don't rearm stalling over invalid targets 2024-06-17 11:51:19 +03:00
RoosterDragon
cf0e73e75e Improve performance of copy-paste in map editor.
- EditorActorLayer now tracks previews on map with a SpatiallyPartitioned instead of a Dictionary. This allows the copy-paste logic to call an efficient PreviewsInCellRegion method, instead of asking for previews cell-by-cell.
- EditorActorPreview subscribes to the CellEntryChanged methods on the map. Previously the preview was refreshed regardless of which cell changed. Now the preview only regenerates if the preview's footprint has been affected.
2024-06-16 13:35:13 +03:00
RoosterDragon
34a68cd2ca Avoid keeping ActorInitializers in memory.
The SupportPowerManager and WithSpriteBody trait captured the ActorInitializer in lambda expressions, which keeps it alive as long as the trait. The lambdas didn't need to capture the ActorInitializer, so rejig them to allow the ActorInitializer to be reclaimed after the traits have been created. As the TypeDictionary in the ActorInitializer can be quite large, this helps reduce memory usage.
2024-06-16 13:19:07 +03:00
RoosterDragon
cac0438d48 Fix map editor copy-paste for isometric maps.
When dealing with isometric maps, the copy paste region needs to copy the CellCoords area covered by the CellRegion. This is equivalent to the selected rectangle on screen. Using the cell region itself invokes cell->map->cell conversion that doesn't roundtrip and thus some of the selected cells don't get copied.

Also when pasting terrain + actors, we need to fix the sequencing to clear actors on the current terrain, before adjusting the height and pasting in new actors. The current sequencing means we are clearing actors after having adjusted the terrain height, and affects the wrong area.
2024-06-15 15:53:42 +03:00
N.N
0c572a862c Fix actorSpawnManager use only one spawnpoint at the moment 2024-06-03 12:33:06 +03:00
Gustas
64b2bd4735 Update to HTTPS 2024-06-03 10:25:06 +02:00
darkademic
b693f20789 Fix crash caused by queuing multiple pick up orders for a single unit. 2024-05-27 15:03:21 +03:00
Matthias Mailänder
69d9bbb400 Unhardcode support power blocked cursor. 2024-05-19 14:43:59 +03:00
Matthias Mailänder
fc4ebf332d Deduplicate directional support powers. 2024-05-19 14:43:59 +03:00
dnqbob
056420c834 Add WithSwitchableOverlay 2024-05-19 14:35:09 +03:00
Kevin Streser
cbcd413ed1 Consider spectators for waiting filter condition 2024-05-07 22:24:37 +03:00
Gustas
6b463f9d9e Remove color caches 2024-05-04 16:31:35 +02:00
Gustas
239891070d Make sure palettes are updated if colors are toggled in game runtime
And fix MutablePalette's not getting updated
2024-05-04 16:31:35 +02:00
Gustas
5fc36bd45f Make player stance colours universally respected 2024-05-04 16:31:35 +02:00
Gustas
2f331548e1 Remove player colors from healthbars 2024-05-04 16:31:35 +02:00
Gustas
34262fb33c Make PlayerRelationShipColor static 2024-05-04 16:31:35 +02:00
dnqbob
64f35feb13 WithIdleOverlay: support animation with facings 2024-05-03 18:36:07 +03:00
dnqbob
4f8ae422ec WithAttackOverlay: support decoration animation. 2024-04-30 21:17:24 +03:00
dnqbob
f24a966f53 WithAttackOverlay: support specifc Armament to play animation. 2024-04-30 21:17:24 +03:00
dnqbob
78fdfbfb09 WithAttackOverlay: now support facing correctly with BodyOrientation 2024-04-30 21:17:24 +03:00
dnqbob
bdb0cfe243 WithAttackOverlay: fix ZOffset not related to actor. 2024-04-30 21:17:24 +03:00
RaushanSakhibzadin
106c18480f Fix Scroll bug when chat is opened 2024-04-30 13:19:57 +03:00
Matthias Mailänder
97c61e0068 Extract strings from resource renderer. 2024-04-30 11:27:46 +03:00
chacha
e5a7b6e795 Do not keep map pakages loaded on Game start to reduce memory impact 2024-04-30 11:06:17 +03:00
ryanjschneebaum
affc98851c added sorting of names to earnings graph 2024-04-30 10:59:18 +03:00
RoosterDragon
10d7436cf0 CheckTranslationReference lint pass learns additional checks.
- Test all translation languages, not just English.
- Report any fields marked with TranslationReferenceAttribute that the lint pass lacked the knowledge to check.
- Improve context provided by lint messages.

Restructure code for readability.
2024-04-24 15:28:28 +03:00
Gustas
cf21c8e906 Fix support power name not really being optional 2024-04-10 23:52:43 +02:00
RoosterDragon
a4bb58007f Trim memory usage of IReadOnlyPackage implementations.
These implementations are often backed by a Dictionary, and tend to live a long time after being loaded. Ensure TrimExcess is called on the backing dictionaries to reduce the long term memory usage. In some cases, we can also preallocate the dictionary size for efficiency.
2024-04-06 10:47:19 +03:00
michaeldgg2
ed5c7bb836 Minelayer: remove unnecessary requirement Rearmable 2024-04-03 15:05:29 +03:00
Matthias Mailänder
188f0e2451 Extract strings from support power name and description. 2024-04-03 11:38:08 +03:00
RoosterDragon
799c4c9e3c Fix map editor not removing an actor properly.
If you edit an actor name, then delete the actor - it fails to be removed from the map in the editor. This is because the actor previews are keyed by ID. Editing their name edits their ID and breaks the stability of their hash code. This unstable hash code means the preview will now fail to be removed from collections, even though it's the "same" object.

Fix this by making the ID immutable to ensure hash stability - this means that a preview can be added and removed from collections successfully. Now when we edit the ID in the UI, we can't update the ID in place on the preview. Instead we must generate a new preview with the correct ID and swap it with the preview currently in use.
2024-03-28 12:11:26 +02:00
David Wilson
25a6b4b6b9 Editor marker tiles layer 2024-03-21 13:11:04 +02:00