• Please make sure you are familiar with the forum rules. You can find them here: https://forums.tripwireinteractive.com/index.php?threads/forum-rules.2334636/

Code Creating and firing up a gametype?

I have started work on a gametype. It is a port of code that I wrote against the UDK.

But first things first, I created a simple class which extends ROGameInfo and it has nothing in it except DefaultProperties and some logging in various events that should fire if the game is loaded.

I compiled the script and moved the .u to my published\script folder and added the following to my ro2 launch options in steam:
FF-Apartments?game=TOGAModTest.TOGAModTest

The game starts up and the correct map loads, but nothing is logged in the log files.

I also have no idea how to make a new gametype appear in the webadmin.

Has anyone tried to do this yet?
 
I have started work on a gametype. It is a port of code that I wrote against the UDK.

But first things first, I created a simple class which extends ROGameInfo and it has nothing in it except DefaultProperties and some logging in various events that should fire if the game is loaded.

I compiled the script and moved the .u to my published\script folder and added the following to my ro2 launch options in steam:
FF-Apartments?game=TOGAModTest.TOGAModTest

The game starts up and the correct map loads, but nothing is logged in the log files.

I also have no idea how to make a new gametype appear in the webadmin.

Has anyone tried to do this yet?

If you are testing this on your own computer with the command open FF-Apartments?game=TOGAModTest.TOGAModTest (listening server), then you will indeed not see anything in your logs. You need to comment or remove this line from ROEngine.ini.
Code:
Suppress=Log
If you are testing it on a dedicated server, then your log lines should be there if you use the correct log statement.
 
Upvote 0
Well I have tried adding a debug log in PostBegingPlay and it does not show in the logs offline or online.

I think because I am loading a FF map that the gametype is defaulting to FF and the log has this:
Code:
[0003.49] Log: LoadMap: ff-Apartments?Name=Player?Team=255?game=TOGATestMod.TOGATestMod?maxplayers=12
[0003.65] Log: Game class is 'ROGameInfoFirefight'

WebAdmin also reports FF is loaded. So I am a bit stuffed right now lol
 
Upvote 0
Well I have tried adding a debug log in PostBegingPlay and it does not show in the logs offline or online.

I think because I am loading a FF map that the gametype is defaulting to FF and the log has this:
Code:
[0003.49] Log: LoadMap: ff-Apartments?Name=Player?Team=255?game=TOGATestMod.TOGATestMod?maxplayers=12
[0003.65] Log: Game class is 'ROGameInfoFirefight'
WebAdmin also reports FF is loaded. So I am a bit stuffed right now lol

Oh yes... I didn't think about that. The FF will indeed force the engine to load firefight. This is handled in the SetGameType function in ROGameInfo.uc.
 
Upvote 0
Oh yes... I didn't think about that. The FF will indeed force the engine to load firefight. This is handled in the SetGameType function in ROGameInfo.uc.

Yep, this is quite a problem. I expect it can be worked around but right now It has been completely stumped :p

Would be great if a TWI coder could jump in and give us the low down on this and if it's currently possible to create and run a new gametype ;)
 
Upvote 0
Yep, this is quite a problem. I expect it can be worked around but right now It has been completely stumped :p

Would be great if a TWI coder could jump in and give us the low down on this and if it's currently possible to create and run a new gametype ;)

Ducky is correct you will want to override SetGameType in your gameinfo class and unsuppress 'Log' and 'ScriptLog' from your config.
 
Upvote 0
Bloody hell i really need to read them comments!

It is now working and correctly loaded my custom game class. Strange thing is that my debug logging is still not getting written out. It should get written to the normal server log shouldn't it?

Code:
static event class<GameInfo> SetGameType(string MapName, string Options, string Portal)
{
	[B]`Log(">>> DEBUG : SetGameType");[/B]

	// Remove the Play In Editor tag from the MapName so we can find the proper gametype when using PIE
	ReplaceText(MapName, "UEDPIE", "");

	// Determine which GameType this Map is based off its name
	if ( Left(MapName, InStr(MapName, "-")) ~= "FF" )
	{
		return class'TOGAGameInfo';
	}

	// If all else fails, let the parent handle it
	return super.SetGameType(MapName, Options, Portal);
}
 
Last edited:
Upvote 0
Bloody hell i really need to read them comments!

It is now working and correctly loaded my custom game class. Strange thing is that my debug logging is still not getting written out. It should get written to the normal server log shouldn't it?

Code:
static event class<GameInfo> SetGameType(string MapName, string Options, string Portal)
{
    [B]`Log(">>> DEBUG : SetGameType");[/B]

    // Remove the Play In Editor tag from the MapName so we can find the proper gametype when using PIE
    ReplaceText(MapName, "UEDPIE", "");

    // Determine which GameType this Map is based off its name
    if ( Left(MapName, InStr(MapName, "-")) ~= "FF" )
    {
        return class'TOGAGameInfo';
    }

    // If all else fails, let the parent handle it
    return super.SetGameType(MapName, Options, Portal);
}

You need to add your class name to get them written out. Do it like this:
Code:
`Log(">>> DEBUG : SetGameType", , 'MyClassName');
(those double , , is not a typo ;). They need to be there)

Edit:
Yes it's written to the normal server logs. If you go to the OP of my open source mutators post somewhere on this Coding board, then you can view my mutators. Especially in BotDetonator are a lot of `Log examples.
 
Last edited:
Upvote 0
Im not really a programmer but I made a little mod that logs information like kill grid coordinates on RO2/RS maps (doing it as a mutator proved too inefficient).

You should be able to get what you want from the gameinfo classes (i added both a RSTerritories and ROTerritories derivative so nothing weird happens if you change to an RS or RO2 map.
 

Attachments

  • Classes.zip
    9.4 KB · Views: 1
Upvote 0