API Feedback and Suggestions

Discussion in 'Empyrion API' started by Jascha, Mar 8, 2017.

  1. Xango2000

    Xango2000 Captain

    Joined:
    Jun 15, 2016
    Messages:
    385
    Likes Received:
    202
    Any news on getting the API accessible from a client computer?
     
    #141
  2. Guru

    Guru Captain

    Joined:
    Jan 13, 2017
    Messages:
    20
    Likes Received:
    10
    the structure damaged request would be an amazing asset to have, but I think an easy way around the flood of data would be to limit the response from it to a specific playfield and not a specific structure. For example: "A structure of yours on Omicron is being attacked!"
     
    #142
  3. Guru

    Guru Captain

    Joined:
    Jan 13, 2017
    Messages:
    20
    Likes Received:
    10
    We're just anxious because the sooner we get these, the sooner we can start creating new goodies for the player experience. We're like a bunch of fat kids standing outside of a closed candy store. We're drooling over what is just out of our reach, lol
     
    #143
  4. Jascha

    Jascha Administrator

    • Moderator
    Joined:
    Jan 22, 2016
    Messages:
    1,141
    Likes Received:
    713
    First Alpha 6.0 Version is being started on the Alpha 6.0 Branch.
    This is NOT yet the Experimental Branch, so please wait on using it, it will not work on Experimental ;).
     
    #144
  5. joemorin73

    joemorin73 Captain

    Joined:
    Aug 24, 2016
    Messages:
    319
    Likes Received:
    170
    Excellent! Unless I am wrong, the only additions are Chat and console. (Which is fantastic, no more telnet!)

    Will this be included in the next experimental part build?
     
    #145
  6. Jascha

    Jascha Administrator

    • Moderator
    Joined:
    Jan 22, 2016
    Messages:
    1,141
    Likes Received:
    713
    Small start. but yes, the first changes were to get around telnet. next a few bugs and then nesw stuff. We will take time for this the next days.
    All changes are in next EXP.
     
    #146
    joemorin73 likes this.
  7. Taelyn

    Taelyn Guest

    So were not in need to use telnet anymore for anything? Now i have a shortcut on my pc to get access to telnet for my server. How can i access it then? :D
     
    #147
  8. joemorin73

    joemorin73 Captain

    Joined:
    Aug 24, 2016
    Messages:
    319
    Likes Received:
    170
    Insert dance of joy!
     
    #148
  9. Jascha

    Jascha Administrator

    • Moderator
    Joined:
    Jan 22, 2016
    Messages:
    1,141
    Likes Received:
    713
    You canstill use it. But we dont want to use telnet for our tools anymore. Thereore the API has the same functionality.

    In the first place the commands to send will stay as "strings". Instead of for example sending "saveandexit 5" over telenet you can now send the same command string over a new Request_Command function through the API. Later we can make own functions out of it. This way the devs can implement some other cool functions too ;).
    But on the recieving end, you will get seperate events. Like Chat will be no string anymore where you have to search for the player and so on on your own. Instead it will give you the Player, the Faction and also the reciever (I guess f in Global/Factin chat for now) as well as the Message of course. But more later ...
     
    #149
    Taelyn likes this.
  10. joemorin73

    joemorin73 Captain

    Joined:
    Aug 24, 2016
    Messages:
    319
    Likes Received:
    170
    Two questions about the changes:
    1. To send to chat, will we need to use the "say" command? I don't see a method to speak on chat separately.
    2. Is there any work being done to handle multiple DLLs in the same mod folder? It is the last significant limit, second to the telnet.
     
    #150
  11. Jascha

    Jascha Administrator

    • Moderator
    Joined:
    Jan 22, 2016
    Messages:
    1,141
    Likes Received:
    713
    At the moment you have to use it the same way you used it via telnet. Was the easiest way for the devs for now. so you need to use "say"

    Can you describe that again. So at the moment just one dll works and another not?
    Are they in different folders?
    Do they both have seperate ports set?
     
    #151
  12. joemorin73

    joemorin73 Captain

    Joined:
    Aug 24, 2016
    Messages:
    319
    Likes Received:
    170
    The multiple DLL issue occurs if you include more than one DLL in the folder. For example, if I have a mod in the folder Mods\MMM, I might place MMM.DLL (the mod) and YAML.dll (MMM.dll dependency) in the same folder. When Empyrion scans the folder, the folder appears to be ignored.

    This will be a problem as mods will be needing dependencies for much functionality.
     
    #152
  13. Jascha

    Jascha Administrator

    • Moderator
    Joined:
    Jan 22, 2016
    Messages:
    1,141
    Likes Received:
    713
    Ah i understand. Will let them know. Maybe a specific dll-name could solve that.
    But the DLL should just do the connection to your tool to prevent the game being influenced/slowed down/crashed by those dlls.
     
    #153
  14. Jascha

    Jascha Administrator

    • Moderator
    Joined:
    Jan 22, 2016
    Messages:
    1,141
    Likes Received:
    713
    Just two things:

    Did you try to put the dependency in a folder below (telling your tool to search there for the dll)?
    Or try to put them into the "Empyrion - Dedicated Server\EmpyrionDedicated_Data\Managed" folder. --> this would be no good solution though.
     
    #154
  15. joemorin73

    joemorin73 Captain

    Joined:
    Aug 24, 2016
    Messages:
    319
    Likes Received:
    170
    It could. I'm not sure how they are loading the DLL.

    I'd recommend using reflection on the DLLs in the folder and finding the one that implements ModInterface. Only one DLL should have it implemented in the mod.

    This sample is based on this post. http://stackoverflow.com/questions/28633347/how-to-release-a-dll-that-was-loaded-with-reflection
    Code:
    String dlls = <currentAPIFolder>
    FileInfo[] files = new DirectoryInfo(dlls).GetFiles("*.dll");
    foreach (FileInfo file in files) {
        if (!LoadedApis.ContainsKey(file.Name)) {
            Assembly ass = Assembly.LoadFrom(dlls + file.Name);
            foreach (Type t in ass.GetTypes()) {
                if (t.GetTypeInfo().FindInterfaces((x, y) => true, null).Contains(typeof(Eleon.Modding.ModInterface))) {
                    Eleon.Modding.ModInterface api = (Eleon.Modding.ModInterface)ass.CreateInstance(t.FullName);
                    LoadedApis.Add(file.Name, api);
                }
            }
        }
    }
     
    #155
    Last edited: Apr 10, 2017
    Jascha likes this.
  16. joemorin73

    joemorin73 Captain

    Joined:
    Aug 24, 2016
    Messages:
    319
    Likes Received:
    170
    I haven't tried that, but will tonight. (I'm in Canada and at work. ;) ) If managed is part of the search path, it could work. I believe we both agree, it would be "messy".

    I could also recommend adding mods and managed folders to the scenario folders. But I think this would also be another "messy" solution.
     
    #156
  17. joemorin73

    joemorin73 Captain

    Joined:
    Aug 24, 2016
    Messages:
    319
    Likes Received:
    170
    @Jascha
    Just updated the quoted code. I forgot to change an interface in the if block.
     
    #157
  18. Guru

    Guru Captain

    Joined:
    Jan 13, 2017
    Messages:
    20
    Likes Received:
    10
    A little late with this one, but since we already have a "Hangar Bay" and it seems we could benefit from somewhere for API and Mods, why not a new thread called "The Control Room"?
    Okay, back to my cage now
     
    #158
  19. joemorin73

    joemorin73 Captain

    Joined:
    Aug 24, 2016
    Messages:
    319
    Likes Received:
    170
    I've posted the Death Message Mod in the Hangar Bay. I don't think there is much demand for a separate forum yet.
     
    #159
  20. Jascha

    Jascha Administrator

    • Moderator
    Joined:
    Jan 22, 2016
    Messages:
    1,141
    Likes Received:
    713
    The Alpha 6.0 Branch is working with the new EXP branch. There you see also all the new functions :)
    Please see also the ModInterface.cs laying in the project (it will not be compiled but gives you inside about the structures used in the Mif.dll. I will always updte it from now on)

    Just some Changes since 5.5:
    Event_Player_DisconnectedWaiting: Let you know when Players have difficulty to enter the game (or they canceled the loading screen)
    Event_ChatMessage: Chat Message that was sent formerly over telnet. Shows also reciever/type
    Load_Playfield: Start a playfield for a few seconds (to be able to send some commands for that playfield)
    ConsoleCommand: You can send all former telnet comands over this function
    Structure_BlockStatistics: Gives you a list of all blocks/devices that the structure consits of
    AlliancesAll/AlliancesFaction: Gives you all Alliance differences (to default), but you need to extract the IDs! (see source files).
     
    #160
    Hopskotch and joemorin73 like this.

Share This Page