Commit Graph

27681 Commits

Author SHA1 Message Date
abcdefg30
f5a963ac47 Production now uses nearest exit to rally point. 2020-10-29 21:42:03 +00:00
Vapre
38f1f1e5c2 Replace TraitContainer.AllEnumerator with ApplyToAll.
As proposed in the past in #13577.

Replace TraitContainer.All() that uses the custom AllEnumerator with
TraitContainer.ApplyToAllX() that takes an action as argument.

The AllEnumerator.Current function show up in profiling reports since it is
used each tick multiple times for multiple traits. The function is 'heavy'
because it creates TraitPair<T>'s temporary objects for each actor
trait combination.

In the past about 20k ITick trait pairs were present during an average
multi player game.

Using an Apply function that takes an action avoid the need to create
these temporary objects.

To be able to still use 'DoTimed' somewhat efficiently the measurement
was moved to inside the trait container method.

Results in a 25% performance improvement in accessing all traits of
a certain type.

Apply function could be used for other TraitContainer functions as well
for further improvements.

Test result for calling on a dummy trait on 20k actors a 1000 times:
  1315 ms traitcontainer.AllEnumerator (current)
   989 ms traitcontainer.Apply (this commit)
2020-10-29 21:21:12 +00:00
Mustafa Alperen Seki
4cdbf74256 Add Align: to SupportPowerTimerWidget. 2020-10-29 19:46:51 +01:00
Andrew Odintsov
bd0738c5c4 Determine stance for spectators based on shroud selection 2020-10-26 23:39:42 +00:00
Paul Chote
72c82cb080 Remove BuildingInfluence trait. 2020-10-26 16:51:12 +01:00
Paul Chote
b9dd59cd63 Remove BuildingInfluence from building adjacency check. 2020-10-26 16:51:12 +01:00
Paul Chote
79019b06ca Remove BuildingInfluence from Plug placement. 2020-10-26 16:51:12 +01:00
Paul Chote
90b25be1b6 Remove BuildingInfluence from ResourceLayer. 2020-10-26 16:51:12 +01:00
Paul Chote
e4faa6b0f0 Remove BuildingInfluence from Aircraft. 2020-10-26 16:51:12 +01:00
Paul Chote
1a3dfdc67f Remove BuildingInfluence from LaysTerrain. 2020-10-26 16:51:12 +01:00
Paul Chote
8d2156fb30 Remove BuildingInfluence from BuildableTerrainLayer. 2020-10-26 16:51:12 +01:00
Paul Chote
5e032edd28 Remove redundant BuildingInfluence checks.
Buildings are already excluded by the ActorMap checks.
2020-10-26 16:51:12 +01:00
Vapre
63d597e4ad ShroudRenderer UpdateShroud only when at least one cell is dirty.
UpdateShroud shows up in profile reports as one of the most
active methods (2.3% CPU time, main mono thread).

This commit introduces `anyCellDirty` to indicate that at lease one
of the cells was marked as dirty.

Avoiding the need to traverse all projected cells of the map
to find any dirty cell.

This reduces the number of shroud updates by at least 50% during a
test game. I assume this is related to renders occurring more
often than logic ticks(?).
2020-10-25 23:01:19 +01:00
Pavel Penev
4135045ca4 Added valid TerrainTypes to the Minelayer trait
Also added a configurable deploy cursor and fixed Minelayer target cell validation checks, which should make for a much better experiencing when dragging over an area with blocking terrain, shroud, fog, etc.
2020-10-24 12:20:15 +02:00
abcdefg30
538623c835 Add a lint check for player counts 2020-10-24 10:09:22 +02:00
abcdefg30
3674583053 Throw an exception at load when a map has more than 64 players 2020-10-24 10:09:22 +02:00
Paul Chote
daa8c74c37 Improve Replaceable logic:
- Remove BuildingInfluence checks
- Support multiple Replaceable/Replacement traits on the same actors
- Fix description typos
2020-10-22 22:15:43 +02:00
Mustafa Alperen Seki
8aeec24c9b Add DamageTypes to Demolition 2020-10-21 18:41:16 +02:00
RoosterDragon
54c4a05062 Classes derived from Stream override ReadByte.
The Stream.ReadByte method is implemented by allocating a 1 byte buffer and calling into Read(byte[], int, int). Override ReadByte in derived classes to avoid needing to allocate this small temp buffer.

Also, fix some bugs in the stream implementations. Remove Write capability from MergedStream that didn't make sense. Add guards into SegmentStream to ensure reads and writes belonged to the segment - otherwise a reader or writer could access regions of the base stream that were outside the intended segment.
2020-10-20 22:53:32 +02:00
RoosterDragon
466de89e17 PackageEntry.HashFilename avoids stream reads .
Operate directly on the array to avoid overhead of stream reads.
2020-10-20 22:53:32 +02:00
RoosterDragon
6eaf51d450 CursorManager avoids use of BitConverter.
Avoid allocating a small temp array via BitConverter.GetBytes, and instead use bitwise ops to isolate the components of the color.
2020-10-20 22:53:32 +02:00
RoosterDragon
7c8dc5d5f4 XccGlobalDatabase allocation improvements
- Use the count to size the capacity of the list.
- Use a char array as a buffer, so will can build each string directly rather than needing a ToArray call first.
2020-10-20 22:53:32 +02:00
RoosterDragon
4f34d3edb3 Improvements in MiniYaml allocation
- Clone method will use the node count to create the correct capacity.
- ResolveInherits will use the node count as the suggested initial capacity.
- FromStream will now stream lines, rather than reading the whole file into memory and then splitting into lines.
2020-10-20 22:53:32 +02:00
RoosterDragon
0efdbc762d Avoid ReadBytes calls in some StreamExts methods.
Read individual bytes to avoid allocating small temp arrays.
2020-10-20 22:53:32 +02:00
Matthias Mailänder
5e42c03afc Replace more \n characters with write lines. 2020-10-19 22:37:01 +01:00
Matthias Mailänder
58726160a9 Reduce the indention level to show the table of contents. 2020-10-19 22:37:01 +01:00
Matthias Mailänder
8cd9215756 Add an additional new line before the unordered list. 2020-10-19 22:37:01 +01:00
Orb
0e33640b14 Code Polish TD Commit 2020-10-19 13:33:25 +02:00
reaperrr
a1c8cbab0b Enable recoil anim on RA/TD Gun Turrets 2020-10-18 20:39:22 +02:00
reaperrr
50b484df56 Fix RA/TD defense turrets facing issues
By using WithSpriteTurret instead of
WithEmbeddedTurretSpriteBody.
2020-10-18 20:39:22 +02:00
reaperrr
99facd2797 Fix default facing of RA/TD Gun Turrets
Compare with make anim and original, 224 was
one facing too far.
2020-10-18 20:39:22 +02:00
Paul Chote
f79e1cacf0 Fix and document FMV scanline rendering. 2020-10-18 20:15:11 +02:00
Paul Chote
82069db724 Fix FMV aspect ratio. 2020-10-18 20:15:11 +02:00
Paul Chote
5a7dc385a3 Remove obsolete LocomotorInfo caching. 2020-10-18 18:19:56 +02:00
darkademic
49e7a33db0 Fixed WithRangeCircle when Visibility is set to Always. 2020-10-18 18:06:22 +02:00
Paul Chote
90b26681eb Remove trait queries from Actor ctor. 2020-10-18 18:00:17 +02:00
Matthias Mailänder
14fc0254c6 Make all range circles fully configurable. 2020-10-18 15:08:17 +01:00
Matthias Mailänder
214aa64ce3 Fix Analyzer warning: V3128 field is used before initialized 2020-10-18 14:53:35 +01:00
abcdefg30
a7bb217887 Make the calculation of DesiredLocalFacing more readable 2020-10-18 14:48:05 +01:00
abcdefg30
10cb8090ec Remove the second arrow on the preview of gdi08a 2020-10-18 14:33:52 +01:00
abcdefg30
1fdecb4e9d Fix briefing text and video of nod04a 2020-10-18 14:33:52 +01:00
abcdefg30
575596c9ad Fix map previews and order in TD 2020-10-18 14:33:52 +01:00
RoosterDragon
e11c8436bd Misc changes to reduce allocation:
- Avoid creating new strings in SpriteRenderer.Flush.
- ProductionQueue.CancelUnbuildableItems can exit early if the queue is empty. It can also use a set of names for quicker lookups.
- OpenGL.CheckGLError avoids a Enum.HasFlag call.
2020-10-17 23:48:48 +02:00
RoosterDragon
c23efea402 Comments to justify GC.Collect calls, compact LOH during load. 2020-10-17 23:48:48 +02:00
RoosterDragon
8d3cec5bea When a render method has nothing to render, eagerly return.
By eagerly returning an empty enumerable in these cases, this avoids allocating an enumerable for the whole render method if nothing will be drawn.
2020-10-17 23:48:48 +02:00
RoosterDragon
87389d3051 Reuse a list in FrozenActor.RefreshState 2020-10-17 23:48:48 +02:00
RoosterDragon
71e3ca4493 Sort renderables in-place in WorldRenderer.GenerateRenderables 2020-10-17 23:48:48 +02:00
RoosterDragon
2adee1e374 Use HasMovementType to avoid Enum.HasFlag allocations. 2020-10-17 23:48:48 +02:00
RoosterDragon
094ccf76b0 Prefer Min/MaxBy overloads to OrderBy().First() patterns 2020-10-17 23:48:48 +02:00
RoosterDragon
bb116034c7 Avoid or reduce LINQ allocations required in various areas. 2020-10-17 23:48:48 +02:00