Commit Graph

37 Commits

Author SHA1 Message Date
RoosterDragon
8e89a6a696 Simplify names, remove unused usings, remove redundant casts. 2016-01-17 21:35:36 +00:00
RoosterDragon
c98df23b57 Create FrozenActor.RefreshState method for better encapsulation and reuse of this logic. 2016-01-17 00:13:06 +00:00
atlimit8
4744f436d3 Move FrozenActor creation to Created in FrozenUnderFog 2015-12-31 00:53:26 -06:00
RoosterDragon
3a2139de26 Add PlayerDictionary.
This custom collection allows other classes to implement a Player to value mapping, but also stores the values in an array for faster lookup by the player index in the world. For some code, this improved lookup time is important for performance.
2015-12-23 23:54:04 +00:00
atlimit8
bee590a057 Merge pull request #10208 from RoosterDragon/perf-comments
Added some performance comments
2015-12-13 20:46:07 -06:00
RoosterDragon
b0619a3e25 Added comments in performance sensitive code. 2015-12-13 16:24:54 +00:00
RoosterDragon
cbc090dd38 Ensure frozen actors are rendered on the first tick they become visible.
The previous lazy rendering means the snapshot of the render state might be more up to date then when the frozen actor actually did become visible. Now, we take this snapshot as soon as needed. We still retain the performance of only doing this rendering when needed by avoiding extra rendering until the visibility cycles again.
2015-12-12 19:54:25 +00:00
RoosterDragon
91ea3532b4 Change a dictionary to an array for faster player lookup in FrozenUnderFog.
Deferencing an array element to get the state is cheaper than a dictionary lookup. We can do this since the players collection does not change during gameplay.
2015-11-27 15:46:32 +00:00
RoosterDragon
ab6ef9be40 Cache traits directly in FrozenUnderFog.
Avoid the performance impact of accessing Lazy.Value by caching the traits on the first tick and accessing the references directly when needed.
2015-11-27 15:45:50 +00:00
RoosterDragon
d70eea5adc Refactor occupied cells visibility checks.
Provide some common extension methods to reduce code duplication, and also use loops instead of LINQ to reduce allocations and provide a minor speedup.
2015-09-26 21:12:05 +01:00
Oliver Brakmann
d667271ab7 Merge pull request #9262 from RoosterDragon/frozen-unify-dict
Speed up FrozenUnderFog.Tick
2015-09-26 20:45:58 +02:00
atlimit8
85fab45451 Remove Actor.HasTrait<T>() 2015-09-19 09:49:23 -05:00
RoosterDragon
592004e738 Unify the player dictionaries in FrozenUnderFog.
This improves the performance of FrozenUnderFog.Tick as only one lookup needs to be done rather than two.
2015-09-05 16:10:00 +01:00
Matthias Mailänder
118782a85e check palette references 2015-08-17 21:36:45 +02:00
Paul Chote
738a500876 Fix visibility queries when fog is disabled. 2015-08-14 19:26:01 +01:00
Paul Chote
86ba26e013 Convert shroud calculations and rendering to PPos. 2015-07-27 19:34:50 +01:00
RoosterDragon
3a0eb5554e Provide HasStance extension method for Stance enum, to avoid overhead of HasFlag method. 2015-07-15 20:40:38 +01:00
Paul Chote
7053e59acb Expose a parameter for reveal behaviour.
VisibilityType.CenterPosition reveals the actor
only if its CenterPosition is inside a cell that
is visible.

VisibilityType.Footprint reveals the actor if any
of its footprint cells are visible (this includes
Mobile actors moving between two cells).
2015-07-04 16:14:47 +01:00
atlimit8
a9908bffb4 UpgradeManager after IUpgradables 2015-06-28 10:24:00 -05:00
Paul Chote
b887d2bfd7 Introduce IDefaultVisibility. 2015-06-19 22:02:06 +01:00
Paul Chote
aee951c86f Remove region assumptions from fast shroud tests. 2015-06-15 18:06:42 +01:00
Paul Chote
585a43fd8f Rename Actor.Destroy/Destroyed to Dispose/Disposed. 2015-05-29 19:08:38 +01:00
deniz1a
106286da23 Prevents satellite icons from being drawn over frozen actors. 2015-05-25 06:31:04 +03:00
RoosterDragon
777a57af62 Lazily generate frozen actor renderables.
Previously actors that could be frozen under fog but were currently visible would be rendered by the frozen under fog system constantly in order to keep a copy of the renderables ready to go for the frozen counterpart when the actor became invisible. Instead, we now delay this extra rendering until the actor actually becomes invisible. This eliminates the wasted rendering to generate renderables that were never used.
2015-03-24 21:08:27 +00:00
RoosterDragon
c3531d6f70 Avoid duplicated frozen visibility checks.
The FrozenUnderFog.Tick method will now reuse the calculation do by the frozen actor when it had to calculate its visibility, this prevents it having to re-do the fairly expensive visibility calculation.
2015-03-19 17:30:40 +00:00
RoosterDragon
6baa35a763 Adjust DisabledOverlay.ModifyRender to be more efficient.
When not disabled, ModifyRender doesn't actually alter the sequence, so we can just return it directly and avoid adding another layer of enumerable. If it is disabled, then the modifying enumerable has one less condition to check inside the loop.
2015-02-26 21:58:29 +00:00
RoosterDragon
b4993efff1 Avoid some minor allocations.
- Don't call string.Format in Actor.ToString since it gets called often, instead prefer a simple concat.
- In HiddenUnderFog.IsVisible, avoid a needless level of lambda indirection.
2015-02-02 21:16:14 +00:00
abcdefg30
8ca61aa917 Updated all year numbers 2015-01-09 21:18:05 +01:00
reaperrr
c619c06999 Merge pull request #7292 from RoosterDragon/upgradeoverlay-modifyrender
Adjust UpgradeOverlay.ModifyRender to be more efficient.
2015-01-08 08:48:55 +01:00
RoosterDragon
df6956867a Adjust UpgradeOverlay.ModifyRender to be more efficient.
When IsTraitDisabled is set, ModifyRender doesn't actually alter the sequence, so we can just return it directly and avoid adding another layer of enumerable. If it is unset, then the modifying enumerable has one less condition to check inside the loop.
2015-01-08 00:52:03 +00:00
RoosterDragon
7cfece6dc0 Introduce a new type for representing map coordinates.
To resolve the ambiguity introduced when the introduction of isometric maps meant that cell and map coordinates were no longer equivalent, a new type has been introduced so they can each be represented separately.
2015-01-07 17:30:34 +00:00
Matthias Mailänder
bc3acfeee7 StyleCop clean OpenRA.Game 2015-01-04 15:38:54 +01:00
Hellhake
fa72e04042 Remove BOM 2015-01-01 22:51:12 +01:00
reaperrr
9dfd369446 Move some Building traits and related elements to Mods.Common 2014-12-26 21:38:49 +01:00
Paul Chote
ecd3809bc2 Fix a collection of whitespace-style issues in Mods.Common. 2014-12-14 17:06:43 +13:00
atlimit8
bbd54cb32f Added IDisabledTrait & rewrote upgrade code using a level-based approach.
Upgradeable traits are notified whenever an upgrade of their declared types are granted or revoked.  The traits maintain their own internal level counter, which is then used to enable or disable the trait functionality.  A trait can register for multiple upgrade types which then all affect the internal level counter.

	IDisabledTrait for identifying (and filtering) disabled traits
	UpgradableTrait provides an abstract base for traits to support upgrade levels
	Added IDisabledTrait support to GlobalButtonOrderGenerator

	Includes rework by pchote with alterations.
2014-11-26 05:45:26 -06:00
reaperrr
f3f051fd46 Move Common Modifiers and PaletteEffects into Traits space 2014-11-18 18:10:59 +01:00