Commit Graph

28 Commits

Author SHA1 Message Date
Matthias Mailänder
d830a0a7ae Merge pull request #6029 from pchote/gametomods
Move *Renderables and Render* out of Game.
2014-07-23 06:54:42 +02:00
Paul Chote
1d77cd5391 Merge pull request #5851 from RoosterDragon/shroud-perf
Speed up shroud checks
2014-07-23 11:02:27 +12:00
Paul Chote
f62bec0530 Remove bogus Require<>s. 2014-07-21 23:50:15 +12:00
Taryn Hill
da001385ae Added some trait [Desc()]s. 2014-07-12 13:31:14 -05:00
RoosterDragon
a512d9ad0a Sped up shroud rendering.
- Only update shroud within the visible screen area, rather than the whole map. This improves performance on larger maps significantly when scrolling around since large portions of the shroud do not need to be updated.
- Provide methods in Shroud to return delegates to check for explored/visibility for tiles within a certain region. This allows it to return more efficient delegates whenever the region is within the map bounds, or shroud/fog is disabled. In the typical case where the region is in bounds and shroud/fog is enabled, the fast check is almost twice as fast as the slow check.
- Use the Shroud delegate functions in shroud rendering, frozen actors, minimap rendering and resource layer areas to provide a speedup since these areas of code can often take advantage of the fact they perform checks within the map boundary.
- Cache current element in CellRegionEnumerator to prevent repeated work if the element is accessed more than once.
- Decrease the size of elements in some arrays in hopes of reducing memory needs and improving cache hits.
2014-07-07 17:34:31 +01:00
RoosterDragon
2351c43237 Refactoring pass.
- Extract an enum for edges rather than using magic numbers for everything.
- Remove duplicated code between FoggedEdges and ShroudedEdges by hosting the visibility function into a delegate.
- Make minimap methods more readable.
- Tidy formatting.
- Make some fields readonly.
- Remove unused usings.
2014-07-07 17:34:25 +01:00
RoosterDragon
8a60880cf1 Tackle the last of the low hanging fruit for memory allocations in the main game loop.
- Avoid calling string.Split twice in SprintFont.Measure.
- Change ActorsInBox method of ActorMap and ScreenMap to avoid allocating and intermediate list. As a bonus this allows the sequence to be lazily consumed. Also avoid LINQ in these methods.
- In FrozenUnderFog.TickRender, the method exits early if no players are visible so the attempt at lazy generation was not needed.
- Unwrap a LINQ Any call in ClassicProductionQueue.Tick.
- Merge some successive Where calls in ProximityCapturable into single predicates.
2014-06-22 17:29:45 +01:00
ScottNZ
dbffce81a6 Remove unused usings 2014-06-15 22:16:40 +12:00
RoosterDragon
f180f44542 Cache some dictionary lookups in FrozenUnderFog.Tick.
Since FrozenUnderFog.Tick gets called a lot, these dictionary lookups were actually getting repeated a fair amount. Avoiding the repeated work is a minor performance improvement.
2014-05-31 18:29:31 +01:00
Matthias Mailänder
683edd2c37 fix frozen actors not visible under fog 2014-05-25 09:07:25 +02:00
RoosterDragon
a0db80cb6a Changes to reduce allocations in the main loop.
Targeted some methods that generated allocated a lot of memory in the main game loop:
- Actor.Render - Changed LINQ calls into equivalent loops. No allocation for delegates.
- Animation.Render - Returned an array rather than a yield expression. The array uses less memory than the complier generated enumerable.
- FrozenActor and FrozenUnderFog - Materialize the footprint into an array: The enumerable is not-trivial to evaluate is and evaluated many times inside the Tick function. The memory needed is minimal. Changed LINQ into equivalent loops to prevent delegate allocation. Should result in overall much faster calls.
- Widget.GetEventBounds - Changed LINQ calls into equivalent loops.
- MobileInfo.CanEnterCell - Changed LINQ calls into equivalent loops. Don't materialize list of blocking actors every time, instead enumerate them and only when they need to be checked.
- FrozenUnderFog.TickRender - Generate the renderables lazily and also remove a no-op Select call.
2014-05-23 14:48:11 +01:00
Paul Chote
1b2a90c00c Migrate to System.Lazy. 2014-04-09 20:20:41 +12:00
ScottNZ
00ec1ca87a Remove unused usings 2013-11-12 19:39:33 +13:00
Paul Chote
eef941fd42 Track per-player frozen actors. 2013-08-12 21:34:18 +12:00
Paul Chote
190ce0fc90 Fix z-ordering of FrozenActorProxy. 2013-08-11 12:30:25 +12:00
Paul Chote
136ddf1697 Allow map-placed frozen actors to start revealed. 2013-08-04 11:41:24 +12:00
Paul Chote
126fc79eed Fix FrozenUnderFog. 2013-07-25 18:11:55 +12:00
Paul Chote
ca5f2c3785 Split Renderable into an IRenderable interface and SpriteRenderable implementation. 2013-05-17 18:12:28 +12:00
Paul Chote
c428cad70c Refactor per-player shrouds & fix shellmap shroud. 2013-04-10 19:36:03 +12:00
Paul Chote
000a5eaa56 Pass WorldRenderer to IRenderModifiers and replace more palette lookups. 2013-02-24 15:45:03 +13:00
Kenny
f41fb32d60 Introducing per-player shrouds.
- Each player has their own shroud and their visibility does not extend outside of the shroud. 
- Units and buildings can no longer target other units outside of their visibility. Buildings can still be targetted if they have been explored.
- GPS will provide visibility in the fog-of-war.
- Spies that infiltrate radar domes will gain their victim's exploration and reset it on all clients (if the victim does not have GPS)
2012-12-13 15:16:56 -08:00
Chris Forbes
55036cd58c fix trailing whitespace everywhere 2011-09-26 08:40:39 +13:00
Paul Chote
094907c1a9 Update copyright header. Normalize line endings to LF. 2011-02-13 10:38:57 +13:00
Paul Chote
9655b34e5f Fix FrozenUnderFog; add to cnc. 2010-11-27 11:28:22 +13:00
Paul Chote
7c5c989eb2 Introduce World.LocalShroud. Breaks targeting stealth tanks. Probably breaks FrozenUnderFog. 2010-11-27 11:20:04 +13:00
Paul Chote
230d59f655 Tweak visibility; hopefully allows targeting of detected units 2010-08-15 06:18:46 +12:00
Bob
ae703d50b2 Actor.traits is implementation detail 2010-08-14 17:39:49 +12:00
Paul Chote
8fab45ae39 Move Cloak, HiddenUnderFog, FrozenUnderFog into Mods.RA; Simplify a pile of related stuff. 2010-07-28 21:11:50 +12:00