beyond-all-reason / spring

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

Add the ability to assign multiple aimpoints on a unit #1679

Open drivver44 opened 2 months ago

drivver44 commented 2 months ago

Currently all units can only accept one aimposition (ussually its in line with the midposition of the unit/building)

there are a number of known to me edge cases where the same unit or building will be in a one way engagements while stationary

https://github.com/beyond-all-reason/Beyond-All-Reason/pull/2897

PtaQQ commented 1 month ago

To flesh out this ticket a little bit, what we would like to explore is:

What issue does it solve? Currently engine allows for a single aimposition per unit/feature. That becomes problematic is an array of situations:

drivver44 commented 1 month ago
* when unit model sticks out of the water but it's aimpos is submerged, units will not target it, despite visual cues tell they should be able to

this is already handled by an alldeffs line somewhere here is a picture of a commander whose aimposition is below the water line and is being shot at by a whistler image

the issue that kroyla raised was about catagories not aimpositions

lostsquirrel1 commented 1 month ago

Re: the possibility of enabling encoding multiple aimpositions (aimpos) into units and features s3o

Is the model the correct place for this? Wouldn't the unit def be a better place? I admit I'm not sure what the litmus test is for determining whether a property should be in the unit or the model.

drivver44 commented 1 month ago

Re: the possibility of enabling encoding multiple aimpositions (aimpos) into units and features s3o

Is the model the correct place for this? Wouldn't the unit def be a better place? I admit I'm not sure what the litmus test is for determining whether a property should be in the unit or the model.

aimpositions are adjusted currently as offsets of the midposition the two can and are normally the same spot on a model but that is just current behavoir

doing it via unitdeff make sense if the aimpositions are their own point and not an offset

lostsquirrel1 commented 1 month ago

I guess you would want artillery to aim at the bottom centre of units in preference? I guess you would want regular shots to aim at the mid centre of units in preference? I guess you would want a fall back to top centre of units in case the previous checks fail? I'd guess artillery would check bottom, then mid, then top for example. While regular units would check mid then top. And lasers may need to pick the nearest point first?

sprunk commented 1 month ago

Units can be long but not very tall, for example aircraft or ships. In that case top/bottom extra aimpoints wouldn't help much if the center is obscured, but front/back might. So perhaps it would be best to let the gamedev specify extra points per unit type as appropriate to the mesh rather than hardcoding points. image

Another edge case: when a target is proportionally very large compared to weapon range (e.g. melee, or maybe a building is just really big) the optimal (sometimes the only) place to hit may be not be some salient place like top or middle, but just some random spot that happens to be in range. Extra aimspots don't really help or harm this one but maybe it's good to keep in mind. image

lostsquirrel1 commented 1 month ago

It almost sounds like the engine should call into Lua, and ask for the game to aim check for a weapon and provide helper functions to support the game code.