Improved Communications

From Naevwiki
Jump to: navigation, search

This proposal describes an advanced system of communicating with NPC ships and assets. It can also be applied to planets.


  1. Make NPC ships more interactive
  2. Facilitate future interactions with NPC ships
  3. Integrate the communications screen with missions


This idea is hardly new or innovative. It basically copies the method almost all space sims adopt. When hailing a ship, the player is presented with a screen that shows the person on the other end of the line, a set of dialogue options the player can pick from, and a text box that shows the other party's response.

In the context of Naev, we want the dialogue options to be generated by a script. The script to be used can be a generic faction-specific script, or if no such script is available, a fallback default. It should also be possible to use a callback function in a mission script instead of a dedicated hail script, so that missions and events can define their own hail dialogues without the need of an external script. In addition, a default script should be used when the player attempts to hail while not targeting anything. This can then be used to initiate distress calls, for instance.


For reference, see the mockup at the bottom of this page.

The communication screen has three areas. The first shows a pilot portrait. It is assumed that portraits in Naev will one day be auto-generated, and the pilot's portrait should be generated from the pilot's ship. Overall features such as clothes should depend on the faction while facial features should be randomized based on PRNG.

The second area, to the left of the pilot portrait, is where the player's dialogue options are displayed. The player can click on these dialogue options to send them to the recepient. There must always be a "goodbye" option involved, to allow the player to close the communication. However, this option may not be available, for example when a mission wants to force the player to respond in one way or another.

The third area, at the bottom of the panel, is the conversation log. The player's choices are printed here, as are the replies from the other party. The text color here is based on the pilot's attitude toward the player.

Lua control

For this communication, we need some Lua functions. It seems a good idea to put these functions in a new module. Functions we will probably need:

  • pilot.setcomm()
Sets the specified Lua script (or Lua callback function in the current script) as the pilot's hailing script.
  • planet.setcomm()
Sets the specified Lua script (or Lua callback function in the current script) as the planet's hailing script.
Opens a comm dialog. This would usually be the first function used in most hail scripts, unless the hail script specifies that the target won't answer hails. Also, this can be useful to force players into a dialogue, for example when pirates want to extort the player.
  • comm.setPortrait()
Takes a portrait definition (whatever that may be, to be determined once random portraits are implemented) and creates a portrait accordingly.
  • comm.createChoices()
Takes a table. Each table element is again a table, the first element of which is the text for the dialogue option, and the second is the name of a Lua callback function to call when the player selects that option.
  • comm.close()
Identical to the current player.commClose(). Typically used in the "goodbye" dialog callback function.