2. About Me
“Best Bachelor“ Computer Science
Kiel University, 2009
Master Games
Hamburg University of Applied Sciences, 2011
Lead Programmer
Daedalic Entertainment, 2011-2012
Co-Founder
slash games, 2013
2 / 58
3. Features
• complete editing environment
• pure rendering power (Gemini)
• state-of-the-art animation
(Mantinee)
• powerful scripting (Kismet)
• real worlds physics
• eye-popping lighting and shadows (Lightmass)
10. Licensing
• non-commercial use:
• free!
• commercial use:
• USD 99 up-front
• 0% royalty on first USD 50,000 in UDK related revenue
• 25% royalty on UDK related revenue above USD 50,000
11. Useful Stuff
• UT Source Code
• UDK Forums
• Showcases
• UDK Programming Home
• UDK Gems
• UnrealScript Language Reference
12. Working With The UDK
• UDK vs. Licensees
• monthly releases
• Feb 12: Recast
• May 12: RealD 3D
• Feb 13: Substance
• Visual Studio 2010 & nFringe
• UnrealEd & UnrealFrontend
• Content Packages
14. Unreal Engine Basics (Cont.)
• UnrealScript
• similar to C++ and Java
• high-level object-oriented language
• pointerless environment with automatic garbage
collection
• simple single-inheritance class graph
• strong compile-time type checking
• safe client-side execution "sandbox"
16. UnrealScript Features
• instantiation
• Actor.Spawn(class<Actor>) vs. new
• timers
• Actor.SetTimer(float, bool, name)
• iterators
• Actor.AllActors
• Actor.DynamicActors
• Actor.CollidingActors
17. UnrealScript Features (Cont.)
• states
state Dead
{
ignores SeePlayer, HearNoise, KilledBy, NextWeapon, PrevWeapon;
function bool IsDead()
{
return true;
}
// ...
}
Source: PlayerController.uc
18. UnrealScript Features (Cont.)
• exec functions
.Bindings=(Name="MouseScrollDown",Command="GBA_NextWeapon")
Source: DefaultInput.ini
19. UnrealScript Features (Cont.)
• exec functions
.Bindings=(Name="MouseScrollDown",Command="GBA_NextWeapon")
Source: DefaultInput.ini
exec function NextWeapon()
{
if ( WorldInfo.Pauser!=None )
return;
if ( Pawn.Weapon == None )
{
SwitchToBestWeapon();
return;
}
if ( Pawn.InvManager != None )
Pawn.InvManager.NextWeapon();
}
Source: PlayerController.uc
20. UnrealScript Features (Cont.)
• config files
class HWPawn extends HWSelectable
config(HostileWorldsUnitData)
abstract;
/** The value the damage of all attacks is reduces by before being applied. */
var config int Armor;
/** The ground movement speed of this unit, in UU/s. */
var config int MovementSpeed;
Source: HWPawn.uc
21. UnrealScript Features (Cont.)
• config files
class HWPawn extends HWSelectable
config(HostileWorldsUnitData)
abstract;
/** The value the damage of all attacks is reduces by before being applied. */
var config int Armor;
/** The ground movement speed of this unit, in UU/s. */
var config int MovementSpeed;
Source: HWPawn.uc
[HostileWorlds.HWSM_Commander]
Armor=0
MovementSpeed=160
Source: UDKHostileWorldsUnitData.ini
22. UnrealScript Features (Cont.)
• localization files
class HWAbility extends Actor
config(HostileWorldsAbilityData)
abstract;
/** The name of this ability. */
var localized string AbilityName;
Source: HWAbility.uc
23. UnrealScript Features (Cont.)
• localization files
class HWAbility extends Actor
config(HostileWorldsAbilityData)
abstract;
/** The name of this ability. */
var localized string AbilityName;
Source: HWAbility.uc
[HWAb_Cloak]
AbilityName=Cloak
Source: HostileWorlds.int
24. UnrealScript Features (Cont.)
• meta data
/** Enable or disable spawning. */
Var() bool bEnableSpawning;
/** Set the rate at which AIs are spawned. */
Var() float RespawnsPerSecond<EditCondition=bEnableSpawning>;
Source: http://udn.epicgames.com/Three/UnrealScriptMetadata.html
25. Navigation Meshes
• connected graph of convex polygons
• at each node we know that an AI can get from any
point in that node, to any other point in that node
due to its convexity
• thus the task of pathfinding through the graph
simplifies into pathfinding along a connected graph
of nodes
• much more natural looking movement
29. Obstacle Meshes
• represent obstacles in the world
• allow low-fidelity raycasts (against this obstacle
mesh only) when an AI needs to know whether it
can walk from one point to another directly
• allows us to skip doing a path search in wide open
areas even if there are many polygons between the
start and the goal
31. Benefits of Navigation Meshes
• can represent a large area with a single polygon
• overall graph density goes down
• memory footprint reduced
• pathfinding time goes down
• less time fixing up cross-level pathing information
• better pathing behavior
• automatic generation
32. Benefits of Navigation Meshes (Cont.)
• handling of dynamic objects
Source: http://udn.epicgames.com/Three/NavigationMeshReference.html
33. Benefits of Navigation Meshes (Cont.)
• handling of dynamic objects
Source: http://udn.epicgames.com/Three/NavigationMeshReference.html
34. Weapons & Inventory
/** Holds the list of link guns linked to this weapon */
var array<UTWeap_LinkGun> LinkedList;
Source: UTWeap_LinkGun.uc
// I made a funny Hahahahah :)
47. Network
“Unreal views the general problem of coordinating a
reasonable approximation of a shared reality
between the server and clients as a problem of
replication.
That is, a problem of determining a set of data and
commands that flow between the client and server
in order to achieve that approximate shared reality.“
- Tim Sweeney, Epic Games Inc.
48. Network
• generalized client-server model
• authoritative server (dedicated, listen)
• predicting and simulating clients
• “hybrid” code
• client and server execute same code on approximately the
same data
• minimizes traffic
49. Network (Cont.)
• generalized client-server model
• decoupling of network and game logic facilitates
extensibility
• network code can coordinate any game which can be described
by the language
• network is controlled on language level through keywords &
variables
• low level network (serialization, reliable UDP) done by core
50. Network - Basic Terminology
• Actor
• object that can move and interact with other actors
• Level
• object which contains a set of actors
• Game State
• the complete set of all actors that exist in a level
• the current values of all actor variables
51. Network – Update Loop
1. if (server)
Send(Gamestate) to all clients
2. if (client)
Send(RequestedMovement) to server
Receive(Gamestate) from server
Render(ApproximateWorldView) to screen
3. if (server || client)
Tick(DeltaTime) to update Gamestate
Update(Actors)
Execute(Physics)
Receive(GameEvents)
Execute(ScriptCode)
52. Actor Roles
• describes how much control the machine (server or
client) has over an actor
• controls the actors function call permissions
// Net variables.
enum ENetRole
{
ROLE_None,
ROLE_SimulatedProxy,
ROLE_AutonomousProxy,
ROLE_Authority,
};
//
//
//
//
No role at all.
Locally simulated proxy of this actor.
Locally autonomous proxy of this actor.
Authoritative control over the actor.
var ENetRole RemoteRole, Role;
Source: Actor.uc.
53. Bandwidth Optimization: Actor Relevancy
• eight prioritized rules:
•
•
•
•
not relevant, if (RemoteRole == none)
determined by the relevancy of its base, if any
relevant if (bAlwaysRelevant)
only potentially relevant to the client who owns that
Actor if (bOnlyRelevantToOwner)
54. Bandwidth Optimization: Actor Relevancy
• eight prioritized rules:
• relevant if (Owner==Player)
• not relevant if
• (bHidden) &&
• (!bBlockPlayers) &&
• (AmbientSound == none)
• relevant if visible according to a line-of-sight check
between the actor's Location and the player's
Location
• relevant, if was visible less than 2 to 10 seconds ago
55. Bandwidth Optimization: Prioritization
• Actor::NetPriority
• regulates share of the bandwidth based on how
important the Actor is to gameplay
• always relative to all other Actors’ NetPriority
56. Replication
• Actor replication
• only Location, Rotation valid on spawn
• variable replication
•
•
•
•
regulated by condition in Class Replication Statement
server to client only
always reliable
subject to bandwidth optimization
• repnotify keyword
replication
{
// replicate if server
if (Role == ROLE_Authority && (bNetInitial || bNetDirty))
Armor, Range, AttackDamage;
}
Source: HWPawn.uc.
57. Where‘s Waldo?
simulated event ReplicatedEvent(name VarName)
{
if (VarName == 'TeamIndex')
{
ChangeColor(TeamIndex);
}
}
Source: HWSelectable.uc, before January 11, 2011.
60. Replication
• function call replication
• keywords:
• server, client
• reliable, unreliable
• server -> client: only to client who owns that Actor
• client -> server: only on owned Actor
• immediately sent, disregarding bandwidth
reliable server function ServerIssueAbilityOrder(HWAIController C, HWAbility Ability, HWSelectable Target)
Source: HWPlayerController.uc.