beyond-all-reason / spring

A powerful free cross-platform RTS game engine
https://beyond-all-reason.github.io/spring/
Other
178 stars 95 forks source link

Auras (sensor extension?) #1508

Open sprunk opened 1 month ago

sprunk commented 1 month ago

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.

Have unit defs for a unit to provide auras. Something like

auras = {
  -- name = { radius = number, strength = integer },
  radar = { radius = 1234, strength = 5 },
  devotion = { radius = 500, strength = 3 },
},

Have a bunch of appropriate callins:

Have callouts: