More Useful UDK Flags

As you can probably guess from my post on getting the UDK to launch without cooking, I like writing batch files to make my work more efficient. Since that post, I’ve added a few more UDK command-line arguments to further improve my workflow. I’d like to share those here and help others find their UnrealScript bugs earlier and more easily than before.

These are the UDK command-line parameters that I find indispensable for improving my development experience:

  • warningsaserrors – There are few script-compiling arguments more useful than this one.  As the name implies, this flag causes UDK to treat make-time script warnings as errors and prevent you from making script until they are fixed.  While it may seem like a hassle at first, the increased discipline in fixing your warnings before they become errors will save you large amounts of time spent tracking down bugs later.  Any programmer/scripter who comes to me for help in debugging their code gets forced to fix compiler warnings before I’ll help them because I’m a mean nice guy and I don’t want to waste their time or mine.
  • scriptstackonwarnings – This flag is a real prize at runtime.  Whenever you trip a warning, it will cause the UDK to output a call stack leading to the warning along with the warning message itself.  This is invaluable when you need to track down an error in functions that get called from multiple locations (which is most of them since you’re a DRY-kind of programmer, right?)  In fact, I can’t think of any reason why you wouldn’t want to have this flag enabled…
  • fatalscriptwarnings – This argument is for when you’re getting serious.  Any runtime warning will be treated as a fatal error and stop your game in its tracks.  Having this puppy enabled will make absolutely sure that you fix your UnrealScript warnings.  Given that a warning is usually a sign that something unexpected is going on in your logic, this is a GOOD thing.  A couple caveats on this one though:  First, I generally only use this flag when I’m writing production script intended for release.  When I prototype, I tend to change code quickly and implement things in a quick and (often very) dirty fashion.  Second, UDK has a tendency to ship with a couple warnings firing during startup, often related to missing online profiles.  It’s fairly trivial to add the necessary nil-checks to prevent these warnings.  Enabling scriptstackonwarnings should help you find these bugs with no problem.

For those who want something nice and easy to cut-and-paste, here is the latest iteration of my UDK launch batch incorporating the flags above:

set start_map=BPG_Entry

Binaries\Win32\ make -warningsaserrors

IF errorlevel 1 GOTO :ERROR_EXIT
Binaries\Win32\UDK.exe %start_map% -log -scriptstackonwarnings


exit /b %ERRORLEVEL%


I hope this proves useful to other UDK-users out there. Good coding and bug-hunting to you all!

Share this Article:
  • Digg
  • StumbleUpon
  • Facebook
  • Yahoo! Buzz
  • Twitter
  • Google Bookmarks
  • Print