Come Learn Blueprint Multiplayer with me! (aka 's a Glutton for Punishment)

, good work. I like the combined force vector idea. I was wondering if you were getting any actual movement? I ask because as far as I know, the Authority (Server-side) Pawn won’t be receiving input (Well, maybe it would on a listen server?). As far as I could figure, that only happens with client-side Pawns. So when you use the Authority switch to guard your inputs, you are effectively stopping them from happening. This is also why I don’t bother putting the Authority guard on my inputs.

Second, and something that’s less important but might be of concern: Rep-Notify events only happen AFTER the frame has finished, whereas RPC calls are called immediately. For input, this can have an effect on latency, however I’d assume that ping and network latency would have a far greater effect. This can also cause some issues with things that happen very quickly (Less than a frame), as only the value at the end of the frame is considered, and if it hasn’t changed since the previous frame, the rep-notify won’t fire as the variable won’t have changed.

[Quote]

Yes, as you said once I try to do dedicated server, everything broken. LOL
I haven’t fully fixed it yet, but your info on RepNotify/RPC is very helpful for me to fix my input events.
Currently I’m working on to get network traffic to only replicate function call that apply force or torque, and multicast so all three side would run it.
But somehow it doesn’t seems to work, I need to study your graph more carefully.

I thought so, and I bet on a Listen server, it only worked for Player 1.
From what I can tell, in your case you’d just want to move the player locally and let the Replicate Movement checkbox do its magic. This would update to the clients and the server alike. I’m thinking that you’re just overcomplicating it :smiley: (Pot calling the kettle black!) I’ll give it a try tonight if I can and report back.

YEEEEEES!!! Mix bag your RPC call and some tweak on my own(and referencing the UFO on input example content) it’s super smooth just relying on the replicated movement. I’m excited!! HAHA!!!
It’s so simple that I couldn’t believe it.(after going through that many set/get/replicate/repNotify/etc.)
I’ll organize my graph a bit and post a update later. It’s so simple I felt like I am an idiot trying to roll my own movement.
(The fact that if you really want to roll your own movement, you’d have to hook up physics side yourself, which defeats our purpose for getting a MP_BP_Pawn ready to go without coding. )

How do you create a physics material, to setup things like friction/bounciness/mass scale/etc.
Right click on empty space in asset browser.


Actual Pawn component setup. Root component is a static mesh, and here is the physics attributes.
This only shows up after you add a staticmesh component and select it.
Note that I set damping attributes to 1 so my pawn stops pretty quick after I release the input,
you can adjust those base on how fast you want your momentum to continue working.


Pawn replication defaults setup.


How to create a custom event (NOT EventDispatcher)
Right click on empty blueprint space without dragging any pin.


After create custom event, make sure you do this like did. Input rpc run from owning client and replicate to server.
EDIT: do NOT check “reliable” checkbox, it was my early mistake when learning, so most of the time you don’t need this on.
please refer to this article for when you should use reliable RPC call.

Everything you ever wanted to know about replication (but were afraid to ask) - Unreal Wiki


Here is my modified torque input handling.


Here is my modified force input handling


And here is the actual update that happens on server.
Note that forceScale I have is 10,000 and torqueScale is 50,000.
You can have other values, but if you didn’t have a multiplier, it will be really slow to see any update.
Edit: it would be better to have a maximum check on the input vectors as well to prevent “speed” cheating.
Where you can just get the vector length and make sure it’s not larger than a certain magnitude.


Big thanks to and Epic. :smiley:
Now moving onto volume spawning!

Yeah, buddy! Congratulations! :smiley:
Feel the power of Blueprints! Well done, Epic. i’m sure exposing the networking to Blueprints was no simple feat, but it’s certainly worth it. I never would have considered making an MP game before, now I’m well on my way! :smiley:

and PenguinTD. Awesomeness!!!

Would you be kind enough to share the scene files?

Cheers

I’ve been including my source files with each update (But they get lost n the big update with all the pictures!), here’s the latest:
SOURCE FILES:
And, here’s the project files as of the recording of this video:
Download HERE

I need to prep a bit to upload, since there are some other work in progress garbage in my project.(also the UFO static mesh).
Will do that today for sure. :smiley:

Here is the files, enjoy!

Thanks a lot. I love the minimalist approach taken here. Instead of starting of with a large project folder 600mb++ sticking to barebones.
It will pay off not only for learning thoroughly but also when packaging. I tried to package for Android a test project started of of a third person BPTemplate and the scene had only a few Builder brushes and some small static geo.
But the exported (packaging took many hours it cooked all the engine shaders) file was over 2 gigs for some reason.

I am going to try and publish these and test them on my iPad and Android phone see if I succeed…

Seems like we have the network and movement in place. It should be able to export and install on iPads and Androids right?
And another think I wonder. What would be the best way to make the game to connect to a given IP? In UDK I was able to create a console node in Kismet and tell it to open <IP>.

Is there a better way if one has a ststic IP to make the clients to connect to it by default?

I got a VERY barebones 3rd person action rpg shooter working with full networking capabilities, but my respawn is ******** up. For some reason my HUD detaches on respawn. Right now I’m handling the character destruction, new character spawning, and pawn possession on the server. Does anyone here have a fully bulletproof multiplayer respawn working?

I got volume spawn bp kinda of working already, so the next step would be respawning.
Also, if you see the diagram at the bottom of this link: https://docs.unrealengine.com/latest/INT/Programming/Gameplay/Framework/QuickReference/index.html
It tells you that HUD is contained within player controller, and gamemodes are suppose to handle respawning and let player controller to repossess newly spawned pawn.

I’m stuck with respawn as well. It seems many critical function not exposed to BP(ie. GameMode: RestartPlayer, PlayerController:ServerRestartPlayer).
I wonder how Haha71687 handles possession on the server? How do you know which player controller to possess?
Here is my question on AnswerHub, How to handle a multiplayer respawn in BP? - Multiplayer & Networking - Unreal Engine Forums

I can possess with camera snap back to Pawn on server side, but client side is totally ******.(can’t move at all.)
Here is the output log, it seems during the call to client restart, it gets None like begining of server setup.



//finished level loading
LogWorld: Bringing up level for play took: 0.001023
LogPlayerController:Warning: NULL GameState when trying to spawn spectator!
LogNet: Join request: /Engine/Maps/Entry?SplitscreenCount=1
LogNet: Join succeeded: 301
LogNet: Join request: /Engine/Maps/Entry?SplitscreenCount=1
LogNet: Join succeeded: 302
LogPlayerController:Warning: NULL GameState when trying to spawn spectator!
LogPlayerController:Warning: NULL GameState when trying to spawn spectator!
LogNet: TestPC_C_2 setplayer LocalPlayer_22     //Player Controller 1 assigned
LogPlayerController: ClientRestart_Implementation None
LogPlayerController:Warning: NULL GameState when trying to spawn spectator!
LogPlayerController:Warning: NULL GameState when trying to spawn spectator!
LogNet: TestPC_C_3 setplayer LocalPlayer_23    //Player Controller 2 assigned
LogPlayerController: ClientRestart_Implementation None    // don't know which one gets the client restart first.
LogPlayerController: ClientRetryClientRestart_Implementation ScratchPawn_C_2, AcknowledgedPawn: None   // one of the client gets a replicated Pawn, server not acknowledged yet
LogPlayerController: ClientRestart_Implementation ScratchPawn_C_2  // one client gets restart with this pawn
LogPlayerController: ClientRetryClientRestart_Implementation ScratchPawn_C_5, AcknowledgedPawn: None
LogPlayerController: ClientRestart_Implementation ScratchPawn_C_5
LogPlayerController: ServerAcknowledgePossession_Implementation ScratchPawn_C_0  //server side acknowledge this pawn is possessed(notice that name is different from above, _0 could be server side of _2
LogPlayerController: ServerAcknowledgePossession_Implementation ScratchPawn_C_1  // acknowledge another client possession
LogBlueprintUserMessages: PW Server call respawn   // server side Pawn called respawn event on destroyed
LogBlueprintUserMessages: GM respawn event  // my GameMode respawne event called(Run On Server )
LogBlueprintUserMessages: GM trying to spawn // running
LogBlueprintUserMessages: GM serverside possess // same line where server side begin the possess( camera snaps to newly spawn Pawn )
LogBlueprintUserMessages: GM call owning client possess // call a "Run on Owning client", to call client possess.
LogPlayerController: ClientRestart_Implementation None  //some how this is called on the server side playercontroller
LogBlueprintUserMessages: PC client possess // the event print on client side PlayerController 


Maybe I need to also print the names of used pawn and PC to help me understand this better.

here is more detailed log after I do more checks.

=========================================
LogWorld: Bringing up level for play took: 0.001028

// I don’t know what this following line means.
LogPlayerController:Warning: NULL GameState when trying to spawn spectator!
LogNet: Join request: /Engine/Maps/Entry?SplitscreenCount=1
LogBlueprintUserMessages: PM Server EventPossessed controller name:TestPC_C_0 my name is: ScratchPawn_C_0 // we can see the server side possess relation ship
LogNet: Join succeeded: 313
LogNet: Join request: /Engine/Maps/Entry?SplitscreenCount=1
LogBlueprintUserMessages: PM Server EventPossessed controller name:TestPC_C_1 my name is: ScratchPawn_C_1
LogNet: Join succeeded: 314

// note that there are no “Client EventPossessed” where I put in place just in case client side also invoked
// following are the same default Engine possess flow

LogPlayerController:Warning: NULL GameState when trying to spawn spectator!
LogPlayerController:Warning: NULL GameState when trying to spawn spectator!
LogNet: TestPC_C_2 setplayer LocalPlayer_28
LogPlayerController: ClientRestart_Implementation None
LogPlayerController:Warning: NULL GameState when trying to spawn spectator!
LogPlayerController:Warning: NULL GameState when trying to spawn spectator!
LogNet: TestPC_C_3 setplayer LocalPlayer_29
LogPlayerController: ClientRestart_Implementation None
LogPlayerController: ClientRetryClientRestart_Implementation ScratchPawn_C_2, AcknowledgedPawn: None
LogPlayerController: ClientRestart_Implementation ScratchPawn_C_2
LogPlayerController: ClientRetryClientRestart_Implementation ScratchPawn_C_5, AcknowledgedPawn: None
LogPlayerController: ClientRestart_Implementation ScratchPawn_C_5
LogPlayerController: ServerAcknowledgePossession_Implementation ScratchPawn_C_0
LogPlayerController: ServerAcknowledgePossession_Implementation ScratchPawn_C_1

// from here on one pawn died, Pawn side EventDestroyed invoked.
LogBlueprintUserMessages: PM Destroyed Server Name:ScratchPawn_C_0
LogBlueprintUserMessages: PW Destroyed Server call respawn

// note GM will only be on server
LogBlueprintUserMessages: GM respawn event
LogBlueprintUserMessages: GM respawnE controller name: TestPC_C_0
LogBlueprintUserMessages: GM respawnE Server: trying to spawn

//new pawn called C_6, again only server side EventPossessed invoked.
LogBlueprintUserMessages: GM respawnE: serverside spawned: ScratchPawn_C_6
LogBlueprintUserMessages: PM Server EventPossessed controller name:TestPC_C_0 my name is: ScratchPawn_C_6

// GameMode respawn custom event trying to get client to also possess by passing C_6 to client owning PlayerController RPC
LogBlueprintUserMessages: GM respawnE: call owning client possess

// note that engine side can’t get a valid Pawn name yet
LogPlayerController: ClientRestart_Implementation None

// client side PlayerController possess custom event got a invalid Pawn parameter.
LogBlueprintUserMessages: PC possessE: input Pawn not valid

// Pawn client side Destroyed event got called really late on both clients, probably low priority? Can’t call respawn since there is no GameMode on client.
LogBlueprintUserMessages: PM Destroyed client side got called?
LogBlueprintUserMessages: PM Destroyed Client Name:ScratchPawn_C_2
LogBlueprintUserMessages: PM Destroyed client side got called?
LogBlueprintUserMessages: PM Destroyed Client Name:ScratchPawn_C_4

Now, I seem to need a way to let client side PC also possess the new Pawn(C_6) got replicated in both clients(whose name will not be C_6 but they are linked).
Also note that this might not be a proper timeline since many events could probably happen not in order(ie Pawn EventDestroyed on server and client side).
But it seems to follow the BP event flow pretty closely.

https://drive.google.com/file/d/0Bwoy4ZeER8JjMnVFYU9PVHhtZ1E/edit?usp=sharing

Try it out. Works in networked multiplayer, accomplished entirely with Blueprint. Controls are WASD Q E M1 M2 Space

Do you mind sharing the Blueprint, scene files so we can open it in the editor? I am on a Mac here and Gameiteration1.exe is not very useful for learning what you have done…

Cheers

Sure thing, these are the 3 main blueprints. Everything else is the actual spells and abilities. https://drive.google.com/folderview?id=0Bwoy4ZeER8JjMGp3VS1VMFZ2czQ&usp=sharing

SUCCESS!!! Figured out how to properly respawn by sending requests from client to server and possess my Pawn.
I haven’t downloaded Haha71687’s file but for me I don’t have to do auto respawn upon destroyed, the entire respawn is base on a input event(or whatever client event you’d like to define).
I’ll post my cleaned up result later today, so excited, digging through source code did paid off, I’ll also offer explanation in my respawn post(in this thread) later. :smiley:
Tested on dedicated server with 2 clients situation and both clients can respawn properly(I bind to start button and enter for a respawn event).

Cheers~

I end up submitted a wiki page so it can be more visible to other people in need.
Here is the page the explained things in detail.

I also got my volume spawning working already, it’s time to expand from here to all other game mechanism that I wanted. :smiley: