#multiplayer
1 messages Β· Page 49 of 1
oh, with windows 11, we can't join ? create session is always happening right , but join session is giving trouble
i'm also on Win 10
i don't know bro there is no logic explanation why I have problem now so I am using win 10
instead
hah
there is no many informations about
or examples
hmm.. yes that's the problem
wonder how many may come when we start testing with actual servers
@high ibex so these are my EOS settings and I am just changing Default artifact name when packaking Client/server
Sorry I have no experience using EOS for dedicated servers
@real ridge try using the same tokens for both and see if the problem persists
Because if it doesn't then there's a problem with the permissions you setup in the backend
Some of them are required to join games successfully even if the name doesn't make it obvious. I don't recall exactly what I had that with when I first started using it years ago. I just copy the same setups from game to game
Check with a token that has all permissions enabled, or one that already works for you, to make sure it's not a permission problem
I do know the execution flow for dedicated servers is different from EOS; it doesn't quite work the same as for p2p clients
@real ridge can i do this on client pc and will it work ? https://www.epicgames.com/help/en-US/epic-games-store-c5719341124379/launcher-support-c5719357217435/how-to-unblock-ports-to-connect-to-the-epic-games-launcher-and-fortnite-a5720237410331 like, will it connect .. what do you think
but I don't know the details because I've never implemented it. I do remember seeing documentation about it
so if you are just using the same execution flow for p2p and dedi, there might be a problem
Aha right. Port forwarding. The dedicated server usage will probably assume that you have forwarded ports, whereas p2p usage will not have that problem. Likely candidate
my doubt is that , in the PC where i running dedicated server build, do i have to do any outbound rules ? or inbound rules on other pc where client build runs is enough ?
Don't doubt π It's a very likely candidate
For a number of reasons, you would need to look at the code, the dedi version may only use your public IP address instead of being able to loopback internally inside your LAN
i can't use same tokens for both one token is special for server has autologin and creating of session
Create another token with full permissions without that
- it's working on win 10 and not win 11
i think just 7777 or 7778 are revelant when u watching logs u Can see what ip and port server has
most of time there is 7777
my tip is that u have non public ip not all providers offer it
this is my nat settings in router then I have also set virtual server for same IP and port
this is ip of machine where server is running
u Can find that IP by typing ipconfig in CMD in machine where u want have server
okay, got the point ..
Hey, I am trying to pass a client variable to the server, when the client connect to a listen server. As example, the player starts his game and can set a PlayerName in the mainmenu. Then once he connects to a server I need to pass this variable to the server.
By googleing I ouly fould suggestion of using GameInstance or RPCs. Any suggestions how to approach this?
read up on how to use RPC in unreal. the pinned compendium should give you a decent idea of how they work
Guys can someone give me a tip? How to make this I want 2 bases on the map lets say 2 cubes one will be base for team Red one for Team Blue how I can make it? and I will be able to attack it and then I will be also able to destroy and if someone will destroy enemy base he will win π i know how to attack and destroy but how to make base logic
and say which is whom base
Can I use only 1 object for it or better use 2?
now I started with 1
You usually make one Blueprint and give it a Team Property
This assumes that you have such a property setup, but if you have a team game then you should have something that identifies teams
Then you can mark that property as Instance Editable
Place two instances of it like you already have and change the value on each to the correct team
Or you make 2 child BP of it and change the values there and place one of each into the level
Hey, thanks for the quick response. But I dont see when to do the RPC. Before connecting to the server there is nothing to do the RPC to and afterwards I seem to have already lost the variable I set.
you could probably get away with storing it on the game instance of your local player then retrieving it once the player has loaded in and RPC to the server with the name
That is basically what I am trying but it seems that I cant access the local game instance post login. Do you have any suggestions where to find more info on the gameinstance and how it works?
what do you mean that you cant access it?
never mind, it was just me being stupid again. Thanks for the help I figured it out
I tried to access it via the game mode... stupid me
Hello. I would like to create a passion project, a multiplayer pokemon game. The problem is that the interactions between the client and the server are very confusing to me π, so I would like someone to hold my hand while I do the combat system from scratch.
Somebody please help
I don't have much but I could pay someone to mentor me. I want to see my project become a reality
We should start luring people to C++ that are working in Blueprints in the Multiplayer channel π
Don't make fan games.
why?
do you like legal headaches and burnout? because thats how you get a bad case of both
I won't get any of those because I won't be that stupid to release it under my name π
I will release it anonymously
just a random link on mediafire from a disposable twitter account
136 votes, 465 comments. The top post on today almost broke me ( ). After really believing we started making momentum on what is going to ruin your β¦
Nobody worth anything is going to help with a fan game.
Thanks, Im pissed now π
if you never release it and never show it or use it as a show case piece (eg for your portfolio) and use it purely as a learning experience you could probably get away with it but then whats the point
you would be way better off with a really small original piece
The thing is I really love pokemon and I love playing pokemon fan games. So I would like to make my own for people to enjoy like I enjoy those other fan games
You can make a critter collectothon / battler
dont do it though
just can't use their IP
my non legal non lawyer advice is to not even acknowledge pokemon as a source of inspiration or anything
Pokemans? Never heard of them.
call it man poke instead
I believe that with due caution and measures to avoid being caught, everything can be achieved.
Lots of fan games are still up, just a handfull of them got taken down.
I just see that there is a huge stigma against fangames here :3
you can believe what you want and noone is saying they are bad, but they are a bad idea particularly with very strong franchises like pokemon. if you want to make it go ahead but you need to be aware about what you are getting in to and that possibly noone is going to want to help you in any official capacity
nah, Im just going to save a bunch of money to pay for a mentor to instruct me on the stuff I don't know
you can ask in this server for free
but you said no one is going to help me
if you ask can someone help me remake pokemon noone will help you
but if you lay down some ground work and ask about specific functionalities like how do i capture these creatures i made when the ball hits them then someone is likely to help you with that specific thing
guys for some reason I am getting kicked short time ago from server when I play with 2 players
how I can find out why?
happening also when testing as client 2x and server is editor
I am still on map but one player will lost me and I am lkke on separate map but kicked
now I am tehre shooting each other
but I cant show log uh
Also by posting here you're inviting others to collaborate in your illegal scheme by soliciting their help. Nobody likes being made a co-conspirator that way.
Especially not in a mentor-style relationship where the implications are quite severe due to the affiliation with you and the project
Illegal is a strong word
pokemonshowdown.com is still up and running, so... π€·ββοΈ
It's not a strong word, it's a basic requirement. And even if something is legal, doesn't make it ethical. Something illegal is not going to pass my ethical check anyway.
It's the reason why I have never and will never work on for example a gambling project.
A basic requirement at least for some of us
May I interest you in my idea for a play-to-earn gambling gacha NFT Pokemon fan game?
You know, I didn't see it as a crime when I asked for help. I just wanted to give something back to the community
I need help incorporating ads.
What are the naming conventions for c++ replication functions? I've seen OnRep_FieldName quite a lot now, that seems fine. But what about RPCs? I feel tempted to use Server_Method or Client_Method for that, but I've also seen ServerMethod.
I prefer Server_Method because it seems more in line with the OnRep_ style. But maybe it's already a convention
Is there some reason why movement to my client is not being replicated to the owning client? Is that because it's an autonomous proxy?
Maybe it should move itself, which would make sense. But then how do I know I don't go out of sync with the server? There are platforms that move and I could miss them if there's a high ping
CharacterMovementComponent should handle this all for you
question about physics sync
i have to many problem so replicate movement sets transform directly which is not ideal for physics object and what I am doing
but some times physics objects gets out of sync a lot
there is some moment component for it ?
or i need to make one ?
(yes it is the same cube)
So, I still haven't looked at Chaos and how well this works, but before Chaos at least, Physics in Multiplayer is if at best only of cosmetic nature
There was nothing build in to sync them and Movement was 100% not supporting Physics
CMC even turns itself off for most of its part
You could ask in #chaos-physics about network/multiplayer support
ye but character movement component has interpolation and (i'm not sure about this) server only Physics with work very well
i can set the Physics to be server only but then i run in to snapping issue on clients
it is a good fake
physics
Again, actual Physics with Movement is not a thing in UE atm at least
The Cube itself, if it's just cosmetic but not gameplay relevant, can have physics and you can code a bit of interpolation to make it smoother
And if it's only about picking it up and moving it somewhere then you can also get away with some gameplay elements
But not if it has to do with character movement
lets say the Cube it is gameplay relevant and getting out of sync with server will be a problem
so lets say the cube is some more complex stuff with many sub actors
If the Cube is usable by multiple players at once, then your best bet is to have it Server Auth and smooth the location on the Client
ye but replicate movement sets transform directly unless i get the movement packed some how i cant use replicate movement with idk if can be a problem if replicate movement is false on root actor and or rest is true
Hello, I have an issue :
I have a struct with an array of references to components of other actors. Those other actors are set to use the owner's relevancy, owner being the main actor holding the struct.
That struct is set as replicated.
The issue that I'm facing is that sometimes, the main actor spawns on client before the other actors, causing some references in the struct to be null. I've tried with weakptr to see if maybe the references wouldn't be null, but no luck. Order of spawn seems to be random too.
Is there a way to fix that using the engine or do I have to code something custom ?
Nothing you can do about it, spawn order client-side will be random
So to solve it you would use an OnRep callback for the array, and check the contents each time it's called
C++ has the option to modify the replicated movement when it comes in
Blueprints aren't cut for advanced stuff like this
do u have some resources for it i dont like to spend 2h reading the .h 
Yeah the .h (:
Honestly, I don't have resources for that
You'll want to check what maybe the Character and the CMC are doing here

I do that, but my array isn't changing so it's only called one time, and with nullptr
It'll change/be called everytime one of those properties is populated with a valid object
I agree with that when it's modified after BeginPlay, but apparently not in this case, it might be a bug
all my actors have spawned, the array is valid on server, and yet, there are still nullptr
Hi, hoping someone can help with this problem im having with displaying and removing a loading screen.. the reason its a being a little bitch is because i have a Pre Lobby level which has its on pre lobby game mode, game state, player state and player controller.. the pre lobby player controller is the class that creates and stores the loading screen widget and then once the game is started the loading screen widget is displayed for all players and then it uses seamless travel to send all players over to the actual map
So, when they're sent to the actual map from the Pre Lobby the loading screen widget stays on the screen, but now because im on a different level i have a new game mode, game state, player state & player controller, so i cant access the stored loading screen widget on the pre lobby's player controller anymore to remove it from parent..
I tired making it persist over by making it so when i create the loading screen widget on the pre lobby player controller i also save a copy to the pre lobby player state, then used CopyProperties to send it over to the new player state when its created..
Then, when i try to remove it from parent from the new game mode once the map is loaded in, it is somewhat working but it only works for the server player while clients still have the loading screen widget on screen.. i tried having it remove from a client RPC & a rep notify called by the game mode but neither worked for the client only server
Any ideas how i can get this to work properly?
Store that Widget in the GameInstance
In C++ you usually don't even do it like that
You just ask the Movie Subsystem to play a Loading Screen, supplying it with a Widget
Which is usually done in the GameInstance as well
Also
The BeginPlay RPC to show your LoadingScreen is wrong
Just add a Branch with IsLocalPlayerController
The RPC is totally redundant
HI guys , im trying to replicate the movement of the player but it doesnt replicate the look up , i tried changing the remoteviewpitch and calculating the new rotation but i get this weird interaction after looking down few times, it rotates backwards opposite to the player
this is the code where i use the remoteview pitch
GetBaseAimRotation
Is the already existing method for that
i tried overriding it but it didnt work
Why overriding it though?
Also isn't BaseAimRotation world space?
You are setting relative
wait can you please give me a sample code on how to use it cause all i did was take the return of the function and assign it to the relative location
nvm , i got it π thank you very much i was too focused on working with the remoteviewpitch
it is good logic to use same game mode for my dedicated server and same game mode for my PLayers? But when I change game mode I have no idea how I can separate for these two and run session on dedicated server
wdym guys π
maybe bit confusing question
hope someone will get it
because in current game mode i Have this
and there I handle session creation π
The game mode is typically defined by the level, not based on "players".
Eg. A player starts the game, the first map they join could be like a "lobby" map that has a specific game mode. As soon as a player connects to a server, the server's map is then used and that map then defines the game mode.
Whether or not you can reuse the game mode for both situations is dependent upon what your game mode is doing.
yes I know I have it set for map
If you want to improve you gotta put in the time
Any learnings come at a price
π
so I have it set right way then I dont see any option how to use different game mode for server and for player π
I need use this because I am making session on server
Your question doesn't make sense. You can't use a different game mode for server and for player. It is based on the map being used.
yes true sorry I am confused of it π because I was thinking how I will make server level with different map when I will want change it because now its like hard coded
ye i like reading code with i did not write and re inventing a wheel 
Not sure why you're doing this. Rather you want to take the rotation inside of the ABP, apply transformations you need to do there
ah okay let it be no need to answer me seems I am confused and I have no idea what to ask
kekw
next time I will think twice
just prototyping but animations doesnt replicate right ? so i'll have to gzt a value of the rotation that can be replicated and give it to the ABP ?
Correct
Animations are driven from the values of the actor the ABP is attached to.
The data in that actor is replicated.
What you generally do is modify the values inside of the ABP with whatever you need to do
Rather than forcing values inside of the character/controller, generally speaking
because they're supposed to be input driven
i see , thank you very much ill try that next π
I'm not using that
Hard Mode = On
My steps are tile based. One tile is 100cm, and there's no diagonal movement. But I solved it by using a multicast that sends out the locations and the clients just process them in order
That's not the solution theoretically but sure
CMC is the only client predictive movement you have without coding it fully yourself
And that's not done with a multicast :D
Heyy ! I got an issue with some rep notify I'm using into a code, So it's actually working on the clients and stuff but only once, and then when a client triggers this code again it stopped running on client and only the server runs it π€ any ideas ?
It's not really clear what it is you're trying to do. The only thing that sticks out for anything not working is that you're not changing "Equip Integer" on the server anywhere visible so the Set of "Equip Enum" likely isn't getting changed.
Update Equipment slots into the rep notify (first image) is the one changing the gear, and the integer in getting changed by an input action that is triggering S_EquipMainWeapon @sinful tree
How would the server know that the equip integer is changed?
nothing too complicated on that one
I guess this integer need to be replicated ? as well ? or rep notify ?
All this would only ever happen client side.
If you need to tell the server the value, then you'd need to send it with the RPC.
yeah I see it now, your right this is client side only
should I rep notify both ? and into the rep notify of the integer, trigger the S-EquiMainWeapon ?
Does the client need to know the equip integer at all? Like, is that integer even needed?
You could RPC to the server the enum of the weapon you want to switch to.
In the RPC you can validate if the switch should occur, then you set the Equipped Enum to indicate to the client the swap should proceed with the OnRep.
(you'd do some checks in the RPC before setting of course)
yeah after reading 4-5 times I get what you mean passing the into directly into the server I did not think about that before x)
Checks are happening here https://prnt.sc/r2LTnjDD43bs
previious haha typical me typing
Now I'm trying to find a way with the "previously equip" that needs to be set before editing the next weapon switch ^^
This Enum on the left needs to be set before the New set happens and needs to be replicated since it is using this data into the "stow previious weapon" checks
Guys I need tip I have 2 teams Red and Blue and I have 2 bases on the map I want on begin play put them in the team π one to red and second to blue but how I can know to which team put them its one blueprint
any tips
?
Make an enum, give it Red and Blue options
give the bases on the map and your pawn classes a variable of that enum type
that's how you match them up
Something something GameplayTags
now I am doing it via player state for players there is no problem because I have lobby and my own database where I am telling them which team they are and via varest I am getting their team and then store it in player state
but for base i dont know if second base is not same team already
i can make this but then both will be red
hmm enum
it will automatically make them different?
i thought is best to store in playerstate
It'll make it not depend on spelling and you can do switch on logic
i thought I can use array of players in team in game state and then just check if there is any base in that array and if it then just set team to blue
not to red
wdym?
like this array of pawn
i did enum but how i can achieve that 2 bases on the start will get different team?
one red and one both
One red and one red/blue or one red and one blue?
no no sorry one red and one blue
HMM I did cast to playerstate but it is always failling idk why π but maybe because I cant use get player state because I am in game as player and it will get my player state
but this is base on the map so idk
You should be doing this all in gamemode
Gamemode gives a player a team, then spawns their pawn at the right base
it is game state for this
I am spawning players on playr starts
i have 4
and this cubes are already spawned
inside map
okay i will refactor it to game mode
The game mode is who spawns the pawn for the player. You want the pawn to spawn at their team's base right?
yes later okay so delete playerstarts? and remake teams to game mode?
right
I will use on post login function
and make array of players
Well you need player starts so when the possession of a pawn takes place it can start somewhere. I placed my player starts in the level and gave them different tags to separate the teams. Then when I'm spawning and possessing the pawns I have an array of all player starts and it randomly chooses one depending on the tag. The team is assigned to the player on the GameMode.
You can make it use YourBaseActor instead of PlayerStartActor
Can also just pass in any vector as the starting location, I find it easer to use player starts and tags so I can just move them around the level while testing.
GameMode is the most appropriate place yeah. There's TDM, CTF, King of the Hill....etc all classic examples of GameModes all using teams.
i am just watching example of it on youtube
so i can also delete playerstarts from map?
when I will spawn them
Do I need also posses them?
- additional question what with my base? it is big cube on map I need also spawn it there because I need give it a team but I cant possess it it is just in the air
my base
it is pawn same as my plane which I am playing with
The player start is just like a built in actor that has an arrow component and a capsule component. It gives you in editor feedback if its likely to have a collision problem before running your game and the arrow shows you which direction it faces. Its main purpose is just to store a location. When you spawn in an actor one of the required inputs is a transform. The transform is a location, scale and rotation.
I understand.
so i can delete them
if I choose random spawn locations
for every joined
For my game I loop through all of the player starts, check to see if its of a certain tag, then randomly select one from the list and use its transform directly into the Spawn Actor's transform input. Like this:
There's extra lines because I just dragged it out of the way for the screenshot, but you get the idea.
How are you choosing them?
not yet just working on it
so i just did it like this and gave tags to my 4 playerstarts from 0 to 4
You tagged your player starts too right?
Ahh okay
good?
Oh wait maybe itβs not Player Start Tag, Iβm not sure if itβs that one or generic actor tag
okay so i found first problem
I am spawning twice now
one is spawned by game mode
and one by playerstart propably
also dont I need make server spawn via RPC?
ah shit I am now spawing 2x on every client
this is how I am doing it and it spawning twice i dont understand
tried also use switch has authority
did not help fuck:D
it is caused because i am spawning them on player starts?
My first instinct is yes, don't remember. For your custom BP, I would offset them by some random transform.
If they both have the same transform, the issue is on your side
If one has the random transform and the other doesn't, then the PlayerStart spawn is being handled automatically and you'd need to find where
OK deleted player starts
will work with random tranforms
now its ok
how it is possible that when I am doing spawn like this I will always spawn both at same location just minimum change?
its random lol
i tried make it like this via target points even i did this I am spawning at same location kekw
This is not a bug. It's how replication is designed. Replication is guaranteed to eventually happen on the client. But you don't know when and it's not in order.
Any of those nullptr entries in your array are actors that exist on the server but haven't been fully replicated to the client yet, so at the client side it cannot properly assign them when it's getting the references over the network
There is an easy hacky way of solving your problem in combination with a config for RPCs, and I forgot the name because I never use it, but if set, all RPCs will not be called on the client unless all parameters of the RPCs have been resolved locally.
So you could call a RPC with all actors you need to have on the client, and it'll be called at the right time.
There are a variety of other ways to tackle the issue though
oh ok nice, so as long as the server doesn't send a nullptr or a pointer of something not replicated, it'll never be nullptr on the client ?
Try setting some breakpoints and step through your blueprint node by node.
here are my target points here is code for spawning there is no waay its wrong how π
Why are you not using player starts? lol. This is exactly what they're in the engine for.
Maybe try moving the Remove node further down the execution chain.
i deleted them because I though they are causing my double spawning
You're removing the item from the array and then trying to use its transform right after
but they were not the problem
They aren't the thing that does the actual spawning. GameMode does
Also I have a node called "Set Local Player Controller ID". I don't remember setting it but I think it was from a tutorial I watched a while back.
okay
also check this, how many players are you spawning?
1 when i spawn 1 i get 2
when i spawn 2
i get 4
and so on
So something is running twice...hmm
Well breakpoints could help you figure out why that happens
I tried move remove
If you want to make this debugging process a whole lot easier just use breakpoints and step through the nodes one by one checking the inputs and outputs with your mouse to see exactly what data is flowing and where the execution path goes. https://docs.unrealengine.com/4.27/en-US/ProgrammingAndScripting/Blueprints/UserGuide/Debugging/#:~:text=modes are active.-,Breakpoints,the Blueprint Editor's graph view.
but there is weird thing even I set clients to 2 and run 2 instances it will choose just 1 target point to spawn both and make between them small difference should not they be on different locations?
sorry I am talking too much today will take break and take a look on it tommorow
will have much clearer mind
It could be that when you use GetAllActors of Class and then assign the results to the array it didn't have any results yet because it can sometimes take a while to run depending on how many other actors you have in your level, so maybe adding a IsValid check to make sure there are results to process in the first place might help.
or set a timer by event with a short delay to keep looping until it has found the results then you can clear the timer and process the data
i will keep this in mind ant check tommorow thanks
I was firstly following turtorial he had almost same blueprints as me but for him it was working hah
weird
All it takes is one missing checkbox or something to skew the results from your expectations.
i know thank you for your time appreciate
Yes correct, but again I've never used the setting for real and you'd need to find it or ask someone who recalls what it is called
and i'm not sure if it's limited to reliable RPCs only or not, I only ever glanced at it when I stumbled across it. Better would be to solve your problem a more traditional way
You can check the values OnRep, you could change the design of your logic so you don't rely on timing. basically the problem you are experiencing is one small subset of potential problems you can experience
I assume here you have a bunch of logic in BeginPlay for various different actors. Right now its that not everything is replicated to the clients, later it'll be harder to trace down timing problems between different BeginPlay logic running
You can chose a method to communicate when everyone is ready and fully loaded, you could make your various actors less tightly coupled to others so that they don't need to reference one another on clients when not all of them may be completely replicated, etc.... various solutions based on your unique problemset
I ended up bouncing a RPC through my PlayerController so that whenever there is a nullptr, it asks for the array again. Not elegant but it works.
Thanks for the help! Btw I couldn't find the setting for that.
And in the end, I'll probably use raw UDP or TCP for messaging as UE's ownership requirement for calls and limitations on data isn't great.
I would strongly recommend against that
Raw UDP/TCP ?
That's working against the engine, and that's a mistake you make in the early day with UE, especially when coming from somewhere else
Yes. I'd strongly recommend sticking with the engine's design and learning the patterns, rather than trying to enforce your own
If your array contains 1000 elements you're not going to have fun
Well yes, but I might have megabytes of data to send from server to a client, I'm making a UGC game
You probably want to load the UGC from the client
rather than fromthe server to serve it to the client
I mean tons of assumptions here from my side, no idea what the requirements and constraints of your project are
Someone has to send the data to the client though ? Things made by other players
Think robocraft
I dont know that game
I'm not the youngest generation
Anyway. Assume you have a set of UGC server decides to play with
it publishes that to the clients in the lobby, clients load it through some web api
you offload the networking load to clients rather than CDN -> server -> clients
you just do CDN -> clients
I was considering doing client -> server (caches and stores) -> client
if your UGC is just like skins, all the server needs to know is the ID to share it with all clients
the clients download and load the data
There's a way to simplify UE's networking model with custom net serialization
it is also possible to stream big quantities of data in chunks from the server to clients using default Unreal's networking in a sequential and ordered way while checking against the reliable buffer.. if you only need to do one big stream on join then that might be sufficient, the rest are just deltas
Yours is smarter but it requires another server, and another codebase to interact with it, which basically comes back to UDP and TCP messaging.
It's more complicated that just skins, it's 3D models
Complication is subjective, based on circumstances
Do what's easiest for you
I gotta grab some sleep now
Ok, thanks!
As long as the 3D models respect the same bounds, collision, etc... as the original
and introducing them wouldn't affect gameplay other than visuals
again, can all be loaded on the client
π€
The 3D models are the gameplay. In my game, people are creating 3D models to make vehicles
Then you want to design that part really carefully π
then, you can also consider what I said
That's the reason i'm asking, I want to do it right
but wouldn't RPC add a lot of overhead ?
when we're talking megabytes ?
you'd be streaming it in manageable chunks in reliable RPCs
meaning that your data will be sent over time to the target
and you ensure you are in budget by looking at the reliable buffer and the packet size
I have to write an article about that, cause its a pretty useful pattern
If I have multiple players, loading things at the same time, the reliable queue could overflow...
that's the trick
you check against the reliable buffer
and send stuff whenever there's space for it
I usually check by buffersize/2
Wouldn't that bog down the game ?
there's no priority for RPCs afaik
Ok, so how can I check the queue?
I have to check cause I dont remember the syntax rn, but its easy
let me check
@cunning stirrup cannot send you much code cause im in the phone and its tricky, but look for NumOutRec
in UChannel ?
Hello!
Working a simple ping system for my multiplayer game. Currently using a line trace and creating a temporary actor to display the way point.
Trying to wrap my head on how I should go about replicating the actor only to team players.
I was thinking to replicate the temporary actor to all clients and make it visible only to those in the same team but wondering if there's a better way to go about this to reduce unnecessary replications.
My next thought would be to use DOREPLIFETIME_CONDITION but not any specific condition for what i'm trying to achieve. Would anyone have any tips?
Hey everyone. I was wondering if anyone had any knowledge in where to start implementing fog of war in a team based multiplayer game? I've seen that implementing some type of grid system that tracks what units are in each square is a way to go. How would I go about setting that up, and where should this state be stored (on the game state?)
Has anyone tried implementing a custom way to determine server authority? As an example, make a specific player authority over a sub level they are nearest to, or authority over another player? I'm looking into p2p alternative networking for unreal. Was thinking that if you could adjust who is considered server authority you could still maintain the basic networking framework
I wouldn't. Make that an RPC
Or you could do it with relevancy but I feel like it's more akin to a message
Please do. This topic is something Iβve recently started pondering. Would love to know the experience of others such as yourself.
I'm not an expert on the topic, but I've never heard of it. Also sounds like nightmare stuff, I'd try to find another way to go about it. What's the usecase?
Idk how it implemented, but I know there is an implementation into a small RTS plugin and it works multiplayer afaik
@prisma snow do you know the specific plugin?
yeah one sec
Real-time strategy plugin and showcase for Unreal Engine 4. - GitHub - npruehs/ue4-rts: Real-time strategy plugin and showcase for Unreal Engine 4.
When loading a new map, what's the appropriate place to assign players to a pawn? I would use player start, except there are fixed locations (and pawns) based on the role of the player (gunner and driver for example)
I read this: https://dev.epicgames.com/community/learning/tutorials/2YGy/handling-spawning-co-op-partners-in-multiplayer-bp-c but this applies to players joining an existing session. In my version the game can't start until both players are ready and have chosen a role (they can't pick the same role)
You can mark your GameMode as "Start Delayed" and override "ReadyToStartMatch" and return true for whatever condition you need.
And you can override more functions on the GameMode to provide the pawn and spawnlocation for them if the default behavior is not enough
to provide the pawn and spawnlocation...
This is the part I meant, sorry. Which method would this be?
Check the Overrides of the GameMode
I'm sure you'll find something matching those terms (:
Choose Player Start sounds good π FindPlayerStart seems even better
That looks interesting @prisma snow , ill definitely have a look at that. TY
@pallid mesa you ascended to a custom io_uring based netdriver yet?
or even better: raw frames
stop the bullying x'D
π
||htons(ETH_P_ALL)||
I want to set an actors location in c++ in a multiplayer game. The SetActorLocation call is made via a reliable Server function, and i can see via some debug draws on the client side that the server side actor moved, but the client actor didnt. Does anyone know what the possible cause for this could be?
these actors to have character movement components too, i feel like that might somehow interfere
Hi all. Please help me I have a problem. I have billiard balls replicated, in the server they are the correct size, and in the clients some randomly become small. What am I doing wrong
https://prnt.sc/FgLvnqwBJDDW
@robust oriole The internet doesn't send data fast enough for a completely smooth experience. That's why interpolation/extrapolation are used.
aye, i just ended up letting an ai controller control the pawn and used MoveToLocation
okay cool, yeah if you were setting the location of the pawn directly that wasn't going to work π
If your AI is a character, CMC will handle the smoothing for you
but not predictive movement, its too tightly coupled with PlayerController for that
meaning you will see yourself start moving after server starts replicating movement that happened server side
thats fine, its a tactics game anyway so quick reaction time wont be a big issue 
Another question aimed at replication and in conjunction with the gameplay ability system, I give my pawns abilities on the server, but they only replicate to the clients that possess these pawns. The list of all abilities the pawn has (or at least certain ones that can be executed by a player not owning said pawn) should also replicate over. Is it possible to set it up this way?
β¬οΈ images show (in order) how the abilities are given, the initialization and lifetime props of the pawn, the function i use to see how many abilities are reigstered on each client and the output. BP_PlayerUnitCharacter_C_0 is the Character possessed by Client1
Hello guys how are you doing? One question, I have to save the "character experience" data and I can't think of an idea to do it. because I think that making queries so that it updates every time it adds 1 or 2 points is going to make the performance bad, how would you do it? thanks guys
I think that making queries so that it updates every time it adds 1 or 2 points is going to make the performance bad
Measure it. Don't guess.
That said, you could attempt to save at certain points or save when someone logs out.
The issue I have with Listen Server is that if host disconnects, everyone is either kicked or enters host migration. Then host is capable of abusing their authority, and is responsible for all game logic running.
I'm trying to make it so that players can leave a session at anytime without affecting the others still staying.
Dedicated server isn't an option I'm interested in
Its either Listen, Dedicated, or p2p.
...these are your only two choices though
p2p isn't something you use for anything that is large.
p2p could work for a UI based game of some sort.
p2p also introduces everyone being responsible for all the game logic.
Outriders is p2p out of UE
So instead of one place of authority, you have X
Idk about non-lockstep p2p, but since the number of connections grows exponentially I wouldn't use such models for more than 4-8 players
If it really is true p2p and they decided to build their own networking for it - that explains why the net stuff was so dogshit when I played it.
But I'm also not exactly going for p2p. I was curious if the server authority could be chosen for each player, Like A is authority of B and vice versa, mainly so that B could be authority of sublevel B and A is authority of sublevel A, rather than A is authority over B, sublevel A and sublevel B
I would have to be very very sure I need p2p to start that journey. You'll have to implement everything from scratch and forget about Unreal's network
Could be. I reached out to a lead who did a presentation, but he didn't give me much useful info other than they changed a lot
That sounds a nightmare
What is computational- and networking-wise more heavy, using a multicast or setting the component to replicated and do it once on the server?
Very well could be. I haven't looked to see how authority is currently dictated, though I assume it's set when host opens their session
That sounds like listen servers being passed around between levels.
Essentially yeah, I'm not trying to do a pure p2p.
But what would be the point in changing host?
I'm not even trying yet. I was just curious
afaik replicated props use rpcs under the hood so I'd expect rpcs to be cheaper, but usually require more setup.
I don't think they use rpcs, I think they're just packets.
(I know everything is packets at the end of the day, but you know what I mean)
maybe, I asked a long time ago so
If player A isn't in sublevel B(which is authoritative by player B), they don't need to know anything about Sublevel B
I think it was Zlo who explained it. Might be able to find messages from them about it.
maybe!
So a separate session?
That's the standard way of doing things
Can only join one session at a time
What kind of game are you working on?
Player A is listen host for their session, and Player B is listen host for their session. Two separate sessions.
To clarify I'm making a VR version of Warzone's DMZ. My main concern is the drop-out of players at anytime. I have no idea how host migration affects a session, but I assume it would result in some sort of hitch
If the listen host leaves the session or quits, it disconnects all connected clients. It's like shutting down a dedicated server.
But there is host migration
Not if they suddenly quit, power outage, internet outage...etc
Only if they run the logic in your game that handles host migration.
Clicking on the main menu quit game button for example.
Ah, see host migration isn't something I'm familiar with. I've just started planning out the networking side as I get basic mechanics up
Maybe there's an unexpected shutdown function you can override? I dunno
I know there's a plugin, not sure if it handles unexpected disconnects
Have you done a multiplayer game before? If not, godspeed.
Nothing experimental, just basic listen server out of UE
guys I need help sometimes joining to my session on dedicated server which is on different network and machine works and sometimes I cant join because I will get this error any ideas how to fix it ?
[2023.01.05-20.58.10:201][598]LogNet: Warning: UNetConnection::Tick: Connection TIMED OUT. Closing connection.. Elapsed: 20.00, Real: 20.00, Good: 20.00, DriverTime: 20.01, Threshold: 20.00, [UNetConnection] RemoteAddr: 87.197.157.225:7777, Name: IpConnection_2147482458, Driver: PendingNetDriver NetDriverEOS_2147482459, IsServer: NO, PC: NULL, Owner: NULL, UniqueId: INVALID
[2023.01.05-20.58.10:207][598]LogNet: Error: UEngine::BroadcastNetworkFailure: FailureType = ConnectionTimeout, ErrorString = UNetConnection::Tick: Connection TIMED OUT. Closing connection.. Elapsed: 20.00, Real: 20.00, Good: 20.00, DriverTime: 20.01, Threshold: 20.00, [UNetConnection] RemoteAddr: 87.197.157.225:7777, Name: IpConnection_2147482458, Driver: PendingNetDriver NetDriverEOS_2147482459, IsServer: NO, PC: NULL, Owner: NULL, UniqueId: INVALID, Driver = PendingNetDriver NetDriverEOS_2147482459
[2023.01.05-20.58.10:210][598]LogNet: Warning: Network Failure: PendingNetDriver[ConnectionTimeout]: UNetConnection::Tick: Connection TIMED OUT. Closing connection.. Elapsed: 20.00, Real: 20.00, Good: 20.00, DriverTime: 20.01, Threshold: 20.00, [UNetConnection] RemoteAddr: 87.197.157.225:7777, Name: IpConnection_2147482458, Driver: PendingNetDriver NetDriverEOS_2147482459, IsServer: NO, PC: NULL, Owner: NULL, UniqueId: INVALID
i'm trying to fix this but MARK_PROPERTY_DIRTY_FROM_NAME(AActor, AttachmentReplication, this); throws error LNK2001: unrecognized external symbol
what i need to include or add to .build?
do you need to add the pushmodel module to your build.cs?
How to set up PushModel. First of all, in Build.cs, you need to add to exclude compilation problems
PublicDependencyModuleNames.AddRange(new string[] {"NetCore"});```
this website is shit https://tech-en.netlify.app/articles/en539604/index.html
In the standard Unreal Engine network architecture, the server checks if the value of the replicated Actor class variable has changed, and in case of ...
I have a question
If I have a widget and I want some players to see it and other players to not see it, what's the best way to do so?
Guys I have a dilemma in latency optimization in animations. I am running my animation on my machine first and then do the replication for all clients except me this is correct for better performance on animation replications to avoid lag
that is my code
Sorry - I'm just going to come out and say it;
If you have no experience in Unreal multiplayer, there is no point trying to create a p2p listen server failover solution or the 'each person is their own server' thing you described.
Focus on making a game that works with multiplayer first. That alone is likely to be difficult enough for you with all the resources that you have on this channel and the internet. If you go to try to modify the Unreal networking at such a low level, then every single time you run into an issue you wont know if its "you" or the code.
You also mention how a listen server gives the server person an advantage, but you then say a dedicated server is out of the question. That's exactly what dedicated servers exist, to even the playing field in competitive games. In a P2P game you still have the issue that each person can 'cheat' their local client if they are in control of it.
Modify the networking engine to the level you describe would realistically require a deep understanding of how it works, or a team of people and time to invest. It's the type of thing that I would assume Wizard, eXi, Zlo etc could undertake.
Unless there is a plugin that handles it all for you, I feel that your going to set yourself up for failure.
Create it only for those clients that need to see it
Yeah that's pretty much the very basic setup of prediction. More or less that's how the CMC works, it locally predicts actions for the autonomous proxy and replicates those to simulated proxies
I'm a hatless wizard now π₯²
Would you forgive me for taking the hat off?
I'll take it since you're π₯΅ now
π
AttachmentReplication is broken ?
this is runs on server
for (size_t i = 0; i < parts.Num(); i++)
{
parts[i]->AttachToActor(Group, FAttachmentTransformRules(EAttachmentRule::KeepWorld, EAttachmentRule::KeepWorld, EAttachmentRule::KeepWorld, true));
}
Is it a good or bad practice to override RPCs in child classes?
Because doing this seems redundant. While my child classes need to have the local call.
@thin stratus https://github.com/EpicGames/UnrealEngine/commit/572055baa0acc38de1963efea10c06da53e0be29 - fix for anim notifies not being fired on server side. I forget who else was talking about this.
@worn wagon π
Changing a 0 to a 1 π
I hope that actually fixes it, I have that convar set and still have issues in shipping
@dry pebble
I think they patched that bug a few weeks ago from the bug tracker
they only just merged it into the ue5-main branch though - so at least it will now be part of the next patch
I need synced clock for my buildings that produce item. I found something interesting. GS->GetServerWorldTimeSeconds() has totally different tone in comparison with TimerManager.SetTimer
ReplicatedProductionStartTime = GetWorld()->GetGameState()->GetServerWorldTimeSeconds();
GetWorldTimerManager().SetTimer(THWork, this, &ATDFactory::OnBuildFinished, 30, false);
ReplicatedProductionStartTime reaches the target time 3 seconds sooner lol
any idea ?
ServerWorldTimeSeconds are kinda a mess
They are averaged over x packages and then even reset once in a while
It's usually best if you code your own with a simple Server/ClientRPC setup
I have that in a Component on my PlayerController
Just sends an RPC to the Server and back with a Timestamp (both direction) so Server and Client know RTT/Latency and have a synced clock @rose egret
It doesn't
Thing with this cvar is that it didnt trigger - any - anim notify in the server when you are an autonomous proxy
There's another issue which is anim notifies on root motion montages
usually used in anim montages in gameplay
in such case queued events can get skipped in the server when you are an autonomous proxy
there are two solutions for this:
- set anim notifies to branching point: Not ideal and not always possible since you cannot have two notifies happeninh at the same time
- and the second solution is fix the cmc in MoveAutonomous
since it only evaluates non root motion animations
@thin stratus I don't need much accuracy so GetServerWorldTimeSeconds was enough for me but what I found is they use different delta.
you can see when windows loses focus or FPS is low TimeManager tick slowly
How to Reaplicate Tracks in Level Sequence ?
The sequences are not played together, but the Transform of the actors in the sequence being played on client 1 must be visible on the player camera on client 2.
Also, the tracks in the sequence are spawnable.
hello, I am looking to test multiplayer locally, I want to start up a dedicated server so i can test out my server browser, i ticked the launcher separate server, i am sure that in UE4 i used to get a separate window open
I got 1 listen server and two other windows clients with this settings
Pretty sure they are talking about a window that shows the Dedicated Server
might need the -log as an argument somewhere
I never tried that in PIE though
if that gets gets me a local dedicated server i can find and connect to, that is perfect
No, that's a ListenServer
I'm also getting a little issue https://prnt.sc/j-jyUnK4NFFX
yeah the dedicated server isn't starting, firstly i never see the separate window openeing
Listen server is a client hosting a game
also it never hits the breakpoint in the GM for a dedicated server
I have never used the Separated server option
If you start with "Play as Client" it should start a DedicatedServer
if i play as a client, that simulates a client connected to the server, i am trying to simulate a stand alone client trying to find a server to connect to
What?
I only ever did that with .bat files that start a Server
i did it before in like 2018 π
command line for that would be something like:
<path to Editor.exe> <path to .uproject> -server -log
Just trying to give you an alternative as I can#t comment on that "separated server" option
Never used that
this code stops be replicated under certain condition, it all triggers on a rep notify after I press an input to switch weapons, but if I press the same input the rep notify fires properly, but does not replicate
Setting a RepNotify variable to the same value won't replicate it
Cause it's not "dirty"
/**
* This is a rarely used option that will launch a separate server (possibly hidden in-process depending on RunUnderOneProcess)
* even if the net mode does not require a server (such as Standalone). If the net mode requires a server (such as Client) a
* server will be launched for you (regardless of this setting). This allows you to test offline -> server workflows by connecting
* ("open 127.0.0.1:<ServerPort>") from the offline game.
*/
UPROPERTY(config, EditAnywhere, Category="Multiplayer Options")
bool bLaunchSeparateServer;
So the Server will not trigger any Breakpoint I guess
thats what I though Rep notify would do I needed confirm ^^ Ty
So what would be my best option to press the same button to go back to melee ? π€
since I need it to dont change the value x)
its this
If you disable that then it's gonna be a new process, yeah
perfect
But why would you go back to "Fist" if it's already "Fist"?
Is it like "Unequip"?
If you want to go back to Melee when you are e.g. MainWeapon, then simply check that
Where you do your Input
When sending the RPC
Send either MainWeapon or Fist
Based on the Enum being MainWeapon or not
same for the other inputs
yeah what I'm trying to do is "If you press the same short cut that is already equipped, then you go back to melee"
So if 1 (main weapon) is already equipped then swap to melee
You can have priorities on action inputs
But also all your equip logic can run through that check abort early and revert to melee if the weapon is already equipped
That's trivial
Hmm How would you do that ?
Something like that for exemple ? https://prnt.sc/Ox-fmjnWO4A_
Make a Macro/Function that takes an enum of your weapontype
Inside this you compared it to the currently equipped type, if it is the same -> handle melee logic, return false/exit macro
If it's not the same, it returns true or your macro continues execution through its exit node where you continue the rest of the function, something something
The important part here being that the logic sits in one place, rather than you copy pasting the different BP nodes to the different input handles in your eventgraph
well I guess in all cases your copy pasting the macro on each input node ?
I'm curious how is it making a difference, exept for the part where it's cleaner, like is it actually sparing resources ?
ty for the tips tho I'm getting on it soon soon ^^
Well since time is the most scarce and precious resource that we usually have. If you have 5 of those weapons
cleaner and simpler to maintain. Less time spend duplicating any change to all the inputs, one place to fix a bug
it also makes it easier in a team for anyone else to come in and do something with the logic
One of the most important principles as an engineer is to keep your work clean and simple. Even if you are just alone
@serene furnace . Tag, forgot to reply to a message
Yeah for sure makes sence to try to make it clear and simple, i was curious to know if it was impacting the ressources of the server itself. I would probably make a macro anyway in order to keep thing clean, im actually happy about this project so far it's not messy, not too much at least
PlayerState has "CopyProperties", used to copy replicated variables to the new player state when traveling. What if I'm replicating variables inside an ActorComponent of PlayerState? Will those be automatically replicated to the new player state?
Nothing happens auto, you have to specify the properties that you want to copy to the new PS
With the exception of very few properties that Epic handled/specified for you
Hello, why is that sound on Map only playing on Server but not on Client?
Its an Actor placed in map and thats the BP
Because the actor is non-clientowned and only executes on the the local client ( your listen server )
Or wherever it runs, it's not properly setup for networking
RPCs need to go through a client-owned actor
Designating function replication across the network
So.. if the Actor replicates its not enough?
Hiya! Quick question for people using GameLift for hosting a dedicated server: were you able to have a crash report from AWS instance ? Since even building a server with crash reporter flag it does not seems to work for me. Minidumps are 0 bytes which is not helpful at all. Any pointers ?
Happy new year all! I have a bit of a generic question.
What is the best way to handle multiplayer character selection?
A newbie guess from me would be, to have a custom server hosted that would handle a player's character selection, (after they login and all), whereas after they join a map, the server gets to know which character they wanted to play by fetching that Server.
Another guess is, somehow having a Websocket kind of P2P logic where players that are in, let's say a lobby, they can see other players' changing selection like Fortnite for example, before they enter the queue to join the game, and again the server gets to know how to spawn it.
Or, which seems the easiest but not that secure, is to have the selection to be local and saved in the GameInstanced then fetched again by the client and RPCed to the game server to spawn that character by ID/Key.
Or even have the whole lobby and character selection after players join the game server, sort of a pre-match state where they choose the characters in the game server, and then the play.
This is a bit of a thinking out-loud here, but I found this is the best way to put the confusing ideas about how to go about this.
I am wondering if EOS+GameLift for dedicated servers can handle all of this.
Thank you so much for helping! I am sure this would be helpful for the masses in here.
Uhm.. this calls the same function but with a Box Trigger it works
There is nothing wrong with having character selection on the local machine and then making an RPC request to the server.
If you need rules for character selection then have the server send a response RPC to the player after they have sent an RPC request with their preferred character. This response will be used to either confirm their request so the player no their pick was successful, or fail telling the player to pick another character.
Then for making sure someone doesn't hold a lobby hostage you could either have a default character that the server selects if the player fails to choose in X seconds, or you reset the lobby because not everyone has picked a character.
There is nothing insecure about processing client side, the problem is who has authority? The client can tell the server what to do, but ultimately the server should have final say and should check the request input of the player against its criteria.
Ideally you'd have inputs connected to events that would make an RPC request to the server, and then if valid the server would perform the players request and create the player character, assign the player control of it, and replicate the players character.
Then again, that's ^ relative to implementation of your game.
@digital marten thank you so much for your input! I understand that this is completely doable, but only if the character selection is about to be done once you join the game server.
I was thinkings omething similar to LoL, where you hit a queue, and then you join a 'Lobby' (not sure the lobby here refers to players joining a game server that handles all the character selection logic and then travels everyone to the game map) or if it is completely P2P (websockets for example) so that players can see in real time other players' character selections and such.
Also, do you think EOS can help with any thing of this regard?
Overlap events are triggered on both the client and the server
No clue, haven't used EOS.
Like before my recommendation is to read the documentation, through the link provided, try around a little bit, come here again if you're stuck
yeah sure but here it says, multicasting will execute them on all connected clients
could I do this from outside of PlayerState? Or will I always have to override APlayerState::CopyProperties?
Okay, I got it I guess. I have to call the whole function in Multicast and not on the Server right? Now it works.
You could technically do whatever you want. The source code is all yours to edit. However CopyProperties is the intuitive and straightforward way.
It's also good to note that it's even used to preserve the PS when disconnections happen (either a hard travel or a disconnect due to a failing internet) though there are caveats you have to be aware of
The compendium in the latest pinned message goes over that in depth
yeah, you're right, seems like the smartest way to do this is to just use CopyProperties. I wanted to keep my ActorComponent modular but I guess it'll need some integration with the PlayerState.
Anyways, thanks for the help
I don't quite understand what you're saying π
So I put the whole function into the multicast and not first setting the timer and then calling the multicast. Now it works.
I'm supposing you're using it for seamless travels, which is almost fine. However, some ActorComponents like ASC can fail miserably when duplicated as AttributeSets fail to copy due to an engine bug. That's why if you're hard-traveling and duplicating ASC it's better if you make it stick around π
Almost fine is concerning. Are Actor Components that bad?
Probably seamless travel, yeah.
Nah, it's just that I haven't faced any bugs so far
Landmines are everywhere
Would be very bold to say "always fine"
Just do what you think is right, then when you inevitably step on a UE mine, ask if someone else has stepped on it before. Most likely, someone has.
fair enough.
What's the difference here between the two net modes: standalone and "listen server". I thought those two are the same.
the hint reads:
Play Standalone: Starts a standalone game. This will not create a dedicated server, nor automatically connect to one.
Play As Listen Server: Enables the Editor to act as both the server and the client. Additional clients can be opened depending on the number of clients.
stand-alone is single player
listen server is a server that also plays as a client, opposed to a dedicated server, that would be a headless server
I understand the dedicated server, but that isn't one of the options here.
hm ... I can start 2 instances with "Play standalone" and they connect via LAN just fine
Should that bother me?
It's called As Client
Read what you sent. It says "nor automatically connect to one"
Meaning you could still connect to one
In fact most if not all #multiplayer games start as standalone, and have times where NetMode is converted to standalone
alright, that makes sense. so in practice, standalone means I have to navigate my in-game menu to start a multiplayer session. whereas listenserver already listens to some other listenserver and connects automatically.
...listens to connections that want to connect to it
FTFY
Hey,
quick question: Is the Multicast quite delayed or is it more likely it is my hardware?
I set up a checkbox that all players on the server can see. Once it gets checked by a player, all players will update and also get the checkbox checked. But it appears that it takes around one second for clients to be updated, while the server (also via RPC) is almost instant.
A multicast can get dropped as it traverses the network if itβs unreliable (default).
Are you emulating network lag?
Whatβs the FPS like?
If you change the value of a replicated boolean on the server then all clients will reliably receive the updated value eventually.
You could also try making the multicast reliable but know that it comes with a warning. Donβt make too many of them reliable because a client gets disconnected if it overflows the reliable buffer. But thatβs like if theyβre spamming a ton of inputs and theyβre all connected to reliable network events.
Hey, thanks for the quick response. It looks like the "Reliable" setting was what I was missing. Guess I have to take a deeper look into Multicasts now to ensure I dont create any overflows. ^^
Any variables setting shouldnβt be set with multicast though
Because if a client joins the session after the multicast they wonβt receive the change. Use replicated variable and change on server instead.
Hey, thanks I am pretty new to multiplayer
or if they arenβt within the network relevancy as it changes same thing happens
wanted to discuss some CMC internals...
when client gets their position corrected from server, they cycle through their SavedMoves buffer and replay all moves. As it replays... does it RESEND the moves to server?
Check out the pinned messages, in particular the second post from the top.
The one about multicast rpcs vs OnReps
Don't send 20 RPCs per tick OnTick and you'll be fine
No it doesnβt resend anything upstream to the sever because the correction has already happened on the server.
as long as you're being reasonable with RPC usage you will not have a problem
thats what i thought too after looking through code... ok so my problem is a conceptual one i guess
Also most games are not worked on professionally π
- client receives rpc from server to correct their position
- on next tick, client will replay all saved moves buffer
- doesn't this instantly create another large location delta, which would trigger another position correction? whats the point of replaying
@graceful flame
That includes games that are technically financed by publishers and worked on by companies :smh:
I'm in such one, take it back 
There's never a better time than every single moment to get out π
Iβm not sure on the exact inner workings of the CMC replays. Itβs all there in c++ though if you want to look around.
i can see whats happening, my question is a conceptual one
thanks though
Iβm not sure what the answer is
Is it good or bad practice to override parent RPC's?
to trigger absolute server travel via console command should be like "servertravel MyLevel?bAbsolute=true" ?
Which further proves Rogers point π
(I don't have the kek laughing dog, that's the one that I really wanted to use π)
I've been here enough to realize that it's bad: #multiplayer message
There is no such option called bAbsolute
It's true by default afaik
Thanks, my primary concern is the redundant event nodes in my graph. ServerDoThing, -> MultiDoThing -> DoThing(override). Seems odd to differentiate between them and seems bloated. Thoughts?
Have your RPCs call functions then override the functions in child classes.
is it anymore difficult to setup multiplayer with IOS or Desktop? Or just minute changes?
Nah that's regular and fine
That's why you have the prefix
Isnt that the same thing tho, 3 similarly type events.
I see, thank you all for the advice here.
@fathom aspen controllers are not receiving an end play event nor a reset event so i thought it cause it not an absolute travel
That has nothing to do with absolute
That has to do though with seamless travel
Most probably they are persisting
@fathom aspen so if i want relative or absolute server travel via console command how do it do it ?
servertravel somelevel?absolute and servertravel some level?relative ?
Hello #multiplayer , it is i again. Today i have come to converse about level management in multiplayer. I would like my game to support a multiplayer mode, where one player acts as the remote host in "listen server" mode (probably). I would like players to be able to be in separate maps, like one player being in a town, the other leaves town and goes to the forest. now one is in the town map and the other in the forest map.
From my understanding, in order to implement this, the host player would need to have a persistent level loaded to which both the local host client and remote client connect. It would then load the sub-levels into the world far enough from one another so players dont see the other maps. Is that correct?
If one player would hit a level transition trigger, that trigger would then have to call to the server via an RPC to tell it to load the new map, wait for that to happen and then move the player in question to the end point of said map
Yes you just place them far enough from one another. You can even do this on a z-plane distance, depending on your game
or you can place them into enclosed cubes next to one another
In this modern day and age just place them all in one large map
World partition is your friend
Question, can you attach a weapon client side to the camera but server side attach a weapon to the player? (FPS game) is that how it works?
Two separate actors. One server-side, one client-side for the owning actor
You use the visibility bools on the separate actors
Hide the 3rd person weapon locally for the owning client
Only spawn the 1st person weapon for the owning client, or hide it for everyone else with OnlyOwnerSee
Or you simply let the ABP do the work for ya with one actor
There is also the third option where your camera follows the 3rd person mesh and you don't have a FPS camera per say
Trying to understand. So i need to spawn two separate actors? one server side and one client? is there a possible link or something you can send so I can dig deeper?
I don't recall the titles, but a few games have done this
You can't (and you don't need to), not even that you do in BP. But again the reason is that you are seamless travelling and you have similar classes of PlayerController in the old and new level's GameModes. If you say, force the seamless travel to be absolute then there's a high chance of having a failing travel, because an absolute travel flushes the whole URL and seamless travels occur for the same connected server.
TLDR: either change the new GameMode's PC class so it's different than the old's, that way PC doesn't persist, or just hard travel.
P.S: read the latest pinned message/article to get the full context
You don't need. There are multiple approaches
It gets complex because you need to manage the reference to the actor
as everyone else needs to see projectiles and VFX spawn from the 3rd person weapon, but owning clients on their FPS one
It is however the approach that is most easily implementable with limited resources, it only takes your time
I see, because I know that the templates and stuff or the UE4 multiplayer shooter i think uses one player and then just replicates or uses a weapon mesh on the character and updates it accordingly for the client
I just dont wanna do that I'd rather just use the weapon in game and attach it to my player
The Lyra project shows the third option
But I don't suggest building anything on top of Lyra
Okay I will look at that as a reference
So this is preferred pattern?
can some one explane me why this is working ? but if i remove delay and spawn actor on the same frame and try to attatch actor to it its just fails to do it ?
code:
#define Delay(seconds, ...) \
FTimerHandle __tempTimerHandle; \
GetWorldTimerManager().SetTimer(__tempTimerHandle, FTimerDelegate().CreateLambda(__VA_ARGS__), seconds, false);
....
Delay(1, [=]()
APartGrupe* G = GetWorld()->SpawnActor<APartGrupe>(partGroups[0][0]->GetActorLocation(), partGroups[0][0]->GetActorRotation());
UKismetSystemLibrary::PrintString(GetWorld(), "BuildPartGrupes Log: Attach loop started | parts count in Groupe =" + FString::FromInt(partGroups[0].Num()) + " |");
Delay(1, [=](){
for (size_t i = 0; i < partGroups[0].Num(); i++)
{
partGroups[0][i]->AttachToActor(G, FAttachmentTransformRules(EAttachmentRule::KeepWorld, EAttachmentRule::KeepWorld, EAttachmentRule::KeepWorld, true));
//partGroups[0][i]->SendAttachToActor(this, G);
}
}
)```
i have feeling i'm working around a bug for some reason 
You are showing a piece of code with no context, like where this is being called
Again.. not where it is being called
Where is the code that calls this?
and 5s after start of servers seems like an arbitrary time, chosen for the same reasons? Delay to hide the problem instead of fixing it
Assuming here, cos lack of context
Instead of using a fixed delay to wait for stuff to load its better to set a timer by event with a short looping duration then clear the timer once the thing you're waiting for is ready.
That is the same problem with a blue-tinted sheepskin instead of a green one
Since the amount of time it takes waiting for something varies
In most cases people don't know what they are waiting for, but just observe that a delay "makes things work"
Figuring out why something isn't working is the crucial part, proper diagnostics
@verbal tendon more context ok
Can you copy paste the text please? The screnshot font is too small to read for me
gonna be back in 30 and look at this again, the more context the bettter @native vector
press on image and open original
ok calling ForceNetUpdate(); on part(actor with will be attached) look like it fixed the AttachToActor issue
I took a quick glance, i'm not back, that code is riddled with problems lol
I'll code review later
the most improtant problems
u "know make it work and refactor" 
I've got a gameplay ability that runs server side, and interacts with some actor components. The ability tells the component to do some stuff server sides and waits for it to finish. In the run of that, the component changes some actor references up that i need replicated to the client's version of that component. I'd like the ability to wait for the replication to the client to finish before it continues. How would i go about doing that?
tl;dr "how do i wait for replication of an object to finish in blueprint"
does this function do that? if so does it do it for the object its being called on, or in general?
nvm that node doesnt do what i am looking for 
Please post your code somewhere in text format
There is PostNetInit:
Always called immediately after spawning and reading in replicated properties
Can someone confirm my suspicion that PostNetInit is only called on clients?
no idea about blueprint
A - return; no need for else. You want to avoid indentation to keep code readable
B - size_t is unsigned. If the if logic is executed when i==0 all other elements in the array get skipped. Hard problem.
- Assuming order is not important, use
RemoveAtSwapor whatever it is called, it swaps to the last position and simply shrinks the array, rather than reordering all elements
C- unneeded if, you literally removed those inB
orange C- shoulda been D, hidden, can't review
Your function is way too long and indentend and it even continues, you need to split your code up better so it becomes more readable and maintainable. Use comments. That's the quick glance things.
https://www.youtube.com/watch?v=26qWNLrRfn8 this is the only thing i could find , i have no idea if it still works but im actually looking around for information on the same thing
Simple Physics replication component that syncs location, velocity and rotation. Might make a tutorial on it later...
Link to the plugin : https://drive.google.com/file/d/13lCTFmj7xEUvANfssSI0imEs628JcQ8o/view?usp=sharing
Also if you want a more professional way of doing this use SmoothSync from the unreal marketplace, its made in c++ and has ...
ive made a Raycast physics based character controller, but i dont need complex physics interactions between other vehicles , its more so just to view the physics and movements of other players, so im assuming its possible to disable physics on anyone that isnt the local player and just send the transforms for everyone elses vehicles. but i havent actually tried it in Unreal , this method works in Unity tho
The hard part is when I say I hit the ball, you say you hit the ball, who really hit the ball?
It's all easy UNTIL you need interaction/collisions between player-driven things, then it shits the bed. Go ram another moving vehicle in PUBG for instance.
couldnt you have a client send the collision info for validation to the server , then the server read the connecting clients collision info and if it doesnt receive it , kick from server? or something along those lines,
guuuys I have hilarious problem XDD I refactored my code so my plane after joining session is spawning by this blueprint in GAMEMODE after on post login but when I spawn my player like this I dont see each other in game can be problem in that that I am not doing RPC on that spawn?
thanks
Send the client input too
I only send input, then simulate locally, and simulate on server. Server is authoritative over the general movement of the vehicle but doesn't replicate little stuff (wheels etc)
So I simulate everywhere, but server's version is what you see reflected in the actual movement
Built in replication but tuned to be less strict
still strict enough but I don't care about 1cm error when my vehicles are the size of tanks
I hope smooth sync is enough to keep fast moving vehicles in check, im trying to make an arcade racer with physics based raycast vehicles
any tips?
Any tips on creating CIV style movement pawn? Basically just hovering and dragging yourself across a map.
I would normally not replicate the movement, but since using Replication Graph, the position of the camera/pawn is quite important to cull stuff outside of the vision.
Since there is no way to cheat with the pawn location, I have CMC set to client-authority mode.
I dunno if I am approaching this problem from a correct perspective. Maybe not using CMC and just sending periodically the location from client->server would be enough. What do you guys think?
CIV is a turn-based strategy game, there's no FPS/RTS-like real-time movement
you go from hex to hex, you set the target hex, you let the animation do the rest. Sounds like a lot of overcomplication thinking
You can go as simple as interpolating to target position
make sure your logic is in a class that handles the hex-movement, forget world position
that's all fluff
you only care about your hex movement, you get a world position from the logic that drives your hex-based world
and simple use that for displaying visual stuff
I believe in the modern CIV the movement is not tied to the hex tiles but it's more of a world absolute position camera. But you are right I should have chosen a different RTS, such as Starcraft as an example.
Movement is absolutely tied to the tiles. You can't put units outside of the hex-grid that is the basis for the entire world. Pick your example wisely
Or it might be unclear what you actually want
This was linked a few days ago https://github.com/npruehs/ue4-rts
I haven't checked it out myself, but looks like it might have some goodies
Oh, really cool! Thanks for the link.
I apologise if I was not clear enough before. I not talking about the movement of units. Just the movement/position of the client camera. The camera that moves when you drag your mouse across the map and is only limited by the world/map bounds.
Even more miscommunication, because CMC is the abbreviation for CharacterMovementComponent
Camera's on the list in that github, I'd be surprised if it wasn't covered properly
True, because I actually have it as flying character. I understand pawn would be much better, but there were some legacy reasons
I'd imagine it just uses the mouse input and translates it into movement
There's nothing too fancy about that
I still need to keep the server informed about the location of the camera though.
Why?
For network culling
Only if it's actually a performance problem, wouldn't you just use relevancy?
As mentioned, I am using Repl Graph to heavily cull the units that are on the map. If they are not even in the cone of vision, I need to discard that
ah right sorry I skipped that
I am spending 80% of the tick just handling networking
π€
Even with Rep graph fast path
Is this with minimal, normal or stresstesting max units on the map load?
I would say normal, as this load is expected. +- 250 players
That's a lot of players for an RTS game π
Basically 99% of them are on ground, and few have CIV/Starcraft view of the map giving commands.
But that is a lot of data to send/process without heavy culling
Ah there we go more clarity π
sounds like that FPS where there's one commander that plays an RTS-like game with a bunch of grunts shooting on the map on the ground FPS
So the trick here is
that you don't need real-time replicated data from all the grunts
you can have periodic lower-frequency updates from them
It's not turn based
I understand
instead of getting immediate replicated positions from all 250 players that are fighting on the ground
they give you lower frequency updates with their positions, to update the commander map
they simply ping their location every now and then, much less traffic than with replicated movement
but still enough to have fluid movement for eye perception for the people in the command chair
a floating camera should not be a character
just make a pawn with a camera on it
Maybe for a very far zoom, but in most cases I want to use the replicated movement and standard replication for the characters on the ground
And then manually ping the server about the camera location?
For network culling?
network culling should have zero to do with the camera location
if you're talking fog of war
if a variable is set to repnotify and it is changed on the client does it call the onrep_variable() on the server/other clients or does repnotify only get called from the server if the variable is changed on the server?
Changing it on the client will do nothing to the server
ah that's good to hear thanks
if it's a BP repnotify it'll fire because BP repnotifies are really OnChanged callbacks
Even in Fortnite (as far as I know), the characters that are in your cone of visions are replicating more often then the ones behind you and if they are far enough from you, they stop replicating completely. Aka network culling
The only way the server knows anything is from a client-> server rpc
That is very much dependent on where you are and where you are looking, no?
so changing a variable on a client should not be replicated to the server if the variable is repnotify then right?
There's virtually zero data being transmitted for a turn based game so it's no problem.
You'd only wanna cull for cheating
and that'd be done vs fog of war
Changing a variable on a client doesn't do anything to the server no matter the repnotify condition
I dont' have a turn based game though, it's more of a Fortnite with few commanders that see the whole map
ok thank you
In that case then yeah you'd probably think about that.
guys I am having problem I dont see this log printing anywhere I need check what team does player have but I cant because when I am setting their teams and spawns its not working correctly idk why
its in game mode
I think there are 2 options for commander movement
- Client-authoritative CMC
- Client-side movement and pinging server about the current location/zoom
Are you talking about moving the commander's viewpoint or the things they are commanding?
If it's their viewpoint I'd just tell the server where you are and what your view frustum is
Commanders viewpoint, aka the human player in Starcraft.
the server can optionally say "nope" if it's in an area not allowed like fog of war
Yeah then just spam at the server "Hey I'm here looking this direction at this zoom"
But this sorta smells like premature optimization
How close in are your commanders looking?
They could get to ground level
Usually commanders have a far-removed long-range view over the entire map, rather than a close look
So their altitude can change and this changes their zoom level?
Yes, the closer they get the higher update rate will the units have, but the fewer units should be replicating at that point, because the commander is zoomed in, thus smaller area to view
is their viewport static? can they change the angle or do they always look down on the units unless they're on the ground?
I was thinking very much a CIV style zoom. Mostly static angle with a bit more tilt towards the ground
I don't zoom too much, I'm always zoomed out so I don't know how it changes when you zoom closer
but I get it from what you're saying
again unless you can actually zoom in close enough to see the units's individual limbs move, there's a lot of optimization potential
I wouldn't fuss about the commander movement, I'd put my time into getting the network culling right
as that's where your bottleneck will be
Guys I am saving my team in menu where I have same game mode as game mode in map and I have same player state there but immediatelly when I join session this information is getting deleted in new map? why when I am with same pplayer state etc
You can zoom in to see the wounds on each character, even eyelashes. Yeah, I think I will just make Pawn with camera and send updates to the server. But to be honest, isn't that what client-authoritative CMC already is?
It is
The concept you're describing is quite unique
i am using exactly same game mode and player state also player pawn but its getting like deleted when I join session
what can be problem
i thought its good way to store variables in player state as they are replicated
Personally I'd put in restrictions that'd make my life easier, but then again, I'm acting on limited information, so to be taken with a grain of salt
I'd just not let commanders zoom in that closely, simply remove them from the relevancy equation, and only send them periodic updates
So that makes commanders not a problem for scalability anymore, and you only worry about getting the culling right for players on the ground
okay I will try find solution somehow by myself then π
What did you mean by " getting like deleted". They either get deleted or not
I am printing it whole time by widget where you have your team and casting to player state and immediately after joining session I am starting printing empty string till I am in lobby I am printing right team
Yeah, I need to try few versions and compare. For now, I think CMC would be easiest to implement, because of some legacy garbage
Apply π₯ to legacy garbage
π
Real world example: we burn garbage to generate energy
use the newly gained energy to do it right π
but I can use game instance instead of player state
it persist always
and it will be solved.
...
Can you please re-iterate what you are experiencing and what you want it to do?
I gotta grab some sleep, it's almost midnight here π€
Same. GN and thanks for the help
π
ok I run my game right? Then I will join lobby it will put me in random team Blue/red ( I am printing this team so i can see if I have set it) after I click play I will join session and immediately after join this print reset to empty so my team in playerstate was deleted
idk why its getting deleted
I have same game mode for menu map and for session map too
currently I tried use GameInstance instead of player state
for storing this
we will see
now I am in lobby u can see on the left team is blue
going to join game
But player states or even game state is not persistent when you travel on server. The new game mode just creates new player states AFAIK
okay It persisted till session with game instance
okay so I will use game instance for these stuff
sad I thought when I have same game mode it will persist
its quite uselles then
thank god for game instance
You could store stuff in game instance, but please make sure you are doing that on the server side.
Secondly, creating a subsystem would be a cleaner solution
why server side ?
I need store team for player for him
to know
also I am using eos what subsystem do you mean
Your own subsystem
why I should do it kekw
As mentioned, it is a cleaner way to separate your code. If you put everything into Game instance, it will be a mess.
Why server side? Server side needs to keep track to which team it assigned the player. Otherwise the player can just lie about which team it was assigned to. Never trust the client
kekw
okay but i cant store it before game starts as you can see because I get deleted player state and even game state
so every player need know what team he belongs to
and then I can store it in session to player state or game state
but I need pass it via game instance
The game instance is persistent on the server too. The server has it's own game instance, so you can store the teams there. And you know you can trust it, because it was created on the server.
ah okay I got it
but when I want use it on server game instance I need use custom event with call on server
?
or ?
Use what?
if i want store those informations in game instance on server I need call it via custom event called on server ?
sorry its midnight here maybe I am already dumb
Server should store the data there, not the clients. NEVER the clients.
Server generates who belongs to which team and stores that in a TMap or TArray on server.
I understand you
but how store it on the server is my question...
if I need call rpc or what
No
or how to store it on "server" game instance
On server, you call write stuff into a variable (which is in GameInstance).
Cast<MyGameInst>(UGameplayStatics::GetGameInstance(this))->Teams.Add(TeamID, Player)
On server, just grab the game instance
and write to a variable there
and via blueprints its available too?
Yes, but if you are dealing with networking I would recommend C++
i am using it 50/50
sessions login etc is in c++
and easy stuff in BP
and I dont need code storing variables via c++
no reason
That means you will never be able to get the player teams on CPP end though ...
Anyhow, I think you got the idea about storing data on the server.. GL
I can I am able to store variables from BP to c++ and opposite
but I dont need this in c++ for now
Unless you do some hacky CPP getters, you cannot use variable declared in BP in CPP. It's a one way street
I know I already have done this because I am passing informations for login to c++ and from c++ to BP also JWT token which I am getting via varest in bp
dont worry π
Problem: Need to remove UI element on [Event AnyDamage] on ONLY client, but since AnyDamage runs on server it removes the server's UI element when the client takes damage.
How do I remove the UI on only the damage receiving client's UI? I've tried has authority/run on client but it still removes on server O_o
You need to RPC to the damaged player controller
What node would I use to check the player controller?
nvm got it
When a client is connected to a dedicated server and want's to leave to a random single player map via a widget button on a menu by OpenLevel(By Name) Node, How come it works in StandAlone but when the client is connected to the server and tries to use it, it simply rejoins the dedicated server it's already on?
I think maybe i'm not destroying the session??
I have a general RPC question I've been curious about. So let's say I code up a damage function. My character shoots your character. My character, on hitting tells the server "Hey, I shot this guy."
Server takes the target, figures out the damage (based on my stats or weapon or whatever) and assigns it.
How does the Server know it's valid? In other words, how does it know I really DID hit it.
what do you mean with know it's valid? are you relying on unreal's network validation or do you want to write you own additional validation
I'm not sure - this part of MP is still sort of nebulous to me. I know that on my character, if I call an Event on the server - I can put something like "Damage Targetted Actor" but I don't know how the server knows I'm not trying to cheat. It seems like there's no safeguards, but maybe my understanding of UE server is still limited.
nobody is going to hack your personal project, so theres no real reason to worry about security π
That's not why I'm curious, I'm curious because I want to understand the systems better.
Like, it seems to me it would be more secure that when you press 'fire' - it actually runs the raytrace on the server, rather than running it locally and saying "I hit x"
that would mean replicating all the actors across the servers
so you would have a client with a player but on the server a replication of that player actor would also fire
So the validation is basically the sever doing exactly what the player just did and then verifying it's right?
In laymens terms
Pretty much.
you wouldn't send a hit event from the client
you would calculate it on the server
cause its easier then doing time warping calculations to account for latency
Yeah, it's earlier in the chain. Both the client and the server would "fire", but only the server's one would actually do anything. The client would just simulate it, expecting a similar/successful return from the srever.
I think I see what you mean.
In this 2018 GDC talk, Psyonix's Jared Cone takes viewers through an inside look at the specific game design decisions and implementation details that made the networked physics of Rocket League so successful.
have a look at how they network the physics in rocket league
Thanks, I'll take a look at this later this evening.
I feel like I'm getting a grasp on 'how to do X' but I'm interested to know 'why is x done this way' to better improve myself.
unreal might not be the best example in many cases, it can be very hard to understand what is going on, writing your own stuff from scratch is great for learning
Also 20 years in AAA sort of has me wanting to make stuff as tight as possible lol. I know no one will hack my side projects, but it's just behaviour ingrained in my head now.
how much are you getting after 20 years π
Well it's 20 years of working on a proprietary engine so this is like starting from scratch π
hahaha i meant in forms of compensation for working on it
Oh nothing, this is purely my own interest. Again, 20 years of proprietary means if I ever need to move to a new studio, I'd like to be up to date with one of the biggest engines.
Plus I just like making my own stuff on the side. Lets me build things I can't otherwise.
/portfolio freelance
oh boo! LogProperty: Error: Replicated TMaps are not supported.
Make an RPC that takes the key and value instead then in the implementation set those on your map
I am missing Development Server as a build target, any ideas?
did you create a <project>Server.Target.cs ?
you also need a source build of unreal to use it if you didnt already know
is that true? i thought only for a linux dedicated server?
for any dedicated server build
i said the same thing a few months ago and i was told it wasn't true, i've not undated my knowledge since 2015 when i built my first linux server
it says it right here in the docs https://docs.unrealengine.com/5.1/en-US/setting-up-dedicated-servers-in-unreal-engine/
You must be using a source build of Unreal Engine, which you can download from the Epic Games Github.
if you try without, it will tell you that its unsupported
@torpid girder @plucky prawn thanks for responding, yes I have the source and I have a server target
glad i was right π makes me feel better, π
did you regenerate your solution file?
you mean regerenerate visual strudio solution?
yes
AH damn, i found the problem
the code is broke
oops
Thank you β€οΈ
you know, if you are working alone, being able to ask a question here has been invaluable
Hello
When a Client connects to the Server, βAgameMode::PreLoginβ will be called and this will give the GameMode a chance to reject the connection.
If accepted, the Server will then call βAgameMode::Loginβ and so on
How can I decide whether the connection is accepted or not???
I want the player to be able to join only if certain requirements are met. Thank You π
What decides is the ErrorMessage param. If empty then connection accepted, if not then rejected.
If I use an RPC call, RPC server call for example, and one of the inputs is an actor class, if the actor class has lots of variables etc, will it take up more bandwith space when sending the RPC call?
I presume what you really mean is an "instance" of an actor? But either way, no, the "cost" of sending an actor via an RPC shouldn't be affected by how many variables the actor has within the class
Expanding on what Kamik said: variables only take up bandwidth if they're replicated. Sending a pointer to an actor over RPC does literally what it says. The RPC sends a pointer which is essentially a memory address to a thing in memory. In your case it's an actor.
I haven't done enough myself yet to know how everything in unreal works, but I wouldn't send a pointer of an Actor via RPC because it's a memory address on a local machine. If another machine receives that pointer and tries to read it, it'll point to something different in memory.
its basically passing a 'reference' to the actor, not the full actor itself