Solution for starting server with a random Level

Discussions about Servers
User avatar
sektor2111
Godlike
Posts: 6397
Joined: Sun May 09, 2010 6:15 pm
Location: On the roof.

Solution for starting server with a random Level

Post by sektor2111 »

Because I found a few issues at combining different game-types using the same type of Levels (the same real prefix), mutators were loaded incorrect at first run. Because I did not like this way, I did the start in other manner (with small patience - around 10 seconds).
....
Edit:
Run-Line

Code: Select all

UCC.EXE server ?Game=BotPack.DeathMatchPlus?Mutator=MapVoteLA_something.BDBMapVote,MyStarter.TheStart?difficulty=3 -log=server.log -ini=Server.ini
Pretty simple with 2 mutators one of them being mapvote to witness travel.

In Server.ini

Code: Select all

[URL]
Protocol=unreal
ProtocolDescription=Unreal Protocol
Name=The_Myself
Map=Entry.unr
LocalMap=Entry.unr
Host=
Portal=
MapExt=unr
SaveExt=usa
Port=7777
Class=Botpack.TFemale1
And Then content of TheStart

Code: Select all

class TheStart expands Mutator;

event PreBeginPlay()
{
		SetTimer(1,False);
}

event Timer()
{
	local string Map;
	Map=Level.GetURLMap();
	if ( Map ~= "Entry.unr")
	{
		if ( DeathMatchPlus(Level.Game) != None )
		{
			DeathMatchPlus(Level.Game).NetWait=0;
			DeathMatchPlus(Level.Game).RestartWait=0;
			DeathMatchPlus(Level.Game).bRequireReady=False;
			DeathMatchPlus(Level.Game).bNetReady=False;
			DeathMatchPlus(Level.Game).StartMatch();
			DeathMatchPlus(Level.Game).TimeLimit=3;
			DeathMatchPlus(Level.Game).RemainingTime=2;
		}
	}
	else
	{
		log (Self$" won't react.");
		return;
	}
}
It is uses Entry.unr declared in INI to start. It will wait a bit, then trigger start and end game when MapVote will take control for None votes getting a random map from list 5... even if exist only 4 will randomize one from these columns loaded else will get only maps from a single column. Starting + ending + automated voting in my config took a couple of seconds. I'm using this way also getting bored to start the same map over and over again not only because of bad mutators loaded randomly at first time.
User avatar
sektor2111
Godlike
Posts: 6397
Joined: Sun May 09, 2010 6:15 pm
Location: On the roof.

Re: Solution for starting server with a random Level

Post by sektor2111 »

As for "default" game-types using Bot in purpose to avoid a game-tie during start (previous working with multi MH types or such)

Code: Select all

class TheStart expands Mutator config; //using main configuration for delay proposal

var config float stDelay;
var bool bFirstTime; //Separate timer action

event PreBeginPlay()
{
		log (Self$" waiting "$stDelay$" seconds for travel check"); //Report configuration
		SetTimer(stDelay,False); //Fire timer but not looping
}

event Timer()
{
	local string Map;
	local Pawn P;

	Map=Level.GetURLMap();
	if ( Map ~= "UT-Logo-Map.unr") //This might be bigger
	{
		if ( DeathMatchPlus(Level.Game) != None )
		{
			if (!bFirstTime) //Is not already ran
			{
				DeathMatchPlus(Level.Game).NetWait=0;
				DeathMatchPlus(Level.Game).RestartWait=0;
				DeathMatchPlus(Level.Game).bRequireReady=False;
				DeathMatchPlus(Level.Game).bNetReady=False;
				DeathMatchPlus(Level.Game).TimeLimit=4; //Grant 4 seconds
				DeathMatchPlus(Level.Game).StartMatch(); //Start
				DeathMatchPlus(Level.Game).RemainingTime=3; //Say 3 seconds and here will enter Lord Bot
				bFirstTime = True; //now we have fired things up
				SetTimer(stDelay/2,False);
				return;
			}
			foreach AllActors (class 'Pawn', P) //second time we put something
			{
				if (P.PlayerReplicationInfo != None)
				{
					P.PlayerReplicationInfo.Score += 2; //First Pawn player has a score
					log (P.GetHumanName()@"has new score.");
					break; //then loop out
				} //Now game ends with a winner shortly doing a random travel
			}
		}
	}
	else
	{
		log (Self$" won't react."); //If map is not Logo mutator won't do anything
		return;
	}
}

defaultproperties
{
     stDelay=5.000000 //At a moment I was using 3 seconds
}
Now combination between CTF and 2 DM-s have a cute random start proposed by server.
User avatar
sektor2111
Godlike
Posts: 6397
Joined: Sun May 09, 2010 6:15 pm
Location: On the roof.

Re: Solution for starting server with a random Level

Post by sektor2111 »

The bump from here.
If this solution was priceless in a win 436 + all sort of adds, oh well... a rented Windows V451 looks retarded. It doesn't seems to care about my setup it is blabbering String section even if I used other way functional in 436, v451 seems intended to piss of all packages mastered with sort of strings. Here I deduct that even a monster replacer using string deal won't work at all in 451 - "nice" engine... truly "nice" - go and burn in hell... :wth:
MrLoathsome
Inhuman
Posts: 958
Joined: Wed Mar 31, 2010 9:02 pm
Personal rank: I am quite rank.
Location: MrLoathsome fell out of the world!

Re: Solution for starting server with a random Level

Post by MrLoathsome »

sektor2111 wrote:The bump from here.
If this solution was priceless in a win 436 + all sort of adds, oh well... a rented Windows V451 looks retarded. It doesn't seems to care about my setup it is blabbering String section even if I used other way functional in 436, v451 seems intended to piss of all packages mastered with sort of strings. Here I deduct that even a monster replacer using string deal won't work at all in 451 - "nice" engine... truly "nice" - go and burn in hell... :wth:
If your mutator needs even more time to load after level start, you could load it with the SwarmSpawner now. (I think.)

Re: UTPG. I think, once again, we are in agreement.

All my future development will be under 436.
blarg
User avatar
sektor2111
Godlike
Posts: 6397
Joined: Sun May 09, 2010 6:15 pm
Location: On the roof.

Re: Solution for starting server with a random Level

Post by sektor2111 »

Okay, with some modification now looks functional in 436 and 451. Starter looks like this:
  • class TheStart expands Mutator config;

    var config float stDelay;
    var config bool bStartGames;
    var String Map;
    var bool bFirstTime, bCheckedMap;

    event PreBeginPlay()
    {
    log (Self$" waiting "$stDelay$" seconds for travel check");
    SetTimer(stDelay,False);
    }

    event Timer()
    {
    local Pawn P;
    local StatLog SL;

    if (!bCheckedmap)
    {
    SL = Spawn(class'StatLog');
    if ( SL != None )
    {
    Map = Caps(SL.GetMapFileName());
    SL.Disable('Timer');
    SL.Destroy();
    }
    // Map=Caps(Level.GetURLMap());
    bCheckedMap = True;
    }
    // if ( Map ~= RefMap)
    if ( Left(Map,11)=="UT-LOGO-MAP")
    {
    if ( DeathMatchPlus(Level.Game) != None )
    {
    if (!bFirstTime)
    {
    DeathMatchPlus(Level.Game).NetWait=0;
    DeathMatchPlus(Level.Game).RestartWait=0;
    DeathMatchPlus(Level.Game).bRequireReady=False;
    DeathMatchPlus(Level.Game).bNetReady=False;
    DeathMatchPlus(Level.Game).TimeLimit=4;
    DeathMatchPlus(Level.Game).StartMatch();
    DeathMatchPlus(Level.Game).RemainingTime=3;
    }

    if (!bFirstTime)
    {
    bFirstTime = True;
    SetTimer(stDelay/2,False);
    return;
    }

    foreach AllActors (class 'Pawn', P)
    {
    if ( P.PlayerReplicationInfo != None && P.bIsPlayer )
    {
    P.PlayerReplicationInfo.Score += 2;
    log (P.GetHumanName()@"has new score.");
    break;
    }
    }
    }
    }
    else
    {
    log (Self$" won't react.");
    log (Self$" has detected being loaded"@Map);
    if ( bStartGames )
    {
    if ( DeathMatchPlus(Level.Game) != None )
    {
    DeathMatchPlus(Level.Game).NetWait=0;
    DeathMatchPlus(Level.Game).RestartWait=0;
    DeathMatchPlus(Level.Game).bRequireReady=False;
    DeathMatchPlus(Level.Game).bNetReady=False;
    DeathMatchPlus(Level.Game).StartMatch();
    }
    }
    Destroy();
    return;
    }
    }
    defaultproperties
    {
    stDelay=3.000000
    }
Anyway I'll write something based on state, no timer or tick or anything from Mutator.

Edit: Variable Map has been moved to prevent some bad logging, it works anyway...