Commit Graph

36 Commits

Author SHA1 Message Date
RoosterDragon
1584018dcd Batch shroud cell changes.
By maintaining a set of changed cells we can avoid repeating work for cells that change multiple times before being rendered. The shroud renderer and radar widget now delay their work until they must render, and thus process each changed cell only once. This avoids significant repetition that was causing major slowdown when many actors were in the world.
2015-03-27 19:50:05 +00:00
abcdefg30
a249302b6b Allow the use of race variants in "StartGameNotification:" 2015-03-20 14:52:58 +01:00
Matthias Mailänder
16ff6e2112 Merge pull request #7561 from RoosterDragon/fast-map-border-shroud
Speed up map border shroud & fix viewport visible cells
2015-03-18 06:36:45 +01:00
Paul Chote
8c4ea20636 Merge pull request #7430 from Rydra/upstream/pf-optimized
[Discussion PR] Complete refactor of Pathfinder
2015-03-03 19:50:25 +00:00
David Jiménez
54ae572303 - Introduced Unit Testing capabilities to the PathFinder trait and algorithm.
Introduced also a small Unit test project to prove it.

- Separated caching capabilities from PathFinder class to increase cohesion and maintainability.
Refactored the pathfinding algorithm by extracting methods based on responsibilities like
calculating costs and reordering functions. These changes should provide a in average a small increase in
pathfinding performance and maintainability.

- Optimized the pathfinder algorithm to reuse calculations like the
MovementCost and heuristics.

- Introduced base classes, IPathSearch and IPriorityQueue interfaces,
and restructured code to ease readability and testability

- Renamed the PathFinder related classes to more appropriate names. Made the
traits rely on the interface IPathfinder instead of concrete PathFinder
implementation.

- Massive performance improvements

- Solved error with harvesters' Heuristic

- Updated the heuristic to ease redability and adjustability. D can be
adjusted to offer best paths by decreasing and more performance by
increasing it

- Refactored the CellLayer<CellInfo> creation in its own Singleton class

- Extracted the graph abstraction onto an IGraph interface, making the
Pathfinder agnostic to the definition of world and terrain. This
abstraction can help in the future to be able to cache graphs for similar
classes and their costs, speeding up the pathfinder and being able to feed
the A* algorithm with different types of graphs like Hierarchical graphs
2015-03-03 20:11:11 +01:00
RoosterDragon
d3b93345b4 Fix Viewport.VisibleCells.
Reworked the visible cells calculation to ensure the visible region is actually minimal, which should reduce the amount of rendering to be done by a small amount. Previously, the region would tend to overdraw by 2-3 cells in either direction. For isometric maps, there was also a bug where it would draw far too much vertically above the top of the map.
2015-02-28 13:36:58 +00:00
RoosterDragon
803390c68e Speed up rendering map border shroud when no shroud is visible.
When the map border shroud must be rendered, but no cells at the border are visible, then we know that no shroud will be visible at all. We can bail from rendering early in this case.
2015-02-27 20:07:32 +00:00
Oliver Brakmann
02c4ace0af Change default facing to 0 2015-02-22 16:25:40 +01:00
RoosterDragon
4d5101a7c4 Vastly improve shroud rendering performance.
Changes in the shroud are now tracked. If a cell changes it will mark itself and its neighbors as dirty. During the render phase all dirty cells will have their vertices calculated and cached. If a cell is not dirty, the pre-calculated vertices are retrieved from cache. Then the sprite renderer is provided the sprite and the pre-calculated vertices to draw.

This prevents constant recalculation of vertices for the shroud in the render phase, requiring instead only dirty cells in the visible area. The update phase is reduced to a practical noop, instead incurring the cost only of changed cells each frame, rather than checking the visible area.
2015-02-20 20:03:42 +00:00
ScottNZ
582b6635ff Brace style fixes 2015-02-13 02:32:49 +13:00
RoosterDragon
82bea961ba Checked LINQ queries and collections for inefficiencies.
- Made Array.IndexOf available via extension method.
- Made ToHashSet extension method.
- Change collections queried often via Contains into sets.
- Avoid Count() extension if Count or Length property exist.
- Made Count() > 0 checks and variations calls to Any() instead.
- Don't call ToList/ToArray if there is no benefit to materializing the sequence.
- If the sequence does benefit from materialization, follow this general pattern:
  - Collection queried often via Contains use ToHashSet to speed up lookups.
  - Short lived variables use ToList. This is because ToArray requires an extra copy to output the final size.
  - Collections persisted into fields or for a long time use ToArray to minimize memory overhead.
2015-01-29 19:20:11 +00:00
Matthias Mailänder
3489794713 replace PlayMusicOnMapLoad trait with Lua Media.PlayMusic method 2015-01-25 14:43:36 +01:00
penev92
52cc69fd1f Move Crate, CrateSpawner and all CrateActions to Mods.Common 2015-01-18 16:40:55 +02:00
RoosterDragon
930d9cbea3 Cache or inline some delegates to avoid repeated allocations. 2015-01-14 22:57:41 +00:00
abcdefg30
8ca61aa917 Updated all year numbers 2015-01-09 21:18:05 +01:00
Oliver Brakmann
c779259462 Merge pull request #7282 from penev92/bleed_moveFiles
Move more traits to Mods.Common
2015-01-08 17:29:19 +01:00
Matthias Mailänder
89b2f4d5d3 Merge pull request #7217 from Mailaender/chrome-init-cleanup
Cleaned up the ingame widget initialization
2015-01-08 07:40:36 +01:00
penev92
bcd5160604 Move everything Bridge-related to Mods.Common 2015-01-08 01:47:20 +02: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
RoosterDragon
a6cda967c2 Formatted all files.
Automatically formatted all files via VS. This generally corrects indentation, removes trailing whitespace and corrects misplaced tabs or spaces. Manually tweaked a few files where required.
2015-01-06 21:28:50 +00:00
reaperrr
b7a3b9fdbf Move ScaredyCat, TakeCover, RenderInfantry, WithBuildingExplosion and SpawnMPUnits as well as Hunt activity to Mods.Common. 2015-01-04 18:12:09 +01:00
Matthias Mailänder
d4d55bb6dc modularize the remaining legacy ingame interface widgets
and consolidate chrome root initialization
2015-01-04 17:57:38 +01:00
Matthias Mailänder
bc3acfeee7 StyleCop clean OpenRA.Game 2015-01-04 15:38:54 +01:00
reaperrr
cb3ba37462 StyleCop fixes 2015-01-04 15:02:19 +01:00
reaperrr
654f56c5d5 Moves Attack, Armament, Move, Air traits and activities as well as anything required by them to Mods.Common.
Extracts Exit from Production into its own trait.
2015-01-04 05:24:28 +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
22ab35f681 Fix capitalization. 2014-12-26 12:13:08 +13:00
RoosterDragon
c37a691c33 Convert some keys users of CellLayer to index via map-coords for efficiency. 2014-12-20 23:39:03 +00:00
Paul Chote
ecd3809bc2 Fix a collection of whitespace-style issues in Mods.Common. 2014-12-14 17:06:43 +13:00
reaperrr
26075b8eaf Moves loadscreens into LoadScreens folder/namespace.
Moves LoadWidgetAtGameStart to Traits/World.
2014-12-11 23:21:34 +01:00
reaperrr
ffca040c47 Moves traits from Common and Power namespaces to Common.Traits namespace 2014-12-11 23:21:31 +01:00
Matthias Mailänder
5361b920ca document various traits 2014-11-30 19:08:44 +01:00
huwpascoe
a660bb95b5 Actor properties consistency improved 2014-11-21 02:44:05 +00:00
reaperrr
5213aef105 Move Palette traits into Traits\World 2014-11-14 01:01:47 +01:00
reaperrr
41f3ee1080 Move ShroudPalette, ShroudRenderer and StartGameNotification to Common
Move World into Traits folder
2014-11-14 00:59:17 +01:00