CSE4MOD Advanced bits n’ pieces

Post on 22-Feb-2016

31 views 0 download

description

CSE4MOD Advanced bits n’ pieces. Paul Taylor 2009. Vectors and Rotators. Vector: Float X Y Z Network Replication: 16bit int (- 32768-32767) Rotator: Integer Pitch Yaw Roll (16bit U-Sig) Network Replication: 8bit ints (>>8) Unrealscript uses radians 2Pie = 360 Degrees = 65535 - PowerPoint PPT Presentation

Transcript of CSE4MOD Advanced bits n’ pieces

CSE4MOD Advanced bits n’ pieces

Paul Taylor 2009

Vectors and Rotators

• Vector: Float X Y Z– Network Replication: 16bit int (- 32768-32767)

• Rotator: Integer Pitch Yaw Roll (16bit U-Sig)– Network Replication: 8bit ints (>>8)

• Unrealscript uses radians– 2Pie = 360 Degrees = 65535

• Degrees = Rad * 180/Pie• Radians = Deg / 180 * Pie• UUnits = Rad * 32767.5 / Pie• Radians = Uunits / 32767.5 * Pie

Vector from Rotator

Var rotator myRot;Var vector myVect;myRot = rot(32767.5, 0,0) // Upside downmyVect = vector(myRot)// Or adding magnitudemyVect = 100* vector(myRot)

Vector Size

Var vector A;Var float B;A = vect(0, 20, 0);// Magnitude of vector AB = VSize(A);

Normalising Vectors

Var vector myVect;Var vector myNorm;myVect = (21345,1234,4343);myNorm = Normal(myVect);

Dot Products

• These are used for the angle between two vectors

Var vector A, B;Var float angle;A = vector(10,1234,1234);B = vector(0,0,324);Angle = Normal(A) dot Normal(B);

Modifying Rotators in existing Classes

• After creating your rotation, you MUST use SetRotation();

• This is the same as movement, using SetLocation(); or Move(); etc

• All defined in Actor.uc

Linked Lists

• These are your replacement for dynamic arrays, which are not available in UnrealScript

This is a 2 part solution, we have a handler, and an Array Object

Class ArrayContainer extends Actor;var ArrayObject ObjectNo1;

Class ArrayObject extends Object;Var ArrayObject NextObject;

Enumerating Objects

Var ArrayObject Element;For (Element= ObjectNo1; Element!=none;

Element= ObjectNo1.Next){

// Do something}

Adding to the Array

Class Object:TempElement = New (none) class‘ArrayObject’;

Actor Object:TempElement = Spawn(class’ArrayObject’)

Depends on which type of object your list is made of

Adding to the Front = Easy

TempElement.next = ObjectNo1;ObjectNo1 = TempElement;

Adding to the back = Almost as Easy

Var ArrayObject Element;Element= ObjectNo1While(Element.Next != none)

Element= ObjectNo1.Next;

Element.Next = TempElement;TempElement.next = None; // Not really

needed!

Adding to the middle = hardest

Var ArrayObject Element;For (Element= ObjectNo1; Element!=none; Element=

ObjectNo1.Next){

// Check if this is the element we want to insert afterbreak; // Stop at this point

}tempElement.Next = Element.Next;Element.Next = tempElement;// Done!

Removing ObjectsVar ArrayObject doomedObj;For (Element= ObjectNo1; Element!=none; Element=

ObjectNo1.Next){

if (Element.Next == doomedObj){Element.Next = doomedObj.Next;return true;}

}Return false;

Game Types and Limitations

Deathmatch Games• All you need are weapons, PlayerStarts and a

good navigation network• This encompasses Team DM, Last Man

Standing, etc• Anything that has the only real goal of Kill or

be Killed• xGame.xDeathMatch, xGame.TeamGame

CTF (Capture The Flag)

• Two teams Only supported• One flag per team (multiples will fail)• xGame.xCFTGame– You must have an xBlueFlagBase and

xRedFlagBase.• Symmetry / A-Symmetry is required as there is

no team-swap mid game

Double Domination

• Teams must ‘control’ two points on a map for 10 seconds to score a point

• Level needs to have two points or more– xDomPointA xDomPointB, etc– You can use xMonitor->xDOMMonitorA / B to

create monitors which show who is controlling the area

Bombing Run

• This game type requires 3 objects– xBombSpawn actor– Two xBombDelivery actors• With Team->Team set to 0 and 1

Onslaught = Sweet

• Power Cores• Vehicles• Teleport Pads• Power Nodes

• Link Setup Must be exported to UnrealEd from In-Game

Linking Power Nodes and Power Cores

• Start your ONS map– Press esc, select the Map button– Click on Link Designer– Create your links then click on the ‘Export to

UnrealEd button.• This copies the info into the cut-paste ram.

– Right click in the level editor and select paste.– An eagle head will appear labelled

ONSPowerLinkOfficialSetup

Assault = Difficult

• Set Up Objectives• Player Spawn Management• Intro and Ending Scenes

Objectives

• TriggeredObjective• HoldObjective• DestroyableObjective• ProximityObjective

PlayerSpawnManagers

• You need two for each objective– Attackers– Defenders

– Team Numbers are used on the PlayerSpawnPoints to identify their associated Manger and thus Objective.

The End

Referecnces

• http://chimeric.beyondunreal.com/tutorials.php