Commit Graph

153 Commits

Author SHA1 Message Date
Zimmermann Gyula
cf8fff2b99 Remove passing the warheads from DamageWarhead to AttackInfo.
Added a Damage class to pass damage value and damage(types) instead.
This removes a great amount of overhead and longterm opens possibilities to have damagetypes without warheads.
2016-07-12 10:09:49 +02:00
abcdefg30
8c80b61897 Fix the tech tree not refreshing properly on owner change 2016-04-30 13:15:51 +02:00
Paul Chote
e71225496b Clarify GPL version. 2016-02-21 16:30:48 +00:00
Paul Chote
b396965fd9 Update licence header year. 2016-02-21 16:27:31 +00:00
RoosterDragon
dc37574494 Cache sync hash functions per actor for faster sync calculations.
Caching the result of the function lookup allows the actor to calculate all the sync hashes for its syncable traits faster as it does not need to repeat the lookup each time.
2016-01-31 00:44:43 +00:00
Paul Chote
0039a2bdbf Split out an ActivityUtils class. 2016-01-19 23:34:13 +00:00
RoosterDragon
8e89a6a696 Simplify names, remove unused usings, remove redundant casts. 2016-01-17 21:35:36 +00:00
Oliver Brakmann
71478aa2b8 Merge pull request #9734 from RoosterDragon/auto-target-perf
Improve AutoTarget performance
2015-12-20 19:53:17 +01:00
RoosterDragon
b0619a3e25 Added comments in performance sensitive code. 2015-12-13 16:24:54 +00:00
RoosterDragon
21292061f9 Added "PERF: Avoid LINQ." comments. 2015-12-12 21:05:13 +00:00
RoosterDragon
dcf375a412 Store Targetables in Actor.
This can be used to avoid several lookups for these traits, as well as allow Actor to provide specialised methods to deal with target types efficiently. This also reduces some code duplication.
2015-12-12 20:55:17 +00:00
atlimit8
7de98ad6d8 Merge pull request #9635 from RoosterDragon/occupy-space-perf
Speed up checks for IOccupySpace trait
2015-10-22 18:28:57 -05:00
RoosterDragon
262ab408b5 Speed up checks for IOccupySpace trait.
Eagerly load the trait (if it exists) in Actor, and use this reference to avoid having to perform self.Info.HasTraitInfo<IOccupySpaceInfo>() checks.
2015-10-14 20:46:15 +01:00
Huw Pascoe
5a81d5dfa7 Created IHealth interface and cleanup.
To decouple the Health trait from OpenRA.Traits.
DisplayHp renamed to DisplayHP and HealthExts moved
moved next to Actor.Kill() for consistency.
2015-10-12 01:55:59 +01:00
Matthias Mailänder
3884a31550 Merge pull request #9313 from RoosterDragon/actor-eager
Eagerly cache traits in Actor
2015-09-26 13:18:05 +02:00
RoosterDragon
593d913f55 Remove sync on actor - as it doesn't currently work. 2015-09-21 22:16:03 +01:00
RoosterDragon
6b9bd1cbbc Eagerly cache traits in Actor.
In this case, removing the lazy generation buys us more performance in removing the overhead of accessing these values than we lose from avoided computation when these values are never accessed.
2015-09-20 22:36:21 +01:00
atlimit8
09984683a7 Add ActorInfo.TraitInfo[OrDefault]<T>() requiring ITraitIfo types 2015-09-19 09:56:14 -05:00
atlimit8
85fab45451 Remove Actor.HasTrait<T>() 2015-09-19 09:49:23 -05:00
RoosterDragon
d1960258db Speed up Player.CanViewActor.
Create Actor.CanBeViewedByPlayer and simply call this instead. The actor can cache all trait lookups on construction to avoid them being repeated for every visibility check.
2015-09-06 23:29:09 +01:00
reaperrr
f2d8e32b01 Selection box size now defaults to Selectable.Bounds if VisualBounds are null 2015-06-19 12:26:16 +02:00
reaperrr
a3bd007ac7 Moved SelectionDecorations to Mods.Common
And added more settings.

Moved SelectionBoxRenderable to Mods.Common, too.
2015-06-17 20:13:52 +02:00
reaperrr
d6fb05ce68 Introduced VisualBounds on SelectionDecorations
To allow visual selection boxes to be independent from Selectable.Bounds.
2015-06-17 20:13:51 +02:00
Paul Chote
8ae3afa3c5 Properly clean up traits that used to hook only death. 2015-05-29 19:21:35 +01:00
Paul Chote
4ff309811f Dispose actors when tearing down the world. 2015-05-29 19:21:34 +01:00
Paul Chote
585a43fd8f Rename Actor.Destroy/Destroyed to Dispose/Disposed. 2015-05-29 19:08:38 +01:00
Oliver Brakmann
7b3b2f85f8 Fix potentially removing actors twice from world in Actor::ChangeOwner 2015-05-26 17:16:56 +02:00
David Jiménez
044b51742f Remove plumbing for trait unit tests. 2015-05-01 16:24:14 +12:00
RoosterDragon
2937a31463 Make IsDisabled a method on Actor.
This allows us to cache the disabled traits, which simplifies life for some callers since we relieve them of having to cache it, as well as improving perf for all IsDisabled calls.
2015-04-25 20:42:26 +01:00
RoosterDragon
6125d7c117 Rename existing fields that are caching TraitsImplementing calls for consistency. 2015-04-25 20:41:48 +01:00
RoosterDragon
106816a547 Cache the IRenderModifier and IRender traits in Actor.
Previously we just cached the query object, but now we cache the full results. This avoids having to re-evaluate them every render.
2015-04-14 20:15:45 +01: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
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
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
RoosterDragon
dc4d522967 Cache render related TraitsImplementing calls in Actor.
The TraitsImplementing<T> performs a dictionary lookup to match up its generic type parameter with the right trait collection. Since actors are rendered so much, it is useful to cache this result to avoid looking it up repeatedly.
2015-01-05 21:05:19 +00: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
reaperrr
ee8e1f46c1 Move 'Activity' into its own namespace in OpenRA.Game. 2014-12-14 17:12:46 +01:00
huwpascoe
a660bb95b5 Actor properties consistency improved 2014-11-21 02:44:05 +00:00
Paul Chote
04d61f465a Don’t rebuild the actor bindings every query. 2014-09-28 14:46:39 +13:00
Paul Chote
ca6119821f Allow lua API to bind a minimal set of properties to dead actors. 2014-09-28 14:46:37 +13:00
Paul Chote
56332251f5 Don’t double-remove dead actors from the world. 2014-09-27 22:14:16 +12:00
Matthias Mailänder
04f1ebe969 abort change owner when the actor is destroyed
fixes #5638
2014-07-03 09:19:51 +02:00
Paul Chote
1c8a8ca6ff Merge pull request #5400 from RoosterDragon/equatable
Implemented IEquatable<T>
2014-06-09 17:32:17 +12:00
RoosterDragon
0c8bdff5be Formatting fixes.
Spaces to tabs, indents, etc.
2014-05-26 18:10:59 +01: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
RoosterDragon
67594b844a Implemented IEquatable<T> to speed up equality comparisons.
Actor, CPos, CVec, WAngle, WPos, WRange, WRot and WVec structs now implement IEquatable<T> which means unboxing/casting costs can be eliminated.

Also simplified the ToString method by concatenating components directly rather than using a format string since the overhead is a bit high for simple cases like this.
2014-05-23 08:04:43 +01:00
Pavlos Touboulidis
63ec6d60e7 Refactoring to remove static Rules & SequenceProvider 2014-05-17 14:32:03 +03:00
Paul Chote
d73af0190f Add a new native-lua implementation. 2014-05-02 22:18:34 +12:00