Skip to content

Converter Restructuring #1782

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Draft
wants to merge 122 commits into
base: master
Choose a base branch
from
Draft
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
122 commits
Select commit Hold shift + click to select a range
30a05ca
gamestate: Apply*Effect components.
heinezen Sep 1, 2024
4e23790
gamestate: Create Apply*Effect components for new entities.
heinezen Sep 1, 2024
7aa349a
gamestate: API interface for Apply*Effect abilities.
heinezen Sep 1, 2024
0bd832a
gamestate: Fix checking ability parents.
heinezen Sep 1, 2024
406a078
gamestate: Add Resistance component.
heinezen Sep 7, 2024
6e48b63
gamestate: Add basic system skeleton for applying effects.
heinezen Sep 7, 2024
f2d7a4c
gamestate: resistance definitions.
heinezen Sep 7, 2024
57acd1a
gamestate: API layer for nyan effects.
heinezen Sep 7, 2024
b0bbf11
gamestate: API layer for nyan resistances.
heinezen Sep 7, 2024
f060824
gamestate: Add LineOfSight component.
heinezen Sep 7, 2024
6f4353c
gamestate: LineOfSight definitions.
heinezen Sep 7, 2024
677ac63
gamestate: Add missing definitions for already implemented abilities.
heinezen Sep 7, 2024
b3e649b
gamestate: Allow fractional values for attributes.
heinezen Sep 8, 2024
aec5019
gamestate: Calculate application for discrete FLAC effects.
heinezen Sep 8, 2024
a94a95b
gamestate: Decrease log level of unrecognized components.
heinezen Sep 13, 2024
6d61807
gamestate: ApplyEffect command.
heinezen Sep 14, 2024
d2d5318
gamestate: Rename command classes and make them 'final'.
heinezen Sep 14, 2024
321fcb8
gamestate: Add condition for ApplyEffect command in activity system.
heinezen Sep 15, 2024
9d13977
convert: Add new activity conditions for applying effects.
heinezen Sep 15, 2024
36bb74d
gamestate: Handle ApplyEffect in activity system.
heinezen Sep 15, 2024
1f754f5
gamestate: Fix time calculations for applying effects.
heinezen Sep 15, 2024
2d4393d
gamestate: Move animation property handling to helper function.
heinezen Sep 15, 2024
ca39fc6
gamestate: Animate effect application.
heinezen Sep 15, 2024
32334e9
curve: Add compress argument for curve operations.
heinezen Oct 16, 2024
ec1cf11
curve: Rename argument for keyframes to 'keyframe'.
heinezen Oct 16, 2024
cac8660
curve: Compress operation on keyframe insertion.
heinezen Oct 16, 2024
f719523
curve: Compress method for curves.
heinezen Oct 18, 2024
ba67084
curve: Add new unit tests for compress() method.
heinezen Oct 18, 2024
679c2a5
curve: Fix compression method.
heinezen Oct 18, 2024
0fe1f1d
curve: Pass through compression args.
heinezen Oct 19, 2024
f286426
curve: Compress during curve sync.
heinezen Oct 19, 2024
e21a99e
renderer: Compress sync on animations curve.
heinezen Oct 19, 2024
d1d627f
renderer: Make fetching from render entity more reliable.
heinezen Oct 20, 2024
9386671
curve: Fix compilation for oider clang versions.
heinezen Oct 20, 2024
fda8e3d
curve: Concept for curve values.
heinezen Oct 20, 2024
06cdde4
doc: Add documentation for curve compression.
heinezen Oct 22, 2024
9445927
gamestate: Add activity node type for branching on value.
heinezen Nov 4, 2024
bbd54ad
gamestate: Handle XorSwichGate in activity system.
heinezen Nov 5, 2024
df28fe1
gamestate: Add unit tests for activity node types.
heinezen Nov 5, 2024
16e37f5
gamestate: Make a lookup function for next comand switching.
heinezen Nov 5, 2024
79e6745
convert: Use new switch gate for command branching.
heinezen Nov 5, 2024
2c39b9f
gamestate: Init new XorSwitchGate activity node type from nyan.
heinezen Nov 7, 2024
2052192
gamestate: Resolve lookup func and node ID mapping for switch condition.
heinezen Apr 7, 2025
ea08f4e
gamestate: Correctly subtract/add applied attribute value.
heinezen Apr 7, 2025
40d3bf0
gamestate: Fix missing convert effect type.
heinezen Apr 9, 2025
0e5f815
convert: Fix generated path of shared media files in modpack.
heinezen Apr 9, 2025
36f57ca
gamestate: Only add apply effect command to game entities with matchi…
heinezen Apr 10, 2025
676b6e3
curve: Fix wrong assertion for interpolation.
heinezen Apr 10, 2025
60495bb
util: Get absolute difference between two fixed point values.
heinezen Apr 10, 2025
dc98ece
curve: Fix overflow for interpolation time offsets.
heinezen Apr 10, 2025
85c02e0
util: Add concepts for fixed point types.
heinezen Apr 11, 2025
88aa621
curve: Cleanup docstrings in KeyframeContainer class.
heinezen Apr 11, 2025
f8024af
input: Use ID texture in input game controller.
heinezen Apr 20, 2025
d43f3ff
input: Send ApplyEffect command to simulation.
heinezen Apr 20, 2025
d56180d
util: Fix writeability check for Directory class.
heinezen Apr 20, 2025
fb65ba7
renderer: Update docstrings.
heinezen Apr 21, 2025
f943ec6
renderer: Swap order of texture targets in world render stage.
heinezen Apr 21, 2025
6aa495b
renderer: Add r32ui as supported output format for writing texture to…
heinezen Apr 21, 2025
99e7a96
gamestate: Process ApplyEffect command from input system.
heinezen Apr 21, 2025
663dfe7
renderer: Update docstring format for texture.h.
heinezen Apr 21, 2025
94d6c9b
renderer: Allow resizing texture without recreating it.
heinezen Apr 21, 2025
053a5da
renderer: Resize all texture targets in render stages with new resize…
heinezen Apr 21, 2025
06c8111
input: Remove unnecessary resize callback for ID texture.
heinezen Apr 21, 2025
f09dc65
renderer: Check if all textures of render target have the same size.
heinezen Apr 21, 2025
ce4f381
renderer: Figure out attachment points with switch command.
heinezen Apr 21, 2025
7b8b361
gamestate: Reserve some game entity IDs for internal use.
heinezen Apr 22, 2025
7a9c92a
convert: Change ability with range to use Ranged property.
heinezen May 4, 2025
42d8025
convert: Fix pylint complaints.
heinezen May 4, 2025
ac2290c
convert: Add new nyan objects for API 0.5.0.
heinezen May 10, 2025
1091533
gamestate: Refactor location of activity gate function definitions.
heinezen May 10, 2025
226db86
gamestate: Allow passing nyan objects in condition/switch functions.
heinezen May 10, 2025
1ae5c9a
convert: Change nyan objects for nyan API 0.5.0.
heinezen May 10, 2025
6712473
gamestate: Consolidate NextCommand condition functions into one.
heinezen May 10, 2025
8571fbf
gamestate: Store current target of command.
heinezen May 11, 2025
9e7a888
gamestate: Allow checking for the Ranged property in nyan API.
heinezen May 11, 2025
5b5d5da
gamestate: Remove obsolete ranged apply effect abilities.
heinezen May 11, 2025
79f3f65
gamestate: Add reverse lookup for ability fqon to ability type.
heinezen May 11, 2025
1230074
gamestate: Use switch statement for component assignment to new entity.
heinezen May 11, 2025
5edd0ac
gamestate: Pass state to condition functions.
heinezen May 11, 2025
71448ed
gamestate; Define initial game entity IDs as constants.
heinezen May 11, 2025
4c1c8db
gamestate: Add lookup for ability type to component type.
heinezen May 11, 2025
e8ddb1f
gamestate: Add condition for checking if a target is in range of an a…
heinezen May 11, 2025
2ecf744
gamestate: Store target of entity when receiving events.
heinezen May 11, 2025
0a3a4a9
convert: Add range check before apply effect ability in activity,
heinezen May 11, 2025
b66c549
gamestate: Add API interface for checking generic API objects.
heinezen May 11, 2025
a0727f7
gamestate: More reliable method to find API parent of nyan object.
heinezen May 11, 2025
912eef7
gamestate: Add method for checking if game entity/player exists.
heinezen May 11, 2025
0b24c5d
input: Fix type of target ID send in command.
heinezen May 11, 2025
6596bb9
gamestate: Make TargetInRange condition accessible for activity system.
heinezen May 11, 2025
6d0ab85
gamestate: Remove unnecessary parameters from ApplyEffect system.
heinezen May 11, 2025
dde103d
convert: Add task nodes to nyan API loader.
heinezen May 11, 2025
e9ddd3f
convert: Add clear queue task to default activity.
heinezen May 11, 2025
c889692
curve: Fix breakout condition when clearing queue.
heinezen May 11, 2025
a9e2e10
gamestate: Use clear queue task in activity system.
heinezen May 11, 2025
3fa9677
gamestate: Make apply effect system use command information.
heinezen May 17, 2025
ac5bd78
gamestate: Remove separate queue for command queue targets.
heinezen May 18, 2025
79042ea
gamestate: Add system for moving to target.
heinezen May 18, 2025
7c42836
gamestate: Private default movement to deestination.
heinezen May 18, 2025
30a2893
convert: Move to target in default unit activity.
heinezen May 18, 2025
9d16958
gamestate: Handle MoveToTarget task activity type.
heinezen May 18, 2025
5ca7432
gamestate: Fix wrong log messages.
heinezen May 18, 2025
e0335a0
gamestate: Clear command queue by default when new command is sent fr…
heinezen May 18, 2025
914d057
convert: Add activity node for checking if the game entity has an abi…
heinezen May 18, 2025
e1c57f5
gamestate: Add condition function for AbilityUsable check.
heinezen May 18, 2025
98a8bc5
gamestate: Turn entity towards target before applying effect.
heinezen May 18, 2025
f89c247
doc: Move system descriptions into code docs.
heinezen May 18, 2025
953d10c
doc: Move component descriptions into code docs.
heinezen May 18, 2025
f788f7e
cfg: Update modpack version of converted games.
heinezen May 18, 2025
be52171
convert: Fix semantic version comparison.
heinezen May 18, 2025
8210696
Merge branch 'feature/apply_effect' into feature/converter_refactor
heinezen May 27, 2025
5939c0b
convert: Move AoCSubprocessor methods into separate files.
heinezen May 28, 2025
f4f0992
convert: Remove typedefs from docstrings.
heinezen May 28, 2025
9dbbe24
convert: Refactor AoCAuxiliarySubprocessor into separate files.
heinezen May 29, 2025
5ded36e
convert: Refactor AoCCivSubprocessor into separate files.
heinezen May 29, 2025
8de72a4
convert: Refactor AoCMediaSubprocessor into separate files.
heinezen May 30, 2025
72440be
convert: Refactor AoCModifierSubprocessor into separate files.
heinezen May 30, 2025
4e26911
convert: Refactor AoCModpackSubprocessor into separate files.
heinezen May 30, 2025
1a64b57
convert: Refactor AoCNyanSubprocessor into separate files.
heinezen May 30, 2025
ce4afe3
convert: Refactor AoCPregenSubprocessor into separate files.
heinezen May 30, 2025
b5149f6
convert: Refactor AoCProcessor into separate files.
heinezen May 31, 2025
9193b00
convert: Refactor AoCTechSubprocessor into separate files.
heinezen May 31, 2025
c2fe6a6
convert: Refactor AoCUpgradeAbilitySubprocessor into separate files.
heinezen Jun 1, 2025
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
The table of contents is too big for display.
Diff view
Diff view
  •  
  •  
  •  
28 changes: 14 additions & 14 deletions cfg/converter/games/game_editions.toml
Original file line number Diff line number Diff line change
Expand Up @@ -38,9 +38,9 @@ expansions = []
]

[AOC.targetmods.aoe2_base]
version = "0.5.1"
version = "0.6.0"
versionstr = "1.0c"
min_api_version = "0.5.0"
min_api_version = "0.6.0"


[AOCDEMO]
Expand All @@ -63,9 +63,9 @@ expansions = []
blend = ["data/blendomatic.dat"]

[AOCDEMO.targetmods.trial_base]
version = "0.5.1"
version = "0.6.0"
versionstr = "Trial"
min_api_version = "0.5.0"
min_api_version = "0.6.0"


[AOK]
Expand Down Expand Up @@ -145,9 +145,9 @@ expansions = []
]

[AOE1DE.targetmods.de1_base]
version = "0.5.1"
version = "0.6.0"
versionstr = "1.0a"
min_api_version = "0.5.0"
min_api_version = "0.6.0"


[ROR]
Expand Down Expand Up @@ -185,9 +185,9 @@ expansions = []
]

[ROR.targetmods.aoe1_base]
version = "0.5.1"
version = "0.6.0"
versionstr = "1.0a"
min_api_version = "0.5.0"
min_api_version = "0.6.0"


[HDEDITION]
Expand Down Expand Up @@ -229,9 +229,9 @@ expansions = []
]

[HDEDITION.targetmods.hd_base]
version = "0.5.1"
version = "0.6.0"
versionstr = "5.8"
min_api_version = "0.5.0"
min_api_version = "0.6.0"


[AOE2DE]
Expand Down Expand Up @@ -278,9 +278,9 @@ expansions = []
]

[AOE2DE.targetmods.de2_base]
version = "0.6.0"
version = "0.7.0"
versionstr = "Update 118476+"
min_api_version = "0.5.0"
min_api_version = "0.6.0"


[SWGB]
Expand Down Expand Up @@ -320,6 +320,6 @@ expansions = ["SWGB_CC"]
]

[SWGB.targetmods.swgb_base]
version = "0.5.1"
version = "0.6.0"
versionstr = "1.1-gog4"
min_api_version = "0.5.0"
min_api_version = "0.6.0"
29 changes: 29 additions & 0 deletions doc/code/curves.md
Original file line number Diff line number Diff line change
Expand Up @@ -18,6 +18,7 @@ Curves are an integral part of openage's event-based game simulation.
1. [Queue](#queue)
2. [Unordered Map](#unordered-map)
3. [Array](#array)
4. [Compression](#compression)


## Motivation
Expand Down Expand Up @@ -133,6 +134,9 @@ Modify operations insert values for a specific point in time.
| `set_insert(t, value)` | Insert a new keyframe value at time `t` |
| `set_last(t, value)` | Insert a new keyframe value at time `t`; delete all keyframes after time `t` |
| `set_replace(t, value)` | Insert a new keyframe value at time `t`; remove all other keyframes with time `t` |
| `compress(t)` | Remove redundant keyframes at and after time `t`; see [Compression] for more info |

[Compression]: #compression

**Copy**

Expand Down Expand Up @@ -292,3 +296,28 @@ Modify operations insert values for a specific point in time.
| Method | Description |
| ---------------- | ------------------------------------------------------------------------------------------------ |
| `sync(Curve, t)` | Replace all keyframes from self after time `t` with keyframes from source `Curve` after time `t` |


## Compression

Curves support basic lossless compression by removing redundant keyframes from the curve.
Keyframes are considered redundant if they do not change any interpolation results, i.e.
the result of `get(t)` does not change.

The most straight-forward way to use compression with primitive curves is the `compress(t)`
method. `compress(t)` iterates over the curve and removes all redundant keyframes after
or at time `t`. The runtime has linear complexity `O(n)` based on the number of elements
in the keyframe container.

Furthermore, primitive curves support incremental compression during insertion for the
`set_insert(t, value)` and `set_last(t, value)` methods via their `compress` argument.
If compression is active, `(t, value)` is only inserted when it is not a redundant
keyframe. `sync(Curve, t)` also supports compression with a flag `compress` passed as
an argument.

Compression may be used in cases where the size should be kept small, e.g. when the curve
is transferred via network or recorded in a replay file. Another application of compression
is in the [renderer](/doc/code/renderer/README.md) for the discrete curves storing an object's
animations. Since compression removes redundant animation entries, the renderer can determine
when the current animation has started much easier as this is then returned by the keyframe
time in `frame(t)`.
71 changes: 60 additions & 11 deletions doc/code/game_simulation/activity.md
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,10 @@ configurable.

1. [Motivation](#motivation)
2. [Architecture](#architecture)
3. [Node Types](#node-types)
3. [Workflow](#workflow)
1. [Initialization](#initialization)
2. [Advancing in the graph](#advancing-in-the-graph)
4. [Node Types](#node-types)


## Motivation
Expand All @@ -32,7 +35,20 @@ and event triggers that indicate which path to take next. By traversing the node
its paths, the game entities actions are determined. The currently visited node in the graph
corresponds to the current action of a unit.

Activities are reusable, i.e. they are intended to be shared by many game entities Usually,
Advancement to the next node can be initiated in several ways, depending on the
[node type](#node-types) of the current node.
It can happen automatically or be triggered by an event. In the latter case,
the event is handled by the `GameEntityManager` which calls an activity *system*
that processes the event to choose the next node.

Advancing in the graph, i.e. visiting nodes and performing actions costs no ingame time. Time
delays of actions, e.g. for using an game mechanic like movement, are instead handled by
scheduling and waiting for events at certain nodes in the graph (e.g. `XOR_EVENT_GATE` nodes).
This means that when running the activity system, the directed edges of the nodes are followed
until a node that waits for an event is reached. This allows the activity graph to support
complex action chains that can be executed in sequence.

Activities are reusable, i.e. they are intended to be shared by many game entities. Usually,
all game entities of the same type should share the same behaviour, so they get assigned
the same activity node graph.

Expand All @@ -45,14 +61,47 @@ representation. You don't need to know BPMN to understand the activity control f
we explain everything important about the graphs in our documentation. However,
you can use available [BPMN tools](https://bpmn.io/) to draw activity node graphs.

## Node Types
Like all game data, activities and node types for game entities are defined via the
[nyan API](doc/nyan/openage-lib.md).


## Workflow

![Activity Workflow](images/activity_workflow.png)

### Initialization

When a game entity is spawned, the engine first checks whether entity's `GameEntity` API object
has an ability `Activity` assigned. If that is the case, the activity graph is loaded from
the corresponding API objects defining the graph. Most of this step involves creates the
nodes and connections for the graph as well as mapping the API objects to node actions.

The loaded activity graph is stored in a `Activity` component that is assigned to the game
entity. At this point, the activity state of the entity is still uninitialized which allows
the entity or the component to be cached for faster assignment to entities using the same graph.
To let the entity become active, the `init(..)` method of the Activity component should be
called after the entity is completely initialized. This sets the activity state to the start
node of the actvity graph.

### Advancing in the graph

After the game entity is spawned, the `GameEntityManager` is called once to trigger the initial
behavior of the game entity. This advances the activity state until the first event branch where
an event is required for further advancement. The `GameEntityManager` now waits for events
for the entity to further advance in the graph.

A game entity's current activity state is stored in its `Activity` component in form of
a reference to the current node. Additionally, the components stores the list of events
the entity currently waits for to advance.

## Node Types

| Type | Inputs | Outputs | Description |
| ---------------- | ------ | ------- | ------------------------- |
| `START` | 0 | 1 | Start of activity |
| `END` | 1 | 0 | End of activity |
| `TASK_SYSTEM` | 1 | 1 | Run built-in system |
| `TASK_CUSTOM` | 1 | 1 | Run custom function |
| `XOR_EVENT_GATE` | 1 | 1+ | Wait for event and branch |
| `XOR_GATE` | 1 | 1+ | Branch on condition |
| Type | Description | Inputs | Outputs |
| ----------------- | ------------------------- | ------ | ------- |
| `START` | Start of activity | 0 | 1 |
| `END` | End of activity | 1 | 0 |
| `TASK_SYSTEM` | Run built-in system | 1 | 1 |
| `TASK_CUSTOM` | Run custom function | 1 | 1 |
| `XOR_EVENT_GATE` | Wait for event and branch | 1 | 1+ |
| `XOR_GATE` | Branch on condition | 1 | 1+ |
| `XOR_SWITCH_GATE` | Branch on value | 1 | 1+ |
130 changes: 0 additions & 130 deletions doc/code/game_simulation/components.md

This file was deleted.

Loading
Loading