Page 1 of 1

Auto -re-/set defaults on first player join

Posted: Mon Aug 26, 2019 6:50 pm
by Misadventure
I arrived at a map earlier where players and admin were trying to fix some server variables that appear to have been adjusted earlier through a poll.

It occurred to me that when a first player joins (or last player leaves) a map, the server could automatically set all variables back to their defaults. Any poll changes then only persist as long as players are active on the map and do not remain for later players. Self fixing!

Re: Auto -re-/set defaults on first player join

Posted: Mon Aug 26, 2019 7:57 pm
by The Noah
I agree. Although I think /poll set should just be removed or defaulted to not being allowed.

Re: Auto -re-/set defaults on first player join

Posted: Mon Aug 26, 2019 9:54 pm
by tainn
I believe someone has actually written a script that did just that; reset all server variables once no players were on the map. It was either that or restarting the entire server with the default values. Uncertain.

Re: Auto -re-/set defaults on first player join

Posted: Tue Aug 27, 2019 4:52 am
by allejo
serverControl allows you to reset the server by it shutting down and letting a bash script restart it; look at the `ResetServerOnce*` settings. Without restarting the server, a simple plug-in (or PR to serverControl) could be added to just make a call to bz_resetALLBZDBVars.

Re: Auto -re-/set defaults on first player join

Posted: Tue Aug 27, 2019 11:07 am
by blast
It would probably be the ResetServerAlwaysFile actually, since that would restart the server every time it emptied. ResetServerOnceFile is more when you want to restart a server for maintenance (such as upgrading to a new bzfs binary) after it has emptied.

Re: Auto -re-/set defaults on first player join

Posted: Mon Sep 02, 2019 11:44 am
by Misadventure
Many thx for the pointers. I've just suggested it to one owner where a problem occurred recently.

/poll set can be fun & educational sometimes, but yes, should probably be concsiously enabled by an owner.

Re: Auto -re-/set defaults on first player join

Posted: Wed Sep 04, 2019 7:24 pm
by Zehra
The Noah wrote: Mon Aug 26, 2019 7:57 pm I agree. Although I think /poll set should just be removed or defaulted to not being allowed.
In versions 2.4.12 and upwards, poll set is not enabled by default.

Code: Select all

BZFlag 2.4.12  "Silence is Golden" (2017-10-29)
-----------------------------------------------

* Allow API to trigger CTF capture event - Vladimir Jimenez
* Allow setting default values for BZDB from API - Vladimir Jimenez
* Add bzu_getTeamFromFlag() convenience function - Vladimir Jimenez
* Add new functions to the bz_APIStringList - Vladimir Jimenez
* Add string utility functions to the API and TextUtils - Vladimir Jimenez
* Fixed an issue with ASCII characters from modified non-ASCII keys in SDL 2
    - Joshua Bodine
* Fixed compilation on macOS when using autotools/gcc - Mike Miller
* Don't send client queries on behalf of players - Vladimir Jimenez
* Removed pollSet as a default perm in bzfs - Vladimir Jimenez
* Player records canSpawn value no longer always returns true - Vladimir Jimenez
* bz_addURLJob() now supports setting HTTP headers - Vladimir Jimenez
* Made multisampling work on all platforms with SDL 1.2/2 - Joshua Bodine
* Add bz_eMuteEvent and bz_eUnmuteEvent to the API - Vladimir Jimenez
* Add configure --disable-server option - Jeff Makey
* Add bz_isPlayerAutoPilot() to the API - Vladimir Jimenez
* Add bz_eAutoPilotEvent to the API - Vladimir Jimenez
* Add bz_getServerOwner() API function - Vladimir Jimenez
* The _maxFlagGrabs BZDB setting is no longer a random number - Vladimir Jimenez
* Add API access for the handicap system - Jeff Myers, Vladimir Jimenez
* Remove Xcode references to deployment targets except for main project
    - Joshua Bodine
* Allow silencing unregistered players in the client - Scott Wichser
* Fix the /silence and /unsilence client commands - Scott Wichser
allejo wrote: Tue Aug 27, 2019 4:52 am serverControl allows you to reset the server by it shutting down and letting a bash script restart it; look at the `ResetServerOnce*` settings. Without restarting the server, a simple plug-in (or PR to serverControl) could be added to just make a call to bz_resetALLBZDBVars.
Are you sure this would do as expected?
Judging by the function name, it seems that it would simply reset all variables to the "defaults", instead of the values which may have been passed.(Not what is wanted in this case.)

It is not too difficult to write a plug-in which does perform a reset when the player count reaches zero.
So I may do so myself in the future. Or offer help to anyone who does wish to do so.

-Zehra

Re: Auto -re-/set defaults on first player join

Posted: Wed Sep 04, 2019 9:46 pm
by blast
Unless I'm mistaken, I'm pretty sure that BZDB values set at startup are set to be the default value. So a '/reset *', for instance, will reset all settings back to what the server config or world had defined.

Re: Auto -re-/set defaults on first player join

Posted: Sat Sep 14, 2019 4:08 pm
by Bertman
The reset will work in cases like this. The incident that started this thread was taken care of by disabling the polls on the server in question to avoid further problems. The bash script for the restart will also work as that is how I have my servers set up... Unfortunately it looks like poll abuse is still a thing, but it only gives temporary satisfaction to those who do abuse it. The tools that are available in BZFS and Linux are more than adequate to take care of these things. That being said, the problem has been solved on the server so go and enjoy the game.

Re: Auto -re-/set defaults on first player join

Posted: Sat Sep 14, 2019 11:33 pm
by Zehra
Server owners should already be aware of the permissions from global groups and how to configure them, especially the defaults.
Three simple signs (!, +, -) can be used to deny, grant and omit permissions from various global groups.
Additionally, poll "set" abuse need not be a concern for server owners who have updated to 2.4.12 and above as by default, the pollSet permission is not granted.

For those who may need assistance in setting up permission files for global groups, feel free to private message me.

-Zehra

Re: Auto -re-/set defaults on first player join

Posted: Sun Sep 15, 2019 1:33 am
by Bertman
Actual server owners work together pretty well in this game. The collective experience and Linux knowledge among us is pretty good. That's how these sort of problems get resolved pretty quickly. As stated before, the problem has been taken care of.