103 lines
2.3 KiB
Markdown
103 lines
2.3 KiB
Markdown
# How It Works
|
|
|
|
## Assets
|
|
|
|
Each minigame is a `MinigameDefinition` asset loaded from `Server/Minigames/`. Hytale's asset store owns loading and editor integration.
|
|
|
|
## Runtime
|
|
|
|
When a minigame starts, the runtime service creates a `MinigameRuntime` keyed by runtime ID. Runtime state tracks phase, players, teams, scores, lives, counters, objectives, spectators, eliminated players, map ID, and variant ID.
|
|
|
|
## Events
|
|
|
|
Runtime lifecycle events are emitted as `MinigameEvent` and dispatched through Hytale's event bus.
|
|
|
|
Current emitted event IDs:
|
|
|
|
- `on_game_start`
|
|
- `on_game_end`
|
|
- `on_arena_reset`
|
|
- `on_phase_change`
|
|
- `on_round_start`
|
|
- `on_round_end`
|
|
- `on_game_rounds_complete`
|
|
- `on_timer_expired`
|
|
- `on_player_eliminated`
|
|
- `on_objective_complete`
|
|
- `on_kill_score`
|
|
|
|
## Trigger Conditions
|
|
|
|
Minigame conditions are Hytale `TriggerCondition` types. They check runtime state and can be attached to normal Hytale trigger volumes or trigger effect assets.
|
|
|
|
Current condition type IDs:
|
|
|
|
- `MinigamePhase`
|
|
- `PlayerInMinigame`
|
|
- `PlayerStatus`
|
|
- `PlayerScore`
|
|
- `TeamScore`
|
|
- `Counter`
|
|
- `CurrentRound`
|
|
- `PlayerLives`
|
|
- `TeamCondition`
|
|
- `TimerElapsed`
|
|
- `ObjectiveStatus`
|
|
- `WinConditionMet`
|
|
|
|
## Trigger Effects
|
|
|
|
Minigame effects are Hytale `TriggerEffect` types. They mutate runtime state or call runtime lifecycle operations.
|
|
|
|
Current effect type IDs:
|
|
|
|
- `StartMinigame`
|
|
- `EndMinigame`
|
|
- `ResetMinigame`
|
|
- `SetMinigamePhase`
|
|
- `ResetScores`
|
|
- `ModifyPlayerScore`
|
|
- `ModifyTeamScore`
|
|
- `ModifyCounter`
|
|
- `ModifyPlayerLives`
|
|
- `SetPlayerStatus`
|
|
- `JoinMinigameQueue`
|
|
- `LeaveMinigameQueue`
|
|
- `VoteForMap`
|
|
- `StartQueuedMinigame`
|
|
- `SpawnItem`
|
|
- `SetRound`
|
|
- `StartTimer`
|
|
- `StopTimer`
|
|
- `SetSpawnPoint`
|
|
- `RespawnPlayer`
|
|
- `SendMinigameMessage`
|
|
- `AssignTeam`
|
|
- `SaveInventory`
|
|
- `RestoreInventory`
|
|
- `ClearInventory`
|
|
- `SetObjectiveStatus`
|
|
- `ModifyObjectiveProgress`
|
|
- `AwardKillScore`
|
|
|
|
## Volumes
|
|
|
|
Volumes are Hytale trigger volumes. core-minigames does not define separate volume classes.
|
|
|
|
The normal flow is:
|
|
|
|
```text
|
|
Hytale trigger volume fires
|
|
|
|
|
v
|
|
Minigame TriggerCondition entries evaluate
|
|
|
|
|
v
|
|
Minigame TriggerEffect entries execute
|
|
|
|
|
v
|
|
MinigameRuntime changes
|
|
```
|
|
|
|
Fields named `MinigameId` are registered as asset picker fields, so the editor can show loaded minigame assets as dropdown options.
|