Solid Snake/CustomControllerInRoboBlitz
How to create your own controller in RoboBlitz
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.
00001 class MyGameInfo extends rbarenapersistentgameinfo; 00002 00003 static event class<gameinfo> setgametype(string mapname, string options) 00004 { 00005 return class'MyGameInfo'; 00006 } 00007 00008 defaultproperties 00009 { 00010 PlayerControllerName="" 00011 PlayerControllerClass=class'MyTestPackage.xPlayer' 00012 }
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.
00001 class xPlayer extends rbarenapcontroller; 00002 00003 exec function LetsDance() 00004 { 00005 if(drivenpart != none) 00006 drivenpart.GotoState('dancing'); 00007 }
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