Resolved Client cant receive ClientServer's reliable udp message.

Users who are viewing this thread

Version number
e1.6.0
Branch
Main
Modded/unmodded
Modded
Summary: Client cant receive ClientServer's reliable UDP message.
How to Reproduce:
Hi...I am from China
I find the file E:\Mount & Blade II Bannerlord\Modules\Native\GUI\Prefabs\Multiplayer\Lobby\CustomServer
there is a xml named Lobby.CustomServer.HostGame.
So i think it is possible to Open a CustomGame for our ChineseCommunity.

There Comes My First Question!
I try to build a button on UI and link the Official's Function LobbyClient.RegisterCustomGame(string gameModule, string gameType, string serverName, int maxPlayerCount, string map, string gamePassword, string adminPassword, int port)
I tried any possible value I thought would work for these parameters, but I always get no response from the OfficialHost
Question 1 : I want to know why I failed to RegisterCustomGame?

Then Comes My Second Question!
I can't RegisterCustomGame and show my server on CustomServerList to other players , so I try to HostGame on Local.
I write a mod named Server into E:\Mount & Blade II Bannerlord\Modules On ComputerA
ServerMod Abusolutly Imitating the official's HostGame Logic:
from ILobbyClientSessionHandler.OnRegisterCustomGameServerResponse()
to BaseNetworkComponent.HandleClientEventFinishedLoading(NetworkCommunicator networkPeer, FinishedLoading message)
The GameType is "TeamDeathmatch" and Map is "mp_duel_001".
The Official's Logic is Very Clear and Everything work's fine On Server , I successfully get into Mission through MultiplayerMissions.OpenTeamDeathmatchMission("mp_duel_001")
My Server ip is "192.168.1.222" and port is "9999"
And build my MissionPeer zaythclsj with Index 0.
And wait for Client Communicator to join which sessionKey=1314 and index=1

Then I write C:\Mount & Blade II Bannerlord\Modules\Client On ComputerB to Join my game.
Client Input sessionKey=1314 , playerIndex=1 , address=192.168.1.222 and port=9999 (had build on my ServerSide).

Question comes, My ClientSide did not get in map "mp_duel_001" , the loading page does not show.

So I use the MultiplayerAdminComponent to write two Functions on ClientSide to find out why
One is :
retrun GameNetwork.NetworkPeerCount.ToString()
Two is :
GameNetwork.BeginModuleEventAsClient();
GameNetwork.WriteMessage(syncRelevantGameOptionsToServer);
GameNetwork.EndModuleEventAsClient();


I login MyLocalServer again and Run These Two Function:
Function One Return: 2 ,which means the udp is connected...
So I can run Function Two to send message to Server through udp.
After Function Two Done, I see SeverSide successfully get the Message syncRelevantGameOptionsToServer though MBDebug.

Theoretically, Client should get the messages from Server to Know which Map to load and which GameType to open. But MyClient receive Nothing....

Then I use the MultiplayerAdminComponent to write One Function On ServerSide:
GameNetwork.BeginBroadcastModuleEvent();
GameNetwork.WriteMessage(new PingReplication(networkCommunicator, num));
GameNetwork.EndBroadcastModuleEventUnreliable(GameNetwork.EventBroadcastFlags.None, null);


Then I find that Client Can Receive the Message : PingReplication
Deeply ,I find It is not PingReplication-Message-Self can send to Client From Server successfully , If I Change the 3rd code EndBroadcastModuleEventUnreliable To EndBroadcastModuleEvent , PingReplication-Message Don't Sent To Client Anymore...

Then I Change the EndBroadcastModuleEvent to EndBroadcastModuleEventUnreliable by setting it's second parameter to false.
So all the reliable way become Unreliable Way include BeginModuleEventAsServer and EndModuleEventAsServer

Question 2 : I want to know why only Unreliable takes effect?

Finally Comes My Third Question!
ServerSide Send Unreliable Message.Then My Client Can Successfully Get into The Server.There is my Debug info:
Starting to read message: TaleWorlds.MountAndBlade.Network.Messages.CreatePlayer
Starting to read message: NetworkMessages.FromServer.MultiplayerOptionsInitial
Starting to read message: NetworkMessages.FromServer.MultiplayerOptionsImmediate
Starting to read message: NetworkMessages.FromServer.MultiplayerIntermissionVoteUpdate
Starting to read message: NetworkMessages.FromServer.InitializeCustomGameMessage
Client: I have received InitializeCustomGameMessage with mission TeamDeathmatch mp_duel_001. Loading it...
Client: I finished loading. Sending confirmation to server.
Starting to read message: NetworkMessages.FromServer.AddPeerComponent
Starting to read message: NetworkMessages.FromServer.InitializeLobbyPeer
Starting to read message: NetworkMessages.FromServer.ExistingObjectsBegin
Starting to read message: NetworkMessages.FromServer.SynchronizeMissionTimeTracker
Starting to read message: NetworkMessages.FromServer.AddTeam Add team with side: None
Starting to read message: NetworkMessages.FromServer.AddTeam Add team with side: Attacker
Starting to read message: NetworkMessages.FromServer.AddTeam Add team with side: Defender
Starting to read message: NetworkMessages.FromServer.TeamSetIsEnemyOf Mission Team: 1 is now enemy of Mission Team: 2
Starting to read message: NetworkMessages.FromServer.SynchronizeMissionObject
....
Starting to read message: NetworkMessages.FromServer.SyncPerk
....
Starting to read message: NetworkMessages.FromServer.UpdateSelectedTroopIndex
Starting to read message: NetworkMessages.FromServer.ExistingObjectsEnd
Starting to read message: NetworkMessages.FromServer.MissionStateChange Mission State has changed to: Playing

Starting to read message: NetworkMessages.FromServer.SynchronizingDone

After above prepared(exactly same when i join official server ), MyClient Side Can Choose Team and Build Agent.

Question comes again , The Agent can only Do bellow things:
1.Move Position By Keyboard WASD
2.Look Direction By Mouse Moving
3.Jump By Space
4.Kick By E
5.Crouch By Z
6.MountAndDisMount By F
7.DropAndPick By G
8.Wield/Hide Weapon Without Animation By Middle Mouse

When I do 1-8 things on client , server side show the same event.

Seems Fine but I when I click Left Mouse to Attack,
Only the animation act_ready_ progress can display on Client Side.
But on Server Side , act_release_ progress can display normally.

If my Client Agent stand front at my Server Agent , click Left Mouse and Release ,ClientSide will pause on the animation act_ready_, but ServerSide will play the act_release_ and Server Agent will be hit by Client Agent .
If my Server Agent stand front at my Client Agent , click Left Mouse and Release ,ServerSide will play the act_ready_ to act_release_ normally, but ClientSide did not play anything.

Deeply, Any Server Agent's action did not send to Client. Also Any Client's Action sent to Server but Server did not send it back to Client....ClientSide is just like play SingleMode, can not see any Agent move or lookdirection changed ...

I also find that ClientSide can See agent bleed, Hear arrows pass by...There are all defined in NetworkMessages, which I changed into unreliable way in TaleWorlds.MountAndBlade.dll...

These 1-8 action or Left Mouse/Right Mouse action can not use MBDebug to debug....I can't see any of these action in NetworkMessages.FromServer or NetworkMessages.FromClient .

I think maybe these Keyboard&Mouse Action are still sending by reliable udp which ClientSide can't receive ...maybe it in TaleWorlds.Native.dll???

Question 3 : I want to know how to solve this Keyboard&Mouse can't sync problem ?


I am really love this game and play it since 14 years ago....
Our Chinese guys also a huge number of this game and we are thirsty for multipaly type(China don't has server in OfficialServerList, So we can only play Single mode )...I hope someone can help me solve this problem....So we can contribute to our share for development of Mount&Blade LB...We can collection a lot of debugs and speed up the MutiplayerMode's development .
You may under the reference to the game PUBG, it become the Most Popular Steam Game with peak palyers 3.2 millions because of Our Chinese spending the Spring Festival , januaray 2018 .
Hope you can help me develop our chinese community server....

Question 4 : Could official provide me the way to decode TaleWorlds.Native.dll or send me the DedecateServer.dll or anything could work to build the server to keep my developing? We really want to contribute to the game ...

Scene Name (if related):--
Media (Screenshots & Video):--
Computer Specs:
OS: win10
GPU:i7-7700
GPU Driver Version:--
CPU:gtx1060
RAM:16g
Motherboard:--
Storage Device (HDD/SSD):ssd
 
They won't publish server files until the release according to their latest statements.
you would need
TaleWorlds.MountAndBlade.DedicatedServer.dll
TaleWorlds.MountAndBlade.DedicatedCustomServer.dll
and their dependencies etc..
 
Back
Top Bottom