Game API

From Empyrion: Galactic Survival Wiki
Jump to: navigation, search

Getting Started[edit | edit source]

Requirements[edit | edit source]

What you will need to get started:

There are ways to code with other tools (Ex. Eclipse, Notepad++, etc.), but this is not covered at this time.

Creating Project[edit | edit source]

Empyrion server mods are compiled in .Net 3.5.

In Visual Studio,

  1. Create a new "Class Library" project.
  2. Ensure the Framework on the top is set to .Net 3.5
  3. Name the project and click OK.
  4. In Visual Studio Go go the Reference Manager
  5. Navigate to "Empyrion - Galactic Survival/DedicatedServer\EmpyrionDedicated_Data\Managed" (Usually in C:\Program Files (x86)\Steam\steamapps\common)
  6. Add both the Mif.dll and protobuf-net.dll as references to the project and mark them with "CopyLocal = false" in their property settings

From this point, you have the project base created.

Mod Entry[edit | edit source]

You may need to add the following include so some of the class arguments work.

using Eleon.Modding;

Your first class must inherit ModInterface and should implement all methods of the interface.

   public class MyEmpyrionMod : ModInterface {
       public void Game_Start(ModGameAPI gameAPI) {
       public void Game_Event(CmdId cmdId, ushort seqNr, object data) {
       public void Game_Update() {
       public void Game_Exit() {

Accessing Empyrion from your Mod[edit | edit source]

The Mod API is structured asynchronously. Any request you make via ModGameAPI.Game_Request() will not be returned immediately. Your results will come through the ModInterface.Game_Event() callback. This is something to remember when building your code.

To help keep track of your requests, you can use the "seqNr" parameter on Game_Request. This can help you know which results to look for when they return during the Game_Event callback.

Including your mod to Empyrion[edit | edit source]

In servers, they are to be included in Content/Mods/<yourmodname>/

If your mod is 'DeathMessenger', the folder should be called this, and you should (atleast) have your .dll placed inside, aswell as any additional files you might require (such as a config file, data, or other dependencies)

Note that if you are using a dedicated server host, said host must allow custom .dll's to be uploaded to that folder.

Sharing your mod[edit | edit source]

There is currently no workshop-integration with mods.

The best method of publicly sharing it, is making a post with the post title tag [mod] on the forum: , under 'The Hangar Bay'

(For instance '[mod] DeathMessenger', where you include a download link to a source of your choice (Google drive is an option), or a github link, for all the files pre-compiled, if you so desire. It is recommended to include a good description of the mod, and its functionalities (documentation))

Additionally, you should consider adding your mod to this list!

You may additionally want to include this link, wherever you have published your mod: How to install a mod

Ressources[edit | edit source]

Basic[edit | edit source]

Advanced[edit | edit source]

For all Requests, and Events, refer to CmdId

Game API[edit | edit source]

Interfaces[edit | edit source]

  • ModInterface - Interface Empyrion will use to access your mod.
  • ModGameAPI - Interface for you to send requests and calls to Empyrion.

Classes[edit | edit source]

Eleon.Modding. prefaced

  • Id - Used to pass entity id information.
  • Inventory - Used to represent the player's inventory.
  • ItemStack - Used to represent a single item in a player's inventory.
  • PlayerInfo - Used to represent all data related to a player
  • PlayerInfoSet - Used to set player data (Health, food, oxygen, experience, etc.)

Enums[edit | edit source]

  • CmdId - All request and event commands.

Suggested standards[edit | edit source]

If you have a method, that you think should be a standard, please put it under 'Proposed'. If the majority of modders agree, this should be moved to 'Commonly Used'. If your standard is conflicting with another, please add it under 'conflicting standards'

Please link proposed standards into "Empyrion Mods and Tools" Discord #mod_standards

If you are a modder, please also 'vote' on these standards (by a positive / negative emote-reaction to the post containing a link to said standard), on above discord.

Note: You are not required to follow these standards.

Proposed[edit | edit source]

Conflicting standards[edit | edit source]

Commonly used[edit | edit source]

File-standards[edit | edit source]


Links[edit | edit source]

GitHub for sample mod-project -

Mod list, discussion, help -

Mod list - Game API ModList

EmpyrionMods website -

Discord - Server Community hub - Find a place to test your mod, ask for assistance, discuss etc. -