Showing posts with label unrealEd. Show all posts
Showing posts with label unrealEd. Show all posts

Tuesday, October 16, 2012

Cookbook: UDK command lines

There are many things that can simplify your work and increase productivity. I think that in case of UDK that requires restarting editor and recompiling after each minor script change you can save some time by using batch files for starting everything you want without the need to manually open some level, etc.

You can find some additional tips on getting started with UDK in this tutorial.

So here are some useful command lines (use them in your batches):
  • compile script

call Binaries\Win64\UDK.exe make
  • run editor with your level + show log

call Binaries\Win64\UDK.exe editor YOUR_LEVEL_NAME -log -NoGADWarnings

Aforementioned command lines are for 64bit systems, in case you're using older 32bit systems, please replace Win64 with Win32. Create those batches in your UDK install dir and put only a shortcut on your desktop to make it work with relative paths.

Using UnrealFrontend:

When packaging your game and cooking your levels you'll need to work with Unreal Frontend (%UDK_INSTALLDIR%\Binaries\UnrealFrontend.exe).

  • don't forget to have all your maps/levels listed in Maps to Cook window prior to any cooking
  • don't forget to use Script/Full recompile after changes to script
  • this has to be followed by Cook/Clean and Full Recook of levels (to actually use changes in script)
  • after cooking, launch your game to make sure everything is intact and up to date
  • only after doing the check (in case everything is ok) do the actual packaging
And last but not least, don't forget that you cannot compile scripts with editor running (this will cause compilation warnings and errors)!




Wednesday, October 10, 2012

Cookbook: Custom postprocess chain

In Unreal postprocess effects are set per level (WorldProperties/Default Postprocess Settings). But what if you want to have the same atmospheric setting for many of your levels? There comes the possibity to specify your custom PostProcessChain and reuse it in every level where you want it to be (and edit settings of all such levels just by tweaking one PostProcessChain).

What do you need to set it?

  • create empty PostProcessChain (right click in Content Browser -> New PostProcessChain, specify package name, etc.
  • setup your postprocess (double click on PostProcessChain):
    • you can specify a chain of different nodes (like in kismet) where output of the previous node is the input for the next one
    • UberPostProcessEffect lets you specify almost everything that is being set in aforementioned Default Postprocess Settings
    • MaterialEffect lets you use any screenspace shader you want

  • use it in level:
    • just select your new chain and use it in WorldProperties/World Post Process Chain

  • you can preview all parts of effect chain directly while in editor:
    • either use Post process effect/Show in editor checkbox directly in properties of individual nodes
    • or click on Game View button on your viewport panel (big G)
Postprocess off

Postprocess on

Tuesday, October 9, 2012

Cookbook: actionscript -> kismet commands with parameters

At some point in your project, you'd like to create some nice menu and be able to load different levels, setup resolutions, etc. Let me show you the way how to simply do it and additionally use utilize parameters as well.



For my demo installer I needed some simple menu (possibility to choose from a set of levels and change resolution for older HW/notebooks). I didn't have much time to play with Scaleform and so I've chosen actionscript 2.0 approach that was more familiar to me. Easiest way to send a string command to unreal is by using fscommand.


   1:  buttonLevel[i].onPress = function() {
   2:              //command to be linked with kismet node
   3:                         //actual command we want to run in kismet
   4:     fscommand("loadmap","open " + levelNames[this.id]);
   5:  };


This method can additionally have a string of parameters that can be parsed/used in kismet to avoid necessity to creating separate kismet nodes for generic tasks (e.g. open level1, open level2, ... open level37). If you're curious how to react on such a command on unreal side, utilize kismet event node FsCommand (New Event/Gfx UI/FsCommand). This node has an optional argument that can be sent to any other kismet action (e.g. Console Command for opening levels).




FsCommand node requires its parameter fsCommand to be set to string that links it with actual fscommand sent from action script.

So in our case for example for opening levels we send fscommand from scaleform with argument (easier to compose it in actionscript than in kismet) that is the actual command to run in kismet and in kismet we just link this string argument and use it in another kismet action. Nevertheless we are sufficient with simple kismet node setup without the necessity to create a separate scheme (and devise separate command names) for each new level to load/resolution to set, etc.

Monday, October 8, 2012

Cookbook: Prefabs

Ever wondering how to compose some complex set of meshes with animations, sound effects, particles into one object with ability of easy instancing? Well, in this case Prefabs are just what you are looking for!

You can create them easily in UnrealEd and reuse wherever you need them without the need to painfully copy kismet schemes, setting all the different parameters, etc. And of course you can decompose your prefab, change a few things and create another version for later reuse.

Let's say we want to have doors that are opened by a button/lever (that requires at least button actor, door interpactor, matinee for doors and kismet assemble). Quite a lot to handle repeatedly if you can just instance one composed prefab instead ;). Here is an example how to create given prefab in editor:


  • insert individual meshes/archetypes for both button and door



  • prepare kismet setup and simple matinee with movement track for door InterpActor



  • with all individual parts set and selected, right click and choose Create Prefab... option. Choose package name, etc. and select Yes for prompt to found kismet sequence (to make it part of prefab) and replacing individual actors in scene with prefab. From now on you can insert another instances of this prefab setup from your Content Browser (and of course position/rotate them differently to work appropriately in your level).



  • in case you need to change some parts of prefab, select its instance and right click, Convert PrefabInstance To Normal Actors, update, create different version of prefab, etc.




Tuesday, October 2, 2012

Cookbook: UDK artist editable properties

Sooner or late in your development you'll come into phase when you have some game skeleton with a lot of parameters (camera, health, etc.). But how to tweak them without the necessity to update unrealscript (defaultproperties) and recompiling?

There are two approaches you can use. Let's take a closer look:

Instanced objects/actors

Each of your actors (buttons, movable/breakable objects, custom lights) will probably need some variables that are preferably tweakable by artist. Additionally each of there instances needs possibility to have differing values of parameters (imagine your ButtonActor with blue light and specific mesh vs other instance of ButtonActor with no light and different mesh).

This is easily achievable using named variables in unrealscript, syntax is really simple:


   1:  class ButtonActor extends Actor
   2:      ClassGroup(BallPuzzler)
   3:      placeable;
   4:   
   5:  // /** */ specifies comment visible for artist in editor
   6:  /** enables actor movement upon activation */
   7:  //(Game) specifies category for parameter in unreal editor
   8:  var(Game) bool bMove;
   9:   
  10:  /** movement offset from base position */
  11:  var(Game) vector vMoveOffset;
  12:   
  13:  /** sound to play upon activation */
  14:  var (Game) SoundCue activationSound;
  15:   
  16:  var(Light) const LightComponent    LightComponent;

This setup results in parameters being categorized in unreal editor into specified groups (F4 on selected actor):


I recommend to create archetype also for instanced objects to create subtypes (for example blue button, red button, healing button) and then use them to create instances (and edit few parameters per instance if necessary).

Not placeable objects


Ok, above mentioned steps work fine for instanced object that are being placed into game level. But what about objects without physical representation in editor (e.g. camera, controller, HUD, etc.)? Here we can create specific Properties object, that can be archetyped and it's parameters updated in content browser.


   1:  class BallPuzzlerProperties extends Object
   2:      HideCategories(Object);
   3:   
   4:  /** min distance from camera */
   5:  var(Camera) vector CamOffsetNear;
   6:   
   7:  /** max distance for camera */
   8:  var(Camera) vector CamOffsetFar;
   9:   
  10:  /** focus inner radius when in exploration mode */
  11:  var(PostProcess)   float fFocusRadiusExploration;
  12:   
  13:  /** movement speed */
  14:  var(Movement)   float Speed;
  15:   
  16:  /** jump force */
  17:  var(Movement)   float Jump;
  18:   
  19:  /** how much energy to drain at once */
  20:  var(Other)   float EnergyDrainAmount;
  21:   
  22:  /** distance to moveable object allowing its pickup */
  23:  var(Manipulate)   float PickupDistance;

Creating and archetype is really simple. Open your Content Browser, click on Actor classes tab, uncheck all checkboxes (as this is not placeable, nor actor) and find your properties object. Right click, create an archetype, specify your package and some cool name (like Properties ;) ) and there you go! From now on, all your global parameters are accessible via properties of this archetype (F4)




To have an access to properties archetype in unrealscript, just reference it in variables and default properties. After that you can access it as any default structure.


   1:  class BallPuzzlerCamera extends Camera;
   2:   
   3:  var const archetype BallPuzzlerProperties Properties; //declare variable
   4:   
   5:  ...
   6:   
   7:  //========================================================================
   8:  function ComputeCameraRotation(float DT)
   9:  {
  10:      local float partAngle;
  11:      
  12:      //use it!
  13:      partAngle = Properties.CamRotDelta * DT;
  14:   
  15:  ...
  16:   
  17:  defaultproperties
  18:  {
  19:      //define it as external from package
  20:      Properties=BallPuzzlerProperties'BallPuzzlerGame.Archetypes.Properties'
  21:  }