Author Topic: Overtime  (Read 2746 times)

jitspoe

  • Administrator
  • Autococker
  • Posts: 18802
Overtime
« on: September 12, 2004, 07:05:45 PM »
I'm working on a small feature that will come in handy for matches and tournaments: overtime.  Basically if the timelimit runs up and the scores are tied, it tacks on an extra 2 minutes or so (manageable by cvar, of course) to the time.  Sounds simple, but there are a few scenarios I'd like to get input on:

1) If the score is 0 to 0, should it still go into overtime?  This could cause problems if a situation arises when it's impossible to score (ie: a map played with no flags on a no-elim server).  It would just keep going into overtime until everyone quit...  However it might also be possible to have a 0 to 0 score, though unlikely (maybe a tournament with a really low timelimit).  I guess I should make it toggleable, disabled by default (no overtime on 0 to 0 tie) but match/tournament servers could enable it.

2) Deathmatch: if the timelimit runs out and the two top players have the same number of kills but different deaths, should it go into overtime or should the person with the least deaths just win?

3) With 4-team maps (or any number of teams over 2), if  the score is, say 12 to 8 to 8 to 4, should it go into overtime to break the 8 to 8 tie, or just go into overtime if the top two teams are tied?  I'm thinking just the top two, but if you had a tournament in which you needed definite rankings for 1st-4th... I guess I can make another cvar for it.  If someone hits the fraglimit it could be a problem, though.  'spose I'll just put a check in for that, too.

Eiii

  • Autococker
  • Posts: 4595
Re: Overtime
« Reply #1 on: September 12, 2004, 08:56:41 PM »
3-- what if you put in a "SUDDEN DEATH" for the 2, 3 or 4 tied teams?
or
have a "contest"...put in 1 player from each team in the map, whoever gets elimd first loses. Best of 5? OOH! and a (cvar) min time limit to prevent camping.

jitspoe

  • Administrator
  • Autococker
  • Posts: 18802
Re: Overtime
« Reply #2 on: September 12, 2004, 09:23:49 PM »
Well, here's what my overtime check function does:

// returns true if:
// top two teams are tied and any score is > 0.
// top two teams are tied and overtime_0 is set.
// any two teams with players are tied and overtime_4team is set and any score is > 0.
// any two teams with players are tied and overtime_4team is set and overtime_0 is set.
// more than one player has the highest number of kills (more than 0) in DM
// all deathmatch scores are 0 and overtime_0 is set.

Eiii

  • Autococker
  • Posts: 4595
Re: Overtime
« Reply #3 on: September 13, 2004, 06:09:09 AM »
that looks good for the checking. Now make it do something! ;D
« Last Edit: September 13, 2004, 06:09:25 AM by eiii »

jitspoe

  • Administrator
  • Autococker
  • Posts: 18802
Re: Overtime
« Reply #4 on: September 15, 2004, 09:41:07 PM »
Code: [Select]
// returns true if:
// top two teams are tied and any score is > 0.
// top two teams are tied and overtime_0 is set.
// any two teams with players are tied and overtime_4team is set and any score is > 0.
// any two teams with players are tied and overtime_4team is set and overtime_0 is set.
// more than one player has the highest number of kills (more than 0) in DM
// all deathmatch scores are 0 and overtime_0 is set.
// tie qualifies as:
// - scores are same OR scores would be same with 2pt flag bonus (player carrying flag)
qboolean GameNeedsOvertime (void) // 1.802
{
     int pass;
     int scores[4];

     if (!overtime->value)
           return false;

     // Check both with and w/o flag bonus:
     for (pass=0; pass<2; pass++)
     {
           if (pass == 0)
           {
                 register int i;

                 for (i=0; i<maxteams; i++)
                       scores[i] = TeamsGetScore(i+1);
           }
           else
           {
                 edict_t *flag = NULL;
     
                 // Add flag bonus points
                 while (flag = G_Find(flag, FOFS(classname), "item_score"))
                       if (flag->teamnumber)
                             if (flag->owner && (!GetLivingPlayersOnTeam(flag->teamnumber) || GameIsGameOver()))
                                   scores[flag->owner->teamnumber - 1] += 2;
           }

           if (GameIsTeamsGame())
           {
                 TeamsCountPlayers();

                 if (overtime_4team->value)
                 {
                       register int i, j, total = 0;

                       for (i=0; i<maxteams; i++)
                             total += scores[i];

                       for (i=1; i<=maxteams-1; i++)
                       {
                             for (j=i+1; j<=maxteams; j++)
                             {
                                   if (scores[i-1] == scores[j-1] &&
                                         GetPlayersOnTeam(i) && GetPlayersOnTeam(j) &&
                                         (total > 0 || overtime_0->value))
                                   {
                                         return true;
                                   }
                             }
                       }
                 }
                 else
                 {
                       register int i, score, total = 0;
                       register int highest = 0;
                       register int winner = -1;

                       for (i=0; i<maxteams; i++)
                       {
                             score = scores[i];
                             total += score;

                             if (score > highest)
                             {
                                   highest = score;
                                   winner = i;
                             }
                             else if (score == highest)
                             {
                                   winner = -1;
                             }
                       }

                       if (winner == -1)
                       {
                             if (total || overtime_0->value)
                                   return true;
                       }
                 }
           }
           else // Deathmatch or other free-for-all style:
           {
                 gclient_t *cl;
                 gclient_t *cl_winner;
                 register int i;

                 cl_winner = GetGameWinner();

                 if (!cl_winner) // all scores are 0
                       return (overtime_0->value != 0.0f);
                 
                 for (i=0; i<game.maxclients; i++)
                 {
                       if (g_edicts[i+1].inuse)
                       {
                             cl = game.clients + i;

                             if (cl != cl_winner && cl_winner->resp.kills == cl->resp.kills)
                                   return true;
                       }
                 }

                 return false;
           }
     }

     return false;
}


Think I finally got it working. :)

Eiii

  • Autococker
  • Posts: 4595
Re: Overtime
« Reply #5 on: September 16, 2004, 06:59:08 PM »
Testing time!

jitspoe

  • Administrator
  • Autococker
  • Posts: 18802
Re: Overtime
« Reply #6 on: September 17, 2004, 08:21:14 AM »
I've spent over 2 hrs of testing alone.  'course that doesn't guarantee it will work 100%.

Eiii

  • Autococker
  • Posts: 4595
Re: Overtime
« Reply #7 on: September 17, 2004, 09:17:25 AM »
No amount of testing will guanantee it's workingness.

jitspoe

  • Administrator
  • Autococker
  • Posts: 18802
Re: Overtime
« Reply #8 on: December 17, 2004, 01:13:32 AM »
Seems to be working pretty well.  I'm surprised how many times it's gone into overtime on the pubs when I've played.

loial21

  • Autococker
  • Posts: 2807
Re: Overtime
« Reply #9 on: December 20, 2004, 11:14:46 PM »
about number 2

is there a way to configure not just kill/deaths but grabs , caps and time in game to an overall player score , seprate from the team score but considered to the over all team score in the event of a tie 

 in case of tie the over all score should brake allmost any tie among players ...

1 this would  lesson the amount of ties to almost none 

2 it solidifies a winner

for  example  and worth debate

1kill =3points to overall score/death-3/grab=1/cap=4
etc
divided by time in game

i dont claim to be accurate to the above but u get the jist
sorry so stupid  :-[
i have always wondered .....why it was never done that way in other quake mod(s) as well?

jitspoe

  • Administrator
  • Autococker
  • Posts: 18802
Re: Overtime
« Reply #10 on: December 21, 2004, 01:10:15 PM »
Eh... by number 2 you mean deathmatch?  How are you going to get grabs/caps in deathmatch mode?

loial21

  • Autococker
  • Posts: 2807
Re: Overtime
« Reply #11 on: December 21, 2004, 07:05:09 PM »
ehhhhhhh  my mistake  :-[

see what happens when you dont comprehend what you read ..and assume to much
 sorry about that

in deathmatches  the grab/cap  catagory would be nulled out in the over all score  ..of course

I belive its a decent idea worth exploring with others and  if its ok put it to the question on the Poll .....

...just wondering

jitspoe

  • Administrator
  • Autococker
  • Posts: 18802
Re: Overtime
« Reply #12 on: December 21, 2004, 10:12:05 PM »
Er, what's a decent idea?

loial21

  • Autococker
  • Posts: 2807
Re: Overtime
« Reply #13 on: December 21, 2004, 11:10:06 PM »
ok let try this..... Player ratings during the game?

during any game circumstance i would like to hit f1 to check my score .....like what you have now ...but one additional catagory  in the scoreboard
 
have a overall score or player rateing based on total  kills/deaths/grabs/caps/ppg kills/time in game etc...those are debateable

...the formula or "rating"  could also be considered in case of a tie

this less simplistic than what you doing now prehaps this belongs on a diffent thread sorry jits
 .....trying to help  :-[

jitspoe

  • Administrator
  • Autococker
  • Posts: 18802
Re: Overtime
« Reply #14 on: May 16, 2005, 10:23:56 PM »
I noticed a bug with overtime, oops.  When we were playing on warhouse.  Both teams had the flag, one team was 2 points behind the other.  The match ended.  Then it gave one team the flag points, evening the score, and went into overtime.  Guess my testing wasn't thorough enough.

Eiii

  • Autococker
  • Posts: 4595
Re: Overtime
« Reply #15 on: May 16, 2005, 11:50:18 PM »
Only one team? Ooooh. Because it checked and returned true. Easy fix!