This allows empty actor files -> they map to a dummy object that renders
nothing.
The use case is automatically hiding objects at lower quality levels &
LOD settings.
Differential Revision: https://code.wildfiregames.com/D3819
This was SVN commit r25224.
- Allows compositing any two templates in TemplateLoader, and not just
filters: 'A|B|C' is now valid for any template A, B and C.
- Allows parents to be composited paths 'A|B|C'. In such a schema, if A
or B themselves specify a parent, the actual composition becomes
A|pA|B|pB|C and so on.
This allows, by leveraging the common schema of our entities, to reduce
duplication.
For convenience, templates in "special/filters/" and "mixins/" can be
included by their direct name. Others have to be completely specified.
See the two provided cases for examples:
- 'hoplite' becomes a mixin that can be used to apply the Phalanx
formation
- 'builder' becomes a mixin that can be give a template the ability to
build the standard structures, and gives the 'Builder' identity class.
This also allows deduplicating that list of tokens.
Update checkrefs & swap std::map for std::unordered_map in
TemplateLoader.
Differential Revision: https://code.wildfiregames.com/D3801
This was SVN commit r25223.
Fixes 76acc4e146 (and some 2007-2010 commit).
ObjectManager needs the Simulation to be initialised, thus needs to come
after it in the class.
Tested by: langbart
Differential Revision: https://code.wildfiregames.com/D3827
This was SVN commit r25222.
Introduced in 93d22ef16b.
Brings back the less intrusive bug of transforming while garrisoned of
turreted and unloading results in the default stance. That needs to be
fixed again.
Differential revision: D3822
This was SVN commit r25221.
Instead of relying on the assumption that an entity which transforms
only has one of the two (and the same) before and after.
Fixes 5b3bdf3647.
Differential revision: D3821
Comment by: @Stan
This was SVN commit r25220.
Don't pretend it to be a callable function, while it is certainly part
of the FSM.
(Also makes it easier for us to implement a duration for the trading in
the future, might we ever want to.)
Differential revision: D3813
Comment from: @Angen
Closes: #6135
This was SVN commit r25216.
Allows for non-moving entities to drop resources. (When someone checks
those cases in the order.)
(Also makes it easier for us to implement a duration for the dropping in
the future, might we ever want to.)
Differential revision: D3817
This was SVN commit r25215.
Introduced in 2ef3fd7a77.
Fixed by switching the order of task of the barracks and outpost.
Patch by: @nwtour
Differential revision: D3820
This was SVN commit r25214.
An actor file, as referenced by the VisualActor, can now define
different actors for different "quality level" setting.
In this initial version, the quality is handled directly by the object
manager.
Actor format impact:
- '<qualitylevels>' may be used as the root node, containing actor nodes
as children.
- such actor nodes can refer to a file, or to an inline actor, or
simply be inlined.
- such actor nodes may have a 'quality' attribute, specifying the
maximum quality level of this actor. By default, 255 (the maximum) is
implied.
- The actor format remains valid, but 'groups', 'variants', 'material',
'castshadow' and 'float' can be given a [minquality, maxquality[ range
via XML attributes. Outside of this range, the XML node is ignored
(making it possible to define, in a single actor file, several quality
levels).
Quality is a 0-255 value, with:
- Range 0-99 intended for lower level-of-detail actors (billboards,
etc.)
- Range 100-200 the 'normal' range for models. 100 is "low", 150
"medium", and 200 "high".
- Range 201-255 used for higher quality actors that might be used for
e.g. cinematics.
The range is wide to make it easier to add intermediate levels in the
future and it seemed easier given that an integer value of some kind was
required anyways.
Engine impacts:
- A new CActorDef class is introduced, wrapping an art/actors XML file
and its different quality levels. ObjectBase remains the definition of a
given 'actor', now at a given quality level.
- CActorDef imposes a maximal # of quality level for a particular actor
definition (5 currently).
- CUnit is made to refer to an Actor Definition explicitly, not a
particular ObjectBase.
- As a minor optimisation, variation keys are calculated on
pointer-to-sets-of-selections, instead of raw sets-of-selections, as
this reduces copying.
- some refactoring, including better const-correctness and hotloading
support via std::shared_ptr.
Differential Revision: https://code.wildfiregames.com/D3787
This was SVN commit r25210.
Moves the building logic from UnitAI to Builder.
Makes it easier for modders to change building behaviour, e.g. letting
structures build.
Differential revision: D3812
Comment by: @Angen
This was SVN commit r25208.
Moves the healing logic from UnitAI to Heal.
Makes it easier for modders to change healing behaviour, e.g. letting
structures heal (instead of using an aura).
Differential revision: D2680
Comments by: @Stan, @wraitii
This was SVN commit r25207.
Moves the gathering logic from UnitAI to ResourceGatherer.
Makes it easier for modders to change gathering behaviour, e.g. letting
structures gather.
Refs. #4293 by optimising a bit.
Differential revision: D2662
Comments by: @bb, @Stan, @wraitii
This was SVN commit r25206.
Including third party libraries to the cppcheck include path is annoying
and the unknownMacro errors are generally not useful.
This was SVN commit r25200.
It is wasteful to do and seems not needed anymore.
Differential revision: D3802
Comments by: @Angen, @Stan
Reverts b478b9742a, b478b9742a
Refs. #3410
This was SVN commit r25198.
592453c62f added a flag to "GetBlockMovementFlag" to return either the
current or the template value, and by default it returns the template
value.
Foundation logic needed it to return the current value.
Gates are also updated to avoid changing behaviour in unpredictable
ways.
Differential Revision: https://code.wildfiregames.com/D3796
This was SVN commit r25196.
Swap an std::set for an std::vector, the set was useful only in an
earlier iteration of the diff. This fixes nopch.
Differential Revision: https://code.wildfiregames.com/D3790
This was SVN commit r25195.
This basically does two things:
- Allow turrets on moving entities (fixes serialisation in cmpPos).
- Allow an entity to be present on another when the other is created.
That makes it basically a boiled down version of a prior patch, omitting
the part where orders could be passed on.
This does allow e.g. ranged units on chariots that fire while the
chariot moves.
Original diff by: @sanderd17
Redone by: @Stan
Differential revision: D1958
Comments by: @Alexandermb, @Angen, @bb, @Langbart, @Nescio, @Stan,
@wraitii
Refs. #2577 by implementing the entity on platform case.
This was SVN commit r25192.
Adds a new component effectively handling negative resource trickles.
Prevents resources from going negative and provides an effect for not
being able to pay.
The effect chosen for 0 A.D. is having the entity not being
controllable.
Not used in the public mod itself, but it is in quite some mods.
Based on an idea of @Nescio
Differential revision: D1323
Comments by: @Angen, (@smiley,) @Stan
This was SVN commit r25191.
Revealed by f884848745. Noticed by @Langbart.
The holder was deleted after being tasked to garrison the new target,
but with still a holder we were not allowed to garrison.
Differential revision: D3794
Closes: #6128
Tested by: @Lanbart
This was SVN commit r25188.
This is necessary following 2d53308e1b, which now handles key-up in
input to prevent hotkeys from firing then.
Hotkeys are a global system, which means opening e.g. the chat window or
the summary does't reset things. If you press "S" to scroll the in-game
camera down, then press 'return' to open the chat, the camera keeps
scrolling down. Following 2d53308e1b, it never released since it never
got the keyup.
To handle this nicely, we need to explicitly clear hotkeys when input
boxes get focus (respectively the console).
Differential Revision: https://code.wildfiregames.com/D3797
This was SVN commit r25186.
The motion manager introduced in bae258f9a1 makes 'chasing' (e.g. an
entity targeting another entity, which also applies to fleeing)
behaviour symmetrical: both units see the initial state instead of it
being ID-dependent.
This allows removing hacks introduced in 6a66fb8205 (and refined in
7b88b1a0f9).
Differential Revision: https://code.wildfiregames.com/D3785
This was SVN commit r25185.
After 21e866fcf0.
AllertRaiser replaced the order instead of just calling the required
function.
While at it, check for the garrisonable size when looking for buildings.
Differential revision: D3789
Tested by: @Langbart
This was SVN commit r25183.
This implements a form of crowd movement that I've generally called
'unit pushing' in the last few years.
Essentially, any two units will push each other away when they're too
close. This makes it possible to ignore unit-unit obstructions, and thus
makes movement much smoother in crowds.
This first iteration of this system only allows pushing between idle
units and between moving units (i.e. a moving unit does not affect an
idle one).
This is because the unitMotion logic to detect it is stuck & needs to
use the pathfinders starts breaking: units can fail to move because they
are pushed away from their intended movement, and the current logic
fails to handle this gracefully.
Thankfully, the most value of this patch in terms of player experience
is found in the improvements to group movements and shuttling.
Other impacts:
- As the short pathfinder is called less often, we can increase the
starting search range & reduce the # of max turns, both improving
collision recovery.
- The performance of idle units is slightly worsened, as they must be
checked for idle-idle collisions. If needed a 'sleeping' system, as used
in physics engine, could be implemented.
- In general, however, expect slight performance improvements, as fewer
short paths are computed.
- Gathering efficiency should increase slightly, since shuttling times
are likely reduced slightly.
- As a sanity change to improve some edge cases (units that say they're
moving, i.e. pushable, but don't actually move), the 'going straight'
logic is turned off if a short path has been computed. This requires a
few cascading changes to work correctly.
Technical notes:
- To reduce the cost of the n^2 comparisons that pushing requires, units
are only compared within a small square on a grid which is lazily
reconstructed each turn. The overhead seems rather small, and this is
much simpler than keeping an up-to-date grid.
- The design is intended to be parallelisable if needed someday.
- The pathfinder's CheckMovement ignores moving units in UnitMotion, as
that is now the spec. Idle units are not ignored, which is required for
the 'collision' detection to work correctly (see above).
Refs #3442 (not fixed - idle units are not pushed by moving units).
Fixes#5084 (the overlap can still happen, but units will push each
other away).
Differential Revision: https://code.wildfiregames.com/D1490
This was SVN commit r25182.
- Fix mistake in 4b46c09222 (similar to one in a4852c4c01) that allowed
hotkeys to fire while typing in the console.
- Prevent Alt+key to fire hotkeys in input boxes & console as that is
often text input.
- Split the hotkey triggering logic in two: a preparatory phase & an
actual firing phase.
This allows the GUI code to check which hotkeys are about to fire and
selectively allow them to go through. This makes it easier to change
hardcoded hotkeys, such as the console toggling one.
Differential Revision: https://code.wildfiregames.com/D3786
This was SVN commit r25180.
Mouse wheel hotkeys behave differently from other hotkeys (mouse
button/keys) in that they are transient: they're always pressed/released
in one go.
As such:
- They shouldn't be added to the stored pressedHotkeys
- They shouldn't be added to active scancodes.
This fixes these issues from 4b46c09222 & also skips un-necessary
processing in those cases.
Reported by: Imarok.
Differential Revision: https://code.wildfiregames.com/D3782
This was SVN commit r25176.
This makes sure all hotkeys from hotkeys/spec/*.json files are displayed
in the editor, even if they are not found in configuration files.
Differential Revision: https://code.wildfiregames.com/D3767
This was SVN commit r25175.
Some information & resources were outdated, preventing progress.
Patch by: nwtour
Differential Revision: https://code.wildfiregames.com/D3764
This was SVN commit r25171.
Change the OOS notification logic to remember the OOS-ness of each
client. Reset it on client leave.
The server will thus continue checking for OOS if the OOS-client leaves.
This is convenient to ignore observer OOS, or wait for an OOS player
without restarting the game.
Also add the turn number to the OOS dump, to fix#3348: particularly
following d4c2cf4430 the turn is likely to not be the same between
different clients.
Agree by: asterix
Differential Revision: https://code.wildfiregames.com/D3753
This was SVN commit r25170.
Follows d0a42f2f00.
Because only the most specific hotkeys can be active at any time,
releasing a key may require re-activating less specific hotkeys.
There were two issues with this behaviour:
- It was buggy, as it only checked one active key, when any still active
key can trigger hotkeys.
- "HotkeyPress" and "HotkeyDown" events where sent, as if the hotkey was
pressed, which was unexpected for most code/users (it is unusual to have
a "Press" event on key release).
This fixes these issues by "silently" re-triggering the hotkeys in such
a case. It also makes it easier for JS code to use "hotkeyPress" instead
of "hotkeyDown" for non-continuous behaviour.
Accepted By: nani
Fixes#6123
Refs #6064 (fixes the problem, but not the code weirdness)
Differential Revision: https://code.wildfiregames.com/D3766
This was SVN commit r25169.
Fixes dc18d94030.
Using down/up to change the map in the map selection dropdown in the
gamesetup has a one-element lag. The reason is that on dropdown up/down,
two events are sent:
- first the current highlighted item is selected (it's usually the
selected one).
- then the new item is selected.
Because of faulty timer logic, only the first update went through.
Differential Revision: https://code.wildfiregames.com/D3774
This was SVN commit r25168.
Not all orders were checked, which would cause problems when receiving
an order that needed moving and that did not handle not being able to
move properly.
Differential revision: D3771
This was SVN commit r25164.
21e866fcf0
Crossbowmen should be able to turret (noted by @Nescio).
TurretHolders should be able to pick entities up.
Differential revision: D3744
This was SVN commit r25163.