Jump to content



Recommended Posts

Hello, Noveans! Athena’s Lua changes bring many community-requested features into the game, and there is a lot to go over, so let's dive right in!




We’re revising the resolution of opaque and transparent screens to 1024x513 pixels in order to better fit them into the real screen element dimensions and improve image resolution on screens.


Also, each sign will now have a resolution adapted to its actual size:

  • Horizontal Sign XS : 1024x512

  • Horizontal Sign S : 1024x1024

  • Horizontal Sign M : 1024x512

  • Horizontal Sign L : 1024x256

  • Vertical Sign XS : 512x1024

  • Vertical Sign M : 512x1024

  • Vertical Sign L : 256x1024


These changes are also accompanied by new features and substantive changes.




With this update, we’re making a fundamental change in text rendering technology. Called, ‘Signed Distance Field,’ (SDF), this rendering method allows for cleaner rendering at any font size and also supports effects such as outlines and shadows.


As a result, here are some text-related changes in the Rendering Lua API:

  • [int] loadFont([string] fontName,[int] defaultSize) - The font size setting becomes the "default" font size and can be changed during script execution with the setFontSize function.

  • addText([int] layer,[int] font,[string] text,[float] x,[float] y) - Now supports the following properties : fillColor, shadow, strokeColor, strokeWidth.


And some additions:

  • [float] getFontSize([int] font): Return the currently-set size for the given font.

  • setFontSize([int] font,[int] size): Set the size at which a font will render.

  • setDefaultTextAlign([int] layer,[int] alignH,[int] alignV): Set the default text alignment of all subsequent text strings on the given layer.


But that's not all! As you may have seen from the image below, we have also added support for High Dynamic Range (HDR) colors which will let you add a glow effect on your colors.


To use the HDR colors, you just have to set color values higher than 1 in the colors you use; commonly multiply each color component by the same HDR coefficient.


As an example, here is the ‘PEGGED,’ screen from Bonusaben’s Underdun Arcade modified with HDR colors:





One of the most common requests for screen rendering has been the ability to apply transformations (translation, rotation and scaling) to text. Given that this is not strategically optimal for rendering, we’ve decided to apply transformations to layers instead with the following functions:

  • setLayerOrigin([int] layer,[float] x,[float] y): Set the transform origin of a layer; layer scaling and rotation are applied relative to this origin.

  • setLayerRotation([int] layer,[float] rotation): Set a rotation applied to the layer as a whole, relative to the layer's transform origin.

  • setLayerScale([int] layer,[float] sx,[float] sy): Set a scale factor applied to the layer as a whole, relative to the layer's transform origin.

  • setLayerTranslation([int] layer,[float] tx,[float] ty): Set a translation applied to the layer as a whole.


We’ve also added a clipping area! This allows you to define an area to limit rendering per zone, especially useful for making scrolling areas and so on.

  • setLayerClipRect([int] layer,[float] x,[float] y,[float] sx,[float] sy): Set a clipping rectangle applied to the layer as a whole.


Please note that anything drawn outside of the clipping area will not be visible but will still be counted in the rendering budget.




As already announced in Athena roadmap, we’ve decided to add a Lua API allowing players to take accurate information from Mining Units with the following functions:

  • [string] getStatus() : Returns the current status of the mining unit ("STOPPED", "STALLED", "RUNNING")

  • [float] getRemainingTime() : Returns the time remaining on the drilling process.

  • [int] getActiveOre() : Returns the ID of the current selected resource.

  • [table] getOrePools() : Returns the list of resources pool on the territory. Each resource pool object of the list contains ‘id’, ‘available’ and ‘maximum’ fields.

  • [float] getBaseRate() : Returns the base production rate of the mining unit.

  • [float] getEfficiency() : Returns the production efficiency of the mining unit.

  • [float] getAdjacencyBonus() : Returns the territory's production adjacency bonus factor. This value will only be updated when a new batch is started.

  • [float] getCalibrationRate() : Returns the current calibration rate of the mining unit.

  • [float] getOptimalRate() : Returns the optimal calibration rate of the mining unit.

  • [float] getProductionRate() : Returns the production rate of the mining unit.

  • [vec3] getLastExtractionPosition() : Returns the position of the extracted ore during the last calibration in world coordinates.

  • [int] getLastExtractingPlayerId() : Returns the ID of the last player who calibrated the mining unit.

  • [float] getLastExtractionTime() : Returns the time in seconds since the last calibration of the mining unit.

  • [float] getLastExtractedVolume() : Returns the amount of ore extracted during the last calibration.

  • [int] getLastExtractedOre() : Returns the ID of the extracted ore during the last calibration.


And with some events:

  • [event] statusChanged([string] status) : Emitted when the mining unit status is changed. Provide the new status.

  • [event] completed([int] oreId, [float] amount) : Emitted when the mining unit completes a batch. Provide the item ID of the mined ore and the amount mined in the batch.

  • [event] calibrated([int] oreId, [float] amount, [float] rate) : Emitted when the mining unit is calibrated. Provide the item ID of the extracted ore, the amount extracted and the new calibration rate.




We have chosen to integrate the notion of item-IDs in a more concrete way. This is the first API using this principle, which seems to us the most adapted. Some functions and events will provide you with an ID designating an item in the game.


We will then integrate the getItem function:

  • [table] getItem([int] id): Return the item table corresponding to the given item ID.


The returned table will then contain the following information:

  • [int] id : The ID of the item.

  • [string] name : The name used to define the item.

  • [string] displayName : The name of the item used in the game.

  • [string] locDisplayName : The name of the item used in the game in the language of your game.

  • [string] displayNameWithSize : The name of the item used in the game with the size (XS,S,M,L).

  • [string] locDisplayNameWithSize : The name of the item used in the game with the size (XS,S,M,L) in the language of your game.

  • [string] description : The description of the item in English.

  • [string] locDescription : The description of the item in the language of your game.

  • [string] type : The type of item.

  • [float] unitMass : The unit mass of the item.

  • [float] unitVolume : The unit volume of the item.

  • [int] tier : The tier of the item (1 to 5)

  • [string] size : The size of the item (xs, s, m, l)

  • [string] iconPath : The path of the item's icon in the game files (usable on the screens).




We’ve also decided to include several smaller features with this update:


The function allowing you to draw a quadratic Bézier curve:

  • addBezier([int] layer,[float] x1,[float] y1,[float] x2,[float] y2,[float] x3,[float] y3): Add a quadratic Bézier curve to the given layer. Supported properties: shadow, strokeColor, strokeWidth.


Additional functionality for images:

  • addImageSub([int] layer,[int] image,[float] x,[float] y,[float] sx,[float] sy,[float] subX,[float] subY,[float] subSx,[float] subSy): Add a sub-region of an image to the given layer. Supported properties: fillColor, rotation.

  • [float],[float] getImageSize([int] image): Return the width and height of an image.


Finally, a function that lets you know the language setting of the rendering client:

  • [string] getLocale(): Return the locale in which the game is currently running (“en-EN”, “fr-FR”, “de-DE”).




Our goal is always to provide a larger and more feature-rich panel while maintaining rendering performance, and we hope that you will enjoy these Lua additions coming in Athena.


As always, we appreciate your feedback, so please share your thoughts and let us know your ideas on what Rendering Lua-related improvements and/or additions you would like to see in Dual Universe. Also, our API approach seems to be suitable and could potentially be applied to other API’s in-game, but we’d love to hear your feedback on that first.


NQ-Ligo is looking forward to discussing them with you in this forum thread!

Link to comment
Share on other sites

This topic is now closed to further replies.
  • Create New...