Empyrion: Galactic Survival Wiki
m (→‎Links: Updated)
Tag: Visual edit
Tag: Visual edit
Line 122: Line 122:
   
 
==Links==
 
==Links==
GitHub - https://github.com/lostinplace/sample-empyrion-mod
+
GitHub for sample mod-project - https://github.com/lostinplace/sample-empyrion-mod
   
 
Mod list, discussion, help - https://empyriononline.com/forums/empyrion-api.39/
 
Mod list, discussion, help - https://empyriononline.com/forums/empyrion-api.39/

Revision as of 20:51, 31 January 2019

Getting Started

Requirements

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

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/Empyrion_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.

From this point, you have the project base created.

Mod Entry

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

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

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

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: https://empyriononline.com/forums/the-hangar-bay.29/ , 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

Basic

Advanced

For all Requests, and Events, refer to CmdId

Game API

Interfaces

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

Classes

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

  • CmdId - All request and event commands.

Suggested standards

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

Conflicting standards

Commonly used

File-standards

List

Links

GitHub for sample mod-project - https://github.com/lostinplace/sample-empyrion-mod

Mod list, discussion, help - https://empyriononline.com/forums/empyrion-api.39/

Mod list - Game API ModList

Discord - Server Community hub - Find a place to test your mod, ask for assistance, discuss etc. - https://discord.gg/sd3Vc7S