.com.unity Forums
  The Official e-Store of Shrapnel Games

This Month's Specials

Raging Tiger- Save $9.00
winSPMBT: Main Battle Tank- Save $6.00

   







Go Back   .com.unity Forums > Illwinter Game Design > Dominions 3: The Awakening

Reply
 
Thread Tools Display Modes
  #1  
Old June 18th, 2010, 10:25 AM
Gandalf Parker's Avatar

Gandalf Parker Gandalf Parker is offline
Shrapnel Fanatic
 
Join Date: Oct 2003
Location: Vacaville, CA, USA
Posts: 13,736
Thanks: 341
Thanked 479 Times in 326 Posts
Gandalf Parker is on a distinguished road
Default 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.
Reply With Quote
  #2  
Old June 18th, 2010, 10:27 AM
Gandalf Parker's Avatar

Gandalf Parker Gandalf Parker is offline
Shrapnel Fanatic
 
Join Date: Oct 2003
Location: Vacaville, CA, USA
Posts: 13,736
Thanks: 341
Thanked 479 Times in 326 Posts
Gandalf Parker is on a distinguished road
Default 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.
Reply With Quote
  #3  
Old June 18th, 2010, 10:27 AM
Gandalf Parker's Avatar

Gandalf Parker Gandalf Parker is offline
Shrapnel Fanatic
 
Join Date: Oct 2003
Location: Vacaville, CA, USA
Posts: 13,736
Thanks: 341
Thanked 479 Times in 326 Posts
Gandalf Parker is on a distinguished road
Default 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.
Reply With Quote
  #4  
Old June 18th, 2010, 11:02 AM

thejeff thejeff is offline
General
 
Join Date: Apr 2005
Posts: 3,327
Thanks: 4
Thanked 133 Times in 117 Posts
thejeff is on a distinguished road
Default 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.
Reply With Quote
  #5  
Old June 18th, 2010, 11:18 AM
Gandalf Parker's Avatar

Gandalf Parker Gandalf Parker is offline
Shrapnel Fanatic
 
Join Date: Oct 2003
Location: Vacaville, CA, USA
Posts: 13,736
Thanks: 341
Thanked 479 Times in 326 Posts
Gandalf Parker is on a distinguished road
Default 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
Reply With Quote
  #6  
Old June 18th, 2010, 11:21 AM
Gandalf Parker's Avatar

Gandalf Parker Gandalf Parker is offline
Shrapnel Fanatic
 
Join Date: Oct 2003
Location: Vacaville, CA, USA
Posts: 13,736
Thanks: 341
Thanked 479 Times in 326 Posts
Gandalf Parker is on a distinguished road
Default 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
Reply With Quote
  #7  
Old June 19th, 2010, 10:30 AM
Gandalf Parker's Avatar

Gandalf Parker Gandalf Parker is offline
Shrapnel Fanatic
 
Join Date: Oct 2003
Location: Vacaville, CA, USA
Posts: 13,736
Thanks: 341
Thanked 479 Times in 326 Posts
Gandalf Parker is on a distinguished road
Default Re: Dom3 programming/scripts to reset timers

Quote:
Originally Posted by thejeff View Post
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)
Reply With Quote
  #8  
Old June 19th, 2010, 10:38 AM
Gandalf Parker's Avatar

Gandalf Parker Gandalf Parker is offline
Shrapnel Fanatic
 
Join Date: Oct 2003
Location: Vacaville, CA, USA
Posts: 13,736
Thanks: 341
Thanked 479 Times in 326 Posts
Gandalf Parker is on a distinguished road
Default 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
Reply With Quote
  #9  
Old June 19th, 2010, 10:40 AM
Gandalf Parker's Avatar

Gandalf Parker Gandalf Parker is offline
Shrapnel Fanatic
 
Join Date: Oct 2003
Location: Vacaville, CA, USA
Posts: 13,736
Thanks: 341
Thanked 479 Times in 326 Posts
Gandalf Parker is on a distinguished road
Default 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.
Reply With Quote
  #10  
Old June 19th, 2010, 10:56 AM
Gandalf Parker's Avatar

Gandalf Parker Gandalf Parker is offline
Shrapnel Fanatic
 
Join Date: Oct 2003
Location: Vacaville, CA, USA
Posts: 13,736
Thanks: 341
Thanked 479 Times in 326 Posts
Gandalf Parker is on a distinguished road
Default 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?
Reply With Quote
Reply

Bookmarks

Tags
gandalf parker, linux, script, server, timer

Thread Tools
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is On

Forum Jump


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


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