w3gh / ghostplusplus

Automatically exported from code.google.com/p/ghostplusplus
Other
7 stars 7 forks source link

Autohost delay #111

Open GoogleCodeExporter opened 9 years ago

GoogleCodeExporter commented 9 years ago
This should be a simple task i think, so i wondered if it isn't already 
implemented or suggested, but i didn't find anything.

There should be an adjustable delay between auto-hosted games. It often happens 
that a game is over or you unhost a game and the bot instantly starts a new one 
although you want to host a different map without disabling the auto-host. The 
time you have between unhosting and new auto-hosted game is extremely short, 
this is why it should be adjustable or at least longer.

Original issue reported on code.google.com by rubih...@gmx.de on 30 Mar 2011 at 10:01

GoogleCodeExporter commented 9 years ago
Yes pls, having same problem here

Original comment by felixam...@gmail.com on 15 Jun 2011 at 6:32

GoogleCodeExporter commented 9 years ago
I applied these changes to ghostone, but should be basically the same..

Open ghost.h and add:

bool m_AutoHostPause;

Open ghost.cpp, look for CGHost :: CGHost( CConfig *CFG ) and add:

m_AutoHostPause = false;

still in ghost.cpp search for the autohost part, e.g.
if( !m_AutoHostGameName.empty( ) && m_AutoHostMaximumGames != 0 && 
m_AutoHostAutoStartPlayers != 0 && GetTime( ) - m_LastAutoHostTime >= 30 )

Change that to

if( !m_AutoHostGameName.empty( ) && m_AutoHostMaximumGames != 0 && 
m_AutoHostAutoStartPlayers != 0 && GetTime( ) - m_LastAutoHostTime >= 30 && 
m_AutoHostPause == false )

Go to bnet.cpp and add a new command to the Admin commands, e.g. right below 
!AUTOSTART

                //
                // !AUTOPAUSE
                //

                if( ( Command == "autopause" || Command == "ap" || Command == "pause" ) && ( IsRootAdmin( User ) ||  IsAdmin( User ) ) )
                {
                        if( Payload == "off" )
                        {
                                    m_GHost->m_AutoHostPause = false;
                                    QueueChatCommand( "Autohost pause: OFF" , User, Whisper);
                        }

                        if( Payload.empty( ) || Payload == "on" )
                        {
                                    m_GHost->m_AutoHostPause = true;
                                    QueueChatCommand( "Autohost pause: ON" , User, Whisper);
                        }
                }

At last search for the !PUB command in bnet.cpp being used to host your 
individual game (and to all kinds of !PUB* commands there might be). Search 
within the pub command for something like

m_GHost->CreateGame( m_GHost->m_Map, GAME_PUBLIC, false, GameName, User, User, 
m_Server, Whisper );

and add right above the following:

                                        if ( m_GHost->m_AutoHostPause == true ) {
                                                QueueChatCommand ( "Starting to autohost afterwards" );
                                                m_GHost->m_AutoHostPause = false;
                                        }

hf

Original comment by angelus...@gmail.com on 28 Jul 2011 at 4:26

GoogleCodeExporter commented 9 years ago
I am not sure what exactly you are requesting, but I have modified auto-rehost 
delay on my own, and made sure that if anyone does .pub too often it goes 
always by delay. Because looking at list of games and seeing one game on two 
rows next to each other sometimes...

When I am playing a map, and I know that we will end in less than a minute or 
two, even before I leave the current map/game, nothing is stopping me from 
whispering my bot and say ".pub" ... simple easy.
Besides, if you play and autohosted game in meantime starts on it's own you 
would have to wait anyway.

Original comment by random...@gmail.com on 25 Oct 2012 at 6:56