API Feedback and Suggestions

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

  1. Jascha

    Jascha Administrator

    • Moderator
    Joined:
    Jan 22, 2016
    Messages:
    1,141
    Likes Received:
    713
    hm I think both points would be rather a Game-Feature
     
    #301
  2. Exacute

    Exacute Rear Admiral

    Joined:
    Feb 17, 2017
    Messages:
    456
    Likes Received:
    307
    Unless I'm misunderstanding you, the first one is 100% an API feature:
    -Being able to register custom commands, for the ingame console, on launch of the mod, to the game.
    As the registration needs to be dynamic, this is neccessary for a request-API-op.
    -Being able to write visual output to the ingame console, from a mod.
    You need to be able to provide visual feedback to the user, that whatever they are typing are doing 'what they intend'.
     
    #302
  3. Exacute

    Exacute Rear Admiral

    Joined:
    Feb 17, 2017
    Messages:
    456
    Likes Received:
    307
    Currently, I believe there is no way to
    -Speak from a 'persona' (not Server:)
    -Speak to only one target (not server-wide broadcasting)
    While doing it in the *chat*-section

    The most commonly (And only) used approach, afaik, is the 'wrap a telnet SAY into a request_ConsoleCommand'
    String command = "SAY '" + msg + "'";
    GameAPI.Game_Request(CmdId.Request_ConsoleCommand, (ushort)CmdId.Request_InGameMessage_AllPlayers, new Eleon.Modding.PString(command));

    But this does not allow for writing from a specifc source, nor does it allow formatting, or to not broadcast it server-wide.

    Applications:
    Answer a single users question, without spamming the entire server (for instance, list which mods are installed, to the user asking)
    Make cool stuff, with being able to make a shiny name, or otherwise.
    (For instance [red]OwlMonster[/red]: Growls (idk.. silly example.. but gets the point accross)


    To make this truly usefull, perhabs also alter the current
    (ChatInfo) (Returned on Event_ChatMessage), to include an ID of the message sent

    And implement a request, that can remove a message, by it's ID.
    (This would be usefull to (effectively)intercepting certain chatmessages, and edit them.
    This could be as simple as giving the user a colored name (as a donation reward for instance). (More cosmetic options would be ideal)
    Or to make 'replace' commands on the user input. For instance a mod could look for {time} and replace it with a timestamp (Again, really a bad example.. but gets the point accross)


    So.
    I'm asking for a Request, for sending chatmessages, that would have the neccesarry data, the ChatInfo class desires.
    This would allow for arbitrary names, aswell as colored text (I imagine it should use the same formatting, as the PDA uses. Should be minimal work to run the input through it, before outputting to chat)

    I'm asking for a slight rework of the Event_ChatMessage, to have each chatmessage have an unique ID to refer it to

    I'm asking for a request that can delete a chat-entry, based on its ID
     
    #303
  4. Jascha

    Jascha Administrator

    • Moderator
    Joined:
    Jan 22, 2016
    Messages:
    1,141
    Likes Received:
    713
    Speaking from a persona will be included in A8.0
    Speaking to only one person is already possible. Also to a faction. See the say help in telnet.
    --> say p:<client-id> 'text with blanks' -> send a message to a specific player

    The rest sounds interesting but not sure its that easy since it means quite some chat mechanic changes, not just API. Maybe this is somethign for the overall chat upgrade in the future.
    I will put it on the list.
     
    #304
    Exacute likes this.
  5. Exacute

    Exacute Rear Admiral

    Joined:
    Feb 17, 2017
    Messages:
    456
    Likes Received:
    307
    I've updated this chapter of the wiki:
    https://empyrion.gamepedia.com/Telnet_Commands
    with your 'say' extension (and some formatting). Do you have any other small gold-pieces you'd like to add? :)
     
    #305
  6. Jascha

    Jascha Administrator

    • Moderator
    Joined:
    Jan 22, 2016
    Messages:
    1,141
    Likes Received:
    713
    Thanks. I put some examples to say and also included remoteex
     
    #306
    Exacute likes this.
  7. Exacute

    Exacute Rear Admiral

    Joined:
    Feb 17, 2017
    Messages:
    456
    Likes Received:
    307
    Here's two additional suggestions:

    -When a mod makes a GameAPI.Console_Write(string), perhabs prepend the mods name in the log file? This would def. make it cleaner, and easier for people to read the log (And determine what mod for instance threw an error)

    -'redo' the events slightly:
    Perhabs rather than just sending all events to all mods, would it be an idea to have the mods *register* for what events they want, when they boot?
    (To be nice, if the mod uses a request, the corresponding event could be auto-registered)
    This would likely save a lot on performance, with many mods running side-by-side, no?
     
    #307
    Kharzette likes this.
  8. Exacute

    Exacute Rear Admiral

    Joined:
    Feb 17, 2017
    Messages:
    456
    Likes Received:
    307
    Perhabs it could be usefull, to have Empyrion 'watch over' the mods in a sense.

    Given that it is possible to load the mods 'at will', this could be usefull to recover, incase of uncaught errors.

    I imagine it could be nice to have a system like:
    -If the mod fail on initial run, don't recover.
    -If the mod fail after, restart it.
    -If the mod fails too often (for instance <1m between fails), don't recover.

    This is not neccessary, as the mods should be able to error-handle on their own. But there's bound to be edge-cases, where it might fail. Having Empyrion be 'friendly' in that regards is perhabs something that could be nice.
     
    #308
  9. Exacute

    Exacute Rear Admiral

    Joined:
    Feb 17, 2017
    Messages:
    456
    Likes Received:
    307
    In the same theme as above: When mods fail, there's a neat error-message printed in the console.
    This is however almost on line of an old-time php error message ;) [Effectively: Something failed, I don't know where. I don't know which mod] (sure.. old php was entirely blank page.. this atleast gives a category.. but details)

    Perhabs it would be possible to print more of the actual error?
    I'm sure that would make debugging easier.
     
    #309
  10. Xango2000

    Xango2000 Captain

    Joined:
    Jun 15, 2016
    Messages:
    385
    Likes Received:
    202
    I really wish we had a device block that can be triggered by a switch in-game (motion sensor) that sends an Event to the API.
     
    #310
    Kharzette likes this.
  11. Exacute

    Exacute Rear Admiral

    Joined:
    Feb 17, 2017
    Messages:
    456
    Likes Received:
    307
    Inter-mod communication:

    A dedicated 'framework' for communicating between mods.
    Should feature Two request-event pairs:

    -Ideally the game should be the controller:
    --You send a request to get your mod ID, and other mod's IDs (No params)
    --You send a request, when you want to communicate with another mod
    ---For this, you supply
    ----Receiving mods ID (This will be the only mod that receives the event)
    ----A custom message for the receiving mod to act on such as "SaveUser"
    ----An object array, with whatever should be sent (what the other mod is expecting, to perform this action. It could be 'userid (int)', 'list containing several entries', etc.)
    ---The game appends
    ----The sending mods ID

    Each of these request should have a corresponding event.

    This approach would keep the seqnr free, aswell as allow for more dynamic approaches, and would allow the mods to (mostly) check that the sending source is legittimate (in case you only allow 'approved mods' to interact with this ones functions, or whatnot)


    This would allow us to communicate between mods, and utilize other mods functions, to save work.
    (For instance, let's say one mod is the main driver between registering a custom value about a player, let's say their reputation. Other mods could then use this 'framework' to request what reputation the player have, and pass along a new value to set the reputation of a certain player to, without having to implement the whole thing in a new mod aswell)
     
    #311
    Last edited: Apr 23, 2018
    Kassonnade likes this.
  12. Exacute

    Exacute Rear Admiral

    Joined:
    Feb 17, 2017
    Messages:
    456
    Likes Received:
    307
    I just realised, that there currently is no way to 'catch' commands from EAH, or chat from EAH (/normal server client)

    Can we have 'say commands' (anything the server 'says') treated as a normal chatevent aswell? Perhabs with a negative userID, or some other way to tell it's a 'server' it comes from.
    (Event_ChatMessage)

    This would be pretty 'huge' so that we can have mods communicate with outside sources more directly.
     
    #312
    Kassonnade likes this.
  13. Exacute

    Exacute Rear Admiral

    Joined:
    Feb 17, 2017
    Messages:
    456
    Likes Received:
    307
    Can we have an additional event, ontop of Event_Player_Connected
    For when the player have FINISHED LOADING and is no longer in a loading screen? Event_Player_Loaded for instance?

    This would be hugely helpfull!
     
    #313
    Kharzette likes this.
  14. Exacute

    Exacute Rear Admiral

    Joined:
    Feb 17, 2017
    Messages:
    456
    Likes Received:
    307
    SpawnEntity for spawning any type of entity;
    (Backpack, drop-pack, NPCs, crates, etc)

    Define basic behavior: Where it spawns, and where it is heading (in 3 dimensions)
    Define inventory: What does it contain/drop
    Define faction: (For npcs)

    Usecase: Spawn a crate (somewhere near the player, based on a mods math, from players position), with <loot>.
    Usecase: Spawn a 'escape-pod' in the atmosphere (no player), with inventory, and make it fly to a given xy., with <loot>.
    Usecase: Spawn a hostile 'special' npc, that drops something special on death.

    (just as a few)
     
    #314
    Kassonnade and Jascha like this.
  15. <Darth Sidious>

    <Darth Sidious> Lieutenant

    Joined:
    Jul 4, 2017
    Messages:
    57
    Likes Received:
    25
    very need
    public struct GlobalStructureInfo
    {

    public byte offlineprotected
    (0 - no device, 1 - has device but off due time, 2 - has device and worked)

    public byte claimdevice
    ( 0 - no device, 1 - has device)

    public long lastattackedUTC
    (when attacked? )
    public int lastattacker
    ( entities who attacks last time)


    maybe add user flag to settings, accesible in request?
    public int userflag
    }
    add request
    request_adduserflagtostructure ( int s, int userflag) to set user flag

    maybe add settings to count base devices... as guns, generators and other )))
     
    #315
    Last edited: May 3, 2018
  16. Jascha

    Jascha Administrator

    • Moderator
    Joined:
    Jan 22, 2016
    Messages:
    1,141
    Likes Received:
    713
    Thanks for the suggestions.

    Just for your info, this is already requested for 8.0 .... so we will see if we get it :).
     
    #316
  17. Xango2000

    Xango2000 Captain

    Joined:
    Jun 15, 2016
    Messages:
    385
    Likes Received:
    202
    You can tell if a base is powered and you can also tell if the base has a device by deviceID. I do both of these in my ActiveRadar mod.

    You can also check if any member of that base's faction is online and\or read thru the Structure log to see who the owner is and check if they are online.
     
    #317
  18. <Darth Sidious>

    <Darth Sidious> Lieutenant

    Joined:
    Jul 4, 2017
    Messages:
    57
    Likes Received:
    25
    each time to request a list of blocks is very expensive) it would be much better to output it immediately in the settings of the structure
    and do cunning checks of the player, too, you can, but it's easier to take out in api ... and get the finished data.
     
    #318
    Jascha likes this.
  19. <Darth Sidious>

    <Darth Sidious> Lieutenant

    Joined:
    Jul 4, 2017
    Messages:
    57
    Likes Received:
    25
    i want gui controls !!!
    dialogs, labels, tabs, textboxes, buttons, listboxes, comboboxes, checkboxes, images, datagrids )))
     
    #319
  20. Exacute

    Exacute Rear Admiral

    Joined:
    Feb 17, 2017
    Messages:
    456
    Likes Received:
    307
    Hah~
    Having access to do GUI stuff is a dangerous step.
    I'm not sure how I would prefer it to work.. But whoever is designing it in the end: Please take your time. Do it well in the first place.
    It can either turn into a nightmare, or something really nice.

    Being able to manipulate the GUI (/custom windows), would def. be a thing that would allow for indepth modding.
    But again, please do it right ;)
     
    #320
    Jascha likes this.

Share This Page