With cordite in the air, splintered steel, shell casings and powder burns, there’s only one explanation...
Discuss & improve the game engine.

Moderators: sparcdr, torhu, Tequila

map cycle for server config discussion

Postby Joe Kari » Fri Jan 30, 2009 9:14 am

This topic give me some idea :
viewtopic.php?p=11579#11579

Here what I propose as a standard map cycle for server.cfg (BTW there will be more map in each map cycle ;) ) :

Code: Select all
set pl_dm1 "g_gametype 0 ; map dm_dry ; set pl_dm vstr pl_dm2 ; set nextmap vstr playlist"
set pl_dm2 "g_gametype 0 ; map dm_tillian ; set pl_dm vstr pl_dm3 ; set nextmap vstr playlist"
set pl_dm3 "g_gametype 0 ; map dm_hangemhigh ; set pl_dm vstr pl_dm4 ; set nextmap vstr playlist"
set pl_dm4 "g_gametype 0 ; map dm_dawnfort ; set pl_dm vstr pl_dm1 ; set nextmap vstr playlist"

set pl_dm "vstr pl_dm1"


set pl_br1 "g_gametype 5 ; map br_durango ; set pl_br vstr pl_br2 ; set nextmap vstr playlist"
set pl_br2 "g_gametype 5 ; map br_cobber ; set pl_br vstr pl_br3 ; set nextmap vstr playlist"
set pl_br3 "g_gametype 5 ; map br_hangemhigh ; set pl_br vstr pl_br4 ; set nextmap vstr playlist"
set pl_br4 "g_gametype 5 ; map br_dawnfort ; set pl_br vstr pl_br1 ; set nextmap vstr playlist"

set pl_br "vstr pl_br1"


set pl_du1 "g_gametype 1 ; map du_highnoon ; set pl_du vstr pl_du2 ; set nextmap vstr playlist"
set pl_du2 "g_gametype 1 ; map du_showdown ; set pl_du vstr pl_du1 ; set nextmap vstr playlist"

set pl_du "vstr pl_du1"


set playlist "vstr pl_dm"
set g_available_playlist "pl_dm pl_br pl_du"

set nextmap vstr playlist
vstr nextmap


It looks slightly more complicated at first sight, so let me explain ;)
This config support multiple playlist, and index of each playlist are stored (that's why "nextmap" should be "vstr playlist" everytime).
Basicly, you can switch playlist with the command "/playlist vstr pl_br" for example if you want the BR playlist. Then, if you type "/playlist vstr pl_dm", you go back to your deathmatch playlist without restarting from the begining of it.

About this line: set g_available_playlist "pl_dm pl_br pl_du", it does nothing for instance, but it could be a good idea to add a new vote, allowing players to choose from one of the server playlist. So this string contains all available playlist separated by a white space.

For example, rather than changing g_gametype through voting, choosing a playlist will do it better. For instance, if players want to play BR on a server with a Deathmatch map cycle, they have to call a vote at every end of map. Choosing the "pl_br" playlist will allow them to play BR at will.


And we could use Tequila's idea, let's say we got a cvar named "g_noplayer_command" that is executed everytime the last human player leave a server, we can go back to the default server's playlist. For example, if you want deathmatch by default, you will add this line to your server.cfg :
set g_noplayer_command "set playlist vstr pl_dm"


I really like that idea. What do you thing about that ?
User avatar
Joe Kari
SG Team
 
Posts: 879
Joined: Sun Sep 16, 2007 8:44 pm
Location: France



Postby Tequila » Fri Jan 30, 2009 1:46 pm

I like your ideas.
Thanks for such a nice work ;)
User avatar
Tequila
SG Team
 
Posts: 1100
Joined: Thu Nov 15, 2007 11:33 pm
Location: Montpellier, France



Postby Joe Kari » Thu Feb 05, 2009 7:59 pm

Now you can call a vote for a server playlist (with SVN rev130).
Only in the console, type:
/callvote playlist <playlistname>
A missing or bad playlist name display all available playlist.

This will only work with the new default server.cfg I'm currently writting (cause it needs playlist definition like at the begining of my thread).
User avatar
Joe Kari
SG Team
 
Posts: 879
Joined: Sun Sep 16, 2007 8:44 pm
Location: France



Postby Tequila » Fri Feb 06, 2009 11:35 am

Very nice, will try to update my server asap
User avatar
Tequila
SG Team
 
Posts: 1100
Joined: Thu Nov 15, 2007 11:33 pm
Location: Montpellier, France



Postby torhu » Sat Feb 07, 2009 5:46 am

Great idea, I love it. This has always been a pain in the backside. I also like the 'noplayer command' idea. :D


When I hear 'playlist' I think of music, why not just call it mapcycle? I'm sure someone will add a built-in music player in the future, I think there are q3 engine games with one already. 8)
In game: =SG=monSter
Monster Browser
User avatar
torhu
SG Team
 
Posts: 1125
Joined: Thu Jan 06, 2005 8:12 pm
Location: Norway



Postby Joe Kari » Sat Feb 07, 2009 12:50 pm

Well, I'm still thinking about the interface, sure I can change this to "mapcycle".

I need to know if you agree with those cvar name:

onEvent_playerConnect_do
onEvent_firstPlayerConnect_do
onEvent_playerDisconnect_do
onEvent_lastPlayerDisconnect_do

It's not exactly the cvar name convention, but I think it's good? Typically, I want that the server execute what is in those cvar when this event happen (allowing us to perform some basic server scripting). Adding *_do at the end is very explicit (IMO more than whithout the underscore, and much more than without the final "do"), anyone will understand that this is a command.

In the future, we can imagine having a lot more event, for example onEvent_teamKill_do, with a cvar like "triggering_player" that contain the client id of the team killer, and "triggering_playerName" that contain his nickname, etc... Allowing great flexibility for server admin.
User avatar
Joe Kari
SG Team
 
Posts: 879
Joined: Sun Sep 16, 2007 8:44 pm
Location: France



Postby Joe Kari » Sat Feb 07, 2009 6:15 pm

I have changed my mind,
onEvent_firstPlayerConnect_do is now onEvent_playerUpTo1_do
onEvent_lastPlayerDisconnect_do is now onEvent_playerDownTo0_do

In fact you can define in your server.cfg as many "onEvent_playerUpTo<integer>_do" and "onEvent_playerDownTo<integer>_do" as you will. I'm pretty proud of that :) Imagine you want to switch to a bank-robbery mapcycle everytime you have at least 8 players, but return to deathmatch when there are less than 8, you can write in your server.cfg:
set onEvent_playerUpTo8_do "set auto_mapcycle vstr mapcycle_bankrobbery"
set onEvent_playerDownTo7_do "set auto_mapcycle vstr mapcycle_deathmatch"

In my server.cfg, I have made thing in order that player can vote for a playlist, and if they do it, this playlist never change until the last human player leave. When the last player leave, the server go back to its auto_mapcycle behaviour that change mapcycle depending on the number of human player. Until the next mapcycle vote... Very interesting, doesn't it ?
It allows great flexibility for both server admin and players.

onEvent_playerConnect_do, onEvent_playerDisconnect_do, onEvent_playerUpTo<integer>_do and onEvent_playerDownTo<integer>_do are working on SVN rev135.
User avatar
Joe Kari
SG Team
 
Posts: 879
Joined: Sun Sep 16, 2007 8:44 pm
Location: France



Postby Pardner » Sat Feb 07, 2009 7:46 pm

Joe Kari wrote:In fact you can define in your server.cfg as many "onEvent_playerUpTo<integer>_do" and "onEvent_playerDownTo<integer>_do" as you will. I'm pretty proud of that :) Imagine you want to switch to a bank-robbery mapcycle everytime you have at least 8 players, but return to deathmatch when there are less than 8, you can write in your server.cfg:
set onEvent_playerUpTo8_do "set auto_mapcycle vstr mapcycle_bankrobbery"
set onEvent_playerDownTo7_do "set auto_mapcycle vstr mapcycle_deathmatch"

Wow! Thats great! I always wanted to see the map rotation be a little more randomized. Hehe most the servers now are running the default server scripts and have the same map roation. It will be cool to join a server and then suddenly have it switch between br_ and dm_ maps.
User avatar
Pardner
SG Team
 
Posts: 1786
Joined: Fri Nov 18, 2005 5:48 am
Location: MD, USA



Postby torhu » Sat Feb 07, 2009 8:44 pm

I'm not much of a BR player, so I'd probably shy away from servers that automatically switch to that mode. But I think I might be outnumbered on that one. :roll: I would be happy if servers would skip the big maps (like backwater) when there are too few players, though. Would that be possible with this system?

By the way, would the onEvent commands run when right away, or just when it's time for the next map?

As for the cvar names, I think onEvent_ pretty much nails it, so _do at the end is feels like a bit too much verbosity. Anyway, you forgot the plural 's' in some of the cvar names. ;)

Code: Select all
onEvent_playerUpTo8_do
onEvent_playerDownTo7_do

onEvent_playersUpTo8
onEvent_playersDownTo7

and:
g_availableMapcycle -> g_availableMapcycles
In game: =SG=monSter
Monster Browser
User avatar
torhu
SG Team
 
Posts: 1125
Joined: Thu Jan 06, 2005 8:12 pm
Location: Norway



Postby Joe Kari » Sat Feb 07, 2009 10:36 pm

@ Torhu:
Of course everything is possible ;)
I take BR in example cause I like this gametype a lot, but you can easily write mapcycle, so we can make a "mapcycle_small_dm" with all smallest map, and a "mapcycle_big_dm", or whatever server admin like ;)

If we are making a lot of mapcycle, I suggest to put them in a different file, that will be called by server.cfg at the end of it. Something like server_mapcycle.cfg. Just to keep a server.cfg simple.

Yes onEvent_ command run instantly. Just to be clear, in my example, the command only affect mapcycle, so it doesn't change the current map, but the next map will be picked from the new mapcycle.

If you want, you can have a different bot_minplayer, a simple example:
set onEvent_playersDownTo1 "set bot_minplayer 5"
set onEvent_playersUpTo2 "set bot_minplayer 2"
So if only one player is connected, he will play with 4 bots (more challenging), when a second player connect, all bots are leaving the game.
User avatar
Joe Kari
SG Team
 
Posts: 879
Joined: Sun Sep 16, 2007 8:44 pm
Location: France



Postby torhu » Sat Feb 07, 2009 11:12 pm

Joe Kari wrote:@ Torhu:
Of course everything is possible ;)
I take BR in example cause I like this gametype a lot, but you can easily write mapcycle, so we can make a "mapcycle_small_dm" with all smallest map, and a "mapcycle_big_dm", or whatever server admin like ;)

I was thinking without breaking the current mapcycle, but just switching between different lists could probably be good enough. :)

Joe Kari wrote:If we are making a lot of mapcycle, I suggest to put them in a different file, that will be called by server.cfg at the end of it. Something like server_mapcycle.cfg. Just to keep a server.cfg simple.

Yeah, I was even considering suggesting a system with plain map list files (one map each line). But using the cvar and command system is much more flexible, since you can have custom settings for each map. A bit messier, but I think the server admins can cope. ;)

Joe Kari wrote:Yes onEvent_ command run instantly. Just to be clear, in my example, the command only affect mapcycle, so it doesn't change the current map, but the next map will be picked from the new mapcycle.

Of course, I wasn't thinking... :oops:

Joe Kari wrote:If you want, you can have a different bot_minplayer, a simple example:
set onEvent_playersDownTo1 "set bot_minplayer 5"
set onEvent_playersUpTo2 "set bot_minplayer 2"
So if only one player is connected, he will play with 4 bots (more challenging), when a second player connect, all bots are leaving the game.

Nice :)
In game: =SG=monSter
Monster Browser
User avatar
torhu
SG Team
 
Posts: 1125
Joined: Thu Jan 06, 2005 8:12 pm
Location: Norway



Postby torhu » Mon Jul 20, 2009 3:57 pm

I tried the mapcycle feature, and fixed a bug in it (r262). I also made some other tweaks. And took the liberty of renaming g_availableMapcycle to g_mapcycles. :)

I noticed you checked in some code in r130 that is commented out. Are you planning to do more work on the feature? The cvar should probably be declared in the code, but is it done other than that?

Maybe the feature can be enabled on the test server, if it isn't already.
In game: =SG=monSter
Monster Browser
User avatar
torhu
SG Team
 
Posts: 1125
Joined: Thu Jan 06, 2005 8:12 pm
Location: Norway



Postby Joe Kari » Tue Jul 21, 2009 10:40 pm

Hi Torhu,

I need mainly to write a server.cfg that use all that, if I remember well, all that thing was working. I have fixed the bug that cause mapcycle to break in sg 1.0 (you know ? when the server is stuck on a map forever, until it is restarted).

For instance, I have started to work again on the game, but slowly, and I have worked only on mapping. I will soon finish what should be done on mapcycle, and propose few mapcycle, with adaptative behaviour (when player join or left).

I hope it will be usefull :)

I think it's already enable.
User avatar
Joe Kari
SG Team
 
Posts: 879
Joined: Sun Sep 16, 2007 8:44 pm
Location: France



Postby Joe Kari » Sun Aug 02, 2009 9:34 pm

So, I'm currently writing few .cfg files with some default mapcycles and server behaviour when players connect or disconnect.

For example, there are 3 automatic mapcycle for DM. When the number of human player is low, it switch to a mapcycle with small map, and fraglimit is set to 20. When there are several players, it switch to a mapcycle with medium range map, and fraglimit is set to 25. When there is many many players, it switch to a mapcycle that have the largest map, and fraglimit is set to 30.
When there is only 1 player, bot_minplayer is set to 4 to give a better challenge. When the last human player leaves, all bot are kicked to prevent server CPU load while no human are actually playing. Bot chat is enabled if there is only one player connected.

By the way, since all that things is set in .cfg files, server's admin can customize it at will. Everything is possible ;)

EDIT:
Usage of Duel mode's CVAR du_enabletrio and du_forcetrio are made wiser and dynamically now !
When there are 3, 6, 9, 12 and 15 players, there is only trio !
In other case, when there are 2 or 4 players, there is only duel, and for other number of players, trio are enabled but not forced.
User avatar
Joe Kari
SG Team
 
Posts: 879
Joined: Sun Sep 16, 2007 8:44 pm
Location: France



Postby torhu » Fri Oct 30, 2009 9:10 pm

Maybe the mapcycle voting feature would be more popular if it was included in the callvote menu?
In game: =SG=monSter
Monster Browser
User avatar
torhu
SG Team
 
Posts: 1125
Joined: Thu Jan 06, 2005 8:12 pm
Location: Norway



Next

Return to Code

Show Sidebar
Show Sidebar

User Control Panel

cron