Skip to content

UE4 Multiplayer & Steam Workflow (with basic definitions)

⓪ How to apply Steam AppID?

Update:02:15:21 2017-05-03

Use this one: https://partner.steamgames.com/documentation/step_by_step

Use SteamPipe Now

https://www.youtube.com/watch?v=PShS32hcing
https://www.youtube.com/watch?v=SoNH-v6aU9Q

Old One:

{
[http://steampowered.com/steamworks/FAQ.php#Technical]

To be granted your own AppID to build your application and prepare for release on Steam, you will need to start by posting your product in Steam Greenlight.

http://steamcommunity.com/greenlight

And FAQ: http://steamcommunity.com/workshop/about/?appid=765&section=faq

Steam SDK: https://partner.steamgames.com/


How do I get access to Steamworks?

You can download the Steamworks SDK, view documentation, and compile with a test appID by visiting https://partner.steamgames.com and accepting the SDK Access Agreement. Developers wishing to integrate the Steamworks SDK with their own games or applications still need to first be Greenlit and provided with an appID.

My game is in early development stages, don’t I need to plan for the SDK integration now?

The Steamworks SDK is easy to integrate, so you can wait until your game is further along in the development cycle before worrying about it. In the meantime, you can download the Steamworks SDK, view documentation, and compile with a test appID by visiting https://partner.steamgames.com and accepting the SDK Access Agreement.

test appID is 480

}

① Structure of Project

Project Folders

|—Blueprints
+——AllLevels
   +——GameInstance(King of all Blueprint,Only One, manage the game main flow related event)
   +——Structure(PlayerInfo)
   +——SaveGame(use for save player info locally and upload to server)
+——Characters
   +——CharacterBlueprint(Base Character,Change mesh on the fly)
   +——Child Blueprint(Different Type)
+——Lobby
   +——Game Mode(Lobby)
   +——Player Controller(Lobby)
+——Gameplay
   +——Game Mode
   +——Player Controller
|—Maps
+——Arena01
+——Arena02
+——LobbyMap
+——TravelMap(Transition Map,Empty Level)
+——MainMenu Map(Empty Level)
|—UI
+——AllLevels
   +——Chat Text(Widget Blueprint)
   +——ChatWindow(Main Menu)
   +——ChatWindow(GamePlay)
   +——Loading Screen
+——Lobby
   +——Character Select(Widget)
   +——Connected Player
   +——Game Setting
   +——Lobby Menu
   +——Player Button(Server to kick someone)
+——MainMenu
   +——ErrorDialog
   +——HostMenu
   +——MainMenu
   +——OptionMenu
   +——Server Menu(Find Game)
|—Textures
|-InfinitBlood
+—Retargeting!!!!!!!!!!!!!!!!!!!
|—Mannequin 
+—Animation(Retargeting!!!!!!!!!!!!!!!!!!!)
+—Character


② Change Project Settings
Project Setting->Map & Mode-> Transition Map & other Map
And Instance

③Animation
设置Retargeting Skeleton
然后Duplicate Animation
设置AnimationBP(Idle)
设置Character的Mesh

④GameInstance
Events:
|- ShowMainMenu: validate main menu -> create Main Menu or add to viewport;Enable mouse cursor~
|- Show Host Menu:~~~
|- Show Server Menu: create each time it’s called
|- Show Options Menu
|- Show Loading Screen: IsValid-> Create Loading Widget(get player controller) -> promote to variable

|- Launch Lobby: (number of players, enable lan?, server name) -> Show Loading Screen
\— call show loading screen
\— create session
\— \—- player collection
\— \—- Use Lan
\— Open Level(Success)
\— \—- Lobby Level
\— \—- Listen
\— (Failed) display error message
\— \—- Macro: (Err Found[EXEC], Message)

|- Join Server(Called from Server Menu)
\— (Server[Blueprint Session Result])
\— call show loading Screen
\— Join Sesson(Call)
\— \—- Result

|- Event Network Error/ Event Travel Error
\— Call Error Handler Function
\— Call Display Error Message

|- Destroy Session Caller
\— Player Controller
\— Destroy Session

Functions
|- NetErrorToString
\— ENetwork Failure
|- TravelErrorToString
\— ETravel Failure

⑤ MainMenu Level
Blueprint
Event Begin Play-> Get Game Instance-> Cast to GameInfoInstance-> Show Main Menu

⑥PlayerInfo
\—- MyPlayerName [Text] \—- Avatar [Texture 2D] \—- Character [Character Class] \—- MyPlayerCharacterImage [Texture 2D] \—- MyPlayerStatus[Text] (Not Ready)

⑦Player Save Game
\— s_playerInfo[struct PlayerInfo] \— \—- Replicated

⑧World Setting
|- GameMode Override: GM
|- Default Pawn: 0_base
|- Player Controller Class: GamePlayPC

⑨ Thumbs
⑩ Lobby Level
+ Blocking Volume

⑪ Main Menu UI Widget UMG
use border

ΔGraph
Event Begin Play->Get Game Instance Cast to GameInfoInstance ->

|- OnClicked HostButton/FindButton/Option Button
\— Remove From Parent
\— Show Host Menu / Join Menu / Option Menu

|- OnClicked Quit Game
\— Quit Game(Get Owning Player)

⑫ Design Host UMG

[server name] [select number of player] [select play Method] [Back][Accept]

ΔGraph

Event Begin Play->Get Game Instance Cast to GameInfoInstance -> set TextLabel Server name

|- OnTextChange(ServerName)
\— Not Empty-> Set Text
\— Accept Enabled?

|- BackButton On Clicked
\— Remove From Parent
\— Show Main Menu

|- Accept On Clicked
\— Remove From Parent
\— Launch Lobby

|- Increase/Decrease On Clicked
|- ToggleLeft/ Toggle Right(LAN|INTERNET)

⑬ Option Menu
Player Name
Avatar

—-
In GameInfoInstance
Event:SaveGameCheck -> Does Save Game Exist?[Player Settings Save] ( -> False: Show Option Menu => Show Mouse Cursor )-> True:Show Main Menu -> Set Boolean: Created Save File

In MainMenu
Event Begin Play->Get Game Instance Cast to GameInfoInstance -> Call SaveGameCheck

—-

ΔGraph

Event Begin Play->Get Game Instance Cast to GameInfoInstance -> Promote GameInstanceRef -> Load Saved Data and set New Data

|- On Text Committed
|- On Clicked Back Button (Return to Main Menu)
|- On Clicked Accept Button
\— Set Members in Player Info Structure
\— Save Game
\— Set Welcome Message Vis Hidden
\— Remove from Parent
\— set Created Save File?
\— Show Main Menu

|- Toggle Right/Left
Avatar Reference Texture 2D Array

ΔFunctions

|- SaveGameCheck (Does Save Game Exist,Slot Name 要一致) -> Branch => True:LoadGame => False:SaveGame -> Set Boolean of Found Saved Game
|- SaveGame ->if SaveGameRef is Valid => False: Create Save Game Object(Player Save Game) -> Cast to PlayerSaveGame->Set(Promote to)SaveGameRef
\— Save S Player Info
\— Save Game to Slot
|- LoadGame
\— Load Game from Slot
\— Cast to PlayerSaveGame
\— get S player Info -> set Player info
|- EmptyNameCheck
|- SetupAvatarDisplay

⑭ UMG Find a Match design

Widget Switcher!!!!!!

ΔGraph

Event Begin Play->Get Game Instance Cast to GameInfoInstance -> Promote GameInstanceRef ->Init
\— Set Play Method
\— Set Enabled Lan?

Event
|- OnClicked Accept Button
\— Session Found?
\— \—- True: Remove from Parent; -> Join Server(Promote to Available Session)
\— \—- False: RefreshServer (To-do)

|- Display Session[Custom Event] \— Params: SessionToJoin
\— Set Time by Event
\— \— Session Timer[Custom Event] \— \— \— Do N
\— \— Reset Timer -> Reset Timer
\— Call Handle Counter down
\— Set Text of Warning Found Available

Functions
|- RefreshServers
\— Set Button Vis Hidden
\— Set Active Widget Index(1,Loading,WidgetSwitcher)
\— FoundSessions[Blueprint Sessions Result | Array] -> Clear
\— Find Session(Online Node) -> FoundSessions
\— \—- Failure: NO Found. Search failed. Please Try again -> set ButtonVis Visible-> set Activate Widget Index
\— \—- Success: FoundSessions->ForEachLoopWithBreak->ArrayElement != Max {set found?;set available session}
\— \—- \—– Complete: if found , set Visible -> set Active Widget Index -> Display Session[Custom Event]

|- Handle CounterDown
\— TimerValue[Int]=10
\— If == 0 => True Session Found?=false;TimerValue =10;ButtonVis[ESlate Visibility] \— Set Active Widget Index(WidgetSwitcher)
\— Call Reset Timer

⑮ Online SubSystem

/Config/DefaultEngine.ini

[/Script/Engine.GameEngine]
+NetDriverDefinitions=(DefName="GameNetDriver",DriverClassName="OnlineSubsystemSteam.SteamNetDriver",DriverClassNameFallback="OnlineSubsystemUtils.IpNetDriver")

[OnlineSubsystem]
DefaultPlatformService=Steam

[OnlineSubsystemSteam]
bEnabled=true
SteamDevAppId=480

[/Script/OnlineSubsystemSteam.SteamNetDriver]
NetConnectionClassName="OnlineSubsystemSteam.SteamNetConnection"

The SteamDevAppId of 480 is Valve’s test app id, shared by everyone. You will need your own app id eventually, but most features of Steam should work before then.

Restart Editor
Test: Standalone Game

⑯ Lobby Player Controller

Δ Lobby GameMode

Custom Events:
|- SwapCharacter (PlayerController[PC], Character Class[Character Class], CharacterStatus[Boolean]);
\\\\ Run this on the server(Replicates: Run on Server)
\\\\ (set Reliable)
|- EveryOneUpdate ()
\\\\ (Replicates: Run on Server)
\\\\ (set Reliable) => Guarantee every thing reliable; Like Particle which is not critical can be set as unreliable

Δ UMG Lobby UI

Variable(Category:Lobby Info)
|- LobbyServerName: Editable;Expose on Spawn;Replicated
|- MapName: Replicated
|- MapTime: Replicated
|- MapImage:Texture 2D; Replicated
|- PlayersDisplay: Replicated;
Custom Events
|- ClearPlayerList
|- UpdatePlayerWindow (IncomingPlayerInfo[PlayerInfo|Array])
\\\\ Replicates: Run on Owning Client!!!!
\\\\ Reliable


Δ Lobby Player Controller

{Player Controller run on both server and clients; PC on client doesn’t know what happened on others}
Custom Events
|- InitialSetup // Check and tell server to update
\\\\ (Replicates: Run on Owning Client; )
\\\\ (Reliable)
\—- Save Game Check
\—- Call CallUpdate(Promote to PlayerSettings[(Replication:Replicated)])

|- CallUpdate ([PlayerInfo],ChangedStatus?)
\\\\ (Replicates: Run on Server )
\\\\ (Reliable)
\—- Set PlayerSettings
\—- Get Lobby Game Mode -> SwapCharacter(Self,PlayerSettings->MyPlayerCharacter,ChangeStatus?) -> Everyone Update

|- SetupLobbyMenu(ServerName[Text])
\\\\ (Replicates: Run on Owning Client; )
\\\\ (Reliable)
\—- Show Mouse Cursor
\—- Create Lobby Menu Widget(Pass through ServerName from Event Params)
\—- Add to ViewPort
\—- Set Input Mode Game and UI ( In Widget to Focus?!!?;Target -> self)

|- AddPlayerInfo(ConnectedPlayerInfo[PlayerInfo|Array])
\—- If get LobbyMenu WB isValid
\—- \—-> True: Clear PlayerList -> ForEachLoop of ConnectedPlayerInfo -> UpdatePlayerWindow

|- UpdateLobbySettings([MapImage,Texture 2D],MapName,MapTime)
\\\\ (Replicates: Run on Owning Client; )
\\\\ (Reliable)
\—- Set Map Image
\—- Set Map Name
\—- Set Map Time

|- Show Loading Screen
\\\\ (Replicates: Run on Owning Client; )
\\\\ (Reliable)
\—- LobbyMenuWB->Remove From Parent
\—- Create Loading Screen Widget
\—- Add to Viewport

|- Update Number of Players(CurrentPlayer[int],MaxPlayers[int])
\\\\ Run on owning client
\\\\ reliable
\—- Set PlayerDisplay

 

|-Event End Play
\—- Destroy Session

|- Kicked
\\\\ (Replicates: Run on Owning Client; )
\\\\ (Reliable)
\—- Open Level(MainMenu)
\—- Destroy Session

Functions
|- Save Game Check

⑰ UMG Lobby Menu Layout Design

{
[Lobby Settings Wrap with Grid Panel(0.5,0.5)] ServerName
\- MapImage|(MapName,MapTime)
\- Start Session | Ready
\- GameSetting(Server Only)
\- Select Character
\- Leave Lobby
\- Press T to Toggle Menus
},
{
[PlayerList(Row 0 Column 1)] \- Title
\- 1 of 4
\- PlayerWindow
}
{Chat Window: Embedded;Hidden}
{Character Select: Embedded;Hidden}

⑱ Lobby Game Mode (控制局部流程?PC控制具体)

|- LaunchTheGame
\\ CanWeStart?

⑲ UMG Connected Player
Var: PlayersInfo[Array] (Editable;Expose on Spawn; Replication: replicated)

⑳ Lobby Menu UMG

Δ Graph

|- Event Construct
\— Get Owning Player -> Cast to LobbyPC -> Lobby Controller Ref
\— is server -> Change text -> Game Setting remove
\— Lobby Controller Ref -> Player Settings =>set Members in PlayerInfo(Status: Host)

|- onClicked Leave Lobby
|- onClicked Clear Playlist
\— Clear Children
|- Update Player Window
\— Create Connected Player Widget
\— Add Child
|- onClicked ReadyStart
\— is Server -> Get Game Mode -> cast to LobbyGame Mode-> get AllPlayerControllers[PlayerController|Array|Replicated] -> ForEachLoop -> CastTo lobbyPC -> Show Loading Screen
\— \—- Completed -> launch the game
\— is Client -> call UpdateStatus

 

|- UpdateStatus
\— Flip/Flop -> seg ReadyStatus?
\— Get Owning player -> Player Settings-> set members in player info (ReadyStatus?)
\— Call Update From Lobby PC

 

|- OnClicked Set Game Settings ->Set Visible
\— Call Fill Player Windows

 

|- OnClicked Choose Character -> Set Visible -> Set User Focus

㉑ UMG GameSettings

Δ Graph

Event
|- Fill Players Window

㉒ Bind (Server name, map name, map time) in UMG

㉓ Lobby Player Controller

|-UpdateAvailableCharacters
\\\\ Run on owning Client
\\\\ Reliable

var: availableCharacter[Boolean|array]

㉔ LobbyGM

Event
|- On Post Login!!!!!
\— Switch Has Authority
\— \—- Authority(Server):
\— \—- \—- Add to Player Controller
\— \—- \—- Get All Actor of Class(Spawn Point, Player Start) -> Promote to Spawn Point(Replicated)
\— \—- \—- Get Game Instance -> Cast to -> get Server Name -> get Max Players -> Set ->Set
\— \—- \—- Cast to LobbyPC ->Initial Setup-> Setup Lobby Name -> Update Lobby Settings(Promote to GM Map Image, GM Map Name/Time; Replicated )
\— \—- \—- Respawn Player
\— \—- Remote(Client):

 

|- Respawn Player (Player Controller)
\\\\ Run on Server
\\\\ Reliable
\— get Controlled Pawn ->isValid -> DestroyActor() => False:
\— Spawn Actor from Class(BaseCharacter, SpawnPoint->Get Random in Range-> Get Actor Transform)
\— possess(Target=Player Controller from Respawn Player,InPawn = return value from spawn actor)
\— Everyone Update(Tell every one update)

 

|- EveryoneUpdate
\\\\ on Server
\— All Players-> get length =>current players -> Branch currentPlayersNumber>0? (Clear Connected player-> ForeachLoop(in All playerController)->Cast to Lobby PC-> Add to Connected Player -> Update Number of Players ) : ();
\— Completed->ForEachLoop -> Add PlayerInfo -> Update Available Character ->Add to Kick List
\— ForEachLoopWithBreak -> Break PlayerInfo -> if there is 0_Base => set CanWeStart? False -> Break
\— \— Else canWeStart? True

|- AddToKickList

|- ServerUpdateGameSettings ([Texture 2D],Map Name[Text],MapTime[Text],MapID[Integer])
\\\\ Run on Server
\\\\ Reliable
\—- Set GM MapImage/Name/Time/ID
\—- All Player Controller -> ForEachLoop -> Cast to Lobby PC-> Update Lobby Settings

 

|- Launch The Game
\— MapID -> Switch on Int
\—0: Execute Console Command [servertravel /Game/Maps/Arena01] \—1: Execute Console Command [servertravel /Game/Maps/Arena02]

Class Defaults: Use Seamless Travel Enabled : Only work in standalone

㉕ Lobby PC

Functions
|- Save Game Check
\— Does Saved Game Exists (Player setting save)
\— If so, Load Game -> Save Game
\— If not, Save Game

|- Save Game
\— If SaveGameRef Is Valid
\— not-> Create Save Game Object -> cast to PlayerSave Game-> promote to SaveGameRef
\— yes-> SaveGameRef -> set S player Info(come from player settings)
\— Save Game to Slot(Ref, PlayerSettingSave)

|- Load Game
\— Load Game from Slot (Slot Name)
\— cast to player save game
\— get S Player Info
\— Break S Player Info apart
\—\—- Set S_Player Info

㉖ UMG Connected Players UI

Horizontal Box

Construct->Set Text->Binding

㉗ Game Settings UMG

Δ Graph

Variable
|- Display Map [Texture 2D] (Replicated)
|- Display Time
Event
|- Construct
\— Set Default DisplayMap
\— Set Default DisplayTime

|- Accept
\— LobbyGM->Server Update Game Settings
\— Set visibility hidden

 

|- You Have Been Kicked(Player ID)
\— Get Player Controller -> LobbyPC
\— Kicked

Use Editable & Expose on Spawn to Construct and Pass Parameters
|- Event OnLogout(Exiting Controller)
\— AllPlayerControllers -> ForEachLoop -> find exiting controller -> Remove from list
\— Set Available Character
\— Remove Index from All Player Controllers/Connected Player
\— Everyone Update

|- Fill Players Window
\\\\Kick Management List

|- AddToKickList
\— Update 更新已经打开的Widget

㉘ UMG Character Select
All buttons

㉙ Lobby GM

|- Swap Character
\— Destroy
\— Respawn
\— Possess

Variable

Character Class

㉚ Lobby PC

|- Update Available Characters
\— Get Available Character
\— Get Lobby Menu WB -> if valid -> get Character Select -> get Character Button-> ForEach -> Set not enabled if character is not in available Character list

|- Assign Selected Character (Character ID,Character Image)
\\\\ Run on Server
\\\\ Reliable
\— Copy old one(Replicated)
\— Character Image
\— set selected Character
\— Call Character Check

 

|- Assign Player ([Character],[Character Image])
\\\\ Run on Owning Client
\\\\ Reliable
\— Set members in playInfo
\— Call SaveGame
\— Call Update(player setting)

Function
|- Character Check
\— Selected Character is 0? True: get game mode -> cast ->get available characters -> set previous character array element true
\— \—- False : if selected is not 0 -> set previous is false -> set selected not available in AvailableCharacter
\— Assign Player (get characters -> get selected character, Character Image)

㉛UMG Character Select Graph

All OnClicked -> Assign Selected Character(Character ID, CharacterImages->get id) -> Set hidden

㉜ Chat Setup

|- Update Chat Window (Sender[Text],Message[Text])
\\\\ Run on Owning Client
\\\\ Reliable
\— Format Text {sender}:{message} sss
\— Create Chat Text Widget (sss)
\— Add Child to Chat Log[ScrollBar] \— ChatLog->Scroll to End

 

|- OnTextCommitted
\— If Commit Method is Equal Enum On Enter
\— Get ChatMessage(Text)
\— Chat Entry SetTextBox “”

㉝ in Lobby PC

Event
|- GetChatMessage(TextToSend[Text])
\\\\ On Server
\\\\ Reliable
\— Promote to SenderText
\— PlayerSettings -> get Player Name -> Set as SenderName
\— get Game Mode -> Cast to Lobby GM -> Get All Player Controllers ->ForEach ->Element cast to Lobby PC -> Update Chat(sender, senderText)

【每个Client对于Player来说,都是Server,然后其他人都是Client】
|- Update Chat (Sender,Text)
\\\\ On Owning Client
\\\\ Reliable
\— Update ChatWindow (sender, text)

㉞ Lobby Menu UMG

Adjust Chat Window

㉟Loading UMG
㊱ChatWindow in GamePlay

㊲ GameplayGM

Var
|- All Player controller
\\\\ replicated

Event

|- Event onSwapPlayerController
\— Add to APCs

 

|- Respawn Player([controller],[character])
\\\\ on server
\\\\ reliable
\— get all actor -> spawn points
\— spawn from class \— possess cast -> Game PC
\— Destroy Session Caller

㊳GamePlay Player Controller

Event

|- BeginPlay
\— is local controller
\— true : remove all widget
\— \—- call load game
\— \—- call Pass CharacterInfo To Server

|- Pass CharacterInfo To Server (player settings)
\\\\ on server
\\\\ reliable
\—- set ps
\—- cast gm -> respawn
\—- call Setup chat window

|- Setup chat window
\\\\ on owning client
\\\\ reliable
\— create widget
\— add to viewport

 

|- GetChatMessage
\\\\ on Server
\\\\ reliable
\— set text/name
\— all player controller
\— update chat

|- Update chat
\\\\ on owning client
\\\\ reliable
\—- update chat window

|- T pressed
\— FlipFlop
\— Show cursor

 

Function
|-Load Game
\— Load from slot
\— cast to struct
\— set struct

㊴ Chat Window

Graph
|- cast to Gameplay GM

㊵ Error Dialog

create widget

—–

NETWORK ERR
TRAVEL ERR


Base mesh: none
Menu Text : Bind



① Replication? http://127.0.0.1:55555/latest/INT/Gameplay/Networking/Actors/Properties/index.html
② Clamp(int)
③ UMG Wrap With [Size Box] ④ UMG Wrap with [Widget Switcher] ⑤ Primitive Circular Throbber
⑥ Online Node的配置/latest/INT/Programming/Online/Steam/index.html
⑦ ⓪①②③④⑤⑥⑦⑧⑨⑩⑪⑫⑬⑭⑮⑯⑰⑱⑲⑳㉑㉒㉓㉔㉕㉖㉗㉘㉙㉚㉛㉜㉝㉞㉟㊱㊲㊳㊴㊵㊶㊷㊸㊹㊺㊻㊼㊽㊾㊿
⑧ The GameMode defines the game’s set of rules. The rules can include how players join the game, game pausing, and level transition, as well as any game-specific behavior such as win conditions. The GameMode is set for each level, and GameModes can be reused in multiple levels.
⑨ You can set a variable to Replicated which means the variable produces a one-to-one copy of the variable that is replicated from the Server to Clients. Or you can use the RepNotify which does everything that Replicated does, but also provides a Function that is called that executes on both the Server and Client machines whenever the variable it is attached to updates.
http://127.0.0.1:55555/latest/INT/Gameplay/HowTo/Networking/ReplicateVariable/Blueprints/index.html

⑩ Function Replication (Remote Procedure Calls or RPCs for short) are functions that are called locally, but executed remotely on another machine (separate from the machine performing the call). RPC functions can be very useful and allow either the Client or the Server to send messages to each other over a network connection. Replicated function calls can be set to either Reliable or Unreliable where Reliable calls are guaranteed to occur, while Unreliable calls may be dropped during heavy network traffic. Most Replicated Functions that handle cosmetic visuals are unreliable to avoid saturating the network.

http://127.0.0.1:55555/latest/INT/Gameplay/HowTo/Networking/ReplicateFunction/Blueprints/index.html

⑪ There are 3 primary types of Replicated Functions: Multicast, Run on Server, and Run on owning Client.

Multicast functions should be called on the Server, where they are executed, and then forwarded automatically to Clients.

Server functions are called by a Client and then only executed on the Server.

Client functions are called by the Server and then only execute on the owning Client.

⑫ Server and Client Replicated Functions have some restrictions, for one they can only be used on Actors that have a Net Owner.

Actors have Net Owners if they are a Player Controller or owned by a Player Controller. For example, a Pawn possessed by a Player Controller can have Server or Client Replicated Functions executed upon it.

⑬ The GameMode sets the rules for the game, like the rule that whichever player crosses the finish line first is the winner. It also handles spawning the players.

A player is set up in a PlayerController, which can possess a Pawn.

The Pawn is the physical representation of a player in the game, while the Controller possesses the Pawn and can set rules for its behavior.

⑮ Difference between Pawn and Character

In our example, there would be two Pawns, one for the snail and one for the rabbit. The rabbit would actually be a Character, a special subclass of Pawn which has built-in movement functionality including running and jumping. The snail, on the other hand, has a different style of movement, so it could extend directly from the Pawn class.

A PlayerController is the interface between the Pawn and the human player controlling it.

Controllers are non-physical Actors that can possess a Pawn (or Pawn-derived class like Character) to control its actions.

A PlayerController is used by human players to control Pawns, while an AIController implements the artificial intelligence for the Pawns they control.

Controllers take control of a Pawn with the Possess function, and give up control of the Pawn with the Unpossess function.

⑱ A HUD is a “heads-up display”, or the 2D on-screen display that is common in many games. Think health, ammo, gun reticle, etc. Each PlayerController typically has one of these.

⑲ Even the most open-ended game has an underpinning of rules, and these rules make up a Game Mode. On the most basic level, these rules include:

  • The number of players and spectators present, as well as the maximum number of players and spectators allowed.
  • How players enter the game, which can include rules for selecting spawn locations and other spawn/respawn behavior.
  • Whether or not the game can be paused, and how pausing the game is handled.
  • Transitions between levels, including whether or not the game should start in cinematic mode.

When rule-related events in the game happen and need to be tracked and shared with all players, that information is stored and synced through the Game State. This information includes:

  • How long the game has been running (including running time before the local player joined).
  • When each individual player joined the game, and the current state of that player.
  • The base class of the current Game Mode.
  • Whether or not the game has begun.

⑳ Framework Class Relationships

GameFramework.png

 

㉑ The Pawn class is the base class of all Actors that can be controlled by players or AI.

㉒ GameFlowChart

GameFlowChart

The HUD refers to the status and information overlaid on the screen during gameplay. The purpose of the HUD is to inform the player of the current state of the game, i.e. the score, their health, the amount of time remaining, etc.

The HUD is usually non-interactive, meaning the player does not click on elements of the HUD, though this becomes a gray area in certain types of games where the HUD and user interfaces are hard to separate.

User Interfaces refer to menus and other interactive elements. These elements are usually drawn overlaid on the screen much like the HUD, but in certain circumstances they could be part of the game world itself rendered onto a surface in the world.

The most obvious examples of UIs are the main menu displayed when the game starts up or the pause menu shown when the player has paused the game.

However, other UIs may be displayed during play. These could be used to show dialog between characters in the game or in more complex situations, such as in an RTS or RPG, they may be integral to the game play itself allowing the player to choose weapons, armor, units to build, etc.

㉔ Slate is a completely custom and platform agnostic user interface framework that is designed to make building the user interfaces for tools and applications, such as Unreal Editor, or in-game user interfaces fun and efficient. It combines a declarative syntax with the ability to easily design, layout, and style components that allows for easily creating and iterating on UIs.

㉕ Unreal Motion Graphics UI Designer (UMG) is a visual UI authoring tool which can be used to create UI elements such as in-game HUDs, menus or other interface related graphics you wish to present to your users.

At the core of UMG are Widgets, which are a series of pre-made functions that can be used to construct your interface (things like buttons, checkboxes, sliders, progress bars, etc.).

㉖ RayCasts(Trace: /Gameplay/HowTo/UseRaycasts/index.html)

There may be instances in your game where you want to determine if the player character is looking at something, and if so, alter the game state in some way (for example, highlight something when a player looks at it). Or maybe you want to determine if an enemy can see the player character, and if so, start shooting or engaging them in some way.

You can accomplish both scenarios by using Raycasts (or Tracing) to “shoot” out an invisible ray which will detect geometry between two points and if geometry is hit, return what was hit so that you may then do something with it.

㉗ Force Feedback (sometimes referred to as rumble or haptic feedback) refers to the vibrating of a device or controller used in games to convey a force occuring in the game to the player. A simple example is when an explosion occurs in the game and force feedback is used to simulate the shockwave, which gives an additional dimension to the immersion.

㉘ GameMode和Player Controller 分管
GM:控制所有的player,Match相关、Respawn相关、切换、能否开始
PC: 角色选择、Chat相关、Save/Load,对widget总体的控制
Instance: 控制Session、Network

具体调用分散在onClicked所在的Blueprint
㉙ Destroy pawn before ReSpawn
㉚ Detect if isValid before CREATE Widget!!!!Valid->Remove ->create; Not valid -> create!
㉛ Steam的Name、Friends需要正式ID,而且不能从Blueprint获得

Published inDiaryUnrealEngine

Be First to Comment

Leave a Reply

Your email address will not be published. Required fields are marked *

http://next.sh/wp-content/smilies/icon_confused.gif 
http://next.sh/wp-content/smilies/icon_cool.gif 
http://next.sh/wp-content/smilies/icon_cry.gif 
http://next.sh/wp-content/smilies/icon_eek.gif 
http://next.sh/wp-content/smilies/icon_evil.gif 
http://next.sh/wp-content/smilies/icon_exclaim.gif 
http://next.sh/wp-content/smilies/icon_idea.gif 
http://next.sh/wp-content/smilies/icon_mad.gif 
http://next.sh/wp-content/smilies/icon_mrgreen.gif 
http://next.sh/wp-content/smilies/icon_neutral.gif 
http://next.sh/wp-content/smilies/icon_question.gif 
http://next.sh/wp-content/smilies/icon_razz.gif 
http://next.sh/wp-content/smilies/icon_redface.gif 
http://next.sh/wp-content/smilies/icon_rolleyes.gif 
http://next.sh/wp-content/smilies/icon_sad.gif 
http://next.sh/wp-content/smilies/icon_smile.gif 
http://next.sh/wp-content/smilies/icon_arrow.gif 
http://next.sh/wp-content/smilies/icon_biggrin.gif 
http://next.sh/wp-content/smilies/icon_surprised.gif 
http://next.sh/wp-content/smilies/icon_twisted.gif 
http://next.sh/wp-content/smilies/10.gif 
http://next.sh/wp-content/smilies/102.gif 
http://next.sh/wp-content/smilies/103.gif 
http://next.sh/wp-content/smilies/106.gif 
http://next.sh/wp-content/smilies/108.gif 
http://next.sh/wp-content/smilies/20.gif 
http://next.sh/wp-content/smilies/26.gif 
http://next.sh/wp-content/smilies/37.gif 
http://next.sh/wp-content/smilies/99.gif