Commit Graph

174 Commits

Author SHA1 Message Date
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
David Jiménez
8659a3e71e Introduced the interfaces IActor, ICacheStorage, ILog, IMap, IWorld a
nd IMobileInfo to separate concrete implementations and abstractions
2015-02-22 23:14:12 +01: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
abcdefg30
8ca61aa917 Updated all year numbers 2015-01-09 21:18:05 +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
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
Matthias Mailänder
9d2f33d42c add a World type 2015-01-04 17:57:38 +01:00
Matthias Mailänder
bc3acfeee7 StyleCop clean OpenRA.Game 2015-01-04 15:38:54 +01:00
Hellhake
5a97a4b63b Fix StyleCop warnings in OpenRA.Game 2015-01-02 12:11:01 +01:00
RoosterDragon
c37a691c33 Convert some keys users of CellLayer to index via map-coords for efficiency. 2014-12-20 23:39:03 +00:00
Matthias Mailänder
10edb7a621 also measure render performance bottle necks
closes #4133
2014-11-01 15:33:03 +01:00
Oliver Brakmann
a3bf3e7403 Add support for mission objectives
Objectives can be either primary or secondary objectives. Primary ones
influence the outcome of the game.  If all primary objectives are
completed the game is won, and lost when any of them fails.

Objectives can be added at any stage during the game, allowing to react
dynamically to game events.

The objectives backend only contains the information about the
objectives themselves. It does not check if objectives are completed or
failed.  Instead, the state of objectives must be manually marked. The
backend, however, does check whether the game is won or lost.
2014-08-07 16:56:17 +02:00
atlimit8
0319b8cbda INotifyCreated 2014-07-25 17:07:15 -05: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
802b6a652c Revert "new PauseState to differentiate game and editor pausing"
This reverts commit d1e18cad7a.
2014-07-08 10:42:00 +12:00
Paul Chote
3c2d9910e3 Revert "Undo changes to World::SetLocalPauseState to unbreak Lua"
This reverts commit 77e3d17527.
2014-07-08 10:39:18 +12:00
Oliver Brakmann
77e3d17527 Undo changes to World::SetLocalPauseState to unbreak Lua
Fixes #5864.
2014-07-07 21:50:37 +02: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
Matthias Mailänder
d1e18cad7a new PauseState to differentiate game and editor pausing 2014-07-06 08:24:08 +02:00
Paul Chote
2a466d08c3 Remove the now-unused ExploredBounds optimization. 2014-06-27 22:07:03 +12:00
RoosterDragon
909c5c7037 Some minor cleanup in TraitDictionary and affected callsites. 2014-06-17 22:10:41 +01:00
ScottNZ
90894aa03e Use var everywhere 2014-06-15 22:17:34 +12:00
Pavlos Touboulidis
ee4f3e5642 Always allow cheats on single player games 2014-06-13 17:18:12 +03:00
RoosterDragon
d1b3d77662 Changed logging in DoTimed/RunActivity to create less overhead.
- Refactored PerfTimer to use less memory.
- Avoid using the PerfTimer in highly called methods DoTimed and RunActivity, instead tracking long ticks manually to reduce overhead and avoid memory allocations.
- Added some helper methods in PerfTimer to output information when a tick takes too long.
- Changed PerfTimer logging to output the time at the start of the line, and no longer truncate output per line.
- Settings.LongTickThreshold changed from TimeSpan to float and renamed to LongTickThresholdMs.
2014-05-28 16:38:05 +01:00
Pavlos Touboulidis
b8bbd55598 Misc changes
* Use Pair instead of KeyValuePair
* double -> var
* Butcher XML comments
* Change WinState default to Undefined and use it instead of the new GameOutcome
* Other changes
2014-05-22 21:57:07 +03:00
Pavlos Touboulidis
de0a5ebd43 Improve replay metadata and the replay browser
List of changes:

* Better and more filters with new layout, for both mods.

* Rename/Delete/Detele all functionality.

* Simplified ReplayMetadata class considerably by introducing a new
GameInformation data object. The new GameInformation class contains
more information than previously available so the new solution is not
compatible with old replays, meaning it can't read old replays.

* Better and cleaner game information gathering in order to be written
at the end of the replay file.

* Revert changes to ReplayConnection, no longer necessary.

* Better exception message on missing sprites and fonts.

* New "SpawnOccupant" class that holds all the information needed by the
MapPreviewWidget to visualize a spawn point. It was using Session.Client
before and it was necessary to separate it to be able to show information
not available at lobby time.

* Fix keyboard focus UI bug when closing a window would not remove focus.
2014-05-22 21:54:14 +03:00
Pavlos Touboulidis
98a05b61b3 Add metadata block to replays
The replay files are just streams all network communication so to
get any info out of them it is necessary to play back the stream
until the wanted information is reached.

This introduces a new metadata block placed at the end of the
replay files and logic to read the new block, or fall back to
playing back the stream for older files.

The replay browser is also updated to use the metadata information
instead of reading the replay stream directly.
2014-05-22 21:54:14 +03:00
Pavlos Touboulidis
df0d1360dd Give PerfTimer the ability to write only slow operations to the log
This is useful to ignore fast operations that just spam the log.

The class had to be reworked because it couldn't properly handle cases
where all of a node's children where below the threshold.

Also changed DoTimed() and RunActivity() to use PerfTimer.
2014-05-22 03:40:36 +03:00
Matthias Mailänder
187362e80e rename OpenRA.Support.Random aka XRandom to MersenneTwister 2014-05-18 21:53:21 +02:00
Pavlos Touboulidis
6f3d9e9c97 Remove unused "Manifest" argument from World constructor 2014-05-17 14:33:16 +03:00
Pavlos Touboulidis
63ec6d60e7 Refactoring to remove static Rules & SequenceProvider 2014-05-17 14:32:03 +03:00
Paul Chote
fdd4437c52 Re-enable shellmaps. 2014-05-02 22:08:41 +12:00
Pavlos Touboulidis
45944a053c Replace (and remove) custom Set<T> with HashSet<T> 2014-04-27 00:01:33 +03:00
Pavlos Touboulidis
2d8cd8299f Add more perf measurements 2014-04-23 03:43:46 +03:00
Paul Chote
4935266945 Merge FileFormats dll into Game and reorganise namespaces. 2014-04-17 01:20:47 +12:00
Oliver Brakmann
4d71e37ab0 Disable shellmaps temporarily 2014-04-03 17:24:01 +02:00
Matthias Mailänder
0c20e38443 add a pause/slowdown/play/fastforward button for replays
closes #4633
2014-03-14 10:07:54 +01:00
Paul Chote
20b88fd904 Remove World.FrameNumber. 2014-03-12 17:19:29 +13:00
Paul Chote
a7d6f717c4 Overhaul ingame timer displays. Fixes #3062. 2014-03-12 17:19:06 +13:00
ScottNZ
e4e6169f7f Add a function to World for setting just the local pause state, and add a lock variable to prevent further pause state changes 2013-11-29 23:01:18 +13:00
Matthias Mailänder
8a13cd6c6a additional checks to avoid giving dead actors a rank sign
closes #4134
2013-11-17 23:28:02 +01:00
Matthias Mailänder
6f8e78761c StyleCop cleanup 2013-11-02 23:18:23 +01:00
Paul Chote
4a2a747556 Pull ActorMap back out into a trait. 2013-09-27 15:36:49 +12:00
Paul Chote
dfd51c0caa Introduce ScreenMap trait for caching screen-coord queries. 2013-09-27 15:36:25 +12:00
Paul Chote
cad46e43c5 Add WorldRenderer parameter to WorldLoaded. 2013-09-27 15:29:44 +12:00
Matthias Mailänder
bdfdaac092 sync effects 2013-08-29 17:37:35 +02:00
Paul Chote
f6d0ea4b0f Remove TileSet rendering code. 2013-08-14 23:08:25 +12:00
Paul Chote
c7350b704e Add trait interfaces for added/removed from world. 2013-08-04 18:22:57 +12:00