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 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), I had to copy the map

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

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

M_FD_Surfacewater

Material for the surface water on the island

Uses Absolute World Position Node.

How to get the flow direction according to the direction of the channel?

General notes

  • With vertex color, you can control 4 values (red, green, blue, alpha)
  • red = speed x
  • green = speed y
  • blue =?
  • alpha =?
  • I don’t get this working yet
Share Button

Water material

Ocean

Surface water

I looked into different tutorials. In this page step for step my water material.

Notes:

Result:

Tiling will be adjusted so that the “basic” block is 1 * 1 m. Each Branch in the FD_watersystem will have its own instance of the watermaterial. In BP I can set the parameters for each branch.

  • S Scalervector
  • Append x and y

Future optimisations

  • Small wave/ ripples by wind. So direction is based on wind.
  • Swimmable water?
  • Particles
  • vertex painting
In my case it is mirrored
Share Button

Replication

To get a multiplayer working properly replication is important. Until now I have no knowledge on replication?

Aim is to use blueprints

https://wiki.unrealengine.com/Replication

Share Button