SlideShare ist ein Scribd-Unternehmen logo
1 von 20
Programming in UE4
A Quick Orientation for Coders
Gerke Max Preussner
max.preussner@epicgames.com
Programming
Is Awesome
Sucks
But…
Because you can:
• Create something from nothing
• Bring dead matter to life
• Improve the human condition
• Impress your girl/boyfriend/cat
• Make a good living in the process
Programming
Is Awesome
Sucks
But…
Because:
• Programmers are crazy
• Programming languages & tools suck
• All code is bad and buggy
• There is never enough time to do it right
• You are always behind the curve
Peter Welch: http://stilldrinking.org/programming-sucks
Programming
Is Awesome
Sucks
But…
Don’t get discouraged!
• If it was easy, a monkey could do it!
• Don’t be afraid of programming languages
• Don’t get discouraged by complex code bases
There are ways to make your life easier
• Know your tools and keep learning
• Software Design and Architectural Patterns
• Coding Guidelines & Best Practices
• Transfer knowledge with your peers
Getting Started
Tools:
• Windows: Visual Studio, UnrealVS, Visual Assist X (recommended)
• MacOS: XCode
For everything else see:
https://docs.unrealengine.com/latest/INT/Programming/QuickStart/
Common Blockers
Compiling
Acronyms
Entry Point
Compiling is handled through UBT
• UBT – Unreal Build Tool
• Solution/Projects in Visual Studio and Xcode are a lie!
Common Blockers
Compiling
Acronyms
Entry Point
Acronym Soup (and Code Names, too)
• UBT – Unreal Build Tool
• UHT – Unreal Header Tool
• UAT – Unreal Automation Tool
• UFE – Unreal Frontend
• BP – Blueprint
• CDO – Class Default Object
• INI – Text Based Configuration File
• Cooking – Optimizing game content
• Lightmass, Persona, Cascade, Swarm and other tools
• etc. pp.
Common Blockers
Compiling
Acronyms
Entry Point
I Want To Understand the Engine - Where Is the Main Loop?
• LaunchEngineLoop.cpp
• It’s really complicated (and everybody hates it)
• Please don’t bother with this – start with our tutorials!
Unrealisms
Type Names
UObjects
Basic Types
Strings
Macros
We Use Prefixes for All Types
• U – UObject derrived class, i.e. UTexture
• A – AActor derrived class, i.e. AGameMode
• F – All other classes and structs, i.e. FName, FVector
• T – Template, i.e. TArray, TMap, TQueue
• I – Interface class, i.e. ITransaction
• E – Enumeration type, i.e. ESelectionMode
• b – Boolean value, i.e. bEnabled
Everything in Unreal is Pascal Case (Upper Camel Case)
• Function names and function parameters, too
• Even local and loop variables!
Unrealisms
Type Names
UObjects
Basic Types
Strings
Macros
UObjects Work Around Limitations in C++
• Run-time reflection of class properties and functions
• Serialization from/to disk and over the network
• Garbage collection
• Meta data
• Also: Blueprint integration
Decorate regular C++ Classes with Magic Macros
• UCLASS – for class types
• USTRUCT – for struct types
• UFUNCTION – for class and struct member functions
• UPROPERTY – for class and struct variables
Unrealisms
Type Names
UObjects
Basic Types
Strings
Macros
// Example (not actual UE4 code – omitting some more advanced details)
USTRUCT()
struct FVector2D
{
UPROPERTY()
float X;
UPROPERTY()
float Y;
UFUNCTION ()
float GetLength() const;
};
Unrealisms
Type Names
UObjects
Basic Types
Strings
Macros
Fundamental Types
• We don’t use C++ integer types (char, short, int, long, etc.)
• Custom typedef’s for ints & strings in GenericPlatform.h
(int32, uint32, uint64, TCHAR, ANSICHAR etc.)
• Numeric type traits in NumericLimits.h
Common Structures
• FBox, FColor, FGuid, FVariant, FVector, TBigInt, TRange
• And many more in Core module
Unrealisms
Type Names
UObjects
Basic Types
Strings
Macros
Containers
• TArray, TSparseArray – Dynamic arrays
• TLinkedList, TDoubleLinkedList
• TMap – Key-value hash table
• TQueue – Lock free FIFO
• TSet – Unordered set (without duplicates)
• And many more in Core module
Delegates
• Unicast and multicast delegates
• Also thread-safe variants
Unrealisms
Type Names
UObjects
Basic Types
Strings
Macros
Smart Pointers
• TSharedPtr, TSharedRef – for regular C++ objects
• TWeakPtr – for regular C++ objects
• TWeakObjPtr – for UObjects
• TAutoPtr, TScopedPtr
• TUniquePtr
• Similar to boost:: & std:: implementations
• Also thread-safe variants
Unrealisms
Type Names
UObjects
Basic Types
Strings
Macros
String Types
• FString – Regular string
• FText – Localized string, used heavily in Slate UI
• FName – String hash, used heavily in UObjects
String Literals
• TEXT() – Creates a regular(!) string, i.e. TEXT(“Hello”);
• LOCTEXT() – Creates a localized string, i.e.
LOCTEXT(“Namespace”, “Name”, “Hello”);
• NSLOCTEXT() – LOCTEXT with scoped namespace, i.e.
NSLOCTEXT(“Name”, “Hello”);
Unrealisms
Type Names
UObjects
Basic Types
Strings
Macros
FNames are case-insensitive!
• Can’t rename ‘MisSpelled’ to ‘Misspelled’ in the Editor
• Can’t name a property ‘Blast’ if one ‘bLast’ exists
Unrealisms
Type Names
UObjects
Basic Types
Strings
Macros
Logging
• UE_LOG, also GLog->Logf()
Assertions
• check(), checkSlow(), ensure()
Localization
• LOCTEXT_NAMESPACE, LOCTEXT, etc.
Slate (UI Framework)
• SLATE_BEGIN_ARGS, SLATE_ATTRIBUTE, etc.
Best Practices
Guidelines
Principles
Coding Guidelines
• Posted on http://docs.unrealengine.com
• There are some inconsistencies in the code base
• If in doubt, follow existing style in current code file
Naming Conventions
• Choose descriptive names that are as short as possible
• Also for local and loop variables!
• Avoid your own acronyms
Best Practices
Guidelines
Principles
General Principles
• KISS, YAGNI
• Composition vs. inheritance
• Avoid tight coupling of code and modules
• Many trivial instead of few complicated components
Design Patterns
• SOLID (especially S, O, L and I; DI is not elegant in C++)
• Hollywood Principle (especially for Slate & game code)
• GOF, EIP
Methodologies
• DDD, TDD (we support unit tests), AOP
Questions?
Documentation, Tutorials and Help at:
• AnswerHub:
• Engine Documentation:
• Official Forums:
• Community Wiki:
• YouTube Videos:
• Community IRC:
Unreal Engine 4 Roadmap
• lmgtfy.com/?q=Unreal+engine+Trello+
http://answers.unrealengine.com
http://docs.unrealengine.com
http://forums.unrealengine.com
http://wiki.unrealengine.com
http://www.youtube.com/user/UnrealDevelopmentKit
#unrealengine on FreeNode

Weitere ähnliche Inhalte

Was ist angesagt?

East Coast DevCon 2014: Game Programming in UE4 - Game Framework & Sample Pro...
East Coast DevCon 2014: Game Programming in UE4 - Game Framework & Sample Pro...East Coast DevCon 2014: Game Programming in UE4 - Game Framework & Sample Pro...
East Coast DevCon 2014: Game Programming in UE4 - Game Framework & Sample Pro...Gerke Max Preussner
 
FMX 2017: Extending Unreal Engine 4 with Plug-ins (Master Class)
FMX 2017: Extending Unreal Engine 4 with Plug-ins (Master Class)FMX 2017: Extending Unreal Engine 4 with Plug-ins (Master Class)
FMX 2017: Extending Unreal Engine 4 with Plug-ins (Master Class)Gerke Max Preussner
 
West Coast DevCon 2014: Build Automation - Epic’s Build Tools & Infrastructure
West Coast DevCon 2014: Build Automation - Epic’s Build Tools & InfrastructureWest Coast DevCon 2014: Build Automation - Epic’s Build Tools & Infrastructure
West Coast DevCon 2014: Build Automation - Epic’s Build Tools & InfrastructureGerke Max Preussner
 
Python intro and competitive programming
Python intro and competitive programmingPython intro and competitive programming
Python intro and competitive programmingSuraj Shah
 
Course 102: Lecture 1: Course Overview
Course 102: Lecture 1: Course Overview Course 102: Lecture 1: Course Overview
Course 102: Lecture 1: Course Overview Ahmed El-Arabawy
 
How to write a web framework
How to write a web frameworkHow to write a web framework
How to write a web frameworkNgoc Dao
 
Develop realtime web with Scala and Xitrum
Develop realtime web with Scala and XitrumDevelop realtime web with Scala and Xitrum
Develop realtime web with Scala and XitrumNgoc Dao
 
I18nize Scala programs à la gettext
I18nize Scala programs à la gettextI18nize Scala programs à la gettext
I18nize Scala programs à la gettextNgoc Dao
 
RedisConf18 - RedisUnique
RedisConf18 - RedisUniqueRedisConf18 - RedisUnique
RedisConf18 - RedisUniqueRedis Labs
 
Linx privx privileges-sudo misconfiguration group and docker daemon privileges
Linx privx privileges-sudo misconfiguration group and docker daemon privilegesLinx privx privileges-sudo misconfiguration group and docker daemon privileges
Linx privx privileges-sudo misconfiguration group and docker daemon privilegesAliBawazeEer
 
Embedded Systems: Lecture 1: Course Overview
Embedded Systems: Lecture 1: Course OverviewEmbedded Systems: Lecture 1: Course Overview
Embedded Systems: Lecture 1: Course OverviewAhmed El-Arabawy
 
Xitrum HOWTOs
Xitrum HOWTOsXitrum HOWTOs
Xitrum HOWTOsNgoc Dao
 
DevOps: What is This Puppet You Speak Of?
DevOps: What is This Puppet You Speak Of?DevOps: What is This Puppet You Speak Of?
DevOps: What is This Puppet You Speak Of?Rob Reynolds
 
Java Virtual Machine (JVM), Difference JDK, JRE & JVM
Java Virtual Machine (JVM), Difference JDK, JRE & JVMJava Virtual Machine (JVM), Difference JDK, JRE & JVM
Java Virtual Machine (JVM), Difference JDK, JRE & JVMshamnasain
 
Playing with playgrounds
Playing with playgroundsPlaying with playgrounds
Playing with playgroundsEurico Doirado
 
RedisConf18 - Amazing User Experiences
RedisConf18 - Amazing User Experiences   RedisConf18 - Amazing User Experiences
RedisConf18 - Amazing User Experiences Redis Labs
 
Math with .NET for you and Azure
Math with .NET for you and AzureMath with .NET for you and Azure
Math with .NET for you and AzureMarco Parenzan
 

Was ist angesagt? (20)

East Coast DevCon 2014: Game Programming in UE4 - Game Framework & Sample Pro...
East Coast DevCon 2014: Game Programming in UE4 - Game Framework & Sample Pro...East Coast DevCon 2014: Game Programming in UE4 - Game Framework & Sample Pro...
East Coast DevCon 2014: Game Programming in UE4 - Game Framework & Sample Pro...
 
FMX 2017: Extending Unreal Engine 4 with Plug-ins (Master Class)
FMX 2017: Extending Unreal Engine 4 with Plug-ins (Master Class)FMX 2017: Extending Unreal Engine 4 with Plug-ins (Master Class)
FMX 2017: Extending Unreal Engine 4 with Plug-ins (Master Class)
 
West Coast DevCon 2014: Build Automation - Epic’s Build Tools & Infrastructure
West Coast DevCon 2014: Build Automation - Epic’s Build Tools & InfrastructureWest Coast DevCon 2014: Build Automation - Epic’s Build Tools & Infrastructure
West Coast DevCon 2014: Build Automation - Epic’s Build Tools & Infrastructure
 
Python intro and competitive programming
Python intro and competitive programmingPython intro and competitive programming
Python intro and competitive programming
 
Course 102: Lecture 1: Course Overview
Course 102: Lecture 1: Course Overview Course 102: Lecture 1: Course Overview
Course 102: Lecture 1: Course Overview
 
How to write a web framework
How to write a web frameworkHow to write a web framework
How to write a web framework
 
Develop realtime web with Scala and Xitrum
Develop realtime web with Scala and XitrumDevelop realtime web with Scala and Xitrum
Develop realtime web with Scala and Xitrum
 
XNA L01–Introduction
XNA L01–IntroductionXNA L01–Introduction
XNA L01–Introduction
 
I18nize Scala programs à la gettext
I18nize Scala programs à la gettextI18nize Scala programs à la gettext
I18nize Scala programs à la gettext
 
RedisConf18 - RedisUnique
RedisConf18 - RedisUniqueRedisConf18 - RedisUnique
RedisConf18 - RedisUnique
 
Linx privx privileges-sudo misconfiguration group and docker daemon privileges
Linx privx privileges-sudo misconfiguration group and docker daemon privilegesLinx privx privileges-sudo misconfiguration group and docker daemon privileges
Linx privx privileges-sudo misconfiguration group and docker daemon privileges
 
Embedded Systems: Lecture 1: Course Overview
Embedded Systems: Lecture 1: Course OverviewEmbedded Systems: Lecture 1: Course Overview
Embedded Systems: Lecture 1: Course Overview
 
MVC Gems
MVC GemsMVC Gems
MVC Gems
 
Xitrum HOWTOs
Xitrum HOWTOsXitrum HOWTOs
Xitrum HOWTOs
 
DevOps: What is This Puppet You Speak Of?
DevOps: What is This Puppet You Speak Of?DevOps: What is This Puppet You Speak Of?
DevOps: What is This Puppet You Speak Of?
 
Java Virtual Machine (JVM), Difference JDK, JRE & JVM
Java Virtual Machine (JVM), Difference JDK, JRE & JVMJava Virtual Machine (JVM), Difference JDK, JRE & JVM
Java Virtual Machine (JVM), Difference JDK, JRE & JVM
 
Playing with playgrounds
Playing with playgroundsPlaying with playgrounds
Playing with playgrounds
 
RedisConf18 - Amazing User Experiences
RedisConf18 - Amazing User Experiences   RedisConf18 - Amazing User Experiences
RedisConf18 - Amazing User Experiences
 
Killer Robots 101 with Gobot
Killer Robots 101 with GobotKiller Robots 101 with Gobot
Killer Robots 101 with Gobot
 
Math with .NET for you and Azure
Math with .NET for you and AzureMath with .NET for you and Azure
Math with .NET for you and Azure
 

Andere mochten auch

UE4 Twitch 2016 05-05: Unreal Message Bus Overview
UE4 Twitch 2016 05-05: Unreal Message Bus OverviewUE4 Twitch 2016 05-05: Unreal Message Bus Overview
UE4 Twitch 2016 05-05: Unreal Message Bus OverviewGerke Max Preussner
 
West Coast DevCon 2014: Game Programming in UE4 - Game Framework & Sample Pro...
West Coast DevCon 2014: Game Programming in UE4 - Game Framework & Sample Pro...West Coast DevCon 2014: Game Programming in UE4 - Game Framework & Sample Pro...
West Coast DevCon 2014: Game Programming in UE4 - Game Framework & Sample Pro...Gerke Max Preussner
 
East Coast DevCon 2014: The Slate UI Framework - Architecture & Tools
East Coast DevCon 2014: The Slate UI Framework - Architecture & ToolsEast Coast DevCon 2014: The Slate UI Framework - Architecture & Tools
East Coast DevCon 2014: The Slate UI Framework - Architecture & ToolsGerke Max Preussner
 
West Coast DevCon 2014: The Slate UI Framework (Part 2) - Game UI & Unreal Mo...
West Coast DevCon 2014: The Slate UI Framework (Part 2) - Game UI & Unreal Mo...West Coast DevCon 2014: The Slate UI Framework (Part 2) - Game UI & Unreal Mo...
West Coast DevCon 2014: The Slate UI Framework (Part 2) - Game UI & Unreal Mo...Gerke Max Preussner
 
Plug-ins & Third-Party SDKs in UE4
Plug-ins & Third-Party SDKs in UE4Plug-ins & Third-Party SDKs in UE4
Plug-ins & Third-Party SDKs in UE4Gerke Max Preussner
 
GDCE 2015: Blueprint Components to C++
GDCE 2015: Blueprint Components to C++GDCE 2015: Blueprint Components to C++
GDCE 2015: Blueprint Components to C++Gerke Max Preussner
 
GDC Europe 2014: Unreal Engine 4 for Programmers - Lessons Learned & Things t...
GDC Europe 2014: Unreal Engine 4 for Programmers - Lessons Learned & Things t...GDC Europe 2014: Unreal Engine 4 for Programmers - Lessons Learned & Things t...
GDC Europe 2014: Unreal Engine 4 for Programmers - Lessons Learned & Things t...Gerke Max Preussner
 

Andere mochten auch (7)

UE4 Twitch 2016 05-05: Unreal Message Bus Overview
UE4 Twitch 2016 05-05: Unreal Message Bus OverviewUE4 Twitch 2016 05-05: Unreal Message Bus Overview
UE4 Twitch 2016 05-05: Unreal Message Bus Overview
 
West Coast DevCon 2014: Game Programming in UE4 - Game Framework & Sample Pro...
West Coast DevCon 2014: Game Programming in UE4 - Game Framework & Sample Pro...West Coast DevCon 2014: Game Programming in UE4 - Game Framework & Sample Pro...
West Coast DevCon 2014: Game Programming in UE4 - Game Framework & Sample Pro...
 
East Coast DevCon 2014: The Slate UI Framework - Architecture & Tools
East Coast DevCon 2014: The Slate UI Framework - Architecture & ToolsEast Coast DevCon 2014: The Slate UI Framework - Architecture & Tools
East Coast DevCon 2014: The Slate UI Framework - Architecture & Tools
 
West Coast DevCon 2014: The Slate UI Framework (Part 2) - Game UI & Unreal Mo...
West Coast DevCon 2014: The Slate UI Framework (Part 2) - Game UI & Unreal Mo...West Coast DevCon 2014: The Slate UI Framework (Part 2) - Game UI & Unreal Mo...
West Coast DevCon 2014: The Slate UI Framework (Part 2) - Game UI & Unreal Mo...
 
Plug-ins & Third-Party SDKs in UE4
Plug-ins & Third-Party SDKs in UE4Plug-ins & Third-Party SDKs in UE4
Plug-ins & Third-Party SDKs in UE4
 
GDCE 2015: Blueprint Components to C++
GDCE 2015: Blueprint Components to C++GDCE 2015: Blueprint Components to C++
GDCE 2015: Blueprint Components to C++
 
GDC Europe 2014: Unreal Engine 4 for Programmers - Lessons Learned & Things t...
GDC Europe 2014: Unreal Engine 4 for Programmers - Lessons Learned & Things t...GDC Europe 2014: Unreal Engine 4 for Programmers - Lessons Learned & Things t...
GDC Europe 2014: Unreal Engine 4 for Programmers - Lessons Learned & Things t...
 

Ähnlich wie West Coast DevCon 2014: Programming in UE4 - A Quick Orientation for Coders

TypeScript . the JavaScript developer best friend!
TypeScript . the JavaScript developer best friend!TypeScript . the JavaScript developer best friend!
TypeScript . the JavaScript developer best friend!Alessandro Giorgetti
 
What's With The 1S And 0S? Making Sense Of Binary Data At Scale With Tika And...
What's With The 1S And 0S? Making Sense Of Binary Data At Scale With Tika And...What's With The 1S And 0S? Making Sense Of Binary Data At Scale With Tika And...
What's With The 1S And 0S? Making Sense Of Binary Data At Scale With Tika And...gagravarr
 
UsingCPP_for_Artist.ppt
UsingCPP_for_Artist.pptUsingCPP_for_Artist.ppt
UsingCPP_for_Artist.pptvinu28455
 
What's with the 1s and 0s? Making sense of binary data at scale with Tika and...
What's with the 1s and 0s? Making sense of binary data at scale with Tika and...What's with the 1s and 0s? Making sense of binary data at scale with Tika and...
What's with the 1s and 0s? Making sense of binary data at scale with Tika and...gagravarr
 
Perl5 meta programming
Perl5 meta programmingPerl5 meta programming
Perl5 meta programmingkarupanerura
 
Python first day
Python first dayPython first day
Python first dayfarkhand
 
python presntation 2.pptx
python presntation 2.pptxpython presntation 2.pptx
python presntation 2.pptxArpittripathi45
 
What is Python?
What is Python?What is Python?
What is Python?PranavSB
 

Ähnlich wie West Coast DevCon 2014: Programming in UE4 - A Quick Orientation for Coders (20)

Python ppt
Python pptPython ppt
Python ppt
 
TypeScript
TypeScriptTypeScript
TypeScript
 
TypeScript . the JavaScript developer best friend!
TypeScript . the JavaScript developer best friend!TypeScript . the JavaScript developer best friend!
TypeScript . the JavaScript developer best friend!
 
What's With The 1S And 0S? Making Sense Of Binary Data At Scale With Tika And...
What's With The 1S And 0S? Making Sense Of Binary Data At Scale With Tika And...What's With The 1S And 0S? Making Sense Of Binary Data At Scale With Tika And...
What's With The 1S And 0S? Making Sense Of Binary Data At Scale With Tika And...
 
UsingCPP_for_Artist.ppt
UsingCPP_for_Artist.pptUsingCPP_for_Artist.ppt
UsingCPP_for_Artist.ppt
 
Children of Ruby
Children of RubyChildren of Ruby
Children of Ruby
 
RIBBUN SOFTWARE
RIBBUN SOFTWARERIBBUN SOFTWARE
RIBBUN SOFTWARE
 
Java01
Java01Java01
Java01
 
Introduction what is java
Introduction what is javaIntroduction what is java
Introduction what is java
 
Java01
Java01Java01
Java01
 
Java01
Java01Java01
Java01
 
Java01
Java01Java01
Java01
 
What's with the 1s and 0s? Making sense of binary data at scale with Tika and...
What's with the 1s and 0s? Making sense of binary data at scale with Tika and...What's with the 1s and 0s? Making sense of binary data at scale with Tika and...
What's with the 1s and 0s? Making sense of binary data at scale with Tika and...
 
Perl5 meta programming
Perl5 meta programmingPerl5 meta programming
Perl5 meta programming
 
Google Go Overview
Google Go OverviewGoogle Go Overview
Google Go Overview
 
Python first day
Python first dayPython first day
Python first day
 
Python first day
Python first dayPython first day
Python first day
 
python presntation 2.pptx
python presntation 2.pptxpython presntation 2.pptx
python presntation 2.pptx
 
Type script
Type scriptType script
Type script
 
What is Python?
What is Python?What is Python?
What is Python?
 

Kürzlich hochgeladen

8257 interfacing 2 in microprocessor for btech students
8257 interfacing 2 in microprocessor for btech students8257 interfacing 2 in microprocessor for btech students
8257 interfacing 2 in microprocessor for btech studentsHimanshiGarg82
 
Direct Style Effect Systems - The Print[A] Example - A Comprehension Aid
Direct Style Effect Systems -The Print[A] Example- A Comprehension AidDirect Style Effect Systems -The Print[A] Example- A Comprehension Aid
Direct Style Effect Systems - The Print[A] Example - A Comprehension AidPhilip Schwarz
 
Optimizing AI for immediate response in Smart CCTV
Optimizing AI for immediate response in Smart CCTVOptimizing AI for immediate response in Smart CCTV
Optimizing AI for immediate response in Smart CCTVshikhaohhpro
 
call girls in Vaishali (Ghaziabad) 🔝 >༒8448380779 🔝 genuine Escort Service 🔝✔️✔️
call girls in Vaishali (Ghaziabad) 🔝 >༒8448380779 🔝 genuine Escort Service 🔝✔️✔️call girls in Vaishali (Ghaziabad) 🔝 >༒8448380779 🔝 genuine Escort Service 🔝✔️✔️
call girls in Vaishali (Ghaziabad) 🔝 >༒8448380779 🔝 genuine Escort Service 🔝✔️✔️Delhi Call girls
 
Reassessing the Bedrock of Clinical Function Models: An Examination of Large ...
Reassessing the Bedrock of Clinical Function Models: An Examination of Large ...Reassessing the Bedrock of Clinical Function Models: An Examination of Large ...
Reassessing the Bedrock of Clinical Function Models: An Examination of Large ...harshavardhanraghave
 
The Ultimate Test Automation Guide_ Best Practices and Tips.pdf
The Ultimate Test Automation Guide_ Best Practices and Tips.pdfThe Ultimate Test Automation Guide_ Best Practices and Tips.pdf
The Ultimate Test Automation Guide_ Best Practices and Tips.pdfkalichargn70th171
 
Right Money Management App For Your Financial Goals
Right Money Management App For Your Financial GoalsRight Money Management App For Your Financial Goals
Right Money Management App For Your Financial GoalsJhone kinadey
 
The Real-World Challenges of Medical Device Cybersecurity- Mitigating Vulnera...
The Real-World Challenges of Medical Device Cybersecurity- Mitigating Vulnera...The Real-World Challenges of Medical Device Cybersecurity- Mitigating Vulnera...
The Real-World Challenges of Medical Device Cybersecurity- Mitigating Vulnera...ICS
 
HR Software Buyers Guide in 2024 - HRSoftware.com
HR Software Buyers Guide in 2024 - HRSoftware.comHR Software Buyers Guide in 2024 - HRSoftware.com
HR Software Buyers Guide in 2024 - HRSoftware.comFatema Valibhai
 
The Guide to Integrating Generative AI into Unified Continuous Testing Platfo...
The Guide to Integrating Generative AI into Unified Continuous Testing Platfo...The Guide to Integrating Generative AI into Unified Continuous Testing Platfo...
The Guide to Integrating Generative AI into Unified Continuous Testing Platfo...kalichargn70th171
 
AI & Machine Learning Presentation Template
AI & Machine Learning Presentation TemplateAI & Machine Learning Presentation Template
AI & Machine Learning Presentation TemplatePresentation.STUDIO
 
TECUNIQUE: Success Stories: IT Service provider
TECUNIQUE: Success Stories: IT Service providerTECUNIQUE: Success Stories: IT Service provider
TECUNIQUE: Success Stories: IT Service providermohitmore19
 
Introducing Microsoft’s new Enterprise Work Management (EWM) Solution
Introducing Microsoft’s new Enterprise Work Management (EWM) SolutionIntroducing Microsoft’s new Enterprise Work Management (EWM) Solution
Introducing Microsoft’s new Enterprise Work Management (EWM) SolutionOnePlan Solutions
 
Diamond Application Development Crafting Solutions with Precision
Diamond Application Development Crafting Solutions with PrecisionDiamond Application Development Crafting Solutions with Precision
Diamond Application Development Crafting Solutions with PrecisionSolGuruz
 
Azure_Native_Qumulo_High_Performance_Compute_Benchmarks.pdf
Azure_Native_Qumulo_High_Performance_Compute_Benchmarks.pdfAzure_Native_Qumulo_High_Performance_Compute_Benchmarks.pdf
Azure_Native_Qumulo_High_Performance_Compute_Benchmarks.pdfryanfarris8
 
Software Quality Assurance Interview Questions
Software Quality Assurance Interview QuestionsSoftware Quality Assurance Interview Questions
Software Quality Assurance Interview QuestionsArshad QA
 
Shapes for Sharing between Graph Data Spaces - and Epistemic Querying of RDF-...
Shapes for Sharing between Graph Data Spaces - and Epistemic Querying of RDF-...Shapes for Sharing between Graph Data Spaces - and Epistemic Querying of RDF-...
Shapes for Sharing between Graph Data Spaces - and Epistemic Querying of RDF-...Steffen Staab
 
+971565801893>>SAFE AND ORIGINAL ABORTION PILLS FOR SALE IN DUBAI AND ABUDHAB...
+971565801893>>SAFE AND ORIGINAL ABORTION PILLS FOR SALE IN DUBAI AND ABUDHAB...+971565801893>>SAFE AND ORIGINAL ABORTION PILLS FOR SALE IN DUBAI AND ABUDHAB...
+971565801893>>SAFE AND ORIGINAL ABORTION PILLS FOR SALE IN DUBAI AND ABUDHAB...Health
 
Unveiling the Tech Salsa of LAMs with Janus in Real-Time Applications
Unveiling the Tech Salsa of LAMs with Janus in Real-Time ApplicationsUnveiling the Tech Salsa of LAMs with Janus in Real-Time Applications
Unveiling the Tech Salsa of LAMs with Janus in Real-Time ApplicationsAlberto González Trastoy
 

Kürzlich hochgeladen (20)

8257 interfacing 2 in microprocessor for btech students
8257 interfacing 2 in microprocessor for btech students8257 interfacing 2 in microprocessor for btech students
8257 interfacing 2 in microprocessor for btech students
 
Direct Style Effect Systems - The Print[A] Example - A Comprehension Aid
Direct Style Effect Systems -The Print[A] Example- A Comprehension AidDirect Style Effect Systems -The Print[A] Example- A Comprehension Aid
Direct Style Effect Systems - The Print[A] Example - A Comprehension Aid
 
Optimizing AI for immediate response in Smart CCTV
Optimizing AI for immediate response in Smart CCTVOptimizing AI for immediate response in Smart CCTV
Optimizing AI for immediate response in Smart CCTV
 
call girls in Vaishali (Ghaziabad) 🔝 >༒8448380779 🔝 genuine Escort Service 🔝✔️✔️
call girls in Vaishali (Ghaziabad) 🔝 >༒8448380779 🔝 genuine Escort Service 🔝✔️✔️call girls in Vaishali (Ghaziabad) 🔝 >༒8448380779 🔝 genuine Escort Service 🔝✔️✔️
call girls in Vaishali (Ghaziabad) 🔝 >༒8448380779 🔝 genuine Escort Service 🔝✔️✔️
 
Reassessing the Bedrock of Clinical Function Models: An Examination of Large ...
Reassessing the Bedrock of Clinical Function Models: An Examination of Large ...Reassessing the Bedrock of Clinical Function Models: An Examination of Large ...
Reassessing the Bedrock of Clinical Function Models: An Examination of Large ...
 
The Ultimate Test Automation Guide_ Best Practices and Tips.pdf
The Ultimate Test Automation Guide_ Best Practices and Tips.pdfThe Ultimate Test Automation Guide_ Best Practices and Tips.pdf
The Ultimate Test Automation Guide_ Best Practices and Tips.pdf
 
Right Money Management App For Your Financial Goals
Right Money Management App For Your Financial GoalsRight Money Management App For Your Financial Goals
Right Money Management App For Your Financial Goals
 
The Real-World Challenges of Medical Device Cybersecurity- Mitigating Vulnera...
The Real-World Challenges of Medical Device Cybersecurity- Mitigating Vulnera...The Real-World Challenges of Medical Device Cybersecurity- Mitigating Vulnera...
The Real-World Challenges of Medical Device Cybersecurity- Mitigating Vulnera...
 
HR Software Buyers Guide in 2024 - HRSoftware.com
HR Software Buyers Guide in 2024 - HRSoftware.comHR Software Buyers Guide in 2024 - HRSoftware.com
HR Software Buyers Guide in 2024 - HRSoftware.com
 
The Guide to Integrating Generative AI into Unified Continuous Testing Platfo...
The Guide to Integrating Generative AI into Unified Continuous Testing Platfo...The Guide to Integrating Generative AI into Unified Continuous Testing Platfo...
The Guide to Integrating Generative AI into Unified Continuous Testing Platfo...
 
AI & Machine Learning Presentation Template
AI & Machine Learning Presentation TemplateAI & Machine Learning Presentation Template
AI & Machine Learning Presentation Template
 
TECUNIQUE: Success Stories: IT Service provider
TECUNIQUE: Success Stories: IT Service providerTECUNIQUE: Success Stories: IT Service provider
TECUNIQUE: Success Stories: IT Service provider
 
CHEAP Call Girls in Pushp Vihar (-DELHI )🔝 9953056974🔝(=)/CALL GIRLS SERVICE
CHEAP Call Girls in Pushp Vihar (-DELHI )🔝 9953056974🔝(=)/CALL GIRLS SERVICECHEAP Call Girls in Pushp Vihar (-DELHI )🔝 9953056974🔝(=)/CALL GIRLS SERVICE
CHEAP Call Girls in Pushp Vihar (-DELHI )🔝 9953056974🔝(=)/CALL GIRLS SERVICE
 
Introducing Microsoft’s new Enterprise Work Management (EWM) Solution
Introducing Microsoft’s new Enterprise Work Management (EWM) SolutionIntroducing Microsoft’s new Enterprise Work Management (EWM) Solution
Introducing Microsoft’s new Enterprise Work Management (EWM) Solution
 
Diamond Application Development Crafting Solutions with Precision
Diamond Application Development Crafting Solutions with PrecisionDiamond Application Development Crafting Solutions with Precision
Diamond Application Development Crafting Solutions with Precision
 
Azure_Native_Qumulo_High_Performance_Compute_Benchmarks.pdf
Azure_Native_Qumulo_High_Performance_Compute_Benchmarks.pdfAzure_Native_Qumulo_High_Performance_Compute_Benchmarks.pdf
Azure_Native_Qumulo_High_Performance_Compute_Benchmarks.pdf
 
Software Quality Assurance Interview Questions
Software Quality Assurance Interview QuestionsSoftware Quality Assurance Interview Questions
Software Quality Assurance Interview Questions
 
Shapes for Sharing between Graph Data Spaces - and Epistemic Querying of RDF-...
Shapes for Sharing between Graph Data Spaces - and Epistemic Querying of RDF-...Shapes for Sharing between Graph Data Spaces - and Epistemic Querying of RDF-...
Shapes for Sharing between Graph Data Spaces - and Epistemic Querying of RDF-...
 
+971565801893>>SAFE AND ORIGINAL ABORTION PILLS FOR SALE IN DUBAI AND ABUDHAB...
+971565801893>>SAFE AND ORIGINAL ABORTION PILLS FOR SALE IN DUBAI AND ABUDHAB...+971565801893>>SAFE AND ORIGINAL ABORTION PILLS FOR SALE IN DUBAI AND ABUDHAB...
+971565801893>>SAFE AND ORIGINAL ABORTION PILLS FOR SALE IN DUBAI AND ABUDHAB...
 
Unveiling the Tech Salsa of LAMs with Janus in Real-Time Applications
Unveiling the Tech Salsa of LAMs with Janus in Real-Time ApplicationsUnveiling the Tech Salsa of LAMs with Janus in Real-Time Applications
Unveiling the Tech Salsa of LAMs with Janus in Real-Time Applications
 

West Coast DevCon 2014: Programming in UE4 - A Quick Orientation for Coders

  • 1. Programming in UE4 A Quick Orientation for Coders Gerke Max Preussner max.preussner@epicgames.com
  • 2. Programming Is Awesome Sucks But… Because you can: • Create something from nothing • Bring dead matter to life • Improve the human condition • Impress your girl/boyfriend/cat • Make a good living in the process
  • 3. Programming Is Awesome Sucks But… Because: • Programmers are crazy • Programming languages & tools suck • All code is bad and buggy • There is never enough time to do it right • You are always behind the curve Peter Welch: http://stilldrinking.org/programming-sucks
  • 4. Programming Is Awesome Sucks But… Don’t get discouraged! • If it was easy, a monkey could do it! • Don’t be afraid of programming languages • Don’t get discouraged by complex code bases There are ways to make your life easier • Know your tools and keep learning • Software Design and Architectural Patterns • Coding Guidelines & Best Practices • Transfer knowledge with your peers
  • 5. Getting Started Tools: • Windows: Visual Studio, UnrealVS, Visual Assist X (recommended) • MacOS: XCode For everything else see: https://docs.unrealengine.com/latest/INT/Programming/QuickStart/
  • 6. Common Blockers Compiling Acronyms Entry Point Compiling is handled through UBT • UBT – Unreal Build Tool • Solution/Projects in Visual Studio and Xcode are a lie!
  • 7. Common Blockers Compiling Acronyms Entry Point Acronym Soup (and Code Names, too) • UBT – Unreal Build Tool • UHT – Unreal Header Tool • UAT – Unreal Automation Tool • UFE – Unreal Frontend • BP – Blueprint • CDO – Class Default Object • INI – Text Based Configuration File • Cooking – Optimizing game content • Lightmass, Persona, Cascade, Swarm and other tools • etc. pp.
  • 8. Common Blockers Compiling Acronyms Entry Point I Want To Understand the Engine - Where Is the Main Loop? • LaunchEngineLoop.cpp • It’s really complicated (and everybody hates it) • Please don’t bother with this – start with our tutorials!
  • 9. Unrealisms Type Names UObjects Basic Types Strings Macros We Use Prefixes for All Types • U – UObject derrived class, i.e. UTexture • A – AActor derrived class, i.e. AGameMode • F – All other classes and structs, i.e. FName, FVector • T – Template, i.e. TArray, TMap, TQueue • I – Interface class, i.e. ITransaction • E – Enumeration type, i.e. ESelectionMode • b – Boolean value, i.e. bEnabled Everything in Unreal is Pascal Case (Upper Camel Case) • Function names and function parameters, too • Even local and loop variables!
  • 10. Unrealisms Type Names UObjects Basic Types Strings Macros UObjects Work Around Limitations in C++ • Run-time reflection of class properties and functions • Serialization from/to disk and over the network • Garbage collection • Meta data • Also: Blueprint integration Decorate regular C++ Classes with Magic Macros • UCLASS – for class types • USTRUCT – for struct types • UFUNCTION – for class and struct member functions • UPROPERTY – for class and struct variables
  • 11. Unrealisms Type Names UObjects Basic Types Strings Macros // Example (not actual UE4 code – omitting some more advanced details) USTRUCT() struct FVector2D { UPROPERTY() float X; UPROPERTY() float Y; UFUNCTION () float GetLength() const; };
  • 12. Unrealisms Type Names UObjects Basic Types Strings Macros Fundamental Types • We don’t use C++ integer types (char, short, int, long, etc.) • Custom typedef’s for ints & strings in GenericPlatform.h (int32, uint32, uint64, TCHAR, ANSICHAR etc.) • Numeric type traits in NumericLimits.h Common Structures • FBox, FColor, FGuid, FVariant, FVector, TBigInt, TRange • And many more in Core module
  • 13. Unrealisms Type Names UObjects Basic Types Strings Macros Containers • TArray, TSparseArray – Dynamic arrays • TLinkedList, TDoubleLinkedList • TMap – Key-value hash table • TQueue – Lock free FIFO • TSet – Unordered set (without duplicates) • And many more in Core module Delegates • Unicast and multicast delegates • Also thread-safe variants
  • 14. Unrealisms Type Names UObjects Basic Types Strings Macros Smart Pointers • TSharedPtr, TSharedRef – for regular C++ objects • TWeakPtr – for regular C++ objects • TWeakObjPtr – for UObjects • TAutoPtr, TScopedPtr • TUniquePtr • Similar to boost:: & std:: implementations • Also thread-safe variants
  • 15. Unrealisms Type Names UObjects Basic Types Strings Macros String Types • FString – Regular string • FText – Localized string, used heavily in Slate UI • FName – String hash, used heavily in UObjects String Literals • TEXT() – Creates a regular(!) string, i.e. TEXT(“Hello”); • LOCTEXT() – Creates a localized string, i.e. LOCTEXT(“Namespace”, “Name”, “Hello”); • NSLOCTEXT() – LOCTEXT with scoped namespace, i.e. NSLOCTEXT(“Name”, “Hello”);
  • 16. Unrealisms Type Names UObjects Basic Types Strings Macros FNames are case-insensitive! • Can’t rename ‘MisSpelled’ to ‘Misspelled’ in the Editor • Can’t name a property ‘Blast’ if one ‘bLast’ exists
  • 17. Unrealisms Type Names UObjects Basic Types Strings Macros Logging • UE_LOG, also GLog->Logf() Assertions • check(), checkSlow(), ensure() Localization • LOCTEXT_NAMESPACE, LOCTEXT, etc. Slate (UI Framework) • SLATE_BEGIN_ARGS, SLATE_ATTRIBUTE, etc.
  • 18. Best Practices Guidelines Principles Coding Guidelines • Posted on http://docs.unrealengine.com • There are some inconsistencies in the code base • If in doubt, follow existing style in current code file Naming Conventions • Choose descriptive names that are as short as possible • Also for local and loop variables! • Avoid your own acronyms
  • 19. Best Practices Guidelines Principles General Principles • KISS, YAGNI • Composition vs. inheritance • Avoid tight coupling of code and modules • Many trivial instead of few complicated components Design Patterns • SOLID (especially S, O, L and I; DI is not elegant in C++) • Hollywood Principle (especially for Slate & game code) • GOF, EIP Methodologies • DDD, TDD (we support unit tests), AOP
  • 20. Questions? Documentation, Tutorials and Help at: • AnswerHub: • Engine Documentation: • Official Forums: • Community Wiki: • YouTube Videos: • Community IRC: Unreal Engine 4 Roadmap • lmgtfy.com/?q=Unreal+engine+Trello+ http://answers.unrealengine.com http://docs.unrealengine.com http://forums.unrealengine.com http://wiki.unrealengine.com http://www.youtube.com/user/UnrealDevelopmentKit #unrealengine on FreeNode

Hinweis der Redaktion

  1. *** Prepared and presented by Gerke Max Preussner for West Coast MiniDevCon 2014, July 21-24th] Hi, my name is Max. I work as a Sr. Engine Programmer at Epic Games and would like to give you a quick introduction to programming in Unreal Engine 4. Who in the audience is a programmer? Who thinks that programming is awesome? Yes, programming is awesome…
  2. … because it empowers you to create really cool things from the comfort of your armchair, and to make other people’s life better, or at least more entertaining.
  3. Programming also really sucks… because all programmers are crazy! Who read Peter Welch’s blog post “Programming Sucks”? It is the most accurate description of what it is like to be a programmer and work in a programming team. Welch argues that all programming teams are composed by and of crazy people. He also describes how most programmers start writing perfect little snowflakes, and on Friday they are told that six hundred more snowflakes are needed by next Tuesday. And then a lot of sketchy code gets dumped into a pile of snow that quickly melts together, and some of it turns yellow because a cat peed on it. All large teams end up working this way, and Epic is no exception. We, too, are crazy – perhaps in a good way, or at least with good intentions. We are successful, because we have more snowflakes than others, and the remaining pile is split into manageable parts, and the yellow snow is hidden, because someone leaned a Picasso against it. Who thinks that C++ is awesome? C++ also sucks… but so does every other programming language! They all suck, just in different ways. Most of the time it is because we are trying to use them in ways they were not designed for, and there is no language that solves all software engineering problems well.
  4. But do not despair! I will quickly show you a few things to get up and running with Unreal and make your life easier. Let’s start with some of the most common blockers for programmers just starting with Unreal Engine.
  5. By the way, we have really great documentation on our website for getting you started, so I won’t go into any detail. Let me just say that we currently support development on Windows and MacOS. If you work in Visual Studio you should also install our UnrealVS plug-in.
  6. The first thing that throws off a lot of people is that compilation is not actually performed by Visual Studio or Xcode, but by our Unreal Build Tool. Visual Studio and XCode solutions are only generated for your convenience. We do this so that we can support different IDEs. In combination with Unreal Header Tool, it also performs a lot of code preprocessing. I will talk about this in more detail in another presentation later today.
  7. Another thing that is confusing at first is our generous use of acronyms. Don’t worry, you will quickly learn and get used to all of them.
  8. If you have experience writing your own little game from scratch, you may be tempted to locate our Engine’s main entry point in an attempt to learn something about how it all works. This is the wrong way to get started. You cannot possibly learn anything useful from this, because most of the code you will use on a daily basis are on a much higher conceptual layer… with about two million lines of code in between. Read and watch our programming tutorials instead!
  9. You will notice that we use prefixes for all our types, and there is no logical explanation for it. The story goes that Tim Sweeney, when he started working on Unreal Engine in his Garage, added FVector for 3d vectors with floating point components and a U-prefix for Unreal game classes. When other programmers joined they assumed that these were naming conventions… and that’s how snowflakes turn into yellow snow. We also use upper-case for all names in C++. It may really upset your OCD, but please don’t try fight this convention, as it will help keeping everything consistent. It may take a while, but you will get used to it.
  10. C++ is great for a lot of things, but it is also lacking useful features that are present in more modern programming languages, such as Java or C#. We would still like to use those features, so we implemented them on top of C++ with the help of dummy macros that will be parsed by Unreal Header Tool.
  11. Here is an example for how a C++ struct may be marked up in this way. From this, Unreal Header Tool will generate all the glue code, and you will most likely never have to see it.
  12. All our fundamental types are declared in the Core module. We have platform specific type definitions for numeric types and strings. We don’t actually use the standard numeric types that are part of the C++ standard.
  13. The Core module also contains many generic container types. We also have an implementation for various kinds of event delegate.
  14. There is also a library of smart pointer implementations. The most common ones are shared pointers, which also come with thread-safe variants. Shared pointers simplify the lifetime management of objects, and we use them often.
  15. String types can be a bit confusing at first, because we distinguish between regular and localized string objects. They each come with special macros for string literals. We also have so called FNames, which store string values in a global hash table. These are very heavily used in the UObject sub-system to identify classes, functions and properties.
  16. Oh, and FNames are case-insensitive. If you ever wondered why you can’t correct spelling errors in the Editor right now, that is the reason why. And if you think that’s crazy… well… that’s because it is!
  17. We also use macros for less complicated things, such as logging and assertions. These are some macros you will likely encounter when working on your project.
  18. We have an internal coding guidelines document that is not yet posted on the Wiki. Since so many programmers from inside and outside Epic are involved, you will find some inconsistencies in style. And, of course, choosing good names for modules, classes, functions and variables is by far the most difficult task for programmers, but also one of the most important ones.
  19. We also try follow proper software design principles more often now. You may already be familiar with some of them, such as KISS and YAGNI. One of the most important, but less known object-oriented principle is SOLID. [more details here, if time available] We also use common patterns from Gang-Of-Four and Enterprise Integration Patterns. Other methodologies we’re experimenting with are Domain-Driven Design, Test-Driven Development and Aspect Oriented Programming for cross-cutting concerns. Those are all huge topics in themselves. I will have to talk about them another time.
  20. Make sure to check out our extensive materials on the internet, all of which are available for free – even if you don’t have a subscription yet. Any questions?