PA Client API Requests

Discussion in 'Mod Support' started by wondible, March 11, 2014.

  1. wondible

    wondible Post Master General

    Messages:
    3,315
    Likes Received:
    2,089
    This thread is a place to collect additional features that mod makers would like to have access to, so Uber has an easy place to find them when they actually get some time. This thread is for collecting ideas only, for detailed discussions of any proposal, please find or create a dedicated thread.

    Client APIS
    Network Services
    Last edited: November 15, 2015
  2. wondible

    wondible Post Master General

    Messages:
    3,315
    Likes Received:
    2,089
    Total Economic Information
    Uber has commented about people not understanding streaming economy. I'd like to do some visualization, but I'll need a lot more information, including the number and type of any unit producing or consuming any resource.
    Ideally:
    - the actual consumption given efficiency reduction, but I'll take a clear explanation of how to calculate it from given information.
    - units that could be consuming, such as idle fabbers or disabled radar.
    - actual unit ids so I could toggle the consume stance from an interface
    - for fabbers and factories, the unit types being fabbed


    Select Unit By ID
    67998: engine.call("select.byIds", units)

    Interactive Selection Filtering
    In theory this can be done a little by adjusting received selections, but the interactive highlights would be incorrect. Allow unit type filters to be setup before or during a box selection, so that the interactive highlight is correct. This would also allow you to select the minority type in an area.

    Media Capture
    Enable usage of microphone and possibly camera so we can create (or embed) in-game chat systems. Will probably need a permissions dialog, and probably be setup per-scene, with mods using it expected to create their own scene. https://forums.coherent-labs.com/index.php/topic,71.0.html
    Last edited: November 15, 2015
    ORFJackal and SXX like this.
  3. someonewhoisnobody

    someonewhoisnobody Well-Known Member

    Messages:
    657
    Likes Received:
    361
    I have been reading the source 1 file at a time. Just started a bit ago and then went to finish a mod. PA DOCS
    wondible likes this.
  4. wondible

    wondible Post Master General

    Messages:
    3,315
    Likes Received:
    2,089
  5. trialq

    trialq Post Master General

    Messages:
    1,295
    Likes Received:
    917
    • A secondary selection model, other than the one the user interacts with. You could then automate things in a mod with no glitches (and re-use the existing functions without re-inventing the wheel), instead of trying to use the user selection when the user isn't
    • Allow giving commands in global coordinates, not screen coordinates. Necessary to do things out of view, and do things in view cleanly
    Implementing these opens the door for any number of mods, each more awesome than the last.
    chattyrazzy, cola_colin and wondible like this.
  6. LavaSnake

    LavaSnake Post Master General

    Messages:
    1,620
    Likes Received:
    691
    I'd REALLY like an API for editing json at runtime. This would be much better than shadowing because mods that shadow the same json file wouldn't conflict as bad and we could use it to let the user change things like names in settings. The changes don't have to be permanent (actually it would be better if they weren't). Thanks!
    aevs and ORFJackal like this.
  7. wondible

    wondible Post Master General

    Messages:
    3,315
    Likes Received:
    2,089
    I forgot to write that that one down - we need either a method to intercept data file loads and edit them for circle-to-line, continuous-build, etc., or even better a way to update unit properties on the fly, so you can have modifiers for pattern and spacing, etc.
    LavaSnake likes this.
  8. someonewhoisnobody

    someonewhoisnobody Well-Known Member

    Messages:
    657
    Likes Received:
    361
    I've been poring over the code trying to figure out how to do this. It would be really help do a lot of cool things(Such as a mod idea of mine for an ingame effects editor)
    LavaSnake likes this.
  9. LavaSnake

    LavaSnake Post Master General

    Messages:
    1,620
    Likes Received:
    691
    It might be possible if there's a global read json function we could overwrite and turn into a framework but I don't know if there is one.
    someonewhoisnobody likes this.
  10. someonewhoisnobody

    someonewhoisnobody Well-Known Member

    Messages:
    657
    Likes Received:
    361
    I was thinking along the same lines. Trying to fake out the game when it comes to reading data.
  11. LavaSnake

    LavaSnake Post Master General

    Messages:
    1,620
    Likes Received:
    691
    I looked into overriding JSON.parse() but that's a native function so that's not an option. :(

    Edit: Looked around some more and it definitely looks like it's not possible to do it this way. JSON data is usually loaded by a XMLHttpRequest followed by JSON.parse() and both of those are native functions that can't be overridden or shadowed. :mad:
    Last edited: March 11, 2014
  12. ORFJackal

    ORFJackal Active Member

    Messages:
    287
    Likes Received:
    248
    It might be possible to replace XMLHttpRequest with a fake object, but that might give only limited abilities to change them, because some of the things we want to mod (e.g. circle-to-line, continuous build) are probably implemented in the C++ code and it reads those files directly. Does somebody know things that we could do in just the UI if we could change the JSON that the UI sees?
    LavaSnake likes this.
  13. wondible

    wondible Post Master General

    Messages:
    3,315
    Likes Received:
    2,089
  14. cola_colin

    cola_colin Moderator Alumni

    Messages:
    12,074
    Likes Received:
    16,221
    I want a way to tell what players are in what teams in the live_game scene.
    Currently PA Stats has to grab it from the new_game scene, which changes all the time and gets worse and worse.
    Currently model.armies() in live_game however is wrong for shared army games, as it merges together players, so if we have 2 players A and B it will list them as one player called "A B". Since displaynames can contain spaces I have no way to tell them apart. It might be one person called "A B" as far as I can tell.
    This is a really really bad issue for me. Like I can't find a way anymore to make it 100% reliable since the last patch, because the last patch randomly clears out data in the new_game scene shortly before the game starts and I have a hard time getting the right data that exists between the game countdown starts and the data is cleared.

    EDIT:
    I suggest that the live_game should be improved to properly separate players even if they have shared armies and show some marker instead. That kind of improvement would naturally force live_game to have the exact data I need.
    Last edited: March 15, 2014
  15. LavaSnake

    LavaSnake Post Master General

    Messages:
    1,620
    Likes Received:
    691
    This would still be very helpful to have since we hit a brick wall in making it.
  16. wondible

    wondible Post Master General

    Messages:
    3,315
    Likes Received:
    2,089
    Mod Message Bus
    Because sometimes I have ideas that want to communicate settings between players, and right now I can either do it through chat, which is disrupting to players, or set up my own web service, which is extra work, and would have be repeated for each mod (but now I need to go post something in the mod ideas thread... ;^) )
    LavaSnake, proeleert and DeathByDenim like this.
  17. cola_colin

    cola_colin Moderator Alumni

    Messages:
    12,074
    Likes Received:
    16,221
    made this sticky so Uber can see it better
  18. cptconundrum

    cptconundrum Post Master General

    Messages:
    4,186
    Likes Received:
    4,900
    You might be able to use jabber for this and then hide the messages.
  19. wondible

    wondible Post Master General

    Messages:
    3,315
    Likes Received:
    2,089
    Cool. Though I don't necessarily expect them to get to such niceties until after release.
  20. wondible

    wondible Post Master General

    Messages:
    3,315
    Likes Received:
    2,089
    Related: allow use of pieces of existing commands. So a mod could ask for a circle area-command zone (and the visible objects in it), or a build template with certain parameters and then get back the coordinates. The results could to be passed back to the engine, possible after editing, or the apis could be used independently. This would make implementing area-attack in Missile Command relatively easy, among others.

    Edit: Still don't have the stock UI as pieces, but we have enough tools to make crude simulations of them.
    Last edited: November 15, 2015

Share This Page