#multiplayer
1 messages ยท Page 536 of 1
you can only test LAN in standlone i believe
unless youre using the build..
package
which i guess for mobile you would have to
brb dinner
Ah ok. Maybe that's why it still comes up 0 sessions found right after creating one, even if I don't open a level
Huh. comes up zero in standalone mode too
I'll try the same on your project
Oh poo. I can't get it to save my changes to the UI blueprint
Okay I saved it
@queen flower I get 0 sessions found right after creating one, in standalone mode on your project.
I am not running Steam. Just setting up for LAN so Steam is not even logged in or running at all right now
My projects don't even have a Steam option. One used to work with LAN, and doesn't in Shipping build (maybe broke in dev build too? I'll have to check), and the new one I started (both 4.23) can't find sessions. I'm beginning to think maybe it's failing to create them?
My project is 4.24
If in the engine make sure you set the number of players to more than 1 in the play drop down.
Make sure you're following the readme
yep it's at 4 players
I added the AdvancedSessions plugin
Steam doesn't matter because I'm not using that, and I confirm it's falling back to NULL online subsystem in the logs when I run it
(steam OSS shuts down on launch, probably because I'm not using Steam on that device)
Ah okay if I do New Editor window then one of the windows can make see the new session.
okay yeah it works on same machine.
Okay works the same on my project ๐ good. Interesting fact: Find Sessions seems like it cannot see the one created by the device that's already hosting the session. At least the behavior is 0 sessions found when Find sessions is run on the host, 1 Session found when run on the joined client (after creating and joining)
Okay I put the win64 build on two computers on the same Wifi and the 2nd computer cant find session @queen flower
Nope doesnt find it when I reverse who the host is. Itnworks great from editor on same.device. does not work from.built.app on separate devices over wifi
Session = true and LAN = true
In all tests
So i guess something must be wrong with my Wi-Fi then or with built app. Gotta figure out how to tell which one
Did you set your IP to static?
No, I never had to do that before on my other projects before to get it working
If you mean configuring my router.
The reason for this was I wanted to create a user-friendly experience where they don't have to have any technical skills to play over their own WiFi
Other people playtesting at their houses didn't have to do anything to their router either; it would just work.
but if I did set it to static then maybe we could use that to eliminate whether it's a router problem or a build problem ๐ I'll have to learn how to do that
@queen flower not sure that will help: I tried specifically executing command "open 192.168.50.49" which is the ip address currently of the host, and nothing happens.
at least not from my android device
I checked host machine's firewall and set everything related to UE4 to be enabled, public AND private
Would having WPS on my router cause any problem?
@queen flower I can get to it via direct IP console command from PC joining Android host, but it doesn't find session.
And only if I do it on my 5G part of my WiFi router.
So weird
well I gotta go to sleep thanks for the help so far
Super weird. Sorry I couldn't help more. Your issues sound pretty unique.
I could have time Thursday morning to help.
It's 11:17pm for me now so let me know if you'd like to spend time before noon testing some stuff
Maybe I can open the PC version here and host so you can join on your end?
Just being absolutely sure I read documentation correctly. I'm updating a float on tick in the client's player character. At a regular interval I have an RPC to server to set this same float variable. The variable is set to ReplicationCondition Skip Owner. This means that the server replication will NEVER overwrite what the original client's float value, right? Just the server and any other version of this character on other clients besides the one that replicated it to server.
yes
@scarlet cypress How are you setting visibility?
@kindred widget Just normal in the Character blueprint "Event Hit" -> "Set visibility" and its replicated on the Server and on the Client.. ??
Uhh. With visibility I'm not sure? I had some issues with the character movement component over something similar. I was trying to set a variable and replicate it across all versions of that actor. I ended up having to make a reliable rpc to the server to set the variable and repnotify set the movement component's variable. If it doesn't replicate correctly for you, you may need to do that same thing.
Trying to replicate a dash mechanic on a custom CharacterMovementComponent (c++):
I've created a custom CharacterMovementComponent so that i could do custom movements like dashing and wall running. I understand how i would do it offline but the replication part is killing me.
I cant just lerp the player location using an rpc, I really dont want to use Launch like previous examples ive seen. The last thing i tried was manually setting velocity since setting the character location over the network directly didnt work. I just cant seem to figure this out lol.
Hello, what is the correct way to destroy all sessions on the client side upon loading the main menu?
I fire this simple event on server side, but it's pretty nasty delay.
previous question answered
Hello boys, little ask :
Actually, i spawn my pawn in game mode, on a post login event. The fact is i would like to fire an event on my Pawn to initialise some usefull data, like the model should be view by other player, and the visibility for the local controller player.
The fact is i visibily can fire an event from my game mode, to this pawn, more "strange", if i fire an event from game mode, to gamestate, to my pawn, it's working 50% of the time. Any clue ?
okay, i finally found it, this is not replicated due to delay.
if i do this :
it's ugly, but it's working fine, i will try with a kind of ping pong event, but if anybody have a clue to manage this properly instead of putting a delay
At least, if no one have any solution, can someone answer why in game mode, if i list all my playercontroller, their id are all -1 ?
that screen is in terrible resolution
you should use HandleStartingNewPlayer, not PostLogin
unlike PostLogin, it works for SeamlessTravel as well
also, all your code from GameMode runs only on Server
i can't tell what you did in GameState with the delay, since i can't read any of that
@hybrid crown
hey I was wondering, and is it best to make multiplayer first or later in a project? like as in start by doing the multiplayer as the first thing you do in the project or make all the other gameplay first then multiplayer
Ill admit I dont know anything about mp aside from tutorials and from what Ive seen its really complicated
Unless the other things you're doing are just maps and visual stuff, I'd say just start with multiplayer coding. There's too much interconnectivity between the clients and server, You'll have much cleaner coding and a lot less hassle doing it from the beginning.
ah ok thanks
@oak pond Also, it's really not that complicated at first. If you want to get used to it, just learn about replicating variables properly, and RPCs, which are just normal events that execute on the same actor in different machines.
You'll go a really long way just knowing those.
Also, for simplicity, start with a dedicated server setup first. It'll be less complicated to learn. In Dedicated, the server is a separate instance, in non-dedicated the first client and the server are the same machine and it gets a little confusing at first when feeling it out.
dont you need to pay for dedicated servers?
It's a setting in Unreal.
wait what
oh wow
You can pay and host the dedicated server for your final product to let people play on better performant server machines, but that's release talk. For development it's just a setting.
Like I said, with it off, Client0 is also the server. So you can't just treat all clients differently than the server, since one of them is the server. It's difficult to learn around. So like I said, start with that on so that the server is a separate instance and it won't make your results weird for your first client vs the others.
so wheres the dedicated server located? and what happens if you try to use that in a packaged project?
What do you mean by located? And I'm not sure how to package it. Looked it up once, but I don't remember. I haven't had a need to and probably won't for months.
I mean like how does the dedicated server exist, Im not really sure how to say it but dont you have to pay if you want to use it in final like you said
When you're developing?
Oh, when you use it in final.
Yes/No. I mean that's up to you and how you want to release. Most games hire servers for it, sure. But take for instance ARK. You're free to put a dedicated server anywhere you want if you want your own little multiplayer world. I ran mine on a laptop for a few months and my wife and I played on our PCs.
oohh so if I remember rightly there are free ones and paid ones
but Im just wondering how its set up in unreal by default and if you packaged it if it would still work
It's entirely up to you. You can release your server files and let players run their own, or keep it all official and don't show server files.
hey this is kind of a weird thing i'm having for my game
here's the scenario
player 1 hosts
player 2 joins
player 1 ends the match early with a "destroy session" node (i used print string as a sanity check) around a minute after p2 joins
both are back at the title screen
player 2 cannot join or host matches
ping me if one of you knows the solution
so surely players running their own wouldnt be dedicated? Im not entirely sure what you mean by showing the server files
It would be a dedicated server if you let them set up their own dedicated server. Dedicated server has nothing to do with who hosts it or where, Dedicated server just means that none of the player's clients is also the server. It's a "dedicated" process being ran somewhere other than the main player's game process.
so still using their connection to host it? damn I dont know as much as I thought lol
I was probably gonna use this tutorial but it does it through steam, would you say this is a good idea? https://youtu.be/TPakLkxc6f0
Hey guys, I still cant make the volume louder ..
Anyway this time I show you how you can:
- add Steam to your project
- Host a Game Steam/ LAN
- Search for all Servers
- join servers
Stay tuned on Facebook:
https://www.facebook.com/PyroDev/
___...
Dunno. Haven't complicated my system with that yet. I need to at some point, but as far as learning how to generally program multiplayer, anything other than setting the play button to more than one player is unnecessary. Possibly distracting too.
To do packaged stuff, you need to learn about creating sessions. And for that I recommend not using a dedicated server unless you want to learn how to package one. Just went looking again. There's a few videos on it. I went with the other option of just learning how it works and sticking with non dedicated. Easier on players that way anyhow, usually.
Heyy, I've got another question about the World Outliner ๐ Is there any way to test ServerTravel in PIE Mode or have the World Outliner work atleast for the Server World in Standalone Game Mode?
Hello, I have problem to set a multiplayer linetrace in a multiplayer FPS. How can set when hit player, the player hit lost health? The server hit player but client to client i don't know ho set.
Clients can't interact with other clients directly, you have to go through the server
Generally the way to handle that is to rpc from the client saying they hit something with the line trace, to the server. Then the server confirms it in whatever checks you want to run and if true call a multicast that plays the 'damage' event on all clients and the server.
@buoyant wedge easiest way is to use ApplyDamage event. It knows for itself to only run on server already, then on the receiving end you can define what happens when it gets there.
True that. Hadn't considered that was a server function. Still playing around with spawning projectiles and haven't quite gotten to damage applications in multiplayer.
Question: what is the proper way of displaying the true ping (as seen in other video games in the scoreboard). Is it just displaying this number? Is it multiplying this number by 2 (as in send and receive) or is it multiplying this number by 4 (as stated in the description "msec divided by 4")
https://gyazo.com/fd95a801d3c85fa089cc39865b74cd10?token=31d8ee51bfa2adeeee72475ede5a5f15
And if it's multiplying by 4, then why is it divided by 4 in the first place?
it doesn't make sense to me at all o_O
I have set the apply damage. But now when I hit a character all character (server and client) take damage
wait so does a normal line trace and then cast to itself not work?
@oak pond What do you mean by cast to itself?
like for example if its third person and then you do line trace -> hit actor cast to third person -> * damage script * would that still work
for if theres multiple of the same actor in the map
as far as I know that works for most things
Sure, that should work. You'll have a much easier time using the damage interface already built in though. No need to care about what you hit, just apply damage to the actor variable from the line trace without casting, and handle that on each class differently.
Hmm so because UE4 TCP is essentially UDP with TCP characteristics, is it really slower?
does it depend on network volume?
It is 100% UDP, not TCP or UE4 TCP
"reliable" RPCs implement some features of TCP sockets
So yes, reliable RPCs are slower when network congestion drops packets
@buoyant wedge If you're still having trouble, you'll have to show us what you're doing that's causing it to affect more than the intended target.
Ive never actually used the damage stuff, can you use it to decrease health and stuff? theres an OnTakeDamage node if I remember rightly right? thanks for reminding me it sounds useful
now that I think about it its hella useful, Ive been using casts to every single actor that you could shoot lmao ๐คฆโโ๏ธ
on server the disply damage on client work. But don't work client to client. I see the blood but in the character to do the shot and not the receiver
the line trace on a weapon and not into a character can be the problem?
Hi guys, I'm new to UE4's replication so maybe you guys can easily answer this. I have looked around a lot so far with no answers. I'm using conditional replication, with COND_OwnerOnly on a property of a component. But it won't replicate when I do this. Without conditional rep it works. I've set the owner of the component's owning Actor to the Player Controller(although the Actor's controller is an AI controller) to the correct player controller. I'm not sure where I'm going wrong or if I'm missing the concept of OwnerOnly. Any help appreciated.
im having trouble with my packaged mulitplayer project in that when I try to use an open level command with ?listen option it wont open the level. It works in editor mode and when I dont have the ?listen option in the open level node but I need to have the map in listen so that other people can join the session. Any reason why im having this bug
Hey everybody, I decided that since my Wifi router hates Sessions, I'm going to just get the Android device's IP address so people in the same room can type/paste in the host's IP
BUT I'm having trouble finding a way to detect the Android device's own IP address so it can be shared with the other players
whatismyip.com charges for API use now, and limits web site requests to 5 / day
I tried Android Goodies plugin but it doesn't seem to have anything that looks up the device's IP address
How can I get my device's IP address from my Unreal app at runtime?
Host your own service that clients connect to, and you return their IP address to them
It's literally one line of PHP
like print $IP_ADDR or something
what happened to the netpktlag console command in 4.24
weird it works now
still doesnt auto complete in the console though
@bitter oriole Is there a way to do that locally on the android device without internet?
That way I don't make the app dependent on my hosting or the internet in order to set up LAN games
I'm considering using a bluetooth plugin instead, since I don't need realtime replication, and it's just turn-based
No, there is not
Public IP address simply isn't something you can physically know from the device
But... you don't want the public IP here ?
Just the local one
If it's LAN
Calling GetMesh()->SetRelativeLocation() on a character mesh on both client and server, although it logs out as having the new relative location on the client, the mesh is still at 0,0,0 visibly, on the server it is correct
Any ideas on why this is?
Solution in case anyone else needs it
Any relative location set on the character mesh which will not have a lasting effect because the client-side prediction of the CharacterMovementComponent overwrites the relative location every frame. The intended way to specify a relative offset for the client-side mesh in this case is to set the value of the Character's BaseTranslationOffset FVector value. For the server you can still use AddRelativeOffset.
Hi folks, i have just read https://forums.unrealengine.com/development-discussion/c-gameplay-programming/43920-how-do-you-replicate-an-actor-pointer
and i am not clear what mean "Actually as long as your actor has bReplicates set to true, then you can pass pointers across server functions directly or as USTRUCTS and UE4 will find the LOCAL version of that same actor!"
It's it mean if I have AActor* ActorExample as replicated variable, and set it as server version of that actor, somthing like this: if(HasAuthority()) { SomeOtherActor->ActorExample = this; } i will on client version of SomeOtherActor get client (the LOCAL version from above) version of ActorExample ?
For gameplay programmers writing C++ code.
in my example, I have weakspots on enemies, so i want when two players attack in "same" time same enemy and each of them attach on enemy's weakspot their combat pet, i need to count pets and do instant kill o enemy. Each weakspot has OwningEnemy which is replicated AActor* and is set on server, so all pets should be on end attached on one instance of enemy (server), but that doesn't happenes. Despite OwningEnemy replicated, server version of Weakspot has server version of Enemy and cleint version of weakspot has client version of enemy, so i can't count and onstant kill...please help or give me some explanation, I have spend whole day on this problem
there is a concept called NetAddressable
it works for all Replicated Actors, all Actors loaded from Package, as well as any stably named Actors, and all components that are default subobjects of those Actors
for those Actors/Components, a NetGUID is created, which matches on the client and server
it is the NetGUID thats sent over the network, not an actual memory address
and that can be resolved on the other side
@keen surge
so if you have a non-replicated Cube on the level, for example
a client can send a server RPC with a pointer to Cube telling the server to destroy it
and it will work
because its on the level (loaded from package), it has guaranteed same name on all clients + server, and that can be used to make a NetGUID
(it can be uniquely identified across all the machines)
still not sure about this: for an FPS game. Is it better to have the actual visualization of the gun recoil done through animations or through code?
@slender yarrow id use an animation montage. thats what im doing currently, going to try to have 2-3 different recoil animations for the weapon (just subtle differences) so its not repeating and randomly select which one to play when shooting
yeah thats what I have as well. Ive just always wondered how COD handles it, or any of the AAA fps'
checkout, might give you a little insight
https://www.youtube.com/watch?v=qmRp58sePT4
In this exclusive Game Informer video, Ben Hanson interviews Call of Duty: Modern Warfare's animation director Mark Grigsby (who you might recognize as the original Modern Warfare's Sgt. Griggs) about the biggest changes to animation during gameplay and more. See more exclusiv...
ive actually watched this in the past. I guess it didnt register with me that the actually firing recoil was an animation. Wasnt thinking lol
yea, just the way he talks about it kind of opens your mind up a bit when thinking about how to go about doing something related to weapon animations lol
hi anyone here know any documetation other than epic one to learn more on CMC?
@Zlo thank you very much on answer. So I should get NetGUID and using it to totalize number of pets on both sides?
Why can't you send RPC's to specific clients, like replicated variables
Net multicast seems wasteful, and sometimes client is not enough,
What if you wanted to send something to everyone with a condition like COND_SimulatedOnly only?
So everyone but the client
when creating a session, i have an open level on success but when someone creates one. it sends them to the level and then seconds later sends them back to the main menu
only in standalone and packaged
Well that's interesting when a client disconnects they open a copy of the current level to my knowledge, so take a look at what logic you have to send them to the main menu, and remember in a real networked scenario the client may send and get networked variables and RPC significantly slower than in editor
So if you're depending on a replicated variable or the client is kicked out to the menu, that would make a lot of sense
That all being said I could be wrong, check what calls the code to open the main menu level and work back from there IMO
My steam game isnt working when packaged, ive heard something about steam_appid as a .txt in the folder but mine still wont work with id 480
Launch the game from Steam if you want to be sure
@stray gull depends on where you put the file, BTW is it working in the engine when using play in standalone game
yea its working in standalone and i have "480" in the file
Where's the file ?
None of this is necessary if you run from Steam
how do i run from steam
Well, I take it you are shipping the game for Steam ?
not atm i just want to use the friend system / invite system
Alright
the appid should be under WindowsNoEditor\projectnamefolder\Binaries\Win64
Keep in mind "shipping" is for well, shipping your game. No logs, no console, etc. Development is what I'd package with for testing
im packaging with Development
i might of found the issue, just testing now
Yep i fixed it... previously i tried upgrading the steamworks version but it didnt work and i didnt change the steamworks.build.cs file back, so it was looking for a different version of steamworks
hello friends! can anyone tell me the best way to go about having the actor of the same type multiple times in a game and that actor has a progress bar but i don't want it to affect any of the other progress bars?
think: generators from dead by daylight if you've played it before
Just spawn each actor in the level or place them in there. The progressbar an actor has will always belong to that actor
ah if that's the case then how would i send information from a playercharacter to that actor?
Depending on how you want to do that and what you want to do
cause this is more than obviously not the best way as i'm trying to cast to that actor, but it's affecting everything else then
If you only want to get a reference to it when you are in a specific distance around you can use an overlap box
Also is it multi-player based?
yes of course
Okay.
So what I would do is adding an overlap box to the actor you have then when event begun overlap of the box is fired you can cast to the player character using the other actor pin
You can then perform the code you want
Or set a reference to the actor inside the player and when end overlap is called resetting the variable to null using a cast again
As I said depends on what you want to do then
ah okay, i was able to get that part down. cause i show some widgets to the player whenever they get into that range but now what im trying to do is have our player hold down a key and i'm trying to cast to that specific actor to increase progress
As I said using the reference you can just go into the player an then performing the hold function using the input key and a gate function then for the first input of the gate you can check if the reference is valid
If it is valid it means you are near your generator
Perform your code then
If it is not valid you are out of range
I would make the reference to that actor replicated and set it with a server event of the character to self inside the generator when begun overlap, and reset it to null on event end overlap
hmm alrighty. i'lll see what i can come up with and come back if i can't get it again :D thanks a lot!
okay so it did kind of work for me! i casted a reference of the actor to the character and that works, but now the other actors i copied don't allow me to interact with it? LOL
How come my set actor location after exiting a vehicle, is delayed? Look video, it's a very small but noticeable delay
Any tips?
so whenever they would step into the box collision, i would go ahead and set a variable that my player can then reference to try to get access to(then i'd some some arbitrary text and a progress bar that is associated with a float variable) then set a boolean that allows me to know in the code if the player is in the radius. when they step out i undo all of that
then with that boolean i set i then stop the player from being able to move(cause i don't want that) then i sent a boolean that is based in the actor and can trigger the float progress to be increased
the way i explained it is probably terrible and i understand that
@woeful ferry There will always be a delay. The higher the latency the more delay you'll have.
see, i would set the float back to 0, but i feel that would have unforeseen consequences such as if other players were on another actor
@chrome bay I'm aware of that, but got any tips on how to do it in any other way?
Not really no. The Server inevitably has to set your "exit" position, you just have to live with it
I will be home in around 2 and a half to 3 hours, if you still struggle with it then I can help you but I don't have a pc with me atm to show you how to set it up @tawny raven
I assume the server is the one that removes you from the vehicle? The client doesn't remove themselves?
Hard to really suggest to be honest without knowing the full extent of the vehicle occupancy system.
A delay will always be there between server and receiving others you can't do much about it, instead of setting the location you can use a Montage using root motion for the character
That'd be really helpful Luis! In the meantime, I'll try to see if I can fix this! Thanks a lot
@chrome bay I'll screenshot in a sec.
There's nothing you can do about the delay for other clients
if i want to have replication on something that can be controlled by a player (for example a vehicle), i need client prediction if i want it to be server authorative right? i assume this is quite hard to program?
trying to find out the best approach
(before i start)
If you're using physics you can't really do client prediction / server-authoritative.
The best approach is to use client-auth, then do a lot of validation and checks / anti-cheat server side.
so if any type of physics is involved it needs to be client authoritive?
yeah, pretty much. It depends. If you have a simple enough game where you can rewind and replay the whole physics scene, you can use server-auth.
Rocket League has a good talk on the subject, but it only works for a game of that scale.
on the plus side client authoritive is pretty easy to setup right?
Yes indeed. Almost as simple as a few checkboxes (so long as the vehicle is a pawn)
the default vehicles are not though right?
Default ones are pawns I believe
i was looking for a good vehicle system that does not use the default vehicle system (since it really sucks imho)
Yeah, I did my own
found one but it does not replicate by default
other then that it looks to be almost exactly what i want though
All the marketplace ones I've seen have a completely appalling network implementation. totally unuseable.
this one does not have any replpication, so i figured i might be able to just add it
The TL;DR version is that you uncheck "Replicate Physics To Autonomous Proxy" on the vehicles skeletal mesh, then the client sends unreliable RPC's on tick to the Server with Input and physics state.
Ideally, you do what you can to compress those RPC's and reduce the number you send
The Server updates itself with the clients physics state, and continuous to run the physics sim with the last-received inputs between updates.
I also advise replicating the input to clients along with the normal replicated movement, so that clients can extrapolate between updates too
Tis what I do anyway
i'm confused by that
replicating input from clients to other clients via the server or what do you mean?
Meh, smoothsync is a workaround for not doing it properly
it just interpolates?
dont see the downside of that tbh
doing it properly would be server authoritive with client prediction imho
The clients are still all simulating the physics scene and the vehicle simulation between updates form the Server. If you don't provide them the input to simulate with, they will continously snap.
Server auth physics is impossible, at least on a "general" scale.
yeah you said that
so the only way to do it properly is reprogram something that does not use physics
so client authoritive is the way to go for me i guess
what does this do though? "Replicate Physics To Autonomous Proxy"
SmoothSync does indeed "interpolate" the transforms - but constantly reinjecting transforms into the physics scene is terrible for performance, and it's not really "true" physics then.
Well, the engine already does physics smoothing between replication updates (you can tune it in project settings to make it more specific to your project). Unchecking that box basically means the locla client will ignore authoritative updates to the transform.
Otherwise it would move forward, but then be constantly snapped back by the servers' update.
ah nice i didn't know there was such a setting to tune
Unchecking that means the client won't apply the servers' physics update if they are autonomous proxy (aka possessed pawn)
so untick that, tick replication and movement replication, done?
(then optimizing optionally)
You also need to send the input and physics state from client->server via unreliable RPC.
I suggest throttling the send rate and compressing where possible.
Also, make sure you call those RPC's after physics scene has ticked.
just wanna make it work first and then try to optimize
is there any decent tutorials about this stuff? it seems really hard to find anything thats good
Not atm as far as I know, I've got endless threads on the forum about it since this is basically "my jam".
Otherwise am planning to put an article together about it, since I end up going through this at least once a week ๐
lol, well don't feel obligated but it definitely feels like a hole in the market so to speak
Yeah very much so
i'll look on the forum specifically too
If it's any consolation, Fortnite uses client-auth vehicles.
So if they can do it... etc.
Epic are apparently "investigating deeper integration with physics" for their new network prediction system, but no timeline on that atm.
Or what that really means..
yeah seems fine for my needs
i'm thinking about this though, and if the server just receives the location / rotation data, does it still need the client input? ๐
seems like that is enough to replicate it?
Yeah as in-between updates from the client, the server is still simulating the physics sim.
So you want it to ideally simulate with the clients input, as the results will be closer-matching when it gets the next client update.
aha, so without the client input it would just be choppy without interpolation?
Yeah pretty much. I mean it will still be smooth-ish, but if the client has the accelerator pressed for example, you want to assume they still do between updates.
For analog-style inputs like steering, I have the server/clients slowly round them back to zero between updates too. Really have to tune it but can help a little.
finally finished implementing deterministic lockstep p2p multiplayer in ue4
@bitter oriole I did end up using FSocket only from UE4
Cool
for an RTS?
so if anyone is wondering, determinism and lockstep are possible w/ ue4
you just have to throw most of it out the door :)
@chrome bay yes, RTS
@chrome bay i think i will start by just adding replication on its own then, and when that is working add the input, does that make sense / sound like a good plan?
wanna divide it into little steps
yeah, is pretty straightforward to send the input next to the phys state.
also also... for the doubters, determinism works across any combination of amd, intel, windows, linux, msvc, clang
@chrome bay i never even used an RPC before lol.....
just wanted to put this out there because some people seem to think floating-point determinism is some sort of wacko nonsense from the nineties or something
90s stuff can be pretty good, in some ways we have been devolving imho
Something I suggest is grabbing this little utility, and running it with a bit of lag and packet loss when playing in PIE. Helps to see where things can fall apart in multiplayer.
https://github.com/jagt/clumsy
I love clumsy too!
Yeah it's great. A lot easier to use than the engines built-in simulation stuff too.
didn't even know it had one
i didn't know about clumsy seems handy
Yeah it has one but it's pretty hidden and not that nice to read, you can see how many packets of what goes out because of which rpc though.
Setting lag has to be made during game play and you have to "record game play" to analyze it afterwards using the ue4 tool
Just some console commands to persuade the net driver what to do with the packets etc.
I prefer clumsy though tbh
Although I do forget to disable it now and again and wonder why webpages take so long to respond
I can't use ue4's built in things as I'm not using its net driver but it could be nice for people that are
@robust wind I'm gonna be heading to bed, but feel free to DM me with the solution as I've yet to find my own! Cheers and thanks again!
hey so Im trying some simple things in multiplayer, so far Im just trying two players in a map and they can click to line trace, and if they hit the other player that player dies, but the weird thing is it only works when the server player does it, yet everythings replicated
the client still recieves the death event so thats good I guess, but they cant activate the server players death
and something else Id like to know is how to accurately replicate ragdoll positions
How are you calling the kill function from the client to server?
@oak pond First issue is that Apply damage is a server only function. I presume you're in the player's character which is owned by the client. That's why it works on the server character and not the remote client. You need to create an RPC event to call. Pass the stuff you need through the event like the hit actor and call apply damage on the server after the RPC
Generally, just think of them as the way that the different instances of an actor talks to each other. The client version of the pawn can talk to the server version with a Run on Server RPC, the server can talk to all instances of the pawn with a Multicast RPC
yeah I think I understand what they are but not how to set it up, never actually seen it in blueprints
Just a sec, I can give an example with your line trace.
@oak pond Try this out.
oh thanks
It'll line trace on the client, then tell the server version of this actor to call it's event and apply damage. Since apply damage only works on the server, it'll already be on the server and we call a multicast. That multicast would set the health and stuff of all of the actors so that all instances stay synced.
ah so it kinda has to apply damage to itself? sort of
and I assume ServerDamage is Run on server and Multicast is of course Multicast
or are they both multicast
ServerDamage is server only.
awesome, they can both kill each other now thanks
so youd use this technique for all other player interactions I assume?
The best way to explain it is that there are actually four actors. You have two players. Server and Client1. Server has two pawns, one on Server and one on Client1, Client1 has two pawns, one on Server and one on Client1. If Client1 wants to do something, they need to use their version of their pawn, the Pawn OF Client1, on Client1 to call the Client1 pawn on the Server. The server version of Client1s pawn will then have the authority to tell all other instances of that pawn to do something with the multicast.
Check this page out and scroll down. there's a graph about RPCs being invoked from where and how they work.https://docs.unrealengine.com/en-US/Gameplay/Networking/Actors/RPCs/index.html
Designating function replication across the network
I dont want to risk speaking too soon, but maybe this isnt as horribly complicated as I always thought (๐ค)
how would you accurately replicate stuff like ragdolls and other physics objects though?
Hard to say. There's some methods, but most are pretty heavy. Ragdolls are hard because there's so many moving parts and you'd need to replicate their bone translations. Normal physics actors are a little easier with only one transform, but stuff like that is generally ignored in most games. It's usually not gameplay relevant to care how someone's body drops after they're dead, or where the prop flew off to when you shot it. The exception might be if you can loot corpses. Some games even cheat that by spawning death bag at the death spot then letting clients handle physics on the body, since translating one death bag is a LOT less expensive. One example of this might be something similar to Apex Legends if you've played it, deathboxes. They need to be in the right spot for players so that the server knows the player is close enough to it to interact with it. Another example is Overwatch, dead bodies and props aren't replicated, each client sees things just a little differently since it's not gameplay relevent.
I'm sure there may be a way to handle it in Ue4 with skeletons, but it'll definitely take a chunk out of your network bandwidth.
yeah I was thinking that would be the case
what if maybe there was one physics object that the ragdoll was attached to, and that physics object was reliable so the ragdoll would be in pretty much the same place for both players but just a different pose?
I wanted to involve quite a bit of physics but maybe I should try to avoid it a bit, I heard projectile movement is more reliable though?
Could maybe work. Definitely don't do reliable though. You'll be replicating the variable enough that even unreliable will be enough. Making it reliable will stagger your network as well. Be careful with reliable replication. Just use it for extremely important things like state changes. I reliably replicate boolean state changes to the server so that it can set the right state. But that's one button press every so often, not up to 120 times a second.
Couple of case points are things like saying a character is crouched, or aiming down sights.
oh I didnt mean the reliable flag itself I meant literally reliable
but yeah I think I could try to avoid physics where possible in multiplayer
Ahh. yeah. It should be at least close as long as the server is replicating it. You might even be able to get away with just location instead of a full transform.
yeah thatd be pretty good
should I try something like constantly checking the ragdolls location on the server and setting that location on the client, or would that be really costly as Id assume?
Hard to say. You could soften that up a lot with some parameters. If velocity > someamount, replicate variable. Else it's probably not moving enough to bother. You 'might' even be able to get away with lowering the amount to 20-30 times a second. Attach the body to the object with a constraint and make it follow the set object.
oh single physics objects like cubes seems to replicate very accurately just with slight lag
Bear in mind, I have no idea if there is an internal way to handle stuff like that. There may be a smooth way to handle skeleton replication that's in C++ that'll be a lot better than any blueprint solution.
I have to admit I know hardly anything about c++ but I think blueprints are capable of most of what I need
I have yet to find anything I can't do in blueprints. I'm very well aware that C++ implementations are faster, but blueprints have apparently come quite a long ways, since people are still in the mindset that you can only implement very basic game functions in them.
Blueprint are extremely useful and not to be ignored. C++ is faster, and more importantly, easier to work with for source control, but it's not nearly as fast to work with.
yeah thats good to hear because Ive been learning blueprints for a long time and its the only way I can make game projects really
Then roll with it. You'll have time to learn C++ later on and then use it for UE4 if you like it.
@oak pond Couple of random quick tips that I've been learning over the past few weeks. First of all, use Validated Gets instead of getting a variable and using an Isvalid node. Only use IsValid when you're getting the variable from somewhere like a function. The ValidatedGet is anywhere from seventeen to twenty percent faster, and it looks neater.
Second, functions are actually slow. Anything that you don't plan on using from another actor and you're only going to use inside of that specific actor but you want to hide it away in it's own little function, use macros.
oh ok, do they work in the same way as functions though?
Mostly. Macros have a couple of extra things inside of them, but they're basically just hidden away graph nodes.
@oak pond Probably should be talking about this in blueprint, but since no one else is talking here much, this was what I meant. The Pure getter function is INCREDIBLY slow. These all do the exact same thing. Get Bool2 and set bool1 based on it 15,000 times.
Do you guys know of a way of replicating TArrays of a fixed size? Ex: TArray<int32, TFixedAllocator<static_cast<uint32>(MAX_NUM)>> MemberSize;
oh wow
@fiery geyser Not sure about C++, but at least in blueprints, Arrays set by the server and set to replicate are replicated automatically.
Not seeing a way to set the max size in blueprints though, so no way to test if it's any different there.
@fiery geyser use FFastArraySerializer. It doesn't preserve order though.
Oh wait nvm, you can't use the non-default allocator.
May be able to wrap it in a helper struct.
Yea, that's what I thought too, but I might have to replicate the size as a member in that wrapper struct to achieve that.
You might as well just replicate it normally then. TArray replication already replicates the number of elements, as well as the elements themselves.
You can't use UPROPERTY() with anything but the normal allocator IIRC, so you would have to define a custom NetSerialize() function the for struct anyway.
Seems like overkill for something like that tbh, and probably prone to error anyway
yep.
either
the more i look into this stuff the more confused i get
Hi everyone ! I have a little question for you all. I would like to know where is the best location to save variables (global ones) on the server-side and how can I make my clients ask for one of them ? I have read that I have to do that in the game instance, game mode, player state but nobody seems sure...
Hi, I've got a question about actors moving on the server which are not players. I've got a few actors rotating and moving on the server, and whenever a client's position gets pushed by these, it creates a very stuttery repositioning on the client. Because the server is trying to handle the client's 'faulty' position and keeps sending corrections to the client. Should the client have predictive data of the actors moving on the server or how should one go about solving this? Does this make any sense?
Anyway Would greatly appreciate any help, I know it's confusing lol. thx!
@burnt copper What are the variables being used for?
@kindred widget, I want to make procedurally generated levels : I need the server to set the "originSeed" and the clients request it to generate on the client-side all that doesn't have to be replicated.
is this still relevant? https://www.unrealengine.com/en-US/blog/blueprint-networking-tutorials
(april 2014)
@twin juniper I'll take a look right now
@burnt copper thanks, just asking since its pretty old
don't wanna confuse myself more by learning stuff that no longer works lol
I have started watching this tutos a while ago but i have not watched all of these.
but nothing major changed since then networking wise?
I don't really know it is my first multiplayer game :/ I will check that again ๐
i'll just check em out then, unless someone tells me in the meantime that its no longer relevant
Ah one more thing ! my server is a dedicated one, I don't know if it change something about the way of doing things
@burnt copper Hard to say. But I'd probably say GameState for something of that sort initially. Not familiar with procedural loading though, but every client should have access to see the gamestate and it.. kinda pertains to the game rules. So.. I'd say there.
@kindred widget i can set the line trace on the weapon bp or i need to set into the character BP?.
@buoyant wedge Still learning that stuff myself. I'm not quite familiar with how to give ownership of a non possessed actor to a client. Before, I did all of that stuff in the Pawn since it's already owned by the client controller, but I'd have to get back to you on that once I know how to handle that unless someone else knows.
@kindred widget, @twin juniper thanks for your time, I will look the tutorials and look on how do the GameState works with multiplayer and networking and I will see if I can go ahead with this ! I'll write a message if I find a solution. Thanks again
@kindred widget there is the possibilty if i set on the player... the people can try to hack the game easy?
@burnt copper euh you helped me lol, you might have highlighted the wrong guy
@twin juniper yeah sorry XD @kindred widget The GameState was indeed the solution ! Thanks !
Has anyone used the steam socket subsystem as described here: https://docs.unrealengine.com/en-US/Gameplay/Networking/HowTo/SteamSockets/index.html
How to enable the Steam network protocol layer for Unreal 4 projects.
For me, it dces me when trying to travel the clients with the server
throwing this log: [2020.04.19-23.16.16:960][371]LogSteamSocketsAPI: Verbose: SteamSockets API: Log [#334320325 P2P steamid:_] problem detected locally (5003): Timed out attempting to negotiate rendezvous
I have a weird problem, when Im using my own mesh and ragdoll, its stuck in t pose for the client, except when I did the same thing with default mannequin it ragdolled fine
my physics asset is set up fine
wait hang on
ok dont worry my fault
ok so I still dont get how to have a key press and then make something happen for which player pressed it for example pressing tab kills the player (for testing of course) but of course I can only get that working for the server not client
@oak pond The client needs to RPC to the server from an actor that it owns. This is usually the controller or Pawn. The server can then destroy the actor.
yeah I dont know how to get the right pawn controller though how to detect which one pressed it
I think I know what to do for other things now though thanks to your help earlier but not sure with inputs
The one with the input did. You program it the same. Input only happens on the client that did it.
Are you trying to kill the player's own actor when that player hits tab?
this is all I can think of but then I get stuck here
This will destroy the actor at least. I haven't gotten to respawn stuff myself yet so can't help much there.
respawn works for server right now so the actual respawn function itself is done
Yeah, that won't work because it's a multicast. Multicasts can ONLY ever work from the Server. To do a multicast, you need to first run a server event, and make that server event call the multicast.
oh yeah I was trying another way with server
but doesnt everything that all players will see have to be multicast?
Most things. But I think Destroy Actor is automatically replicated to all. Let me check.
I mean if you're simulating physics and all of that stuff, you need to call a multicast I think.
So yeah, you'd need to buffer what you have there with a Server event that calls your multicast event.
ok what really confuses me is I already have this death function working with both players but I cant make client activate it on themselves
of course that tab will only be from the server not client
That all looks right, but you need to plug a Self reference into the ServerDamage on the tab event.
oh is that it? I think I tried self for respawning but it didnt work, Ill try it with this
oh wow that really was it thanks lol
youve been a great help so far, most of this seems like it should be obvious but I guess this is how to learn it to start with
A lot of this is fresh. I'm not too far ahead of you.
Case and point, I'm trying to understand how to set actor ownership to call RPC from a weapon instead of the character. Aaaaand, it's just not working no matter what I do.
i just call GameMode's Restart Player function
from a server RPC, but your way is fine
it works, and does the jobn
damn I didnt know that existed lol ๐คฆโโ๏ธ
came up with an ingenious idea for reliably keeping the ragdolls location 100% accurate - its a bit silly though https://gyazo.com/77b98efc8c2f0db2e0969d91a8edacf0
mesh is constrained to the capsule
its often very obvious to see where its being pulled around by the capsule though
hrm anyone got any ideas how to make it look better?
I really wonder how games get this working with accurate ragdoll replication
why would that be accurate? the bones still get simulated differently on clients and there is no guarantee that they will be on the same position (unless I missed smth)
by accurate I only mean to the root bone, so the location of the ragdoll is perfect but the pose its in will be different between server and client
pose isnt too important but as long as at least one bone is where it should be thatd work fine, idk if this is the best idea though cus it looks wonkey and weird
yea replicating the root position is what probably most games do for ragdolls, but normally you wont move in ragdoll ^^
oh yeah dont worry that was just me messing around with it
so how would I go about accurately replicating the root position without it looking wonky?
when I implemented ragdoll I overrode a lot of functions in cpp (was a lot of stuff as I also wanted to change the capsule rotation, size, etc to fit when in ragdoll), but in BPs not sure just try to debug if its also wonky when you kill someone as many things can cause it especially when you move in ragdoll
well currently using constraints Im not sure if its possible to make it look nice with the constraints you can always see how the ragdoll is being pulled by one bone
Hello, I have been developing a MP environment; I can get into lobby, travel to map, swap PC data, no problem; both local (Editor Standalone Game x2) and remote machines (through steam). PlayerState derived class has a struct set to RepNotify, Rep Condition = None. However, it appears clients do not have OnRep_var being called, but the server side does for its own PlayerState struct var. The stranger thing is, it appears the PlayerState as a whole is not replicating at all on the client side. Is someone able to assist?
@naive locust is your playerstate class selected on the GameMode that is being used on that level?
@naive locust How are you setting those variables?
Hi @kindred widget, is it normal to take discussion out, or stay in here to discuss? By the way, thank you for trying to help me
I'm new here which is why I ask. Some discords like to have people go to DM so channels aren't flooded with one topic, some would rather just keep it in the server.
I don't think it matters much. No one's really talking in here, and I find forum/public problem solving helpful.
I agree on both fronts. OK, I am in a derivative of GameStateBase, I take the PlayerArray (a default var) loop through it, for each element, cast to my PSBasicPlayerState, set it to a TEMP var, use Make structvar node, connect values, then use Set Member in Struct node, and then on my TEMP var, I set that struct var with return of Set Members
so the end looks like this
the server side gets the REP_NOTIFY, the client does not
and so, I put some debugging on client to see if their playerstate ever updates, at least with regard to this struct. It does not.
On the server, I can even see that the server copy of the client playerstate does have the right data
only me man, only me. I seem to run into the most obscure problems leaving people scratching their heads... this is no different.
If your repnotify isn't firing, then that means you're not setting that variable on the server. Only the server can multicast or replicate variables.
Where is that execution line coming from? Where are you calling it?
GameMode event calls Event on GameStateBase, then from that event, I call what you see: which is a function. So, here are the images in order of execution
First
Second:
and third: the start of that function that ends with the first image I posted:
Sec, let me replicate and see what happens.
Trust me, it will work for you ๐
Does anyone recommend any specific services for (cross-platform) skill-based matchmaking? I've been looking at GameSparks and Playfab but just wondering if anyone recommends any alternatives. Is the Epic Games one working yet? Thanks in advance.
@naive locust Okay, now that I know that's all working, next question is when are you calling that function in the gamemode?
During an initial load for a game. So, the player has already traveled, and their playerstate is created before this function runs (i get the count of the playerarray length as shown and it matches the number of players each time).
I mean, the server copy of the client's playerstate has the data, I can output that from the server, but the client's version of the playerstate sits at its default data
I've even run ForceNetUpdate at the end of the first image on the PlayerState, nothing
I am thinking that you are thinking the playerstate hasn't yet been created on the client side when this code is running. This is possible, I will definitely check that. I can run a timed looping mechanism to check if the client's playerstate is there before proceeding, do you think I should go down that road?
These are the replication settings on the PlayerState. I have also tried it with Net Load On Client.
and here is the replication setting on the struct on the playerstate:
i also want to say that the playerstate, for the serverside replication (the onrep notify that runs for the player on the server) runs at least every second. I never get a single replication event on the client, so if the playerstate happened to not be on the client during the time of that set, the playerstate should appear at some point and I should get replication events happening, right? but I don't which is the weird thing
@naive locust On the server, you can see client's stats just fine from their player state? Cause my last thing to question was where you were setting the tempref var for the playerstate.
I even made a little test struct and added all of the switch has authority stuff and I'm getting little hellos from the repnotify function.
yes, so on_rep notify runs on both server and client, at least that's how I understand it. So, inside the onrep function, i output whether it is the server or client, and what the values of the struct are. And, the correct values print out for who would be the client. They are different from the player on the server also
Oh. Interesting.
I actually didn't have one thing set up like yours which I just switched. Pretty sure I found your issue.
i'll spin 'er up and try your suggestion
I'm FAIRLY sure that the notify doesn't know how to call the repnotify function when it's not in the same blueprint. Since you're setting the struct in the gamestate, it has no clue what it should call. Pass the struct through a function or event into the playerstate and make the playerstate set it's own variable with notify.
Cause, I just set that up to do the same thing in the Gamestate and it broke everything that I just had working.
no, f'ing, way
i am going to try that (it's 4:18am here) may I ask what time it is by you? I am trying to finish up a final exam (at home b/c of covid 19) and i'm going to do this tomorrow and I would love to let you know the outcome. I do have another on_rep that does work. This is a pawn reference on the playercontroller. When ONPossess runs, I set the reference to the returned pawn in OnPossess input. Then, the OnRep function for the pawn runs for both client and player on server. but perhaps playerstate has some limitation from gamestate?
Computer Graphics final ๐ I look like crap
@kindred widget so, trying to set playerstate from gamestate broke onrep from variable on playerstate?
Lemme show quick.
go4it
Ah. Nope. Nevermind. That was my dumb. Helps to connect all the right lines. That theory went out.
Honestly, I'd consider deleting the variable and renaming it, setting it back up and seeing if you get the same thing. Maybe it's just a bug.
It is worth mentioning that when I was setting it on Gamestate that I wasn't actually setting anything, and it was calling repnotify on the server, but not on the clients.
i'm nto sure i follow
This is in gamestate, I forgot to plug in the SetMembers to the SetVar
It still called Repnotify on the server but not on the clients.
If I plug just that in, it starts working on the clients as well. So, that's all I got, but I'm setting it the same way you are.
right, did you check to see if my class settings and replication settings for the struct var are the same?
I'm wondering if i have something set incorrectly on a class that playerstate depends on, incorrectly, perhaps playercontroller or something
would you mind posting in a DM to me your Pawn, GameMode, GameState, PlayerController, and Playerstate Class settings for replication?
at least then I can compare with someone who works
I haven't changed any of those settings. All of my settings for all of those are default at the moment.
gotcha
thank you for your help Authaer. I will try checking all my settings on all my classes and then delete and recreate teh var to see if tha tworks.
Just curious. What do you have in your notify function?
it first tests if not the server, or if the server if it is a local controller, and sets Widget values (a HUD, but not using hud class)
but i also have logging now to see if things are transacting
Can you put a print at the beginning of it and see where it's printing? If your clients ever print.
the client never prints
But server does?
tht's what i was trying ot say earlier
yes
the server's local player
and the server version of the client (through rep_notify)
I'd seriously look at that struct. Maybe try setting it differently. I don't know. That's the only way I could get it to not repnotify on clients.
i believe it ๐ its just me man
i'm hot garbage
always run into these obscure things
Nah. People notoriously have issues with structs.
For a start, what happens if you take out the SetMembers part and plug the make directly into the set node?
i was thinking ot try different methods of what i am already doing there as a test
i've been on this for 3 days mate ๐ฆ
I wonder..
Can you give me a screenshot of your struct default values from the playerstate?
Those two blue references going into the Make on the struct, are they actually valid?
Because if they're not valid, you're not actually changing anything, therefor the server has nothing to tell the clients to change.
they're definitely valid. this works fine on single player and the server gets the data. Also, there is a byte value (total laps) getting passed in
i'm telling ya man
its a bit of crap luck. i'm going to try the things you suggested
try this
nvm
you already trid it
time for me to get to sleep
Still incredibly sure that it's just the struct. If the notify is running on the server and not the client, then the variable hasn't changed.
i will give it a go. Thank you so much for trying to help me Authaer
Anytime. Always up for a good puzzle.
๐
Hey, tried an extremely basic built-in ACharacter replication in-editor test with network emulation with upload/download times of between 30-40 ms each, and I am getting some extremely jittery results https://gfycat.com/CaringUniqueKissingbug
the motion blur inconsistency makes it extremely obvious incase the fps is too low on that capture
It seems like ping fluctuations are causing the character to jitter (low ms results in a closer-to-server approximation while high ms results in a further-from-server approximation) resulting in jittering (that is my theory at least)
I was wondering if anyone here can confirm this is indeed the case, and perhaps share some insights for what it takes to create a more fluid character replication
I'm down for implementing my own Pawn replication from scratch if that's what it takes
Hello everyone. Very urgently need help finding servers in Steam. Who can help?
So I have a weapon that is spawned by the playercharacter as a separate actor and then attached to socket of a mesh component. Typical weapon spawn. I have the self reference of the character fed into the weapon's spawn. I ALSO have tried to setowner on the weapon to both the playercharacter and the playercontroller. Weapon actor is set to replicate. However, no matter what I do, I cannot seem to get this weapon to call a server rpc on itself. I'm trying to call left click in the playercharacter and have that call a client event in the weapon, which calls the serverRPC in the same weapon. Server RPC never fires when used from a client. I'm led to believe that SetOwner was also the NetOwner for this object. Any actor that has an owner that is owned by the client should be able to call server RPCs. Or so I've read. And yet I can't get it to work no matter how I spawn the weapon or set the owner. I'm either trying to do something dumb or really not understanding this.
I should come on here and leave long paragraphs more often. I always figure it out fifteen minutes later. Didn't replicate the variable to the client for it to use to call the right event.
Hey, I have created a server list where you click on the server you want to connect to to actually connect. This works fine the first time but if you return to the main menu and click on a different server it takes you back to the one you already connected to, any ideas?
how are you traveling to the server?
with ClientTravel
Could this be an issue with using NAME_GameSession for hosting and joining sessions?
yeah likely
Hello everyone,
Iam currently creating an AnimBP and iam trying to replicate my AimOffset. It works fine when my characters are near eachother, but as soon as they are like 5 Meters apart from each other, it stops replicating.
I would be grateful, if anyone could help me.
@twin juniper Have you changed any default settings for LOD or relevancy? That doesn't happen by default.
I think I changed something with the LOD, iam looking into that, thank you for the quick reply!
I know AimOffsets in the animgraph have an LOD setting. Should be default to -1 though.
Yeah, I had it at 0, but when I change it to -1 it gives me a warning "AimOffset 'Hip_AimOffset' contains no LOD Threshold", do you know why that happens? (sorry if iam stupid, never really used animations that much before xD)
Mine is a 1d offset, but that LOD setting at the top is what you changed and it gave you a warning?
yeah, if its at -1 it gives me a warning, thats why i changed it
Does your mesh have any extra LOD settings?
Its the default mannequin, but no extra LOD settings
I doubt that it's that then. The -1 warning is probably just a warning for 2d offsets since they take more performance than a 1d. The -1 should still work though. Even your 0 should work.
When you get out of range, does the other player's pawn recenter their offset or does it stay where it was at. If you change it and then reenter the 5meter area, does it change to the new oriented offset?
same with 1D, the 0 wont give an Warning, but if its 0 then it stops working after the 5 meter radius
it recenters
Hmm. I am setting mine a little differently. In the Animblueprint it's the exact same, but in the Pawn, I'm setting the Pitch on tick, but I'm only replicating it to the server 45 times a second to have it replicate to every other client that isn't the owner of the pawn.
Timer started on beginplay
Collapsed graph being ran on tick behind a Remote side of SwitchHasAuthority.
Thats a way more effecient way, thank you :D
But about the warning, should I just ignore it?cause it is still happening
@twin juniper I mean, setting it to 0 is the same thing as -1. I think it's just a performance warning so that you don't render an actor WAAAY in the distance, and still needlessly update the facing when they're just a tiny dot on the map.
somehow it isnt, when i set it to -1 the aimoffset works all the time, when i set it to 0 it only replicates in the radius
Hello guys, i've been working on the multiplayer project and for now i've created a dedicated server, but for some reasons, i can't see info about it, but i still see him in server list(it;s just empty line with 0/0 players. more over i cant join it. joining session function return fail. i checked my logs and found this line : Warning: OSS: Invalid session info for session GameSession in GetResolvedConnectString(). Do you have any idea what's wrong and how to fix it?
did anyone ever tried making a real time strategy? and successfully have 100's of units?
@narrow prairie Having 100s of units is not really that bad. You just need some optimization. A HUUUGE one for characters is turning the tick rate of their movement component down. I did that once as a test and my FPS nearly doubled with about 120 characters on screen with two player viewports up.
Animations and movement will tank FPS if left uncapped. It's really important to focus there on projects with character classes for some seriously easy optimization.
im not rlly that familiar with tickrate on movement component, mind shed a light on that where to find?
i mean, at 100 units not moving at all. i get these fps
i disabled almost everything inside the character movement component
you want to also use Animation Sharing
if all units have the same movement and stuff
i was experimenting
the documentation of animation sharing is rlly rare
yup
or hard to find
i coudnt understand it
same as assetmanager, etc
Goodday Guys
this is the Score Function in player state
its just adding point for server ( Host )
this is how im calling the function in PC in Add Kill Function
i've tried to change it many time to run owning client or on server to test same
i think because the kill function running on Server
@meager spade i downloaded a skeleton from mixamo with only 25 bones, that also saved a ton on performance
yeah skeleton updates are expensive
im pumping out 50 more units
so im at 150 now
with 45 fps
in pie
so thats getting somewhere
check stat rhi and draw calls, maybe you render too much. artists for example setup characters with insane amounts of materials. also triangle count can be an issue. cloth sim is a big issue (may spawn characters very slow actually)
seems indeed i have insane draw calls going on
im not rlly sure what "normal" is
but over 5k with 100 units
change on scene lighting, eg disable shadow it will drop the calls to the third
i prefer characters with least amount of individual materials
are you using LOD's on your meshes and MIPMAPS for textures?
lod can help indeed, but your lod model should use less materials, preferably 1 or 2 at tops
@rotund sapphire that is definitely something i remember the Unreal expert on optimization had on his livestream about optimization
2 tops, maybe 3 pushing it
good call ๐
i have lods aswell, ye only 3 of em
im not sure if the textures are handled in some sort of way
i mean, its dependent on game, but i think the optimization video had 5/6, not sure.
mipmaps?
@narrow prairie
that is the course where you'll find a TON of performance optimization techniques on the Unreal Engine website online learning section
Suggestion: Get into the habit of using software like OneNote or Johplin to build a notebook of Unreal Engine stuff you learn along the way. Never memorize things that are lower than surface level, always document
Big Shoutout to Victor Lerp. I love it when this guy hosts livestreams. Far better than Alex Paschall who just talked over everyone all the time and felt the need to finish their sentences.
question
this is running much better then where i started today
are you using material instances for all those soldiers?
no
ok
i dont think so atm
would that also help?
the advise u gave about textures rlly increased a lot of fps
its having like 6 mat id's atm
i should prolly use a 3d application and try to confine it into one
I cannot comment on that. that info i gave you earlier talks about master material and material instances
6??? jeez man
srry i did not see any link
the learning path
I would absolutely spend a few hours and understand the optimization techniques there and how you can apply them to your setup and see how much more performance you can gain. Do you have a lot of printing to a log going on as well in tick?
lotta mercy
again, thx for advise rlly helped me out a lot
do somebody know, what argument should i pass to ue_log() to show the name of the session. i mean i dont know the type that this macro accept
UE_LOG(..., "%s", *FStringtype);
@fast arrow the question is, do you understand why you need the asterisk there?
in there, kind of hidden, you will find your answer
Thank you)
But this was only part of my problem. i've created dedicated server and session but i cant join it, though i can see it in server list (but the name of server is empty and it has 0/0 players). there is this line in my logs and i cant figure out how to fix it "OSS: Invalid session info for session GameSession in GetResolvedConnectString()"
that part i will not be able to assist. So something in the call to GetResolvedConnectString is bombing the OSS
i just dont know hot to debug it correctly, because i use blueprint for join part, and function join session return false and it seems like blueprint search result is empty.
you can take a look at shootergame example from epic has setup for oss and just works
it seems EPIC launched some new stuff about the online services
Documentation for Epic Online Services
was this announced somewhere?
barely
is this new or i just didnt notice
ye, i was actualy trying to find something on ranked matchmaking using their services
whaat, that's awesome. I was super curious when more would be revealed about the SDK.
is there any difference between the sessions nodes and the "open ip" command? Oc there are more features for the session nodes but I mean an advantage like a more stable multiplayer experience or something?
sessions allow you to get the ip in the first place
Or to not have any at all
using Steam net
once you connect there is no difference how you did it on the network performance
Ok, thanks!
Is ServerNotifyLoadedWorld called when the client has finished loading the map? Or when they start loading the new map?
looks like it runs twice? once when they loaded and initialized the transition world, and once when they loaded and initialized the target
ah hmm I'm trying to call something server-side when the client has finished loading the map. Looks like ServerNotifyLoadedWorld is a sealed event
Hm maybe I can still override the _Implementation
looks like the whole point of sealed event is to make it not virtual
bit weird that that even exists
yeah ServerNotifyLoadedWorld is sealed though. I wonder if I can still override ServerNotifyLoadedWorld_Implementation
nope, didn't work :/
There are literally 8 sealed events in the entire engine
implementing that feature was definitely worth it
lol
@jolly siren GM has a client side callback
er
GS
me and zlo was looking through this the other day
i actually think we ended up giving up
cause we hit the same shit you did
Looks like ServerNotifyLoadedWorld has always been sealed. Sealed by Tim himself
Right, that's why I was going back in history to check if there was a reason stated
yeah I think I'm just either going to unseal it or add a virtual callback
lol ๐คฆโโ๏ธ
we were looking for a nice callback to do stuff when all clients have finished loading the level, just a simple thing
ended up making another RPC
cause we dont use source engine
Right, yeah I'm just hooking up EAC authentication. But want to do it after they finish loading the map so slow machines don't timeout
how do you get access to EAC? 
๐ง
how to call replicating using on server side?
DOREPLIFETIME_CONDITION(ACPP_DesertCharacter, bIsPlayerMoveForward, );
Just call the function on the server when you change the value
bIsPlayerMoveForward = true;
OnRep_IsPlayerMoveForward();
I'd probably make a setter for that too, and have it call the OnRep if the value changes
iirc OnRep is called everytime the value is updated. Even if it doesn't change.
I'm not 100% either way, but the documentation says otherwise https://docs.unrealengine.com/en-US/Resources/ContentExamples/Networking/1_4/index.html
An overview of the Network Features example level, example 1.4: Variable Replication (RepNotify).
Oftentimes, it is desired to execute some logic in response to the value of a replicated variable changing. Variables that are marked RepNotify, have a special function called automatically any time the value is changed, on both Network Authority and Remote Machines.
I think the oversight is: if the value of some replicated var (int) is 100, and you overwrite it with 100 (with a set) I would think RepNotify would run
I mean, right now, I'm having some issues with replicating structs and onrep notify is NOT running on the client
we've run into the issue where the server is executing the rep notify before the client is even ready for replication. It's a difficult problem to solve.
Onrep wont call everytime its changed
Only if the value is different
In c++ there is way to set it as repnotify always
Not sure that's possible in bp
im having some trouble displaying the player list in the lobby, i followed this tutorial but the client doesnt see anything
if i print something in the event that adds the player to the list it only prints on the server, so the client must not be running the event although they are replicated 'run on owning client'
here is the thing "Run on owning client" is not equal to "run on client"
if its owner is not client
then yep it wont
and you dont need to manually add players to a list
i know that there is a list in gamestate
you can access playerlist made of playerstates from gamestate
i was gonna fix it up when i got it working correctly
https://imgur.com/a/EY0wrc1 these are all the blueprints
you guys are funny ๐ I love the popcorn image
that is the gamemode bp
that is your reason
gamemode doesnt exist on clients
therefore its owner is server
put that client function where a client can access
that event is run on server then replicated to clients
one of the safest place, i feel, to do client calls is playercontroller... the client owns the playercontroller; just a statement, not in response to anything
the add player event is in the player controller
here is the thing
it is not replicating to clients
as I said
Run on owning Client != Run on client
in the large image, it appears he's using playercontroller to run an event that is marked for run on owning client; why wouldn't that run?
ooh
PCLobby is a playercontroller, the client owns the playercontroller
alg lmao
help, someone get this guy a drink
although resdun, why do you have the actual event on the gamemode marked as run on server?
cautiousness?
idk just followed the tutorial
i tried that yesterday and failed it just wont replicate to clients
should i put everything in the gamemode bp into gamestate
also crazy theory but still
sometimes when I Call a "Server" function
on my widgets
it wont get called
unless I chain it to some actor with replication
it might be because
server doesnt recognize the widgets
it might be the same with gamemode
clients dont have it
there fore maybe not able to reach there
try printing something
from within that function
and see if it reaches
the gamemode function
then it doesnt reach client
yep
try to move your code
or you can create a chain
that was stupid
it works for the client one
but might not in serverside
just go to some actor
that is both on the server and client
and call it from there
for example
instead of moving your functions
make a caller function
in idk gamestate
and call the caller function in game mode
idk if that made sense
yea, ill give it a go
dont make the caller function client
well u know the problem
fixing is the easier part lol
finding is kind of annoying tho
I personally dont work too much with gamemode
didnt really need it but would be happy to know its exact purposes
the gamemode is where you keep like scores and such
so people clients cant change scores etc
i thin
@kindred widget to get around this struct business, I am doing a manual transmission by way of calling an event on the PC from the GameState (which is where all of the manipulation of playerstate occurs), I check if the current struct = new struct, and if it does (meaning, no data changed, for instance, I run a job every second (I know it's cheesy but whatever) on the GS every second that updates the position of each player in the race, if the position didn't change, and nothing else in the struct changed, then no need to call the client, so it is somewhat more efficient than making constant reliable calls to client
I honestly believe something is wrong in blueprints when it comes to struct usage, replication, and onrep for the client
i know how to do replication like in characters - all in the same bp but i cant get my head around replication and sharing info through multiple bps
@stray gull map it out on paper. Most people when they see the mountain to climb to see if something will work, they either procrastinate and/or just don't do it and figure out another way (sometimes better, or nothing at all)
One way around that is to get your brain to secrete constant dopamine and trick it. to do this, do what [good] workhorse developers do (not rockstars); write one atomic piece of the puzzle, test, SUCCESS = dopamine, go to next one
This is why SQL rocks IMO because changing something in SQL takes almost no time to change, and you can make yourself very happy (and others) a hundred times a day. It takes very little effor to see things come to life in SQL.
i dont even know the steps. so for firing a gun... you would have a multicast event and a run on server event, the server event would run the multicast and then run the fire function. and you would do a switch has authority to decide which player runs which set. like that, but i dont know if its the same steps or.....
I don't understand the last part: "and you would do a switch has authority to decide which player runs which set"
where?
is there a way to use $_post with ue4 (PHP btw). Im making a login system, but im entering the credentials using the url or $_GET, and the security problems with that is pretty obvious lol. is there a way to use $_POST for it?
anyone tried using the OnlineBeacon classes? can it be used to low 2 servers talkt to eachother?
@keen thorn i have and am currently using lobbybeacon classes as well. AFAIK if you wanted 2 servers to talk to each other you would need to make a client beacon on one of the servers and have them connect to your host beacon on the other server
Is there a way out of the box to support 'instanced areas' in UE4? For example a player goes into a zone, potentially marked by a collision box and they can interact with the world but they and whatever they do is invisible to all other players on the server? For example placing down meshes with collision (so the server still needs to have knowledge of it but other clients don't get blocked by it).
Not really
@barren warren
You wouldn't use ue4s servers for that anyway
At least not only
Could anyone point me in the direction of how i can make a server inside of a masterserver? Similar to the ark/rust type browser system
Basically I donโt want a create server button inside my game, I want to be able to make that elsewhere and my browser will listen for servers
@heavy aurora If I understand this correctly: create a vertical box widget in your main window (in here, it appears you could use a horizontal box and inside that you're using vertical boxes), the middle window would be empty. Create a new widget for displaying the server data row. When the client polls to get a server list, they should get an array of some struct (the struct being the server row data), then the client iterates over its received struct array and for each one, creates the widget server data row from the struct, and adds them as children to the server list window
Why does the client see the weapon/item from the server, but the server doesnt see the one form the client? Thanks for any help!
replication only works one way: from server to clients
your server has no idea what your equipped item is
and that design is non-viable
from unmaintainable, to that single blueprint causing half your game+ to get loaded at the same time
So how should i do it?
In this presentation from Unreal Fest Europe 2019, Epic's Sjoerd de Jong offers an in-depth look into Blueprints. Best practices, dos and dont's, and recommendations on how to utilize Blueprints to its full potential.
During this advanced class we will go into how to use Blu...
In part 2 of Blueprints in-depth, Epic Games' Senior Engine Evangelist Sjoerd de Jong goes over crucial, but rarely covered topics, with a goal to level up a range of viewers - from those with a working knowledge of Blueprints to users that are fully and professionally profici...
Multiplayer is extremely hard, make sure you're ready to spend a large amount of time
I absolutly am
Head to the multiplayer doc : https://docs.unrealengine.com/en-US/Gameplay/Networking/Blueprints/index.html
The various aspects of multiplayer applied to Blueprints.
Thanks
Why does the client see the weapon/item from the server, but the server doesnt see the one form the client? Thanks for any help!
@scarlet cypress Can you tell me what id have to do different here?
Replication is only server to client
You can't create objects on the client, and have them exist on the server
so how would you do it?
Your issue is that you're not setting your variables on the server, so they're not getting replicated. So when you tell the server to multicast like that, it's still using default values and not the ones that the client changed.
Alright thanks!
So id have to make a event "set new value" (on server) passing the variables?
Remember that if you ever want to RPC to all, or update a variable on all other clients, you have to RPC to the server and set the variable there. Then it'll replicate correctly.
These may not be the greatest examples. Still learning myself, but here's how I'm handling state changes for my player character.
Now it works! Was actually pretty easy..
Yall could have told me id just need to pass the variables..
Passing them works too. Just depends on how you want to set it up. Just remember that if you want to replicate a variable, the set node has to be ran on the server's side.
Yeah i learnd that now thanks!
I had a huge issue learning networking stuff at first until I realized that an RPC was nothing more than a fancy way to say "Event that gets ran on a different machine"
In my case the server doesnt have to know about these variables until you switch weapon/item, so passing the should be fine.
@scarlet cypress there are some things you have to keep in mind with multiplayer. #1, everyone has an instance of the game running on their machine (this is obvious but look at it deeper and it becomes wildly complex). #2, the server maintains copies of many actors that also exist on the client, including playercontroller, playerstate, gamestate. In some client instance, there exists only one playercontroller, the server has its own copy of all playercontrollers; the gamestate contains all of the playerstates, and because the gamestate is replicated to all clients, the playerstates for all players are also replicated to all clients. You as a client have your own playerstate that is updated through this replication mechanism. #3, the server is the entity that tells everyone elses game what to do so everyone is in coordination with each other. Without telling the server what it is you want to do (for example, move a pawn) and have the server replicate as needed, then only your game is updated with the delta.
I tell people to look at it this way: make believe you're playing a game of checkers with someone remotely over the phone, and you have a mediator in the middle who is keeping track of checker movement. So you want to move your piece; you tell the mediator to 'replicate' that delta to everyone, including you, to move the piece somewhere (including the mediator himself). After everyone has processed the command to move, everyone is now synchronized; you, your opponent, and the mediator all have your piece moved to exactly where you want it without you actually touching it
in the most perfect world, the only thing you are doing is providing input, that input is then only processed by the server to replicate out, and anything happening on the server is then replicated out. So, your machine, in a perfect world, is nothing more than a dumb terminal
Thanks a lot!
obviously we don't live in a perfect world. Games are meant to be illusionary. Some things are done on the client only, for example, particle effects should only be done on the client side and not replicated out because usually particles do not affect the gameplay, they are only there for making people go ahhhhh, and hence no need to replicate something like that.
is there a way to use $_post with ue4 (PHP btw). Im making a login system, but im entering the credentials using the url or $_GET, and the security problems with that is pretty obvious lol. is there a way to use $_POST for it?
Bit of a noob question here about multiplayer workflow. Do people tend to build a multiplayer game (that is intended for online play) with hosting LAN sessions? At what point do you test with say, the Steam Online Subsystem?
i never used LAN, i used IP to connect
then switched to Gamelift near the end of development
I would test with Steam near the end of development for logic
I've been following the official BluePrint Multiplayer tutorial. https://youtu.be/abmzWUWxy1U
In this video we take a look at the finished project and step through each of the features that will be covered in this series. We show our functional Main Menu and its options, a lobby where players can chat with one another and select their characters for the game, some serv...
and I'm getting this message in the log"Unable to create OnlineSubsystem module Steam"
Cannot for the life of me figure out why it's doing this and wondered if I can tackle the online part later and setup the game locally with LAN play
@shy kelp might look into what you mentioned instead if I need to test with remote players
@stoic acorn It depends. each subsystem has their own niche requirements/setup/use cases. Steam has things that lan doesn't have. For example, achievements, a friend system, invites, etc. So, if your game is going to be on steam, then you should test it on steam, if you're going ot add additional components like i mentioned, or other steam subsystems, then you need to test those. I think working out the kinks of the base logic in LAN first is the first step; once the game 'works' as intended, then start moving to online subsystems
think of it as extra layers on top of the base multiplayer experience; get the base working, then add additional layers
ok brilliant thanks guys. I'll test the majority of the work with LAN first. I have maybe one requirement from Steam and that would be Leaderboards
ah, Wes Bunn, I love Wes Bunn's streams.
Hello I have a problem I have a dedicated server but it detects me but does not make me join ideas?
[2020.04.25-12.21.50:306][791]LogNet: UNetDriver::TickDispatch: Very long time between ticks. DeltaTime: 679.83, Realtime: 679.83. IpNetDriver_2147482588
[2020.04.25-12.21.50:306][791]LogNet: NotifyAcceptingConnection accepted from: My ip
[2020.04.25-12.21.50:306][791]PacketHandlerLog: Error: PacketHandler parsing packet with zero's in last byte.
[2020.04.25-12.21.50:306][791]LogNet: NotifyAcceptingConnection accepted from: My Ip
[2020.04.25-12.21.50:308][791]PacketHandlerLog: Error: PacketHandler parsing packet with zero's in last byte.
Hello, does anyone know a good way to replicate movement for ProjectileMovement Pawns? The default Replicate Movement option gets extremly choppy on the client when I spawn more than 20 of them.
@stoic pebble what is a projectilemovement pawn? are you talking about a pawn with a projectile movement component?
Yes, I want to visually replicate a pawn that is moving with the projectilemovement component on the server.
It's not really recommended to replicate fast moving objects. It's also generally a waste of network resources. This is why a lot of games multicast spawn the bullets in the same style and make it look as similar as possible.
Anyone have a solution for this on null subsystem? Maxing out on 16 players over a dedicated server.
Well i got my sessions working over wifi now but no idea how. However, upon joining a session the client does not go to the server's level. What usually causes this problem?
Im assuming 16 players is not a hard limit?
On the server side I just Open Level with "Listen" option. Do i need to do something more?
@elfin cliff I have read that 16 players is a hardcoded limit but can be changed if you alter the engine code and rebuild the engine
@elfin cliff I have read that 16 players is a hardcoded limit but can be changed if you alter the engine code and rebuild the engine
@peak star Oh. Do you have any idea what i can change and where?
@elfin cliff sorry I don't remember which file it is
Thanks for the direction though. Have been going insane since the morning.
whats this
@elfin cliff I found it just by googling, and I think there are some answers on answerhun where I read that
Hey is there a way in blueprints to set the name of the session to something more friendly than the machine's name amd MAC address?
So when it shows up in a server list it can say "Bob's Game" for instance?
For multiplayer are there best practices for keeping replicated variables to a minimum if you have a full set Resists, Stats (Str,Dex,Wis,ect), Regen Values, Multilpe Resources (Health, Mana, Energy), and Modifiers (Crit/Dodge/Block).
If all of those change consistently through the game, they need to be set to replicated correct?
I've tested keeping less-changed-often variables to change on the server but send a client event instead to update the stats. It works but I'm curious if there are any other techniques
@peak star But im not using sessions at all. This is all in Null Subsystem. Found a config var MaxPlayers, but changing that does nothing.
@tawny parcel anything but the variables that change constantly (health, mana, energy)
Whats strange is, in the editor, if i set number of players to 17, and preview in new window, it still ends up with one that doesnt connect.
@peak star
can be loaded from a data asset and have only the modifiers replicate, have each machine recalculate
Yeah i was asking people for help on a problem on my project.
For your problem I think the maxplayers doesmt do anything past the actual hard coded limit that you have to change in the engine source code
Dont mind doing that. Am running on source anyway.
So you can make it lower than that amount (16) to have an effect, but no effect if higher than the hardcoded limit. That is what I have read anyway.
So the max players config is limited by the hardcoded limit
Any idea how i can go about looking for this in the engine source?
@winged badger Alright so the stats would be derivative from whatever gear buffs or w/e they have equipped type thing.
I just dont know which cpp or h file to change without searching the web again and I am babysitting right now
pretty much, if you do have RPG like progression
Haha! So am i!
its fairly easy to sync the changes, as they happen rarely
@peak star Thanks though. You pointed me in the right direction. (I hope)
not replicating the same thing more then once is the important part
Its more for my tool right now and I'm just thinking of optimization
and while that helps bandwidth its not your main consideration, the more places you replicate the same data in, the greater the chance something goes out of sync
gotcha good to know