Game Coding – UE4 Blueprints

Introduced in Unreal Engine 4, Blueprints is a visual scripting language that is built into the engine. By using visual scripting, instead of writing code from scratch inside Visual Studio or some other IDE (which we will cover in the next chapter), we can use predefined actions and connect them together, similar to drawing a graph. This is often a great starting point for artists and game designers as it is much more visually oriented and easier to grasp than just plain code.

The Blueprints system in UE4 is almost the only, and certainly the most common way to build game logic efficiently and fast. It is the new version of the old system in UE3 called Kismet, that was not efficient when it came to refactoring the logic for different levels inside the same game. The engine supports C++ game code as well, but in that case I would not consider it as scripting, as C++ cannot be a scripting language and is pure programming!


There are two types of blueprints you can create:
1. Level Blueprint: This works similarly to how UE3’s Kismet system worked as events and actions that will occur in just this particular level. This is good for things such as triggering enemies to spawn or moving platforms. Each level has its own blueprint that can be used only in the same level, and is used to control the current level entities and blueprints. Connecting some cloud objects with raindrop particles is a good example of what a level blueprint can achieve.
As they are only exposed per-level, this means that their number will always be limited to your number of levels; so if your project contains 20 maps/levels, it means that you have exactly 20 level blueprints!

2. Class Blueprints: Introduced in UE4, this can be put into any level. They just work using their predefined behavior that we create beforehand, similar to prefabs in Unity. The easiest way to think about it is that each entity in the world is a blueprint as long as the entity has to act, behave, or do any logic type. These types of blueprints are very powerful, as you can use them anywhere inside your project; you can even recycle them to be used in another project somehow! You can have any number of these; it depends on your game and world size and complexity. It may take some time to get used to it, but we will dive into some simple systems first.