<?xml version="1.0" encoding="UTF-8"?><rss version="2.0"
	xmlns:content="http://purl.org/rss/1.0/modules/content/"
	xmlns:wfw="http://wellformedweb.org/CommentAPI/"
	xmlns:dc="http://purl.org/dc/elements/1.1/"
	xmlns:atom="http://www.w3.org/2005/Atom"
	xmlns:sy="http://purl.org/rss/1.0/modules/syndication/"
	xmlns:slash="http://purl.org/rss/1.0/modules/slash/"
	>

<channel>
	<title>Game Dev Without a Cause &#187; UDK</title>
	<atom:link href="https://gamedevwithoutacause.com/?cat=11&#038;feed=rss2" rel="self" type="application/rss+xml" />
	<link>https://gamedevwithoutacause.com</link>
	<description>Rob&#039;s Thoughts on Games, Game Dev, and Design - Temporary home of Skyboy Games</description>
	<lastBuildDate>Wed, 23 Jul 2014 09:18:52 +0000</lastBuildDate>
	<language>en-US</language>
	<sy:updatePeriod>hourly</sy:updatePeriod>
	<sy:updateFrequency>1</sy:updateFrequency>
	<generator>https://wordpress.org/?v=4.2.38</generator>
	<item>
		<title>Three Things I Wish I Knew When I Started Using the UDK</title>
		<link>https://gamedevwithoutacause.com/?p=1708</link>
		<comments>https://gamedevwithoutacause.com/?p=1708#comments</comments>
		<pubDate>Tue, 08 Jan 2013 14:07:46 +0000</pubDate>
		<dc:creator><![CDATA[Rob]]></dc:creator>
				<category><![CDATA[Game Development]]></category>
		<category><![CDATA[UDK]]></category>

		<guid isPermaLink="false">http://gamedevwithoutacause.com/?p=1708</guid>
		<description><![CDATA[Boy, Unreal Engine 3 is a gift that just keeps on giving. I&#8217;ve been using Unreal in a professional capacity for a few years now (with occasional forays into UDK-land to see how I fare without source code) and I &#8230; <a href="https://gamedevwithoutacause.com/?p=1708">Continue reading <span class="meta-nav">&#8594;</span></a>]]></description>
				<content:encoded><![CDATA[<p><a href="http://gamedevwithoutacause.com/wp-content/uploads/2013/01/6081261.jpg"><img src="http://gamedevwithoutacause.com/wp-content/uploads/2013/01/6081261.jpg" alt="6081261" width="264" height="400" class="aligncenter size-full wp-image-1715" /></a><br />
Boy, Unreal Engine 3 is a gift that just keeps on giving. I&#8217;ve been using Unreal in a professional capacity for a few years now (with occasional forays into UDK-land to see how I fare without source code) and I still find out about new features all the time.  Game development being what it is, those discoveries are often answered with a heartfelt: &#8220;That&#8217;s great! I wish I had known about that 6 months ago&#8230;&#8221;</p>
<p>So, in the spirit of helping out others using Unreal Engine 3 or the UDK, here are three features that I wish I had known about when I first started using Unreal.<span id="more-1708"></span></p>
<p><b>Kismet Console Command</b><br />
What&#8217;s the easiest way to call an UnrealScript function from Kismet? Write a custom sequence action? No!</p>
<p>Use the Console Command sequence action. Using it you can call any function marked with the exec keyword in UnrealScript.  All you need to do is pass in a valid target for the sequence action (most likely a PlayerController, like in the convenient All Players kismet variable.)<br />
<a href="http://gamedevwithoutacause.com/wp-content/uploads/2013/01/consolecommandkismet.png"><img src="http://gamedevwithoutacause.com/wp-content/uploads/2013/01/consolecommandkismet.png" alt="consolecommandkismet" width="161" height="183" class="aligncenter size-full wp-image-1719" /></a></p>
<p><b>Cause Event</b><br />
Console Command will allow me to easily call into UnrealScript from Kismet. What if I want to go in the other direction?  That&#8217;s where the Console Event node comes into play. This kismet event gets executed when the &#8220;causeevent&#8221; console command is triggered through UnrealScript. This makes it trivially easy to write code that calls out from UnrealScript into Kismet.</p>
<p>Having a Pawn, for example, calling &#8220;causeevent PawnHitWall&#8221; (&#8220;CE PawnHitWall&#8221; for short):</p>
<pre class="brush: c#">
   PlayerController(Controller).ConsoleCommand(&quot;CE PawnHitWall&quot;);
</pre>
<p>Results in the following Kismet event being called with the PlayerController&#8217;s Pawn passed through as the Instigator:<br />
<a href="http://gamedevwithoutacause.com/wp-content/uploads/2013/01/pawnhitwall.png"><img src="http://gamedevwithoutacause.com/wp-content/uploads/2013/01/pawnhitwall.png" alt="pawnhitwall" width="259" height="292" class="aligncenter size-full wp-image-1721" /></a></p>
<p><b>ActorComponents</b><br />
I&#8217;m a bit sheepish to admit it, but I jumped into Unreal without really understanding the relationship between Actors and ActorComponents.  As a result, I probably created dozens more custom actor classes then I ever needed.  In hindsight, the extra classes were senseless because it is so trivially easy to add new ActorComponents in the defaultproperties of a class.  Spawning Emitters (a descendant of Actor) when I could have just added ParticleSystemComponents in my Pawn&#8217;s defaultproperties block was probably my worst offense.</p>
<p>If you only read one page on UDN, read the page on <a href="http://udn.epicgames.com/Three/ActorComponents.html" target="_blank">ActorComponents</a>. (If you only read one page on UDN though, you&#8217;re probably doomed.  Read a lot of UDN pages, just make sure you don&#8217;t miss the one on ActorComponents.)  </p>
<p>For people experienced with Unreal, these tips are probably old hat, but it&#8217;s surprising how far you can get with the engine while still missing basics like ones above.  Personally, knowing the above tidbits ahead of time would have probably sped up the development of my first Unreal Engine game prototypes significantly.</p>
]]></content:encoded>
			<wfw:commentRss>https://gamedevwithoutacause.com/?feed=rss2&#038;p=1708</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>Copy-Paste Between Different Objects in UDK</title>
		<link>https://gamedevwithoutacause.com/?p=1292</link>
		<comments>https://gamedevwithoutacause.com/?p=1292#comments</comments>
		<pubDate>Tue, 07 Aug 2012 14:31:37 +0000</pubDate>
		<dc:creator><![CDATA[Rob]]></dc:creator>
				<category><![CDATA[Game Development]]></category>
		<category><![CDATA[UDK]]></category>

		<guid isPermaLink="false">http://gamedevwithoutacause.com/?p=1292</guid>
		<description><![CDATA[Normally, when you copy-paste data between objects in the UDK Editor, the source and destination objects must be the same type in order for the data transfer to succeed. There is, however, a useful trick you can use if you &#8230; <a href="https://gamedevwithoutacause.com/?p=1292">Continue reading <span class="meta-nav">&#8594;</span></a>]]></description>
				<content:encoded><![CDATA[<p><a href="http://gamedevwithoutacause.com/wp-content/uploads/2012/08/0800_copy_paste_babies.jpeg"><img src="http://gamedevwithoutacause.com/wp-content/uploads/2012/08/0800_copy_paste_babies.jpeg" alt="" title="0800_copy_paste_babies" width="400" height="385" class="aligncenter size-full wp-image-1297" /></a><br />
Normally, when you copy-paste data between objects in the UDK Editor, the source and destination objects must be the same type in order for the data transfer to succeed.  There is, however, a useful trick you can use if you ever find yourself needing to copy large amounts of data between objects of different types.<br />
<span id="more-1292"></span></p>
<p>The core of this trick stems from the format that UDK uses when copying data to the clipboard for copy-past operations.  It just so happens that the format UDK uses when serializing data to the clipboard is the same format it uses for defining object settings in UnrealScript defaultproperties blocks.  That is to say that it serializes objects to an easily human-readable, and therefore human-editable, format.</p>
<p>The trick is to, after copying an object from the UDK Editor, paste it to a text editor.  From the text editor, you can modify the source object definition to match the destination object.  Then, you just need to copy the modified text and paste it back into the UDK Editor.  If all goes well, you should see your data copied to the destination object.</p>
<p>Voila!  Tedious hand-editing averted by (semi-)clever hacking.</p>
]]></content:encoded>
			<wfw:commentRss>https://gamedevwithoutacause.com/?feed=rss2&#038;p=1292</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>Creating a Simple In-Game Editor in UDK</title>
		<link>https://gamedevwithoutacause.com/?p=432</link>
		<comments>https://gamedevwithoutacause.com/?p=432#comments</comments>
		<pubDate>Tue, 03 Jan 2012 00:32:19 +0000</pubDate>
		<dc:creator><![CDATA[Rob]]></dc:creator>
				<category><![CDATA[Programming]]></category>
		<category><![CDATA[UDK]]></category>

		<guid isPermaLink="false">http://gamedevwithoutacause.com/?p=432</guid>
		<description><![CDATA[Any video game has a number variables that can be tweaked to affect the game experience. Often, adjusting these values is a trial-and-error process of iterating until the game just feels right. It&#8217;s common practice to implement a way of &#8230; <a href="https://gamedevwithoutacause.com/?p=432">Continue reading <span class="meta-nav">&#8594;</span></a>]]></description>
				<content:encoded><![CDATA[<p><a href="http://gamedevwithoutacause.com/wp-content/uploads/2012/01/ingame_editor.png"><img src="http://gamedevwithoutacause.com/wp-content/uploads/2012/01/ingame_editor-1024x559.png" alt="" title="ingame_editor" width="584" height="318" class="aligncenter size-large wp-image-438" /></a><br />
Any video game has a number variables that can be tweaked to affect the game experience.  Often, adjusting these values is a trial-and-error process of iterating until the game just <i>feels</i> right. It&#8217;s common practice to implement a way of doing such tweaking without having to restart the game to see changes take place: an in-game editor.</p>
<p>The UDK provides several utilities for editing objects and actors on-the-fly.  You can use these utilities to quickly implement a tweaking interface to allow game designers on your team to easily adjust game parameters in realtime.<span id="more-432"></span></p>
<p>The core of UDK&#8217;s realtime tweaking capabilities is a feature called <a href="http://udn.epicgames.com/Three/RemoteControl.html">Remote Control</a>. Starting UDK.exe with Remote Control enabled opens up a window alongside the game which allows you to change graphics settings, inspect and edit active actors, and toggle stat captures.  Activating Remote Control also enables a series of console commands that can allow runtime editing of almost any instantiated object, actor, or archetype.</p>
<p>For example, you may want to implement an object that contain a categorized list of the various global tuning parameters you expose in your game.  These numbers could represent values that will eventually be constants in your game system but will need significant iteration in order to find the right mix for your game.</p>
<p>First of all, you&#8217;ll need to be able to start your game with Remote Control enabled.  In my case, I edit my UDK launch batch file to add &#8220;-remotecontrol&#8221; argument when launching UDK.exe:</p>
<pre class="brush: diff;">
Binaries\Win32\UDK.exe %start_map% -remotecontrol
</pre>
<p>Next, create an object to contain the parameters that you want to expose to your game designers.  By using the &#8220;var(category)&#8221; syntax for declaring members, you can organize them into collapsable tabs.  For arrays of objects, the &#8220;editinline&#8221; modifier makes it possible for designers to edit the objects contained within the array (as opposed to just the array itself.)</p>
<pre class="brush: c++;">
//Class written as example for blog article on creating an in-game editor
class TestGame_GameParameters extends Object;

var(Players) float PlayerHealthMultiplier;
var(Players) float PlayerSpeedMultiplier;
var(Players) float PlayerAttackMultiplier;

var(Enemy) float EnemyHealthMultiplier;
var(Enemy) float EnemySpeedMultiplier;
var(Enemy) float EnemyAttackMultiplier;

var(Weapons) editinline array<TestGame_Attack> WeaponAttacks;
var(Weapons) float SecondsPerWeaponBeat;

defaultproperties
{
	Begin Object Class=TestGame_InstantHitAttack Name=Attack1
		AttackName="OverhandLight"
		Damage=1.0
		Duration=1.0
		Cooldown=1.0
	End Object
	WeaponAttacks.Add(Attack1)

	Begin Object Class=TestGame_ProjectileAttack Name=Attack2
		AttackName="Fireball"
		Damage=4.0
		Duration=2.0
		Cooldown=3.0
	End Object
	WeaponAttacks.Add(Attack2)

	Begin Object Class=TestGame_InstantHitAttack Name=Attack3
		AttackName="OverhandHeavy"
		Damage=2.0
		Duration=1.0
		Cooldown=1.0
	End Object
	WeaponAttacks.Add(Attack3)

	PlayerHealthMultiplier = 1.0f
	PlayerSpeedMultiplier = 1.0f
	PlayerAttackMultiplier = 1.0f

	EnemyHealthMultiplier = 1.0f
	EnemySpeedMultiplier = 1.0f
	EnemyAttackMultiplier = 1.0f
}
</pre>
<p>With the game parameters object defined, it&#8217;s time to instantiate it in some easily accessible global space: GameInfo, for example.</p>
<pre class="brush: c++;">
class TestGame_GameInfo extends SimpleGame;

var TestGame_GameParameters GameTuningParameters;

//...

defaultproperties
{
	Begin Object Class=TestGame_GameParameters Name=GameParameters0
	End Object
	GameTuningParameters=GameParameters0
}</pre>
<p>It&#8217;s important to note the name of the game parameters object instantiated in defaultproperties, &#8220;GameParameters0&#8243;.  You&#8217;ll be able to use this name as a parameter to the &#8220;editobject&#8221; command to directly address your parameter object.</p>
<p>At this point, you can edit your game parameters object in-game by hitting tab and entering &#8220;editobject GameParameters0&#8243;.  Doing so will open a property grid targeting your global instance of TestGame_GameParameters.</p>
<p>Of course, typing in &#8220;editobject GameParameters0&#8243; tweak values is a nuisance and we don&#8217;t want anything discouraging your game designers from using the tools you&#8217;ve built.  To make it easier for them, we can take an extra step and make the game parameter property grid accessible with a single button press.</p>
<p>By editing DefaultInput.ini, you can set up a key binding like so:</p>
<pre class="brush: diff;">
;-----------------------------------------------------------------------------------------
; Game Keyboard/Mouse Bindings
;-----------------------------------------------------------------------------------------

; Binding for tweaking ingame parameters (written for blog post)
.Bindings=(Name="F9",Command="TweakGameParameters")
</pre>
<p>With the above setting, pressing F9 will call an exec function called TweakGameParameters().  After that, it&#8217;s just a matter of defining said function:</p>
<pre class="brush: c++;">
class TestGame_PlayerControler extends PlayerController;

exec function TweakGameParameters()
{
   ConsoleCommand("editobject GameParameters0");
}
</pre>
<p>And that&#8217;s it!  Now, your team&#8217;s game designers will be able to press F9 while the game is running to bring up a property grid for tweaking game parameters on-the-fly.</p>
]]></content:encoded>
			<wfw:commentRss>https://gamedevwithoutacause.com/?feed=rss2&#038;p=432</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>QCF+Punch: Implementing Street Fighter-style Input</title>
		<link>https://gamedevwithoutacause.com/?p=266</link>
		<comments>https://gamedevwithoutacause.com/?p=266#comments</comments>
		<pubDate>Mon, 19 Dec 2011 00:00:46 +0000</pubDate>
		<dc:creator><![CDATA[Rob]]></dc:creator>
				<category><![CDATA[Game Design]]></category>
		<category><![CDATA[Programming]]></category>
		<category><![CDATA[UDK]]></category>

		<guid isPermaLink="false">http://gamedevwithoutacause.com/?p=266</guid>
		<description><![CDATA[Ah, the QCF+Punch (Quarter-circle Forward and Punch). Also known as the &#8220;Hadouken&#8221; motion or &#8220;Fireball&#8221; motion.  It&#8217;s a standard in fighting games to have a tier of special moves tied to complicated input commands like QCF+Punch.  The extra difficulty in &#8230; <a href="https://gamedevwithoutacause.com/?p=266">Continue reading <span class="meta-nav">&#8594;</span></a>]]></description>
				<content:encoded><![CDATA[<p><a href="http://gamedevwithoutacause.com/wp-content/uploads/2011/12/street_fighter_4_strapya_moves.jpeg"><img class="aligncenter size-medium wp-image-279" title="street_fighter_4_strapya_moves" src="http://gamedevwithoutacause.com/wp-content/uploads/2011/12/street_fighter_4_strapya_moves-300x198.jpg" alt="" width="300" height="198" /></a><br />
Ah, the QCF+Punch (Quarter-circle Forward and Punch). Also known as the &#8220;Hadouken&#8221; motion or &#8220;Fireball&#8221; motion.  It&#8217;s a standard in fighting games to have a tier of special moves tied to complicated input commands like QCF+Punch.  The extra difficulty in executing the command lends a greater sense of accomplishment that, when paired with a suitably powerful attack outcome, can make a game feel more visceral than if a powerful attack were launched with a single button press.</p>
<p>In my latest game prototype, I decided to implement a simple Street Fighter-like command input system for executing special attacks.  The big trick here is to take a stream of (imperfect) human input, compare it against a list of canonical actions, and match in such a way that a human player will be satisfied that the system is responding accurately to their input.  This is how I put it together.<span id="more-266"></span></p>
<p>For the command input system, I start off with a series of commands that I will recognize.</p>
<ol>
<li>Super Beam (HCF+ATK)</li>
<li>Energy Ball (QCF+ATK)</li>
<li>Spin Attack (QCB+ATK)</li>
<li>Normal Attack (ATK)</li>
</ol>
<div>The list above contains the names of attacks with their corresponding input strings written in parentheses.  The abbreviations for the attack strings mean the following:</div>
<ul>
<li>ATK = Attack button</li>
<li>HCF = Half-circle forward</li>
<li>QCF = Quarter-circle forward</li>
<li>QCB = Quarter-circle backward</li>
</ul>
<div>So, &#8220;QCF+ATK&#8221; would be a quarter-circle forward motion following by an attack button, the canonical &#8220;fireball motion&#8221;.</div>
<p>I specifically ordered the attacks starting from the most complex inputs going to the simplest.  This is the order in which I will test actions against my input buffer and I want to make sure my more complex actions will be recognized over the simpler actions.  This is especially important for HCF+ATK versus QCF+ATK because the latter is actually a subset of the former.</p>
<p>With a list of actions in hand, the next step is to fill a buffer with input from the player.  Ideally, I would like to have input capture running at a fixed rate independent of my visual framerate.  However, since I&#8217;m using the UDK for my prototype, it would be a bit difficult (not to mention wasteful) to implement a custom input capture system.  So, I settled for extending the existing PlayerInput implementation to log input and throw out commands older than some arbitrary age (about 0.5 seconds in my initial implementation.)  This gives me a record of the inputs executed by the player over the last half a second.</p>
<p>The final step in command recognition is to actually match actions against my player&#8217;s input buffer.  In a world of perfect player input, I would just have to search the buffer for occurrences of sequences like Down + Down-Right + Right + Attack in order to match QCF+ATK.  In reality, player input has a lot more variance.  While a player may intend to enter Down + Down-Right + Right + Attack in order to launch a QCF+ATK, they are just as likely to enter something like Down + Down + Down-Right + Right + Up-Right + Attack.  To a computer, that sequence looks nothing like a QCF+ATK, but the player is most likely going to be convinced they entered a QCF+ATK, if not perfectly, at least well enough.</p>
<p>In order to give the player a suitable level of forgiveness in action matching, I search across the input buffer for matching inputs while ignoring non-matching inputs.  As long as a subset of the buffer matches the target action&#8217;s input string (in the proper order), then I consider the action matched and end my search.  I also clear the input buffer as I know consider it &#8220;consumed&#8221; for the purpose of recognizing command actions.</p>
<p>With the input Down + Down + Down-Right + Right + Up-Right + Attack as an example, I would check against the &#8220;Super Beam&#8221; action (HCF+ATK) and fail to match.  Then, I would check against the &#8220;Energy Ball&#8221; action (QCF+ATK) and match against the buffer since Down + Down-Right + Right + Attack occurs in the buffer once I ignore the extraneous Down and Up-Right.</p>
<p>The end result of this implementation is a fairly convincing input matching system that should satisfy most player&#8217;s with its mix of accuracy and forgiveness.  By tuning the length of time to preserve the input buffer, you can control the tightness of the input recognition to match your tastes.</p>
<p>The UnrealScript source code for the input matching system follows:</p>
<pre class="brush: c++;">class BPG_PlayerInput extends PlayerInput;

enum BPG_InputCommand
{
        BIC_Up,
        BIC_UpRight,
        BIC_Right,
        BIC_DownRight,
        BIC_Down,
        BIC_DownLeft,
        BIC_Left,
        BIC_UpLeft,
        BIC_Attack
};

struct BPG_InputCommandEntry
{
        var BPG_InputCommand InputCommand;
        var float AgeSeconds;
};

struct BPG_ActionDescription
{
        var name ActionName;
        var array Inputs;
};

var transient bool LastAttackPressed;
var transient bool AttackPressed;
var transient array CommandBuffer;

var array Actions;
var transient int LastMatchIndex;

const COMMAND_INPUT_MAX_AGE = 0.5f;
const MATCH_REMEMBER_TIME = 1.0f;

function string CommandToString(BPG_InputCommand inputCommand)
{
        switch( inputCommand )
        {
        case BIC_Up:
                return "U_";
                break;
        case BIC_UpRight:
                return "UR";
                break;
        case BIC_Right:
                return "R_";
                break;
        case BIC_DownRight:
                return "DR";
                break;
        case BIC_Down:
                return "D_";
                break;
        case BIC_DownLeft:
                return "DL";
                break;
        case BIC_Left:
                return "L_";
                break;
        case BIC_UpLeft:
                return "UL";
                break;
        case BIC_Attack:
                return "AT";
                break;
        }
        return "";
}

function string GetBestMatchAsString()
{
        if( LastMatchIndex == -1 )
                return "NO MATCH";

        return string(Actions[LastMatchIndex].ActionName);
}

function string GetActionsAsString()
{
        local String actionString;
        local int index, index2;

        for(index = 0; index &lt; Actions.Length; ++index)
        {
                actionString $= Actions[index].ActionName;
                actionString $= "(";
                for(index2 = 0; index2 &lt; Actions[index].Inputs.Length; ++index2)                 {                         if( index2 &gt; 0 )
                        {
                                actionString $= ", ";
                        }
                        actionString $= CommandToString( Actions[index].Inputs[index2] );
                }
                actionString $= ")\n";
        }

        return actionString;
}

function string GetCommandBufferAsString()
{
        local String commandBufferString;
        local int i;

        for( i = 0; i &lt; CommandBuffer.Length; ++i )
        {
                commandBufferString $= " " $ CommandToString( CommandBuffer[i].InputCommand );
        }

        return commandBufferString;
}

function AddCommand(BPG_InputCommand inputCommand)
{
        local BPG_InputCommandEntry commandEntry;
        commandEntry.InputCommand = inputCommand;
        commandEntry.AgeSeconds = 0.0f;
        CommandBuffer.AddItem(commandEntry);
}

//Hooked to action in DefaultInput.ini
exec function AttackStart()
{
        AttackPressed = true;
}

//Hooked to action onrelease in DefaultInput.ini
exec function AttackStop()
{
        AttackPressed = false;
}

// Postprocess the player's input.
event PlayerInput( float DeltaTime )
{
        local int index;
        local array indexesToRemove;

        super.PlayerInput(DeltaTime);

        for( index = 0; index &lt; CommandBuffer.Length; ++index)         {                 CommandBuffer[index].AgeSeconds += DeltaTime;                 if( CommandBuffer[index].AgeSeconds &gt;= COMMAND_INPUT_MAX_AGE )
                {
                        indexesToRemove.AddItem(index);
                }
        }

        for( index = 0; index &lt; indexesToRemove.Length; ++index)         {                 CommandBuffer.Remove(indexesToRemove[index], 1);         }         if( aBaseY &gt; 0.0f )
        {
                if( aStrafe &gt; 0.0f )
                {
                        AddCommand(BIC_UpRight);
                }
                else if( aStrafe &lt; 0.0f )
                {
                        AddCommand(BIC_UpLeft);
                }
                else            {
                        AddCommand(BIC_Up);
                }
        }
        else if( aBaseY &lt; 0.0f )         {                 if( aStrafe &gt; 0.0f )
                {
                        AddCommand(BIC_DownRight);
                }
                else if( aStrafe &lt; 0.0f )                 {                         AddCommand(BIC_DownLeft);                 }                 else            {                         AddCommand(BIC_Down);                 }         }         else         {                 if( aStrafe &gt; 0.0f )
                {
                        AddCommand(BIC_Right);
                }
                else if( aStrafe &lt; 0.0f )
                {
                        AddCommand(BIC_Left);
                }
        }

        if( AttackPressed &amp;&amp; !LastAttackPressed)
        {
                AddCommand(BIC_Attack);
        }
        LastAttackPressed = AttackPressed;

        FindBestActionMatch();
}

function FindBestActionMatch()
{
        local int actionIndex;
        local int inputIndex;
        local int commandBufferIndex;
        local int matchedInputCount;

        //For each action (ordered by priority)
        for(actionIndex = 0; actionIndex &lt; Actions.Length; ++actionIndex)         {                 commandBufferIndex = CommandBuffer.Length - 1;                 matchedInputCount = 0;                 //Walk backwards through input on list and find in command buffer                 for( inputIndex = Actions[actionIndex].Inputs.Length - 1; inputIndex &gt;= 0; inputIndex-- )
                {
                        //Consume commandBuffer until we find our target input (or run out of buffer)
                        while( commandBufferIndex &gt;= 0 )
                        {
                                if( Actions[actionIndex].Inputs[inputIndex] == CommandBuffer[commandBufferIndex].InputCommand )
                                {
                                        matchedInputCount++;
                                        break;  
                                }
                                commandBufferIndex--;
                        }
                }

                //If we matched all inputs in an action, record that action and stop searching
                //Also clear the command buffer since it's all processed
                if( matchedInputCount == Actions[actionIndex].Inputs.Length )
                {
                        LastMatchIndex = actionIndex;
                        SecondsSinceLastMatch = 0.0f;
                        CommandBuffer.Length = 0;
                        break;
                }
        }
}

defaultproperties
{
        Actions(0)=(ActionName="EX1", Inputs=(BIC_Left, BIC_DownLeft, BIC_Down, BIC_DownRight, BIC_Right, BIC_Attack))
        Actions(1)=(ActionName="SP2", Inputs=(BIC_Down, BIC_DownRight, BIC_Right, BIC_Attack))
        Actions(2)=(ActionName="SP1", Inputs=(BIC_Down, BIC_DownLeft, BIC_Left, BIC_Attack))
        Actions(3)=(ActionName="ATK", Inputs=(BIC_Attack))

        LastMatchIndex=-1

        LastAttackPressed=false
        AttackPressed=false
}</pre>
]]></content:encoded>
			<wfw:commentRss>https://gamedevwithoutacause.com/?feed=rss2&#038;p=266</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>More Useful UDK Flags</title>
		<link>https://gamedevwithoutacause.com/?p=228</link>
		<comments>https://gamedevwithoutacause.com/?p=228#comments</comments>
		<pubDate>Mon, 12 Dec 2011 00:06:03 +0000</pubDate>
		<dc:creator><![CDATA[Rob]]></dc:creator>
				<category><![CDATA[Programming]]></category>
		<category><![CDATA[UDK]]></category>

		<guid isPermaLink="false">http://gamedevwithoutacause.com/?p=228</guid>
		<description><![CDATA[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&#8217;ve added a few more UDK command-line arguments to further &#8230; <a href="https://gamedevwithoutacause.com/?p=228">Continue reading <span class="meta-nav">&#8594;</span></a>]]></description>
				<content:encoded><![CDATA[<p><a href="http://gamedevwithoutacause.com/wp-content/uploads/2011/11/the-fatal-warning-movie-poster-1929-1020202673.jpeg"><img class="aligncenter size-medium wp-image-233" title="the-fatal-warning-movie-poster-1929-1020202673" src="http://gamedevwithoutacause.com/wp-content/uploads/2011/11/the-fatal-warning-movie-poster-1929-1020202673-190x300.jpg" alt="" width="190" height="300" /></a>As you can probably guess from my <a title="Launch UDK Game Without Cooking" href="http://gamedevwithoutacause.com/?p=164">post</a> on getting the UDK to launch without cooking, I like writing batch files to make my work more efficient. Since that post, I&#8217;ve added a few more UDK command-line arguments to further improve my workflow. I&#8217;d like to share those here and help others find their UnrealScript bugs earlier and more easily than before.<span id="more-228"></span></p>
<p>These are the UDK command-line parameters that I find indispensable for improving my development experience:</p>
<ul>
<li><strong>warningsaserrors</strong> &#8211; 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&#8217;ll help them because I&#8217;m a <del>mean</del> nice guy and I don&#8217;t want to waste their time or mine.</li>
<li><strong>scriptstackonwarnings</strong> &#8211; 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&#8217;re a <a href="http://en.wikipedia.org/wiki/DRY">DRY</a>-kind of programmer, right?)  In fact, I can&#8217;t think of any reason why you wouldn&#8217;t want to have this flag enabled&#8230;</li>
<li><strong>fatalscriptwarnings</strong> &#8211; This argument is for when you&#8217;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&#8217;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&#8217;s fairly trivial to add the necessary nil-checks to prevent these warnings.  Enabling scriptstackonwarnings should help you find these bugs with no problem.</li>
</ul>
<p>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:</p>
<pre class="brush: diff;">set start_map=BPG_Entry

Binaries\Win32\UDK.com make -warningsaserrors

IF errorlevel 1 GOTO :ERROR_EXIT
Binaries\Win32\UDK.exe %start_map% -log -scriptstackonwarnings

GOTO :GOOD_EXIT

:ERROR_EXIT
pause
exit /b %ERRORLEVEL%

:GOOD_EXIT</pre>
<p>I hope this proves useful to other UDK-users out there. Good coding and bug-hunting to you all!</p>
]]></content:encoded>
			<wfw:commentRss>https://gamedevwithoutacause.com/?feed=rss2&#038;p=228</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>Skip the UDK Startup Movie</title>
		<link>https://gamedevwithoutacause.com/?p=168</link>
		<comments>https://gamedevwithoutacause.com/?p=168#comments</comments>
		<pubDate>Wed, 30 Nov 2011 00:47:10 +0000</pubDate>
		<dc:creator><![CDATA[Rob]]></dc:creator>
				<category><![CDATA[Programming]]></category>
		<category><![CDATA[UDK]]></category>

		<guid isPermaLink="false">http://gamedevwithoutacause.com/?p=168</guid>
		<description><![CDATA[Epic may put a lot of thought into their startup movies, but I don&#8217;t want to have to see them every time I startup UDK game to check my UnrealScript changes. With a quick little trick, you can avoid playing &#8230; <a href="https://gamedevwithoutacause.com/?p=168">Continue reading <span class="meta-nav">&#8594;</span></a>]]></description>
				<content:encoded><![CDATA[<p><a href="http://gamedevwithoutacause.com/wp-content/uploads/2011/11/UDK_LOGO_blackglow.jpeg"><img class="aligncenter size-medium wp-image-174" title="UDK_LOGO_blackglow" src="http://gamedevwithoutacause.com/wp-content/uploads/2011/11/UDK_LOGO_blackglow-279x300.jpg" alt="" width="279" height="300" /></a><br />
Epic may put a lot of thought into their <a title="Nice Logos, Epic" href="http://gamedevwithoutacause.com/?p=73">startup movies</a>, but I don&#8217;t want to have to see them every time I startup UDK game to check my UnrealScript changes. With a quick little trick, you can avoid playing the UDK logo movie and speed up your development iteration.<br />
<span id="more-168"></span></p>
<p>All you have to do is delete/rename UDK_logo.bik which is located at $UDK_ROOT\UDK_Game\Movies.  This prevents the movie from playing (obviously) and allows the UDK to start up faster.  It&#8217;s a trick that&#8217;s about as dirty and as simple as they come, but it can really make a difference when you&#8217;re iterating on game script.</p>
<p>Epic, your logo movies are nice and all, but sometimes I just want to concentrate on making my game.  Nothing personal, right?</p>
]]></content:encoded>
			<wfw:commentRss>https://gamedevwithoutacause.com/?feed=rss2&#038;p=168</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>Launch UDK Game Without Cooking</title>
		<link>https://gamedevwithoutacause.com/?p=164</link>
		<comments>https://gamedevwithoutacause.com/?p=164#comments</comments>
		<pubDate>Mon, 21 Nov 2011 00:45:13 +0000</pubDate>
		<dc:creator><![CDATA[Rob]]></dc:creator>
				<category><![CDATA[Programming]]></category>
		<category><![CDATA[UDK]]></category>

		<guid isPermaLink="false">http://gamedevwithoutacause.com/?p=164</guid>
		<description><![CDATA[In my professional work, I&#8217;ve gotten used to all the freedom that comes from having access to Unreal source code. Meanwhile, at home, I&#8217;ve been using the UDK and have been extremely frustrated by how much my development speed drops &#8230; <a href="https://gamedevwithoutacause.com/?p=164">Continue reading <span class="meta-nav">&#8594;</span></a>]]></description>
				<content:encoded><![CDATA[<p><a href="http://gamedevwithoutacause.com/wp-content/uploads/2011/11/Little-Caesars-Hot-N-Ready-Pizza.jpeg"><img class="aligncenter size-full wp-image-171" title="Little Caesars Hot-N-Ready Pizza" src="http://gamedevwithoutacause.com/wp-content/uploads/2011/11/Little-Caesars-Hot-N-Ready-Pizza.jpeg" alt="" width="320" height="320" /></a><br />
In my professional work, I&#8217;ve gotten used to all the freedom that comes from having access to Unreal source code. Meanwhile, at home, I&#8217;ve been using the UDK and have been extremely frustrated by how much my development speed drops because I don&#8217;t have access to my usual workplace tools.</p>
<p>The biggest slowdown culprit has been the Unreal Frontend. Ostensibly a tool to give you easy access to every step of the Unreal workflow, it can slow development to a crawl because it forces you to cook data every time you update your script. It does this by hardcoding the &#8220;-seekfreeloading&#8221; flag when it launches UDK.exe. With this flag enabled, UDK.exe will only load seek-free packages which only get updated when cooked. Considering that cooking can take minutes depending on your machine and any script you edit needs to be cooked if you want to see its effect in-game, the &#8220;-seekfreeloading&#8221; flag can slow the typical edit-&gt;compile-&gt;run cycle to a crawl.<br />
<span id="more-164"></span></p>
<p>At work, I can modify and rebuild Unreal&#8217;s tools to match my (and my team&#8217;s) preferred workflow with no problem. Using the stock binaries that come with the UDK, I have to be a bit trickier. In this case, it&#8217;s not too hard because all the Unreal Frontend does is marshall parameters for executing programs on the commandline. This means that I can replicate almost anything that the Unreal Fronted does by using batch files.</p>
<p>In the case of launching the game without &#8220;-seekfreeloading&#8221;, it&#8217;s as easy as this:</p>
<pre class="brush: diff;">Binaries\Win32\UDK.exe MyGame_Entry</pre>
<p>You can call this from the root folder of the UDK with &#8220;MyGame_Entry&#8221; being replaced by a map of your choice. When launched this way, UDK.exe will use the compiled script and editor content packages directly instead of loading pre-cooked data. The key here, of course, is the lack of &#8220;-seekfreeloading&#8221; as a parameter for UDK.exe.</p>
<p>Since this is for speeding up my UnrealScript editing workflow, I like to make sure I build my scripts before launching my game:</p>
<pre class="brush: diff;">Binaries\Win32\UDK.com make
Binaries\Win32\UDK.exe MyGame_Entry</pre>
<p>Calling UDK.com instead of UDK.exe allows the output from the make command to stay in the same console window instead of launching in a new window. This is great when you want to see errors that come up from mistakes in your UnrealScript.</p>
<p>With a little bit of work, I can make a batch file that will launch UDK.exe only if scripts were successfully built and pause to let me examine the error report otherwise:</p>
<pre class="brush: diff;">set start_map=BPG_Entry

Binaries\Win32\UDK.com make

IF errorlevel 1 GOTO :ERROR_EXIT
Binaries\Win32\UDK.exe %start_map%

GOTO :GOOD_EXIT

:ERROR_EXIT
pause
exit /b %ERRORLEVEL%

:GOOD_EXIT</pre>
<p>Now, my workflow can be edit script -&gt; save -&gt; double-click LaunchUDKGame.bat -&gt; check my changes -&gt; repeat. Much faster without the cooking step. This means I can spend more of my time making my game instead of just waiting for the UDK to run.</p>
]]></content:encoded>
			<wfw:commentRss>https://gamedevwithoutacause.com/?feed=rss2&#038;p=164</wfw:commentRss>
		<slash:comments>1</slash:comments>
		</item>
	</channel>
</rss>
