ZERSTORENGAMES

OCEAN AND BOATS SIMULATOR / GUIDE 5 OF 5

Blueprint API

The reference: the ocean, the boat, the helm and its orders, wind, sound and boat definitions, by class.

On this page

The main classes and the functions you call from Blueprint or C++. Every class and function shows its tooltip in the editor. This page groups them by task.

NA Ocean (ANAOcean)

The sea. Place one per level.

FunctionWhat it does
Get Wave Height (World Location)The surface's height above still water at a point, in cm, the boats' own waves included. It is exactly what the physics uses.
Apply Sea StateRebuilds the waves after you change Preset, Beaufort, Zone, Wave Direction Deg or Sea State from Blueprint. Boats and the surface follow at once.
Trigger Rogue Wave (World Location, Seconds From Now, Crest Height)A focused wave group whose crest rises Crest Height (m; 0 for 1.6 times the significant height) at a point, so many seconds from now.
Rogue Wave On First ShipA rogue wave onto the bow of the first boat in the level, timed by her speed.
Set Surface Detail (Cells)The surface mesh's resolution, 16 to 1024 cells a side. Use it as a graphics quality setting.
Set Detail Focus (World Location)Where the sea keeps its full detail this frame instead of the camera, for example a boat seen through a scope.
Get Detail FocusWhere the full detail is now.
Get Camera DepthHow deep the camera is under the surface, in m (negative above it). Use it for your own underwater effects.
Get Surface Material InstanceThe sea surface's dynamic material instance: set its colour, clarity and foam parameters at run time with Set Vector Parameter Value / Set Scalar Parameter Value (Customizing.md, "Colour, clarity and foam"). None until the surface material has loaded. The pause menu's Water sliders write to it too, once one is moved (Customizing.md, "The water look sliders").

Main properties: Preset (Beaufort, Zone, a wave form or Custom), Beaufort (0-12), Zone, Wave Direction Deg, Sea State (Custom), Rogue Waves, Sea Follows Wind, Surface Material, Surface Extent (the detailed area's half size in m; 2000 by default), Horizon Extent (the flat outer ring's half size in m; 40000 by default). The sea level is world Z = 0.

NA Boat (ANABoat)

A boat of any mesh, built from its boat definition.

FunctionWhat it does
Set Boat Definition (Definition)Makes her that definition's boat, in its first configuration, and builds her; while playing, her physics and sounds start again for her. Use it after spawning an NA Boat at run time.
Rebuild BoatBuilds her again from her definition: meshes, parts, options, numbers.
Set Configuration (Configuration)Sets her up as one of her named configurations. Returns false and a reason if she has no such configuration.
Is Configuration ModifiedWhether her options differ from her configuration's.
Set Variant (Group, Variant, Fix)Picks one variant of an option group (Off removes the group's part). With Fix, a variant it needs is picked with it, and variants that no longer fit give way.
Get Shown VariantsWhat each option group shows now.
Add Part (Part)Adds a part (a mesh at a socket, or a light, an exhaust, a camera point...).
Remove Part (Part)Removes a part and the parts riding on it.
Replace Part (Part, Mesh, Mass)Swaps a part's mesh, and its mass if given.
Move Part (Part, Socket, Transform)Moves a part to a socket and an offset from it.
Undo Part Edit / Can Undo Part EditTakes the last part change back.
Get Exhaust Outlet LocationsHer exhaust outlets shown now, in her frame (cm, relative to the boat actor, that is to its Boat Root): where to put smoke of your own. Attach to Boat Root, not to Boat Model.
Get Class For (Definition)The class a boat of that definition is spawned as: its Boat Class (a Blueprint child of NA Boat), else NA Boat.

Part and option changes update her mass and centre of gravity, so her trim and stability follow.

NA Boat is Blueprintable: a Blueprint child of it can carry components of your own (smoke, a flag, a light). Set its Boat Mesh Set to the definition and compile it: the definition takes the Blueprint as its Boat Class (category Boat) by itself when that is empty, and the sea trials spawn her as that class. Components given Component Tags make her options and versions (see "Boat definitions" below). See HowTo.md, guides 5 and 6.

NA Ship Motion (UNAShipMotionComponent)

The physics and the helm of a boat. Every NA Boat has one.

Helm

The helm functions work the boat's helm, and the helm sets her orders only while the component's Helm is on (category Motion > Helm). The sea trials pawn turns it on for the boat it drives (Take Helm, below, does too, and Leave Helm turns it off). For any other boat, turn it on before you use these functions, or leave it off and set her Throttle and Rudder Angle directly.

FunctionWhat it does
Helm Levers (Lever, Direction, Delta Time)Pushes a throttle lever (-1 for all) ahead or astern for a time, as a held key does. A lever brought back to neutral stays there until Helm Levers Let Go. Ships of 30 m and more without pods are driven by the telegraph instead: use Helm Telegraph on them.
Helm Levers Let Go (Lever)The lever's control is released; it rests where it is (in neutral when it was there).
Helm Telegraph (Steps)Moves the engine telegraph so many orders ahead (positive) or astern.
Helm Wheel (Direction, Delta Time)Turns the wheel to starboard (positive) or port, for a time.
Helm Set Wheel (Position)Sets the wheel: -1 hard to port, 1 hard to starboard.
Helm MidshipsWheel amidships.
Helm All StopLevers to neutral, telegraph to stop, thrusters off.
Helm Thrusters (Bow, Stern)The thrusters' joysticks, -1 to 1 (positive pushes that end to starboard).
Helm AutopilotAutopilot on (holding the present heading) or off.
Helm Autopilot Adjust (Degrees)Changes the autopilot's heading.
Hold HeadingAutopilot on, holding the present heading.
Helm Self Centring (On)With the sea trials pawn: the wheel centres itself when its keys let go of it (for gamepads and beginners).
Helm Tabs (Down, Starboard Up, Delta Time)Works the trim tabs: bow down or up, one side up.

Direct orders (AI and scripts)

FunctionWhat it does
Set Propulsor Order (Propulsor, Revolutions, Angle)Gives one propulsor its own order, off the common levers: revolutions -1 to 1, and its rudder, pod or outboard angle.
Release PropulsorsEvery propulsor back on the common levers.
Get Propulsor Count / Get Propulsor (Index)Each propulsor's kind, revolutions, angle and thrust.
Start Underway (Knots)Puts her under way at once at a speed, with the engines already at that speed's order. Use it to start a scene at sea.
Reset On OceanBack on the sea at her draught, upright and at rest, keeping her place and heading.
ReinitializeSets her physics up again for her boat as it is now: call it after changing her parts or options at sea. False while she cannot float (no NA Ocean, no hull to float).

State and fuel

FunctionWhat it does
Set Fuel (Share) / Get Fuel ShareTanks filled to a share of their capacity. Her weight follows, and dry tanks stop the engines.
Is AirborneShe is clear of the water (a planing boat off a crest).
Get Spray At (World Location, Radius)How thick her spray is around a point, 0 to 1. Use it to wet a camera lens or a windscreen.
Get Engine CountHow many engines she has (port first).
Get Engine Load (Engine)That engine's load, 0 to 1 (0 for an engine she has not). Use it to drive smoke or an effect of your own.
Get Engine Rpm (Engine)That engine's revolutions per minute (0 for an engine she has not, or stopped).

Speed, heading, heel, trim, revolutions and loads are readable properties of the component (Speed Knots, Heel, Trim, Engine Revolutions, Throttle, Last Strike...). The helm display reads the same values.

Taking the helm (ANASeaTrialsPawn)

For a game with a character of its own. These are Blueprint nodes of NA Sea Trials Pawn, category Helm. All but Set Ship are static. HowTo.md, guide 13, has an example.

FunctionWhat it does
Take Helm (Player, Boat, Helm Screen = true)Spawns and possesses the plugin's helm pawn for that boat, with its cameras and keys and, with Helm Screen on, its HUD and helm display in place of yours. Your character stays aboard where it stands, attached to the boat. Returns the helm pawn (none without a player or a boat). If the player is already at a helm, that pawn moves over to Boat.
Leave Helm (Player, All Stop = true)Gives the character back, upright and detached from the boat, and puts your HUD back. With All Stop on, her engines stop and her rudder goes amidships first. Returns the character; none when the player is not at a helm taken with Take Helm.
Get Helm Boat (Player)The boat the player is at the helm of through the plugin's helm pawn, or none.
Find Nearest Boat (World Context, Location, Max Distance = 2000)The NA Boat nearest Location within Max Distance (cm, measured from her hull), or none: the boat to board.
Set Ship (Boat)A member function of the helm pawn. The camera and the helm work from that boat from now on; none: the level's first boat.

Walking on a moving deck needs the hull to have collision.

To drive a boat from your own interface, switch Show Helm Display off (Project Settings > Plugins > Ocean and Boats Simulator > Interface), or call Take Helm with Helm Screen off. Then call the helm functions of her NA Ship Motion component (the table in "Helm" above), with its Helm on.

Events

These are the plugin's Blueprint events (bind them with Bind Event to ... or Assign ...):

EventOnWhen
On Spray Impact (Location, Impact Speed)NA Ship MotionA hard blow of her hull into the water: a slam, a sea breaking on her bow. Location is in the world (cm), Impact Speed in m/s. It is raised for blows of Spray Impact Event m/s or harder (4 by default), at most every half second.
On Boat RebuiltNA BoatHer meshes and parts have been built again: after a definition, configuration or option change. No parameters. Re-place anything of your own that follows her parts.
On Design ChangedShipyard sessionAfter every change of the design in the shipyard, and after undo and redo.
On Change Rejected (Reason)Shipyard sessionA change was refused; the design stays as it was. Reason is a text for the player.

The shipyard session is the NA Shipyard Subsystem's (a game instance subsystem): Get Session.

There are no other events. To react to anything else, read the motion component's properties on Tick: Heel for a capsize, Last Strike (m/s, 0 when clear) for a grounding or a collision, Is Airborne, Speed Knots.

Wind

The NA Wind world subsystem (UNAWindSubsystem; Get World Subsystem > NA Wind Subsystem) answers the wind at any point, whatever the source: an override, your wind sources, Ultra Dynamic Weather, or the ocean's own wind.

FunctionWhat it does
Get Wind (World Location)The wind velocity there (m/s), gusts included.
Get Mean Wind (World Location)The same without gusts.
Get Wind Beaufort (World Location)The wind's Beaufort force there.
Set Wind Override (Velocity) / Set Wind Override Beaufort (Beaufort, Toward Deg)One wind everywhere, over every source.
Clear Wind OverrideBack to the sources.
Register Wind Source / Unregister Wind Source (Source)Adds or removes an object implementing NA Wind Source (level actors are found at play).
  • The NA Wind Source interface: Get Wind At (World Location) and Get Wind Priority. Implement it on any actor or component; the highest priority that answers wins.
  • The NA Wind Source component is a ready-made one: a constant wind (speed or Beaufort force, direction) inside an optional radius.

Sound (UNASoundLibrary)

Every sound plays a row of the sound table (Customizing.md, Sounds). Category Ocean and Boats > Sound:

FunctionWhat it does
Play Sound 2D Row (Row, Volume Scale)Plays a row once, unattenuated. Advanced: Strength 0 to 1 picks the point in its volume and pitch ranges (negative: at random).
Play Sound at Location Row (Row, Location, Volume Scale)Plays a row once at a point, with its attenuation.
Spawn Sound Attached Row (Row, Attach To, Relative Location, Volume Scale)Starts a row attached to a component and returns its audio component (keep it for a loop).
Spawn Sound 2D Row (Row, Volume Scale)Starts a row unattenuated and returns its audio component. Advanced: Fade In Seconds.
Set Row Input (Audio, Row, Input, Volume Scale)Sets a playing component to the row's volume and pitch at an input from 0 to 1.
Find Sound Row (Row)The row's data; false when the table has no such row.
Load Row Sound (Row)The row's sound, loaded.
Play UI Sound (Row, Volume Scale)An interface sound (UI_Click, UI_Hover...).
Get Sound Table / Reset Sound CacheThe table in use; forget the loaded sounds (after changing the setting at runtime).

On a boat's Sound component: Sound Horn, Restart (her loops again for her boat as it is now), and the properties Engine Row Prefix, Horn Row, Rain Rate and Volume.

Maps (editor only)

Two actors set a map up for the scenario screen (HowTo.md, guide 12). Neither is in a packaged game.

ActorWhat it does
NA Map Setup (ANAMapSetup)Holds the place's words and sea, and a box over the water to chart. Its Make Place button (category Chart) charts the ground and the sea floor under the box, saves the depth asset DA_<Map>_Depth next to the map, and writes or updates the map's row in the places table. Result says what it did.
NA Start Spot (ANAStartMarker)A spot where boats may start: its position, its rotation as the heading, and Spot Name, Kind, Description and Order. Make Place writes every one in the map into the row's Spots.

Boat definitions (data)

A boat definition (NA Boat Definition, UNABoatMeshSet) is a data asset. The boat picker and Set Boat Definition take it. Its interface fields (display name, description, card image, category, stats) are read by the picker. Its configurations, options and upgrades are the lists the picker shows. See Customizing.md.

Options and versions can come from a Blueprint child of NA Boat instead of tables (HowTo.md, guide 5). In the definition, category Boat:

Property or functionWhat it does
Boat ClassThe class she is spawned as (see Get Class For). Compiling a Blueprint whose Boat Mesh Set is this definition sets it, when it is empty.
VersionsThe versions she is sold in, in order. The first is the boat as built. Empty: every plain tag on the Blueprint's components is a version, from the one with the fewest options fitted to the one with the most. Filled in: only these words count.
Read Blueprint OptionsReads the Blueprint's tagged components into her option groups, the picker's rows and her versions, replacing what the last reading made. A compile, a change of Boat Class or a change of Versions does it by itself. Returns whether anything changed.
Blueprint Groups, Blueprint VersionsRead only: the option groups and the versions (after the first) the last reading made. Your own rows stay.

The Component Tags of a component in the Blueprint (Details > Tags): a plain word names a version the piece is fitted in (Standard, Pro, Max); Option=Crane the option it belongs to (else the component's name is the option); Variant=Large its variant of that option (one shown at a time); Mass=350 its mass in kg; Icon=... a configurator icon key; Exhaust on a Niagara component makes an exhaust, shown while the engines run, with its float parameters EngineLoad (0 to 1), EngineRpm and BoatSpeed (m/s) set every frame. A piece the picker hides has no collision either.

C++

  • Every class above lives in the NavalArchitect runtime module. Add "NavalArchitect" to your module's dependencies.
  • The wave field (FNAWaveField) gives HeightAt, NormalAt and VelocityAt at any point and time, the same maths as the GPU. Use it for your own floating objects, cameras or AI.
  • The hull dynamics (FNAHullDynamics) is a plain C++ class that runs without the engine's world. It is useful for tests and offline tools.
  • The water look of the pause menu's sliders is FNASeaLook (Public/Ocean/NASeaLook.h): FNASeaLook::Get() is the game's look (colour, clarity, foam), Set changes it and puts it on a surface material instance, ApplyTo puts it on one, and IsTouched says whether a slider was moved. Nothing is put on the material until then.
  • The tags of a Blueprint boat are read by FNABlueprintOption (Public/Boat/NABlueprintOptions.h).

Cookie preferences

Choose whether to allow YouTube videos. You can change your mind at any time using Cookie settings at the bottom of every page.

Cookie policy · Privacy policy