#multiplayer
1 messages ยท Page 364 of 1
what is confusing is that the VR (server host) still gets seen as remote and gets painted yellow
annnnd I can't connect at all now
I tried packaging the game and running it on two different machines (it's development build)
loads up fine on both
console command to host
console command to connect
doesn't work
Does anyone know why animations "jitter" on laggy clients over the network? it's as if when they skip updates or packets, the animation literally freezes while it waits for the next move. This makes a laggier client look even laggier and is really silly. Is this an option I can turn off somewhere? (please @ me if you reply, I may not see it otherwise!)
If anyone here is experienced with building a DTLS UDP server in C++ could you please check out my forum post where I ask for criticism for my current proposed setup: https://forums.unrealengine.com/development-discussion/c-gameplay-programming/1407760-best-practices-for-building-secure-single-socket-udp-listener-server
anyone know a better way to do this? https://gyazo.com/54dc1188f89b69c53a354dc44d171383
is there a node or something that could run things on server rather than a whole event
Yiiiiew!!! My pull request got pushed to Master :)
Stops graphical RHI modules being built against dedicated server targets - so the binaries will run on cloud instances and headless machines
does ue4 store network data somewhere? Like if I need to compare data in time? Or I should make such system by myself?
anyone know where to find that bigass pdf about networking that someone wrote?
Look on pinned messages and look for cedric_eXi network compendium @tough gyro
thanks
@tough gyro as you love these video tutorials, you probably want to know that udemy has two paid courses on ue4 multiplayer now ๐
https://www.udemy.com/courses/search/?q=unreal multiplayer
Udemy is the world's largest destination for online courses. Discover an online course on Udemy.com and start learning a new skill today.
oh crap, my link broke
oh well
fuck videos ๐
I know ๐
http://orfeasel.com/ has some written c++ tutorials but they are more for getting you started with things
Meepmeep what data are you trying to compare ?
@zinc loom Position.
I think it's easy to add my own map and store time-position values, but it could be already done somewhere inside character movement component or unreal network code
positions should be stored in the stored moves for a char
So CharacterMovementComponent could be extended upon to log
which is used to replay back moves in case of server/client disagreement
No code in front of my face rn, but seems like it could have something over there on cmc for you to use
It would be your best bet as it already has some replay functionality already (eg stores position internally)
If that's too hardcore and you just need positions, could do a timer to log getworldposition, but also: what's the data for?
I'm going to look into StoredMoves
guys, can someone explain me this:
why names are switched for each client? (Dedicated server, 2 clients)
each own characted on each client is _C_0
right the local character will be 0
so, object names on each client are different then, right?
yes
each client has their own instance of the characters anyways
hm... how unreal knows which object corresponds to which on each client, by some GUID?
(Whoops, confused PC for PlayerController)
lol
edited to client
So basically @cold sparrow , this is a large topic
The general idea is that everyone is pretty much independent
ok, I always thought that object names will be synchronized
In the case of pawns, the Game Mode class spawns a pawn for every player, and the player controller knows which pawn is his
The PC (player cont.) and pawns both exist on the server and client
Right
So it's pretty obvious which pawn is yours - the player controller is associated to it when it Possess() the Pawn on the server
And that link is replicated to your local game
The name isn't super useful in UE4, really
To answer your question directly @cold sparrow, yes, replicated actor references are resolved via GUID.
Detailed information about how object reference properties are replicated.
oh, thanks.
If your object isn't stably-named, you can't rely on its name to be the same across clients.
FNetworkGUID
ok, I was debugging some network code in the game and I noticed some wierd behaviour, so I used display objects name on self. Well, learned something new. Thanks guys!
finally! something uniques amoung all clients:
player state -> player id
it seems like running things off "onrep" is really slow sometimes. like it seems like theres a straight up full second of wait time.
wouldnt that negatively impact things like binding players health to onrep? like wont players just die several hundred milliseconds after their health actually drops to 0?
@vital steeple what version?
that has been fixed in 4.18 i think
or coming to 4.19 cant remember
4.17
the server should be killing the pplayer
shouldnt it just force net update every time a player takes damage?
so technically it shouldnt matter for that part
no shaq
is that too demanding?
the update is based off what you have set the frequency too
net updates are dynamically adjusted when the value doesnt change
^
you can disable it, though it'll increase bandwidth use
or you can set the minimum higher
but when you want something to update quickly, use force net update
yeah
ok cool. thank you very mcuh ๐
aaaah much better!
theres no weird "skips" or pauses when players and buildings take damage
you guys rock ๐
np
hey there
when I look at these online lobby tutorials for unreal engine 4
i was wondering who hosts these lobbies
is it the player who hosts them
or is it a server ran by the game devs or whatever?
@bitter veldt It depends on what you want to do. If you want it to be custom, local games for groups and such, then you have the player host it. If you want matchmaking and mmos and such, you need to host your own.
@cedar compass will just be doing local games/online games (4 players - inviting friends from steam etc)
do you know any tutorials or documentation that can point me in the right direction?
@bitter veldt Check out the Advanced sessions Plugin. There should be tutorials for that and it really helps if you don't want to use use a lot of c++.
ah im already familiar with advanced sessions and have it installed, just wanted to know if there is documentation on this specific thing
the videos I watch just show how to do stuff and don't really explain things very well
i have question what i have to change to convert this systems skills system , inventory system ,and quest system the single player to multwiplayers
links https://www.youtube.com/watch?v=Pe2wOHe9VKs&index=25&list=PLmKKTERcjTPLIW5fPHRaFcl1hfRb0okbz https://www.youtube.com/watch?v=n7Sy151Uvqk&list=PLmKKTERcjTPIkMH9iK3gTUyl976_TW1hj&index=3 and https://www.youtube.com/watch?v=uA6oT6QIvAw&list=PLmKKTERcjTPKEPl0nk48Tpmj-iWmzqo_Q&index=30
Unreal Engine Version: 4.18.0 Template: Third-Person Template Ability System 4.18: http://www.mediafire.com/file/wt776i8dw451t45/SkillTreeSystem.rar Companio...
Unreal Engine Version: 4.14.0 Template: Third-Person Template TexturePackV2: http://www.mediafire.com/file/cb3g26mgpbpr23d/QuestTexturesV2.rar After having i...
Unreal Engine Version: 4.12.5 Template: Top-Down Template In the former videos we added the ability to equip and unequip weapons to our character. However th...
i have to change all begin to player to custom event???
and put replay to the server ???
That guy mispelled his YT channel
ok
Why would we know what you need to do for that?
Usually you code Multiplayer Systems from ground up for Multiplayer
Changing existing code from others from Single to Multiplayer is just not worth it
And if you need to ask as such as vague question, you should stop doing Multiplayer and that size and go back to learning the basics
Has anyone managed to get SteamSockets to work ?
I gonna convert the bp to c++ code
when i try to replicate springarm rotation as i would do with camera, somethimes it does work and somethimes not
with camera everything is good, but if i use spring arm it doesnt work
but it worked out once when i was toggling alot of settings on springarm and then didnt work again
wow and now it works though i didnt change anything
find session node left with max results 0 should find all availble sessions ?
@twin juniper that would only replicated on the server cause all others would be remote. (right?)
but i fixed it by just toggling some things and reseting them to normal
Use a branch on event tick that is localy controlled? if it is set the rotation and update too all otherwise it shouldn't do anything
The way you have it now: Is server ? then update. Meaning no clients will update if controlling this.
if you just plug in the remote then everyone will just update it even if they aren't controlling the object
Has anyone had any issues where if you were to play with dedicated server check, the camera would go crazy for a few seconds then spawn the player in correctly. I tried without the dedicated server check and it spawn correctly. Also with dedicated server check, i realize that some of my animations that plays is buggy such as dashing forward or any direction would play the animation but not move the player. It works before but now doesnt. Anyone know whats going on?
@opaque tinsel Well the dedicated server makes it so that the viewport viewport is a client, so that behavior is what a client will see, probably.
well i tried with 2 players, and it seems like both the server and client is doing this
With dedicated server settings?
yes
@thin stratus what you suggest ???
no reason to replicate things that are only visual stuff, also dont RPC on tick, validate and execute the code locally @twin juniper
@thin stratus converting the bp to c++ and put the server do i make in singleplayer a find a away to put the cliente interact with server ??
@thin stratus where you from ?
Okay, I've looked through a bunch of unanswered UE hub and there MUST be a way to do this - how do I deploy/launch across a local area network using the editor's Project Launcher (I'm using the recommended settings by project artemis so I know it is possible) ...however my device WILL NOT show up in the device manager on either machien despites connecting every other way -
second machine
has ANYONE encountered this? @thin stratus can you take a look at this?
Failed to add the device!, that's all it says when I manually add an IP that I can directly ping
Any hints in the console?
Worst case scenario, you might just be able to throw together a script that rsyncs it to the other computer, but I get the appeal of having in-editor support
checking now
Nothing even makes it to the console
it's like Epic doesn't care about that particular feature
there's almost no docs on it
it's not a dealbreaker, I have sync dropbox folders so the moment I save one one machine the other gets the changes, i use that method for editor testing and I just copy the packaged build to a network folder.... manual backups every few hours otherwise
Hello, friends. Question for anyone able to answer. So, I'm spawning an item on the server, then calling a multicast in order to replicate disable sim physics, no collision, and attach to player character. The problem I'm having is that unless I delay for approx .2 after the spawn, I will get an error saying "Accessed None" in reference to the actor that was just spawned. Thoughts on what may be occuring here and how to fix this in a less janky way than upping the delay? Thanks
Use a RepNotify on the actor variable (if you have one; if you don't, make one)
Replication isn't guaranteed to be done in orderโyou can never rely on it over the network
RepNotifies are made for this purpose; they allow you to call a function exactly when something replicates
@merry hemlock I've got no real idea on that, sorry
Haven't tried to use it myself
satr, cant you just do all that in the object's beginplay on the clients?
@brittle sinew Are Repnotify's multicast automatically or do i need to call a multicast seperately?
@manic pine ill give that some thought. Thanks!
They're not really multicast per se...they occur on each client individually when they receive the information
It's not like it's one RPC going to all clients
I agree with @manic pine's idea though, I didn't immediately consider that
If you don't need to replicate something, don't. ๐
ye, the less replicated the better
gotcha. problem is the actor is an item that can be picked up if it already spawned in the level. Once picked up (and held by the character, saves an inventory version. If you select that item from the inventory its spawns the physical version of the item and attaches again to play. So, I dont think Begin Play would work for me.
Unless I'm misunderstanding your suggestion. Which is entirely possible.
@manic pine @brittle sinew Thanks for you help.
@merry hemlock Don't spam @ someone!
Whom did I spam @?
1 - Let me check your role in this server : ah yes
2- the person I did @ , I did it ONCE. If he has a problem with it, I'm sure he'll either ignore me or put a stop to it, him being a MODERATOR
- This isn't your job or your channel. Go away if you have nothing constructive to add. The mods police this, not you.
Here, let me spam @grand kestrel you, to make sure you read this. Now we are 1 for 1, meanwhile, no one here has learned anything about multiplayer in unreal or shared any news
Oh wow
I mentioned the wrong guy
But holy shit that attitude lol
GL
What a douche
Almost tempted to @ a mod as you so clearly pointed out that I am not just to help you out
I think so
report him or me all you want but when you enter the chat, all it does it clog the channel
let them DM him and handle it
Is there an issue here guys?
Well
I was attempting to tell Pedro not to spam @ people (cedric) and accidentally @ blake instead
Who then went onto being a flaming ass
So I guess that's up to you if Blake needs a moderator ๐
Why dont you both just let it go and move on....
My goodness
All I said is don't spam @ someone
Didn't need that
And for the record Blake, I wasn't moderating as you accuse me of, it's just really annoying when someone spam @'s you
But the person didn't spam you
Just let it go, move on.
moving on
Yeah.. just.. maybe tone it down and pull your head in in the future
devils, have you ever played with the project launcher?
How do you mean?
specifically deploying across lan
forwhever reason I can't get the device manager to pick up my other computer
even though I am pinging and hosting successfully
as well as transferring between network folders
well yeah but before I do that, I need to get the computer to show up in device manager
it was recommended to test this way from a page in 2016 on a VR game called Project Artemis
I dont dev with VR so im probably not the one to ask.
this was more of a multiplayer issue because the editor can't fidn the other machine
Ok well why dont we see if we can figure it out
Im assuming you have the Editor open on both machines?
Im also assuming thats an requirement
yep
already opened
session fronthends ...but don't you have to handle this on device manager first
And both machines are set to be Shared?
make sure both machines are visible?
Are they both Shared?
Did you try using the Mac Address instead?
I did not try that actually, that's a good idea
MAC Address maybe more useful as it wont change if the device is disconnected/reconnected unlike an internal IP might change.
makes sense....you have to do some real hacking to change it afaik
is it the link-local address?
doesn't say physical but that looks a lot like a mac address
Cant remember, if you type in ipconfig /all i think it appears
Maybe not
It maybe the Physical Address of the Adapter
Been an while since i needed one actually lol
Yes its the Physical Address
just to make sure...i'm supposed to add the machine i WANT to connect to right? It seems absurd for add device to mean anything else but at this point it just is like, dead
That doesnt look like the right address
Yes i would assume you want the device to connect to
I need to convert it that's the problem
http://ben.akrin.com/?p=1347 except i need to go the other way
There's a link on that page to one that goes backwards
or do I need to leave off that %10 maybe?
yeah but it didn't work
Please note that of the various IPv6 notations, the one this script will expect is fe80::xxxx:xxxx:xxxx:xxxx.
fe80::a49e:f462:91e:23c6%10
i'll try without the 10%
ipv6 and mac are 2 different things
That third sector of it looks off
i agree but it's what ipconfig gives me
Should be 2 bytes, but it's only 3 hex characters
ugh
forgot how big of a difference ipconfig is vs ipconfig /all
no idea still fails
anyone messed with the HTML5 exports, im able to connect to myself via chromium and firefox but i just see a black screen
apparently multiple people are having the problem just cant find any answers or ideas around
nvm got it had to change AA setting from none to tempAA game started right up wicked
Just a heads up. I was able to track down a bug in 4.18.2 when trying to test 3+player (or 2+ with dedicated server) multiplayer in PIE with an Oculus connected (possibly vive as well don't have mine connected right now). Will cause the editor to lock up for half a minute waiting on HMD code. https://answers.unrealengine.com/questions/742516/bug-with-video-ue4-pie-locks-up-with-3-players-or.html
@frank quartz wonder if I could ever figure out what all lock up the editor in PIE or after it
it's been a constant struggle since ~4.13 with that
it doesn't always happen on every project, so it has to be some specific setup (and usually it goes away if you wipe intermediate + saved folders and regen the VS solution
you traced yours into HMD stuff tho
So, there is a PreClientTravel
Is there a PostClientTravel ?
Well, there is BeginPlay.
Hehe
i'd implement a time/clock variable or component in your GameState class and set it to replicate
then use that to drive your day/night
also EventTick -> SetElapsedTme = GetElapsedTme + DeltaTime is much more straightforward way to keep the time
Would this be an appropriate area to discuss automated matchmaking without a dedicated server using steam with without forcing players to open ports just to play?
might be a good idea to check out the UWorks plugin fo that
otherwise you are stuck using Steam sockets for connection (it does work with listen servers tho)
We were using it, however given the difficulties with documentation for the specific items, and having little to no prior experience we are finding the task more than difficult to achive matchmaking, leaderboards, steamid, player name, player avatar with a simple click to create/join game without the need to open ports.
Long story short: We're trying to have one button to utilize a method for the player to automatically match with another user that's doing the same thing without having to port forward or create a lobby to then start the match.
This has proven to be difficult to achieve even with uWorks for reasons beyond my comprehension.
We are able to pull up the devAPI to allow both users to integrate to steam, but when trying to join the game with one another, this results in no results(aka unable to find the other parties listing).
Hey guys, I'm having a little problem with replication. Here's two bugs which I think may be linked to my chat system. I'm running a dedicated server with 2 clients messaging eachother, which sends notifications to the chatbox widget.
- The notification widget only pops up for Client 1
- When sending messages, both clients are named '0'
Here's the first of three screenshots, in this I am getting the owning player to later add to a structure for the message that will be sent.
In this second screenshot, I am breaking the structure and getting the authors name from the Player ID.
And in this third screenshot I am throwing up a notification (a box that increases alpha) when a message is recieved that is not in the channel the client is currently focusing on.
Any ideas where I could be going wrong? I thought I had a good understanding of network replication but it seems like this is something I just cant get my head around alone.
you are missing the important part, how does the client sent the message to server and how does the server distribute them
The client sends the chat message to BPI Chat system, and any listeners who are watching that channel will pick up the message.
I dont think the problem lies with that though? Messages can be sent just fine. I think the problem lies with the author of the message not being referenced properly
so you get message on both clients but the notification doesn't work?
ay there is it possible to imake somewhere where i can invite someone from my steam friends list to join my lobby using blueprints?
Yep, messages appear for both clients
@mild hull Thats why I think its a problem with the message ID not having the correct owning player
where do you call the notification?
3rd image
from where do you call that
In the gamestate
The player controller -> Game state (adds the channel message -> Notify the channel has updated) -> UI_HUD
isnt all the information you need already containt in the message you send in OnChatChannelUpdated?
of the BPI?
if the message reaches everyone, cant you check if its is for another channel and notify the ui from the client?
cant you recorded and send it?
Sure..
and i only noticed now, why are you looping through all player controllers in Pop notification?
Oh, that was something else I was trying and forgot to remove, ignore it ๐
On second thought, I'm probably going to function better when its not 4:30am. Thanks for the help. I'm going to pick this up tomorrow and try and rack my brain. Thanks!
@mild hull Thanks for the help bud. If you dont mind, I'm going to take another deeper look at everything, and if I cant figure it out, I'll drop you a line?
k, good night
I have a class that causes a crash when spawned. If I recompile the class, the crash no longer occurs. I save the class, restart the editor, and now the class will continue to crash the game until I compile it again... !?!? This only happens when I'm playing with several clients in editor
Hmmm so it only happens with one particular child of the base class... the only difference is the mesh
@icy nacelle you're doing a few things wrong as far as I can see
Makes more sense to talk about when you are available. Ping me
So I've been struggling with getting ragdolls to replicate the last couple of days, I actually made a bit of progress and got them to be roughly in the same pose as the server, which is good enough for my purposes. Anyhow I just noticed, that when I run the game as a dedicated server, the ragdolls seem to be all messed up and not simulated properly, they hang around weirdly in the air for a long while. Do skelmesh physics not get properly simulated on a dedicated server?
There are booleans to update meshes on dedicated servers
However I can't recall them, so try to check the components, meshes and animbps
bEnablePhysicsOnDedicatedServer?
thats what I'm using rn, doesnt seem to have an effect tho
There should also be something about updating bones
@sharp arrow, IIRC there is a Server time variable on the GameState
AGameStateBase::GetServerWorldTimeSeconds()
So, My game is appearing on the steam master list but all servers are responding with Rules failed to respond for server What does this mean ?
Resolved, was a problem with engine edit
Anyone have experience with Advanced Sessions/UWorks plug ins?
I'm looking to start working with one of them, and I'm curious if anyone has recommendations/thought
s*
Hey guys, i have a countdown timer that plays on both the client and server when they spawn, however theres a 1 second difference between both of them. Is that normal and is there any fix for it?
For a local listen server setup, is there anyway to stream a level volume to a client without loading it on the server's machine?
curious question, can you use the same server for multiplayer connection as you do for p4v?
(I have no conception about how servers work)
You could use the same server for a dedicated UE4 server and a Perforce server, sure.
It probably wouldn't be the best idea, however
ELI5? haha
VPSs and software like Docker make it much easier to virtually separate your services, which makes maintenance much easier
Basically, you set up virtual computers that do one thing, and if one dies, your others don't
Ahh. Makes sense!
Running them within the same OS is a pretty rigid solution
You could still run them on the same physical server, though...that is, the hardware itself
appreciate it!
if I'm on a lan during a listen server, when I want to open a map, I simply open it and it will load on the client's side correct?
An overview of how travelling works in multiplayer.
Well the server can only load his own savegames
To load a clients savegame, you would need to let the client server rpc that to the server
Select one and see if it resolves
It started when my "is locallly controlled" node stopped working. It always returns false on any client i put it on
and none of my meshes or animations are working. or my ai controller. lol BUT it was working fine a couple days ago
are you actually checking them clientside?
So, there's nothing wrong with making your transition level the persistent level if you are streaming in level?
I'm not sure how you could so it either way but the docs I just read didn't seem to mention a persistent level
Well, the TransitionLevel is usually some new map that gets loaded between ServerTravel if it's seamless
I think I'm confusing level streaming with seamless travel
How does the persistant level relate to the transition map?
is there a callback for when pawns have spawned in the level, when testing multiplayer?
@rain coral "spawned" ?
As in the actual spawning of pawns that players control?
If so, no. You can control that rather easily though since you know when that occurs. You can just create an ED if you want.
If you mean OnPostLogin, then there's that.
OnPostLogin is too early, since only player controllers exist at that point. when testing multiplayer, pawns are spawned automatically unless I as you say override that functionality
I guess the problem is if I override SpawnDefaultPawnFor I only return the pawn to spawn, it yet hasn't happened ๐ค
So I'm wondering. I have Customization Data on GameSparks.
When the PlayerState gets initialized, I'm quering that on the Server and save the Data (few names and floats) in it.
Now the Character would need to get that data when ever he's respawned.
BeginPlay wouldn't work, as it's not possessed yet. OnPossessed would work, if the PlayerState is also Available on the Clients when that happens
(Multicast OnPossessed)
I could pass the data to the Client in that Multicast, but that's a chunk of data every time someone respawns
I have various things that I have to do in multiple places because of conditions like that. For example I do some things in both BeginPlay and OnRep_PlayerState
And then I just check and see if it was already done before doing it again
Might be one of those times @thin stratus
I call them "network race conditions"
OnRepPlayerstate is what I aimed for now
Currently trying this: PlayerState gets the GameSparksData, fills it into an OnRep Struct.
In the OnRepStruct, I set a boolean to true, so the client knows everything is proper.
Could also check the Struct values, but /shrug
In the Pawn, OnPossessed, I get the PlayerState, set an OnRep PlayerState variable (BP doesn't have the native one) and in there I check the boolean and get the struct.
If the boolean is still false, I start a timer of 1 sec
For now at least
why dont you give it to the character on the server after spawn
ive found this to be true:
void FunctionRunOnServer()
{
AActor A = GetWorld()->SpawnActor<AActor>();
A->SomeReplicatedInt = 5;
}
void BeginPlay()
{
if(!HasAuthority())
{
if(SomeReplicatedInt == 5) // True if this actor was spawned in FunctionRunOnServer
{
}
}
}
Because that's gambling
I don't think that's actually meant to work every time
If at all, you'd make it repnotify
possibly, but i think its intended... isnt that what'd be considered 'initial replication'?
which tehre's even a separate rep condition for
would be nice to have an answer from UE team on that one, because I'm using it here and there(though with Deferred spawn)
Well then you'd probably need to ask on the forum/answerhub
Server here is unofficial
Hello Everyone! I've hit a small snag. I'm creating an array of render targets and am drawing to one of them. Then I want it to replicate to the client. The array is set to replcate and the drawing happens on the server. Any reason why there would be no update on the client?
Well, any reason a render target would replicate its changes? :P
I thought about that and during the training stream they said there isn't any reason it wouldn't
So I guess it would be because it's set to replicate, it should replicate it's changes. I'm just not sure if that's a correct assumption or not
First time trying to replicate a render target so I'm not sure if there are special rules for them or not.
guys how do i replicate add impluse?
@acoustic aspen if itโs super gameplay important you can replicate movement from the server and sync up a clientside impulse to appear smooth
Replicating physics does seem to be an expensive and inconsistent thing to do though
Many games just let all clients do their own local simulations for small physics props
Can I replicate the transform while doing physics on client side?
Yeah you should be able to! Havenโt done it personally but youโd need some smoothing / interpolation logic to avoid popping
thanks
Is that correct? So the "good" option is more secure and the correct way?
Event begin play runs on server and client- it would likely be better to run that function as in the โBadโ example but with a switch has authority node before it, making sure only the server runs that code
Thereโs no need for an RPC in this case (feel free to correct me if Iโm wrong)
Keeping in mind that since it would only be initialized on server, youโd have to replicate those properties down
So you might need to run a different clientside init function for cosmetic things that donโt affect gameplay
Wait... So i would add a switch has auth node and make what? Call that function on the Client from there (ClientInitAttributes)?
If the init function is setting important values like health, movement speed etc, then use a switch has authority node after event begin play (which is run on server and client), and call the function from the authority output
Then assuming those important properties like health are replicated, the client will get the correct values from the server
Ooohh
I mean you can do an RPC like in your first example if you really want, but it's basically wasting resources- instead of the server directly calling the function right away, you would be saying as the client "hey server please call this function" , sending that request to the server and then having it call it
Actually looking at that screenshot again, there's definitely no need for that 3rd RPC at all
The values will automatically be replicated down to the client if you set them up
Oohh.... good to know. Used to get a knot in the head... thanks gonna play with it!
Defintely takes time to sink in- really easy to go on a complex route and realize it's possible with much less logic
Works...fine! Yep!
how do I simulate something in client and send it back to server
Hey, i'm relatively new to UE 4, well, i've been coming in and out for years now. I'm often hearing that 'multiplayer is hard to do' 'You shouldn't make your first game have any sort of multiplayer at all'. But I'm wondering, just exactly how hard is it to make your game have a multiplayer function?
easy, once you actually grasp the concept how it works(it's just not sending data between A and B)
next step is to design code that works with time delays
@acoustic aspen still need help?
yeah ๐
Do you understand ownership?
Ok so lets start a little more basic. You have 2 roles Autohrity and remote
Ok excellent
So with RPC usually you can only go from server to client
But there are a few exceptions to that
The main one that is most commonly used is through the player controller
A player controller can make requests to the server. and the server can then handle those requests and multicast the results to everyone
the base documentation is here
Designating function replication across the network
as long as the client owns the actor, it can call a server function
I'm just stuck on trying to make throwing stuff for clientside less jittery
its a physics method
addimpulse
I simulated on client
then called on server
yeah that's a little harder. You will want to look at your net update frequency and update the minimum but it's going to increase you bandwidth the higher it is.
If you spawn the object on the server (and it replicates to the client) the ownership is on the server. So a client can't send the notification to the server.
It could be routed through the player controller if you really wanted to though.
Generally you would simulate on the server and update the position on the client since the server would spawn the object.
That method would work out of the box
then it's just tweaking values for performance vs simulation accuracy.
the UE4 physics engine is not deterministic so the simulations are not guaranteed to match if you just replicate the add inpulse event.
I'll work on other things then lol, I don't wanna deal with custom physics and stuff
Replicated physics is kind of a can of worms most people don't want to deal with ๐
for gernades should I just use physics and not projectile phsyics?
I don't use projectile physics so I'm not sure what it does.
having a 100% accurate simulation probably isn't required though since it just needs to come close enough
@inland fulcrum Multiplayer is so hard at the start cause it brutally requires you to know ue4s framework. You need to know what classes are available, when they are available, where they are available. You need to learn a few layers of networking, such as replication, ownership etc. And then apply all of that.
It's too much for the average ue4 beginner
Singleplayer you can store your kills nearly everywhere. Multiplayer you soon find out that you can't get passed the PlayerState
Just as an example
anyone know why setting events to reliable causes my other events to not work properly?
Trying to make AI run exclusively on client (and not at all on server) anyone got a starting point for me?
Wont be used in the final product, it's so we can spawn hundreds of servers and have them run on AI to simulate clients for stress testing
Hoping someone has been in the same boat
Guess I'll start removing all the client checks
cant you just spawn some aicontrollers on client
or write some random walk logic into tick of your player controller
Hey guys, i'm setting the rotation of my projectile, although it isn't moving towards the way it's rotated. Anyone know why? Note that setting the spawn rotation works, although i am attempting to rotate it in the projectile's event tick.
Not sure if it's a problem with repliccation or
i'm able to use the built in homing mode in projetile movement, although i would prefer make something more custom
How do you guys do recoil? We have everything server authorative but I'm not sure that it's viable for recoil, needs to happen instnatly not delayed by latency
@grand kestrel - recoil is simply adding a small (AND I MEAN SMALL) amount of control rotation to the character - which is not even remotely close to being in sync from client to server anyways.....
In a perfect world - you would run line traces on client - passing in the start & end points to the server for authoritative HITTING of your bullets. while you are on client - add the recoil effect - as its local and happens right away - and in the next fire - will take into account for the start/end points on the server authenticator next iteration.
hopefully thats not as garbled as i think it is lol
Probably a simple question, but How can I set a map to act as the main lobby for players so they can go to other levels and come back to the same one they left from before
if your doing an actual PHYSICS bullet actor - - i wish you the best of luck ๐
@inland sun - bSeamlessTravel = true (GameMode) & simply change maps. the FIRST MAP (Lobby) they need to connect to in order to load it.
I don't need any help with applying recoil, I'm just asking how you can be sure that players can't remove it by hacking'
doesn't it make it so each map they go to becomes a new session? I am trying to make it so that if someone leaves the main lobby map and then wants to return they come back ot the same map everyone else is located.
brain hurts thinking about this stuff lol will save it for tomorrow
@grand kestrel now thats a good point - i didnt think of.... maybe make the floats that control the yaw/pitch of the recoil as Replicated - so they cant edit the values?
Every part of my shooting system is fully server authorative, it's just recoil that is more like an effect as it's applied following a shot and it's applied specifically to the client
It's a tricky one
I guess the client could send the rotations applied by recoil and the server could go "yeah nah" if it suspects foul play
Can anybody tell me why the client does not travel to the correct map if I use steam online subsystem but does travel to the listen servers current map if I use online subsystem NULL ?
I am using ServerTravel after a session is created to transfer the host to a map
ServerTravel(TEXT("/Game/Maps/TestMap/MapName?game=/Script/GameName.Gamemode?listen"))
Then After finding a session I connect the client to the session using JoinSession, and after joining call client travel on the client...
FString TravelURL;
if (PlayerController && Sessions->GetResolvedConnectString(SessionName, TravelURL))
{
PlayerController->ClientTravel(TravelURL, ETravelType::TRAVEL_Relative, true);
}
@grand kestrel for the AI question, why not just spawn them as you would a regular player on server to stress test?
Yeah I was probably over thinking it
I have a behavior tree that basically does the same things a regular player does, and the AI use the same pawn as the player does. The only difference in logic is the shoot start location code in the controller
Also probably will give you a better idea of performance if using a dedicated server with the AI as itโs more load on your client to simulate the behavior
Also for the recoil, yeah itโs likely best to do it instantly on the client and then validate on server (within an allowed tolerance). Thereโll always be some innaccuracy and hackers who remove recoil could probably still get away with it sometimes. As long as thereโs a few checks, it should work for the most part!
@eoinobroin#6833 Thanks for the input, I'll play around with it tomorrow
Guys, I need some help. I need to set an ID to each pawn spawned in a multiplayer game... for example, the server's pawn (supposing that the server has a pawn) would have 0 as ID, while the first client that joins will have 1, the second 2, and so on... This id needs to be stored in each client, meaning that a client will know its id and those of the other pawns.
My question is, how can I set the ID from the server so that it will be present in each pawn? I'm trying to understand WHERE the client's pawns are spawned, so that I can set the ID there using SpawnActorDeferred and replicating the ID, but I can't find where I should do it...
@manic agate maybe you can increment a int in AGameMode::PostLogin(), and then simply use that name as and ID ?
oh sorry, you said each pawn not PC...
@zenith yarrow that would work, but I need to set that ID when the pawn is actually created, and in the PostLogin() method the user pawn isn't actually created
That' right ๐
if i enable replication on the actor, and the position of the actor on the client and server are different, will the server attempt to update the client's data with the server location?
or will it forever stay out of sync?
Any idea what actually changes the map on the client after client travel? I am still trying to figure out why steam OSS does not transfer me to the correct map after joining a session...
@manic agate Coundn't you use the integer set in postlogin when a new player joins to identify him on the server, the server has an array of all the PC's right? and the first PC is the server, so the incremented int could be taken as an ID right? so just use that int as an id when you spawn pawns for players
@manic agate you are spawning pawns on the server, right?
@zenith yarrow That would work, but I still don't understand WHERE unreal spawns the default pawns for players ๐
Also, about your problem, I can't help you out there, I still haven't mess around which map travel ๐ฆ
@manic agate naw, that was something I asked earlier. As for spawning as far as I know you can either spawn on client, which means nobody but that client will see the thing, or you can spawn on a server with a RPC, which ensures that everyone connected to the server sees the thing...
the players are spawned on the server by default I suppose, if you are making a FPS game I would recommend you check out the shooter example in the learning section of unreal
Thanks, I'll try ๐
@manic agate might be a good idea to spawn in as a spectator or no pawn by default and write your own pawn spawn logic in the GameMode so that you can set up properties like that exactly when youโd like.
@manic agate you are welcome, also @inner iris has a good point...
@inner iris Good idea. I'll look into that too!
Itโs pretty handy for respawning and other repeating events too- you can reuse a lot of the logic
Do you remember what methods should I override?
I'm looking at the code right know but I don't understand where I should spawn the pawn inside the GameMode class. There is a SpawnDefaultPawnFor() but it only gets fired for the server's pawn, apparently
I didnโt override anything- just let the default code spawn me in the level with no pawn, set my camera location to something nice and create a countdown widget
Then I created new functions in the GameMode to spawn the pawn, find the right team location to spawn on, init all properties and UI, and then possess when the game begins
Then when you die you can use the same function, and any logic that has already been set (like team spawn locations) wonโt need to be set again
No problem ๐
is this the right channel to ask for packaging with steam? I'd like to ship with current steam sdk (141) and not the ue integrated (139). But how can I do? I think i need to "clone" the onlinesubsystemsteam plugin from engine into my project and adjust it to use the 141 and recompile, right? I think this information is outdated: https://docs.unrealengine.com/latest/INT/Programming/Online/Steam/
An overview of Online Subsystem Steam, including how to set up your project for distribution on Valve's Steam platform.
You need to overwrite the UE SDK in the sources with yours
And rebuild the engine
And possibly fix the onlinesubsystem stuff if there were API changes
i don't want to rebuild the engine, only the onlinsubsystemsteam plugin
i thought this is why everything went to plugins and not tight closely to the engine core itself
Dunno, I haven't needed a more recent Steam SDK myself. But since the plugin is part of the engine, my guess would be that you need to rebuild the engine, whether it's in a plugin or not.
Ok, thanks - I go with 139 then.
Why did you need 141 ?
not really a need - more a want ๐ when i've read the doc I thought it is staight forward to use a new sdk but trying to follow i did'nt get it to work - so just wanted to ask if anyone uses newer sdk or the one shipped with ue.
I actually don't know what's the difference. I know I have a shipped game on Steam with the regular SDK, and since many games aren't updated I guess there is basically never any breaking change
Just doublechecking - I have a listen server - I execute a Open Level node (say on my gamestate)....that's all I do....what happens to the connected client?
Anybody know if FDateTime::UTCNow() is good enough for rough network clock syncronisation?
Trying to syncronise an ocean simulation, but it's important for vehicle prediction etc. that the simulations match as close as possible.
@chrome bay have you looked at AGameStateBase::ReplicatedWorldTimeSeconds? It seems like it would fit well in this scenario
I'm guessing the function you mentioned is local to each client, so even though most computers will be on an NTP server, it still might be pretty off
Yeah, UTCNow gets the time without daylight savings, so probably from some central server or on windows
RepTimeSeconds might have to do, and I'll have to sample it and extrapolate time as best as possible
So long as it's fairly close it should be good enough
Vehicles in Multiplayer are a pain in the godamn ass
any way to know from which subsystem the player is connecting from?
@twin vault Don't think so, the point of the OSS is that it's platform-agnostic
no chance of PlayerID conflicts between subsystems?
It's probably possible (albeit really rare). Each subsystem has their own idea of what a PlayerID is though, but I suspect most of them are just using a number
yeah i created my db's key as PlayerID, SubsystemID
Ah I see so it's for your own Databases?
ye
The other way around it would be for users to create a special "My Game" account which they login to and maintain your own user ID's
But of course most people don't like that
anybody knows how i can get the number of players in game?
@opaque tinsel FOnlineSessionSearchResult.Session.SessionSettings.NumPublicConnections
@twin vault thanks - how is the transition level different from level streaming? Is there still blocking done?
half blueprint question - why wouldnt' I want to do a pure cast to game state if I never change the gamestate ever?
I'm trying to think of instances when it would fail? but multiplayer confuses me still
Alright. I've been asking for help since a long time here for how to being able to join and find people online on a server browser and people could be able to create their server. I don't c++. I want to know what kind of thing I need to do for my game to work online, and it works lan perfectly. Please someone tell me how! Don't just shit on me like last time some people did, I tried dm UE4 they read my dms but they do not respond and I'm getting depressed.
Like what do I need to do? Do I need to buy a hosting site and if so, which? Do I need to do a dedicated server and it will works online? If so, I saw some tutorial for dedicated server and hosting it with my pc but I won't be able to open the server everytime, I need some sort of a website that host the server everytime.
I'm getting soooo depressed and annoyed by how there's no tutorial about that and just tutorials about lan shit. I have enough. I already made a lot of works in my multiplayer game and I need to get it ready soon. Someone please explain to me please and whoever helps me good I will pay you via paypal So don't be useless please thanks.
@agile crane There are 2 options. Dedicated servers or listen servers. If you want to go with dedicated servers then you can get hosting from someone like AWS or DigitalOcean to name a couple. You would setup the dedicated server on their system. If you want listen servers then you don't need extra servers. One of the players playing the game would play the role of host in that situation.
Thanks for explaining. I still did not really understand about listen servers, how do I setup a listen server?
If you could explain what is it I'll appreciate it thanks.
@jolly siren
The network compendium already covers that
I sounds a bit excited. About DigitalOcean is it only c++? Is there any tutorial to setup it for UE4? since Idk anything about c++ so I would not be able to set up it myself. @jolly siren
Dedicated servers in general need to be built from source. So yes you at least need to know how to download source from github and package it.
But... does DigitalOcean make the dedicated server theirself inside the site or we need to make it ourself and then buy the site?
also
is there a way to buy the thing without needing to buy it every month, so I could be without worrying
cause all I see is month and month, why cant I just buy it for like 3 years or so?
DigitalOcean is just a cloud computing platform. You rent a vm from them essentially.
Okay
Did not answer my question, can I buy it for a years or multiple years than a month? Or is there any free demo to try it?
...
You can probably prepay for more than a single month
go to their website and figure it out
Oh okay cool
Oh
Is there any good dedicated server tutorial for DigitalOcean? Or any dedicated server tutorial could work?
Time 2 work now I guess
is there any tutorial for setup digital ocean after doing the dedicated server?
DO is just a cloud vm like i said before. It will be the same as setting it up on your own machine.
i.e. section 3 in the wiki
okay
Also
will it auto detect the lan blueprint and will it work online? Like, everything in lan works, and after buying DO and making the dedicated server, will it auto work online? Or do I will need to change some of the blueprint?
I made everything in blueprint and I use advanced session btw.
@jolly siren
Sorry for tagging.
idk what you are talking about. Try it and find out.
I mean, my game works lan
and after making the dedicated server and buying digitalocean, will it works online?
Or do I will need to change some of the blueprint?
@jolly siren
anyone experience with Steam method for FindFriendSession - more specifically the Delegate binding for OnFindFriendSessionCompleteDelegate?
System for setting up advertisement of matches and handling matchmaking of players
can do the FindFriendSession just fine.... cant seem to get a good working code syntax for the binding of the delegate
few functions here available - cant seem to make heads or tails of htem: http://puu.sh/yXNs8/d5b2656521.png
What are you running into when trying to bind it? (what have you tried?)
well for starters i am only familiar with Delegate.AddDynamic(this, &NSpace::Function)
so i tried to bind the delegate property there
there is no AddDynamic to it.
secondly - the AddOnFindFriendSessionComleteDelegate_Handle() - is weird inputs
i have no idea whaht to do - i just simply want to run a custom function to join the found result returned from the delegate
unfortunately shootergame isnt using FindFriendSession at all - the group i'm on definitely wants to have this funcitonality in the project theyre developing.
only thing i've found that gies any clue to what to do is that wiki doc... dont see anything in answerhub regarding issues in past with this ๐ฆ
You probably want AddUObject
Matchmaking->OnMatchmakingComplete().AddUObject(this, &ThisClass::OnPartyMatchmakingComplete);
see UT source
@jolly siren - ok that clears up the delegate binding - except one of hte parameters of the delegate is FOnlineSessionSearchResult
void JoinFoundSession(int32 LocalUserNum, bool bWasSuccessful, const TArray<FOnlineSessionSearchResult>& SearchResult);
TypeDef error ๐ฆ
apparently you cant use anything that isnt U in a blueprint exposed function?
even if i hav eit as a C++ function - its still undefined type
yeah FOnlineSessionSearchResult isn't a USTRUCT
i see it inthe OSS plugin as a full on class
i dont know how to use it then in this function as an arg - and it has to be there as its the return of ht delegate
Engine source (Runtime) forward declares it in 2 places: GameInstance & OnlineSession classes..... i cant seem to do it in project ๐ฆ
how is the transition level different from level streaming? Is there still blocking done?
@merry hemlock - its defined as the necessity to unload the current map and transition to a new map. in order to unload (bSeamlessTravel) from one map - you have to have a map loaded in order to move to another.....
but does it work like level streaming in single player?
like, for VR, is there blocking?
not sure what you mean by blocking. the transition map is in all intensive p urposes BLANK
placeholder for the pawns to reside whiel transitioning to new map - unloading the previous
is AGameMode::Logout reliable enough that i can depend on it to save some information about the player back to my database, or should I also put some timers in that periodically save too?
@worthy wasp Does it block I mean does it load and you can't move and the computer hangs until the level is complete?
Question about using two instances for testing Lan multi-player.. Is possible to go run a break on the client side? How do I know which blueprint instance I'm looking if I'm looking at a blueprint?
Isn't SpawnActor meant to spawn a copy on both server and client? Howcome it only spawns it on server?
Guess I have to call it on both
Just wanted to make sure something isn't wrong
@grand kestrel Do you have the actor checked as Replicated, and the spawn is happening on an event that executes on the server?
Ah lol forgot that its not replicated by default
Was a big derp
So next question, if I spawn a controller and call possess.. it doesn't possess on the client, only server
Possess needs to be called from server anyhow
its a server auth function natively - if client runs it it wont do anything.
@grand kestrel
Uh-huh
I'm not new to networking
Naturally I'm calling it from the server
it doesn't possess on the client, only server
Like I said
i dont understand - you drieclty said: "So next question, if I spawn a controller and call possess.. it doesn't possess on the client, only server"
i tried to answer you....
so no offense meant in me trying to help you
It possesses on the server, logically I'm already calling it on the server, I'm saying that when I call possess on the server it possesses on the server and not the client
what kind of visual errors are you getting?
do you float in air?
fall through floor?
maybe your guy looks squashed and kind of hovers in air above ground?
NM lol
@worthy wasp I had referred to this great tutorial by @thin stratus , when I was looking trying to learn steam integration, it is a tutorial on how to get friends from steam into unreal using steam oss you can find more info on it -> here
You are welcome mate!
ey guys! I've got an issue! I'm trying to replicate the forward vector of my character's third person camera, but no matter what I do It wont replicate the Z vector at all to the other clientsx.x it replicates it to the owner and the server but not to other clients.. so it works left and right but Z axies are at 0 for other clients x.x
https://gyazo.com/e4db033b3052348f9236d3978e02699d
when I spawn
when I need owner in beginplay. there often is a latency here for client
this doesn't work. but adding a 0.2s delay fixes it
it's quite inconsistent. I could loop a delay here but is there a cleaner way? like OnOwnerSet or something. can't find it :\
I'm replicating the pawn reference right now but I don't want to replicate variables unless it has real meaning
Should ask here, I guess..
How do I setup dedicated server to be public? Right now it is available through local IP, and in order to make it public I have to create session, wich I don't want. Is there any configs to make my server not LAN?
@wary wyvern You need more than just a config for that. An actual, always-online server has to be available to provide clients with a list of game servers.
Steam provides that service
PSN, Xbox too
I know that, my service will provide client with an IP
But right now all I need to do is to make my server to be public, not LAN
I know I can do this by creating game session with bIsLan=false;
But I want to make it without creating session, if it is possible
If you're not using sessions (meaning, you just start your game as a server and you connect directly with "open <ip>" on your client), then it shouldn't need more configuration
LAN vs not LAN is a session thing
I'm not sure you can filter by LAN/not LAN when you create a server, basically. It should accept any kind.
Maybe I'm mistaken, but can you confirm that this is your issue ?
Without creating session I'm not able to connect within public IP
If I create a session, I can do this.
We've tested it, my public IP is ok and ports are forwarded, so it might be configs and Lan mode
@wary wyvern When you talk about LAN, you're talking real LAN, or locally on the same computer ?
I'm really surprised that there is a difference on this
I mean LAN, my home network
Other computers are able to connect, but that is all
I want to make it available for others.. Looks like I have to create sessions((
Well, sessions are a better long-term approach, unless you plan on not shipping your game on a major platform, but I'm really surprised that this is an issue
Session don't have anything to do with an IP connect
Just saying
Sessions are mainly for saving the data about a game so others can see that, for example, in a serverlist
Or just for matchmaking etc.
You can always connect directly via IP, LAN and Internet
@wary wyvern
@thin stratus Yeh, but how do I set my server to be public? I mean available to connect with public IP. Right now I'm only able to connect with local IP in my home network
You only need to open port 7777 in your router
Then check online what your router's public ip is
Then you host with "OpenLevel MapName?listen" (node) or "open MapName?listen" (console)
Then others can join via "OpenLevel YourPublicIP" (node, not 100% sure that this works) or "open YourPublicIP" (console, which works)
Where console means the node "ExecuteConsoleCommand"
@wary wyvern
@thin stratus What I gather is that this only works for local clients in @wary wyvern 's case
Which sounds like a bug to me
Yeah, that's what I was saying to him ๐
There isn't a public/private setting for servers
There is for sessions (ans he's not using sessions)
Firewalls of PC and Router can also block incoming connections
Yeah, "?listen" will make your PC listen for connection on port 7777
You only need to open port 7777 in your router
I've alredy done that. Other users are able to connect to my session with public IP. But if I do not create session, conection become unavailable through IP
Nope. I have disabled it right now
Okay, I'll try Null)
@thin stratus Still not able to connect, even with null subsystem, bIsLANMatch = false inside gamesession.. Ports are open, firewall disabled..
Okay, find the problem.. It was in my router ip settings.. Thank you for help, guys!
Told you it's not UE4 related :D
Yeah, sorry)
Ey guys! How would you replicate the forward vector of a camera to the server and then to the other clients? ๐ pls help thanks!
I've been trying since morning (now its night) to get the fowrard vector of my camera to replicate to other actors with no luck ;-; anyone could help ?
@rancid current i dont know if this is what you are looking for. example this is very basic melee system im using it works nice.
with get control rotation you can get the forward vector
alright I will try that! thanks lots @late sundial
well same as the camera vector this wont replicate to other clients (THO i tried to replicate rotation and floats through the same way and it works with no issue) but vectors are like nop lol anyways thx for the example will try more tomorrow!
ok, i dont know what kind of mechanic youre trying to do so hard to say more.. no problem good luck
@late sundial Here i Just did a little test right.. Im just printing the values using the replication method you showed me and no matter what replication method I use, Its almost always the same result, server and client see the values but other clients NOP
Check this out: https://gyazo.com/9ef0399d53928a10d808e4e7c0b55dce
https://gyazo.com/06c186a2cc98b0fa7e8b22c0cc08a0b7
Exactly same issue thats how i have it initially replicates to owner and server but not other clients wtf xd
hmm weird, it replicates only on 1 client but if theres more it just shows 1 and 0. i dont know what happens there for the numbers, hopefully someone who knows more can tell about that.
results from what u told me to do earlier to put camera instead: https://gyazo.com/a36e69959f1757920af4ab3107fd60e8
hmm weird my other camera works tho o.O my first person camera replicates values right
welp using my fps camera did the trick xd done
GetControlRotation will always return 0,0,0 for other clients
because you don't know what their controller is
{
return Controller ? Controller->GetControlRotation() : FRotator::ZeroRotator;
}```#
So I'm using BP and I'm trying to set it up to, at the end of the game (deathmatch), find the player with the heighest score and announce them as the winner. Right now I've got a blueprint I've placed in the level that has a map of FirstPersonCharacter to Integer, character being the player and integer being the score. Whenever a player gets a kill, it adds a key/value for them in the map in the blueprint. Then when the game is over, it gets the values as an array, I use Max Of Int Array to get the highest score, and then use the index of that value to get the key (player). Theeen I get the player's name which is held in a variable and then print that out, along with the score. But after getting a kill and the match ending, it just prints out " won with a score of points!"
The player controller 0 on a gamestate - that is always the server (if listen server) or is that still the client? If you call an event on a server and it is set to multicast, if it targets PlayerController At Index 0, that will get everyone, because it's replicated from the server and all clients treat their player controllers as 0? I'm trying to keep track of who is what from game mode to game state .... the gamestate isn't owned by the player so my thoughts so far are that player 0 should be server since it owns gamestate?
Calling a multicast on a PlayerController doesn't really make sense, because PlayerControllers aren't replicated to all clientsโthey're only replicated to the owning client
I have a unique use case so most of the time I want it to happen to everyone ...there are a few exceptions for minor things though
Even if you call a multicast on an index 0 PC, it will still try to target that same PlayerController on each client (not each client's local PC), and it will fail, as it doesn't exist on clients
These events originate from the gamestate
Why not just multicast on the GameState?
What is the actual function I would use?
Umm, not really sure what you mean by that
You would need a multicast RPC that is called from the server.
And just as a note, the index 0 PlayerController is not always the server's PC.
It usually is due to the timing of its spawning, but there's no inherent guarantee that that will always be the case.
this trend with always using index-retrieved playercontrollers is very weird
Yeah, it's just a quick hack that seems to work fine
If you're on a client I understand it, because yeah, there is only going to be one PlayerController
If you're on the server though, it's really bad practice
yeah i guess, i just never find myself lacking the reference when i need it
maybe its a blueprint thing
From the perspective of a beginner, I understand it's much easier to go "why do I need to worry about making all these references and casting and stuff when I can just type 'Get Player Controller' and it all works?"
I don't have anything against someone thinking in that manner, it's just that they're not properly informed
yeah i guess its a product of design based on lack of information
multicasting in a PlayerController is a really bad idea, since you are telling all client machines to execute your multicast function on their copy of your PlayerController
so unless the machine that calls that multicast is the only connected client, there will be at least 1 client that does not have its own copy of your PlayerController
and then things will just break
So what is a better practice @winged badger ? Do I use the PlayerState list to obtain the proper reference, or cast to gamemode from my gamestate to get a PlayerControllerArray populated on OnPostLogin?
only the server has the true state of your game, so actors should replicate variables that are needed for the clients to keep their simulation of your game up to date
for example, if you had a Light Switch that has bOn boolean
good practice would be to replicate that boolean, with RepNotify (which defines a function that is called when variable is replicated)
and then use that function to update client visual state (as in, turn on the lights)
multicasts are suicidal for any class that does not exist on every client (like the PlayerController and GameMode)
So where would that function be located that actually updates the lights? It would a RepNotify existing on their client BP?
I mean like a Player Controller's BP
the client instance
I'm trying to practice using the proper terms as my understanding is still a thing in progress
lets say you want to press E to turn on the light and your player pawn has the reference to the LightSwitchBP instance you want to affect
you would go from input event E (Pressed) -> to call your CustomEvent named, say, LightSwitchToggledServer (which is replicated to server and is reliable)
And since it's replicated, it is called on the server's instance of that light (and from there, to all other clients?)
then in the event you would Get a reference to the LightSwitchBP -> SetOn (true)
bOn would replicate to the clients
and they would call their OnRep functions to actually turn on the lights
if you did the same with multicasts
then if a new client connected after you turned the light on, it would have no idea that you turned it on, as it was not connected when multicast was called
but when it connects, the LightSwitchBP would replicate its bOn variable, and OnRep function would be called
That shouldn't be an issue as I will only have 2 players for quite a long time (LAN mvp ) but I feel like it's important I know that, so thank you
multicasts are great for stuff that does not depend on state and needs to be run on every client
like playing an animation
and btw, if you multicasted from host PlayerController, its not just that it would not work, it would break the client's connection
What about events not related to the client, like making an AI controller move or playing a sound that should be heard by all? If I'm triggering those events on the GameState, do they just need to set to Replicate on the red node (and also the actor's themselves need to replicate enabled on their class settings)
AI controllers exist only on server
so no replication is possible there
firing sounds is a good candidate for multicast, but an actor responsible for the sound in the first place (like a character being responsible for its footsteps) is a better option then a GameState to call it
Is it possible to use a break and step through a blueprint if you are checking for replication and other testing for multiplayer? How do you target the appropriate blueprint instance? Normally I juse use the existing blueprints that are open before runtime, do I do something like use the world outliner once play as started?
i don't know how to answer that question well
Or do you just essentially put print nodes on every replication event you want to check?
good part of my project is in code
and Visual Studio breakpoints behave differently
On the client, how do I know which PlayerState in the PlayerArray is mine?
your PlayerController has a reference to it
omg thought I'd tried looking for it there. Thanks!
if the position of a player on the server and on their own client is out of sync, will the positions eventually be synced? Sorry if it's a really nooby question.
if they are replicated yea
replication basically sends the server version of a variable to relevant clients whenever it changes
with positions/vectors they are usually simulated simultaneously server and clientside to prevent choppy movement for the client, while it's waiting for the server to update again
Charactermovement is automatically replicated afaik, nothing you gotta worry about there
Sooo...
Why does OnPostLogin... 1700ms...
spike?
I'm about to kill it for my demo, since it's a single player slice anyway...but
I am curious as to why is causing that
Why is it so high when a player joins
oh, closed out of it already, I'll check it later later
I found my problem BPs anyway
I wish epic would comment on the [/Script/OnlineSubsystemUtils.IpNetDriver] config
๐
hey guys... does nayone know the difference with the macro of UE_SERVER and WITH_SERVER_CODE
UE_SERVER seems to be the correct one but didn't work
Hey guys, i'm not sure what i've done wrong.. As you can see in this video when i am using the jetpack it is choppy, especially near the end: https://gyazo.com/15734cf9ab231e9fcf67189acdb227c0
and this is the blueprint used: https://gyazo.com/b4d1b9f9f03160e045dd5f2688cd9a00
was wondering if anyone knows why?
i think the server is trying to set the position to what it should be, but i have no clue why it would be out of sync
if it feels like rubberbanding, odds are you are replicating an actor component you shouldn't
oh
maybe
i was dealing with replicated meshes and collisions apsules
ill try to set that back
dam
did nothing
But yeah, defs feels like rubber banding
it would have to be one that has a FTransform
speeds on your server and client not beeing synced could also cause the problem
only if i'm using stuff to do with time dilation though right?
no, if your server thinks your character's speed is 500 and client thinks its 700
client will simulate at speed 700 and server will correct its position every time replication happens
yep
hmm
it could be the code i use to keep the speed below 500?
in the blueprint i showed
we had a problem like that when the root component (capsule) got replicated
yeah, i just unreplicated all of the ocmponents and it didnt fix it unfortunately
i may aswell try the thrust with a staticc value
anyone figured out how to remove jitter present in dedicated servers when changing velocity quickly?
Unless I am mistaken
Up until recently, multicasts weren't being fired on the server, right?
You'd have to do MyMulticast() and then MyMulticast_Implementation() right after to have it fire on both client and server, right?
What is "recently"? I can't remember that ever being a thing, and I've been around since like 4.8
Are you thinking about OnRep?
You do need to manually call that on the server in C++ for that to fire on the server
(not in BP, however, IIRC)
Commands like ?Listen or open IP address can always come from a widget itself, since the player IS the server before they are connected, right?
HELP:
Sanity fading
movement replicates just fine
Unreal just seems to laugh at me anytime I try using Switch HasAuthority
TextRenderers don't just replicate cause you click on that boolean
If there is no logic to replicate the text in that, then ticking that doesn't do anything
Thanks , I was going to go crazy
so how do I replicate that, I set the text on the remote node
what was wrong with that blueprint ?
Are your two windows even connected to each other?
What you BP currently does is: For the Server, do nothing despite the Print.
For all clients, change the text to I am the Client
Switch Has Authority decides per instance if that instance is existing on Server or a Client
so wait, it will think it has authority because it's the client's pawn BP?
No, you have 2 Players. Server and Client.
These replicated sphere you have there exist in total 4 times
Server's sphere exist on Server and replicated on the client.
Client's sphere exists on Server and replicated on the client
Now, if we take "SwitchHasAuthority" on the Server's Game.
His own Sphere will show "I am the host", cause we are on the Server, so SwithcHasAuthority will use "Authority".
The other sphere will also show "I am the host", cause that instance is obviously also on the Server.
Now the Client's game has his and the other sphere both on his end. he is remote, so these two instances will go the "remote" path.
so there are 4 pawn instances to keep track of???
Well, per game 2
probably reveals my ignorance but isn't there a "IsTheFrickingServer" node anywhere?
I was copying this from the network example map
Client sees two players. Server sees two players
Make it a total of 4
And yes, "IsServer" is a node that exist
but that won't matter if it doesn't replicate
Well, replication is more a process
If you place a box into the level
You don't have to tick "replicated" to make it exist on everyone
If it's not replicated, it is not connect. So the Server and Client instance (see image above) aren't connected.
For both players, it's an object in their world which they can change, delete, etc.
right now it's just the pawns/players that are giving me issues
If however you do enable replication on that block, it would be connect. So you can use the server to destroy the actor or replicate variables in it, which then arrive on the client version
And that applies to all actors
Well, if your Pawn is replicated
And the game spawns it (e.g. gamemode Defaultpawn)
Then you can replicate variables and RPCs in it
Switch has Authority will work in replicated and non replicated actors
It's simply telling you if you are on the Authority or not
So i need to make those events here then....and they will be called on the instructor BP if the....
That stuff there is spawning code for VR and non VR Server/Clients
that's the game mode though
the first player that joins is the host, so it chagnes the IsServer variable to false
here is the pawn BP again
the gamemode now fires this event if the connecting player isn't the server (it's at the end of that big blueprint before)
After it posessed?
Well this will only call on the Local Client, so the one that is actually owning the Pawn
that explains why it's not working then
You'd want to set a RepNotify text variable
In which you set that text to the renderer
And that Text should get set on the Server side, right after spawning it
Here's where I get confused
Server Side makes me think Game Mode because that only exists on server
Correct
So how do I set the text on the pawn BP but have it be server side?
Well, knowing you are on the Server in the GameMode, cause that hting doesn#t exist on clients, you know that ,every function, which is NOT a Client RPC or Multicast obviously, will run on the Server
So if you spawn your pawn
And you have a function in that, which is not an RPC
"SetText" or so
And you call that from within the gamemode, after spawning the pawn
that call will still be on the server version of the pawn
RPCs are to hop between Server and Client versions
If you don't use one, you'll stay on that specific side
Why can't I find RPC anywhere....?
So if you call "Set SomeText", where "SomeText" is a RepNotify Variable", right after you spawn the Pawn, it will still happen on the Server
It's explained in my compendium
RemoteProcedureCall
You can imagine that as your Remote from your TV, sending a call to your TV
"Power off", sents it to your TV, that does things on it.
If you see your Remote as your Server and the TV as your client, you'd have the same thing when using a ClientRPC
Created by making a CustomEvent and setting it to RunOn...
Basically what you have in your latest screen
But as said, no reason to use that
Set a RepNotify text variable
with "I AM THE CLIENT"
And in the OnRep function, you use that variable to set the TextRenderer
OnRep functions are auto created when you set a variable to repnotify
So the text variable needs to be on the actual game mode?
Na, in the Character
But after spawning your pawn/character in the GameMode, you can easily access that, right ?:P
sorta, how do I get the actual OnRep Event to come up
I've made the variable, RepNotify and compiled the Bp
You mean how to show it?
You should see it in the functions on the left
OnRep_VariableName
Doubleclick it
And put your logic in it
hi . to those who has used dedicated server before... do you face issue where the server reuqires directx to run?
It will be called on all instaces of that Actor (so Server and all Clients) when the Server sets the variable and the value arrives at each player
I only faced that once, with GameLift
yeah i'm getting that in EC2 now
There I added a silened installer for DirectX
so u put it in the volume?
it seems directx won't install
after installing it's asking again...
did u finally pack the 'image' together with the redistributable?
Thanks @thin stratus I'm sure I'm not done with questions but it's finally working
ic
GameLift is hosting new instances based on settings and demand
And has a way of installing these quietly
if you put an "Install.bat" file with it
vc_redist.x64.exe /q
dxwebsetup.exe /q
so it worked after that?
i got the VC_redist to work.. but it's still pestering me for DX
For GameSparks shit I also had to add a certificate
oh what's this go tto do with gamesparks tho?
Nothing, just so you don't wonder why there is a AddTrust... thing :D
In the screenshot
yeap yeap .. got it
Our Servers communicate with GameSparks, so they need the certificate
As it's not present on a fresh instance of gamelift
oooo
vc_redist.x64.exe /q
dxwebsetup.exe /q
start "" certmgr /add AddTrustExternalCARoot.crt
Install.bat actually looks like this
so you put the certificate in the image? ic
So replicated is for things to GET to the server, REP Notify is for things to get from the Server to Everyone else? Something like that?
Yeah, GameLift lets you upload a build of your server
btw. we manage to got all our backend done thanks to a lot of your advice. I also see your chat with the Gamelift support. really helpful