Random Map Option?

Discuss and provide feedback on Maps.
User avatar
pooty
Posts: 4486
Joined: Sat Apr 03, 2021 10:22 am
Location: Michigan
Server Sponsor: Yes
Server Admin: Yes

Re: Random Map Option?

Post by pooty »

Got a response. I'd put it on the server but McLovin is busy playing MinusBadgerMeUP.... That's the vote for random map thing.

Still working on RandomCrashMap thing, needs testing.
User avatar
YEAAAHHHHHHHHHH
Posts: 1100
Joined: Tue Jun 08, 2021 3:03 pm
Server Sponsor: Yes
Server Admin: Yes

Re: Random Map Option?

Post by YEAAAHHHHHHHHHH »

Wow that was a quick turnaround. If possible, I'd give it a name like ???????????RandomMap????????????????????????????????????????? so it's easy to see and scroll to. Hopefully people find this fun or interesting. If it's a "crappy" map then hopefully people whine less since we were all willing to roll the dice.
User avatar
pooty
Posts: 4486
Joined: Sat Apr 03, 2021 10:22 am
Location: Michigan
Server Sponsor: Yes
Server Admin: Yes

Re: Random Map Option?

Post by pooty »

On the server.
You'll see an entry called ONS-<??? Random Map ???> which if voted for the server randomly selects a map.
The map selected will go out of rotation for normal voting, but the RandomMap does not ever go out of rotation, meaning people can keep voting for a RandomMap every time.

Quick yes, thanks to the folks over at miasma.rocks, and ultimately to Wormbo (who wrote the code for it).

I need to see if I can put the RandomMap on the command line -- I don't think it will work since the crash map (which is really the command line starting map) has to be an actual map. RandomMap just uses a customized voting handler.

That being said I have the RandomMap Map code done, I just need to test it on the server to make sure it doesn't do anything funky... but that's lower priority.
User avatar
Enyo
Posts: 1678
Joined: Mon Apr 05, 2021 11:27 pm
Server Sponsor: Yes
Server Admin: Yes

Re: Random Map Option?

Post by Enyo »

pooty wrote: Fri May 06, 2022 8:28 am On the server.
You'll see an entry called ONS-<??? Random Map ???> which if voted for the server randomly selects a map.
The map selected will go out of rotation for normal voting, but the RandomMap does not ever go out of rotation, meaning people can keep voting for a RandomMap every time.
This is a very cool idea, glad it wasn't too much work to accomplish. I agree with YEAHHHHHHHH, it should maybe have a special character or something at the beginning of the name to make sure it appears at the top of the list when sorted alphabetically so it's easy to see for everyone that doesn't come to the forums.
“Never argue with stupid people, they will drag you down to their level and then beat you with experience.”
― Mark Twain
User avatar
pooty
Posts: 4486
Joined: Sat Apr 03, 2021 10:22 am
Location: Michigan
Server Sponsor: Yes
Server Admin: Yes

Re: Random Map Option?

Post by pooty »

Its literally called "ONS-<??? Random Map ???>"
It always shows up at the top (at least it did the three times I tested it). I think the mod puts it always at the top.
User avatar
pooty
Posts: 4486
Joined: Sat Apr 03, 2021 10:22 am
Location: Michigan
Server Sponsor: Yes
Server Admin: Yes

Re: Random Map Option?

Post by pooty »

Random Map Update:

The voting ONS-<??? Random Map ???> seems to work just fine.

On the RandomCrashMap, I am stumped. I have code to switch levels. It works fine locally, works fine Listen/Dedicated on my machine, except on the Server when it comes up it DOES change maps, but it disconnects my client during the switch. So it might work after a crash, since everyone gets disconnected, but if you vote it in, it will disconnect everyone -- and not sure how to fix it.

Snarf, maybe you have some ideas:

Code: Select all

//-----------------------------------------------------------
//
//-----------------------------------------------------------
class MutRandomMapOmni extends Mutator
                         config(MutRandomMapOmni);

var GameInfo.ServerResponseLine ServerState;
var protected FileLog Output;
var config array<String> aAllMaps;
var config array<String> aRandomMap;
var int rdZahl;

auto State MatchInProgress
{
	function Timer()
	{
		// Stop Match Start Countdown for network game
		// Check for match end
		//if (Level.Game.bGameEnded)
		//{
			SetTimer(0, false);
			GotoState('MatchEnded');
		//}
	}

Begin:
	SetTimer(1.0, true);

}

state MatchEnded
{
Begin:
   //NextMap = "DM-Deck17";
   if(aRandomMap.Length > 0)
     rdZahl = Rand(aRandomMap.Length);
   else
     rdZahl = 0;
   Level.ServerTravel(aRandomMap[rdZahl], false);
   aRandomMap.Remove(rdZahl,1);
   if(aRandomMap.Length<=0){
    aRandomMap = aAllMaps;
   }
   SaveConfig();
}

function PostBeginPlay()
{
 local String gpack;
 local String fstring;
 local String maptmp;
 Super.BeginPlay();
 Level.Game.GetServerInfo( ServerState );
 switch (ServerState.GameType) {
   case "ASGameInfo":
        gpack = "UT2k4Assault";
        break;
   case "xCTFGame":
        gpack = "XGame";
        break;
   case "xBombingRun":
        gpack = "XGame";
        break;
   case "xDoubleDom":
        gpack = "XGame";
        break;
   case "xDeathMatch":
        gpack = "XGame";
        break;
   case "xTeamGame":
        gpack = "XGame";
        break;
   case "xMutantGame":
        gpack = "BonusPack";
        break;
   case "Invasion":
        gpack = "SkaarjPack";
        break;
   case "xLastManStandingGame":
        gpack = "BonusPack";
        break;
   case "xVehicleCTFGame":
        gpack = "XGame";
        break;
   case "ONSOnslaughtGame":
        gpack = "Onslaught";
        break;
   default:
        gpack = "ERROR";
        break;

 }
 if(gpack != "ERROR") {
    Output = Self.Spawn(class'FileLog');
    Output.OpenLog("lastmapomni",,True);
    maptmp=Repl(ServerState.MapName,"*","");
    fstring = maptmp$"?game="$gpack$"."$ServerState.GameType;
    Output.Logf(fstring);
    Output.CloseLog();
 }

 if(aRandomMap.Length<=0){
    aRandomMap = aAllMaps;
    SaveConfig();
 }
 SaveConfig();
}

defaultproperties
{
     GroupName="MutExp"
     FriendlyName="RandomMapOmni"
     Description="Plays random Modes/Maps"
}
Not much code to it. I'm wondering if adding some time to the first settimer maybe 5-10s to let clients catch up. Or maybe set second timer to 0?

Right now the current crash map is Ganga-v2
User avatar
captainsnarf
Posts: 2682
Joined: Tue Jul 06, 2021 1:51 pm
Location: Washington
Server Sponsor: Yes
Server Admin: Yes
Contact:

Re: Random Map Option?

Post by captainsnarf »

I'm really not sure. Maybe do this?

Code: Select all

state MatchEnded
{
   ...

Code: Select all

simulated state MatchEnded
{ 
    ...

maybe this also?

Code: Select all

auto State MatchInProgress
{
	function Timer()
	{
		super.Timer();           // don't forget to call super
		SetTimer(0, false);
		GotoState('MatchEnded');
	}
Begin:
	SetTimer(1.0, true);
}
User avatar
pooty
Posts: 4486
Joined: Sat Apr 03, 2021 10:22 am
Location: Michigan
Server Sponsor: Yes
Server Admin: Yes

Re: Random Map Option?

Post by pooty »

What goes in the two states?
Or are you saying add the same code into simulated state MatchEnded?

I also wonder if I should "end the match", I mean level.ServerTravel does that but I wonder if that's why the disconnect?
User avatar
pooty
Posts: 4486
Joined: Sat Apr 03, 2021 10:22 am
Location: Michigan
Server Sponsor: Yes
Server Admin: Yes

Re: Random Map Option?

Post by pooty »

I added the super.Timer() and seems to have fixed it.
If you vote for it it will load spambox (dummy map, very small) and then in a few seconds load the random map.

So its on there now for a crash, server starts with RandomCrashMap, but we won't know for sure until we get a real crash...(pretty much 3/4 time when its DJY)
User avatar
captainsnarf
Posts: 2682
Joined: Tue Jul 06, 2021 1:51 pm
Location: Washington
Server Sponsor: Yes
Server Admin: Yes
Contact:

Re: Random Map Option?

Post by captainsnarf »

Interesting! The idea to call super.Timer() was from the ONSOnslaughtGame code. In the timer code for MatchInProgress, it has this:

Code: Select all

       Super.Timer(); // Need this!!!
I took the comment in consideration when making the suggestion :)

On a side note, while looking through this I think I found why EvenMatch custom scoring sometimes messes up and why 2.9 changes didn't work. Not sure how to fix it but at least know where it's happening now.


Oh, and for the two states, I was just suggesting changing the state to a 'simulated' one, but looks like that's not needed.
Post Reply