API FAQ

Discussion in 'Empyrion API' started by Xango2000, Apr 27, 2017.

  1. Xango2000

    Xango2000 Captain

    Joined:
    Jun 15, 2016
    Messages:
    385
    Likes Received:
    202
    I'm rather new to programming, I have a few questions:

    Q: How do I use an API?
    A:

    Q: Do I need to import the DLL into an executable to be able to use it?
    A:

    Q: Can I access it remotely?
    A: not unless you/someone else programs it that way

    Q: Is somone working on a way to access the data the API can provide that is as easy as telnet?
    A:

    Q: Are there any useful links on how game APIs work?
    A:
     
    #1
  2. joemorin73

    joemorin73 Captain

    Joined:
    Aug 24, 2016
    Messages:
    319
    Likes Received:
    170
    Q: How do I use an API?
    A: It is best to make a C# project. You can look at the samples in the repository https://github.com/lostinplace/sample-empyrion-mod and you can also read an overview in the wiki here https://empyrion.gamepedia.com/Game_API

    Q: Do I need to import the DLL into an executable to be able to use it?
    A: You will need to import the Mif.dll as it is the interface Empyrion will access.

    Q: Can I access it remotely?
    A: not unless you/someone else programs it that way

    Q: Is somone working on a way to access the data the API can provide that is as easy as telnet?
    A: The API's purpose is to avoid using telnet.

    Q: Are there any useful links on how game APIs work?
    A: The ones listed in the first question.
     
    #2
    XeroTerragoth likes this.
  3. Xango2000

    Xango2000 Captain

    Joined:
    Jun 15, 2016
    Messages:
    385
    Likes Received:
    202
    That looks like a Yes but is there any other way to do it?

    Either I phrased the question wrong or you misunderstood, this doesn't answer the question.
     
    #3
  4. joemorin73

    joemorin73 Captain

    Joined:
    Aug 24, 2016
    Messages:
    319
    Likes Received:
    170
    No. The API information is specifically made to do it programmatically. To support Telnet or some webservice, you would need to write a one.


    I don't know of anyone currently writing a telnet or webapi interface. A webapi interface would be challenging as calls to the API are asynchronous. Difficult, but not impossible.
     
    #4
  5. Xango2000

    Xango2000 Captain

    Joined:
    Jun 15, 2016
    Messages:
    385
    Likes Received:
    202
    Q: How do I use an API?
    A:

    (this is a Guess)
    Create an executable program that imports the mif.DLL file, this program needs to send requests to the functions of the DLL
    the DLL then tags the request with a unique number and the request sits in the DLL's buffer

    Empyrion occasionally accesses the DLL's buffer to see if there are any new requests
    When there are unfulfilled requests, Empyrion reads the request and returns data or an error code to the DLL
    the DLL then stores that Data or Error in the Same buffer using the same unique number as the request

    Your program will need to accesses the DLL's buffer occasionally to see if it's request has been fulfilled
    Your program does whatever you requested that data for
     
    #5
    dtmullican likes this.
  6. joemorin73

    joemorin73 Captain

    Joined:
    Aug 24, 2016
    Messages:
    319
    Likes Received:
    170
    You don't make an executable, you make a library. Empyrion will load your library as one of it's own and call it.
     
    #6
    Daede likes this.
  7. Xango2000

    Xango2000 Captain

    Joined:
    Jun 15, 2016
    Messages:
    385
    Likes Received:
    202
    But... That means... OMG!!!
    Oh man, I thought this was going to be some monumental ordeal, teaching myself yet another new programming language, copying all the functionality of my old program over, create an actual executable, convince server host to run the executable, etc etc etc.

    If all I have to do is create a DLL...
    All I really need to do is learn just enough c# to program a few functions and I'm done.
     
    #7
  8. joemorin73

    joemorin73 Captain

    Joined:
    Aug 24, 2016
    Messages:
    319
    Likes Received:
    170
    If you look at the GitHub URL I posted earlier, there is the source code for DeathMessenger mod. You can study it as the basis of a simple mod.
     
    #8
  9. Social Justice Warlock

    Social Justice Warlock Ensign

    Joined:
    Apr 24, 2017
    Messages:
    3
    Likes Received:
    1
    I want to tweak some physics settings, particularly vessel movement.

    Before I get started, is this possible using the API? Are there any significant limitations to the API?
     
    #9
  10. joemorin73

    joemorin73 Captain

    Joined:
    Aug 24, 2016
    Messages:
    319
    Likes Received:
    170
    The API won't let you tweak physics. It's not in the scope of what you can modify.
     
    #10
  11. Social Justice Warlock

    Social Justice Warlock Ensign

    Joined:
    Apr 24, 2017
    Messages:
    3
    Likes Received:
    1
    Thanks for that instant reply.

    That's a shame really. How would one go about suggesting some improved physics for thrusters? My idea was to mod and test them myself, but since that's off the table... any suggestions?
     
    #11
  12. joemorin73

    joemorin73 Captain

    Joined:
    Aug 24, 2016
    Messages:
    319
    Likes Received:
    170
    At this time, none. There is no way to modify individual blocks in any way. I'm not sure if that is on the list, or when it will be. I'd recommend posting in the suggestions the ability to modify game elements.
     
    #12
  13. Social Justice Warlock

    Social Justice Warlock Ensign

    Joined:
    Apr 24, 2017
    Messages:
    3
    Likes Received:
    1
    Thanks for the help. Cheers!
     
    #13
    joemorin73 likes this.
  14. Alexandra

    Alexandra Ensign

    Joined:
    Apr 9, 2017
    Messages:
    22
    Likes Received:
    2
    Q: How to detect attacking structure? (get intruders and victim structures)
    A: Thats not possible at the moment.
     
    #14
    Last edited: Jun 12, 2017
  15. Jascha

    Jascha Administrator

    • Moderator
    Joined:
    Jan 22, 2016
    Messages:
    1,141
    Likes Received:
    713
    Thats not possible at the moment.
    We thought about it, but it might cost a lot of performance to inform the mod about every shot. Is postponed for a later time.
     
    #15
  16. Xango2000

    Xango2000 Captain

    Joined:
    Jun 15, 2016
    Messages:
    385
    Likes Received:
    202
    why not just the first shot per attacker and only on PvP playfields?
     
    #16
  17. Jascha

    Jascha Administrator

    • Moderator
    Joined:
    Jan 22, 2016
    Messages:
    1,141
    Likes Received:
    713
    but where do you draw the border. when is it a "new attack" and then the game has to save all those informations about attacks... will think about it, but it might take time.
     
    #17
  18. KRDucky

    KRDucky Ensign

    Joined:
    Jun 11, 2017
    Messages:
    3
    Likes Received:
    0
    does the API work in a Linux Environment? Like for example if I wanted to make a Gnome Shell Extension for managing a server?
     
    #18
  19. Alexandra

    Alexandra Ensign

    Joined:
    Apr 9, 2017
    Messages:
    22
    Likes Received:
    2
    Q: What is Eleon.Modding.GlobalStructureInfo.lastVisitedUTC and how to convert human date ?
    A: Its a Binary Date. Use a function like Date.FromBinary(lastVisitedUTC)
     
    #19
    Last edited: Jun 12, 2017
  20. Jascha

    Jascha Administrator

    • Moderator
    Joined:
    Jan 22, 2016
    Messages:
    1,141
    Likes Received:
    713
    Its a Binary Date. Use a function like Date.FromBinary(lastVisitedUTC)
     
    #20
    Alexandra likes this.

Share This Page