250 likes | 392 Views
This document provides a comprehensive guide for advanced users of UnrealScript, focusing on vectors, rotators, and network replication. It covers practical implementations of vector mathematics, including normalization, dot products, and magnitude calculations. The guide also details network replication considerations with integer types and radians-to-degrees conversions. Furthermore, it delves into the creation and management of dynamic object arrays, gameplay types for deathmatches, and elaborate team game setups like Capture the Flag and Onslaught. Enhance your game development skills using these methodologies.
E N D
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 down myVect = vector(myRot) // Or adding magnitude myVect = 100* vector(myRot)
Vector Size Var vector A; Var float B; A = vect(0, 20, 0); // Magnitude of vector A B = 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; varArrayObject ObjectNo1; Class ArrayObject extends Object; VarArrayObjectNextObject;
Enumerating Objects VarArrayObject 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 VarArrayObject Element; Element= ObjectNo1 While(Element.Next != none) Element= ObjectNo1.Next; Element.Next = TempElement; TempElement.next= None; // Not really needed!
Adding to the middle = hardest VarArrayObject Element; For (Element= ObjectNo1; Element!=none; Element= ObjectNo1.Next) { // Check if this is the element we want to insert after break; // Stop at this point } tempElement.Next = Element.Next; Element.Next = tempElement; // Done!
Removing Objects VarArrayObjectdoomedObj; 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 • xDomPointAxDomPointB, 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.
Referecnces • http://chimeric.beyondunreal.com/tutorials.php