skullernet / openffa

Free-for-all deathmatch mod for Quake 2
GNU General Public License v2.0
22 stars 11 forks source link

[FeatureRequest] How to prevent auto-restart of map after timelimit hit if there is no players? #18

Open amokmen opened 1 year ago

amokmen commented 1 year ago

Q2PRO-server with OpenFFA mod (without Warmup) automatically restarts map every time after timelimit. So, there are a lot similar log messages like this:

...
A [2020-10-14 02:25:55] 0 entities inhibited
A [2020-10-14 02:25:55] 0 teams with 0 entities
A [2020-10-14 02:25:55] 15 minutes remaining in match.
A [2020-10-14 02:30:55] 10 minutes remaining in match.
A [2020-10-14 02:35:55] 5 minutes remaining in match.
A [2020-10-14 02:39:55] 1 minute remaining in match.
A [2020-10-14 02:40:45] 10 seconds remaining in match.
A [2020-10-14 02:40:55] Timelimit hit.
...
A [2020-10-14 02:40:55] Map queue: 11 entries
A [2020-10-14 02:40:55] Couldn't find next map!
A [2020-10-14 02:41:05] 0 entities inhibited
A [2020-10-14 02:41:05] 0 teams with 0 entities
A [2020-10-14 02:41:05] 15 minutes remaining in match.
A [2020-10-14 02:46:04] 10 minutes remaining in match.
A [2020-10-14 02:51:04] 5 minutes remaining in match.
A [2020-10-14 02:55:04] 1 minute remaining in match.
A [2020-10-14 02:55:54] 10 seconds remaining in match.
A [2020-10-14 02:56:04] Timelimit hit.
...

I do not like such useless log spam. Is there any way to prevent restart map if there are no players at server?

Like server run 1st map once after start and if there are no players - stuck at intermission phase? And after player connection intermission ends as usual and map is restarted as usual.

joe0x04 commented 1 year ago

It looks like q2proded is replaying the same map because it can't find the next map file (look 10 lines down in your logs you posted). Are you able to manually change the map to all 11 in the list?

On Thu, May 18, 2023 at 3:46 AM amokmen @.***> wrote:

Q2PRO-server with OpenFFA mod (without Warmup) automatically restarts map every time after timelimit. So, there are a lot similar log messages like this:

... A [2020-10-14 02:25:55] 0 entities inhibited A [2020-10-14 02:25:55] 0 teams with 0 entities A [2020-10-14 02:25:55] 15 minutes remaining in match. A [2020-10-14 02:30:55] 10 minutes remaining in match. A [2020-10-14 02:35:55] 5 minutes remaining in match. A [2020-10-14 02:39:55] 1 minute remaining in match. A [2020-10-14 02:40:45] 10 seconds remaining in match. A [2020-10-14 02:40:55] Timelimit hit. ... A [2020-10-14 02:40:55] Map queue: 11 entries A [2020-10-14 02:40:55] Couldn't find next map! A [2020-10-14 02:41:05] 0 entities inhibited A [2020-10-14 02:41:05] 0 teams with 0 entities A [2020-10-14 02:41:05] 15 minutes remaining in match. A [2020-10-14 02:46:04] 10 minutes remaining in match. A [2020-10-14 02:51:04] 5 minutes remaining in match. A [2020-10-14 02:55:04] 1 minute remaining in match. A [2020-10-14 02:55:54] 10 seconds remaining in match. A [2020-10-14 02:56:04] Timelimit hit. ...

I do not like such useless log spam. Is there any way to prevent restart map if there are no players at server? Like server run 1st map once after start and if there are no players stuck at intermission phase?

— Reply to this email directly, view it on GitHub https://github.com/skullernet/openffa/issues/18, or unsubscribe https://github.com/notifications/unsubscribe-auth/ABAHKYITHDB37I5XWGXET23XGXHVXANCNFSM6AAAAAAYGDOXZQ . You are receiving this because you are subscribed to this thread.Message ID: @.***>

amokmen commented 1 year ago
  1. Server starts with map q2dm1
  2. Maps list file now (I left only 2 maps while testing) looks like this:
    # mapname       min_players     max_players     flags
    # mandatory     optional        optional        optional: 1 or 2 (1 = not automatically selectable; 2 = not votable)
    q2dm1           2               16              1
    q2dm2           2               16              1

So, It seems right, that engine/mod could not find next map, because there is limit "min players should be 2". I intentionally choose 2 (not 1, because I thought that 1 player could be dummy GTV observer). I did it because I thought, that server if could not find appropriate map would 'stuck' until there would be player connection. 2 players did not work, so, as next step, I put "1" into flag - but this did not work too...

And yes, server could see and change maps manually.

amokmen commented 1 year ago

This would restart q2dm1:

# mapname       min_players     max_players     flags
# mandatory     optional        optional        optional: 1 or 2 (1 = not automatically selectable; 2 = not votable)
q2dm1           0               16
q2dm2           2               16              1
amokmen commented 1 year ago

Probably I badly described what I want.

I want that server would not start any map w/o player(s).

What I want step-by-step:

  1. Server first run with mandatory map q2dm1.
  2. After timelimit hit 1st time, server would not restart any map - server would be in some 'stuck' condition in intermission.
  3. If player(s) connected, server starting operates as usual - starts map.

Main point is: no need to run maps (do useless work) if there are no players!

QwazyWabbitWOS commented 1 year ago

This behavior is handled by the game code, not the engine. It's controlled in G_RunFrame where it compares level.intermissiontime with level.time (or equivalents) and if it has a non-zero player count it sets level.exitintermission = true and calls ExitLevel.

I use a cvar named cycle_always to make this an option.

    if (level.intermissiontime && (level.intermissiontime < (level.time - scoreboardtime->value)))
    {
        // exit intermissions only if we have clients
        if (CountConnectedClients() || cycle_always->value)
            level.exitintermission = 1;
    }

    // exit intermissions
    if (level.exitintermission)
    {
        ExitLevel();
        return;
    }

In the case of OpenFFA, in skuller's version the logic resets the level if G_ExitLevel fails to find a successor map.

amokmen commented 1 year ago

@skullernet

[FeatureRequest] Is it hard to implement new Boolean cvar like 'restart_map_without_players'?