[SM Plugin][RELEASE] Surrender

Discussion in 'Coding' started by Neoony, Aug 8, 2017.

  1. Neoony

    Neoony Member

    Messages:
    1,313
    Likes Received:
    85
    Trophy Points:
    0
    Surrender
    [SR]
    v0.1
    Created by Neoony


    Thanks to
    Trump a.k.a Kidpaler - helping testing
    Mr. X. - helping testing
    Mikleo - Good SM tips
    And people in this thread :)


    Main project site: https://git.empiresmod.com/sourcemod/Surrender
    Releases: https://git.empiresmod.com/sourcemod/Surrender/tags

    Currently unstable! v0.1
    Direct link to the latest release v0.1 (Get this!) : https://git.empiresmod.com/sourcemo...5445b6ac26bd197e78457ff9b3/Surrender_v0.1.zip
    Dont forget to set your config!
    Defaults should work too :P

    v0.1 Release notes:
    Generally tested
    Needs some heavy real world testing
    Mostly the voting part

    ----

    Features:
    - Surrender.
    - Delay CV explosion.
    - Set requirement for amount of people needed for !sr/!surrender to start a vote. And how often it resets.
    - Set vote time restrictions. Time after round started or time after failed vote.
    - Set how long the surrender vote lasts for.
    - Set how many minimum players needed in a team for surrender to work.
    - Set vote threshold percentage.
    - Config file.


    ----

    Issues & Planned features:
    https://git.empiresmod.com/sourcemod/Surrender/issues

    ----

    Commands:
    Code:
    "sm_sr"
    "Surrender. In chat: !sr"
    
    "sm_surrender"
    "Surrender. In chat: !surrender"
    
    Cvars:
    Code:
    "sr_howmany" "def. 2"
    "How many times someone in a team needs to enter !surrender, before the vote starts."
    
    "sr_timer" "def. 120"
    "When someone in the team enters !surrender, it will start this timer. At the end of the timer. The amount of !surrender entered gets reset. (Seconds)"
    
    "sr_votetimer" "def. 30"
    "How long should the surrender vote last for. (Seconds)"
    
    "sr_restricttime" "def. 120"
    *"How long should !surrender be restricted for after unsuccessful vote. (Seconds)"*
    
    "sr_restrictstarttime" "def. 300"
    "How long should !surrender be restricted for after round has started. (Seconds)"
    
    "sr_minplayers" "def. 6"
    "How many players needed for surrender to work. (Players in a team)"
    
    "sr_st" "def. 80"
    "How many must vote yes for the vote to be successful. (Percentage, min 50, max 100)"
    
    "sr_howlong" "def. 60"
    "How long to wait after a successful surrender vote to kill the CV (Seconds)"
    
    --

    Changelog:
    Code:
    v0.1
    - First release  
     
    Last edited: Aug 14, 2017 at 9:45 PM
    complete_ and Mikleo like this.
  2. Xyaminou

    Xyaminou Member

    Messages:
    1,224
    Likes Received:
    118
    Trophy Points:
    0
    Thank you Neoony.

    I would like to have a surrender plugin on my server, however, like I said before, I still don't feel comfortable with the current way.

    I would need options such as,
    • Approved by Commander: if the vote passes it has to be approved by the team's commander.
    • Approved by Commanders: same as above but has to be approved by both commanders.
    • Approved by Admins: after the vote passes the admins have a short time to deny it. (Yes, no to accept it, to deny it, because admins like to AFK)
    • Commanders Agreement: override the % of players needed, only requires both commanders to agree. (and admin(s) if the option is activated)

    I will say I don't know if any of these actually works better, but you know me I'm a Commander Supremacist...
     
    Neoony likes this.
  3. Mikleo

    Mikleo Member

    Messages:
    144
    Likes Received:
    84
    Trophy Points:
    0
    I don't really like the idea of having the whole team vote before someone has to approve/deny it. I think if your going to go that route it is best if the team commanders/admins are able to veto the vote while it is still going on as well as for 20 seconds after it finishes . While I'm an avid supporter of surrender, I think a team vote can be disruptive to team moral and I think the teams commander should be able to shut that down instantly to get their players to refocus on the game if that's what they want to do. There is no point waiting through a long surrender vote only for a commander or admin to say no.
     
    Last edited: Aug 9, 2017
    Neoony likes this.
  4. Neoony

    Neoony Member

    Messages:
    1,313
    Likes Received:
    85
    Trophy Points:
    0
    I plan to add:
    Stop surrender by admin. https://git.empiresmod.com/sourcemod/Surrender/issues/4
    At any time.

    Surrender by commander only https://git.empiresmod.com/sourcemod/Surrender/issues/1
    Which will be optional.

    Hoping that should more or less cover most of these points?
    As I rather agree with Mikleo...so I would rather have things start properly...rather than making them verifiable by approving.

    Not saying I wouldnt implement some of those later.

    EDIT:
    Or...maybe another option could be making surrender startable by anyone in the team like it is...but start of the vote must be confirmed by commander?

    Added to possible planned features. https://git.empiresmod.com/sourcemod/Surrender/issues/5
     
    Last edited: Aug 9, 2017
  5. Xyaminou

    Xyaminou Member

    Messages:
    1,224
    Likes Received:
    118
    Trophy Points:
    0
    Mikleo is right.

    Can you also add a cvar to enable/disable surrender? Maybe have it say "surrender is disabled" when someone enters !surrender.
     
    Neoony likes this.
  6. D.D.D. Destroyer

    D.D.D. Destroyer Member Staff Member Moderator

    Messages:
    9,294
    Likes Received:
    66
    Trophy Points:
    0
    My suggestion is, make the commander's vote weighted, as in the commander's vote counts as an amount of 'normal' votes, to give him more power over a vote.
     
    Neoony likes this.
  7. Lazybum

    Lazybum :D Staff Member Moderator

    Messages:
    4,722
    Likes Received:
    159
    Trophy Points:
    0
    I think I agree with destroyer here, that sounds a bit more fair. I mean if the whole team is trying to surrender even if the commander thinks there's a way to win, he isn't going to be able to get enough morale to go with his plans. Somewhat likewise, if only half the team is giving up but the commander also wants to give up I don't think the rest of the has a chance, at that point in the game it's incredibly difficult to find a commander willing to put in effort to replace current comm and you really can't do much without one.
     
    Neoony likes this.
  8. VulcanStorm

    VulcanStorm Developer Staff Member Moderator

    Messages:
    538
    Likes Received:
    54
    Trophy Points:
    0
    @Neoony

    we just tried it today. and some bugs were found.

    It doesn't say how many votes are needed to surrender, nor how many people have already voted.
     
    Neoony likes this.
  9. Neoony

    Neoony Member

    Messages:
    1,313
    Likes Received:
    85
    Trophy Points:
    0
    Yep, sorry about that xD
    https://git.empiresmod.com/sourcemod/Surrender/issues/7

    +new issues and suggestions added
    https://git.empiresmod.com/sourcemod/Surrender/issues

    Currently unstable! v0.1

    Thanks for the test, feedback and suggestions ;)
    I will get it into better state next version and probably make some test especially for the "sr_howmany" feature.


    Sounds good.
    I wonder if it might combine well with commander having to accept the start of the vote.
    But I guess that might make trouble if team wants to surrender but not the comm?
    But yeah, the weight sounds like it can somewhat nicely split the choice between the team and comm and make it more equal (if set up properly)
     
  10. VulcanStorm

    VulcanStorm Developer Staff Member Moderator

    Messages:
    538
    Likes Received:
    54
    Trophy Points:
    0
    I think each player on the team should be treated equally, regardless of who's in the CV. As how do you decide who the commander is? Especially if they're not in the CV at the time, or are dead without the ability to respawn...

    What about giving the commander the deciding vote on a tie? Instead of weighting their vote.

    Although... That would make the surrender requirement at about 50%, so if over half the team want to give up, then give up, which does seem a tad pessimistic. :|

    Also, can you make a surrender vote for non-commander mode? We played a round on fogtown and it was basically prolonged by 10 minutes as we waited for the tickets to finally drain.
     
    Neoony likes this.
  11. Mikleo

    Mikleo Member

    Messages:
    144
    Likes Received:
    84
    Trophy Points:
    0
    You could always do the same thing squadcontrol does and use the last person in the cv.

    You could have used emp_sv_destroy_cv [2/3] to kill the cv if you wanted.

    You can also end any game including infantry like:
    int paramEntity = FindEntityByClassname(-1, "emp_info_params");
    AcceptEntityInput(paramEntity, "InputNFWin");
    AcceptEntityInput(paramEntity, "InputImpWin");

    In case you didn't know that already.

    Don't really think the commander should need to accept the start of vote. I think if the commander votes no and you have the setting set it should just cancelvote/cancelmenu and say that the commander has vetoed the surrender vote.

    If you want to add a setting where the enemy comm has a choice, when the surrender vote starts send them a menu: do you want to veto the surrender vote? which does the same thing. As well as giving admins a command that vetoes as well.
     
    Last edited: Aug 12, 2017
    Neoony likes this.
  12. Neoony

    Neoony Member

    Messages:
    1,313
    Likes Received:
    85
    Trophy Points:
    0
    Yep.

    You just blew my mind here xD
    Certainly better than this:
    new String:commnf[256];
    Format(commnf,256,"emp_nf_commander");
    new ents=GetMaxEntities();
    new ent;
    for(new i=1;i<=ents;i++)
    {
    if(IsValidEntity(i))
    {
    new String:class[256];
    GetEdictClassname(i,class,256);
    if(StrEqual(class,commnf,false))
    {
    ent=i;
    break;
    }
    }
    }
    SDKHooks_TakeDamage(ent, 0, -0, 9999.0, DMG_GENERIC, -1, NULL_VECTOR, NULL_VECTOR);
    Used that already in NCEV...took a bit of time to figure out xD
    Totally missed that command xD

    Nice.
    I knew I was gonna have to figure that one out xD ( https://git.empiresmod.com/sourcemod/Surrender/issues/6 )
    Thanks a lot :)

    ----

    Well, that was mostly about the idea to not make the team go through a vote, if commander is gonna simply cancel it. (to reduce useless votes / to catch failed sooner)
    Also if comm accepts start of the vote, it would also count as his "yes".

    Think if commander should had a chance to stop the vote, then it should be at the start.
    But that is completely open to new thoughts :P


    Yea, Iam not much into giving enemy team any say, so far...

    And admins interrupting the surrender vote, while it happens, or after, is already in for next version. After using that command, it will also set the usual time restriction of failed vote.
    And then there will be a separate admin command which will simply disable any surrender, until end of the map.
     
  13. VulcanStorm

    VulcanStorm Developer Staff Member Moderator

    Messages:
    538
    Likes Received:
    54
    Trophy Points:
    0
    I personally think the enemy team should have no input at all over a surrender vote. Otherwise this could be used to grief and troll their opposition by refusing to let them end the round. We already lose players when a match goes really badly, or people disconnect or spectate as the 10 minute resistance struggle isn't ending fast enough.

    I agree with admins being able to cancel a surrender, but I'm unsure if that would ever happen? Since the team would just ignore it, or vote no.

    Maybe a timer between votes, so it can't be tried too soon after the last one. This would stop people spamming surrender vote.
     
    Neoony and D.D.D. Destroyer like this.

Share This Page