How to Make a Multiplayer Game in Unreal Engine 4 [Blueprint Tutorial] (Unreal) – Part 1 – by DevAddict

April 27, 2021

Multiplayer

Unreal


Title:
How to Make a Multiplayer Game in Unreal Engine 4 [Blueprint Tutorial]

By:
DevAddict


Youtube – Tutorial

Description:
A tutorial extension to the previous Unreal platformer tutorial that shows multiplayer implementation.

Summary

This tutorial extends the previous tutorial on making a platformer in Unreal found here:

Youtube – Lets Make a Platformer – Unreal Engine 4.26 Beginner Tutorial

The original tutorial follows one created by Unreal with some extra steps added. This tutorial is an expansion made by DevAddict specifically to show how to add multiplayer to this project.

Lesson 1: Introduction to Multiplayer

Play Modes

When going into Play Mode in Unreal, there are many options for testing and debugging multiplayer.

    Play Modes: Net Modes:

  • Play as Offline (Standalone): (Default) You are the server
  • Play as Listen Server: Editor acts as both the Server and the Client
  • Play as Client: Editor acts solely as Client and a Server is started behind the scenes for you to connect to

Testing Multiplayer Settings

Approach #1

  • Set Number of Players to: 2
  • Set Play Mode to: Play as Client

This tests both windows as if they were both individual clients.

Approach #2

  • Set Number of Players to: 2
  • Set Play Mode to: Play as Listen Server

The Editor will act as the Server (host) and the extra windows will act as Clients connected to that Server. This helps point out differences occurring between the Server and Clients for debugging multiplayer actors.

Editing Blueprints

Editing Game Mode

The Game Mode class only exists on the Server. It does NOT exist on any of the Clients.

This fact is why transitioning this tutorial to multiplayer causes many issues, the first of which is fixing the UI so it displays for all players. It originally only displays for the Server player because much of the programming for it is within the Game Mode class. Similarly, the respwan code is also only in the Game Mode.

Use “Event OnPostLogin” node

-> “Cast To BP_PlatformerController” node

-> Client Draw HUD (Event we created in the BP_PlatformerController class)

This tells the Game Mode (Server) that when a new player logs in and has their own Player Controller created, that that specific instance will create its own HUD for that individual Client. Note that they intially tried the “Event Handle Starting New Player” node in place of the “Event OnPostLogin” node, which did create the UI, but it did NOT create the character (so in the Unreal editor you just moved around as a camera). This approach may work with some extra modifications, but it did not direclty work in this instance.

Player Controller

The Player Controller is very powerful in multiplayer because it is replicated on the Server and the Client. They like to keep UI on the Player Controller because it exists throughout the play session. While the character may be destroyed in some instances, the Player Controller generally persists. This makes the Player Controller beneficial for respawning mechanisms as well.

Building a Player Controller:

Right-Click -> Blueprint Class -> Player Controller
Named: BP_PlatformerController

You need to connect the Player Controller and your Game Mode, as they work together to realy information between players and the Server.

In the Game Mode class (ThirdPersonGameMode) Event Graph -> Details -> Classes -> Player Controller Class -> Use dropdown to select new Player Controller (BP_PlatformerController)

Common Error – Event BeginPlay to Initialize Player Controller Blueprint

When initializing their Player Controller class, many may try using the “Event BeginPlay” node. This works for single player, which is why it may be prevalent, but it does not work for a multiplayer project. Instead you want an event that will run on the Client ONLY.

Moving HUD from Game Mode (Server) to Player Controller (Client):

Add Custom Event

Connect Custom Event to start of class

In Details of Custom Event -> Graph -> Replicates: Run on owning Client -> Replicates: Check ON Reliable

via Blogger http://stevelilleyschool.blogspot.com/2021/04/how-to-make-multiplayer-game-in-unreal.html

Intro to Unreal: Basics and Intro to Blue Prints

March 17, 2021

Intro and Blue Prints

Unreal


Title:
Unreal Engine 4 Complete Beginners Guide [UE4 Basics Ep. 1]

By:
Smart Poly


Youtube – Tutorial

Description:
A quick introduction to using the Unreal engine and just getting acquainted with the main editor window.


Title:
Unreal Engine 4 – Blueprint Basics [UE4 Basics Ep. 2]

By:
Smart Poly


Youtube – Tutorial

Description:
Quick introduction to using Unreal’s blueprints.


Title:
Unreal Gameplay Framework

By:
Unreal


Unreal – Link

Description:
Unreal Gameplay Framework, the official Unreal documentation.


Learning the Basics

It has been a while since I have used Unreal in any significant capacity, so I am going back to the basics to try and make sure I have all the fundamentals covered.

Tutorial #1

Moving/Positioning Objects

By default, Unreal has all the transformation functions snap. So moving an object, rotating it, and scaling it all occur in steps as opposed to smooth transforms. This can easily be changed in the top right of the viewport at any time.

Extra Camera Controls

F: focuses on object (like Unity)

Shift + move an object: Camera follows the moving object

You can directly change the camera speed in the top right of the viewport.

Adding Content Pack Later

If you find that you want to add the starter content to a project later than the start, this can easily be done through “Content” in the “Content Browser” window, then “Add New”, and choosing “Add Feature or Content Pack”. The starter content options will be one of the first to show up by default under the “Content Packs”.

Lighting Basics

“LIGHTING NEEDS REBUILT” Error Message

The static meshes want the lighting to be rebuilt when added so they are accounted for. Fixed with:

Go to: Build -> Build Lighting Only

Light Mobility Options

Lights by default have 3 mobility options: Static, Station, Movable

  • Static: can’t be changed in game; fully baked lighting
  • Station (Default): only shadowing and bounced lighting from static objects baked from Lightmass; all other lighting dynamic; movable objects have dynamic shadows
  • Movable: fully dynamic lighting, but slowest rendering speed

Tutorial #2

General Structure of Blue Prints

Components:

area where different components can be added

what allows you to place objects into the viewport of the blue print

this is where colliders are shaped to the proper size/shape


Details:

all the different details for this particular blue print


Event Graph:

this is the tab where visual scripting is majorly done


Function:

effectively contained event graphs with more specialized functionality


Variables:

representation of fields as you’d expect

Events

These are events which call the given functions when something in particular occurs. These functions are created within the blue print Event Graph.

Actions (Examples)

On Component Begin Overlap: occurs when something initially enters a collider
– Similar to Unity’s OnTriggerEnter

On Component End Overlap: occurs when something initially leaves a collider
– similar to Unity’s OnTriggerExit

E: occurs when the “E” key is pressed

Action: Timeline

Timeline:

allows you to visually create a graph of how a variable changes over a particular set of time

By default, the x-axis is the time and the y-axis is the variable value.
Points can be added as wanted to act as key frames for the variable.
Also allows for easy modifications to the interpolation between points, such as changing it from a line to a cubic interpolation by selecting multiple points.

Make sure to pay attention to the time Length set in the time line. Even if you didn’t put points somewhere in particular, if that is way longer than where your points are, you can get strange results since it will perform the action over the entire length of time.

Debugging Blue Prints

If you select Play from within the blue print, you can get a separate play window while leaving the blue print window visible. This can be helpful for example with the Event Graph, as you can actually see when different events occur according to the system and when inputs are read. This also shows the variables changing in some nodes, such as Timeline.

Classes (as covered by the Gameplay Framework Quick Reference)

Agents

Pawn

Pawns are Actors which can be possessed by a controller to receive input to perform actions.

Character

Characters are just more humanoid Pawns. They come with a few more common components, such as a CapsuleComponent for collision and a CharacterMovementComponent by default.

Controllers/Input

Controllers are Actors which direct Pawns. These are generally AIController (for NPC Pawns) and PlayerController (for player controlled Pawns). A Controller can “possess” a Pawn to control it.

PlayerController

the interface between a Pawn and the human player

AIController

simulated AI control of a Pawn

Display Information

HUD

Focused on the 2D UI on-screen display

Camera

The “eye” of a player. Each PlayerController typically has one.

Game Rules

GameMode

This defines the game, including things such as game rules and win conditions. It only exists on the server. It typically should not have much data that changes during play, and definitely should not have transient data the client needs to know about.

GameState

Contains the state of the game.
Some examples include: list of connected players, score, where pieces in a chess game are.
This exists on the server and all clients replicate this data to keep machines up to date with the current state.

PlayerState

This is the state of a participant in the game (which can be a player or a bot simulating a player). However, an NPC AI that exists as part of the game would NOT have a PlayerState.
Some examples include: player name, score, in-match level for a MOBA, if player has flag in a CTF game.
PlayerStates for all players exist on all machines (unlike PlayerControllers) and can replicate freely to keep machines in sync.

via Blogger http://stevelilleyschool.blogspot.com/2021/03/intro-to-unreal-basics-and-intro-to.html

Intro to Unreal: Basics Tutorial Compilation

March 16, 2021

Intro and Basics

Unreal


Title:
Unreal Engine 4 Complete Beginners Guide [UE4 Basics Ep. 1]

By:
Smart Poly


Youtube – Tutorial

Description:
A quick introduction to using the Unreal engine and just getting acquainted with the main editor window.


Title:
Unreal Engine 4 – Blueprint Basics [UE4 Basics Ep. 2]

By:
Smart Poly


Youtube – Tutorial

Description:
Quick introduction to using Unreal’s blueprints.


Title:
Unreal Engine 4 Beginner Tutorial: Getting Started

By:
DevAddict


Youtube – Tutorial

Description:
A more in depth intro to getting through the Unreal editor and starting to apply it to some general case uses.


Title:
Unreal Engine Beginner Tutorial: Building Your First Game

By:
Devslopes


Youtube – Tutorial

Description:
A good introduction focusing on building more of your own assets instead of using the Unreal given assets.


Title:
Unreal Engine 4.26 Beginner’s Tutorial: Make a Platformer Game

By:
DevAddict


Youtube – Tutorial

Description:
A large tutorial focusing on fleshing out the functionality of a given project and assets in Unreal.

Summary

This is a quick list of some Unreal tutorials just to get familiar with the engine. I listed them in order of a progression that I believe makes sense, where the first couple simply introduce the main Unreal editor and some of the tools it gives you, and the later tutorials start to implement those individual components to varying degrees. Some of these focus on using blue prints, while some focus on applying parameters to assets just through the Unreal editor directly. Finally, some of the tutorials near the end beging to show these tools making more complete systems and projects.

via Blogger http://stevelilleyschool.blogspot.com/2021/03/intro-to-unreal-basics-tutorial.html

Grayboxing Levels in Unreal

February 5, 2019

Grayboxing in Unreal Engine

Basics of BSP

Wiki Unreal Engine – Basic Level Design BSP

I’ve started to learn the basics of the Unreal Engine (UE4), primarily with respect to it’s BSP (Binary Space Partitioning) and grayboxing levels. It’s the engine of choice for our Architectural Approaches to Level Design class specifically for this purpose.

Brushes

Unreal provides a base of shapes to work with that are perfect for setting up the overall shape and scale of a level or world in 3D. There are boxes, cones, stairs (linear, curved, and spiral), cylinders, and spheres. These shapes however also have various parameters associated with them that really help you mold out your world. The objects can have their sizes changed without strange scaling effects that need to be accounted for. The stairs have parameters for stair size and shape.

One particularly useful feature is that these shape brushes can be either additive or subtractive. Additive does what you would expect, creates the shape in the world. Subtractive however removes the colliding volume from any existing additive shape it intersects with. This can quickly and easily create some interesting shapes, or help build out rooms and doorways. Speaking of rooms, another helpful feature for this is that you can make some of these shape brushes hollow. This leaves a thin shell of the shape with a completely empty volume.

Geometry Mode

Finally, if you really want to stretch the creativity of your shapes, you can further edit them in Geometry Mode. This tool reminds me of Maya; it lets you do things like extrude faces or move around/remove vertices. This mode lets you craft the shapes almost anyway imaginable and is very easy to use.