Learning Fluid Dynamics in a online multiplayer immersive 3D/VR learning environment

I want to build a Virtual World in Unreal Engine,  with the purpose of educating Fluid Dynamics.  Still, a lot of work has to be done.

Update 1 September 2020.

Update 7 june 2020.
Version 0.01. Simple prototype dedicated server and clients running om a server at Avans University. Looks a bit weird, but this is a milestone for me.

v0.01

Update June 2020
Starting for the third time. read my thoughts.

Update 2019 First video on the project

Update June 2018
Followed several online courses on using blueprints in Unreal Engine.
See https://unreal.fluiddynamics.eu/main-water-system-in-unreal/

First video will follow soon?

Update October 2017. After a long time following courses on how to build in Unreal Engine, I finally have started with building blueprints. Busy building a watersystem

Update may 2017. I have reactivated the project. Was too busy with ordinary work :-). I am following a course on Udemy (Unreal Engine 4: How to Develop Your First Two Games) to get my skills on a higher level.

Share Button

Part 3 Replicating functions

https://docs.unrealengine.com/en-US/Gameplay/HowTo/Networking/ReplicateFunction/Blueprints/index.html

Note: In the documentation the blueprints are changed with the different step. I am building new versions each time:

Space bar = MulticastSpawn
p = Run on Server

Note: In this example the blueprints ar build in the character. The character lives both on the server and the client. So that is why, a function can by activated on the server by an action on the client.

Step 1 Multicast (Spacebar)

The multicast only spawns to the clients if it is activated on the server.
So on a dedicated server how to activate this function?

Stap 12

Step 2 Run on Server (key p)

Works on the Dedicated Server (local)

Activate fire on client and show on al clients

Stap 3 Run On Owning Client (key o to print inventory)

WrapUp Part 3 video

I understand why the Item Added and Item Removed string is not printed on the client. This because the Triggerbox only activates the server (Authorrity) which activates Remove and / or Add Item.

Share Button

Part 2 Actor replication

According to https://docs.unrealengine.com/en-US/Gameplay/Networking/Actors/index.html

Step 1 Replicating Actors in Blueprints

I have added the startercontent to the project.

After the first part I started the dedicated server (local) and of course the not replicated fire is not showing. This because the dedicated server has no graphical interface.

But if I set the Net load on Client as checked in the Fire_NoReplicate, it will also be visible on the client! So at this point I don’t see the difference 🙂

Second part of the instructions Dynamically Spawning Replicated Actors

If we look at step 14. If I run it on the dedicated server. With a dedicated server, the No replicate part is no use, because the server has no grapical interface?

Client in dedicated server


If we look at step 4. Bought fires show up on the client

Client with dedicated server

Step 2 Replicating Variables in Blueprints

https://docs.unrealengine.com/en-US/Gameplay/HowTo/Networking/ReplicateVariable/Blueprints/index.html

Instead of fire I used the Spark_Effect

I set the countdown variable to 100

Result after step 25 I got a problem. If a run the simulated server (2 clients) in the editor, no problem. But after packaging and starting the local server, this appears, over and over. I can start the client but stil this is wrong.

Warning in server log

So it looks like the progam is try to read the value of Textrender, while it has no value yet or is not create yet? If I don’t use event tick, there is now problem.

Warnings Tick on Dedicated Server

Turns out to be a typical Dedicates Server error. Problem is that the dedicated server does not have a graphical interface!!!! So it can’t deal with the textrender, there is no textrender on the server!!!!

RepNotify

Warp up and some solution to the problem 🙂 Stil not solved completely

Wrap Up part 2

Problem solved

After the counter is back to 0, the timer still keeps on running because it is set on looping! De timer is only running on the server. So the timer should be cleared!
This is done in the On Rep Deactivate.

Clear Timer in On Rep Deactivate

Share Button

Part 2 Basic Menu, some C++ and settings

We continue with the project from Part 1

Step 1

Share Button

Part 1 Building the basic model

Most of what I am doing is also explained here:-):

Step 1 Building from source
Build UE 4.25.3. from source I used Visual Studio 2019!!
Make a C++ ThirdPersonProject

Step 2 Build the basic model according to https://docs.unrealengine.com/en-US/Gameplay/Networking/HowTo/DedicatedServers/index.html

Note: In the article the Map from ThirdPersonCPP was moved to content. That did not work with me (got problems with packaging),

Step 3 To prevent to game to start fullscreen I added the next Blueprint to the Level Blueprint of the ThirdPersonExampleMap.

Smaller screen size

Step 4 Added a local Level with my server address

Connect to my server
Showcase dedicated server

Share Button

Breakdown : FD_PlayerInfo

PlayerName and PlayerImage are imported from Steam in FD_MainMenuPC

Video use for analysing problems https://vimeo.com/476355670/529aca5858

Event Debug FDPlayerInfo prints information to screen

Location of the debugfunktions used

FD_LobbyGM EveryoneUpdate

FD_Lobby Event BeginPlay

As Host:

0:15 Default setting as Barbarous.

When the others make first contact. FD_LobbyPC Event BeginPlay is called several times on the server. Time 0:39
This because a PlayerController lives on the server and the client?

1:17 Host changes character to Natural . EveryoneUpdates runs with only info of the host. Server FD_LobbyGM knows that other are connected, but they have not selected a character yet. Natural is greyed out at al clients!

After each client selects a character it is grayed out, EveryoneUpdate loop runs on FD_LobbyGM on server, PlayerImage of clients is missing

1:42 Host select Barbarous. Players are displayed. PlayerImage is missing for clients.

2:41 When ready or not ready is clicked the loop runs again on the server

Second run

Clients started to select a character, while the character selection is not open on the server / host. One client appears without CharacterImage and name. Start Session is grayed out!! 6:15 After the client without characterimage and name quits, start session works again.

After rejoing, the start session is still grayed out. 8:42 . 8 players where allowed to join. If one of the clients changes character, it is ok again

As Client

21:39 althoug the client knows it PlayerImage, it does no show up.

Share Button

Breakdown : Framework

Based on Compendium Cedric Neukirchen

Example of Dedicated Server with 2 clients

From Reuben Wards course

  • Game Instance :
    Game instance created when game starts and lasts until that game executable closes, persisting across level changes and joining sessions etc.
    Game instance is only aware of its own executable. Does not have any connection between server and clients. Lives only on the client (is this correct?, also the server is an .exe)

In steam multiplayer of FD_Online:

BP_FD_OnlineGameInstance (Parent class = FD_OnlineGameInstance in C++)

  • Event Show Main Menu (Interface)
  • Event Show Host Menu (Interface)
  • Event Show Server Menu (Interface)
  • Event Show Options Menu (Interface)
  • Event Show Loading Screen (Interface)
  • Event Launch Lobby (Create Advanced Session and open FD_Lobby, as listen) (Interface) Setup Host as listen server
  • Event Join Server (Interface)
  • Event Save Player Info (Interface)
  • Event Main Menu Player Info (Interface)
  • Event Update Friends List (Interface)
  • Event NetworkError
  • Event TravelError
  • Event Destroy Session Caller (Interface)
  • Event Store Character Seleceted (Interface)

Several Gamemodes and PlayerControllers

Game and Server Default Map is FD_MainMenuMap . In level BP : Event BeginPlay sets resolution and starts Show Main Menu

FD_MainMenuGM has no content, is only used the get the FD_MainMenuPC activated

FD_MainMenuPC

  • Event BeginPlay
    Gets playername and image from Steam and also the friends

Map FD_Lobby has no Level BP. Starts FD_LobbyGM

FD_LobbyGM :

  • PlayerKicked
  • AddToKickList
  • Event OnLogout
  • StartLoadingScreen
  • LaunchGame (Actual start of the selected level)
  • ChangeCharacter

FD_LobbyPC:

  • InitialSetup (only on client)
  • LoadPlayerInfo
  • SavePlayerInfo
  • CallUpdate (only on server)
  • SetupLobbyMenu (only on client)
  • AddPlayerInfo (only on client)
  • UpdateLobbySettings (only on client)
  • ShowLoadingScreen (only on client)
  • UpdateNumberOfPlayers (only on client)
  • EventEndPlay
  • Kicked (only on client)
  • AddPlayerToKickWindow (only on client)
  • UpdateAvailableCharacters (only on client)
  • AssignSelectedCharacter (only on server)
  • AssignPlayer (only on server)
  • GetChatMessage (only on server)
  • UpdateChat (only on client)

Gamemaps like FD_World and FD_Prototype uses BP_FD_OnlineGM

At this moment BP_FD_OnlineGameStateBase and BP_FD_OnlinePlayerState are not used.

BP_FB_OnlineGM :

  • EventOnSwapPlayerControllers
  • SpawnPlayer
  • EventOnLogout
  • UpdateChat

BP_FD_OnlinePC :

  • EventBeginPlay
  • PassCharacterInfoToServer (only on server)
  • SetupUI (only client)
  • GetChatMessage (only on server)
  • UpdateChatWindow (only on client)
  • InputActionChat

Share Button

Breakdown : FD_ConnectedPlayer

In next serie we start at the end, the menu showing Player Info. Then we follow “upwards” to the higher “levels”

FD_ConnectedPlayer Menu

Adds Info from PlayersInfo : Instance editable

FD_ConnectedPlayer is called in FD_LobbyMenu : Event UpdatePlayerWindow

UpdatePlayerWindow is called in FD_LobbyPC event AddPLayerInfo
Event runs only on client.

AddPlayerInfo is called in FD_LobbyGM Event EveryoneUpdate

EveryoneUpdate is called in
FD_LobbyGM event Onlogout
FD_LobbyPC event CallUpdate (Runs only on Server)

CallUpdate is called in
FD_LobbyMenu event UpdateStatus (changes the Ready Status)
FD_LobbyPC event AssignPlayer (runs only on client)

Only PlayerCharacter and CharacterImage are added, not the PlayerName

AssignPlayer is called in FD_LobbyPC event AssignSelectedCharacter (runs only on server)

Only PlayerCharacter and CharacterImage are added, not the PlayerName

Assign Selected Character is called in FD_CharacterSelection Menu
This is the start of selecting the avatar of the character

Only PlayerCharacter and CharacterImage are added, not the PlayerName

Share Button

Update June 2020

One could think that I haven’t been active lately. But that is not the case!. I have been very active, and had a lot of “challenges”

Actualy I am starting the project for the third time 🙁

First Time
I started to build in Unreal Engine using only Blueprints. I ran into problems with the hydraulic calculations. I also read that the best approach is to start with a basis in C++

Second Time
I started to learn C++. I followed several courses at Udemy, Linda.com, and Unreal.
My prototype multiplayer is based on the listen server in Unreal. My idea was that it would be no problem to convert to a dedicated server. This was a mistake. Turns out that a dedicated server is completely different compared to a listen server. There is also little documentation on getting a dedicated server running on a VPS.

Third Time
My new approach is to start with getting the standard third-person game running on a VPS. Based on a dedicated server and clients. And I started to use perforce as source control. And I skipped the idea of using a Linux VPS, it is all to complicated.
I managed to get the “simple” project running as a server and client on a windows server.
So my strategy now is to add on the simple project, and test everytime that it is working as a server and client. Bt using perforce I will be able to always return to a working solution


Share Button

Source Controle

I am using perforce

Unreal documentation : https://docs.unrealengine.com/en-US/Engine/Basics/SourceControl/InEditor/index.html

https://allarsblog.com/2017/04/05/populating-perforce-with-an-unreal-engine-source-build/

Streaming starts at 1:27 h

from 23 min

Share Button