Week 2 Day 5 - Blueprints
We started class playing a 12 player game of Hearts, and talked a bit about the game design decisions behind it and other trick taking games, like Spades.
We then went into UE4 and talked about the Content Examples museum, which holds examples of how to do a hundred and one different things in UE4. I cover the basics in this class, but there's a huge amount to learn, so when working on your projects be sure to open up the relevant examples project and see how the Epic team did it.
Finally I showed three new events in UE4 - BeginPlay, OnOverlap, and Tick. BeginPlay runs once - when the object is created (which is often when the map loads). OnOverlap runs when the player enters inside the object (usually done with an invisible box or sphere collision). Event Tick will trigger and run every frame.
Tick has a special caveat with it - since the frame rate in a video game is not steady, and can vary wildly depending on the computer and quality settings of a game, you should not rely on it to always fire at the same speed. If you do, your game will play differently on faster and slower machines, with usually the faster machines at a disadvantage. To this end, every time you use Event Tick, you should drag out from it the "delta seconds" variable which is how long it has been since the last frame, and multiply your speed by it so that it will move at the same speed no matter whether you're on a fast or slow machine.
I then ran through an example of making a platform, showing such things as: 1) How to make a variable in UE4 (either by clicking the + next to the variables list or by promoting a pin to a variable), 2) How to get/set variables in UE4 (drag the variable on to the event graph), 3) How to make public variables that can be set on an object while in editor view without needing to recompile your code, 4) How to move objects (using the various set location nodes), 5) How to do if statements (a Branch node in UE4), 6) Comparisons (less than, greater than, etc.) which feed into Branch nodes, 7) and programmatically animating a platform in UE4.