Unreal Engine Livestream - Python in Unreal Engine - May 30 - Live from HQ

WHAT
On this week’s livestream, Jamie Dale and Aaron Carlisle are joining us to demonstrate how you can use Python in Unreal Engine to automate processes in the editor. They will walk us through how to get started, provide some examples on how we’ve used it internally, and answer questions regarding the topic.

WHEN
Thursday, May 30 @ 2:00PM ET - Countdown

WHERE
Twitch
Youtube

RESOURCES
Demo Files
Python in Unreal Engine
Python API Docs

WHO
Jamie Dale - Senior Programmer, UK - @jdale88](http://twitter.com/jdale88)
Aaron Carlisle - Pipeline Developer - @aaronbcarlisle](http://twitter.com/aaronbcarlisle)
Victor Brodin - Community Manager - @victor1erp](http://twitter.com/victor1erp)

NEWS

**Ray tracing for architectural visualization: webinar replay **
https://www.unrealengine.com/en-US/b…webinar-replay

**Learn how Drifter Entertainment leveraged elegant optimizations to bring Robo Recall to the Oculus Quest **
https://www.unrealengine.com/en-US/d…e-oculus-quest

**Demand for Unreal Engine and real-time 3D skills at all-time high **
https://www.unrealengine.com/en-US/b…-all-time-high

**A new look for the Unreal Engine documentation **
https://www.unrealengine.com/en-US/b…-documentation

**Splitgate: Arena Warfare infuses elements of Halo and Portal to create a new breed of FPS **
https://www.unrealengine.com/en-US/d…w-breed-of-fps

**Unreal E3 Awards 2019 Announced **
https://www.unrealengine.com/en-US/b…tel-and-nvidia

COMMUNITY SPOTLIGHT

Scionti Design
https://www.sciontidesign.com/

XERA: Survival
https://store.steampowered.com/app/6…XERA_Survival/

**Alluris **Alluris Announcement Trailer - YouTube

ARCHIVE
Python in Unreal Engine | Inside Unreal - YouTube

Yes! Have been waiting for this topic for ages! This stream is got to be the most useful one for in a long time

Python have its own set of “objects”, separate from the Blueprint world, and its own garbage collection issues…

In a reality where even UMG menus can cause performance impact (some projects are forced to fallback to Slate UI, I’ve seen this), a Python runtime is yet one more big problem engineers have to somehow fit in the 16ms of a frame. I don’t know if Epic would consider that a good idea.

YES! Each week I’m hoping this will be next :slight_smile: thanks for listening.

They technically open sourced Skookum Script so my guess is that a new language using SK tech is being cooked right now. Skookum Script doesn’t use a Virtual Machine and compiles to C++ data structures (kind of) so the performance is almost close to C++. It also behaves like a scripting language so it completely obliterates python in regards to gameplay programming.

Epic say they are also working on a new VM.
So there’s a lot of things going on they didn’t explain yet.

Meantime you can out UnrealEnginePython plugin:

Just trowing it in, in case someone is looking to implement some python in their projects. It’s pretty mature UE4 python implementation already, can be used in editor AND at runtime in packaged projects.

I realised I answered this question backwards… I thought I’d been asked whether you could make a String Table from FText instances.

Yes, you can do that. You can use unreal.LOCTABLE to create an FText that references a String Table entry.

To follow-up from my on-stream answer… that delegate seems broken for external use. The delegate is called when Python is initialized as the module is loaded, so if IPythonScriptPlugin::Get() returns a valid pointer then Python has already been initialized, and if it doesn’t then there’s nothing you can bind to for callback later. I’ll look at either fixing or removing that.

Hi, I have a question, is it possible to import and use other libraries such as numpy or other machine learning libraries?

I don’t see why not. They just need to be compatible with stock CPython.

Hi
Are the source files used in this talk available somewhere?
thank you very much

Hi, great presentation.
Could you give us a link to download Python sources of the presentation, specially the sequencer please ?

Same question, we’d like to test and study python code, specially for the sequencer. Thank you.

Sorry for the delay!

Here are the source files from the demo:
https://github.com/abcarlisle/UnrealDev/tree/master/Python

Thanks for a great tutorial, I am totally not getting all of the stuff regarding exposing C++, but I will get there!

I have a somewhat related question regarding “post processing” the compile or save actions - in the editor. Specifically I would like to make a small plugin that can generate and expose specific Blackboard get/set_key_values, as suggested in this feedback i made: Setting Blackboard key values, debug and suggestion! ( I hard coded the functions, but it would be relatively simple to archive the very same thing dynamically - in C++ or via Python. As we are not able to add BP to a blackboard, the code was placed at the AI Controller. )

**In general I assume that there is a limit to how much of this that can be done in Python… but perhaps you can direct me to sample code for doing something like this - I hope you get the “gist”… and the challenge? **

My general game plan would be to make a subclass of Blackboard and/or BlackboardData that can dynamically create/expose the get/set<value> functions. Say a general function ‘set Action Status’ (in this case Action Status is an ENUM, so there should also be a specific ‘*set Action Status Running’ *function) should appear dynamically, when I cast to an instance of my specific blackboard asset (BB_asset). (This is as an more solid alternative to actually generating blueprints, as suggested in the feed back… )

For this to happen I would - at least - need to:

  • “post process” the key(s) when a new key is set up or when the blackboard is saved

  • be able to add new get/setFunctions to the action/function list, UE4 must contain some general ways of doing that dynamically… when building the action lists?

  • Like the BlackboardKeySelector function, as it is used in Behavior trees.

  • I guess this could even be accomplished by adding some new dynamic functions to the backboard data/blackboard key types.

However when I drag from a Blackboard variable I am not able to cast to my BB_asset - so I also need to enable that for my subclass of Blackboard? (As for the cast to a Child-of-character can be done “dynamically”, I guess it should be possible to cast to BB_asset (however we are not allowed to make a child of Behavior tree or blackboard).

I imagine that much of this can be done in, or at least triggered by, Python, however I would probably need to catch the save/built/compile event for the Blackboard… and I don’t see that there is a way for Python to catch such the event…

In general I think we need an library of small, and relatively simple, examples… for such tasks?

An even more simple extension, would be a new ‘make literal name’ that could take a specific BB as input, so you could select the correct BB_key from a drop down list. (I can cast to BlackboardData but in BP I can not get the reference to BlackboardData from the Blackboard?)

whats my epic ID

Here’s the demo files updated for UE5 which also includes the stub file and instructions on how to set it up for auto-completion.