fs2open.github.com icon indicating copy to clipboard operation
fs2open.github.com copied to clipboard

FR: FRED - lock object's position/heading flags

Open MitoPL opened this issue 3 years ago • 8 comments

In FRED, there is a "Does not move" checkbox in Ship editor, Misc category. In the past this did not prevent ships from turning, just from moving from their coordinates. It seems like this characteristic was used by some FREDers to create ships that would turn to engage enemies but not move from their position, in tandem with ai-chase and unlocked turrets.

One such example is in Aftermath Reboot, mission Act6-g, "Keeping our gains". There are two cruisers acting as artillery, with the player being able to order them to attack currently targeted capital ship with keypresses, and the mission just runs a clear-goals and then add-goal "ai-chase" to make said ships turn to a designated target while still not moving from their position. It's a surprisingly simple solution, and during my attempts at fixing said mission to work properly with modern builds, I learned that there isn't really an easy and supported way to do that - beyond custom ship movement SEXPs or dynamically calculating set-object-facing transition times for the proccess to look believeable.

My suggestion would be to introduce two flags in place of the current one - let's call them "Lock position" and "Lock heading" - the first one alone would be a quick and easy fix for the situation I faced, using the two in tandem could easily replace the current "Does not move" flag, and I think using the latter only, beyond some cosmetic uses, could possibly simplify building simple convoys - single waypoint for the entire convoy, order all vessels to follow a waypoint and then lock the heading for all of them. Although I'm not particularily sure how the AI would behave when nearing said waypoint.

MitoPL avatar May 21 '22 18:05 MitoPL

I'll leave the discussion of utility for lock-position and lock-orientation flags for others for now.

Just some quick notes: Although I'm not particularly sure how the AI would behave when nearing said waypoint. AI wants to have it's center point pass through the waypoint, so they will all converge on it and not stay in a nice formation.

and then add-goal "ai-chase" to make said ships turn to a designated target while still not moving from their position. Making it so the ship cannot move forward but could rotate can easily be done by setting the velocity of the ship objects physics to 0 via scripting. (I can show you how to do this in FRED with a line of code, or even just make you a custom sexp).

wookieejedi avatar May 21 '22 18:05 wookieejedi

Thanks for the insight. So quick explanation:

I'm suggesting that said convoy ships could not change their orientation in said use case, and just fly forward, parallel to each other. I'm more worried about what would happen if the AI was getting rather close to the waypoint in question - with the waypoint being, for example, on a 45deg angle from a ship's heading. Would the ship just trudge on at same speed, or would it slow down in because of its forward speed component lowering, as if it attempted to turn? What if said ship overshot a waypoint for some reason, would it just stop moving forward? (I would assume the FREDer in this case would use a departure cue of x distance from object, but let's assume an oversight somewhere).

While I appreciate the suggestion and your offer, I think it rather misses the point of this request. I am aware the same behaviour is possible to achieve with a plethora of methods - custom SEXPs, scripting, repeated set-object-position, I even tried forcing the ships to glide at 0 speed (which would have worked, but then I would have to enable glide for that ship class in tables, and I wasn't sure if that wouldn't cause said vessels to use glide by default). But none of these methods are as simple and accessible to the end user as just having a checkbox and a SEXP that lets them turn an object into a stationary sentry or revert it back to normality at a whim. Not to mention that the other methods don't really broadcast such a possibility to the user, cause unnecessary clutter in the event editor or are outright troublesome to use (I can already imagine attempting to make a redeployable stationary sentry with the use of set-object-position. Ugh.)

MitoPL avatar May 21 '22 19:05 MitoPL

That's a good question, and I would have to refer to someone who knows the AI code better, perhaps @Baezon? :)

Thanks, I definitely understand the sentiment regarding native support in FRED and certainly see the utility.

wookieejedi avatar May 21 '22 19:05 wookieejedi

Bonus points for anyone who can make it possible for FSO to interpret the old "Does not move" flag as the new "Lock position" flag, for ease of moving missions to modern FSO builds.

MitoPL avatar May 21 '22 19:05 MitoPL

Overall, I do think these would be useful flags.

wookieejedi avatar May 21 '22 19:05 wookieejedi

For what it's worth, these flags should be as simple as possible. I don't think any extra code or behaviors should account for these flags at all. Theyshould merely do exactly what they say on the tin (no movement/no rotation), and if that screws over the AI, then so be it. Modders function best when they are given simple modular tools to work with, and the less we introduce new behaviors to try to 'make things work' despite these flags the better.

Baezon avatar May 21 '22 19:05 Baezon

Agreed

JohnAFernandez avatar Jan 05 '23 16:01 JohnAFernandez

I'm putting this on 24.2 as this is a feature that would resolve a change in behavior.

JohnAFernandez avatar Jan 29 '24 03:01 JohnAFernandez