There is no spoon

Legacy:Solid Snake/CustomControllerInRoboBlitz

From Unreal Wiki, The Unreal Engine Documentation Site
Jump to: navigation, search

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.

  1. class MyGameInfo extends rbarenapersistentgameinfo;
  2.  
  3. static event class<gameinfo> setgametype(string mapname, string options)
  4. {
  5.   return class'MyGameInfo';
  6. }
  7.  
  8. defaultproperties
  9. {
  10.   PlayerControllerName=""
  11.   PlayerControllerClass=class'MyTestPackage.xPlayer'
  12. }
  13. </uscript lines>
  14.  
  15. 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.
  16.  
  17. From here, we code something into xPlayer.
  18.  
  19. <uscript lines>
  20. class xPlayer extends rbarenapcontroller;
  21.  
  22. exec function LetsDance()
  23. {
  24.   if(drivenpart != none)
  25.     drivenpart.GotoState('dancing');
  26. }

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

Comments[edit]