A Story about an Unknown destined to be a hero. Well mixture of retro style platforming and tap based gameplay for iPad family devices. A game with varying look/feel and gameplay style.

Post tutorial Report RSS Fast forward a Matinee for iOS (UDK)

This tutorial is about fast forwarding a Matinee in UDK (something like skipping a cut-scene in Infinity Blade series ).

Posted by on - Intermediate Other

Hello all UDK devs,

First, I target this tutorial for intermediate UDK devs, who know most about the class hierarchy, basic understanding of unreal script, input handling for iOS devices in UDK and obviously knows how to setup a new game (you can check in hourences for this, though a new game for iOS needs some more things).

Also, this is not a copy/paste code tutorial, so you need to understand and then apply to project.

In this tutorial we gonna learn how to fast forward a matinee in real time during gameplay, like we do to skip cut-scene in Infinity Blade series.

Here is a video what we will achieve at the end:


**I am using skelmesh and sound from jazz Rabit package that comes with UDK.
**I pressed and released the skip button two times so, it was like fast forward---> normal and fast forward ------> normal.

At first we need to set few things:

1. Setup a input zone in DefaultGame.ini and then add it to a new "Mobile Input Config" with a unique group name, besides from your normal group that includes your basic gameplay controls. (if you dont know how to do that please check this on UDN ). You should have min of 2 input groups for this system, in my example I have 2 groups, one for the basic controls to control the player and other for the skip. Please note: Only one input group can be active at a time.
For this tutorial i will be using the skip group name as "SkipGroup" and normal control group name as "NormalGroup".

2. A custom Kismet Sequence to activate and deactivate the "SkipGroup" input group. We need to activate this when a matinee is played in Kismet with "bDrawSkipButton" checked and again connect to another instance of this node with " bDrawSkipButton" unchecked when matinee ends.

Activate Skip (Ksmet Sequence)

class mySeqAct_ToggleSkip extends SequenceAction;

//player object to be passed from kismet
var Object PlayerObject;

var myPlayerController mPC;

/**should we draw skip button */
var() bool bDrawSkipButton;
/** desired fast forward playback speed, 1 is default matinee playback speed*/
var() float playRate;

event Activated()
{
 if(PlayerObject == none)
      return;

  mPC = myPlayerController(PlayerObject);
  
  if(mPC != none)
   {
     if(bDrawSkipButton)
	{
          mPC.PlayerInput.ResetInput();   //flush the input buffer
          mPC.drawSkipButton();	
          mPC.setSkipRate(playRate);			
	}
	else
	{
         mPC.PlayerInput.ResetInput();   //flush the input buffer
         mPC.drawNormalControls();
	}
    }
}

DefaultProperties
{
 ObjName="Toggle Skip Button"       // name of the sequence in Kismet
 ObjCategory="my Custom Nodes"   // name of the sub catagory in Action catagory, this sequence belongs 
 
 playRate=2.0                   //setting the playback speed to 2X by default

 VariableLinks.Empty
 VariableLinks(0)=(ExpectedType=class'SeqVar_Object',LinkDesc="Player",PropertyName=PlayerObject)
}

*************************

After you have setup above mentioned steps successfully its time to go to your playerController class. According to me playerController class is the best place to apply this, because in playerController we have easy access to "WorldInfo" and "PlayerInput". We will need this two references for this tutorial.

Apart form your own code, add this in your PC class:

//additional variables needed for this system
var float defaultPlayRate;  //stores the default play speed of the matinee 
var float manipulatedRate;  //stores the applied play speed of the matinee during fast forward
var seqAct_Interp currentPlayingMatinee; //stores the reference to the currently playing matinee

/**returns reference to the currently playing matinee*/
function SeqAct_Interp getCurrentPlayingMatinee()
{
	local int i;
	local Sequence GameSeq;
	local array<SequenceObject> AllSeqObjects;

	GameSeq = WorldInfo.GetGameSequence();  //getting the game sequence from the current level

	if(GameSeq != none)
	{
		GameSeq.FindSeqObjectsByClass(class 'SeqAct_Interp',true,AllSeqObjects); //get all the sequence object and fill the supplied Array

		for(i=0;i<AllSeqObjects.Length;i++)
		{
			if(SeqAct_Interp(AllSeqObjects[i]).bIsPlaying) //checking if the matinee is playing
			{
				return SeqAct_Interp(AllSeqObjects[i]); //return the reference of the playing matinee
			}
		}

		return none;
	}

	return none;

}

/**set the fast forward play rate, called from the kismet sequenceAction*/
function setSkipRate(float newRate)
{
	manipulatedRate = newRate;
}

/**called from key pressed event, set it in defaultInput.ini*/
exec function skipPressed()
{   
        currentPlayingMatinee = getCurrentPlayingMatinee();  //gets the current matinee
	defaultPlayRate= currentPlayingMatinee.PlayRate; //storing the default play rate before new play rate is applied.
	currentPlayingMatinee.PlayRate = manipulatedRate; //applying new play rate
}

/**called from key pressed event, set it in defaultInput.ini*/
exec function skipReleased()
{
	if(currentPlayingMatinee != none)
	{
		`log("default rate: "@defaultPlayRate);
		currentPlayingMatinee.PlayRate = defaultPlayRate; //set the default play rate when the key is released
	}
}

/**Use to draw the skip button on screen by activating the relative input group*/
function drawSkipButton()
{	
  MobilePlayerInput(playerInput).SetMobileInputConfig("SkipGroup");	
}
/**draw the normal controls*/
function drawNormalControls()
{	
  MobilePlayerInput(playerInput).SetMobileInputConfig("NormalGroup"); //your normal control group name	
}

Now, Finally we need to tweak some INI files
a. in DefaultInput.ini, add this:
.Bindings=(Name="MOBILE_Skip",Command="skipPressed | OnRelease skipReleased") // name of the exec functions in your PC class.

b. in DefaultGame.ini, when you define zone add this:
[SkipButton MobileInputZone]
Type=ZoneType_Button
InputKey=MOBILE_Skip ---> this should match exactly with input name in defaultInput.ini, see point a.
...... //Set other properties
*************************

**you can use these code wherever you want, however mentioning my name is appreciable.

-with regards
Kashyap Singha Phukan

Post a comment

Your comment will be anonymous unless you join the community. Or sign in with your social account: