Seeing it in the native code is very informative. For example, knowing that the GameType was responsible for executing the ChoosePlayerStart function helped me in my version of it. Seeing how all this is set up natively should help me make a better blueprint. I’m looking forward to getting back into UE4 in the next few days (darn that work and family, taking my UE4 time!) to try out a bunch of this new knowledge!
LOL, sorry, I did put warning message in bold.
The reason being trying to find out how to setup a working multiplayer blueprint kinda needs to read those native code a bit.
And since I already put sometime into finding relevant info, I also want to keep it in one place in this thread so in the future I can refer back to it.
I can already see myself rolling the controls pretty soon and hopefully can give you guys a movement replicated Pawn blueprint so people can happily do extend it.
The good thing about this is that 's project is the empty blueprint project, thus as of now it has no asset dependency except that arrowMesh.
So any blueprint derived from this project can be copied to other project and start to work, just need to replace arrow into something available with engine would do the job.
Movement replicated pawn you say PenguinTD? Such a thing would be most appreciated, thanks for having a go at it.
I’ll admit I too am somewhat illogically afraid of the sight of code, and I’m wondering if it would be difficult to “install” your altered replicated pawn, if you are successful in creating it?
Thanks again for your efforts
Important Framework diagram:
It is from this doc link
Also controller diagram:
https://docs.unrealengine.com/latest/images/Programming/Gameplay/Framework/Input/InputFlow.jpg
From this doc link, note it has example blueprint to address what’s “forward” in moving forward.
Just post it here for future reference.
It shouldn’t be, I think both and I are trying hard to avoid(to some extend) doing any native code and to achieve full multiplayer enabled pawn from default project.(Not from the altered template project where Epic already included additional Character/Pawn classes).
The goal I have in mind is to simply take this opportunity to learn the framework and understand what can I do with it, and where is the brick wall surrounding our happy blueprint world.
If anything serious we run into, we can always ask in answer hub and maybe Epic can do actual update that enables pure blueprint based multiplayer.
So, given that said, the install I have in mind would pretty much just copy the blueprint to your project’s game folder and it’s ready to use.
Where all the reference to assets(mesh, material) would be replaced with default Engine provided ones.
^ This
Helps you devise clever work arounds when things aren’t exposed to the Blueprinting system.
! I commend you on all the work you’ve done thus far. I’m very keen about getting every thing done in BluePrint as well. The path seems much more exciting to explore simply because I haven’t scripted this in-depth with a nodal base system. So this will truly be a beautiful thing to see unfold. I’ve downloaded what you’ve done so far and will be working myself to get all the basics done. I’ve been working hard on other solutions but MultiPlayer has been something I want to dive into as well. Thanks again for sharing!
We are working on some materials that should really help people get to grips with networking, BP and C++!
Fantastic thread to follow. Thanks to all of you involved co students for sharing the knowledge and for awesome work on UE4.
Rock ON!
Awesome thread, keep it going! I will contribute as much as I can.
I have played around with replication a fair amount on my local machine but have decided to move over to a real environment for development of replication (Internet), although I haven’t figured out how to make a server listen for another clients connection yet. Any ideas?
Congrats on finally taking the dive into Replication !
I knew you and replication had a future together!
See?
Now you are leading the pack!
This is awesome, thank you posting this. I’m having an issue with the blueprint. I’m trying to add the ChoosePlayerStart into my own game, but I can’t get a ReturnNode. I’m new at this and if anyone could point me into the right direction that would be wonderful. Thanks.
Never mind, I figured out. You have to click on the function within the graph and add an output, just in-case anyone else gets stuck on this.
Success!!
http://www.theartsnobs.com/wp-content/uploads/2013/07/303690-good_news_everyone1.jpg
First off: Thanks, everybody! I’m happy that this thread is getting people into thinking about the fine points of Blueprint multiplayer. I’m sorry for not updating sooner. I’ve been really busy and completely stumped. A bad combo. I was having a huge headache figuring out exactly what client, server, etc. was calling any given function and, more importantly, why.
Fortunately, Epic posted some AWESOME videos on Blueprint networking. If you haven’t seen them… SEE THEM NOW!
There’s a couple hours worth, but they REALLY clearly explain everything from replication to the various ways Blueprints can send and receive data from servers.
https://www.youtube.com/playlist?lis…t4chjhypxIO9ZB
Thank you Epic for providing such awesome learning resources. I’m blown away. The things people will be creating with UE4 will push gaming far and fast.
Now, for the good news:
I’ve got replicating, physics-based actors playing in multiplayer. Both with a dedicated server and a listen server. I haven’t tested outside of the editor, but that’s gonna happen tomorrow. I’m writing up a post now, but wanted to let y’all know that there’s been progress and that it’s GOOD.
Here’s a little preview:
And, here’s the project files for those that just can’t wait to take a look!:
DOWNLOAD HERE!
I’ll be back tomorrow with the full breakdown!
The videos were a revelation! I was starting to grasp the basic tenants of replication, but seeing them in a simple example was massively important. I’m impressed that even the advanced topics like relevancy were covered.
For those that haven’t seen them:
https://www.youtube.com/playlist?list=PLZlv_N0_O1gaG5BW72It4chjhypxIO9ZB
Yeah, buddy! your crazy, rainbow-hued replication inspired me! Thanks for the encouragement.
, you are awesome, and Epic is also awesome, see that tutorial series clears a lot things up.
**Edit:**I also have something half baked, which does not rely on DefaultPawn’s movement component and does not have to use the physics part of Pawn class.
Ideally, there should be a switch to do first person/third person, and a switch to use the physics(move by adding force to set velocity) or just purely roll your own movement(you would have to handle collision response.)
So far, I can do most of the movement part in later mode, with rotation left to tweak(heavily referencing how the Input example do to the UFO.)
And 's example for 6-DOF tutorial, but you know what, control is indeed a major part of the game, get the feel right needs a lot work.
Also, I think 's player start method can be improved, so you no longer have to rely on a tag( which potentially restrict how many player can spawn on a map, or when Pawn died you used up all respawn point.),
as I mentioned before, I intended to spawn in a volume, but I haven’t get to how to default spawn to a spectator pawn and then possess a player pawn with possibility to choose team. I’ll do that once the rotation part is done.
How to train your pawn to replicate!
Hello all. I’m back and I’ve got all kinds of stuff to share. I’ll be posting here, then once everybody’s had a chance to take a look and give it a go, I’ll publish a nice tutorial to the Wiki.
Thanks to all who contributed. I’m absolutely shocked how well this works and how much fun it is to play with a frend or two in a game you’ve greated, even if it’s absurdly simply liek this.
What’s been done
- The 6-DOF pawn I built HERE has been made to fully replicate. Physics and movement are handled completely on the server.
- A simple attack has been made (Blast Attack!) that uses a physics impulse to blast other pawns away from the player.
- Tested on LAN and it’s very fun :F
Letting the server do it all
One of the first big problems I was having is that when Physics Enabled was set to true on the Pawn, there was some really wacky behavior. What other clients would see and what the player would see were quite different. The player would rotate a little and stop, meanwhile, the other clients would watch as the player’s representation would continue to rotate as if pushed by physics. If the pawn were on the ground, it would even roll about. Meanwhile, the player’s view was totally still, until they moved, then each of the clients would correct for a moment before returning to their physics drift.
Thanks to the videos posted by Ben earlier this week, I was able to understand that what I was seeing was the server replicating physics and sending that data to the clients while the local player was seeing the result of their input only.
My solution was bold, but has fixed my issues and allowed me to quickly expand the functionality beyond my original goals!
How it’s done:
Server-Only Physics:
I turned off physics COMPLETELY on the local clients. That means that only the server would be doing those calculations. this little line of Blueprint has changed everything for this test:
http://i.imgur.com/nfiQJev.png
Sending input to the server to handle:
Now, I just had to make Custom events that replicated from the Client to the Server each time there was input from the player:
http://i.imgur.com/9f6lETI.png
And, then do the actions I wanted to the pawn on the server. Each of these custom actions is set to Run on Server and has the Reliable box checked. I figure that input should definitely be replicated reliably, and should be a very small packet to send as I’m only sending the input value:
http://i.imgur.com/vuZkzv6.png
Getting the data back from the server to the payer:
At this point, everything was working really well… At least on all the remote clients. My arrows were zipping all over! However, my local player wasn’t moving at all. I’m assuming that because player input generally isn’t handled remotely, the optimized Replicate movement propoerty of pawns doesn’t bother. So, I made my own!
After struggling with the jerky, un-smooth replication of position and rotation, I tried replicating the entire transform of my pawn pack to the player. Smooth as butter! I know that this is a very expensive operation, especially at high frame rates, but it’s pretty essential for the player to have smooth, fast input. I’ll experiment with reducing this workload, but for now this works:
http://i.imgur.com/tNDda2p.png
And, that’s it! That makes it all work! Seriously. Here’s the entire Pawn’s Event Graph (The fancy Blast Attack is there in green. I’ll cover that next)
http://i.imgur.com/MdeH50W.png
And, here’s video of it doing its thang (Sorry about the low frame rate, it runs MUCH faster and smoother locally)!
SOURCE FILES:
And, here’s the project files as of the recording of this video:
Download HERE
Take a look at my new post above. that should get you up to speed with the movement replication. Its still relies on the built-in replication to get the position and rotation to the other clients, but you’ll see how that all works, I think.
I’ve also been thinking about the player start issue. My system works fairly well for a racing game, where the player will always want to spawn in an ordered location and only ever once per match (unlike deathmatch for example.) I was thinking of doing a Get all Actors-> Pawn within a certain distance of each player start to see if they are valid, rather than relying on the tag system.
I kinda get the system down as well, albeit looks different from yours, I don’t know if it’s correct(edit: by correct I mean I merge input event flow that could have some sort of conflict, but all my control feels fine no interlocking at all, maybe or other Epic guys could tell us if this is a good/bad approach), but here is what I have for replicated movement.
EDIT: Please note that my control does not use any physics simulation at all, and will go through everything even if my pawn is set to block all. It is because I force update actor location without checking hit event.(I don’t even know if you don’t simulate physics, will hit event ever emit.) I know we shouldn’t reinventing wheels, but this is for study purpose for me, so use at your own risk.
Here is my pawn setup, that “Use Controller View Rotation” option almost drive me nuts, after check that off all the camera behavior was solved.
Here is the part to handle movement related input
Here is OnRep called when force vector is set
Here is torque input and OnRep Torque
And finally, the part doing update and some debug input to do a break(I haven’t implement damping yet.)
And here is the result(spawn still using 's method, but use teleport):