Control Game-state from an internet browser.

Discussion in 'Mod Discussions' started by napperjabber, February 6, 2014.

  1. napperjabber

    napperjabber New Member

    Messages:
    20
    Likes Received:
    1
    Hi, long time lurker here,

    Thinking about custom games more and more, there is one thing that they universally leave out. The ability to be tracked from 3rd party websites. Sure, you can write a program that will mine the gamestate in memory and addons that you can have send back to webservices.

    I'd like to control the game. For example, setting up a tournament. It would be so much easier if you could generate a game from a webservice and then send invitation codes to the players. This could be done through a verity of mediums such as email or username/password login. At the end of the day, I want to be able to tell the client to open the game and join this game-session.

    You could design a set of APIs like so: ( Mind you I am use to the Alpha version of PA. Things could have changed. )

    GET /user/:user-handle.json
    {}.keys(userid, username, stats_url, last-game-played)

    GET /user/game/:gameid.json
    {}.keys(winner[], losers[], gametime, chronocam)

    GET /game/:gameid
    {}.keys(players, teams)

    GET /game/:gameid/:teamid
    {}.keys(players, main-objective-state, secondary-objective-state-1, secondary-objective-state-2, secondary-objective-state-3, secondary-objective-state-infinity)

    POST /game/create.json
    {}.keys(players, teamdefinitions, objectives, map-id)

    -napperjabber
  2. cptconundrum

    cptconundrum Post Master General

    Messages:
    4,186
    Likes Received:
    4,900
    I recently found myself wishing for something similar. It would be nice to be able to go to PA Stats, find a game, and click "play on this map."

    If we had a way to pass initialization args to pa through a uri handler registered in windows, we could get pa://example.com/starthame/:gamejson to be opened by pa. I'm not sure how to set that up though.
  3. napperjabber

    napperjabber New Member

    Messages:
    20
    Likes Received:
    1
    Exactly!
  4. DeathByDenim

    DeathByDenim Post Master General

    Messages:
    4,328
    Likes Received:
    2,125
    Bah, I thought I had an idea. There used to be a --uiurl parameter you could pass on to PA, so I thought you would be able to get away with
    Code:
    ./PA --uiurl "coui://ui/media/alpha/start/start.html?parameter1=something"
    and then read out the parameters using a mod.

    But...
    Code:
    terminate called after throwing an instance of 'std::runtime_error'
    what(): pathname must be absolute
    [00:05:25.021] INFO Dump written to /tmp/0bae1fa2-0fc6-2651-72d72f6d-05444896.dmp
    [00:05:25.021] INFO Upload command: /home/jarno/Games/PA/crashupload -c /tmp/checkpoint.cpk -p Platform=linux -p Program=client -p TitleId=4 -p Version=59607 http://uberent.com/GameClient/SubmitCrashReportWithDump /tmp/0bae1fa2-0fc6-2651-72d72f6d-05444896.dmp
    I suppose you could also write a script that writes to a file in the directory of your mod and then starts up PA and let your mod read the data. That would be very platform dependent though. It would probably work similar to PA Stats' current 1v1 thingy then once you have the data.
  5. cptconundrum

    cptconundrum Post Master General

    Messages:
    4,186
    Likes Received:
    4,900
    Does uiurl work if you use the file:// path to start.HTML rather than coui://? It's less convenient, but it would be a start.
  6. DeathByDenim

    DeathByDenim Post Master General

    Messages:
    4,328
    Likes Received:
    2,125
    Nah. It crashes too. If I try full paths (without coui:// or file://) it doesn't crash, but just ignores them. Not even an error in the logs. I tried many many many combinations.
  7. LavaSnake

    LavaSnake Post Master General

    Messages:
    1,620
    Likes Received:
    691
    Maybe you could just have a mod like the PA Stats matchmaker except at the beginning it would ask you to paste an ID in a textbox. You'd go to the web app and make your game there which would return an ID. After you paste that into the mod it would run a server call with the idea to retrieve the settings and then use them to start the match.
  8. Illmaren

    Illmaren Active Member

    Messages:
    174
    Likes Received:
    150
    Its at the moment nearly imbossible because of the fact that nobody can generate unique ID´s for an User

    So can everyone pretend to be anyone, Godde could be pretend to be Gandalf and so on.
  9. LavaSnake

    LavaSnake Post Master General

    Messages:
    1,620
    Likes Received:
    691
    true.
  10. cptconundrum

    cptconundrum Post Master General

    Messages:
    4,186
    Likes Received:
    4,900
    But we can get a system id. So it would still be very useful for playing on the same map as a pa stats game you are reviewing.
  11. cola_colin

    cola_colin Moderator Alumni

    Messages:
    12,074
    Likes Received:
    16,221
    Weird I can remember a few month ago I could use PA as a browser by doing
    PA.exe --uiurl www.google.de

    But it crashes now as well.

    I guess the easiest thing would be to have the system online stuff from cptconundrum better integrated, so you can just search a system by a game id.
  12. cptconundrum

    cptconundrum Post Master General

    Messages:
    4,186
    Likes Received:
    4,900
    I found a flag for PA.exe --ticket that claims to accept an "UberNet session ticket" as input. Is this likely to be the lobby id value we're looking for?

    * Edit *

    Doesn't really seem to be implemented in the ui. The code for the new_game and lobby scenes both just read the ticket out of local storage and then do nothing with it. Unfortunately I don't know how to ask Ubernet for the game's ticket (If that even is the lobby id).
  13. DeathByDenim

    DeathByDenim Post Master General

    Messages:
    4,328
    Likes Received:
    2,125
    Yeah, I remember it working for me as well. I think they may have broken it when they introduced the coui:// stuff. That's just a guess though.
  14. cola_colin

    cola_colin Moderator Alumni

    Messages:
    12,074
    Likes Received:
    16,221
    The lobby id is not the game session ticket.
    I am not quite sure what the ticket is used for, but I think it is given to the server, probably for some sort of authentification.
  15. napperjabber

    napperjabber New Member

    Messages:
    20
    Likes Received:
    1
    That would be left up to the implementer, all I would need is the username as a unique id. Then I'd have them click on a link and it'll que a new session.

    ------

    Yes, but thats to much required by the end user. This should be simple.

    -----

    In general, matchmaking involves a lot of data. Regional-location and Skill-level are only two major components to ensure truly random yet matched individuals. My attempt here is to allow people to do this for uberent.
  16. Illmaren

    Illmaren Active Member

    Messages:
    174
    Likes Received:
    150
    The username can be changed. It should not be possible to change a unique variable.
  17. napperjabber

    napperjabber New Member

    Messages:
    20
    Likes Received:
    1
    You're right, but we're not tracking machines that do our work for us. We're tracking humans that play video games. If they change their name, they forfeit everything that goes with that name. Like it's reputation.
  18. cola_colin

    cola_colin Moderator Alumni

    Messages:
    12,074
    Likes Received:
    16,221
    They do not need to change their name in game. It is trivial to modify PA mods, so they can send bogus data without actually changing anything. At first we would need something like an OpenAuth system that allows us to verify the identity of people even though we are only communicating through they very easy to modify javascript layer of the UI.
  19. emraldis

    emraldis Post Master General

    Messages:
    2,641
    Likes Received:
    1,843
    For loading a planet in from a website, if we have the system sharing mod tied in with whatever website you are trying to download the system from, then I don't think it would be inconceivable. You'd have to do some site-side alterations, set up a server specifically for the site, and alter the mod and website to be able to affect each other, but I can see it being at least possible...
  20. DeathByDenim

    DeathByDenim Post Master General

    Messages:
    4,328
    Likes Received:
    2,125
    Wouldn't it be possible to use something akin to what the PA bug tracker uses now. It authenticates users through a link like this:
    https://uberent.com/User/Login?titleId=42&redirectUrl=http://pa.lennardf1989.com/Tracker/index.php?do=authenticate&returnUrl=aHR0cDovL3BhLxmlbm5hcmRmMTk4OS5jb20vVHJhY2tlci8=
    I wonder if you can even use the username and the password supplied to the PA client to do so automatically.
    cptconundrum likes this.

Share This Page