beyond-all-reason / beyond-all-reason/RecoilEngine
Feature: Masks/categories for allowing inbuilt ally-helping behaviour
- Dominant language
- C++
- Stars
- 679
- Forks
- 290
- Avg merge
- 3d 2h
- Merged PRs (30d)
- 40
Description
MaDDoX wants to make a constructor that has the following abilities:
- Can assist the construction of structures.
- Can repair anything.
This is difficult to do at the moment since commands like Patrol, Area Repair, Fight and Guard give constructors a bunch of inbuilt behaviors that lua is ill-suited to overriding. Eg, if a constructor is on Fight and gives itself a Repair command to a nearby unit, lua can detect and remove the command, but it can't cleanly make the unit stop reissuing the command (and even finding and removing commands is pretty ugly).
I suggest solving this with some sort of mask or category system for automatically giving and receiving help from allies. One implementation could work like the weapondefs ShieldInterceptType and InterceptedByShieldType. Units would have a helpiee mask and a helper mask. If the helpiee mask and helper masks don't align, then the helper ignores the helpiee for all sorts of engine-internal helping checks (ie the helper generating a Repair command). Lua would be able to set these masks dynamically. Then MaDDoX would write the following gadgetry.
- Give newly created unit nanoframes a helpiee mask that distinguishes them from structures or complete units.
- Give the special no-assist constructor a helper mask that doesn't overlap with the unit nanoframe mask.
- Give units the default mask on UnitFinished, so the no-assist constructors knows to repair them.
There is potential to add two types of mask, one that is used for automatically generating commands (unit AI), and another which is used for outright blocking the ability to Repair certain targets (behaviour). This would be akin to how BadTargetCategory and OnlyTargetCategory let units be configured to shoot at particular enemies without automatically acquiring them as command targets when idle or on orders like Fight.
Of course, maybe masks are wrong and it should be done with a list of categories. That's an implementation detail.
Contributor guide
Research direction
The issue names no files or tests; start by tracing the engine's internal Repair, Fight, Guard, Patrol, and Area Repair assistance checks, then compare the existing ShieldInterceptType and BadTargetCategory mechanisms. Define the mask or category behavior for helpers and helpies, including dynamic Lua updates and the distinction between automatic commands and blocked repairs; done means constructors can selectively assist nanoframes, structures, and completed units.
Written by the indexing model from the issue text.
Assessment
- Tech stack
- cpp, lua
- Domain
- game-dev
- Issue type
- Feature
- Difficulty
- 5/5
- Estimated time
- Over a week
- Activity status
- Stale
- Clarity
- Needs clarification
- Newbie friendliness
- 25/100