You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Copy file name to clipboardExpand all lines: README.md
+7-3Lines changed: 7 additions & 3 deletions
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -9,15 +9,17 @@ The Python VM tries to give easy access to all of the UE4 internal api + its ref
9
9
10
10
It is not meant as a way to avoid blueprints or c++ but as a good companion to them (albeit reducing the amount of c++ required for coding a game could be an interesting thing ;). If your development pipeline is already python-based (Maya, Blender, ...), this plugin could easily help you in integrating unreal into it.
11
11
12
-
Another funny feature (well, a side effect ;) is that you can change your python code even after the project has been packaged. You can potentially build a completely new game from an already packaged one.
12
+
If you want to have an idea of what the plugin can do, jump here: https://github.com/20tab/UnrealEnginePython/blob/master/tutorials/YourFirstAutomatedPipeline.md
13
13
14
14
In addition to this, the plugin automatically adds an actor class (PyActor), a pawn class (PyPawn), a character class (PyCharacter) and a component class (PythonComponent) for "gentle" integration of python in your games.
15
15
16
-
In the development menu, you get access to the 'PythonConsole' too, you can use it to trigger python commands directly from the editor. There is even an experimental Editor/IDE included, you can run it from the Window/Layout/Python Editor menu item.
16
+
Another funny feature (well, a side effect ;) is that you can change your python code even after the project has been packaged. You can potentially build a completely new game from an already packaged one.
17
+
18
+
Once the plugin is installed and enabled, you get access to the 'PythonConsole' item in the 'Development Menu', you can use it to trigger python commands directly from the editor. There is even an experimental Editor/IDE included, you can run it from the Window/Layout/Python Editor menu item.
17
19
18
20
All of the exposed engine features are under the 'unreal_engine' virtual module (it is completely coded in c into the plugin, so do not expect to run 'import unreal_engine' from a standard python shell)
19
21
20
-
The currently supported Unreal Engine versions are 4.12, 4.13, 4.14and 4.15
22
+
The currently supported Unreal Engine versions are 4.12, 4.13, 4.14, 4.15 and 4.16
By default the build procedure will try to discover your python installation looking at hardcoded known paths. If you want to specify a custom python installation (or the autodetection simply fails) you can change it in the Source/UnrealEnginePython/UnrealEnginePython.Build.cs file at this line: https://github.com/20tab/UnrealEnginePython/blob/master/Source/UnrealEnginePython/UnrealEnginePython.Build.cs#L10
49
51
52
+
Note: ensure you have a 64bit python installation
53
+
50
54
51
55
choose a project you want to install the plugin into, open the file explorer (you can do it from the epic launcher too) and:
Copy file name to clipboardExpand all lines: tutorials/YourFirstAutomatedPipeline.md
+46-41Lines changed: 46 additions & 41 deletions
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -1,8 +1,8 @@
1
-
Your First Automated Pipeline with UnrealEnginePython (WORK IN PROGRESS)
1
+
Your First Automated Pipeline with UnrealEnginePython (Part 1)
2
2
=
3
3
4
4
In this tutorial i will try to show you how to build a python script that can generate
5
-
a new Unreal Engine 4 Blueprint implementing a Kaiju (a big Japanese monster) with its materials, animations and a simple AI based on Behavior Trees.
5
+
a new Unreal Engine 4 Blueprint implementing a Kaiju (a big Japanese monster) with its materials and animations. In the second part a simple AI based on Behavior Trees will be added to the Blueprint as well as a bunch of simple unit tests..
6
6
7
7
Running the script from the Unreal Engine Python Console will result in a native Blueprint (as well as meshes, animations, a blackboard and a behaviour tree graph) that does not require the python plugin to work.
8
8
@@ -77,7 +77,7 @@ ue.py_exec('name_of_script.py')
77
77
78
78

79
79
80
-
Finally, download the https://github.com/20tab/UnrealEnginePython/blob/master/tutorials/YourFirstAutomatedPipeline_Assets/Kaiju_Assets.zip file and unzip it in your Desktop folder. These are the original files (fbx, tga, ...) we will import in the project using a python script.
80
+
Finally, download the https://github.com/20tab/UnrealEnginePython/blob/master/tutorials/YourFirstAutomatedPipeline_Assets/Kaiju_Assets.zip file and unzip it in your Desktop folder. These are the original files (fbx, tga, ...) we will import in the project using a python script. The files have been 'donated' to me by Matteo Baccaro and Giacomo Caneschi of AIV (Italian Videogame Academy, http://aiv01.it)
81
81
82
82
Importing the Mesh FBX
83
83
-
@@ -133,7 +133,7 @@ The Kaiju original model is 30 meters high, so we scale it down to use it in a c
133
133
Creating the Materials
134
134
-
135
135
136
-
The models looks good from a geometry point of view, but you can note (on the top left of the previous screenshot) that no material is assigned to the mesh.
136
+
The model looks good from a geometry point of view, but you can note (on the top left of the previous screenshot) that no material is assigned to the mesh.
137
137
138
138
We are going to create two different materials, one for the blades (Element 0) and the other for the kaiju body (Element 1)
The textures are ready, we can start "programming" our materials adding nodes to the graphs.
198
198
199
-
Let's start with the blades. The only two things to take into account is that the OcclusionRoughnessMetallic textures must have the sRGB flag turned off, and each of its channel will be mapped to a different channel:
199
+
Let's start with the blades. The only two things to take into account is that the OcclusionRoughnessMetallic textures must have the sRGB flag turned off, and each of its color channel will be mapped to a different material component:
unfortunately, as you can see, we need a hack when creating new blueprints. Generating a Blueprint with the same name of another one will trigger a crash. We are investigating a better api to avoid that tricky exception.
471
+
Always take into account that creating a Blueprint (of any kind) with a name of an existing one, will trigger an error.
472
+
If ue.find_asset() succeeds, we destroy the already existing asset.
470
473
471
474
Once the blueprint is created, we need to assign a custom event 'DoAttack' (triggered when the Kaiju is near a Pawn), anpther one called 'Boring' (triggered when the kaiju is stationary/idle for more than 10 seconds), 2 bool variables (Attack, Bored) and a float one (Speed):
472
475
@@ -752,49 +755,51 @@ Now it is time to create The Character Blueprint at which we will attach the pre
the get_cdo() method returns the 'Class Default Object', it is a special instance of a class defining the default properties and components that following instances should inherit. When you edit a blueprint class you can effectively editing its 'cdo'.
769
783
770
-
TODO: implement the idle timer triggering the bored state
771
-
772
-
The BlackBoard
773
-
-
784
+
We can now complete the first part of the tutorial by compiling the blueprint:
774
785
775
786
```python
776
-
from unreal_engine.classes import BlackBoardDataFactory
777
-
from unreal_engine.classes import BlackboardKeyType_Bool, BlackboardKeyType_String
778
-
779
-
from unreal_engine.structs import BlackboardEntry
780
-
787
+
ue.compile_blueprint(slicer_bp)
788
+
slicer_bp.save_package()
781
789
```
782
-
783
-
The Behavior Tree Graph
784
-
-
785
-
786
-
TODO: Implement a decorator checking for pawn in a sphere, create a bt with a sequence of 'move to', 'raise event (attack)', 'wait'
787
-
788
-
The Kaiju Brain
790
+
Final notes
789
791
-
790
792
791
-
TODO: assign the bt to the AIController of the Kaiju
793
+
You can get the whole script here: https://github.com/20tab/UnrealEnginePython/blob/master/tutorials/YourFirstAutomatedPipeline_Assets/kaiju_slicer_pipeline.py
792
794
793
-
Testing it
794
-
-
795
+
You can now drag and drop the blueprint in your scene or subclass it.
795
796
796
-
TODO: write a unit test instantiating the Kaiju with a dumb pawn and checking for pawn in its virtual sphere.
0 commit comments