.com.unity Forums

.com.unity Forums (http://forum.shrapnelgames.com/index.php)
-   Dominions 3: The Awakening (http://forum.shrapnelgames.com/forumdisplay.php?f=138)
-   -   Dom3 programming/scripts to reset timers (http://forum.shrapnelgames.com/showthread.php?t=45813)

Gandalf Parker June 18th, 2010 10:25 AM

Dom3 programming/scripts to reset timers
 
This is turning into a pain.
edited note: this all applies to direct connect but comments about the pbem differences acceptable also

Dom3 --hours 24 --quickhost game
is a fairly standard setting. Quickhost it if all the turns are in, otherwise at 24 hours even if someone hasnt done their turn. But if someone wants to change the maximum time or worse yet a temporary extension then its a pain.

The best answer would be if Dom3, like other server programs, would recognize external requests to reread its files and settings. But it doesnt. Direct connect is nice in many ways but it has the drawback of requiring shutdown for almost any change. I should mention that the game DOES have options for things like hosting everyday at 4am or Mon/Wed/Fri at midnight. That would make things easier to manage and much easier on server loads but no one seems to ever choose that for their games.

Ive considered it quite abit but it always comes up "impossible" (meaning of course, possible but more time/effort than its worth). Maybe if I gripe abit here someone more capable than I might smooth some of it out.

Gandalf Parker June 18th, 2010 10:27 AM

Re: Dom3 programming/scripts to reset timers
 
OK the game started with --hours 24 --quickhost
Now I get a request for changing it to 36 hours. No problem. Take the game down, change the script to --hours 36 --quickhost, start the game back up.

Now I get another request, this time for an extension. Dont change the timer, just add 6 hours to it. Grrrrr..... ok. Take down the game, --hours 42 --quickhost, restart. When you notice that the game has hosted, take it down, --hours 36, restart.

But wait, theres more. The players are watching the onscreen countdown. When you got the request, you did the change when the timer showed 8 hours to go. So you extended it too far. And by the time you saw the hosting, it was 3 hours into the timer and you reset it too far. I have things to do. I want to go out. I dont want to catch it RIGHT at a specific time.

OK...
so I should be able to use the --preexec --postexec switches to manage this...
IF there is a change.sh then instead of hosting, SHUTDOWN Dom3, switch the change.sh for restart.sh, RESTART.
But that would start the timer and go 36 hours till next hosting. Also what happens to the chaining of shells? Which preexec is still running? Plus shutting down the game at that point might catch someone logged into the game trying to squeeze under the wire which can create corrupted files. And some people never disconnect, or they incorrectly disconnect (using the big red X instead of quit/disconnect), so it never looks like no one is connected to some of the games.

Gandalf Parker June 18th, 2010 10:27 AM

Re: Dom3 programming/scripts to reset timers
 
So it becomes
IF there is a change.sh
and IF there are no connections
then SHUT DOWN the game
FORCEHOST the game
COPY change.sh to restart.sh
restart the game
delete the change.sh

the headache now becomes making it generic. Which dom3 game am I so I dont shut down the wrong one. Which port is it running on so I can check for connections.

thejeff June 18th, 2010 11:02 AM

Re: Dom3 programming/scripts to reset timers
 
Wouldn't it make more sense to do that as a postexec?
At least you wouldn't have to forcehost then.

Can you still get corrupted turn files if it hosts and then shuts down while someone was connected? I've never seen this problem, but I haven't run a direct connect game in awhile.

And can you get connection info from the game, instead of checking the port yourself? I remember it displays who's connected.

Gandalf Parker June 18th, 2010 11:18 AM

Re: Dom3 programming/scripts to reset timers
 
Post exec would still have to shut down the game. On the one hand it would avoid the problem of force-hosting the game. On the other hand it would extend the pause time while rabid players download new turns. And if the timer is off by ANY measurable amount then I get complaints. Ive had complaints for the timers being off by minutes, much less *horror* if it was off by as much as an hour

Gandalf Parker June 18th, 2010 11:21 AM

Re: Dom3 programming/scripts to reset timers
 
The debug log (game.log) does show the connections. But some games never show "no" connections. The game is notorious for not seeing disconnects if the player just ends Dom3 before quitting the server. But I could try testing it to see if the wrong results are within acceptable misses

Gandalf Parker June 19th, 2010 10:30 AM

Re: Dom3 programming/scripts to reset timers
 
Quote:

Originally Posted by thejeff (Post 749321)
And can you get connection info from the game, instead of checking the port yourself? I remember it displays who's connected.

OK side thought...
The tail of the game.log looks like this:
allgang, Connections 0, Time 14h (quick host)
Arc+ Er+ Py- Ul+ Ti+ Mac- Aby+ Ca- Jo+ shi+ As+

The "Time XXh" shows the countdown. I could use that to avoid alot of the *&^$% date math. When I get "we want 6 hours added for just this turn" I cant just take down the game and add 6 to the --hours 24 switch then restart because the game might already be 7 hours into the timer. So restarting with --hours 30 is way more than they want. This used to mean checking the time-stamp on the ftherlnd file to see when it last hosted, adding the total force-time plus extension to that, then trying to figure out how much time is left to hit that new mark (yes I know its simple math but I hate simple math)

Im realizing now that I can take the "Time XXh" off the game log, add 6 to that, and change to the --hours X switch to that number for an accurate extension.

But knowing to make it --hours 13 to hit the new mark for the extension and restarting it still doesnt solve all the headaches. As soon as the game hosts, it will display a new timer based on a 13 hour limit. There is no way to set the game to "host in 13 hours then go back to 24 hours". Unless Im up and watching, or have that one game out of 100 contact me when it hosts, players will see the timer and rely on it getting pissed if it changes (no matter what they are told)

Gandalf Parker June 19th, 2010 10:38 AM

Re: Dom3 programming/scripts to reset timers
 
New thought:
if the new extension would have the game host on Monday at 5am and I change the switches from:
--hours 24 -q
to being
--hosttime 1 5 --hours 24 -q
then it should host at Mon 5am. And the countdown timer would include Mon 5am and 24 hours but since the 24 hours is sooner it should display that counter which gives me lots of time to take down the game and remove the --hosttime switch before the next Monday. This would avoid lots of confusion about the next hosting time

Gandalf Parker June 19th, 2010 10:40 AM

Re: Dom3 programming/scripts to reset timers
 
AARRGGHH
previous thought is no good either! Most extensions dont go to the limit. In fact, the purpose of the extension is specifically to avoid having the game host on forced-timer. If it quickhosts because the lagging player got his turn in (sometimes just squeezing under the time limit), then it will STILL host AGAIN when it hits the Monday 5am setting giving a double hosting and requiring a *shudder* rollback.

Gandalf Parker June 19th, 2010 10:56 AM

Re: Dom3 programming/scripts to reset timers
 
The only thing I can see is some extensive testing of post.sh
The problem there is that the programs job ID would be something like
5907 dom3 thisgame --preexec pre.sh --postexec post.sh

Now if the post shell decides it needs to reboot the game to a new timer, it will begin by killing the job 5907 dom3 thisgame --preexec pre.sh --postexec post.sh
and starting a new one such as
5919 dom3 thisgame --preexec pre.sh --postexec post.sh

But since job 5907 is the one which started the post.sh will it stop when that job is killed never getting to the line to create another?


All times are GMT -4. The time now is 06:11 PM.

Powered by vBulletin® Version 3.8.1
Copyright ©2000 - 2024, Jelsoft Enterprises Ltd.
Copyright ©1999 - 2024, Shrapnel Games, Inc. - All Rights Reserved.