Commit Graph

130 Commits

Author SHA1 Message Date
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
Paul Chote
4935266945 Merge FileFormats dll into Game and reorganise namespaces. 2014-04-17 01:20:47 +12:00
Paul Chote
1b2a90c00c Migrate to System.Lazy. 2014-04-09 20:20:41 +12:00
Matthias Mailänder
67cd0645a4 update to .NET 4.0 2014-04-09 20:20:26 +12:00
Curtis Shmyr
76f7e87633 Add Actor.IsDisguised 2014-03-16 19:37:38 -06:00
Curtis Shmyr
8576c24988 Add IEffectiveOwner trait 2014-03-14 19:36:51 -06:00
Pizzaoverhead
ed6147ce0b Fixes order lines not being shown after reselect once their lifetime has expired.
Adds INotifyBecomingIdle.
2014-03-05 18:14:57 +00:00
Paul Chote
0fe839add0 Move HealthExts.IsDead and Kill to Actor. 2013-12-01 00:14:47 +13:00
Paul Chote
19e0c2a83f Remove PPos and PVecInt. 2013-09-27 15:58:56 +12:00
Paul Chote
ad44610e5a Replace dynamic Actor.Bounds with the (unchanging) relative rect. 2013-09-27 15:39:57 +12:00
Matthias Mailänder
8e4ef0462d StyleCop clean Actor 2013-08-29 17:40:26 +02:00
Matthias Mailänder
8c6074a081 WithCrumbleOverlay for Dune 2000 buildings 2013-08-17 23:47:09 +02:00
Paul Chote
c3f04cc32e Convert non-aircraft positioning to world coords.
This removes the incomplete and unused hover code
on Mobile, which would be more trouble that it is
currently worth to carry over.
2013-07-21 17:35:47 +12:00
Paul Chote
6a435752fd Remove *PxPosition from IOccupySpace/IPositionable. 2013-07-21 17:35:46 +12:00
Paul Chote
ecc119cb29 Combine IHasLocation -> IOccupySpace, IMove -> ITeleportable. 2013-07-21 17:33:32 +12:00
Paul Chote
7bce2017c3 Simplify and increase robustness of Shroud et al. Fixes #3440. 2013-06-22 13:15:27 +12:00
Matthias Mailänder
11755798cc Don't reserve airfields/helipads for husks that just fall down
fixes #3376
2013-06-16 12:43:41 +02:00
Chris Forbes
ae809ce39f Use actor/target generations to invalidate targets on ownership change 2013-06-13 09:44:50 +12:00
Chris Forbes
5bc47f4834 Add generation counting to Actor and Target
This allows us to invalidate targets based on arbitrary conditions,
just by bumping the actor's generation number.

The next patches will use this.
2013-06-13 09:44:13 +12:00
Paul Chote
ca5f2c3785 Split Renderable into an IRenderable interface and SpriteRenderable implementation. 2013-05-17 18:12:28 +12:00
Paul Chote
9e4bab07e5 Add conversions and helpers for world coordinates. 2013-03-29 20:39:27 +13:00
Matthias Mailänder
0a82bfe552 format TODO: uniformly to auto-generate task list in MonoDevelop 2013-03-27 09:45:17 +01:00
Matthias Mailänder
72841a51e6 add shroud, creates shroud and reveals shroud to syncreport 2013-03-06 16:05:31 +01:00
Matthias Mailänder
2bc7570674 remove conditional compile left-over junk 2013-02-28 21:59:18 +01:00