beyond-all-reason / beyond-all-reason/RecoilEngine

Auras (sensor extension?)

Open
#1,508 0 comments 0 reactions 0 assignees View on GitHub
area: Lua API enhancement
Dominant language
C++
Stars
679
Forks
290
Avg merge
3d 2h
Merged PRs (30d)
40

Description

### Background

Lua is pretty bad at doing spatial tasks (tracking units in zones, raycasting over terrain etc). The engine could have native support for this kind of work and in fact it may be a matter of extending existing sensor interface. Zones around units are of course auras and many things can be elegantly achieved with them that currently require manually polling and keeping track of units (ZK area cloaking, BAR raptor acid puddles, the BAR idea to have T2 radar remove wobble, etc).

### Core design

Have the engine read `gamedata/auraDefs.lua` which defines an array of aura types.
* string name
* bool, whether ignores terrain
* bool, 3d vs 2d
* bool, applies to units directly or via ground
* bool, affects self/allies/enemies/neutrals/features(/projectiles??)
* bool, tracked per individual aura carrier or common (like radar)
* bool, per team vs allyteam

Have unit defs for a unit to provide auras. Something like
```lua
auras = {
-- name = { radius = number, strength = integer },
radar = { radius = 1234, strength = 5 },
devotion = { radius = 500, strength = 3 },
},
```

Have a bunch of appropriate callins:
* `wupget:UnitEnteredIndividualAura(auraID, unitID, carrierID, strength, totalStrength)`
* `wupget:UnitLeftIndividualAura(auraID, unitID, carrierID, strength, totalStrength)`
* `wupget:UnitAuraStrengthChanged(auraID, unitID, auraTeamID, oldStrength, newStrength)`
* etc.

Have callouts:
* Spring.SetAuraStrength(unitID, auraID, strength) -> nil
* Spring.SetAuraRadius(unitID, auraID, radius) -> nil
* Spring.GetAuraStrength(unitID, auraID) -> strength
* Spring.GetAuraRadius(unitID, auraID) -> radius
* Spring.AddStandaloneAura() -> auraEmitterID (see #1000 sensors)

Contributor guide

Open the contributing guide

Research direction

Start by comparing the proposed gamedata/auraDefs.lua schema with the existing sensor interface. Map the requested aura definitions, unit-provided auras, callins, and Spring.* callouts before deciding the design; completion would require an agreed engine and Lua API, but the issue names no implementation files or tests.

Written by the indexing model from the issue text.

Assessment

Tech stack
cpp, lua
Domain
api, game-dev
Issue type
Feature
Difficulty
5/5
Estimated time
Over a week
Activity status
Stale
Clarity
Needs clarification
Newbie friendliness
20/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.