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

No reasonable way to set units' engagement range when they have multiple weapons with different ranges

Open
#776 2 comments 0 reactions 0 assignees View on GitHub
status: needs-testing
Dominant language
C++
Stars
679
Forks
290
Avg merge
3d 2h
Merged PRs (30d)
40

Description

Units with multiple weapons with different ranges will move until they get close enough to fire their longest range weapon.

Gunships with forward facing weapons will apparently move closer to within LOS range if it's lower than their longest ranged weapon.

Apparently this happens regardless of move state.

Setting the longest ranged weapon with commandFire=1 apparently made a multi-weapon gunship ignore it and close in, but i couldn't reproduce with a ground unit.

Possible solutions:
1- Spring.SetUnitWeaponState table allowing a "desiredRange" besides the "range" which sets the weapon range (*)
2- A unitdef indicating which weapon number the unit should check for the "close enough" range threshold (*)
3- A boolean unitdef indicating whether the unit should try to get close enough to fire the shortest range weapon in the target's direction or not (defaulting to false to mimic the current behavior)

(*) solutions 1 and 2 may have problems dealing with multiple weapons with/without cylinderTargetting and different heightMod and heightBoostFactor, as the weapon with the biggest range in the target's direction may change dynamically (ex: gunship with laser and rockets trying to shoot at ground while flying over tall hills)

-------------------- how to reproduce

recoil engine build 1544, Metal Factions v2.12, any flat land map.

/give aven_kodiak (has 500 range cannon and 660 range missiles)
/give target 1 (a building for the enemy, spawn it like 1000 range away from the kodiak)
/globallos

order the kodiak to attack or fight the target and check if it moves close enough to use the cannon.

Contributor guide

Open the contributing guide

Research direction

Reproduce on Recoil Engine build 1544 with Metal Factions v2.12 on a flat map using /give aven_kodiak, /give target 1, and /globallos. Start by tracing the attack or fight movement decision that chooses the engagement range for the Kodiak's 500-range cannon and 660-range missiles; done means a multi-weapon unit uses an appropriate range without unwanted movement.

Written by the indexing model from the issue text.

Assessment

Tech stack
cpp
Domain
game-dev
Issue type
Bug
Difficulty
5/5
Estimated time
Over a week
Activity status
Stale
Clarity
Mostly clear
Newbie friendliness
35/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.