#multiplayer
1 messages ยท Page 360 of 1
did you make the variable in C++?
nope
mkay, make sure the replication settings for the var is set to default
whats triggering the timer
through an rpc?
then how does the client know about it?
because the server updates a replicated variable
hmm i dont quite follow... what exactly is to the left of the timer in your bp?
gamemode bp
i'm totally lost on the whole networking thing again since the screenshot i posted earlier wouldn't work
and all my attempts before that
right the previous screen was what i was referring to
just does not compute anymore
oh, to the left of that time is beginplay
or was, because it's gone now
the timer, not beginplay
right so you started that timer on both server and client
i think i tried running it on client/server only
because yeah, it should only run on the client if i'm doing it that way
but i think that didn't work at all
print other player's timers on screen
right, so at every x second interval you send rpc to server with client's current time
that's what i was doing, yes
before i started trying to do it on the server
i'm not sure what the best way is anymore either
if the server already has the client's time, then obviously thats the best way
i mean, since movement is clientside
the timers might not be accurate if i do them serverside
actually nnnnoooo that shouldn't be the case
urgh i'm so confused
yeah it should be like spawn > latency delay > race starts/timer starts > finish race > still latency > race ends/timer ends
anyway
that doesn't really matter
thats hardly a big concern though, you have access to latency
the point is, my timer doesn't work no matter how i do it lol
decide on a way you want to do it and it shouldn't be a problem
well, neither way seems to work right now
do you see any reason for the second example not to work?
just to be clear, it does work fully on the server
the starttimer thing not working?
that seems to be a server rpc which you are calling from the server ye
yeh
do server rpcs work when called from server? in blueprints i mean, they do in code
it says (if owning client)
should work
yes they work
!
well you'll hvae to show the start timer event thing then
ok
So you have a timer in PlayerState, correct? That is actually good. PlayerState is AFAIK owned by server, and then replicated to all clients. However, setting a variable inside them, can only be done via Server, to have that value replicated to all clients. Also, you can access other player's PlayerStates as well from GameState->PlayerArray
So in your case, it would be
witness true blueprint prowess
intense in my mind sounds like a bug trap ^______^
PlayerState -> RunOnServer Event -> Start Timer -> Promote to Variable (Replicated)
oh, irony
Then actually you can read from other PlayerStates, to get the updates on UI
No need to RPC all around with values
that's in a component on playerstate, yes
right, so the only problem here really is that timer var is not being replicated
yep
@manic pine CurrentRaceTimer is being replicated and that's the one i'm reading
You can just make a Server_CustomTick(RunOnServer/Reliable) event, and put the calc there, and call that on the tick, to make sure you are actually running it on server
yeah
What is that parent ref again?
the PlayerState
your component is allowd to tick?
right, what if you fire off a log entry at the end of the tickevent chain
@manic pine good point though, need to make sure to let it tick on dedicated servers
ye
Also, as he said. Smash dat shite with PrintStrings, so you will exactly see what runs and where
yep
Also be careful with reliable tick events, those will kill your RELIABLE_BUFFER in no time
ye also makes no sense to have this be reliable
since a lost package in this case is useless
time is outdated already
So, you get printed the timer value, and it's all good?
oh yeah, drawing it to the hud and it's all good, but only on the server
And how is the drawing done exactly?
the widget gets the variable on a timer
I mean, where does it happen? UMG Widget?
so player state's component is replicated, var is being updated by server, and the var itself is set to replicate...
Okay, good news bad news :
Try This:
Multicast_SetTimer (TimerPin) -> Set Timer (TimerPin)
Server_SetTimer -> Multicast_SetTimer(Get Timer -> TimerPin)
And call that
Basically a manual variable replication to all clients, just see if it actually replicates something or not. We've seen a few cases where values set by the server on a replicated class and a replicated variable, are actually not getting replicated to the clients.
Even though they should.
hmmm
Tho this multicast event will set the same timer on all playerstates, so it won't be good for your goals, just eliminating the possibility of the replication issue
and you want me to update the replicated variable on the timer right?
so yeah, i think i get it
hold on
Yes, and you can turn off the replication for that variable
Since you are already manually replicating it
If you get ANYTHING on clients, it's a rep issue, so make sure you re-check everything. CanTick, Always Relevant (not only for owner), Component Replicates, etc etc.
how do you want me to run the timer event?
You mean the Server_SetTimer?
You can pop that into the tick, and see if your HUD updates
inside PlayerState ofc
So it will be like:
EventTick -> Your_Current_Logic -> Server_SetTimer
oh yeah, forgot i can link it to tick
oh no, i'm confused
can't link a timer to tick of course
yeah but he said "pop that into the tick"
the value youre now trying to replicate, send it with a multicast
but i can't pop that into the tick ๐๐
ah that's just confusing me more raap ๐
right i already forgot about the pins
If you get anything on clients, your logic is sound, and it's a replication issue.
sorry if i'm a bit slow but i'm really sick of dealing with this stuff
I mean the timer changing logic is sound, might be a var replication issue, a wrong call of events, and other numerous stuff
But again, be noted: This will change ALL PlayerState timers to a single timer value that you started on server, hence will not work for your final purposes ๐
Also avoid manual replication on tick.
only on that specific playerstate
PlayerState AFAIK is owned by server, so run on owner won't work. However you can ID them always and do it like that. But again, this is just to test, nothing more. Don't even plan on keeping it ๐
so you want me to just print TimerToReplicate and see if it's correct right?
so like this
Yep, it should work.
yeah, it prints the exact same stuff as my hud
So server is okay, but on clients it's nada?
yeah i'm not sure what the deal is with prints btw
sometimes server prints show up on clients and other times not
this is one of those times where it's not showing up on the client
i'll see what happens when i get the variable from my hud
still 00:00:000
hmmm
well that makes sense since the variable isn't replicated ๐คฆ
Nah,
If you manually replicate it, there's no need for it to be rep as well, since you are setting it on all clients
right
So how do you start this CreateTimer event exaclty?
Like where you set the start timer, and the bool?
Where does it get called?
And how, more specifically
gamemode calls BeginTimer which sets the IsTimerTicking bool
Can you pop me a shot?
i pasted it above i think
could you try setting your time var to replicate with notify
Is that controller casted?
then do a print on notify
@raven viper what controller?
@manic pine trying that but actually running into a weird issue, hold on
The one you are getting the PlayerState from?
@raven viper no it just gets the owner (PlayerState) and casts to it
Can you show me how and where are you exactly calling that BP?
@manic pine i've never seen this before but if i do a 0 duration print, it doesn't show up on the client
otherwise it does
you mean this @raven viper ?
No no, I mean
oh no, you want to know where i'm calling the timer bp?
In GameMode
Where you start it
You sent the pic of a custom event. How is that event getting called and where?
The ClientBeginRace
Where do you call that?
Also that GetPlayerState node doesn't look good, you should be getting one that looks like a variable (replicated)
Like so.
@manic pine i guess that's because it's not replicating every frame eh
@raven viper the gamemode calls ClientBeginRace
and the GetPlayerState node gets a casted playerstate, i know i need to clean up :<
If you get from the controller, no need to cast.
Plus that's specific to player, so this might be the root of your issues
it's a custom PlayerState so i have to cast if i want to access its custom events, don't i?
but yes, it's meant to be player-specific
btw that does work @manic pine
the client prints the correct times
I might have a feeling that the Tick in GameState runs on client
And since the variables you originate from are not replicated, your client overrides with 0-0-0 and you get nada at the end
Server Tick -> Set correct var
Client Tick -> Override with NULL
yeah except he had an authority check on that one
do you have any other events that uses that var in some way?
It will be true
it'll only be true on listenserver
Since he is not using SwitchHasAuthority, but HasAuthBool on the Parent Ref, which is the PlayerState there
nope, can't think of anything that would override it
this var gets set in the timer component and nowhere else
hes dealing with dedi yes
and i'm testing on a listenserver btw
brb real quick too, gotta get a snack
Then basically your Tick is overriding
Make sure that's only ran on server (calling a custom event, etc) and you will be good to go
wait even there its not actually a problem, since in that case
Since RepNotif printed good values, and you are only changing there, it's kinda obvious
timer would be started on both too
Nah, he got a custom event for timer start from GameMode -> Only Exists on Server -> Only Server Timer starts
Just auth that tick properly and all good
And that is a good final note for me to get to bed, 3 AM, gotta get up early. Hope you get it fixed! Gnite!
yeah but listenserver is server
i'm gonna replicate these cookies into my stomach
night @raven viper thanks for the help
no it wouldnt
so clawsome was saying i should run a custom event on server every tick?
i guess i'll try that
yeah it doesn't work
if your repnotify for your var is printing the right value on the client
then its obviously being updated correctly
you need to find all places where your var is being used
one of them has to be writing over it
so the client never touches it ?
it shouldn't
oh i bet i know what it is
actually no, i don't
i thought maybe i was caching the playerstate too soon on the widget
but i already put in a delay for that
in the timer component?
in that bp above
after the call to ServerTick?
right
well regardless of where i put it, it does that thing again where it doesn't print on the client if i set the duration too low
but yes, before the call it obviously prints on client too
huh what duration
print duration
well it's just 2 clients so
same thing except i don't see what happens on the server
right, but whats the pure client printing out
server messages
or also client messages if i call the print before calling the ServerTick, like i said
youre printing the TimerCurrentTimespan var yes
i dont mean down to the millisecond, just 'after 10 seconds it prints ~10'
with a duration of 0, only on client 1 btw ๐ค
duration?
print duration
set print duration to 2 seconds, set value to the var
yeah...
apparently
but my UI works fine on server
and this is the total extent of the widget graph
it's a user widget that gets added to a list dynamically on construct
with a delay, because otherwise only the server gets one
eh, well
what i mean is the server only gets a widget for itself
because it creates the widget before the client loads in
otherwise it's anything but dirty ๐
it does happen all clientside
why?
where and when is the widgets made
i have a HUD widget which holds HUD elements as individual user widgets, including a PlayerList widget that dynamically creates PlayerListItem widgets inside of itself
the HUD widget is created in the HUD object
right, and playercontroller creates the standard hud object, everything fine so far
why exactly do you need the delay
oh because the player list isn't quite dynamic enough yet
it only gets the list of players once at the start
so the listen server would create the list before the client connects
and the client wouldn't be in the list
i was going to fix that up once i got the timer replication working
๐คท
add a print in the widget
i did, it prints
between update and set text
here is the playerlist bp btw:
oh except the delay shouldn't be set to 0 of course
just did that a couple minutes ago to test
yeah you prolly want some kind of multicast instead, when a player joins and leaves
to tell clients to update their list
it wont
whats the print say?
is the widget on the client reading the correct value too?
sec
no, it prints the default time on the client
as expected
the SetText node isn't broken lol
so your playerstate tick is printing the correct value
and your widget printing the wrong value
eh whta a mess, i have to go to bed but i have a simple workaround for you
instead of running your widget update on a timer, just do
OnRepNotify -> call widget to set time
yeah i have to go to bed too
since we found out rep notify worked
i was thinking of that too
doesnt explain whats wrong, but at leasst it should provide a working thing so you can move on
np, good night
night
Really quick, does someone has any experience with Steam Cloud Storage? If so, can i easily Work with Unreals "SaveGame" and upload / Download that one to the steam cloud storage to maintain player settings like selected skins and such?
@shy nymph That's a good question... I would like to figure that out as well
Seems like it's possible
I cant filter search results using FOnlineSessionSearch queries, all available sessions are being returned rather than those that meet the criteria, this is a gist of what I have done,
while creating a session...
SessionSettings = MakeShareable(new FOnlineSessionSettings());
SessionSettings->Set(SEARCH_KEYWORDS, MatchTag, EOnlineDataAdvertisementType::ViaOnlineService);
I feed a fstring that has "1V1" in MatchTag...
And, while finding sessions,
SessionSearch = MakeShareable(new FOnlineSessionSearch);
SessionSearch->QuerySettings.Set(SEARCH_KEYWORDS, MatchTag, EOnlineComparisonOp::Equals);
Here, I pass-in "2V2" in MatchTag
Now, where no session result should show-up, I can see "1V1" session when I search for "2V2", can anybody help me understand what is happening here ? why are the SearchParams not being used ?
Hey anyone knows how to replicate destructible meshes in mp? Would like to hear an answer in like 1 or 2 hours please.
Please anyone?
Ok I then just think I can make a BP with dm and set it to replicate
This isn't a hotline, and your question is too vague. If you tried something and that doesn't work like you want it to, tell us about that
K
Hi everyone, UE4 offers linear and exponential smoothing for multiplayer games. Can I ask if anyone has some experience about how to choose between these two?
Showing the difference between the client and the server with no smoothing (what objects not attached to the default mesh look like). -- Watch live at https:...
Showing the difference between server and client side linear smoothing -- Watch live at https://www.twitch.tv/m72thelaw
Showing the difference between the server and client with exponential smoothing. -- Watch live at https://www.twitch.tv/m72thelaw
@cursive shard you can see the difference between those three on these videos
@pallid mesa Thank you very much. I think the linear one looks the best to me. In my own test case I've also noticed that the linear mode handles rotation smooth much better.
Through looking at the engine code, I think basically they are just two different ways to interpolating between two transforms(positions and rotations). (Please correct me if I am wrong. Thanks in advance)
Yes, the way you interpolate positions by net update is basically interpolating between two given positions for the other clients to not see rubberbading due to network hiccups
Velocity, rotation, position are usually the most important values to have in mind to interpolate
So you are choosing the way you are interpolating
Thanks, I am little confused about this piece of code. So why the Linear smooth mode makes a lot less sense under the typical high update rate
Thats probably something you'd come to a conclusion testing
Alright, I'll do some more tests about these two modes and see if I can figure out something. Thank you very much. If I can get something useful I'll talk about it here.
Hey guys, does anyone know maybe why Steam isn't working in my Release build?
It works if I go Play -> Standalone from the editor
but not in my packaged game
I do have steam_appid.txt in my root game folder (should it be somewhere else?) with my AppID
(The steam_appid was in the wrong folder)
@ripe raptor did you try to update steam in the engine ?
I figured it out, the appid.txt was in the wrong folder :p
It tells you to put it where the game binary is, but it means the GameName/Binaries/Win64 folder, not the game's root folder
gotcha, thanks for the info, but I did not need the txt file, because i had the appID in DefaultEngine.ini, is it better to keep it in a txt instead ?
You have to have it in the txt for a packaged build
the defaultengine.ini only works in dev builds and editor
@manic pine @raven viper apparently Date Time and Timespan variables don't replicate
@ripe raptor OK, by packaged build you mean the shipping build, right ? because it is working for me in a packaged dev-editor build ?
@small temple didnt we discover that repnotify worked?
@manic pine ah yeah, good point
i guess they don't replicate outside of their actor or something
either way it's not the widget for instance, because i also tried to replicate to my playercontroller and that didn't work either
so i looked it up, and other people are having the same issue
it didn't occur to me to look it up yesterday ๐คฃ
wat, youre saying you cant even replicate a var on the playercontroller?
i can't replicate the var TO my playercontroller
you dont replicate with a destination though...
no but i'm getting the var from my PC
anyway there are workarounds
like breaking the timespan and replicating the ints individually
lol?
only one class can replicate
and thats Actor(and sublcasses)
for the others you can replicate their references, but not replicate their internal values
I found out the problem with the session search queries not working, if anyone stumbles on it, LAN Queries are not being filtered by the search settings. But if I use steam and create online sessions(not lan) they are filtered correctly. I have no idea why that is the default behaviour but I am filtering the recived results in OnFindSessionsComplete() like so for now,
if (SessionSearch->SearchResults.Num() > 0)
{
for (int32 SearchIdx = 0; SearchIdx < SessionSearch->SearchResults.Num(); SearchIdx++)
{
if (bIsLanSession)
{
for (auto setting : SessionSearch->SearchResults[SearchIdx].Session.SessionSettings.Settings)
{
UE_LOG(LogTemp, Warning, TEXT("Key : %s , Value : %s"), *setting.Key.ToString(), *setting.Value.ToString());
if (setting.Key == SEARCH_KEYWORDS && setting.Value.Data == MatchTag)
{
// Yup this is correct LAN result, join it or add it to a array
}
else
{
//Not the session you were looking for
}
}
}
}
}
actors and actor components*
PlayerState is a subclass of Actor
yes, and playerstate does replicate
yeah, so?
yeah, but any objects inside it that are not also actors/actorcomponents, wont replicate their internals
well, my race timer is an ActorComponent
right, and the actual time is?
the Timespan variable?
ye
it's a struct...
thats a struct
of ints
not based on Actor
not based on ActorComponent
ergo, it cannot replicate its internals
ohhhh i had no idea that was a thing
yeah, its the entire point of the Actor class, to provide replication
you need a number of functions and whatnot for the replication stuff, functions the non-USTRUCT structs dont have
structs can have functions
it doesn't make sense to me
how is a struct anything more than a collection of variables?
in c++ there's little difference between struct and class
in ue4 they've made them a bit different though
but then how come you can replicate a transform or a location or a rotation but not a timespan?
because those are part of AActor?
i think those are done a bit different
right
i think it should be possible to get structs to replicate properly hmm
maybe its just timespan that doesnt have support for it?
Timespan and DateTime
neither works?
i think they should if you provide the necessary uproperties
anyway why not just switch it to a float
keep the timespan on the server, but use float for replication
no need to replicate the entire struct
yeah, i see in the code the FTimespan struct is not a USTRUCT at all
yeah it only has a 64bit int member from what i can see
64 bit might be a problem for replication, but you might only need 32 bits worth of information
yeah i'll do something like that
but i wanted to avoid having to rebuild the timespan from a single number
just want to get stuff working quickly
can't do that if i have to bring out my shitty math skills
well, at least this explains it
ye
shouldnt be hard finding a workaround
so youre now running player time on server ye
yeah...
maybe i shouldn't though
because i need the timer to update really fast on the client
so i'll have to do a separate client-side timer too...
and now its only updating on replication
yeah
you did limit it in the widget didnt you
that too but actually it isn't necessary
you wouldnt technically need a timer on the client then
anyway i guess i shouldn't run the timer on the server only, and then use the original timespan for the local clients but the replicated one for remote ones
oh that's a good point, lol
simplifies things a great deal ye
or is it? the widget would get the client time
but the server would set the start time
so they might not match up
on the server, set starttime to now + client latency / 2
latency varies though
its an average latency
not good enough for a racing game...
you might also just wanna keep time on client
so server just tells client when to 'start'
that's what i wanted to do yeah
then every once in a while, you send an rpc to server with client's current time
so server can replicate it to other clients
it's not working though...
so before, i had the gamemode call StartTime, which ran on the server
ehh wait maybe i messed something up
oh yeah no of course
Hello good people of the internet! :)
I got a weird latency issue and I was hoping some of you can give me advice how make it to work correctly.
When I move Cards from a Position to another (ex from Board to Discard), there is window where I change the Card's Values. It's when I have already copied the data to the target Position but haven't deleted from the original position, so the Card's data exists in both. That is when I change the Position ID on the Card, everything else remains the same. It works fine for the server, but the client receives the info with some latency, and it messes up the client side with blank cards because the data is not there anymore.
Is there a good solution for this? Any advice is greatly appreciated.
@pliant cypress Either use OnRep functions/Variables
Or use an RPC
Generally, Clients only need to know the ID of the card and any value that might change during the game
All other information, like text or images etc, should be in a datatable
And the only thing you replicate is a struct that contains the TableRow (ID) and whatever values change during gameplay
Idk how your game works, but I assume you have Arrays with cards
So Array of Struct it is
Yeah so, when you need something to be done only when the variables are replicated, use a repnotify
Or an RPC to send the change
Im not sure I can replicate the frontend though, as it is different for each player. for example the player can drag a card with the mouse, move it around and drop it back to its hand (not making a move) and the other player shouldnt see that
I'm only talking about the backend
backend work fine, this problem is frontend only. I have a visual feedback of the backend and the data is there, but the frontend doesnt seem to follow all the time.
I can put in a delay to make it work (it does I tried), but it looks a lame solution and Im afraid it could later mess up the frontend completly
No delays
That is in fact 'lame' :P
Especially when a person has a higher ping
As said, you need to hook it up to OnRep or RPC
Owning Client RPC makes sure it's not happening on others
And OnRep variable can be set to ConditionOwnerOnly
OMG
I set it to reliable and it worked like magic and rainbows
it is like a second Xmas :D
how to replicate actor spawn
If I save the game and I'm connected to Steam, will it automatically save to cloud?
or do I have to do anything extra?
You'll have to actually save to the cloud
Check the OnlineSubsystem Interface if it has any Cloud saving functions
Otherwise you'll have to manually hook into it via the steamapi header
i have a problem with multiplayer, client player characters are lagging on a movement terribly, all stuff is set to replicated, is this right way to do the movement replication? i havent tried this over online yet.
or should i go with "switch on authority", and what about that float value does that need also replication through the nodes?
if your character inheritates from character class you don't need to replicate movement since character movement component does it for you
its just basic character with custom controller, movement component is set to replicated, all update frequencys are default
with those settings the movement is stuttering
and parent class is character yeah from top right
gonna check tomorrow more of this its time to go ๐ด
@thin stratus - a bit late but thanks for the answer.
just get rid of those "server" character and plug directly the add movement input into the axis inputs
guys, what's the best way to update UMG widgets in response to server-side events?
like say, if i want to update a list of players
i need to update it when a player joins
my first thought would be to use an event dispatcher, but serverside event dispatchers are only serverside so that doesn't work
do i really have to go and add custom client-side events and dispatchers for everything or is there a better way?
onrep event for the player list?
heh, good timing, i was just looking
that's how i'm doing it right now actually, for something else
but i don't like it because it's yet another event dispatcher
also the standard playerarray that comes with gamestate isn't replicated so i'd have to make my own and so on
none of this is a huge deal but it just seems like there must be a better, cleaner way
also by the way, if i do it onrep, that doesn't work on listen servers, so then i need a second dispatcher for those...
i get ya. maybe there is a better awesome way, but im not sure what it is!
Anyone have access to the pull request shown in this tutorial? https://wiki.unrealengine.com/Using_Steamworks_with_UE4
Working on getting dedicated servers to show up with steam but it looks like the engine code changes are behind that pull request which seems to be a dead link now
It seems to be 500'ing at the moment, but I've seen the pull before
@brittle sinew 500'ing as in temporarily unavailable?
Yeah it does
I figured the pull got rejected and the link died or something, but not sure how it works
I had thought it'd stay regardless
Rofl, changing the pull ID to 2134 or 2136 works fine
ยฏ_(ใ)_/ยฏ
Couldn't tell you, sorry
No worries! Hopefully can find another way- this seems to be the only discussion / wiki around getting dedicated servers to show in steam
I know it was a super long discussion, and all of the PRs seem to be loading pretty slow
It might just be that it's taking too long to load and timing out on the server, dunno
(well, now that I look back at the message I seem pretty dumb)
Haha.
Iโll try to contact the original author and see if he has the code elsewhere! Seems like a topic that is very hard to find official docs on
Im interested aswell, ask them if you can contact them if they could please update the wiki
Thanks
Will do!
from what i remember of that pull request it made a bunch of online subsystem interface changes and iirc i don't think they were all necessary
that PR loading bug on github has been an issue for like 2 weeks now
@pallid mesa it was like that at beginning, and the character movement lag was there ๐
not on server player, but all clients
-------------------------------
Player is spawing correctly in editor, but not in standalone game
i am using World Composition Also(if that make any difference)
Enable on character movement component linear interpolation
Are you modifying location or something or something?
@pallid mesa ok I have searched around and finally got something: https://github.com/EpicGames/UnrealEngine/compare/release...Scienziatogm:release
Seems the link is invalid but his repository is still intact
@lost inlet can you recall what wasn't necessary? Going to attempt to make this work now
is it possible to have a uobject(not actor) replicate as a member of an actor in the same way a ustruct would?
@twin juniper Is the weapon class replicated?
what if you try in your Weapon bp to add a beginplay-> authorityremote->print message
@manic pine and print it only from authority or both?
it prints
mhmm, im setting a mesh at beginplay depending on what weapon it is
ok nvm works now
@manic pine now it works fine, had to set weapon data var to replicate, it stores the mesh too
right, clients beginplay didnt have it and couldnt choose a mesh
do i have to do the same for barrelID, sightID, railID? what im setting in expose from spawn?
that seems likely...basically anything that's not part of the class defaults
because thats all the client has access to
oh i made all those attachment ID vars replicate in MyCharacter and now all players can see the selected attachments on the gun player is holding
๐
very neat
hey, i asked this same thing yesterday and havent found any fix for it yet. on multiplayer my characters movement is laggy on clients, server host sees everything smoothly
i have done replications to character and its components
oh looks like those replications are default, but anyways
client has laggy character and it sees other players very laggy also (other characters have same settings)
If i replicate an actor managed by a ChildActorComponent, do i have to replicate the component ?
Trying to replicate a drag and drop when a client drops an item infront of another client (dedicated server game). Item does not show up for both players. Can someone show me what I'm doing wrong? I've added a custom event for running on server.
Any help would be much appreciated ๐
(I believe I can avoid these problems by using the SpawnActor 'Owner', but I am not sure how to go about this)
youre calling a server rpc on a client-side only object
try moving your "ReplicateToServer"(rename it to something more descriptive) to your character class or maybe your controller class
@manic pine
i'm trying to do a dynamic player list that updates when players join/leave
i've tried multiple methods and i can't get it to work
basically because of the damn listen server following different rules than the clients
you got any ideas?
how you attempting to do it?
first i tried to update the list for the clients with an onrep function
and for the server too actually
but the server gets added to the list differently from the clients
so i tried to do it OnPostLogin for the server
that doesn't work for whatever reason, couldn't figure out why
then i also tried doing it on PlayerState BeginPlay/EndPlay
that doesn't work at all, although i think i just realized why
it's an annoying issue because it should be really simple, it's not like i don't understand it like with the replication stuff or whatever
it's just an enormous fucking mess
so i'm mostly wondering what you think would be the best way to do that
have you looked at GameState?
yeah my player list array and onrep function for it are in my gamestate
i havent actually used it myself yet, but it seems a bit weird to me... it has a playerarray, yet from what i can see it's not actually replicated?
exactly
UPROPERTY(Transient, BlueprintReadOnly, Category=GameState)
TArray<APlayerState*> PlayerArray;
it's not replicated but it is the same for clients and server
and the function AddPlayerState is not a client rpc...
so the playerarray is actually up to date?
yeah but it doesn't have an OnRep function so i can't know when it updates
right.... but how is it replicated?
yeah but when a new player joins, it needs to be updated
if the array isnt replicated, and not the AddPlayerState function...
๐คท
is it some kind of magic
yes that would make the most sense
because this would be the obvious place to put anything related to ui player arrays too
as youve already thought
well it's not a big deal because i can make my own player array
even if it's a pain in the ass
and doesn't work for some inexplicable reason
youre making your own replicated array?
yep
whats the declaration?
oh youre bp eh hmm
whats the contents of the container
the types
player controllers right now
yeah thats no good
the gamemode calls the gamestate to update the array OnPostLogin btw
cant give clients access to other clients pc's
ehhhh?
it's just a list of all the PC's in the game right now
it doesn't give you access or anything
yeah, other clients should never have pcs not their own
they also come with Only relevant to owner, by default, so they wont replicate
buuut i can get their playerstate though, right?
right, that's what i'm doing
no i mean i can get the playerstate from someone else's controller
but anyway no big deal, i can change the array to hold playerstates
the array should only ever hold playerstates
it's just a bit messier down the line (literally in visual terms)
well just an extra getplayerstate when you make the container ye
yeah
right, assuming thats changed, what exactly was the problem
hold on, i'll fix this first
yw
@manic pine i think i can get it working
for some reason the widget isn't receiving my OnLogout dispatcher from the gamemode though
but i can work around that
i think...
youre calling on a widget from gamemode?
haha yeah i was starting to wonder for a minute
the way i imagined you'd do it was onrepnotify with the player array
lol
i do it with an event dispatcher which fires onrep (for clients only) and also whenever the array is updated
why not exclusively on array update?
OnRep functions don't fire on servers
on listenservers? hmmmmm
yeah i know
thats a bugger
at least i can use a single dispatcher here
hmmm i said "here" because i thought i couldn't do it with a single one somewhere else but i think i can and now i feel stupid
onpostlogin add player to array then call listenserverupdateui and onnotify updateui ye
and listenserverupdateui and clients updateui can be the same
hmm maybe, how are you doing it on listenserver right now?
i mean i just call a universal dispatcher that describes what happens
like when my player list gets updated i call OnPlayerListUpdated
and then anything else in the game can bind to that
i don't have a separate, specific dispatcher for UI
anyway this doesn't matter, i have a problem
wait it's probably a UI problem
the player list update could, theoretically, be used for more than just ui
so its not necessarily ui specific ye
right
its prolly fine, which class has it though?
gamestate
ye sounds good
yeeeeeee
Guys are the Simulated Proxies being extrapolated (dead reckoning) or does the CharacterMovementComponent interpolates between the last 2 known positions?
my god, it finally works
http://www.tomlooman.com/ue4-cpp-multiplayer-course/ launches early next week based on the email i just got
@Apst#8432 and @raap#5040 i see u two always chatting lol
Can I get some advice/info on multiplayer inventories? Here are my questions or concerns
- How do you handle the shuffling of inventory via requests made from UI? Do you get client to test that it's possible, then send to server?
- How do you handle validation and corrections?
- When/where do you setup the UI following an event, such as splitting a stack, picking up an item, etc?
- Naturally I'll want to be replicating the inventory and not using multicast, so is there a convenient way I can simply detect changes? Is it logical to replicate both the inventory and a 'pending modifications' array?
I think I have basically the right idea in my head and some on paper, but want to check how other people are handling these things
If it was me, id create an inventory as an component. The inventory itself would just be an array of objects. The UI would be an completely seperate layer, all it does is visualise the information inside the array and delegate any drag drop or swap requests to the inventory component. Multicasting an inventory is unnecessary if all important actions are performed server side.
@grand kestrel
You should only really need to tell the server when an item action occurs
Pickup, Drop, Swap whatever
The reason I'm considering doing it on both is that it would allow for instant feedback, wouldn't have to wait for server
Yes thats fine, but whatever the server returns should always be corrected on the client.
Anyone got a good way of replicating a rendertarget with blueprints? I only need to replicate it once per client, when they first join. After that I'm replicating inputs, but I feel like making a huge array of inputs and looping through it when you first join isn't the best solution...
@here i have bought a static ip from my isp and i have a dedicated server now what should i do?
The Mods are not here to answer questions at your whim. Please only ping us if there is an issue.
sry
Someone else maybe able to help you.
alright.
An little more information on what your trying to achieve would also be helpful.
like??
Your statement above on its own may have context to people you were discussing it with before.
i have never see anybody discuss this before
@here i have bought a static ip from my isp and i have a dedicated server (which is built from ue4 source v4.17)
I want my friends to join
now what should i do?
buy server?
i bought a static ip
not server
Ok well that gives some more context now doesnt it? You want to play games with your friends on your own game
Have you built the Server executable for your game yet?
yes
its working as u see:
but i have not port forwarded
i want a experienced person to help
Experience doesnt come for free. If you run your server executable your friends should be able to join if you give them your IP address
Then port forward
ok
@fossil spoke but i have a problem, i got a static ip from my isp so what ip should i use to join in ue4?
@fossil spoke Before I forget (I'm swamped!) thanks for the info ๐
ok
It will tell you your public IP address
Which should be your Static IP which is what you use to connect
so when i buy a static ip from my isp all the pc's in my net become static and the same?
thanks ๐
No your Router has an Static IP
hm..
Your connected computers have local addresses which the Router manages
could u explain?
mhm...
so when we type whats my ip the router's ip is displayed or my ip?
Yes and then what happens is that the Server is listening on the Port 7777 (by default) to any incoming traffic which the Router will send to if its not blocked by an firewall or the Router hasnt got that port forwarded
so its the router's right?
Whats the routers?
Yes, your Static IP is assigned to your Router by the ISP
thanks ๐ for ur time
how should i spawn a spectator pawn and possessing a player into it on death?
i have tried with OnRep_Health, but it didnt work
So, anyone has experience with multiplayer on non-characters ?
Working on vehicle pawns right now - it works, but just using bReplicatesMovement is obviously not enough, prediction / rollback is required too
Curious to know if anyone else has implemented that
@bitter oriole the Ben Tristem Udemy multiplayer course covers creating and replicating a vehicle in the final section. Might be useful!
Also speaking of that course- itโs still in production and has a really solid steam listen server multiplayer integration section- could be a good opportunity to see if theyโd be willing to add a section for dedicated servers with steam too as they have all the framework in place already. Definitely an area that is essential for many games but has little to no documentation on how to set up. Otherwise it looks like the course will just finish up after this vehicle section
Okay
Do I have to make possessing pawns execute on server?
anyone?
Yes you should possess pawns on the server side
So run in server with a variable in it (player controller for what player to possess)
writing anyone is helping, so... Anyone?
@twin juniper that depends when and where you call it
For initial possess, you would use OnPostLogin in the GameMode
That is server side and gives you the controller of the player that joined
For respawning people usually perform a serverrpc inside of the playercontroller and then call a Respawn function in the game mode while passing the controller with it
If setup smoothly, initial spawn and Respawn can use the same function in the game mode
I use on death spawn spectator pawn and possess into it and destroy a character of dead player, but it doesn't delete it
Ok will try when I'm home
Anyone familiar with DTLS via OpenSSL? I have built a working client-server implementation into my game but I have a question if the method im using for session tracking is best practice.
@thin stratus will this work? In onrep_health if health is 0 or less get game mode and calling a custom event with player controller reference and from there do everything?
As that should already be on the server
Well vars only replicate if set by server
So to make an onrep happen you need to ve on the server
So you can directly handle the <= check there etc
But custom event with run on server from onrep_health will run on server. Or not
Oh the on any damage is on server
It needs to be :D
That's what the server icon is for
Anyway, need to go. At UNI atm
@bitter oriole no problem! ๐
@twin juniper i have a solution if u want
@inner iris Funny seing you on the coding side of things, btw, thought you were much more of an art person
@bitter oriole Doing my best to get to a decent level on the coding side too, have always wanted to make a game! Art is no fun if you canโt do interesting things with it ๐
Gonna make a game out of these landscapes ? ๐
A lot more than landscapes if all goes well ๐
how do i get a player that got damaged from on any damage?
@twin juniper when on any damaged is called, the actor that is calling it is the one that has been damaged.
and how to get the pawn hit?
with getplayer controller - get controlled pawn in it?
I assume you are calling the damage event on the pawn, no?
on character
Character is a pawn
Is this right?
Yeah that should be fine- what isn't working for you?
my spectator pawn is spawning at 0,0,0
That's an issue with your spawn logic, not the damage logic
Is this being called on the character?
I'm not sure why you are getting the controlled pawn when you already have it as self
Typically possessing and unpossessing logic happens somewhere other than the pawn such as in the GameMode as you are dealing with destroying and possessing pawns
Also I'm not sure if you are using the standard spectator pawn or a custom one- I'd test first by spawning to a specific location and seeing if it works, then you can rule out a spawn collision issue.
Also have a read of this: https://wiki.unrealengine.com/Blueprint_Multiplayer_Respawn
A How To Guide for respawning a player character through Blueprints in Unreal Engine 4.
@inner iris now it works if client kills server, but if server does that the server dies
maybe something in giving damage is wrong
wait no nothing wrong with damage giving
I checked with destroyactor instead of respawn and it works ok
ok i got it all working
But the client cant controll spectator pawn
would someone please be able to help me on an issue im having with my server hostings for some reason when i leave the game(Destroy session) it doesnt actually like i leave the game but i then cant find any other servers or cant even re-join the same game again unless i use the console and connnect through the lan ip address (open 127.0.0.2) please help ill show my screen
@raw novaeey#1200 sounds like you should investigate your error handling in uhh
I forget the name ofnit it has all your host and join logic
Make sure on error you are not destroying the session for the server
I think there's a tutorial a lot of ppl follow and a bool whew they plug both server and client into destroying session resulting in server closing its session if a client leaves
but i think we want to destroy the one of the clients and thats our issue right now like the client can leave but then cant rejoin or search for the same server
hmm i need to find that ahaha
would you happen to know the link
Not off hand, mobile at the moment.
When client goes to a main menu you can always run a destroy session as a fail safe
yea we try that but it seems it doesnt work correctly
we are using online subsystem steam
and i test on the same pc but with 2 projects opened
Hmm. That shouldn't work if steam is actually on.
Should be two different computer different steam accounts etc
okay i can do that
And I've seen you may need two different networks routing like that is sketchy. Like trying to dial your own telephone #
Tech steam should be doing its tunneling so with two computers it might work on same network i have messed with that in a year :0
so the issue might be becasue steam isnt on
With steam off you'd be connecting through port 7777
So for some reason whenever a player connects to my dedi server I get this: https://i.imgur.com/s0fwGu8.png
It doesnt effect anything... but i worry it may in the future be a problem
what c++ socket library should I use for a linux server?
So I've got the strangest of issues. I have two pawns in a network session. On the listen server, it looks like the local player has RemoteRole == ROLE_AutonomousProxy, instead of ROLE_SimulatedProxy
It's made even stranger (ahah) by the fact that on the client, that pawn correctly has Role = ROLE_SimulatedProxy, RemoteRole = ROLE_Authority
What gives ?
anyone here using point and click with acceleration? like for rts/moba games
the problem i see that sometimes(only sometimes) move to location (called from server side) has an ugly glitch, where the movement does not start smoothly
like the first couple of frames of the movement are cut out
Hey @chrome bay , you're all over Google with multiplayer physics. Trying to do a cooperative physics thing, like a MP ball game - got any hints ?
@fierce birch looks involved in this too ๐
it should be relatively easy to write a custom ball physics component! Avoid PhysX like the plague is my only advice
I've tried... god knows how many times, to get PhysX replication with replay/prediction working nicely but it's just a minefield.
So you can't have real physics in MP ?
I mean if the "ball" is a crate and falls on a surface, I still want it to slide along the surface, bump, etc
Unfortunately not so much - since PhysX is so crazy un-derterministic, the simulations differ too much on each player to have a smooth simulation
So you end up with constant corrections from the server
and replay is... difficult
I believe this is why Rocket League uses Bullet, they wanted more control over the simulation etc.
Okay
So from your point of view, the best options are either to have authoritative clients, or custom physics ?
If I don't care about cheating etc
Yeh almost definitely. Just to clarify, are the players the balls or are the balls not player-controlled?
Player-controlled, and they're not really balls, let's say vehicles
Yeah gotcha
For the early phase I would go for client-authoritive, but if you decide against that later then custom physics is the best way
Takes a little longer unfortunately but is worth it. I did it for these two projects (yet to do anything with collision for the hover vehicles) https://www.youtube.com/watch?v=UPb70PUf7KE&t=131s https://www.youtube.com/watch?v=rpWxsHX4B2k&t=50s
The pawns in the top-down game are just hovering spheres, so they were relatively easy.
Yeah, unfortunately collisions are something i'd like to work well, so I guess i'm going to go with authoritative
Yeah I think so. Luckily for us Epic gave us source so Character Movement is there in all it's glory to strip the essential parts out of
I've done a few fancier things for my collision with those pawns but other than that, the main bulk of it is epic's handywork
in a way
Would an authoritative client work by just sending location & speed to the other ? Or am I still going to need prediction ?
no prediction needed for the authoritative client
Although you probably still want to implement some smoothing of some kind
for players looking at other clients I mean
Yeah, I mean, if I have two clients and a listen server, the client A is still going to need to simulate client B I guess
Yeah what I tend to do is send input as well, so remote players keep simulating with the same input until they hear otherwise.. that can help a lot sometimes, especially when data rate is quite low
A lil extrapolation if you will
In Character Movement the server doesn't actually simulate the client at all until they get a new packet, and they work out the delta time for the simulation from the last time they recieved a packet. It's a bit odd IMO, I don't like it much but I guess there's a reason they went with that method.
No worries!
Still waiting for Epic to make the character movement class more abstract so we can use it for more things... but that's probably not going to be a priority for them
Maybe when UT gets vehicles.. who knows
Though UT's been dead since july so no idea what's going on there
UT has always been a side project for Epic, I mean that was pretty official
Yeah it looks like they're all on Fortnite for the time being, since BR is doing so well
Do I need the movement component class, by the way ? I mean does it do anything in particular that I need ?
It can be quite handy, some stuff in code specifically looks for 'Movement Components' and calls some of the functions from all over
Radial Force Component for example looks for 'AddLinearForce' etc.
specifically on a 'UMovementComponent'
Inheriting from UPawnMovementComponent can be useful since some AI classes interface with it too
Does that come with interfaces I need to implement ?
I mean the base PawnMovementComponent is pretty light
But in inherits the NavMovementComponent which isn't
Lemme check a sec, just opening up VS
Yeah sorry UNavMovementComponent is the one AI looks for
I think PawnMovement just has a couple of minor useful things, I can't remember if it's strictly 'required' for pawns
Although you could Shift + Alt + F it and see if any major classes come up :p
Yeah I still have a hard time seeing how to interface with the movement component class. The entire API seems geared toward moving with speed
I don't see how I can implement physics with it
I mean if I have inputs that do "accelerate left", how do I tie that into "RequestDirectMove" ?
There is also a "RequestPathMove" but which is used ?
Well, gonna read some docs ๐
are there any circumstances where character event "begin play" is not being called after player connects to server
by this i mean client side character event "begin play"
i saw this on rare occasions, for example when a player runs my client for the first time
perhaps someone could give a better insight what could be happening
because i cannot reproduce the problem
Sorry my bad - those 'RequestMove' functions are actually really badly named.. they just input the full velocity required to get to the next path / target point - which you can usually just normalize and use for input which I think is what CMC does
@twin juniper I believe clients call BeginPlay at a different time to server - maybe they don't if the game hasn't been started yet