#multiplayer
1 messages ยท Page 330 of 1
well they never touch the flying project ever ๐ ill check it out
well, i was thinking of a procedural racer
but i have had like 20 ccorrupted projects due to splines
when trying to gen a proedural spline
do both of your players spawn in at same time? or couple miloseconds till 2nd one spawns in ?
idk hit play a bunch of times not getting the problem......... however if i turn dedicatedsrv on i get the problem 100% of the time
yes!
thats my problem
i remember i changed something
then it spawned a few times
actually
idk
u make sure to delete the pawn the level comes with?
for multiplayer its best to delete that pawn, so the player start takes over
ive networked movement
oh
no i did
yeah soz
thought u meant the blueprint sorry
this has happened with all of my networked projects
for this video i had to just keep playing until i got it https://www.youtube.com/watch?v=q0fDsBcVv-I
any ideas?
are you still there?
ASKIN THE LORD TO FORGIVE ME I SHAT MYSELF AND COULD NOT SOLVE THE PROBLEM
Do I need an OnRep if I'm already calling a function with RPC
OnRep is for Variables @glad sedge not sure what your on about
@fossil spoke do you know how to fix one of my players spawnign at 0,0,0
it's a new project, 2 player starts.. when i set it to dedicated server it happens, not on non-dedicated
Is it trying to be spawned inside Geometry and it cant resolve it?
They arent overlapping any solid geometry
Does the character fall to the ground or does it remain in the air?
@fossil spoke ah I mean OnRep_..
it's the flying project
and if you are asking if they are in a collider or something, no they aren't
Does it happen in an blank level with just an single PlayerStart?
Does the pawn have an SpringArm?
Disable the Springarm and see if that changes anything.
ok will getbakc to you
@glad sedge If you dont include an OnRep_ as required you usually get an UHT error in VS im pretty sure.
So if its still compiling you may not need one.
hrmm
I'm still strugging with the architecture
but they spawn very close when it seems it "wouldn't work"
Ive had issues in the past with MP and Springarms. I cant remember how i fixed it though
damn
whatcan i do
is there a way to assign one player to each start?
i thought thats how it worked initially
You can override a couple of functions on the GameMode that control spawning behaviour. I usually just roll my own custom solution to player spawning though.
yeah, that requires c++ tho
No it doesnt.
There should be 2 functions you can override
Hover next to the Function category and an "Override" button will appear with a list of functions you can override
FindPlayerStart i think is the one you want to override.
Theres another one though
Cant remember its name
Yes
for mp spawning
Yes
@fossil spoke I'm moving an actor with my character's PhysicsHandler - how does that work? I call OnServer on PhysicsHandler on tick?
after you help brent, where is this function category
nah help Vectorz first - i'm jumping ahead of the queue
ty :0
Where you add functions
like where is this inside?
Where your function list is
Ohh in the GameMode class
Yes the GameMode controls the default classes for a few things. You will need to have an custom GameMode class in order to override the function.
i cant use the default one?
@glad sedge Networking Physics movement isnt super easy lol
welllllllllllllllllll shit
What type of movement is it? An thruster or something
yeah
but i have made it more complex
i networked physiccs based movement here tho
cuz i added thrust
to "aerial"
Im not an huge fan of Physics networking. I usually avoid it if i can.
Im probably the wrong person to ask tbh. More experienced guys on here that have tackled it.
If you let the server run the simulation and just push an transform update to the client that might be sufficient?
It gets complicated when you let the clients simulate it as well.
I love physics as far as cosmetics goes. But networked physics to me is to much hassle for what you get. You can easily fake "physics" more cheaply.
I've done the classic mistake of starting my project and going 'Oh I'll make it multi
I've only been at it for a day so it's starting to make a little more sense
Multiplayer is not something easily tacked onto an existing project.
Ah fortunately I can (and will) discard it
Its all experience. These mistakes and pitfalls make you an better developer/programmer at the end of the day anyway so when you think about it your not really losing anything.
Only time really.
heh yeah it's really how I learn
yeah, most devs are pretty old
As long as you understand where and why you went wrong you will come out better for it
why is that?
His code is messy as shit though lol
o rly? lol
There is an learning curve to UE4 C++ but it is definitely something all blueprinters should try and learn.
My workflow generally involves prototyping in BP and then moving everything to C++
I'll do that once I'm more experienced with C++
Right now the journey is its own reward etc
Porting BPs to C++ is an great way to learn it
I'm glad I got a reasonable amount of exp with BPs
still in high school
I think I may owe @heady merlin a beer for writing the advanced sessions plugin...
What is that for? Web sutff?
Steam
oooh
oh
Yeah I hear steam stuff is a right pain
Yeah its pretty good
I look forward to being crippled by it eventually
^^
The Steam OSS needs an update haha
im feeling so jubilated that my linux dedicated servers aren't crashing or failing to regognise steam ๐
Hey @fossil spoke ive looked at the override stuff but lol.. idk where to start omg
Just write your own spawning system.
and was the other one 'choose playerstart'
Ah yeah thats the one
ive got a bp spawning system, but it needs a lot more work
yeah
I usually just reserve PlayerStarts for Spectators and write my own spawning solution for Players
man isn't debugging code on C++ easier
Depends on what the bug is ๐
do you guys know where i could find some example bp spawning systems
because i'm either thinking the wrong way aobut it or
im confused
I have an MarketPlace package thats an spawning system ๐
It should be on sale at the moment i think
Did the summer sale start yet?
Just enter your cc into chat..
what's cc?
creditcard - just a joke
ohhh
haha ywah
soz i wont buy the asset devil
im a high school student, i aint got monay fo dat
Its $5 ๐
All good mate haha
๐ ^^
well, technically i am
my organs are worth alot
probs JUST enough to scrape that asset
Just mail me your Kidney
Hehe
but, like is it hard to make something really basic.. like each player takes 1 of the playerstarts
as long as i have the same amount of starts?
ik why u made the asset, theres fkin nothing on the internet about it
API ?
Just OnPostLogin assign an player an number 1 to n based on Player count
Then use that to assign them to an spawn point
wow, this override thing opens up so much networkign stuff
i didnt even notice it before
If you havent already you may also want to familiarize yourself with the GameState and PlayerState classes and their importance in the networking architecture
yeah
lol
ik this isn't about networking, however do you guys know why my procedural spline doesn't work
like, i want to make a spline with x points
and i do a for loop
and use add point
and add 100 to the X position of the last point for the next point
and even thatcrashes the project
and i can't open it again
You didnt accidentally create an infinite loop?
Should I have any issues with passing an actor via reference should I ?
well, i did a for loop and set the max to the variable 'points'
and points was on 10
You shouldnt really need to pass an actor as an ref. The pointer is pointing to the object ref anyway
yeah, guess I shouldn't buck the trend.
Hey, devils
i've done this https://gyazo.com/3611317a326446aafd604e5b671071e9
and it's saying it can't find a start
ohwait
What logic do you want for it though?
Basic stuff - PC - click on Actor - check if actor is of certain class / type - tell AChar to "hold" said item
Right now my PC is passing through to the char the actor to pick up
Do the pickups only persist as long as the player character is alove or are they like bind on account or something.
If they persist as long as the character. Just put it on the character.
argh
There is usually alot of differing opinions on where player input should be handled PC or Char. I usually subscribe the idea that the character should own its input controls. Others think the PC should
I think dividing it between the will vs the physical implementation makes sense
do any of you'se know why this isn't working https://gyazo.com/5b047a11b294fdad2622b71528f06f87
one of em are spawning in the ground
What is GetPlayerControllerID
You're telling that BP to put all the actors inside an array
Shouldn't you get an array of all the player Controller IDs?
Postlogin returns the most recently connected player
yeah, i thought it triggered every time someone joined
and set the position, possessed it
@twin sorrel You may need to Delay an slight fraction.
but, is the rest of the logic right?
Wouldn't you be getting the same value for spawning zone each time ?
but, isnt the id different
OnPostLogin is called as soon as an PlayerController is spawned and assigned to an Player. Some other classes may not be setup yet at that point.
Cause you're returning the total size of that int as a result index, no?
Im actually laying in bed right now. If i was at an PC id do you up an example system
Lol
lol dw
its just
do i have the logic right?
like player 1 will have id of 0
so it gets 1st "spawning zone"
and it spawns a player at that
and possesses it
Not sure what GetControllerID is actually returning though. What you should do is create an Array of Players and each time OnPostLogin is called. Add the new player to that array and use the array index they are assigned to as their ID
You would then have to maintain the other end of that though as well. OnLogout you would need to remove the exiting Controller from that array
yeah, ill try that
humm
yeah
well
cclearly this is too advanced for me ๐
i might just give up
lol
fuark
cya guys
ty for help
@fossil spoke appreciate help, just donmt understnad
throw some debug code and see what you're getting
No worries. Try tackling it another time.
Did anyone try clothing with a multiplayer game? client's clothes stutter on the server, but server's clothes seens fine on client
im using the in engine clothing
Sorry Takain, haven't tried it.
Sounds like it's becatuddering on other clients. If whatever your doing is replicating to the server its updates won't be as smooth and instant as local client
Does UE4 dedicated servers have to be on Windows?
Or does Linux work?
I'll need a dedicated server for a client to server concept
To build it for Linux
The guide has untill facepalm
Has anyone here gotten multiplayer working with vr and non vr players? I had it work momentarily for a second and then it crashed and no longer allows the vr client to connect to the non vr clients
Hello people! What's the best way to sync physics or at least simulated physics?
I have this item that players should be able to throw, where I'm using AddImpulse. However, this means that I'm multicasting from the server, so each client calculates the impulse and makes the throw, therefor unsynced.
What's the best approach to this?
If you check Replicate Physics it will be in sync, at least with small diferences due to replication rate
You can check PrimitiveComponentPhysics.cpp ConditionalApplyRigidBodyState - its where implimentation of rigid body interpolation lays
Replicate Physics meaning Replicate Movement? @tiny coyote
yeah, sorry, my mistake
But when I spawn it on the server, addImpulse, the clients only see the object where it's spawned, even though ReplicateMovement is on @tiny coyote
have you checked Replicated in spawned actor?
Yup
have you assigned RootComponent? does it have SimulatePhysics checked?
is RootComponent registered?
you can check AActor::GatherCurrentMovement, place there breakpoint and see why replication code is not reaching
Guys I have a scenario. I want to spawn a AI on server to follow one of my player. I send a RPC 'Server Call' from playercontroller to spawn AI. When I have 2 clients on server, it spawns the same ai two times. When there is only 1 client on the server it spawns 1 AI. What could be the problem here ?
in first case there is two playercontrollers on server, for two clients, thats why it creates ai two times
hi
help me
I have a problem with my game online ๐ฆ
I using Steam multiplayer and LAN:
when I want join to a lan game
I can't join, because the game say error :(, idk why
I think best I send screenshot
HELP D:
๐ฆ
I don't think a screenshot of your game menu will help us at all
Is multiplayer in UE that easy
but where is the problem on my project ๐ฆ
Wait for somebody to answer, spamming won't help ๐
xd
@tiny coyote If the root component is registed? What do you mean by that?
I have setup all the components to use the same root
@tiny coyote I call a server function from one client, why it will replicate on another client ? As I call spawning AI from one of the controllers on the server. How to avoid such situation
@tiny coyote Server call for spawning AI is triigered from Input by one of the client. And I do not want this fucntion to replicate on each client, logically a server call is made from one of the client on the server , as only one of them receives input.
be patient plz
You trying to join a steam session from the same computer as the one that spawned it on same steam account?
@twin juniper
Couldn't say off hand. There is sometimes problems connecting to your ow up address through steam so if the results are you able to connect to it through console open ip ?
kinda a UMG question but, can someone give me the basics of making all UMG widget components face the player
Just so i dont do this and set it for single player oops
god
spent the whole day trying to figure why cloth simulation was so bad on multiplayer
turns out its only bad on the editor
on the actual game its fine
ยฏ_(ใ)_/ยฏ
@brittle sinew got it working! ๐ Guess I was just too tired and grumpy yesterday ๐
I'm having a hard time getting my Child Actor Components to replicate properly
via c++? @gaunt kestrel
i have a UPROPERTY variable stored in a Character that's a pointer to another object in the world UPROPERTY(Replicated) ASpecialThing* Thing; . ASpecialThing has a very short network relevancy range (about 5meters). You can see how the problem starts, if some players are not in range of this actor it will NEVER be relevant to them, unless they get in range! However on the Character it is set on Thing is always relevant to that player which makes sense.
How to make Thing network relevant to anyone near the player that has it set to begin with?
Does anyone have an example project with a lobby function that works with steam? Basically, want to have a lobby to invite friends where everyone can configure their weapons, etc.. and then have the host pick the map and launch the game. I've seen the multiplayer examples, but nothing with a lobby that works with steam.
Does anyone here know about custom spawning in BP?
Thatcould help me
does the 1stplayer controllerID return 0 or -1
yeah
cuz when i printed it onpostlogin it returned -1 and 0
and it fixed my spawn system by adding 1
On postlogin you'd want to add the connecting controller to an array, and then on match start or whenever you want to do your spawn in just iterate thru the array and do the spawns
Just to confuse matters further, player controller 0 on each client is the clients pc
So it running set spline points on the array, and then adding another point to the array?
I know nothing about splines sorry :(
Anybody else using GameSparks?
Is it me or does replication/movement/everything else seem extremely convoluted compared to UE's networking layer?
Using binned2.
Increasing per-process limit of core file size to infinity.
Fatal error: [File:D:\Epic Games\UnrealEngine\Engine\Source\Runtime\Core\Private\Linux\LinuxPlatformMisc.cpp] [Line: 642]
Error Presenting MessageBox: No message system available
Signal 11 caught.
Malloc Size=131076 LargeMemoryPoolOffset=131092
CommonLinuxCrashHandler: Signal=11
Malloc Size=65535 LargeMemoryPoolOffset=196655
Engine crash handling finished; re-raising signal 11 for the default handler. Good bye.
Segmentation fault```
trying to run my server on linux.. any ideas?
Hi guys, this is probably a very dummy question, but relating to networking all ive been able to do is build a dedicated server, host it on azure and have a couple of friends connect.
Where in the middle of all this comes Photon for example?
In what scenarios should we consider using something like Photon?
Do we still use the dedicated server?
A general overview with some detail if anyone has time for that
@brittle sinew Nope, it didn't even generate a Saved folder
im so close, i can feel it
lol
Just curious, how did you get around the SQLite thing?
@brittle sinew Instead of building from pre-compiled libraries for windows, I just compiled the SQL (C files) source code specifically for linux
this allows me to build SQLite for any platform.
Ah okay, yeah
Without logs though, I don't really know what to say on the current issue
same
Question for you lethal, just a quick one, if i want to make an event thats client sided that goes off when server does any damage event
Do i just set it to replicate from server to client
If you only want it to go off on the owning client, yes
If you want it to go off on all clients, it should be multicast
@brittle sinew It's a VM, im going to try and mess with the permissions
this really sucks if i cant get it to work
because Windows servers are expensive
I would make sure you have a pagefile running
I've had issues with that running high-ram applications in VPSs before
It might be setup by default there, I know on DigitalOcean it isn't
I guess it's probably what you set it to in the initial setup, haha ยฏ_(ใ)_/ยฏ
Yeah, mine didn't even have a firewall
xD
Well it has iptables
but i dont like iptables lol
so I installed UFW
(UFW is basically the same thing, just its a lot easier to use than iptables, I think its still just using the iptables built in stuff though)
heyyy
i got it
And then it crashed
๐
Anyone got any advice on storing a health value before it gets updated by replication?
I feel like this is a stupid way
I need 1 to run before health gets replicated and one to run after it does
You have no guarantee of replication order when intertwining RPCs and RepNotifies; I know in C++ you can set up the RepNotify to send the old value
Ahh okay ๐ฎ
Or possibly just send it via a parameter in the first RPC?
hmmm good idea
@brittle sinew Hey so I got my server to run on my vm
However, i cant seem to get it to show up on steam O_o
these are the ports i opened ```
54244
8766
27015
7777
27016
Just to ask again. Anyone know how to get the port null online subsystem has picked for dedicated server after its launched?
I think the port is accessible via GetAdressURL when using c++
Yeah I saw something on that I'm using bp so might have to make something to expose it ehh
GetWorld()->URL.Port
Wonder if I can just tack this code in my own game instance class and rep aren't my bp with that child of game I just want it exposed to get when a ded spawns so I don't have to rely k. A user to configure an I I correctly lol
Ini
Question: Are event dispatcher calls replicated by default or does that depend on what event that calls its?
There not replicated by default
Yes and no. The problem I am trying to solve if it's already using 7777 it will increment and I want to be able to get the currently used one so my heartbeat to a custom master will be correct ๐
Ahhhh, I see I see
I'm not much a c++ coder but see what I can do to expose that GetWorld url
Not high on priority that's expecting users will want to host multiple servers on the same box ๐
Hard enough time getting someone to test multiplayer with me hahaha
Anyone know righ toff hand why ping always says 9999 using steam subsystem if that matters
can someone help with databases?
@brittle sinew , @regal hazel Thank you for the ping issue cleared up ๐
Anyone here thatcould help me with spline meshes?
I know this is a common problem
but does anyone have any ideas about tracking physics objects accurately on a client?
besides the slightly hacky "just keep resetting the position"
Help me please. I use this script to make pawn moves for every player. It works but pawn moves smoothly on server and on owning client but laggy for all other clients... Why? Btw, I have tons of this message in log, what's this means?
LogNet:Warning: UIpNetDriver::ProcesRemoteFunction: No owning connection for actor 0_Ship_C_1. Function MoveShip_Server will not be processed
It means you're trying to call a server RPC on an object you don't ownโthat's not allowed
Designating function replication across the network
Take a look at the table on that page
@brittle sinew dah, I cannot understand something... log says No owning connection for actor but I have client who controlls that pawn normally...
Yes, but each pawn on each client is trying to call that server RPC
It'll work fine for the owning client, but on all other clients it will throw that error
It's not only the owning client trying to call it :p
Well.. I can understand now a bit more... But how can I fix that in my script, for example?
Hi. does anyone have this issue ot a similar one?
Im using steam OSS but sometimes it just fails. Steam says im in the game but if i get the playername i just get the "desktop.....". Sometimes it just works and i get my steam name. I have not had this issue before 4.16.
Hey folks. I'm in quite the pickle at the moment. All I want to do is replicate an int between players. I spent most of last year working on a networked game but for the life of me I cannot get this simple integer to replicate. So below is my set up - press 1 to print the 'ReplicatedInt' variable which is default 0, press 2 to set it to 1 on the server. I'd like to think I'm just missing something obvious right under my nose, but I'm honestly at a complete loss over why this doesn't work.
(just reuploaded the image, not sure why my last screenshot was such a low quality image)
You're going to have to give a little more info than it "doesn't work" :p
ah, sorry - what I mean to say is that no replication appears to happen whatsoever. When the host presses 2, the client's ReplicatedInt does not change and when the client presses 2, the host's does not change either
Okay. I see you're doing this on the ThirdPersonCharacterโI assume the host and client each have their own pawn?
So there are two total pawns present on both the host and client?
yes, I belive so
Okay.
I think I see the issue here, haha
Are you expecting the host's pawn's value to change when you call the function on the client's pawn?
Heh, i sorta was
Well, that might be the issue ๐
Press button - run on server- get actors of class for each set value :0
Each pawn exists on both the server and the client, but those pawns are separate from each other. Even if you call a function on the client's pawn (I mean the client version of the client pawn) that replicates to the server version of the client pawn, that won't affect the server pawn
oooooooooohhhhhh
yeah. I see. I remember something about this from the past. Alright, so am I to understand the host and pawn should be separate blueprints or something. Apparently I'm not too familiar with this side of things.
Well, the "host" isn't a blueprint or even an object in a physical sense.
All replicated actors exist in multiple settings, and they're tied together via the network (magic UE4 resolution stuff if that's how you prefer to think of it for now).
So if you have an actor A that's replicated, you can refer to actor A as actor A on another client via an RPC.
But that doesn't mean an actor of the same type as actor A will be the same actor.
okay, I think I'm with you ๐
Host is a client but is authority and is the server. Unless dedicated server which is a host without a client
Every client has there own local version of the world
alrighty, thanks guys, that's cleared up a lot. Okay, so is there a proper way you can recommend to share this infomation?
Can you give a context of its end use?
i mean, share variable infomation between instances beyond local representations of those instances
So not just to server but other clients?
Let's take player name for example... Maybe this is an easy context to follow
sure!
You run a function to make your name bob by pressing 1
Nothing replicated... So only you as a client see bob
One sec call
(I'll brb in a sec as well)
sorry, im back
Acutally, based to what you guys have said, I think I might understand a little better what I need to do. So the context is that one player starts a 'Virus' (timer that counts to 100 on the server) and then both players can see the virus counter go up. Originally, I had it on the understanding that if both player's printed their own replicated VirusProgress variables, it would work. But I now release why that doesn't work. So instead, would it be better to not replicate the variable, but instead get the server to count and then pass the value of VirusProgress back to client using an RPC?
Uhg at work good times
welcome back, you're working late ๐
Yeah ๐ฆ
The thing with that is an RPC still would need to be called for every individual client, you can't just broadcast one to a bunch of objects (dispatchers kinda work like that, but those are beside the point)
In your original example, that value you replicated actually still exists on the server.
It's just not on the server's own pawn
It's on the server version of the client pawn
Which means if you have one object that all clients can access, you just replicate the value on that.
The clients wouldn't access their own pawn/whatever, but they would access that communal actor replicated by the server
hmm, i see, so that one object could be 'The Host Player' in a LAN system for example?
No, again the "host" isn't an object itself.
sorry, i mean, the first player in the game
Well, I wouldn't design it like that, but feasibly it could work
There exists an object called the GameState...I would look at it as what you might want.
It exists on all clients and can be accessed via the world
ooh, yes, I've read a little about that. I can quite see how that would be useful in this case
If you set a replicated variable on the server version of the GameState, that change will be propagated to all clients
If you want to see a project with some replicated stuff I have an example for download on my drop box I started a ctf example project
alright, I'll give that some research but that sounds like a good plan. I can't thank you guys enough for the help!
oh, wow, that would be super useful if it's no trouble. Thanks
cheers, i found it!
Most recent link some vids of what to expect I didn't tutorialize it but tried to make blue prints read easy
okay, well, that's fantastic. Thank you, I'll take a fresh look from tomorrow.
Well, I can't thank you guys enough, but you guys are the best! Thanks and bye for now
hey guys
so i have an ip of a server i want to join (without using sessions)
why does Open "IP_HERE" only work for 127.0.0.1
yet its still showing up on steam master server
yet i cant join via IP
Is OSSNull only LAN?
Port issue?
not even lol
OSSNull. In other words... online subsystem nothing.
You might have issues doing online stuff when you have no online subsystem. A thought.
The thing is
im able to connect using 127.0.0.1
with steam overlay
and not using OSSteam
but the thing is
my web browser can go to MY IP
lol
it should be the most basic functionality
Connect to an IP, get that shit, load it up
Ossnulll works. But the firewall needs to be open. Some ISPs will not let you connect to your own router back to yourself. I know from testing my dedicated servers if I wanted to connect to it I had to from another network if I was using my public ip
Otherwise I had to use the lan address 10.0.0.x etc
my game is on steam master server
so i know its not the firewall
also
im not using steam OSS
i dont get why OSSNull is only able to connect to LAN
why cant it treat remote servers
the same way
i feel like the only diff is "AM I DOWNLOADING THIS DATA LOCALLY?" NO? "DOWNLOAD IT FROM IP"
it doesnt seem like it should be more complicated than that
Well again. The computer that's trying to connect to the server where is it network wise?
Same network?
yea
but even when i had someone try to connect
from outside the network
it did the same
like, the client sends a connection request, but the server just does not reply
lol
127.0.0.1 is loop back that will always work
Your connecting to yourself
What about your local up which would be something like 192.0.0.x or 10.0.0.x
Could I do PlayerController->ClientTravel(FString("MyIP/Game/Maps/MyMap"), ETravelType::ABSOLUTE);
or something like that lol
I know it works, i tested all my ports using nmap
Ports are forwarded on router to the server computer?
yea
Do an ipconfig on the server computer and try from another open that IP address
gonna just have to mess with it
i know OSSNull can do LAN and Remote IP connections, just there is no subsystem stuff like FriendsInterface, Chat, Voice, etc
but it should still have BASIC functionality
does anyone know how to simulate one of the players leaving without it closing everything
@twin sorrel OPEN MAPNAME
ahh thanks!
er newb question
hmm I don't even know how to ask it.
if I invoke a function using UFUNCTION(Server, reliable, WithValidation) - does that mean everything under that gets called depending on whether it's on the server or client?
side question - does PIE multi tests always look like laggy?
When you invoke that function, it will be sent to the server, if the client has the authority for that object (IE: Owns that object)
If it's on the server, I believe it'll just execute.
ok
weird - my server stuff runs, but the client doesnt
Clarify?
one sec, I'll paste some codes
What is "server stuff"
as in role < ROLE_authority
ok so I have this .h
'''UFUNCTION(Server, reliable, WithValidation)
void Server_SecondaryActionPressed();'''
dang. how do I paste code ?
void Server_SecondaryActionPressed();```
there we go
```
UFUNCTION(Server, reliable, WithValidation)
void Server_SecondaryActionPressed();
bool Server_SecondaryActionPressed_Validate();
void Server_SecondaryActionPressed_Implementation();```
if (Role < ROLE_Authority) {
GEngine->AddOnScreenDebugMessage(634, 1.0, FColor::Green, FString(TEXT("INVOKING SECONDARY ACTION ON SERVER")));
Server_SecondaryActionPressed();
}
else {
GEngine->AddOnScreenDebugMessage(622, 1.0, FColor::Green, FString(TEXT("INVOKING SECONDARY ACTION ON CLIENT")));
InvokeSecondaryAction();
}
}```
and ```void ACastleKeepersPlayerController::Server_SecondaryActionPressed_Implementation() {
InvokeSecondaryAction();
}
bool ACastleKeepersPlayerController::Server_SecondaryActionPressed_Validate() {
return true;
}```
I forget what the story is with PCs/Pawns specifically about role.
Client won't run that function, it will be sent to the server and invoked there
They're... autonomous proxies versus authority on one versus the other.
Designating function replication across the network
ah ok
It may.
I was mixing up your names.
SecondaryActionPressed, which is not an RPC, calls Server_SecondaryActionPressed which is an RPC that will run on the server.
sorry 8\
I mean, you can just put a breakpoint in either branch.
And look at the value of Role.
sorry not following why I'd need to do that?
weird - my server stuff runs, but the client doesnt
So your InvokeSecondaryAction is only running on the server, but not the client?
GEngine->AddOnScreenDebugMessage(634, 1.0, FColor::Green, FString(TEXT("INVOKING SECONDARY ACTION ON SERVER")));
Server_SecondaryActionPressed();
}
else {
GEngine->AddOnScreenDebugMessage(622, 1.0, FColor::Green, FString(TEXT("INVOKING SECONDARY ACTION ON CLIENT")));
InvokeSecondaryAction();
}```
In one case, you will tell the server to run it. In the other, you will just run it.
yeah that's what I was thinking
Which means that if your role comparison is correct... and the client is asking the server to run it... the client is never even trying to run it locally.
You should probably always call InvokeSecondaryAction.
But only ever call the RPC if you're not the server.
Is ROLE_Authority not the server?
I mean, what I thought I was checking is "If the PC is not the Role_Authority, run it on the server"
It's kind of dangerous to mix role with server vs client.
hrmm I was following a tut that was doing that.
I mean, don't confuse a role with meaning that you're on the server or client.
oh
Typically it may mean something, but it isn't inherently true.
yeah, good point
ROLE_Authority doesn't mean you're on the server.
Is there something more verbose?
ROLE_Authority just means you've got authority to do whatever you want with this thing and anyone else (if anyone) should accept it.
I suppose for this case, since you're explicitly dealing with server/client, it would makes sense to actually check if you're on the server or client.
Unless there's some other way I should be approaching this
heh
But I think it's appropriate to explicitly check server/client since you're dealing with a server/client RPC.
Not a matter of authority.
GEngine->AddOnScreenDebugMessage(634, 1.0, FColor::Green, FString(TEXT("INVOKING SECONDARY ACTION ON SERVER")));
Server_SecondaryActionPressed();
}
if (UWorld->IsClient()) {
GEngine->AddOnScreenDebugMessage(622, 1.0, FColor::Green, FString(TEXT("INVOKING SECONDARY ACTION ON CLIENT")));
InvokeSecondaryAction();
}```
That seems backwards.
If you're on the server, why would you try to send an RPC to the server?
oh because I don't know what I'm doing.
Server_SecondaryActionPressed() is a call to a method that'll dispatch a message to the server to run... or shortcut and just run the _Implementation version since you're already on the server.
You only want to send the RPC to the server if you're not on the server.
And regardless, you want to InvokeSecondaryAction();
Because if you're the server, we don't need the RPC and don't want it, or we'll just end up calling InvokeSecondaryAction twice, once from the RPC running immediately locally and again later in this function.
And if you're the client, you want to call the RPC so the server will get to call InvokeSecondaryAction, but we also want to do it ourselves right now, locally.
okay, so am I determining that at the right time? What I'm strugging with is when to invoke a RPC call to the server and why
GEngine->AddOnScreenDebugMessage(634, 1.0, FColor::Green, FString(TEXT("INVOKING SECONDARY ACTION ON SERVER")));
Server_SecondaryActionPressed();
}
GEngine->AddOnScreenDebugMessage(622, 1.0, FColor::Green, FString(TEXT("INVOKING SECONDARY ACTION LOCALLY")));
InvokeSecondaryAction();```
Is what you want
Not sure how else to explain RPCs. :/
Imagine that every call to a function that has UFUNCTION(Server) on it replaced with...
{
Function_Implementation();
}
else if (IsObjectOwnedByPlayer)
{
// Send a message to the server, which will call Function_Implementation();
}```
A function marked with Server will NOT run on the client. Period.
A function marked with Client will NOT run on the server. Period.
The _Implementation version of the function will run whever it's supposed to run (owning client for client, server for server, all clients for multicast).
So if a function runs on the server, does it then get reflected to all other clients? I mean, usually speaking - netcull aside?
Absolutely not.
Where some code executes has no bearing on it running on anywhere else.
If you run a function on the server that happens to make client or multicast calls, then obviously that'll happen.
If you run a function on the server that happens to set some values on replicated properties, obviously those change will get replicated.
But all of that is secondary, separate, consequential to specifically what the code that's running on the server is doing, and not inherent to having made an RPC to the server.
okay, that makes a little more sense but I think I need to re-read the documentation. I'm incorrect on how the structure works and why / when you need to invoke what calls to keep everything going.
I found a great 5 or 6 part overview from the epic guys about replication and stuff but for the life of me I can't find it again
It's relatively straight forward, the RPC stuff.
I want to think so, but something just isn't clicking
If it's Server_, it's going to run on the server one way or another, be it because you are the server or because it'll send a message to do so.
Same with Client_.
With obligatory caveats of the system telling you to go to hell if you have no right to make those calls.
It might help you to try diagramming it out.
With vertical space being time
or seeing a diagram
Not quite.
heh
So, you'd draw a box for client and for server.
Then a line going down.
Going down is time.
So you'd write next to a point on the client "Server_Foo" and an arrow pointing to the right over to the server's line and write "Received Server_Foo"
Then slightly further down the line "Server_Foo_Implementation".
Let me see...
heh
I need to just start using my damn cheap tablet as a digital whiteboard.
I just realised the Networking and Multiplayer part isn't in order
... how can I just take a photo with my webcam? Bollocks.
My phone is dead, can't use it take a photo.
regarding RPCs, if a client performs a RPC to the server, say to change their name, does the server have to a RPC to all the clients with the updated name?
as in, are the calls one way? Client - > Server / Server -> Client?
Phone had just enough battery for it.
Calls are all one way.
So if you want anything to get back, it either needs to be another RPC OR replicated via variables.
Does that graph make any more sense?
Sorry, shit had writing on a whiteboard, tiny space
Cticky_foo_implement?
Call
Client_Foo_Impl```
Bleh, messing with formatting so it would appear right.
that actually does make a lot of sense
It's just messages between server and client.
Yeah
Clent sends RPC to server, server receives and runs the appropriate function.
I think my issue is that the "server" can also be a PC and a character etc.
Because then Server and Client become somewhat abstract
Don't think of the server or client as objects in the world at all. They're entire copies of the world running in separate processes.
Well, I know what you mean and that makes way more sense
And you're right, I've been trying to tie to some tangible thing
You've just got lots of things in multiple different places all partaking in the illusion of being the same as something elsewhere.
Anyways, I need to eat food. After making it.
okay. Thanks @warm pagoda
Eventually I'll remember what this kind of graph is called... Message graph?
..ah yeah, sure
do actors that are set to replicate and their movement still need calls to the server?
@warm pagoda ah sorry bout this but my client still isn't updating and i'm not sure why
god damn.
For the life of me I cannot get the server to recognise my client moving an object
nice
Waiting for that email was more stressful than a job application
I don't call _implementation direct, do I? ?
brentwallac: the server needs to initiate actual movement. The client can call an event that calls the server RPC to do the move
yeah that's what I have
though I'm starting to think my UFUNCTS aren't working at all
for some reason
if I call a UFUNCTION(Server.. ) and that leads to other UFUNCTION calls, do I have to also define those as Server?
So my PC->callsInput->InputDeterminesRoleAuth->InvokesFunctionUFUNC(Server)->GetPawn->GetCursorCoords->UpdateMovementofActorSelected
Works fine being server, but when the client does it, the server doesn't see it.
client initiates, but runs the server rpc, and then the server runs the multicast rpc to actually perform the move
how to make splitscreen?
silly question but just to double check, event rep does not cost anymore bandwidth right
@zinc loom hmm that didn't seem to do it.
Does anyone have an idea how u could pawn a particle effect just on the client before the server destroys the actor with out having to multi cast?
Anyone have any experience with replicating skeletal meshes in multiplayer? Such as cars?
I replicate flying ships
if that counts
there skeletal meshes
@cyan bane ask away im heading out soon
So I'm trying to replicate spheres that im allowing players attach to boxes using contraints.
They replicate just fine, they attach, they spin (they're supposed to function like wheels)
But they get out of sync super easily, especially for players who join mid-game
Are constraints not similar to the way skeletal meshes work? Like how does a multiplayer racing game work?
**And that's server and client(s) on the same machine, or a different machine on a local network.
I thought i understood why constraints get out of sync, given that physx runs at a different rate on different machines or w/e, therefore producing different results when it simulates physics inbetween replication updates.
But Actors don't get oos.
So I'm ultra confused.
@cyan bane actors don't get oooos?
Not to the same extent, no
Also, not entirely too sure how others do their MP racing games...but I would probably cheat and use character class
But how would you deal with the physics of tire friction and etc?
Also, what type of physics are we talking about here?
Hardcore sim? Or arcade game?
I would probably again cheat
With friction
Creating my own custom solution
Because unreal physics is op
And even more so when dealing with replication
For the sake of argument lets go with hardcore and difficult to cheat.
So you really want to do this the super hard way
Well I was hoping to use whatever it is multiplayer racing games use for clients, but if they cheat then I'm out of luck there.
I have an idea on how to minimize oos issues with constraints, but it won't be good enough.
Take a look at this site
Take a look at this site
Take a look at this site
I've read it
All of it, UE4 uses the 3rd solution according to him.
It seems like between the 3 he lists that state-sync is the more superior to snapshot interpolation, and in the comments he says that "Yes the halo engine uses state synchronization, as does Unreal engine."
You are saying that incoming players are 'out of sync" when they join a game already in progress I assume?
I'd say about 20% of the time a couple of objects will be out of place. But they will become out of sync during gameplay as well.
And then pop into place
It's a hard issue to debug because I can't get it to go out of sync on demand.
@cyan bane are they always relevant?
For the sake of debug, yes
I feel like part of the issue is constraints are, on occasion, flexible. I don't want them to be but that's just how they work.
As long as they are always relevant and replicated correctly. Probably more an issue with Physics itself.
UE4 phyics engine
PhysX
I just need to minimize how quickly the physics simulation between the server and clients diverge. I'm not trying to fix it.
So that when it is time to update stuff the pop isn't jarringly noticable.
Aye so fake it
It is simulated on client
Ah, that makes sense
Yeah, f**" physics
Do you have a gif
Or video
Showing what you're trying to do?
Might make it easier to come up with a solution or work around
I'll make one, it'll take me a little bit.
Kk, I am sure with everyone here, we can come up with something.
Hey is anyone around to help me squash this bug?
I'm spawning a child actor component on my players, but when I try to pick up the child actor to use it it grabs the server copy of the child actor component
post your bp?
not that I can be much help, I'm struggling to get the basics going
Is there a way to determine an actor's ownership?
Do you mean as in GetOwner?
heh
I'm hungover
what's a good way to record my ingame stuff? I need to show someone a clip of what's going on with this game.
As in a built-in UE4 recorder or just any screen capture type program? If the latter, I would suggest Shadowplay if you're team green or OBS
cool getting OBS now
AFAIK GetHitResultUnderCursor won't work in a setting where the PC is being controlled in a different setting
I would maybe pass the hit result to the server and go from there?
It would open yourself up to some client-authoritative issues, but some things just really can't be fully server-authoritative
Do yourself a favor and do some debugging.
When you call the function on the server from the client, do you get a valid hit result?
If not, that's a big clue.
Okay, so you successfully receive the RPC on the server and get a successful trace?
I mean, both the server and client work with the moving of the box.
That's not quite what I mean
dang.
I thinkI know what you mean
not sure how I'd test that differently then what I've got at the moment?
Yeah, unless I'm unaware of some magic behind the scenes I don't see getting the mouse cursor on the server version of the client's PC working
Would you suggest creating a rep for the location? or even the hit result of the trace?
Just a question, what triggers "ONPICKUP SET"?
I don't see it in any of the code here
oh that's on the box
I've used a custom component called Upickupable
if (MyStaticMeshComponent) {
GEngine->AddOnScreenDebugMessage(884, 1.0, FColor::Green, FString(TEXT("ONPICKUP SET")));
//MyStaticMeshComponent->SetCollisionProfileName(TEXT("IgnoreOnlyPawn"));
MyStaticMeshComponent->SetCollisionResponseToChannel(ECC_Pawn, ECR_Overlap);
MyStaticMeshComponent->SetCollisionResponseToChannel(ECC_WorldDynamic, ECR_Overlap);
MyStaticMeshComponent->SetSimulatePhysics(false);
}
else {
GEngine->AddOnScreenDebugMessage(222, 1.0, FColor::Green, FString(TEXT("STATICMESH COMPONENT NOT SET")));
}
//LockPosition();
}```
It really doesn't do much other than change the collision response channel and turn off physics.
about the hit result?
Because that log occurs on the server, and the only time that's called is if you get a successful hit
Yeah
Actually your check for the PickupableComponents array proves me wrong ๐คฆ
yay ๐ฆ
Hmm, that is quite odd. I was going to say since the actual log occurs on the character, you could be tracing at a default location on the server and just hitting something to go into the if
But, you made sure the actor you hit has a pickupable component
Yeah it checks for it - kinda like an interface check I guess.
Well it's a substitute of that anyway.
I would log out what object you get inside of the hit
If it's the same on the client and server, good
If not, good I guess, because you have a lead
ok
:p
And I assume the cubes are replicated?
Nah that's probably fine, was just confirming
Looks good ๐
damn it. I gotta jet
Would Actor GetName() be sufficient to test what I'm getting via hit?
Probably, it'll give you an indication of if you're hitting the right thing at all
I've got a flashlight in my multiplayer game, how do I sync up the position of the point light to where the camera is looking on all clients? It is a parent of the camera, but that's not enough haha
well I tested it and I'm getting consistent messages
It's also possible that maybe the client doesn't own the actor, and therefore cannot call make the Server call
But that would also mean nearly every interaction of a client to a server-owned actor would be done via an interface (or something similar)
Whats the problem @glad sedge ?
ah god damn near everything
But you're smarter than me so maybe you can help
So here's my code https://codedump.io/share/0sQ6cpp4VtwU/1/aplayercontroller
and a video
it shows that I can move a box as server and it'll update on the client fine. But if I do it as the client, I can move the box but doesn't update to the server.
And I don't know why.
The only thing I can think of is the actor I'm picking and moving isn't owned by the client. And therefore the RPC would not trigger. But it does trigger cause I can see it via the logs and what-have-you. So I dunno.
Your only moving the Clients version of the Box Actor.
GEngine->AddOnScreenDebugMessage(622, 1.0, FColor::Green, FString(TEXT("INVOKING SECONDARY ACTION ON SERVER FROM CLIENT")));
Server_SecondaryActionPressed();
}
InitiateSecondaryAction();```
Doesn't that "InitiateSecondaryAction()" mean it'd be firing on the server version?
GetHitResultUnderCursor(ECC_Visibility, false, TraceResult);
if (TraceResult.GetActor() != nullptr && TraceResult.bBlockingHit) {
So
When your client tells the server to InitiateSecondaryAction
GetHitResultUnderCursor will most likely not be returning what you expect
The Server doesnt know what your clients version of that is
You never told it
So for all it knows its cursor could be anywhere
You would have to perform the HitResultUnderCursor on the client, then send that to the server so that the server knows what your client wants to pickup from its persepctive
The client understands whats under its cursor, but the server doesnt understand whats under the clients cursor
Does that make sense?
Yeah I think so
First, is there a way I can test what the server sees under my client's cursor?
Yeah verify that if (TraceResult.GetActor() != nullptr && TraceResult.bBlockingHit) is even being reached on the Server when the Client goes to pick something up first of all
TraceResult.GetActor() will most likely be null for the Server
let me test that
Make sure that its the Actor you want, otherwise if it isnt null it could be some random Actor
It could assume that the Cursor is at 0,0 and just get whatever Actor is under that coord
But then I do a test for whether it has a component?
Or just print the name of the actor
Whatever works for you
PrintString is your friend lol
Your also going to run into an second issue, you will also need to send the position of the mouse or at least the new position of where the Client has moved the box to back to the Server so that it can update it for everyone else as well. Since the Client only knows where hes moving the box you need to make sure the Server also knows that information (either on tick or an lower interval, usually an lower poll rate or only when the box moves significantly enough in order to snap to an new grid position)
Should I use multinet cast for that?
Well, hang on. First I believe I understand what you're saying. I'm calling the function that does the hit before the Server knows anything about the client.
As long as RepMovement is on and the Server is updating the new position all Clients should get the updated position without an Multicastt
ok
if I do move the box though, and replicatemovement is on those actors, wouldn't that update all the clients?
Yes thats what i just said above
yeah
But only if the Server is the one whos doing the movement update
Remember variables are only replicated from the Server to Client
Not from Client to Server to Client
If an Client modifies an Rep Var its only modifying it for itself
So should I tell the server by way of a FVector that updates the position?
Yeah or if you want to optimize further there is an FNetQuantizeVector i think as well
oh, that's what that is for?