Author Topic: Release of Movements-SEXPs, capship useful (v1.1 Dec 1, 2019)  (Read 602 times)

0 Members and 1 Guest are viewing this topic.

Offline wookieejedi

  • 28
  • Intensify Forward Firepower
Release of Movements-SEXPs, capship useful (v1.1 Dec 1, 2019)
Release of Custom-Movements-SEXPs
Custom sexps and functions for FSO that allow for much easier ship movements and rotations.
v1.1 (Dec 1, 2019)




TLDR: Release of custom sexps which can make cap ship (or any ship) movements much easier and more natural looking.

Background
Do you ever get frustrated when trying and get large ship movements to look good? I've found this be especially tricky if you want the ships to act dynamically, if you want big ships to rotate in a way that looks natural, or if you want many big ships to follow a leader ship and stay in a relative formation. Dynamic waypoints provide an invaluable tool, yet ships will stop following a waypoint path once the path is complete or immediately turn around to start the path again. I wanted a single sexp that told a ship to track a waypoint or ship, thus the ship would travel to the waypoint and then move again if the waypoint moved.

It can be similarly tricky to get large ships to rotate to a certain orientation. The rotation maneuver sexp is useful but you aren't guaranteed that the ship will stop rotating when it reaches the desired orientation. Again, I wanted a single sexp that I could use once that would move a ship to a specified orientation with a natural looking movement.

To achieve these goals, I developed a suite of custom lua sexps, and hopefully you might find something useful to your own missions!


Overview
In this release I have included sexps to rotate ships to a specific orientation, have a waypoint track a ship, a ship track a waypoint, and a ship track another ship. Fun things you can do with these sexps is to have entire fleet all rotate to the same orientation, have a battle group of ships follow around a leader command ship, order AI capships to 'attack' an enemy craft by pulling up next to it and rotating 90 degrees to bring broadsides to bear, ordering a ship track a target orientation, and many other things.


Gritty Details
The following custom lua sexps are included:
 
move-to-orientation
Moves a ship to a given orientation over a specified time duration. This sexp only has to be called once and can be used to make a much more natural looking rotational effect for ships. By default this sexp will issue a play-dead-persistent order with priority 200, but this priority value can be changed and the order can also not be issued. Also by default it will use the ship's tabled rotational velocity to make the rotation look natural.

early-stop-move-to-orientation
Immediately terminates the custom `move-to-orientation` sexp for a ship. Only use this sexp to prematurely stop `move-to-orientation` for a ship.

add-waypoint-track-ship
Sets a waypoint to a position relative to a ship continually. This sexp is an easier way to make a dynamic waypoint track a ship location. The waypoint will be moved to the specified coordinates relative to the ship at every time duration. If the ship is not present or destroyed, or departed then the waypoint will not update location.

remove-waypoint-track-ship
Removes a waypoint tracking of a ship. This sexp removes the effect of 'add-waypoint-track-ship'.

add-ai-goal-track-waypoint
Adds a custom ai-goal for a ship to track a waypoint path. The ship will move to the final point in the waypoint path and remain in that position. If the waypoint path is moved the ship will follow the waypoint path again. Useful for having ships follow dynamic waypoints. Note, this order can only be removed via the sexps 'remove-ai-goal-track-waypoint' or 'clear-goals'.

remove-ai-goal-track-waypoint
Removes a custom `add-ai-goal-Track-Waypoint` goal.

set-idle-track-orientation
Sets an idle/resting orientation for a ship tracking a waypoint, either as an absolute orientation or an orientation relative to a given ship. When a ship that is tracking a waypoint is not moving forward it will move to this idle orientation. If a relative orientation is specified the sexp will get the target ship orientation and then add the pitch, bank, and heading values set in this sexp to create a final idle/resting orientation.

unset-idle-track-orientation
Unsets/removes the idle/resting orientation for a ship tracking a waypoint. This sexp will result in a ship tracking a waypoint to not attempt to change it's orientation when not moving.

add-ai-goal-track-ship
Adds a custom ai-goal for a ship to track another ship. The ordered ship will move to follow the target ship and then once stopped will rotate to the target ship orientation, or a variant to that orientation. This is a higher level sexp that runs 'add-Waypoint-Track-Ship' with 'add-ai-goal-Track-Waypoint' and 'set-Idle-Track-Orientation'.

remove-ai-goal-track-ship
Removes a custom ai-goal for a ship to track another ship. This is a higher level sexp that runs 'remove-waypoint-track-ship' with 'remove-ai-goal-track-waypoint' and 'unset-idle-track-orientation'.


Usage:
Download these two files from https://github.com/wookieejedi/Custom-Movements-SEXPs and then place them in your data/tables folder. Then just open FRED and you will see a new listing called LUA-Movements where all the sexps are located. There are detailed descriptions of each sexp and each argument.

Important! You need the most recently nightly build for these to work (Dec 2, 2019).

I included an example mission that shows how to use the 'move-to-orientation' and the 'add-ai-goal-track-ship' which is a higher order sexp that runs 'add-waypoint-track-ship' with 'add-ai-goal-track-waypoint' and 'set-idle-track-orientation'.

Change Log
Code: [Select]
v1.1: Added track orientation behavior. Now ships will also maintain the specified orientation to their specified target, even if the target rotates or moves. Thanks for the suggestion General Battuta!
v1.0: First release.

Finally, I would be happy to answer any questions and hope you can find something that is useful for your own missions!
« Last Edit: December 06, 2019, 03:12:46 pm by wookieejedi »

 

Offline mjn.mixael

  • Cutscene Master
  • 212
  • Anims: 420, Cutscenes: 10, Mainhalls: 7, Logos: 52
    • Steam
    • Twitter
    • Mix-Hai Productions
Re: Release of Movements-SEXPs (v1.0 Nov 30, 2019)
Very cool. I almost certainly have use for some of these.
Cutscene Upgrade Project - Mainhall Remakes - MixaelANITools - Between the Ashes - MjnMixael's Render Boutique - Mix-Hai Productions
Youtube Channel - P3D Model Box - Photobucket Albums - Model Releases - Downloads
Between the Ashes is looking for committed testers, PM me for details.
Report MediaVP issues, now on the MediaVP Mantis! Read all about it Here!

 

Offline wookieejedi

  • 28
  • Intensify Forward Firepower
Re: Release of Movements-SEXPs (v1.0 Nov 30, 2019)
Great! If there is any extra functionality you wanted added that may be useful just let me know.

 
Re: Release of Movements-SEXPs (v1.0 Nov 30, 2019)
Good work! :)

 

Offline General Battuta

  • Poe's Law In Action
  • 214
  • i wonder when my postcount will exceed my iq
Re: Release of Movements-SEXPs (v1.0 Nov 30, 2019)
Great! If there is any extra functionality you wanted added that may be useful just let me know.

My holy grail of movement SEXPs is 'hold relative orientation' (or 'hold relative aspect' or whatever). Tells a ship to position itself in a point, say, 500 meters beneath the target's origin, maintain that point relative to the target no matter how the target maneuvers, and hold its own orientation respect to the target.

Or, in other words: "go to 500 below the target's origin and keep your top facing that origin no matter what."

Probably really hard.

  

Offline wookieejedi

  • 28
  • Intensify Forward Firepower
Re: Release of Movements-SEXPs (v1.0 Nov 30, 2019)
Great! If there is any extra functionality you wanted added that may be useful just let me know.

My holy grail of movement SEXPs is 'hold relative orientation' (or 'hold relative aspect' or whatever). Tells a ship to position itself in a point, say, 500 meters beneath the target's origin, maintain that point relative to the target no matter how the target maneuvers, and hold its own orientation respect to the target.

Or, in other words: "go to 500 below the target's origin and keep your top facing that origin no matter what."

Probably really hard.


Alright, just added that functionality (github also updated). That is now the default behavior for `add-ai-goal-track-ship` and you can also turn that behavior on and off using `set-idle-track-orientation`. So now you can really tell a ship to go to a spot relative to another ship and keep it's nose pointed at it no matter what :)
« Last Edit: December 01, 2019, 06:24:18 pm by wookieejedi »

 

Offline General Battuta

  • Poe's Law In Action
  • 214
  • i wonder when my postcount will exceed my iq
Re: Release of Movements-SEXPs (v1.1 Dec 1, 2019)
Without looking - how do you specify whether you want the mover to aim their nose, top, bottom, or ass at the target? Or is it nose only?

 

Offline wookieejedi

  • 28
  • Intensify Forward Firepower
Re: Release of Movements-SEXPs (v1.1 Dec 1, 2019)
Without looking - how do you specify whether you want the mover to aim their nose, top, bottom, or ass at the target? Or is it nose only?

Good question, the user can specify what direction to aim. The inputs for `add-ai-goal-track-ship` takes, among other things, a pitch, bank, and heading that is relative to the target ship's orientation. So, say you wanted Ship A to pull up beneath Ship B and then rotate so it's butt is facing Ship B. To do that you would set the relative y location in `add-ai-goal-track-ship` to some negative value and then the pitch and heading of 0 and a pitch of 90 degrees (again these are relative to Ship B's orientation). These inputs to the sexp would tell Ship A to go to that position relative to Ship A and then point it's butt up in the air so the butt is facing Ship B.

The full sexp and all it's arguments for that higher order sexp are:
Code: [Select]
$Operator: add-ai-goal-track-ship
$Category: Change
$Subcategory: LUA-Movements
$Minimum Arguments: 3
$Maximum Arguments: 10
$Return Type: Nothing
$Description: Adds a custom ai-goal for a ship to track another ship. The ordered ship will move to follow the target ship and then once stopped will rotate to the target ship orientation, or a variant to that orientation. This is a higher level sexp that runs 'add-waypoint-track-ship' with 'add-ai-goal-track-waypoint' and 'set-idle-track-orientation'. This sexp uses a time interval of 1 second for updating positional data and a track distance of the radius of the ship following the track order. Note, use a waypoint path with only 1 waypoint. The order 'clear-goals' will also stop this custom order. Also the ship will continually maintain the specified orientation when at rest.
$Parameter:
+Description: Ship to order.
+Type: Ship
$Parameter:
+Description: Target ship to track.
+Type: Ship
$Parameter:
+Description: Waypoint path to use for the ship to follow.
+Type: Waypointpath
$Parameter:
+Description: Priority of order. Default is 100.
+Type: Number
$Parameter:
+Description: X offset in meters from the center of the target ship that the ordered ship will move to. Default is random value between the radius and diameter of the target ship.
+Type: Number
$Parameter:
+Description: Y offset in meters from the center of the target ship that the ordered ship will move to. Default is random value between the radius and diameter of the target ship.
+Type: Number
$Parameter:
+Description: Z offset in meters from the center of the target ship that the ordered ship will move to. Default is random value between the radius and diameter of the target ship.
+Type: Number
$Parameter:
+Description: Pitch of idle orientation in degrees relative to target ship orientation. Default is 0 (same pitch as target). Any value is valid and will be converted to range within 0-359.
+Type: Number
$Parameter:
+Description: Pitch of idle orientation in degrees relative to target ship orientation. Default is 0 (same bank as target). Any value is valid and will be converted to range within 0-359.
+Type: Number
$Parameter:
+Description: Pitch of idle orientation in degrees relative to target ship orientation. Default is 0 (same heading as target). Any value is valid and will be converted to range within 0-359.
+Type: Number

 

Offline General Battuta

  • Poe's Law In Action
  • 214
  • i wonder when my postcount will exceed my iq
Re: Release of Movements-SEXPs (v1.1 Dec 1, 2019)
Fantastique! This will be amazing for capship choreography, especially in capship command missions.

 

Offline wookieejedi

  • 28
  • Intensify Forward Firepower
Re: Release of Movements-SEXPs, capship useful (v1.1 Dec 1, 2019)
Thanks, glad it will be helpful. If you or anyone else comes across anything that you’d like added just let me know and I can see what I can do!

 

Offline 0rph3u5

  • 211
  • Someone should label the Future: Assembly Required
    • Steam
    • Twitter
Re: Release of Movements-SEXPs, capship useful (v1.1 Dec 1, 2019)
I am certainly going to get some use out of these for Pendragon - even though my stated goal is to get rid of capital ships more and more...
"When you work with water, you have to know and respect it. When you labour to subdue it, you have to understand that one day it may rise up and turn all your labours into nothing. For what is water, which seeks to make all things level, which has no taste or colour of its own, but a liquid form of Nothing?" - Graham Swift, Waterland

"As you sought to steal a kingdom for yourself, so must you do again, a thousand times over. For a theft, a true theft, must be practiced to be earned." - The terms of Nyrissa's curse, Pathfinder: Kingmaker

"...because they are not Dragons."