Download presentation
Presentation is loading. Please wait.
Published byJonathan Harrington Modified over 9 years ago
1
Important UDK Classes How they fit together Copyright © 2015 – Curt Hill
2
Introduction We have created a level We have seen an introduction to UnrealScript We should have also set several.ini files We should have also created several UnrealScript classes descended from: –GameInfo –Pawn –Controller
3
Classes There are several classes that are vital to your play These include: –WorldInfo –GameInfo –Actor –Pawn –Controller –Camera Understanding how these interrelate is crucial Copyright © 2015 – Curt Hill
4
WorldInfo This is the master class for the engine –We will use this to find out or change the world in our programs Source is in: …\Development\Src\Engine\Classes It has instance variables that control: –Lighting, physics, sounds among others Copyright © 2015 – Curt Hill
5
Functions GetWorldInfo will return a WorldInfo object Several iterators: –AllControllers –AllPawns Several events –PostBeginPlay –PreBeginPlay It is unlikely but possible we will make a descendant of WorldInfo Copyright © 2015 – Curt Hill
6
WorldInfo and GameInfo One of the most important objects of WorldInfo is GameInfo The instance variable of type GameInfo is named Game –Since UnrealScript is polymorphic it may be any descendant of GameInfo This is actually set in the Editor –Among other possible places Copyright © 2015 – Curt Hill
7
Menu The descendent of GameInfo that is actually part of the WorldInfo is set from the editor –Use the View and World menu This is connected to an individual level The Game Type is the set of values which are known descendants –A drop down It is also dependent on the ancestry of the GameInfo item you choose Copyright © 2015 – Curt Hill
8
View/World Copyright © 2015 – Curt Hill
9
GameInfo Determines the rules and characteristics of this game This will determine several things in the game –Presence or absence of the pawn –First or third person camera –Heads Up Display Next are four displays with different GameInfos Copyright © 2015 – Curt Hill
10
GameInfo Copyright © 2015 – Curt Hill
11
CloudGame Copyright © 2015 – Curt Hill
12
UTTeamGame Copyright © 2015 – Curt Hill
13
UTDeathMatch Copyright © 2015 – Curt Hill
14
GameInfo Descendents There are many, some of which also have descendants –PlayerCollectorGame –MobileMenuGame –FrameWorkGame SimpleGame –UDKGame UTGame UTDeathMatch The one you choose to derive has an effect on your game We will make our own as well Copyright © 2015 – Curt Hill
15
More on GameInfo There will only be one GameInfo (or descendant) instance Chosen before the level starts and persists for the rest of gameplay for that level –If the level is terminated and a new level entered a different GameInfo is used This class does delegate some of its duties to other classes Copyright © 2015 – Curt Hill
16
Continuing GameInfo also selects the player classes It specifies the default pawn, camera and controller class In this and other ways it is the central class for determining what game play will be like Copyright © 2015 – Curt Hill
17
Actors Recall that an actor is anything with a representation in the level This includes –Static meshes –Lights –Sounds –Pawns Copyright © 2015 – Curt Hill
18
Actor Events Destroyed() Falling () RanInto (Actor Other) –Actor ran into another actor TakeDamage and Tick will be considered later Copyright © 2015 – Curt Hill
19
More Events Bump (Actor Other, PrimitiveComponent OtherComp, Object.Vector HitNormal) –Somebody bumped me HitWall ( Object.Vector HitNormal, Actor Wall, PrimitiveComponent WallComp) Copyright © 2015 – Curt Hill
20
TakeDamage When a pawn or actor is damaged this event is called It may be used to modify the damage –Such as when armor is present It may also be called to inflict damage Copyright © 2015 – Curt Hill
21
TakeDamage Signature: event TakeDamage ( int Damage, Controller InstigatedBy, Object.Vector HitLocation, Object.Vector Momentum, class DamageType, optional Actor.TraceHitInfo HitInfo, optional Actor DamageCauser) Copyright © 2015 – Curt Hill
22
Tick(float delta) An event in any actor Parameter is time since last call Called so many times per second Allows animation and AI Usually want this to be quick if the actor is not active –Like: if(somebool) return Copyright © 2015 – Curt Hill
23
Actor Methods Destroy() –Makes it die Move (Vector) –Moves in this direction –Usually invoked in Tick so motion may be dependent on timing TakeRadiusDamage –Wrapper for TakeDamage Copyright © 2015 – Curt Hill
24
The Player Any player uses a set of several classes to function These are: –Controller –Pawn –Camera We now consider these Copyright © 2015 – Curt Hill
25
Pawn Controls the presence of the player in the level A player does not need a pawn, but if they lack one they can move around but not be seen Pawn is a derivation of Actor URL: http://wiki.beyondunreal.com/UE3:Pawn_(UDK) http://wiki.beyondunreal.com/UE3:Pawn_%28UD K%29 Copyright © 2015 – Curt Hill
26
Pawn Properties Float Alertness in the range -1 to 1 bool bLOSHearing bool bMuffledHearing bool bCanCrouch Controller SkeletalMeshComponent Mesh Weapon Copyright © 2015 – Curt Hill
27
Pawn Events BreathTimer() OutsideWorldBounds() –Max is 524286 uu PostBeginPlay() PreBeginPlay() SetWalking(bool iswalking) Copyright © 2015 – Curt Hill
28
Controller The interface between the person and the pawn class Interprets the keyboard commands and passes on to the pawn Say method takes a string and displays it to the pawn Copyright © 2015 – Curt Hill
29
Controller Events HearNoise IsInCombat Destroyed SeeMonstrer(Pawn) SeePlayer(Pawn) We will look at some of these in the animation presentation Copyright © 2015 – Curt Hill
30
Camera Generates the display that the player sees A first person display has the camera aligned with the player’s location and orientation In third person it usually follows the person around For dramatic effect it may leave the player and follow the action somewhere else Copyright © 2015 – Curt Hill
31
Startup When the game starts WorldInfo is initialized The first piece of code that you might get to see is the GameInfo init() method There are also the Post and Pre Begins of the various actors Copyright © 2015 – Curt Hill
32
Logging The debugging process is somewhat hard One of the tricks we use is logging Every time the editor (which is an extension of the game) starts it keeps a log It closes that log when done This log is UDKGame\Logs and is Launch.log In this we may write messages Copyright © 2015 – Curt Hill
33
Log Macro The command is a macro Part of the preprocessor The simplest form is just to take a string –Make the string say all that you need Example: `log(“*** Damage ”$DamageAmount); Copyright © 2015 – Curt Hill
34
Finally We have the fundamentals for putting actors into motion and making them active agents We now need an example to see it all come together Copyright © 2015 – Curt Hill
Similar presentations
© 2025 SlidePlayer.com. Inc.
All rights reserved.