I love the smell of UnrealEd crashing in the morning. – tarquin
Legacy:Solid Snake/CustomControllerInRoboBlitz
How to create your own controller in RoboBlitz[edit]
So I have been messing around in RoboBlitz trying to figure out the structure for Unreal Engine 3.0. While I think Roboblitz has created a lot of its own things, which wouldn't apply to Unreal Engine 3.0 normally, its still good to figure out its structure so I can develop anything I wanted on it.
So first thing you do is follow the steps in the wiki which allows you to compile scripts for RoboBlitz. Now, I'm not sure if it is just me, but I can't actually use the make flag to compile my scripts. While the scripts compile, the saving process always causes a crash. So what I did instead was to start up the game and when it prompted me that the scripts have been updated, and whether I wanted to compile or not I clicked yes. That seemed to work and my packages got compiled and saved.
So lets get started. I created a package called 'MyTestPackage'. Inside there I wrote two script files 'MyGameInfo' and 'xPlayer' [I know, but I couldn't think of any naming conventions at the time]
From what I gathered, RoboBlitz runs the appropriate Game Info class which is decided upon the map prefix. After some logging, it appeared that, the majority of the time, it used this particular game info class, which is 'rbarenapersistentgameinfo'. Also looking into Engine.GameInfo ... the variable PlayerControllerClass was still there. So I assumed that controllers were setup in the same way as UE2.x. It appears so.
-
class MyGameInfo extends rbarenapersistentgameinfo;
-
-
static event class<gameinfo> setgametype(string mapname, string options)
-
{
-
return class'MyGameInfo';
-
}
-
-
defaultproperties
-
{
-
PlayerControllerName=""
-
PlayerControllerClass=class'MyTestPackage.xPlayer'
-
}
-
</uscript lines>
-
-
This is a very basic class, which just hooked into the function which returned the game type, and defined a few default properties. That was easy. Oh, remember to change RoboGame.ini [in RoboGame\Config] so that DefaultGame and DefaultServerGame are set to MyTestPackage.MyGameInfo respectively.
-
-
From here, we code something into xPlayer.
-
-
<uscript lines>
-
class xPlayer extends rbarenapcontroller;
-
-
exec function LetsDance()
-
{
-
if(drivenpart != none)
-
drivenpart.GotoState('dancing');
-
}
This was a funny state I found inside that class. It makes Blitz do a little dance ...
And there we have it. You now have your own custom class as the player controller. I know this is a very brief tutorial, and it does rely on you having a lot of Unrealscript knowledge, as well how Controllers work (They seem to work in the more or less same fashion as UE2.x). If you need to know more information of either, then go look for tutorials on those. While the scripts are tiny, it did take me a few hours to figure out how RoboBlitz sort of worked, and how things were structured. Once that was figured out, writing the script didn't take very long at all :D