40
Unreal Engine 4 Blueprints: Hate and Love Roberto De Ioris @unbit http://aiv01.it http://github.com/20tab Codemotion Rome 2017

Unreal Engine 4 Blueprints: Odio e amore Roberto De Ioris - Codemotion Rome 2017

Embed Size (px)

Citation preview

Page 1: Unreal Engine 4 Blueprints: Odio e amore Roberto De Ioris - Codemotion Rome 2017

Unreal Engine 4 Blueprints:

Hate and LoveRoberto De Ioris

@unbit http://aiv01.it

http://github.com/20tab

Codemotion Rome 2017

Page 2: Unreal Engine 4 Blueprints: Odio e amore Roberto De Ioris - Codemotion Rome 2017

Disclaimer

https://github.com/20tab/UnrealEnginePython

Page 3: Unreal Engine 4 Blueprints: Odio e amore Roberto De Ioris - Codemotion Rome 2017

Blueprints ?

Page 4: Unreal Engine 4 Blueprints: Odio e amore Roberto De Ioris - Codemotion Rome 2017

Blueprints …

Page 5: Unreal Engine 4 Blueprints: Odio e amore Roberto De Ioris - Codemotion Rome 2017

Blueprints :)

Page 6: Unreal Engine 4 Blueprints: Odio e amore Roberto De Ioris - Codemotion Rome 2017

Blueprints :|

Page 7: Unreal Engine 4 Blueprints: Odio e amore Roberto De Ioris - Codemotion Rome 2017

Blueprints :(

Page 8: Unreal Engine 4 Blueprints: Odio e amore Roberto De Ioris - Codemotion Rome 2017

!!!

Page 9: Unreal Engine 4 Blueprints: Odio e amore Roberto De Ioris - Codemotion Rome 2017

How to reduce Hate ?

Page 10: Unreal Engine 4 Blueprints: Odio e amore Roberto De Ioris - Codemotion Rome 2017

First Rule: Use Events

Tick is an antipattern in Unreal Engine

Page 11: Unreal Engine 4 Blueprints: Odio e amore Roberto De Ioris - Codemotion Rome 2017

Why Events ?• “Code” organization

• Networking friendly

• Time management for free

• Triggerable by animations too

• Easy to explain to non programmers: cause->effect

Page 12: Unreal Engine 4 Blueprints: Odio e amore Roberto De Ioris - Codemotion Rome 2017

Come on, we need Ticks…

Use Components

Page 13: Unreal Engine 4 Blueprints: Odio e amore Roberto De Ioris - Codemotion Rome 2017

MoveForwardComponent

Page 14: Unreal Engine 4 Blueprints: Odio e amore Roberto De Ioris - Codemotion Rome 2017

Generating events from components: Event Dispatchers

Page 15: Unreal Engine 4 Blueprints: Odio e amore Roberto De Ioris - Codemotion Rome 2017

Subscribing to Events

Page 16: Unreal Engine 4 Blueprints: Odio e amore Roberto De Ioris - Codemotion Rome 2017

NO-if/branch

https://cirillocompany.de/pages/anti-if-campaign

Page 17: Unreal Engine 4 Blueprints: Odio e amore Roberto De Ioris - Codemotion Rome 2017

Good Branch (single path)

Page 18: Unreal Engine 4 Blueprints: Odio e amore Roberto De Ioris - Codemotion Rome 2017

Evil Branch

Page 19: Unreal Engine 4 Blueprints: Odio e amore Roberto De Ioris - Codemotion Rome 2017

Anti-IF Weapons in Unreal Engine 4

• ENum’s

• Maps (UE4 >= 4.15)

• Switch statement (???)

• Events !

Page 20: Unreal Engine 4 Blueprints: Odio e amore Roberto De Ioris - Codemotion Rome 2017

ENum + Switch Example

Page 21: Unreal Engine 4 Blueprints: Odio e amore Roberto De Ioris - Codemotion Rome 2017

Organization: Multiple Graphs

Page 22: Unreal Engine 4 Blueprints: Odio e amore Roberto De Ioris - Codemotion Rome 2017

CommentsConsider them as “visual grouping” too

Page 23: Unreal Engine 4 Blueprints: Odio e amore Roberto De Ioris - Codemotion Rome 2017

Functions

Page 24: Unreal Engine 4 Blueprints: Odio e amore Roberto De Ioris - Codemotion Rome 2017

Functions VS Events

• Events can be replicated (networking)

• Events can be interrupted (delay, timelines)

• Events cannot return values

• Events have no local variables

Page 25: Unreal Engine 4 Blueprints: Odio e amore Roberto De Ioris - Codemotion Rome 2017

Macros• Raw way to re-organize code in function-like blocks

but without functions limits

Page 26: Unreal Engine 4 Blueprints: Odio e amore Roberto De Ioris - Codemotion Rome 2017

Blueprint Utility FunctionsFor Programmers: Static functions ;)

Page 27: Unreal Engine 4 Blueprints: Odio e amore Roberto De Ioris - Codemotion Rome 2017

Re-routing nodes

Page 28: Unreal Engine 4 Blueprints: Odio e amore Roberto De Ioris - Codemotion Rome 2017

Auto-Collapsing

Page 29: Unreal Engine 4 Blueprints: Odio e amore Roberto De Ioris - Codemotion Rome 2017

… collapsed to function

Page 30: Unreal Engine 4 Blueprints: Odio e amore Roberto De Ioris - Codemotion Rome 2017

Debugging• Real time graph traversing

• watch values

• clients/server attaching

• break points

• stepping

Page 31: Unreal Engine 4 Blueprints: Odio e amore Roberto De Ioris - Codemotion Rome 2017

A Debugging session

Page 32: Unreal Engine 4 Blueprints: Odio e amore Roberto De Ioris - Codemotion Rome 2017

Interfaces• Decoupling

• Decoupling

• Decoupling

• Decoupling

• …

Page 33: Unreal Engine 4 Blueprints: Odio e amore Roberto De Ioris - Codemotion Rome 2017

IDamageable

Page 34: Unreal Engine 4 Blueprints: Odio e amore Roberto De Ioris - Codemotion Rome 2017

Hey !• Functions

• Interfaces

• Debugging

• Variables

• Conditionals

• Type Casting

• …

Page 35: Unreal Engine 4 Blueprints: Odio e amore Roberto De Ioris - Codemotion Rome 2017

“I Fear Writing Blueprints IS programming…”

Page 36: Unreal Engine 4 Blueprints: Odio e amore Roberto De Ioris - Codemotion Rome 2017

Blueprints VS C++• The UE4 C++ API is not fully exposed

• Using blueprints for shaders (materials) is extremely advantageous

• Interfacing with C/C++ is a must for libraries

• Good designed Blueprints are easy to read even for non programmers

• Blueprints are sometimes too much “silent” on error

Page 37: Unreal Engine 4 Blueprints: Odio e amore Roberto De Ioris - Codemotion Rome 2017

The Obvious Truth ?

Honour the “good programming/design rules” and your blueprints will be more like coding instead of

spaghetti

Page 38: Unreal Engine 4 Blueprints: Odio e amore Roberto De Ioris - Codemotion Rome 2017

Alternatives

• UnrealEnginePython

• Unreal.js

• SkookumScript

Page 39: Unreal Engine 4 Blueprints: Odio e amore Roberto De Ioris - Codemotion Rome 2017

An Indie Success StoryDownward by Caracal Games

http://store.steampowered.com/app/506900/

Page 40: Unreal Engine 4 Blueprints: Odio e amore Roberto De Ioris - Codemotion Rome 2017

Thanks• http://aiv01.it

[email protected]

• https://github.com/20tab/UnrealEnginePython

• https://github.com/ncsoft/Unreal.js/

• http://skookumscript.com/