#multiplayer
1 messages · Page 298 of 1
A downside is that it does not scale
Thanks to consoles P2P matchmaking is a standard now
Yeah but having o (n) connections for a sever and o (1) client connections is better than o (n)^2
Of course it's more reliable for you
How has reliability with lag and rubber banding been with steam for you?
No I mean in terms of setup
Oh yeah definitely
You control the host better
Having that makes it much easier
All my previous games had quite a big amount of players so a P2P approach was cost effective
Hmm interesting. Max player setup for me is 3v3
Yeah, I didn't really think about that
I mean, it could either be set up so you can host your own server like minecraft.
Or I guess I can set up an instance that listens on incoming requests and duplicates a server instance that can host.
Probably wouldn't be too hard to run it on freebsd
But again, try to scale the numbets
Run a single instance that hosts a fake 3v3 instance and on connection reroutes to a predetermined server setup
But yeah
For 2k players you need 2k/3 UE instances xD
Fuck
How reliable is the instance then
In even the basic 1v1 I was getting crazy lag
Host that on amazon and you bill goes quuckly inyo the 10k per month if not more
If I want my shooter to be competitive how do I preserve the hosting
As in make it reliable for everyone
BTW I really appreciate this brain dump. Definitely something I wasn't thinking of
How did you fix any lag though. Steam seems to have a lot of it
The character movement component has client side prediction
The stock configuration should be enough
Also UT (on github) has a custom one
That performs better
But is spevific to UT
That's probably a better idea. I can just co-opt it into my own. All I need is movement and projectiles to really be super reliable
Both are there
Is there any way to account for the advantage the host gets though?
so who is working on a login system?
UTs projectile have also a client side simulation one
@livid aspen not really, this is why in P2P matchmaking no one knows who is the host
Ouch lol. I guess in Lan it doesn't matter too much
Maybe you can make it ping each client before replication occurs
If every client pings each other before a rep each should have the same delay
You normally connect only to those with a good ping
Right
Thats enough
But in a super highly competitive shooter it gets close
But even then the guy next to the data center is srewed
I've dealt with enough assholes to know nothing is beyond reproach
I live on an island ^^
Yeah but only as screwed as everyone else
Nope, the closer you are to the server the better
So there will be always some players with poor experience
Yeah
Unfortunate
I guess Lan is only the truest way to keep it level
And hope no one else complains
Thanks again for all your help
Np ^^
Nice to have a rubber duck for this stuff
Good luck. Hope it all goes well
Hi, i have little question. I work for this afternoon on my student project and i want to have confirmation about things.
When you set a function like this "UFUNCTION(Server, Reliable, WithValidation)"
I know you must to implemente function with the postfixe like this.
ServerFire_Validate
But the function validate was launched on server or on client ?
It's executed on the server when the call comes from the client
Ok thanks for answer
Do you guys think having hitscan weapons is better than projectile based for network reliability? It makes sense that hitscan would be more reliable but how much more reliable would you think it is? I guess it probably depends on how long it takes for the projectile to impact a target right?
@livid aspen A single Linetrace is extremely cheap, especially when replicating it for network play. Projectiles need to be simulated so that the results are reliable across all connections.
Yeah that's what I was thinking. After my talk last night on here p2p might be the best option so making network checks cheap is really important
Depends on what the game is i guess
Is there a big difference between a line trace vs a projectile that doesn't have any arc that just goes in a straight line?
A line trace is simply an instant scan which is very cheap, even with a straight projectile you'd have to calculate overlaps and keep things lined up on clients if you want it to look good for everybody
Heyo. I'm running this function on a RepNotify var change, but it only occurs on clients, not the player who's hosting the listen server. AFAIK RepNotify should run on both clients and clients with authority?
Heyo. I'm running this function on a RepNotify var change, but it only occurs on clients, not the player who's hosting the listen server. AFAIK RepNotify should run on both clients and clients with authority?
It won't be called on the Host because the host is updating the variable, which causes the RepNotify to trigger. So when it triggers, it sees that the Host already has the variable changed, so it doesn't need updated, thus, no RepNotify
Thank you, that makes sense. So when the server sets the variable I should also do an "IsServer" check and run the function
Nvm, that won't work. Silly
Hmmm, but if I only want something to happen on client and I use "RunOnOwningCLient" I also need to run the same function on server if it's a player who's acting as server?
This is what I set up
If you're calling this within a Player Controller or Player Pawn, you can use the pawn's reference and do a IsLocalController check
and then run the functions for the server as well. It'll return false if it's a dedicated server
Isn't that essentially the same as using IsServer for this instance? Just a swap on the true/false execution
Or am I missing something
What I have there worked, although the server player can see the other players UI as well
Nope
IsServer and IsLocalController are different. IsServer checks to see if you have authority/controlling power of the game. IsLocalController checks to see if you're controlling this controller. It's a little confusing. But it'll turn true on the client, always. Because the client only ever has their controller. But when you run it on the server, the server has everyone's controller. So it'll return true only for their controller, all the others are being controlled by the other players so it'll turn false. IF the server HAS no controller (IE: It's a dedicated server) it'll always be false while IsServer will be true still
Hehhh
I don't use blueprints often so I'm trying to convert this from C++ to blueprints a little. But it depends on what your setup is
Essentially you'll want to do this though:
Thanks for helping out. This is all in a pawnBP
well hang on actually. Explain to me what you're trying to achieve real quick. Is this a typical scoreboard? Player presses F1 and see everyones score?
No this is displayed when player dies
Just a placeholder TextActor
I do "SetVis" and "SetText"
In the showscore function
The server executes
So when the player dies. A score pops up?
Correct, match is over and they will both respawn
Then I would make this as simple as possible and do this
Have a variable that's your score, and set it to replicated
if you want to see OTHER player's scores as well, you will need to use a Player Controller State. Since every client will have one of those for every controller. It's a way of replicating a player controller on a very low-bandwidth solution
That variable holds the score for that player.
When the player dies, you use IsLocallyControlled and simply call Show Score. No need for a client function
That'll only run on the player's controlled controller. Whether it's server, or client. As long as your death event is called to everyone.
If it's not, you can mark your Death function as a NetMulticast which is called on both server and ALL clients. Everyone BUT the person who's controlling that pawn will have IsLocallyControlled false. So it'll only ever be called on the proper player
In your death function, you use IsServer, if it's true you do all your server handling of the death, if false, then do another check, IsLocallyControlled? If yes, call your show score. Nice and neat
Fact is that I'm using this event to display score for all players when one die, so I can use the multicast and run the function locally and not pass any variables
You said that "Only player ever has their controller". But I use a OnPostLogin in GameMode to save all current connected playercontrollers in an array, and that is working? Does the gamemode then hold a reference to the clients controller, and doesn't actually know anything about it?
The server will always have all player controllers
GameMode is only called on the server, clients never even have the GameMode class create
created*
Ah you meant that the client only ever knows about their own controller, gotcha
Had to read it again
Hi guys, what is COND_InitialOnly property of DOREPLIFETIME_CONDITION really do?
from docs // This property will only attempt to send on the initial bunch
but what is " initial bunch" ?
if i'm login in world, this property replicated once? but if i'm create new object this property not replicated
@surreal prism InitialOnly means you're only replicating the variables when a new player joins the game and is creating their version of the world. I don't believe it replicates if that player is already in the world, and you create a new object however because the server and the client will be matching in defaults when it's constructed. The server would change things after its own construction, and by then the object will probably already of been sent to the client for creation so it'd already be considered as "initialized" on their end
@calm hound Thx! One more question, Can I use COND_Custom with UObject Derived class? i'm using ReplicateSubobjects for replicate array of inventory items, but UObject don't have PreReplicataion(...)
only Actor based classes have replication capabilities. I don't believe it's possible to replicate a UObject at all
@calm hound Ok, Thank for your answers 👍
sure thing
Would you guys use property replication or rpc for doing a stun? I normally try to avoid rpc's when possible. However, I think it might be necessary for doing stuns because if I do replication and there is high ping the player is going to keep running on his screen and then teleport back to the position they are really at on the server.
i would do client side prediction
assuming client does not cheat
it will go over smoothly
means, I would apply stun on client side, then server would apply, then compare client result with server result
and if it matches, simulation go on
yeah I'm applying on client and server right now. But sometimes they aren't the same and I'm getting cases where the player is stunned on the server but still running around on the client.
@calm hound it is possible to replicate UObjects
then there is something wrong with your simulation
i would rather resolve this problem first, rather than trying to hack it around
unless you are talking about other clients, not the one which applied stun ?
yes, I am talking about the client that receives the stun
the one that is getting stunned
oh, my bad. Guess they can be.
idk how did you setup your system
but if there is enough data replicated, you can try to predict stun on all clients
I haven't done any prediction yet really
ie, you might now in advance that certain ability will apply stun effect, and if all clients have this ability replicated, then you can just use information about when ability has been activated and let all clients simulate from this point
has anyone else seen projectiles with a low velocity move very jerky on clients?
omg nvm I see what it is
they are still attached to the socket I spawned them at lmao
that is pretty funny
so my idle animation is moving them while they are flying through the air
🤣
I lied, I'm not doing that. Oh well, will keep debugging
@jolly siren might be a tolerance thing somewhere maybes?
Mind you if it's just regular replicated movement I don't see why that would be the case
yeah I'm not doing anything special. just normal replicated movement.
creating a fp template to see if I can reproduce there
oh dang shooter game has a crazy world gravity set. I was trying to figure out why my speeds weren't matching up. trying to test over there
hm maybe I will just have the client spawn his own projectile. because this jittery is ug
@dim wharf I came across this. Are you still planning on creating the blog post for this issue^? https://answers.unrealengine.com/questions/77749/replicated-projectile-movement-components-are-chop.html
hey @jolly siren yes i am. my writing has really dropped off but i'm going to get back into it, and i'll definitely cover how i did projectiles and the component i wrote for it. i'd like to get feedback on that code too so this post can't come too soon!
awesome 😃 I'm sure people in this channel can give you good feedback.
I'm having jitter issues when projectiles have a small speed, like 1000
@jolly siren i should mention that everything is c++ now (looks like i was using blueprints when i wrote that answer). hopefully that is still useful
yeah I do c++ mostly with bp for high level stuff. It is useful. I'm just really surprised that ue doesn't have smoother network projectile movement built in
I'm going to dig through UT and see what they are doing
that's a great idea, i read that codebase a lot and find it very helpful
yeah me too. I will look out for you post tho
this looks like an interesting function
so it looks like they are using client side prediction for at least some of their projectiles
anyways, if any multiplayer gods want to show how they do their projectile client-side prediction I would love to take a peek 😄
@jolly siren yeah, i had more success with client side as well (with server correction); in my case synchronizing bouncing simulated projectiles was the challenge - they can move very quickly and change direction suddenly
it will be good to write something up so i remember what it is i actually did 😃
Yeah I'm very interested in what your final solution was. I would love to see how server correction works.
@ripe folio did you ever get your client side prediction working?
@dim wharf btw why do you do a multicast from the server to spawn the projectile clientside? instead of just spawning the projectile clientside without an rpc
hm well I guess the rpc is needed for spawning it on simulated clients
since the fire input will be on the autonomous proxy
@dim wharf it does seem like your implementation would create 2 projectiles on the clients tho. Since you are spawning on the server and replicating them. and also spawning them in the multicast.
Hmm... reliable RPCs... how "blocking" are they? I need a method that, on level load, can be called from a client to give information (an int32 but that's irrelevant) to the server BEFORE CheckPlayerStart is called on the server.
I definitely wouldn't base that on a network race condition that might work, that's just asking for trouble off the bat
You'll probably have to do some overriding to delay flow until you get all the clients' info within a time threshold
Hey guys
A bit stuck on replicating the function setActorRelativeLocation
Before I tried to replicate it,. the function was working
I didn't have the timeline hooked into the lerp
Ok so it works for the hosting character now but not any of the connecting characters
Welp I got it working. In case anyone was wondering, I was getting the wrong actor for location and trying to only run it on the host.
@jolly siren A while ago, yeah, but not with PhysX
It was with hand-coded physics
And it wasn't always right, but it was using the 'proper' techniques
Not sure on how to do any of that with UE4/PhysX though
@jolly siren i think i do it all quite differently now so it's highly likely that if it looks like an error, it was an error!
@dim wharf ahh okay well if you can share what you ended up with I would appreciate it. At least a quick summary.
@ripe folio I'm just using unreal's built in physics
the awkward moment when your clan mates think you've left them to play some new game called "spacewar" on steam... 😃
@dim wharf are you still replicating the projectiles at all then?
I see why I'm getting jerky projectiles now. Replicating movement actually does do client-side prediction of sorts.
I am modifying the velocity on the server only and velocity isn't replicated. So my server and client projectiles are moving at different speeds.
so movement components velocity isn't replicated. but Actors have a FRepMovement property that is replicated. So I thought setting the LinearVelocity there would stop the jittering on the client. But it doesn't
float Speed = FMath::Max(MinSpeed, MovementComp->InitialSpeed * ChargeUpPower);
MovementComp->Velocity = GetActorForwardVector() * Speed;
ReplicatedMovement.LinearVelocity = MovementComp->Velocity;```
dang everyone is jamming
went ahead and posted it https://answers.unrealengine.com/questions/504647/modify-projectile-velocity-on-client.html
Hi folks! I'm learning about how to implement networking, multiplayer and online services and I just learned about OSS (https://docs.unrealengine.com/latest/INT/Programming/Online/index.html). I'd like to know if you guys like this feature and, also, what implementations of the interface are available. I can only see the Steamworks implementation on the docs. Are there others? Ideally I'd like a distribution platform independent implementation.
@jolly siren is it only the velocity var not replicating?
well nothing on the movement components is replicated
is the component replicated itself
unless, are you sure the velocity value itself ain't replicated?
so that the value is replicated but not applied
ah good point no the component isn't replicated. but it doesn't really matter if it was because it doesn't have any properties that are.
That is what replicated movement on the actor is for
What is the callback for a steam lobby session invite ?
@jolly siren sure, the gist of it is this:
- the owning client's projectile "fires first" and ignores the server for a moment (to give you the client side feel)
- as soon as the first round trip is made, the server is in control - however it has used the client's ping and firing information to predict where the server projectile should initialize
- simulated proxies have also made the prediction (using something simple for lin and ang vels like dead reckoning)
- after the initial round trip, all proxy roles listen to the server, but they perform their updates using only physics movements (teleporting only when the error distance is too large). this "local movement" override is what allows them to be smooth and full physics locally. they'll actually simulate on each client - what will change is their goal velocities and locations, which they will move toward at a rate that is a function of the error distance
- since my projectiles often bounce, and at high velocity, there is special case handling for significant velocity angle differences between server and client. for example, if the dot product between the current velocity and the target velocity is suddenly severe, the client takes a few packets off (checking each time if the dot product severity goes down). this is a way of saying "did the server just bounce? maybe i'm about to bounce?" and either we make progress toward the authoritative location and velocities or we don't, at which point you're either okay to start applying updates from the server again or you should teleport to the right location because you missed a turn
that's all from the top of my head, could be missing some things. hopefully that makes sense
for my game i have a lot of momentous entitires, so dead reckoning as a function of ping has been really helpful for mostly putting everything where it should be
entitires isn't a word but entities is!
i should add that i'm not using ProjectileMovement anymore, i doubt i made that clear. the physics and replication are pretty much all custom at this point. this was a tough decision for me because i really like to rely on proven, existing code where i can (hence using an engine). but i did a lot of experimentation and i'll probably continue to experiment with different approaches up until release.
This is great, thank you for the explanation 😃
anyone had issues with Steam overlay screwing your viewport after level restart?
my game is in 16:9 - if I bring up the overlay (to invite someone to my game), then reload the level, the game renders as 4:3 with black bars either side
.
^ this only happens if I've used the overlay though - if I don't use the overlay, it renders the full window as it should
4.13, steamworks v132
even changing the resolution after that doesn't get it back to normal.. have to delete the appdata... so the generated configs might give me a clue, will search those.
interestingly, the UMG hud/widgets still render correctly, it's just the game itself, strange
yup, you were right
overlay usage was just coincidence, there was a rogue dupe camera
thank god
(actually no, thank YOU for mentioning it)
"By default, Steam sessions are created using ‘Steam Presence’, what this means is that instead of using Steam’s master server list for global server searching, Steam will only return sessions within your Steam region and sometimes sessions related to the people on your friends list."
I'm using the Advanced Sessions plugin which has a tickbox for using "Presence" or not... my game us unlikely to have many servers so I'm not sure if I want Steam being even more selective with which ones it returns... I wonder if I should just turn "UsePresence" off?
could be misunderstanding that.. think I'll leave it on for now
@turbid stratus latest SDK is 137, might be worth updating too!
any way in blueprint using the event logout to stop a client from immediately destroying their possess pawn on disconnect?
I've tried setting it up to un possess off of the event log out in the game mode but it seems to just immediately destroy the pawn before anything else can happen
@chrome bay yea.. but I'm scared of C++/VS, just happy I managed to get it compiling (so I could use plugins), so I've stuck with what Epic had in 4.13
Anyone had the issue with steam overlay that you get the popup in the bottom right corner but you can't get the overlay with shift+tab ?
^ it was caused because of steam VR
I have an odd problem with Steam Sockets currently
One end( the host) has no apparently problems and the ideal time stays under 1 second
the other end (the client) keeps receiveing ack timeouts and the connection overall eventually times out
I have a question about replication. If you set a variable to replicate, and the variable changes only once, does it add lag to the game?
I guess what I'm saying is, are tons of replicated variables that don't change often bad for performance network wise?
No.
Bp all have a net priority which will help determine which data gets first dibs on the next packet. And what can wait till theres less pressing matters.
I have a match on a map with 7 rounds. Thoughts on using gamestate vs game instance for match data / current score?
it seems like using the game instance would make more sense but my game instance also holds references to all of my menus and transitioning between menus and playing
Unless you perform actual level transitions between rounds, GameState would make more sense?
Thats what I was thining. Im actually doing some reading on the ue forums and it seems like game mode might be a better idea
I need to handle all of the rules of the game mode for max players, when to start a round, death, respawning, and win condition
my respawn logic is already in game mode and the level shouldnt be "reset" per say after rounds
Or does that not make sense?
You can reset a level without a transition, GameMode and all Controllers remain persistent when this is done. It gives a convenient way to "Reset" for rounds for example
I handle all rules for a game in the gamemode
This includes scores
Any data i need clients to know about get replicated through the gamestate
ok thanks
All Replicated Variables have to be 'checked' periodically to see if they've changed, so there is some overhead for having a UPROPERTY marked as replicated. However they only have a network cost when they are actually sent out to clients. They're not replicated unless they have changed.
Hello, has anyone created a dedicated server which can be found through server browser?
cause I can connect through console command but the server is not shown in server browser
Well yeah, null wouldn't work. Didn't know if you were doing things over Steam or not, that's about all I can help I think 😛
Your session creation is working fine? You said you could connect by console but do sessions work
And when you're using Steam the overlay comes up and everything, correct? I've seen people just trying Steam in their config file without all the setup, doesn't quite work
When I make a game through game, I can connect on another computer
But when I create a dedicated server, it does not work
And When I Add Node Create session to Gameinstance after Event Init And I am running dedicated server in editor, it works
I can disconnect players and the server is still up
But when I cook the server it just does not work
@brittle sinew
Hmm, not really sure. Haven't personally done stuff with dedicated servers, sorry :/
@twin juniper When doing some googling for mp stuff with steam I saw that there were some known issues with dedicated steam servers. I would make sure that steam is opened and running on the machine with the server.
@twin juniper Also make sure to check that the required ports on the dedicated server are open. This includes any routers as well. Usually if you can't see an advertised session its because your network is blocking the advertisement.
I would try that before anythign else
So basically I should Open port 7777 and try it then?
I think theres a handful of them to open.
yea but by default it runs on 7777
define doesn't work
well steam overlay nor the steam ingame "message" in the right hand corner doesn't popup
so somethings wrong
has something changed? :S
in ue4 i mean
all there is to it is to put the code into "DefaultEngine.ini" and you're done
perhaps [/Script/Engine.Engine]?
that line differs from what's in the docs - not sure if that matters though
given the docs often are outdated
Np. I was fighting this forever
lul
If it doesnt work after that close steam and the editor then reopen steam before the editor
it worked now ^^
tyty ^^
was driving me nuts
couldn't remember that little detail xD
No problem. The guys on this board helped me, glad I could pass it along
4.13 is great except that its not really documented lol
Hey anyone had this warning:
LogOnline:Warning: STEAM: Can't start an online session (Game) in state InProgress ?
I am a bit confused on the use of the dedicated server. Is it a simple server that once compiled you connect to and just works? Is there some good documentation on expanding it and writing server side code?
Thats perfect. Thanks!
You're welcome :P
@ruby furnace This means that your GameMode is in State "InProgress" and you tried to Start it again
If you game doesn'T break, ignore it
@thin stratus I am creating a session with steam in C++. It gives that warning, but it still works
was just wondering if it was an issue
btw do you have tips for running two steam sessions on one pc for testing ?
You can't
Maybe with a Virtual Box
@ruby furnace But yeah, if you look into the code, it somewhere calls "ReadyToStartMatch" (which you can override) and if this is true, it calls "StartMatch" or something like that in GameMode.
And that goes through GameMode, GameState and GameSession. And GameSession will probably call your Steam function
But it sounds like you are manually calling it too late
tried virtual box but it doesn't have DX10. Well soon I have two pcs, then I don't have this issue.
And thanks, will check it out
You made that blueprint multiplayer example right ?
@thin stratus
eehm
Which one
The BallBump
?
That's outdated in terms of knowledge
@ruby furnace
But I have a WiP Steam Example project
For Session stuff
Was supposed to give examples for Steam functions (Friends etc) and Sessions, but haven't had time to add more than the session
and they are not done yet
But if you need a peak, gimme your github account name or email
peek/peak? English
I guess 'peek'
@thin stratus Oke, I am working on a C++ plugin for steam and session stuff
but your thing is on the marketplace right ?
Öhm, slow, I have a Lobby System on the Marketplace, but that only uses the BP nodes for Sessions.
And I have the Session Tutorial for C++
Which is a wiki entry
And I have a private GitHub repo with more C++ code for Sessions and better commented
@ruby furnace
@thin stratus Aah oke that explains it :p
@ruby furnace C++ Steam/Session plugin that exposes everything to BP ?
pretty much
JustDoIt
Yeah I found that everybody is like following tutorials (either from Epic or not) and everybody has to do it everytime. Plus C++ has so much more options
If i'm want to use Dedicated Server with Steam, I need to download third party addon for steam sessions?
@ruby furnace @wary willow Then concentrate on the Steam part. There is already a Session Plugin
@thin stratus @ruby furnace no need for two plugins though if someone is willing to do it all
I would rather have one plugin for it all
And pay good monies for it
Session != Steam
Aye
So no, keep it two if possible
That's stupid
Why would I want to download a Plugin that exposes sessions stuff if I don't want the Steam shit in it?
...
Expose the Steam functions in a separated Plugin
¯_(ツ)_/¯
heh
What you said just now didn't make any sense with the conversation that was had
If I want a Steam Multiplayer Plugin
I want EVERYTHING that I need to make that happen
Steam functions and Session functions are 2 different things.
Session Funtions are covered, so Steam functions alone are enough
If I am using a STEAM MP plugin..
Do you now understand it?
I WANT it all...
Then download both Plugins
There is no special Session stuff for steam
and is still quite valid...
It's only different settings
There is NO reason to have to download two different plugins by two different people
when one person can just do it all
There is also no reason to rewrite a plugin that already exists
Is it perfect?
I mean, this is subjective
Of course anyone can rewrite a plugin that already exists
And make it cater towards the Steam side
I don't care if someone wants to waste his time on exposing all the code for sessions again.
Sure do it, but my advice is to expose Steam alone
Aye
As a customer, if I wanted to do Steam stuff, then I would want one plugin that fit the bill, from start to finish, not have to learn two different plugin, deal with two different people, etc.
This is from a customer standpoint. And if @ruby furnace feels like selling his plugin on the MP, then this would be a great way to get some $$$
People are lazy by nature
This is how you get into their pockets
You could
Anyway, not sure why all the beef
But, if he wanted to do it, and I would suggest he does, especially if his intention is to sell...
Then he should do it.
There is no beef. I just say that it makes no sense. There is a good plugin with all kinds of stuff. There is nearly no second why of writing it.
It would be a complete copy and costs lot of time.
I am not really sure what my plan with it is. First it a learning experience. Normally I only write code for the editor/engine, using the engine on a game level is always good.
Either you accept that or have your own opinion. I'm not arguing to a point where I convince you :D
If it is a complete copy...and nothing can be improved on...then Epic is failing us
Why Epic
Because they choose not to expose things when it is possible and has been for some time now.
You only realize this now?
And people are dependent on community plugins to make the engine work like it should by default
Of course they can expose tons of stuff and decide to not to
Yeah so, Epic fails you then.
I mean, RIP Paper2D
They don't want to expose certain things due to "Too complex for BP users"
and due to "We have no time and our resources are elsewhere"
For some reason, I don't think that logic works anymore
But for sure, it's more about priority than not
Open an AnswerHUB post. Ask for Quaternions being exposed to Blueprints and name reasons such as "Gimbal Lock"
They will tell you that Quaterions are too complex for BP users and that they want to keep it simple with Rotators
¯_(ツ)_/¯
And that applies for Session Stuff too
And even you put up a PR, then they tell you to create a Plugin
Aye
Like I said awhile back. A uservoice would be nice.
But they have "issues" page now, but that's barely used.
anyway, for me it is just learning and I'll see what I include and if I am going to sell or something
I dont have time pressure for a game or something
@wary willow Allar was working on a full plugin solution for steam + dedicated servers but it was a long time ago and you would have to ask him if it is still being developed
Quick question to anyone who has tried, does the PartyBeacon LobbyBeacon system work with the steam subsystem?
Who knows
I have been trying to get it working for the past 3 weeks
Here is my answerhub on it and it has a link to my forum thread without any answers
I got LobbyBeacon almost working however the client never seems to finish the connection
the LobbyBeacon system is almost needed to test the PartyBeacon system so I havn't gotten that far yet
@livid aspen One bug to watch out for with steam beacons is that they can ONLY host on steam sockets with how engine code is currently setup
Hmm
I hope to finalize some changes on my end and put a PR in for it and see if its accepted
Sounds good. I think I'm gonna put this on the backburner for a while and come back to it later. But if you're using steam and its at least getting set up thats good
Rocket league uses it I think and they use steam
so I'm not super worried
They use unreal engine 3 however
My first thought was to email them and do some research however they use the old system from UE3 which is different
If you use that code however it should atleast start a connection, its the client that never finalizing the connection and im not sure why yet
The client keeps reporting ack timeout even though the host can communicate with the client fine
Hmm
That just makes me think its a port configuration error
I don't really understand the system yet though. Thanks for your help
I might send you a message in a couple of weeks to see if you've made any progress
Ya np, no documentation on it at all
and working on it through steam requires atleast 2 computers and 2 accounts
Yeah, Steamworks is a pain for the first timers
I'm back at it, trying to figure it all out
I can get the server to shoot and show the clients. And I can show the client shooting. But I can't get the client to tell everyone that they are shooting.
Thoughts?
I can do it fine in the base player, the replication. There is no issue.
But when I do it inside another bp there are issues.
As you can see above.
From what I've read, there is no true p2p in UE4
So if you want to update all clients about an action its either through the server or not at all
But I could be wrong
@lament kettle
Whats the best way to set a players velocity and have it networked? I have been setting the velocity with UCharacterMovementComponent and that works great in single player.
that component does all the replication for you
@lament kettle what's the issue
I see all your events are set to execute on server? so none of them executes client-side?
@lament kettle Define "another Blueprint"
I would guess he tries to call "Server RPCs" in Server owned Actors
looks like he's trying to spawn the projectiles client-side here
What does exatly RCP mean?
Thx
so pretty much a 'function'/event that runs remotely
Yea I know what it is I just did not know the words😃
😛
Can anyone help me with https://answers.unrealengine.com/questions/506803/alobbybeaconclient-not-finishing-connection.html I can't seem to figure out why the client keeps timing out
Especially whenever the host appearntly has no problem talking to the client
Is Source really the only way to fix the Steam Leaderboard bugs?
As far as I know
or just get the steam oss plugin source and recompile it
but then you have to share the binaries with your entire team
Damn, lame
More Upvotes:) https://issues.unrealengine.com/issue/UE-24791
@ivory parcel Maybe try pinging one of the epic staff
Wouldn't know who to ping
https://cloud.whinis.com/index.php/s/UHtM5QhiehGFkXb/download I am so confused
@ivory parcel if you have the engine source, you can do a git blame on one of the subsystem files, which will show you who has worked on those files, which should help you figure out which devs to contact (assuming they're active on the forums, etc)
alternatively if shooterdemo has subsystem code you can git blame there and see (i forget whether it wraps up steam or not)
Anyone know how to keep an anim notify from double triggering on client?
yeah i ended up using an is server check in the animation blueprint
Thanks though 😄
@wary willow voted
@wary willow Is there a PR for it?
@ivory parcel I am also learning in my spare time how sessions (with steam) including creating lobby beacons work. I am asking around if there is someone who knows.
Ya, I am beginning to think that the current implementation of steam sockets is bugged or something
@ivory parcel I favorited your question, so I won't forget :p
Ya I messaged one of the few epic staff that has said stuff on beacons so I hope to get a reply soonish
I am a contractor for Epic
But I want to create a plugin that makes using sessions (mainly steam) easier for both C++ and Blueprints
@ivory parcel Did you see this post: https://answers.unrealengine.com/questions/467973/what-are-online-beacons-and-how-do-they-work.html ?
Ya, its a good explanation for beaons themselves but not Lobby or Party beacons
I have managed to get a simple Test beacon working using the standard IpNet driver
however I have not managed to get Lobby or Part beacons working and it appears Steam Sockets may be broken
But such a plugin would be nice honestly, there is already the Advanced Session Plugin for blueprint
I don't think its targetted to steam however
is there a working approach on setting a player to spectate thru BPs?
@ruby furnace If you have questions while creating the plugin, just ask (:
I don't know everything, but I already encoutered some stuff
@thin stratus Cool thanks!
Will be moving in a week though, so won't have spare time for a while 😦
Well, let's make it like this.
Create a private repo for your Plugin and add me.
If you have a question or need help, I will look over it
btw that plugin you were talking about is mainly for blueprints, I want my plugin to also make it a lot easier to do stuff in C++
For the C++ part, any idea how you want to do this?
Easier mostly means that you wrap functions into other functions to take away confusing code
While working with C++ Steam/sessions, i feel like more freedom is better
Still allow freedom but have all the basic things implemented.
I mean projects are alive, when something is wrong with it you fix it
Are you aware of the test classes for Network functionalities?
for now I just need to implement the default stuff, since I know barely anything about it
and no
@ruby furnace Haven't checked them out in terms of actually using them. But they show use cases
Might be help ful
Na it's mostly classes you create and call the test function to check if oyur stuff works
but you can't actually use it for your game ?
Na it's really just test classes for your subsystem code
But they might show how to actually call what stuff
yeah it does! thanks for the reference
@thin stratus one attached to that issue report but there are like 2 others that are similar PRs... almost a year later
what ?
I wish I knew these test exist, still not sure it would help with my steam socket problem
Quick question. How difficult is it to set up two different charaters and controlers? Nothing fancy.
not remote or online or anyhing, just in the same game locally
In blueprints
@merry pawn Very simple, by using 2 nodes: "Create Player" and "Get Player Controller" (or just setup last one in character's details "Pawn" and "Input").
Ok cool, I hadnt looked much into it but was wanting to do some playtesting and was wondering if that woudl be easier than ai
cause I dislike AI -_-
well it dislikes you as well
Well, if I disable steam sockets everything seems to work ¯_(ツ)_/¯
So, the steam subsytem is setup such that unless your playing a lan game it doesn't allow you to get the IP address and forces you to use steam sockets.
That seems rather short sighted
Why does an AuthToken change constantly?
Why wouldn't a Steam Authentication Token be the same for the player throughout the session?
(well, if that's what I even have that is)
Actually, some of it stays the same ... ahh... so newb at this stuff it's annoying
Hmm, well, it's running on tick, I wonder if it gets used up after I ask for one
(╯°□°)╯︵ ┻━┻
@wary willow I'm not sure how Steam auth tokens work specifically, but typically you (1) request an auth token (by passing credentials, for example) and then (2) include it in your requests until it expires at which point your system should (3) defer to a refresh token! (if you received one in the original auth token response) or (4) request a new auth token and begin using that. And repeat.
do you know the expiry for steam auth tokens, and if they use the refresh token model?
The reason some of that string may stay the same is that it might be an encoded composite token which contains some static information (for example, your requester ID and permission or something that doesn't change) and then more transient information (like your auth token and perhaps a refresh token)
Often an encoded token in a system with several token types will be able to announce its type through its value, if that makes sense
so the "type" part of the token string would remain constant
I don't know shit
hey man that's a start! 😄
All I know is I am calling the GetAuthToken from the IOnlineSubsyem
Originally, I was trying to get the PlayerController to decide the authtoken for the player, but for some reason I couldn't get that to work, so I just set it to 0, since I only care about the local player for now.
FString AMyCharacter::GetSessionTicket(class APlayerController* PlayerController)
{
FString SessionTicket = iOnline->GetIdentityInterface()->GetAuthToken(0);
return SessionTicket;
}
So like I said I don't know about Steam specifically, but in most authentication systems you can think of the GetAuthToken request as a login
Aye
so you would ideally only do it once (or when necessary, like i mentioned above)
so perhaps just moving it out of Tick for now to test would help
and then try using it some time later to request information -
Well, it didn't matter actually
I did move it out
And only called it once
I am using GameSparks
and then you try to make a different request to the subsystem and it fails?
and was trying to get Steam Authentication to work
I needed a session ticket
I get the ticket, input it to the Steam Authenticator, but there's still something wrong
Does it return any errors?
What do they look like?
Um, nothing viable on UE4
i see, and maybe the full error isn't propagated completely
That's one problem, but as long as I have the session ticket, I am fine for now
you could grep around the stack (yours, through the plugin, the steam subsystem code) for that NOT_CONFIGURED error and see what throws that
cool
If this doesn't work
I might just DL the SDK again
And try to access it directly
Steamworks SDK
that's a good idea; that will at least allow you to compare requests/errors and isolate the problem
Anyone have a network-heavy game and given 4.14 a shot? Keen to see what these improvements have done
Cus if Paragon is anything to go by, not a lot haha.
@chrome bay lol
I know paragon is a fairly network heavy game, but sometimes it lags like a right bastard. Never really sure what the cause of it is
But it doesn't give me much hope working on an FPS / RTS hybrid -.-
Paragon is on it's own version, UT too to some extent
Lots of changes for the engine the last few releases have come from Paragons internal engine build
Which makes me wonder if these network fixes have come from it too
well, improvements shall we say
40% is a mighty claim
if these are changes for that reason, I'm going to be forced to version change... and embrace the future
and... broken voip
Yeah, to be honest when a new version comes out, I always prioritise upgrading. Simply because I have no idea how many versions will come out before I release, and god knows what thing will arrive in the future that I'll want
Did screw me over during 4.12 previews for a few weeks though...
I bet 😛
I'm going to be jumping from 4.11 to 4.14, and a new version of physx lib
I am really not looking forward to see what breaks
it's annoying situation because aparrently VOIP broke after 4.11, and tesselation performance somehow got worse
¯_(ツ)_/¯
I wish I had the knowhow to bring in select changes I want to my own source engine, since I have changed a whole bunch of crap in it too
Fuck that, I tried working with source engine a couple times. Utter nightmare
I just embrace the issues :p
noooOoooOOoo
it sounds like the have changed a bunch of things in the gamemode class too
that's going to screw me
Yeah Gamemode got some attention for sure
They did one change which IMO is really godamn stupid. Added an override for InitNewPlayer, which just calls another verison of InitNewPlayer
Instead of changing the calls TO that function, they just made a new one and did what I would call a bandaid fix
Totally undocumented ofc
=/
honestly the only thing they needed to do to gamemode is just go in and expose all the stuff to BP that should already be exposed, like spectator functions and bools, and things like that. It's a paint to have to expose these things yourself when they are so basic
pain*
I remember I was chasing a problem with spectators being reset when the gamestate changed, but the said they were reworking the gamemode to fix this
or something
I gave up and wrote my own spectator system haha
I knew what I wanted so it was easier
just... check always spectator and fixed ><
yeah true
I have it so if you go spectator it makes onlyspectator true and then the player won't be reset and spawned accidentally
Ah I did my own spawning system and everything, basically shredded the gamemode to pieces.
I needed multiple rounds etc as well, which gamemode doesn't natively have any support for
Got my own respawn timers etc. Was actually oddly fun to do, make a cool gameloop
huh sweet sounds like you went all out
Mine just has CS style round, warmup preround etc, and spectate
I have to make an assault and capture gamemode next, not sure how that's going to work
about VoIP (a bit late), it seems to work again in 4.13, at least on the Null subsystem
okay, just tested again, not so sure anymore... -_-
Hey all,
I've recently been trying to setup local asynchronous multiplayer where one player would be in VR and one using the desktop and have run into all sorts of problems.
To help me wrap my head around it, I've decided to strip out the VR side for now and create a simple setup as follows:
- Dedicated server
- 2 players
- Players start as spectators
- 2 different actors are spawned
- each client possesses one of these and gains control
Seem to constantly be running into problems with the possess side of things. I've read the documentation and tried to follow that, but feel like I'm going in circles.
Is anyone able to explain how this should be done. What should be put into my game mode BP, what should go in the level blueprint, etc.
Are you looking to significantly differ from default functionality? The default GameMode flow spawns a PlayerController and Pawn for each player, then has the PC possess the pawn it spawned
I would look at the default GameMode if you're confused to what exactly goes on, it shouldn't be too hard to follow what happens when and in what order
Apart from there being 2 different pawns, no, that sounds like what I'm after. Maybe my mistake was making my own GameMode BP to start with
Well it's fine using your own GameMode BP, the default GameMode functions still occur, you can just override them
If I switch to the default GameMode and hit Browse to Asset in Content Browser it does nothing...
You have to manually enable engine content, but the default GameMode is written in C++, so it might be a bit hard to follow, didn't know you're in BP
ah yeah, wouldnt have a clue looking at code rather than BP
maybe this is better asked in the BP channel
What is your problem exactly with the possess side of things?
on our side we used a bit of C++ but should be doable in BP
Well, VoIP does not work anymore on my last build, I don't understand. This VoIP thing starts to be a nightmare ^^
I'm replicating a bool. Does anyone know how I could reset it on the server AFTER it's been replicated without an RPC?
wut
lol what part didn't you understand?
also, does a value have to change on the server to replicate?or will it check if the client value is out of sync and replicate it to fix that?
I would assume the server would correct the client if the client didnt explicitly call for an update on the server
Its how you prevent cheating
If I set a box component on my character to be replicated, is that not enough to replicate things like its relative location and collision state?
@dim portal depend of your need, you need to replicate those thing to many player ? what the logic between this box component ?
you need to change his location during runtime ?
but I think it's better to prototype your game and optimize bandwidth later, nevermind if there are some useless replicated variable
bandwidth shouldn't be an issue, right now I got it working with a multicast, but I thought maybe some its properties should of been taken care of if I set it to be replicated using SetIsReplicated
This is what I had been after all week...sadly it took just 20 mins to make a tutorial: https://youtu.be/4CgeAxiS19s
This is what I was talking about. Are there any options besides RPC for being able to trigger my projectiles multiple times? http://hastebin.com/rivacojiwi.cpp
If I set bTriggered to false at line 64 then it won't replicate to the client
💩
@wary willow Have you managed to get SteamSockets working ?
@ivory parcel haven't tried that
But I'll be playing more with whatever is default in the engine
They seem to be entirely non-functional for me on 4.11
And then, move onto Steamworks SDK proper
I havn't even really got into the Steam SDK too much, just what the steam subsystem automatically does in place of normal IPNet Driver
Using IpNet everything works OK, but the subsystem seems to prevent you from retrieving that
No idea, I don't know crap about onlinesubsystems other than from the past few weeks trying to disect them, I need to really up my game with MP though, but yeah, OSS are used for more than just MP
True, My problem has been that steam doesn't seem to tell the engine if the server in unreachable I guess
so if you join game and the sockets are not working the engine gets no warning
I don't see anything in the logs if I click JoinGame in steam
so, if steam is not available, nothign would happen
Hmm, that part I am unsure of, like I said, complete newb in this field really
But I do know you can catches to see if Steam is available or not
Unless I host a session with bUsePresense is false in which case it joins a "lobby" session of some type
You can force OSS to only be Steam
and if it's not available, then do something else
It'll throw out an error for sure
Im not talking about that sadly, im talking about joining sessions
On the steam friends interface if you right click your friend and click join game its suppose to send off a call to OnSessionUserInviteAccepted
However if the server they are on is unreachable steam doesn't appear to do anything as far as I can tell
Which is annoying
Ya, but the problem is I don't see it being called if it failed
Not sure if steam is not calling the method or the engine prevents it somewhere
OnSessionUserInviteAccepted gets called first to cleanup stuff it looks like
And then it says it calls JoinSession()
Or rather, that's how the invite is accepted
Yep, should be
there is a param in the cleanup code, that states if it was successful or not
bWasSuccessful
The whole flow according to steam and what I have seen is that whenever you click it either in the overlay or steam client itself it calls a GameServerChangeRequested event
The engine is suppose to capture that and that calls OnSessionUserInviteAccepted
So I am about to see if steam isn't broadcasting that or the engine is ignoring it
Yeah no idea. But if you haven't figured it out by then, eventually I'll have to mess with that.
Yep
it appears that that particular callback was not registered in the subsytem, not sure why though
Well thats odd and interesting. GameServerChangeRequested _t Is not in the current OSS for steam however if you are hosting a GameServer session its whats called
GameLobbyJoinRequested_t is Only called for lobby sessions and is the one registered
So if bUsesPresence is true then the steam overlay essentially doesn't work
Running 4.12.5. Im Getting some weirdness from what appears to be the CharacterMovementComponent when my Character spawns a whole bunch of actors (bullets) the CharacterMovementComponents replication seems to slow down to near 1 FPS updates while everything else appears to be carrying on at 100+FPS.
No sign of any issues in ANY of the stat data. So im wondering if its not somehow intentionally slowing itself down to a frame crawl. I even tried removing the projectiles and children under the character thinking maybe their tick time was somehow sinking the primary characters tick time. But no luck.. And its purely on the replicated (Third party screen) First party screen updates as expected.
Checked my bandwidth.. Plentiful. No bottleneck there. Far as i can tell. Besides its net priority is set to 3 so..It should get first dibs, But alas... Nadda..
It turned out it was the Net Priority. Still not sure how it calculates the priority per actor, But basicaly Even though my Projectiles were only set to Net Priority : 1 . They were still getting all the net priority over my Character (Net Priority : 3).
After finally adjusting the Net Priority down to : 0.1, And cranking my character up to 100 priority it appears to be much better.
So im wondering if each individual projectile actor is creating an additive effect on the priority. Something like Each Projectile has priority 1, And i have 30 projectiles therefore net priority = 30.. Or something.
Anyway its obviously sortable.. Gladly... But put into question my understanding of their replication priority system.
Any thoughts on how to track when a client joins the server? And assigning clients unique IDs? As well retaining the unique IDs across level changes? Been at this for awhile. Blueprint project.
Not sure on blueprint
@golden granite on your gamemode you can override this function : http://prntscr.com/cxcnrn
I'll look into that later, have to head to work 😦 If you have any links or more information feel free to leave it in chat. Thanks.
Does ue4 really have no LLAPI?
@wary willow I have found that the Steam callback required for the Join Game button on the friends list is not implemented
So I have had to implement a version thats likely not PR safe currently
Atleast Its not implemented if the server sessions is created with bUsesPresense as false
If bUsesPresense is true then there is a callback to OnSessionUserInviteAccepted
@regal hazelblue#4427 I suppose I'm not understanding how to communicate with the client that connects once they're received through the OnPostLogin event.
Dumb question: Is there any way to get player pawn or controller from the gamestate player array?
any workaround on setting a player as spectator thru BPs?
@heady delta if you are on the server side, yes
The owner of the PlayerState is the PlayerController
@thin stratus sweet cheers
Yo
Anyone know if I need different domain names/steam web api for different games?
I should be able to just have one steam api key for all games right? I mean, it's not like I can get more than one api key anyway...
Probably just answered my own question nvm
I'm trying to assign clients a unique ID. I know I can generate an ID per client connected using OnPostLogin, but how do I get that ID to the client connecting?
You could feed it onto the PlayerController, or the PlayerState
Most likely the PlayerState if you want all clients to know about other clients' IDs
Though I'm not 100% sure when the PlayerState gets constructed, don't have the source here with me
The problem I'm having is that the OnPostLogin is server only, so arrives only to the server. I do see that the player controller is supplied. If I cast to the player controller blueprint does it automatically apply to the proper client?
If you use a replicated variable, yes. You can't guarantee when that variable will arrive at the client however, so you should wait until the RepNotify to do anything
Or form a flow that can go on without it
I did try that as well, but it seemed like it wasn't replicating. Perhaps it didn't yet travel through but I'd think on LAN it would be almost instantly.
Are you checking for the replication once? Or multiple times
Because you're most likely running into a race condition, even on LAN
Well I scrapped all the previous attempts. I'll try something new here real quickk.
Got it working with one unexpected issue.
GameMode OnPostLogin
PlayerController
The server gets the call three times, the total amount of players (server client client), but every time when it gets to the second branch check int != -1, it always returns true.
So what happens is the server is updated with every unique ID, keeping only the last.
When it should be keeping only the first.
PrintString
If I remove the IsServer Branch check and add a print string to the end this is what shows up.
When your server logs out, it's most likely not the server's PC, but the server acting on the client's. Unless that's not what is happening
Personally I would keep the player's struct replicated and change that on the server, not let the client set its own
But that's just from what I'm seeing here
That does make sense but then that would put me back to my initial problem: how do I know which client is talking to the server?
The idea was that when a client performs an action it sends along it's unique ID
Unless there's another way to identify which client is talking to the server so I may pull the right information about that client.
You should just be able to identify by what PlayerController makes the call
I noticed player controllers come through as PlayerControllerName# in the OnPostLogin event but when a client sends a player controller it's always just PlayerControllerName.
Maybe the name doesn't matter and there's another identifier I'm not seeing through debug text.
Just wondering, what kind of actions are you looking to perform that requires what you want?
It's a board game so I want the server to be aware of which client is sending information. That way I know if it's their turn, if they have the card they're trying to send, and so on.
All that information is held on the server but I just need to be able to identify which client is sending the information so I can pull the correct stored information.
You probably would set up server functions on the PC itself then, and can do checks on its info within the server's version of the PC
And delegate function calls from there
Yes
Awesome, think I got it.
Still don't know why the server's player information isn't sticking but other than that good.
Because you're setting it on the client, its ID is 0 when you set it on the server
Even when I throw in the IsServer check then assign the ID, it still seems to be lost. It's not an issue though because I'll be using player controllers instead which will eliminate that process.
Your issue is the struct isn't replicated, so it'll stick onto the client but not the server
ah
It can be tough to wrap your head around the multiplayer model, don't get too discouraged at it 😄
Still doing it but I believe that's just due to things running out of order.
And it's bad practice that way any how so I'm just going to delete itand go with what I know works.
So assuming I'm using a lobby system I store the player controllers into an array as I get them through OnPostLogin. Then if a client says, "I want my name to be Distul" they will pass Distul through a Run On Server event along with their player controller as well. Then I just use Find In Array on the server with the provided player controller to get my index, and then change the data.
If you're using a run on server event you don't need to pass the PC, because it's already running on the server's copy
And then (assuming the variable is on the PC), you can just change it right there. No finding involved
I meant pass the PC of the client.
EG: Custom Event named ForfeitGame which is Run On Server. If a client wants to forfeit they perform ForfeitGame with their PC passed through the event, then the server knows which PC/client is quitting.
"The server" isn't some one thing, each PC exists on the server
And when you perform a run on server call, it calls the function on the same PC, just the server's copy
oh
Which will then propagate replicated variables back down to the client's copy
Yeah that's where I had a hiccup in understanding too.
So let's say my client is multiplayer_pc3 on server, and the player draws a card which issues a Run On Server DrawCard event. Let's assume that when the DrawCard runs it's done on the server. If inside DrawCard I used GetPlayerController would that return multiplayer_pc3 or the servers PC which would likely be multiplayer_pc
You wouldn't use GetPlayerController, you can act on the PC just the same as if it's the client's
Each object has its own server functions, and its own server copy
I understand it's a bit tough to get your head wrapped around it, I was in the same spot at one point. But each object is its own thing, and when you call server functions it acts on the same object it's called from
I believe I understand you but I'm just having a hard time visualizing it.
I'd have to see it in blueprints to fully grasp it. I've been watching some tutorials but all the ones I've found are a bit excessive. EG: I watched one on session handling and part of it was adding the UMG. However, instead of just adding the buttons and talking about the code they went on for fifteen minutes about how to anchor buttons, place them in size boxes, and so on.
All very useful information but rather watched that in a different tutorial and saved some time. So yeah, don't have time for that lol.
Just try to think of the server as less of a central hub in this situation. Each object in the game (that's replicated) exists on both the client and the server. So when you call server functions from the client, the server still calls the function on the same object, just with authority over it
Yeah, that I completely understand. The problem I was having is I wanted to store certain information on server only, and I wasn't sure how to identify which client was requesting that information.
I'm starting to see my errors though.
I also noticed you can't run functions on server.
What do you mean?
There's no option to Replicate functions, eg: ReturnItemName (not custom event). But I suppose you wouldn't really need to. Sorry, as I'm talking I'm kind of visualizing things and figuring it out as I type haha.
There's no reason to replicate a function because they should just be used to modify local data and return results which if needed to be replicated would be done in the custom event.
Yeah, but if you need to run functions to get info on the server I would generally do that on the server side to prevent clients doing stuff with it
Rule 1: Never trust the client 😛
That's what I'm aiming for. That's the idea of RunOnServer, right?
Yeah
This is obviously my first multiplayer game, and although I want to do my best to ensure people can't cheat. Especially since I'm doing it for another.
It's not a big project though so it's a good opportunity for me. I'm fine with everything else, just getting down the multiplayer stuff.
Yeah it's definitely a big leap coding for multiplayer. But once you get it down, it'll be second nature
Thank you for all your help btw. I've been at this for a couple days and you really clarified it for me.
No problem, glad to help 😃
Ok so. Get World Delta Seconds seems to just break after a client connects to a server.
Its seems to be pretty much stuck at 0.01 .
All day to find out my level file was apparently corrupted. Or so it seems. Still not sure bout the stability of the Get World Delta at the moment, But apparently migrated everything into a new level fixed the hung delta bug i was experiencing.
Nope.. Nevermind.. false alarm somehow time dilation got messed up for my (broken level), Cant believe i missed the (World Settings).. Facepalm.
Hi everyone! I'm a bit lost with variable replication. I have a struct array in GameMode, which I would like to share with (only) 1 Client. I'm sure I'm overthinking this by now, so could you please elaborate on how would you approach this issue?
@pliant cypress Hi, GameMode only exist on server, well you can't replicate variables with.
You can use GameState, PlayerState or your Pawn instead, it depends on what you want to achieve :)
@rare cloud Sorry, my (card) game is running in GameMode, but Variables are in GameState as it should be. I wish to "pass on" data to the individual players, so they have an array as well, but not for everyone, just one player, because all players see the game area differently. I can "pass on" the data to the "Server Player" but not the Client, which makes me think that I didn't really made anything and just had access to the data because it is on the server already.
@pliant cypress Ok well if you need to filter which player need this informations, you will need to override the AActor::PreReplication function, and use the DOREPLIFETIME_ACTIVE_OVERRIDE macro, this macro will check a boolean, like bReplicateMyAwesomeArray, if set to true your array will be replicate, well inside your gamemode you only need to set to true this boolean and set the array.
More informations about the macro here : https://www.unrealengine.com/blog/network-tips-and-tricks
@rare cloud I have no problem separating the data for each player, but I'm not sure how to send the information to a client
@modern fable it is a Struct Array
yea but I mean, is that data game-relevant?
@modern fable it is the core data to determine what the player sees on the map
@pliant cypress " but I'm not sure how to send the information to a client" can you explain more precisely where did you need help ? this is really vague ^^
Your replication will be on your Pawn or your PlayerState, it's a Card game well I don't think you need to respawn your pawn (you will lose all informations inside your Pawn whereas PlayerState's informations stay persistant)
well choose the most confortable for you
after "Tag" your variable as Replicated inside the UPROPERTY of this variable, using a RepNotify here can be really useful to update your map render once the array is replicated 😃
@rare cloud sorry if I am not clear enough, still a beginner :)
I would like to show the game board differently to each player, as they do not see each other's hands. To achieve this, I made a struct array in GameState, where I store all the game data, and through GameMode is the only way to change that array. I made 2 other arrays, which only contain information for 1 player, so they cannot cheat and look into the code and see what is in the other player's hand. My question is, what would be the best way, to make that array available to the players, each only accessing the array relevant to them? How to "send" the data to the client? Where should I store it in a way, that each side can access their data and based on that will be able to build a map?
To be clear: the only question here is to "push" data from the server to (only) 1 client.
@pliant cypress No problem, you're welcome :D
Well GameState is better to replicate global informations, not for individual one, PlayerState is better for those kind of things
Well you need to:
- Create a PlayerState, declare bReplicateStructArray and your struct array (don't forget to add Replicated to its UPROPERTY) , override PreReplication() and write something like:
DOREPLIFETIME_ACTIVE_OVERRIDE( AMyPlayerState, ReplicatedStructArray, bReplicateStructArray );
also don't forge to declare the GetLifetimeReplicatedProps(..) function and include "Net/UnrealNetwork.h"
-
Set your custom PlayerState inside your Gamemode
-
Now, Get the player you want to replicate the struct array, get his playerstate set bReplicateStructArray, and set your Array.
It will be replicate to the client and only this one 😃
Also I explained before, using RepNotify instead of a simple replication will be better for you to update map render on client side
I'm using BP only, I should have mentioned that
I try to send a screenshot, but Print Screen does not work anymore on my PC for some weird reason
@pliant cypress Ok ok it's BP only, hmm if you add a non-replicated struct array to your Pawn/PlayerState and you create an RPC with your array as parameter
and you call this RPC from GameMode it will work normally
@rare cloud I think I see what you mean. I never used PlayerState before, probably that is why it was so hard to find a solution alone. Thank you for the great advice, I will try this! 😃
My answer is imcomplete, don't forget to fill your non replicated array with the RPC's array
@pliant cypress No problem 😃
@rare cloud "create an RPC with your array as parameter" could you explain that
Create a Custom Event
set it as Run on owning client
for replication
and add your struct array as parameter
hm...
what object should I connect to Player State so I can cast to it?
GameMode GameState, Player Pawn and PlayerController doesnt work
A PlayerState is its own object, you don't cast to it
Unless you have your own custom one, but you still need to get the player state
@pliant cypress, your custom event will be on your playerstate, and call from your GameMode
@rare cloud jepp, got it now, I have input on the Client side as well. Still not perfect but I will figure it out the rest tomorrow with fresh mind. Thank you very much for all the help! 😃
@pliant cypress No problem 😃
one thing, direct IP connection doesnt work becouse ports and stuff
with Sessions, will it get opened or something?
i mean no online subsystem
and if i use steam as online subsystem to host the session, does it work then?
What do you mean because I have been struggling with that for a bit now
Just starting a session doesn't seem to open ports automatically in say your router
@summer nova If you Use steam subsystems you cannot connect via direct IP unless you open the map with the option bIsLanMatch
first, im opening the map as Listen
and im not using any subsystem for now
in fact, i have to close steam
if steam is opened, then i cant connect by IP even on Lan
but with that closed, i can play Lan
If you are using the steam subsystem than that makes sense
but not online with external ip
otherwise it doesn't
btw, what is the default?
as far as I know
my gamemode is just child of GameMode
The default is Null subsystem
but i cant seem to connect from external
that is probably because of NAT on your router
To my knowledge UE4 doesn't attempt todo UPNP
In my experience currently on 4.11 the steam subsystem with steam sockets doesn't work at all and im not sure why
It attempts to but the connection never completes, in theory according to the steam SDK it should
It will either use NAT punchtrough and if that fails use a steam relay server
the thing is that i shouldnt use steamworks
becouse its a VR game and ill probably release on oculus store first
i doubt steam is going to be happy if i use steamworks for development and end up releasing on oculus
I have no idea on that one, Im just a code monkey not marketing person
https://answers.unrealengine.com/questions/52877/network-how-to-connect-to-a-remote-listening-serve.html Here is a method of possibly setting up UPNP which should auto open the ports on about 96% of routers
but its not a full tutorial
They can, this just punches holes in routers for them
so this is the only way?
otherwise you would have to link them to https://portforward.com/ or similar and tell them to open ports 7777
A port forward is a way of making a computer on your home or business network accessible to computers on the internet, even though they are behind a router. It is commonly used in gaming, security camera setup, voice over ip, and downloading files.
Another way would be to petition epic to include UPNP by default 😄
would make my life easier
might try that thing
It basically removes problems for less-technically oriented users
// Create the proper Steam P2P address for this machine
NewSessionInfo->SteamP2PAddr = ISocketSubsystem::Get()->GetLocalBindAddr(*GLog);
NewSessionInfo->SteamP2PAddr->SetPort(Subsystem->GetGameServerGamePort());
UE_LOG_ONLINE(Verbose, TEXT("Server SteamP2P IP: %s"), *NewSessionInfo->SteamP2PAddr->ToString(true));
this from the steamworks session code
p2p adress and stuff
with steam, can it work without opening the port?
as expected, steam does indeed do nat punchthrough
for p2p servers
it seems unreal DOES use that P2P stuff
have you tried it @ivory parcel?
bool FSocketSteam::SendTo(const uint8* Data, int32 Count, int32& BytesSent, const FInternetAddr& Destination)
this function in the steam subsystem sends internet data through Steam API
wich is P2P and automatically bypasses everything
there is a similar thing on oculus online subsystem
If there is something for the oculus system you can use that
As I said I have not had luck with the steam version and 4.11, it never seems to finish the connection on the clients side because the client constantly responds with ACK timeout
seems to be a lot of stuff regarding that. Not on IP, but with Sessions connection
wich connects p2p
welp
il try myself tomorrow
Ya, if you attempt to connect via sessions on steam it automatically attempts P2P
the basics of my VR Deathmatch game are done, the very basics
now, for testing, i need some basic infraestructure
I modified my engine to avoid that using a config variable
ya
have you tried 4.13?
and direct IP works
but do you use that port thing?
Not yet but that code doesn't appear to ahve been touched
Ya, I use port forwarding, not UPNP yet as the game is not that far along
The only change to steam sockets that I see is that its copyright notice was updated
maybe the linked steamworks library is other version
or something is missing in steamworks settings
Not sure
late today, but tomorrow ill get a LAN server browser going
after that, on Steamworks
hope that part isnt as bad as the achievements/leaderboards part
becouse that thing is useless
just realize, that with Steamworks you need to host your game with bUsesPresense as true otherwise none of the hooks work
That part is also not in any of the documentation
Ya, I don't think they explicitly cover that in the shootergame code but its a gotcha for sure
Ah yes that one
/** Presence enabled session */
bool bIsPresence;
Is that in the session creation?