[WIP][Server] Puppetmaster

Discussion in 'Work-In-Progress Mods' started by wondible, July 17, 2014.

  1. wondible

    wondible Post Master General

    Messages:
    3,299
    Likes Received:
    2,089
    Release Thread

    Enables create-unit and change-control for spectators, which can act as puppet-masters over the poor players. Intended as spectator donate-for-unit during the Community AbleGamers Tournament, but I expect it will be usable for other random silliness.

    Spectators may use the 'toggle puppetmaster' keybind, which is by default alt+ctrl+shift+p. The binding should be configurable if you visit Settings while in a modded game.

    Please note that this server mod enables cheats, so players will need to enable the Show-Cheats stock mod to play, in addition to selecting Modded Games.

    - https://github.com/JustinLove/puppetmaster
    - Release thread: https://forums.uberent.com/threads/rel-server-puppetmaster.62534/

    Recommended client mods for puppetmaster:

    - Sandbox Unit Organizer
    - Sandbox Unit Menu
    - Bulk Create Units
    - Improved Player Control

    Issues

    - Players would like to be informed about pastes
    - Pastes should be attributed to the "Puppetmaster", whoever that is at the time.

    Other Notes:

    - Since you have to change control to give a player units, the mod also allows the puppet-master to give unit orders, including self-destruct. (It's up to the puppet-master's discretion to allow donate-for-troll)
    - Nukes and anti-nukes are preloaded with one missile, and the metal cost is increased proportionally.
    - As discovered in the video, extra commanders don't change the losing conditions - only original coms count for assassination.
    - Controlling a player stops army stat updates; the mod clears control flags when the spectator panel opened, but it can be easy to forget you need to re-select a player in order to paste.
    Last edited: September 18, 2014
  2. warmax

    warmax New Member

    Messages:
    28
    Likes Received:
    9
    how do you set it up to work
  3. wondible

    wondible Post Master General

    Messages:
    3,299
    Likes Received:
    2,089
    If you're not familiar with the mods directory, the settings tab of PAMM has a path you can copy; back up one ("Planetary Annihilation" for me) and put the unpacked zip folder in server_mods. (e.g. server_mods/puppetmaster-master using the default github archive name) Then run/refresh PAMM and it should be available.
  4. cwarner7264

    cwarner7264 Moderator Alumni

    Messages:
    4,460
    Likes Received:
    5,390
    Unfortunately this is so integral to how the charity tourney is going to run, it's not practical to keep it under wraps for very long!

    Amazing mod as always, Wondible - your work never ceases to impress me :)
  5. wondible

    wondible Post Master General

    Messages:
    3,299
    Likes Received:
    2,089
    Added some baby-teeth to the player restrictions, players should no longer be able to use copy-paste hotkeys.

    However, I'm doubtful of providing the same level of restriction on player control. The game uses the same api calls during normal play and post-defeat spectator modes. You can't just blanket disable them, so it's left at the current "UI disabled" state.
    cwarner7264 likes this.
  6. trialq

    trialq Post Master General

    Messages:
    1,295
    Likes Received:
    917
    I can see this being really good for a sort of team game, where one player is a spectator and credits to purchase items are acquired over time (possibly including performance of the live player).
  7. wondible

    wondible Post Master General

    Messages:
    3,299
    Likes Received:
    2,089
    Added ping-on-paste. It's not rate-limited yet, so be careful with boom swarms ;^)
    trialq likes this.
  8. wondible

    wondible Post Master General

    Messages:
    3,299
    Likes Received:
    2,089
    Cleaned up proof-of-concept ping implementation and got it working on PIP
  9. wondible

    wondible Post Master General

    Messages:
    3,299
    Likes Received:
    2,089
    Limited pings to 0.5 second (could still be spammy, but should still be individual for many smaller, slower pastes). Added counter (in the devmode box) of pasted units; resets after two seconds.
    cwarner7264 likes this.
  10. shiwanabe

    shiwanabe Member

    Messages:
    82
    Likes Received:
    32
    I've been trying to use this for some testing of balance and such, and I've not managed to get anything to actually spawn. Checking with the normal cheats, copy/pasting still works, but I've not managed to get anything to paste while using this mod.

    As you've been talking about restrictions on who can paste, I'm wondering if I've gotten something wrong in there somewhere. Although, I have been trying to do this while being a spectator so I think I have everything right there...
  11. wondible

    wondible Post Master General

    Messages:
    3,299
    Likes Received:
    2,089
    I don't think this offers any advantage for balance testing over the regular cheat mods. Well, maybe the paste counter.

    Are you running any other mods? Have you tried disabling them?

    Are you comfortable copying devtools and running the debugger to look for messages?
  12. shiwanabe

    shiwanabe Member

    Messages:
    82
    Likes Received:
    32
    It probably doesn't offer any advantage over anything else for what I'm wanting to do. I'm mostly trying to as I can't find the other mod with the selection-box thing.

    Was running other mods, but yes I did try it with as many combinations I could think of that would help. (None, all cheats, PTE, stable) Only posted when I ran out of ideas.

    Being a software developer I'd hope I was comfortable with that, but I must admit to not knowing how to do that at this time. I'll take a look around and see if I can get it running.
  13. wondible

    wondible Post Master General

    Messages:
    3,299
    Likes Received:
    2,089
    You mean like Sandbox Unit Toolbox ?

    I'm not sure there is a good write-up on it at the moment.
  14. shiwanabe

    shiwanabe Member

    Messages:
    82
    Likes Received:
    32
    Yeah, that's the one. >.>
    I got it running, kinda weird to use, but it seems based on Chrome's devtools so it's at least a familiar navigation.

    Anyway, checking the console logging I'm noticing a lot of 'you are a puppet' this morning. Sadly I doubt this is what was happening to me last night as last night I was still getting the ping, just not the paste.

    ...

    Okay, after switching to PTE I've gotten the pings appearing again. And it's still giving the 'you are a puppet' response.

    ...

    And despite trying further, I can't manage to get the debugger into where you check whether everyone's spectators. Currently that's where I'm suspecting there's something going wrong, but I can't say for certain.

    As I need to head to work I'm going to have to leave it here, hopefully you have more luck with trying to find stuff that I have.
  15. wondible

    wondible Post Master General

    Messages:
    3,299
    Likes Received:
    2,089
    Okay, I can think of one way you could get both pings and no-paste. It sounds like it's loading the live_game extensions, but not triggering the exclusion to the general paste-disable. Can you paste me the result of `window.location.href` for the live_game (Live Game) scene ?

    I thought of another one - if the mod loads twice, for some strange reason. You should be able to see this if "puppetmaster" appears on the console of the live_game scene more than once at start.

    And actually, I discovered I forgot to check in some changes. I think it would only prevent the paste counter from working, but I pushed an update.

    I don't know what you mean by "get the debugger into where you check whether everyone's spectators" It's pretty much just the webkit debugger; you can inspect the dom, but often have to type things into console to inspect game state. `model` is the root of most of it, and most values are KO values that have to be called as functions.
  16. shiwanabe

    shiwanabe Member

    Messages:
    82
    Likes Received:
    32
    What I meant was that I could get a breakpoint into the '.puppet' method, but the calling method was within an area that seemed to be loaded into memory but not tied directly to the 'page'. This meant that while I could see the code that checks to see if someone is a spectator (I think on load of live-game. Not certain, it's my first time looking at this.) I couldn't get a breakpoint on anything within that file, as it would get unloaded from the debugger when the page is refreshed.

    Once I get home I'll see if I can look into the double loading and such. Can't do much without the code to poke at. ;)
  17. shiwanabe

    shiwanabe Member

    Messages:
    82
    Likes Received:
    32
    okay, putting window.location.href into console gets me: "coui://ui/main/game/live_game/live_game.html"

    Which seems to link to an empty file. I'm going to guess that might not surprise you, but... all known info.

    Only appears once.

    On further inspection, are users of this required to build it as you have outlined in README.RD? or is it able to function out-of-the-box? I notice that your change only seems to have affected the grunt.js file on git.

    If want to move this to messages or some other form of communication I would not object, as we are approaching the point I would consider this to be cluttering the thread.
  18. wondible

    wondible Post Master General

    Messages:
    3,299
    Likes Received:
    2,089
    Okay, as expected, no flipped slashes or anything. That's the string I'm checking against.

    A github archive should work because I check in the modified common.js, there will be a few unnecessary files uploaded to the server, but not many. Using the repo directly will upload a bunch of unnecessary files to the game server, and waiting is no fun.

    Last change affected modinfo, common, and common_extensions.
  19. wondible

    wondible Post Master General

    Messages:
    3,299
    Likes Received:
    2,089
    Clears control flags when the spectator panel is opened in order to re-enable army stat updates. Don't forget to select a player again when you need to paste something.

    Main issue left is how to activate the puppetmaster mode. Candidates (so far)

    - All Spectators (current); leaves extra controls on caster screens.
    - Additional client mod
    - A spectator types "I am the puppetmaster" in to public chat.
    - Additional keybinding
    cwarner7264 likes this.
  20. cwarner7264

    cwarner7264 Moderator Alumni

    Messages:
    4,460
    Likes Received:
    5,390
    Aha! So that's what was causing that. Brilliant QOL fix, thanks!

Share This Page