Empires Pick-Up Game (PUG) Sourcemod Plugin [Server]

Discussion in 'Coding' started by ScardyBob, Aug 9, 2016.

  1. ScardyBob

    ScardyBob Member

    Messages:
    3,457
    Likes Received:
    30
    Trophy Points:
    0
    Empires Pick-Up Game (PUG) System [Server]
    v0.60 alpha
    Description:
    This is a Pick-Up Game (PUG) system for Empires. It is currently setup to play two matches on a map, switching sides between rounds. I've gotten it to the point where it automates much of the process of team selection and map changes so I figured I'd release it for any potential PUG organizers.

    How it works:
    • An admin sets the PUG map by typing !setpugmap <map> and activating it using !pugon
    • After the map switch, two players volunteer to be captains by typing !captain
    • Captain 2 picks the first side, while Captain 1 picks the first player via menus (player must be in spectator to be eligible to be chosen)
    • Captains can stop picking players by typing !endpick
    • When spec is empty, each side will get a 10min pre-game planning time, which can be skipped if both captains type !ready
    • After Round 1 is finished, the map will reload, and the teams will switch sides
    • The same teams will last until the pug is ended (via !pugoff). Use the !pugmap <map> command to change the map after the desired round.
    Requires:
    This is a Server Plugin that requires Sourcemod to run.

    Installation:
    Extract empirespug.zip to your /Empires/empires/addons/sourcemod/plugins/ directory, and reboot your server or type "sm plugins load empirespug" into your console or rcon.

    Commands:
    Admin
    • sm_pugon - Turns on the PUG
    • sm_pugoff - Turns off the PUG
    • sm_setpugmap <map> - Sets the PUG map
    • sm_pugmap <map> - Sets and immediately changes to the PUG map
    • sm_removecaptain - Removes a captain
    • sm_moveteam <Client ID> <Team 1/2> - Move player to specified team
    • sm_moveplayer <Player Name> <Side NF/BE/Spec> - Move player to the specified side
    • sm_allowswitch <0/1> - Toggles where players can freely move between sides (i.e. between BE/NF/Spec)
    • sm_picktime <s> - Changes the time till the remaining players in spec are randomized, default = 900s (15min)
    • sm_randomspec - Randomize all players in spec
    • sm_addtime <s> - Add time to the comm vote time
    Captain
    • sm_ready - Indicate your team is ready to start a match
    • sm_unready - Remove your teams ready
    • sm_leavecaptain - Step down as captain
    • sm_team - Pick your starting team (only available to Captain 2)
    • sm_pick - Pick a player
    • sm_endpick - Indicates the captain wants to random the remaining players
    All Players
    • sm_captain - Volunteer to be a captain
    • sm_currentcaptains - See the current captains
    • sm_currentpugmap - See the current PUG map
    • sm_pugstatus - See the current status of the PUG
    • sm_listteam - List the players on a team
    • sm_listclients - List every player on server by team, name, and client ID
    Changelog:
    • v0.1
      • Initial Public Release
    • v0.2
      • The PUG no longer ends after Round 2. It will continue with the same captains/teams until the !pugoff command is used
      • Added the !pugmap admin command so that the map can be changed after the desired round (otherwise the PUG will keep swapping back and forth on the same map)
      • Included the sourcecode file (empirespug.sp)
    • v0.3-0.4X
      • Various fixes for captain and player selection
    • v0.5X
      • Added !listteam function
    • V0.57
      • Fixes for player selection phase
      • Added !moveteam, !moveplayer, !listclients, and !allowswitching functions

    • V0.60
      • Added !addtime, !randomspec, !picktime, !endpick commands
      • Players in spec are randomly sent to teams after 15min (by default)
      • Captains can indicate they want to stop picking teams by typing !endpick
     

    Attached Files:

    Last edited: Sep 17, 2016
    Xyaminou, Tama, complete_ and 2 others like this.
  2. flasche

    flasche Member Staff Member Moderator

    Messages:
    13,299
    Likes Received:
    168
    Trophy Points:
    0
    awesome i hope this will make pugs easier to manage.
    how does it deal with more than two typing !captain?
     
  3. LordDz_2

    LordDz_2 Strange things happens here

    Messages:
    2,956
    Likes Received:
    93
    Trophy Points:
    0
    Bloody fucking great. Keep it up!
     
  4. Devourawr

    Devourawr Member

    Messages:
    1,970
    Likes Received:
    72
    Trophy Points:
    0
    Fucking brilliant.

    Now someone host a pug.
     
  5. Xyaminou

    Xyaminou Member

    Messages:
    1,369
    Likes Received:
    156
    Trophy Points:
    0
    My dream come true!
    Just two things

    Having people in spectator before a PUG match can sometimes lead to exploit by having people position their camera at strategic location before the round starts.
    That being said, picking from Unassigned on a public server would mean you're likely to pick AFKs (we all know how 1/4 of noob is always AFK).
    So maybe add a config option to chose if captains are going to pick from Unassigned (you'd have to restrict spectator) or from Spectator?

    Second thing, do captains have to pick all of the players? maybe you could add a command so the rest of the players just get auto-assigned when the captains have picked all the players they like?

    How will players that join after the beginning of the PUG be able to join teams? just auto-assign I suppose? Maybe add an option to have the pug automatically set a password when it's beginning?
     
  6. Paradox

    Paradox I am a gigantic asshole who loses people's hard wo

    Messages:
    6,926
    Likes Received:
    148
    Trophy Points:
    0
    Scaedybob is a god amongst men! Give em a statue!
     
  7. Caelo

    Caelo Member

    Messages:
    2,371
    Likes Received:
    5
    Trophy Points:
    0
    This could be (easily, I hope) fixed by letting the captains pick the players from spec and then after everyone is picked reload the map and then do the 10min. planning time.
    Having a password is fine as an option, but I wouldn't turn it on by default. Enforcing auto-teams for any newcomer would be better, I think, because having more people in a game is almost always better!
     
  8. blizzerd

    blizzerd Member

    Messages:
    10,552
    Likes Received:
    60
    Trophy Points:
    0
    Make a waiting room map to switch to, theres no need to reload the entire map for everyone.
     
  9. A-z-K

    A-z-K Member

    Messages:
    3,241
    Likes Received:
    215
    Trophy Points:
    0
    Thats pretty baller ScardyBob
     
  10. vipervicki

    vipervicki Member

    Messages:
    2,611
    Likes Received:
    130
    Trophy Points:
    0
    awesome!
     
  11. ScardyBob

    ScardyBob Member

    Messages:
    3,457
    Likes Received:
    30
    Trophy Points:
    0
    It basically prevents anyone past the first two people who type !captain from becoming captain, unless one of those captains resigns or is removed by an admin.

    Yeah, it shouldn't be too difficult to do that (I'm planning to add a config file so things such as the pre-game planning time, etc can be modified), though I may decide to bypass it by using blizzerd's 'waiting room map' to do all the choosing/voting.

    Right now, yes captains have to pick every last player in spectator. I was planning to just randomize the last 25% of players, but it might be better to have the captain type something like !randompick to indicate that they are done choosing.

    For now, I've not dealt with late joining players as the plugin is currently only setup for the scheduled type of PUGs (like the Winter/Summer ones). The teams are effectively 'unlocked' during the matches, so a late joining player can join either one right now. Its not ideal, but I didn't want to prevent people from playing until I have a way to deal with late joining players.

    Not a bad idea, so it would go regular map -> waiting room map (pick captains/comms/teams) -> pug map?
     
  12. Xyaminou

    Xyaminou Member

    Messages:
    1,369
    Likes Received:
    156
    Trophy Points:
    0
    Yeah a waiting room with indication about what's happening would be cool.
     
  13. Trickster

    Trickster Retired Developer

    Messages:
    16,576
    Likes Received:
    46
    Trophy Points:
    0
    Looks great, I wish this was around when I used to do pugs and scrims.

    2 thoughts though:

    I might not have read enough, but is there a function to uncaptain someone via admin? If someone types it as a joke would the map have to be reloaded? How does it handle a disconnect of a captain as well, can they just rejoin?

    How do you pick via the menu? Is it just the standard flick through pages source menu?
     
  14. ScardyBob

    ScardyBob Member

    Messages:
    3,457
    Likes Received:
    30
    Trophy Points:
    0
    Yup, any admin can remove a captain using the !removecaptain command (it pops up a menu to remove a captain). Also, the captain stays the captain even after a disconnect/rejoin. Players stop being captains either if they use !leavecaptain, an admin removes them with !removecaptain, or the PUG ends/is turned off (!pugoff).
    Its just the standard Source menu system, like the end of the round map votes. As far as I can tell, that's the only way to do a vote and/or selection system within Empires.
     
  15. Trickster

    Trickster Retired Developer

    Messages:
    16,576
    Likes Received:
    46
    Trophy Points:
    0
    Can I make a suggestion? I don't know how complex this is.

    Allow the captain to type

    !pick portionofplayernamehere

    at which point it brings up a menu with "pick X" 1 yes 2 no,

    based on which player it selected from the portion you typed in.

    So if I type !pick bob, it picks either Bob2 (Tama) or ScardyBob, then just asks for my confirmation. If it's the wrong one then I know I need to be more specific. It should probably still ask for the confirmation even if I type !pick Youzy and get a perfect match, just to be sure it wasn't a typo or whatever.

    I just think flicking through pages of menu will take ages, but typing could be a lot easier.
     
  16. ScardyBob

    ScardyBob Member

    Messages:
    3,457
    Likes Received:
    30
    Trophy Points:
    0
    I believe I can do something like that. So for example, if you types !pick bob, it would give you a menu with all the players with 'bob' in their name who are in spec.
     
  17. Trickster

    Trickster Retired Developer

    Messages:
    16,576
    Likes Received:
    46
    Trophy Points:
    0
    That's an even better solution. Awesome.
     
  18. blizzerd

    blizzerd Member

    Messages:
    10,552
    Likes Received:
    60
    Trophy Points:
    0
    TBH it would be stellar if captains can pick a method of picking players.

    Not high on the list of todo, but something like

    -Handpicked
    everyone is picked 1 for 1, if a captain does !pickrandom, he no longer gets to pick a player and is assigned one randomly on his turn to pick, if both do !pickrandom the rest is all distributed randomly.

    -50% random
    as soon as 50% remains, players are picked randomly.

    -Full random
    Everyone is randomly distributed, but at the end each captain get the opportunity to 'steal' 3 (1 per 10 in a team? other scaling methods?) players, (this so if all vets get randomized in one team the steals from 1 captain will be high level players while the steals from another will be pubbing proletariat, it wont be perfect but i don't see another way of implementing 'full random' without it just being imbalanced games every time.)
     
  19. Trickster

    Trickster Retired Developer

    Messages:
    16,576
    Likes Received:
    46
    Trophy Points:
    0
    If it's random then there's literally no point in it because the server can do emp_forceautoassign anyway. The whole point of this is to facilitate organised picking.
     
  20. Lazybum

    Lazybum :D Staff Member Moderator

    Messages:
    4,827
    Likes Received:
    190
    Trophy Points:
    0
    Any way this can support keeping teams through map changes? Usually when I run pugs I do several maps to help with variety, it's not like it's a scrim or anything. This still helps a ton though and I hope to abuse it for all it's worth in the upcoming pug.
     

Share This Page