Contents
Games Demystified: Rolando
 
 
Printer-Friendly VersionPrinter-Friendly Version
 
Latest News
spacer View All spacer
 
November 22, 2009
 
Video Game Watchdog National Institute On Media And The Family Shutting Down [12]
 
Modern Warfare 2 Infinity Ward's 'Most Successful PC Version' Yet [16]
 
New Tech, Design Details Of Project Natal To Emerge At Gamefest In February
spacer
Latest Jobs
spacer View All     Post a Job     RSS spacer
 
November 22, 2009
 
Trion Redwood City
Sr. Environment Artist
 
Trion Redwood City
Sr. Evnironment Modeler
 
Sucker Punch Productions
Network Programmer
 
Sucker Punch Productions
Texture Artist
 
Sucker Punch Productions
Character Artist
 
Sucker Punch Productions
3D Environment Artist
 
Crystal Dynamics
Sr. Level Designer
 
Sony Online Entertainment
Brand Manager
spacer
Latest Features
spacer View All spacer
 
November 22, 2009
 
arrow Upping The Craft: Susan O'Connor On Games Writing [7]
 
arrow Small Developers: Minimizing Risks in Large Productions - Part II [7]
 
arrow iPhone Piracy: The Inside Story [51]
 
arrow And Yet It Grows: Analyzing the Size and Growth of the European Game Market [5]
 
arrow NPD: Behind the Numbers, October 2009 [13]
 
arrow Reflecting On Uncharted 2: How They Did It [5]
 
arrow Sponsored Feature: Rasterization on Larrabee -- Adaptive Rasterization Helps Boost Efficiency
 
arrow Postmortem: Wadjet Eye's The Blackwell Convergence [2]
spacer
Latest Blogs
spacer View All     Post     RSS spacer
 
November 22, 2009
 
Managing Creativity
 
Time Fcuk - A Postmortem [3]
 
Accepting the Inherent Value of Games [1]
spacer
About
spacer News Director:
Leigh Alexander
Features Director:
Christian Nutt
Editor At Large:
Chris Remo
Advertising:
John 'Malik' Watson
Recruitment/Education:
Gina Gross
 
Features
  Games Demystified: Rolando
by Jeremy Alessi
0 comments
Share RSS
 
 
June 3, 2009 Article Start Previous Page 2 of 3 Next
 

Touch the World

Let's begin with the simplest technique: touch. This is a sensation we almost take for granted because it's so innate. Touch has always been a component in video game play. It's actually the joint that hinges our audio-visual experience to the rest of our body and makes a game feel tangible. Though it is widely perceived that touching a flat screen somehow produces a less tangible game, Rolando proves otherwise.

In Rolando, players can call upon characters -- the rolandos -- by touching or drag-box selecting them. When this happens the character is ready to go and then reacts to the tilt mechanism. In addition players can touch and move additional objects like elevators and gears.

Advertisement

In these instances players are directly manipulating objects that the rolandos are either too "weak" or lack the proper appendages to manipulate themselves. It is in these instances that the rolandos' worship sessions of the finger are most appropriate.

Let's have a look at some touch code. Though the original game was not written in this engine, the samples provided for this segment of Games Demystified -- downloadable here in a package -- are written in JavaScript for the Unity Engine, which is a fantastic component based engine.

The first component we'll examine is camera and the touch functionality of the device. In the game you can select a single rolando by tapping on them or you can select an entire gang of rolandos with an RTS-style selection box. Below is the code responsible for the highlight and selection of a rolando.

Camera Component:

var rolando : Transform;

private var debug : String;

private var initialSelection : Vector2 = Vector2( 0, 0 );
private var hit : RaycastHit;
private var selected : boolean = false;
private var touch : iPhoneTouch;

function FixedUpdate()
{
var ray = Camera.main.ScreenPointToRay( Vector2( touch.position.x, touch.position.y ) );
var layerMask = 1 << 2;
layerMask = ~layerMask;
if ( Physics.Raycast( ray, hit, 100 ) )
{
if ( hit.collider == rolando.collider )
{
selected = true;
rolando.SendMessage( "select", true );
rolando.SendMessage( "highlight", true );
}
else
{
selected = false;
rolando.SendMessage( "select", false );
rolando.SendMessage( "highlight", false );
}
}
}

function LateUpdate()
{
if ( !selected )
{
if ( iPhoneInput.touchCount == 2 )
{
touch = iPhoneInput.GetTouch( 0 );
transform.position == Vector3( transform.position.x, transform.position.y, -20 );
transform.position -= Vector3( touch.positionDelta.x, touch.positionDelta.y, 0 );
}
}
else
transform.position = Vector3( rolando.transform.position.x, rolando.transform.position.y, -10);
}

function OnGUI()
{
useGUILayout = false;
GUI.Box( Rect( 0, 0, 480, 20 ), "Debug - " + debug );

var screenPos : Vector2;
if ( iPhoneInput.touchCount == 1 )
{
touch = iPhoneInput.GetTouch( 0 );

if ( initialSelection == Vector2( 0, 0 ) )
initialSelection = touch.position;

if ( touch.position.x > initialSelection.x && initialSelection.y > touch.position.y )
GUI.Box( Rect( initialSelection.x, 320 - initialSelection.y, touch.position.x - initialSelection.x, initialSelection.y - touch.position.y ), "" );
if ( touch.position.x < initialSelection.x && initialSelection.y > touch.position.y )
GUI.Box( Rect( touch.position.x, 320 - initialSelection.y, initialSelection.x - touch.position.x, initialSelection.y - touch.position.y ), "" );
if ( touch.position.x > initialSelection.x && initialSelection.y < touch.position.y )
GUI.Box( Rect( initialSelection.x, 320 - touch.position.y, touch.position.x - initialSelection.x, touch.position.y - initialSelection.y ), "" );
if ( touch.position.x < initialSelection.x && initialSelection.y < touch.position.y )
GUI.Box( Rect( touch.position.x, 320 - touch.position.y, initialSelection.x - touch.position.x, touch.position.y - initialSelection.y ), "" );

if ( initialSelection != touch.position )
{
screenPos = Camera.main.WorldToScreenPoint( rolando.position );
if ( ( ( screenPos.x > initialSelection.x && screenPos.x < touch.position.x ) || ( screenPos.x < initialSelection.x && screenPos.x > touch.position.x ) ) && ( ( screenPos.y > initialSelection.y && screenPos.y < touch.position.y ) || ( screenPos.y < initialSelection.y && screenPos.y > touch.position.y ) ) )
rolando.SendMessage( "highlight", true );
else
rolando.SendMessage( "highlight", false );
}
}

if ( iPhoneInput.touchCount == 0 )
{
if ( initialSelection != Vector2( 0, 0 ) || ( initialSelection - touch.position ).magnitude < 5 )
{
screenPos = Camera.main.WorldToScreenPoint( rolando.position );
if ( ( ( screenPos.x > initialSelection.x && screenPos.x < touch.position.x ) || ( screenPos.x < initialSelection.x && screenPos.x > touch.position.x ) ) && ( ( screenPos.y > initialSelection.y && screenPos.y < touch.position.y ) || ( screenPos.y < initialSelection.y && screenPos.y > touch.position.y ) ) )
{
selected = true;
rolando.SendMessage( "select", true );
rolando.SendMessage( "highlight", true );
}
else
{
selected = false;
rolando.SendMessage( "select", false );
rolando.SendMessage( "highlight", false );
}
}
initialSelection = Vector2( 0, 0 );
}
}

 
Article Start Previous Page 2 of 3 Next
 
Comments

none
 
Comment:
 


Submit Comment