#multiplayer
1 messages Β· Page 526 of 1
Okay so I have a sort of complicated question.
In a dedicated server environment, how would I handle the following:
I built a login system that works and authenticates but now after authenticating, I want the client to go to another map. I've only worked with listen servers so I really don't know that much about dedicated servers, what I am wondering is how this would work? How do I make the two clients share the same map? On listen servers, the host is listening for connections after the map is opened with the listen thing, and clients do client Travel to it, in a dedicated server what to do?
@fringe sinew it depends but usually for dedicated server u have to launch a game server which is not easy. first you have to use services like gamelift, playfab, ...
Hmn.
I do know about that but I can also run the dedicated server locally too for testing purposes.
All I need to know is how to handle multiple maps ;-;
Yeah I did some digging and found that we can only have one map on a dedicated server.
Well can we have it like a parent map and many different children maps that can be loaded via level streaming?
My level blueprints BeginPlay node fires not instantly after a client loaded in, but there seems to be a delay corresponding to the clients ping. I tried to use a loading screen, which gets removed after the level loaded, and should be instantly added again, but due to the delay in the BeginPlay node the loading screen dissapears for a few frames
Any idea why this is happening, and is there a blueprint that gets loaded instantly so I dont have the delay?
@solar stirrup No - components are replicated through their owning actor, so you need to call ForceNetUpdate() on the owner
how long does it take to execute a shipping-build-dedicated-game-server on a normal PC ? given the assumption level is empty
I am thinking whether my matchmaker should cache ready game servers or not
F
@rose egret You want to have idling instances that are ready to move from an empty waiting level to the actual game level.
@thin stratus yes they are actually waiting in lobby map which is empty. when all users joined then the instance travels to game map.
I may also preload assets of the game map in lobby as well. don't know how much it helps
how a dedicated server handles assets ?
as far as I know textures and render meshes are not cooked in dedicated server.
@thin stratus I had tried to run all the movement through the server for my grappling hook but for some reason the character still glitches back to normal position
Shouldn't though, so something is still wrong in your setup
Nvm I got it to work thank you @thin stratus
@thorny saddle https://www.youtube.com/watch?v=_XW9oI36kTE
In this video we will simply be creating a dedicated server to be used for testing our code in a multiplayer environment.
Host Server:
"C:\Program Files\Epic Games\UE_4.22\Engine\Binaries\Win64\UE4Editor.exe" "C:\Users\YOUR USERNAME\Documents\Unreal Projects\TutorialGame\Tutor...
not strictly ue4, but can the same UDP socket on linux not be used to do blocking writes and non-blocking reads?
Hi all, is it possible to pass in variables in some way as a connecting client? Say I have a Main Menu that will determine the game mode/map that will be put into play, and I'm connecting to a server as a client. I want them to be able to choose to connect as a Regular Pawn, or a Director Pawn (something like a spectator but replicated so players can see them). Right now I'm passing in the choice with a command line option on clients, but I'd like it to just be two different buttons on the main menu that you can choose as a connecting client. As server I can pass in variables via the open level options string. Is it possible to also pass in variables from client somehow?
Hello! I have no experience making a multiplayer game in UE4, but I'd like to avoid shooting myself in the foot early :)
From the bits and pieces I've seen, there seems to be quite a lot of replication (and perhaps even extrapolation) handled by the engine. I'm making a simple little P2P multiplayer physics-based racing game with full server authority (think micromachines) with custom physics to get my bearings back.
In order to harness the built-in network stuff, does it matter if I use a regular actor instead of a pawn, or should I switch asap in order to avoid issues? Should I look into networking early in general or can I delay that to later when I have a working single player prototype?
Another idea I had (wish I fear might be redundant and I doubt is novel) was to use localized authority. Two cars colliding would notify the other car of a contact (forces applied) with a timestamp. The earliest (or only) timestamp would then gain authority for every subsequent interactions between them. This would create a constant authority ordering among players (which could start out with a fully meshed ping contest). It would err on the side of collision but could allow seamless transition when a host leaves and adapt to network disturbances.
Again, no idea whether that's desirable though and how much more of a pain it would be to implement than full server authority π€·ββοΈ
unreal has no built-in P2P
@winged badger Sorry maybe peer-to-peer is the wrong word, I meant authoritative client
As in, no dedicated server
thats listen server, its still server auth
Oh yeah listen server, haven't heard that one since my CS1.6 days
Well that's what I'm going for anyway, doesn't need to be P2P
unreal also doesn't do host migration
@winged badger Well that second idea would definitely require a proper P2P implementation, but it's more of an idea I'm toying with, I'd want to set something up with just regular server authority first
How much refresh rate is good for server? Especially for big size RTS? Like 1000+ units
Massively depends on the game, server hardware etc. There's no one right answer for that.
Answer is try it and see
hello everyone
are there any scenario's when multiplayer (replication, rpc's) wont work in VR builds?
ok
i seem to have a problem then
because everything works fine if not vr mode
but as soon as i switch to vr builds my replication is out the window
also any reason i would see an offset in attached actor on server in vr but not in normal mode?
Nothing springs to mind unless something is specifically done for VR to work - but generally speaking any and all networking and general gameplay logic is unaffected whether it's VR mode or not
So I'd say there's something else at play there
Because I've got the bad habit of making long drawn out preamble that noone cares for and ultimately detracts from the question, I'll just repost here the core questions I asked ealier :D
In order to harness the built-in network stuff, does it matter if I use a regular actor instead of a pawn, or should I switch asap in order to avoid issues? Should I look into networking early in general or can I delay that to later when I have a working single player prototype?
And I've made a preamble again.
If you want an object that the player controls and moves around, use a pawn
It's a physicsy car
Well it's what the gameplay framework expects - and in my experience working against it ends with peril.
Network roles and the like won't be correct for example, possessing the vehicle is the best way IMO. All my vehicles are based on pawns if it helps (and they also use a custom phys sim)
Roger, do you know if there's a straightforward way to convert a regular Actor to Pawn by any chance?
Oh yes
Just change
public AActor to public APawn π
And when you control it, make sure the controller "possesses" it
The C++ code is contained in an actor component, so the actor is a BP one
Yeah just reparent the BP to a Pawn
Oh okay, I'll try that out as soon as I get home π
Incidentally this reminds me, it will also allow you to use the engines AI system - which expects an AI controller to possess a pawn also.
May not matter, but food for thought either way
Might matter π€·ββοΈ Thanks a ton π
But as you get further in you'll find that players generally have a controller, a pawn and a state - and those three things work in tandem together by design.
@chrome bay I see, by state do you mean a specific object or just the collection of variables in the object?
specific object - the player state actor
hey hey sorry to bug you again @chrome bay but any reason you can think of as to why the network profiler will be blank on opening a .nprof file π¦
No idea sorry. Works okay for me in 4.24
Some older engine versions broke it, not sure which ones though.
Just make sure it's running in an actual networked instance of the game
E.g, press PIE, then start the profile, stop the profile, then stop PIE
@chrome bay 4.22.3 source build had issues.(not sure if it was just our setup or because it was broken anyway) using the .exe from a 4.24 build and managed to profile. Thought i'd let you know. Thanks very much for pointing me in the right direction ^_^
Can someone help please, I can't find a single tutorial on how to do pawn possession in multiplayer
I tried 2 different approaches but they both only work on singleplayer
I don't know much about that, what I meant by saying different approaches is in one the TP character does the possessing and in the other one the controller does the possesing
can u point to any tutorial or documentation for multiplayer possession
well just a few days back I managed to launch the server for the first time
so umm
I'm trying to get in a vehicle
without any animations
ok thanks for the help
ok thanks, I gotta go now, so I'll look into it later, thanks for all the help, really appreciate it
Depends on the game
In a RTS ? Maybe one ?
you need to seriously fake stuff to get over 100 units moving around at the same time, at least using CMC
and if it can't do a 100-120 FPS on a high end computer, the game might as well not work at all
He's talking about dedicated server tick rate I guess
So which tick rate are you talking about
UE4 ticks are basically frames, so you might be talking about clients, the server, or the net update rate
@quaint spear https://www.youtube.com/watch?v=VusAHXoHF3Y
Traditionally, multiplayer real-time strategy games have used the lockstep approach to support larger numbers of units fighting their way across the battlefield.
In this Unreal Fest Europe 2019 session by Deadalic Entertainment's Technical Director Nick PrΓΌhs, you'll discove...
this is how daedalic tried to do an rts game in ue4
the project got put on hold but they might talk about tick rate etc, can't recall but worth to watch
will not work w/ thousands or even hundreds of units imo
Hey all! Can someone please remind me what the console command is for displaying character/CMC movement corrections/reconciliations? I've used this 100 times, but right now I'm having one of those moments where I just can't seem to pick the right words for Google to give me the answer I want.
Ugh, never mind. Finally found it: p.netshowcorrections 1
In a bit of a pickle: I'm sending data from my server to a game client via UDP, using plain old FSocket. The data as captured by wireshark (and ngrep on the server side) looks like this:
tΓ+Γ<ΒΌYΓE 5Γ}@3bSΓ
ΓΓ
ΓΒ¨VΓΓΈΓ!ΒΏp1 138.197.206.197 57935|
The payload of which is p1 138.197.206.197 57935|
Now for some reason, Socket->RecvFrom() on the client side seems to be getting p|, which is a message that's been sent several seconds before that, has been ACK'd so it shouldn't ever be appearing in ue4. It certainly is not what's being sent over the network. My question is why.
the corresponding ngrep capture is this:
U 138.197.206.197:22222 -> 68.53.95.72:52545 #49
p1 138.197.206.197 57935|
it seems like old data is being returned by Socket->RecvFrom() somehow, like if it's caching it or something
to better illustrate
@chilly mason Is the socket newly initialized at that point, before calling RecvFrom ?
it's not
I would expect the data to pile on starting from the creation of the socket, until you call RecvFrom
I'm consuming data as it comes
So was the undesired message sent before or after you created the client socket ?
the flow looks like this:
- client registers w/ server
- server sends list of players
- client asks for a new list of players every x sec
- server respond w/ list of players
- client consumes response
(I'm debug logging everything that's consumed by the client as strings)
udp
No, I mean this should be TCP
ah
Anyway, so you then go on to get partial data on one update, then the rest before the other update ?
hum? :)
What's the exact issue ?
the issue is that the first list of players is empty as the server is not including the querying player in the list and that message seems to be repeating on the client side
when calling recvfrom
i.e. the first list message is empty
p| --> an empty player list
Alright
once another client connects, the server now includes that client in the original client's list messages
e.g. pStranger 1.1.1.1 12345|
messages always start with p and end with |
(players are delimited by |)
But you can see the real data on Wireshark ?
yes, as in the screenshot above
also in the screenshot
at the bottom
for now, everything fits inside a single MTU worth of bytes so it's a very simple usecase
Gonna need more context, when does that happen
it happens on a simulated tick @ 30fps
So you're reading network data on tick ? π
void UHoruNetManager::Tick(const float DeltaTime)
{
if (KeepAliveTimeLeft < 0.f && Socket)
{
printf("keepalive\n");
KeepAliveTimeLeft = KEEPALIVE_INTERVAL;
int sent = 0;
Socket->SendTo(KEEPALIVE_BYTE, 1, sent, *MatchMakerAddress.Get());
}
TArray<uint8> data;
data.SetNumUninitialized(MTU_SIZE);
int read = 0;
int sent = 0;
if (PlayerListPollTimeLeft < 0.f && Socket)
{
PlayerListPollTimeLeft = PLAYER_LIST_POLL_INTERVAL;
// request the player list from the matchmaking server
if (Players.Num() == 0)
{
data[0] = 'l';
Socket->SendTo(&data.GetData()[0], 1, sent, *MatchMakerAddress.Get());
Socket->RecvFrom(&data.GetData()[0], MTU_SIZE, read, *MatchMakerAddress.Get(), ESocketReceiveFlags::None);
FString received = BytesToStringHoru(&data.GetData()[0], read);
printf("[tick] received: %ls\n", *received);
if (received.StartsWith("p"))
OnPlayerListReceived(received);
}
}
}
it's debug mode, so yes on tick
I have a threaded version but I'm not turning it back on until I fix this
Alright, so I don't know if that's the issue but I've never used RecvFrom outside of a while loop on the read size
Generally speaking, UDP is entirely unpredictable, and the safe way to read data accurately is one thread, that only does reading (not sending), in a loop, all the time
I have a version that does just that
the problem is
I'm not having issues with the data not being sent
which is something I'd understand
not being sent [by the server]
in other words, if my silly debug tick reader would not be getting packets - that I'd understand
but it's getting them and they're "stale"
there's no data corruption since both the start char and terminator char are arriving correctly, and in fact the packets contain older messages
whereas both wireshark and ngrep are telling me that it's the correct message that's being sent
It's clear to me that the reading code here is the issue
well I can try switching the threads back on
That's not even the issue
You should however get the incoming size before you read
Using HasPendingData
ok let me try that
Basically while(haspendingdata(size)) RecvFrom(size)
And after the while loop exits, you can decode the data
yeah I get the threaded idea
No thread needed for that
If you want to read from a socket, you need a while loop
same problem w/ haspendingdata
So what's the coede like now
uint32 expected = 0;
const bool bResult = Socket->HasPendingData(expected);
if (bResult && expected > 0)
{
Socket->RecvFrom(&data.GetData()[0], MTU_SIZE, read, *MatchMakerAddress.Get(), ESocketReceiveFlags::None);
hold up
replacing the if w/ the while as you suggested fixed it
thank you!
Alright
Sockets suck, I gave up on them a decade ago after doing too much of that kind of debugging
suckets
uint32 expected = 0;
while (Socket->HasPendingData(expected))
{
Socket->RecvFrom(&data.GetData()[0], MTU_SIZE, read, *MatchMakerAddress.Get(), ESocketReceiveFlags::None);```
HTTP + JSON is my goto "easily talk to a random server that's 10 lines of Python"
this is for a nat punchthrough server/client type of deal hence the use of udp
and now it works perfectly, time to turn the threads back on
Cool
now to get flatbuffers to work
Anyone know how to fix "Failed to create session" when starting multiplayer game? I have online subsystem enabled, steam subsystem enabled, maps added in packaged maps list
Ah there was a map I missed, nevermind
Noob question. if i have a map that's configured to, say, "Player State Lobby", and it's a CHILD of "Player State Base", can i still access variables and such from "Player state base" since it's the parent? or am i strictly stuck with what's only in "Player state Lobby"?
https://www.youtube.com/watch?v=09yWANtKmC8
after i watched this, i got a new idea about my 1000 players in one map replication.
Can we seperate players to channel? Like you did realize every MMORPG games have a Channels in a map. If one channel reached to 75 or 100(sample) then they loggin to channel 2 or more.
Then servers replicates 75 times instead 1000 times for 1000 players.
Can someone help me for tips how i can seperate players to channels in one map?
Making session or what?
Creating a networked multiplayer game isn't easy, but Unreal Engine's gameplay framework is designed to set you up for success. On this episode of Inside Unreal, Technical Writer Michael Prinke will cover fundamentals such as the server-client model, various features of replic...
run separate servers (by using load balancing in cloud) and route new players to 2nd, 3rd servers
so chat system is will running seperately thread. so they can pm or talk in the same world
players between servers won't see each other, for the better
mean make execute dedicated server seperately ?
yes
then its makes more ports for connecting
you can open many ports on a fw no big deal
as i saw (referring BNS) that using only one ip and port, they looks like changing session for channel in same server executes. Cant we do ?
they probably have a load balancer that will route your network to a server behind the curtain
hence you have one ip:port for accessing but internally it's been rerouted perhaps
Or they have an entierly custom server logic that has yet been documented :)
But it's not really an issue operating many ports and many addresses for a game
Sessions can explain the client where to join
i thought that sessions creating a game instance in same server executes
well
Thank you man
1000 players in one map
unholy
probably the actors should idle a lot, so others can tick. that way you can turn a 30fps server to a 3fps, hosting 10 times as many players.
not even small π my goal is 10k or more players
why not 100k i say
ehh because need more adversite for 100k players playing at same time
so not possible yet
you're a nobody under 1M is what I say.
why you gotta put me down like that
1m peek or 1m sustained?
BOTH!
hard bargain
<insert more annoying smiley>
would mean that i could reach LOL game Concurrent users 
well with load balancing there no problems for limitations
gj epic
and robert ofc
wish you luck to get 10k players to play the game let alone connect π Very hard out there. and i am not being sarcastic or rude. Just wish you the best of luck.
Very hard for indie developers unless you have done something no one has seen, and even that is hard :/
oh mean advertising
ehh i already have 2k players atm without releasing so, if i could more ads and event for more players, and streamer youtuber etc... why not?
never said you couldn't, just said its really hard
imo my game not looks like indie game if you look at from outside
yeah in reality its very hard, but if you dont give up, you can do it.
10k players can potentially result in outputing 750.000 player data over the network. Depending on the tick rate it will generate pretty high output. Just wondering if load balancing is enough or better think about other packet distribution models.
yeah before taking a professional developer, i should use smooth sync for decrease bandwidth instead CMC replication. (1x send rate per frame) after selling that game. if i get rich, then i can make my team for developing and optimize more on this game with custom socket distributions
even max freq is 10x send rate for all actors in game so
there last status optimization for networking in game match. still trying to do reduce
yikes
[HELP] old guy with simple problem yet it eludes me. [blueprints] I want to set a bool variable to true if the player is the host in a session. I can screen share and show what I have. Its got to be a simple issue but its making me angry.
why? you can just call IsServer from almost anywhere
trying that as you typed that lol
its part of a way the host can promote clients to "moderator" status
Anybody have success passing the IP address command line argument to a packaged game executable?
I have a separate launcher/matchmaking application and I would like to have the unreal executable connect to the specific ip/game server that is provided in the command line arguments
however, I can't get it to respond to any command line arguments at all, even just providing a different default map file
@raw quarry for shipping games you have to enable custom maps from the cmd line first // HORU: macro: allow specifying custom map in Shipping builds GlobalDefinitions.Add("UE_ALLOW_MAP_OVERRIDE_IN_SHIPPING=1");
put this in your target.cs
ah, thanks I appreciate it
hi. given the assumption I want to make a first person game that has following details.
- a big map 10 times bigger than PUBG.
- the only continuously replicating actors are players default ACharacter. they just move in the world.
- for each client there are nearly 50 loot actors. (items on the ground)
- all loot actors are replicated to all clients but their NetUpdateFrequncy is 0.5
so the question is how many client a dedicated server can handle ?
and whats the limits ? I am concerned about both CPU performance and bandwidth
π€
Iβm confused on UE4βs networking implementation. When you run an event on the server such as OnDamage, does the client have access to the logic that is occurring in that event.
@rose egret Its highly ambitious requirement.
You need all the possible combinations to optimise your game like Replication graph, NetDormancy and hopefully Network Prediction(yet to be announced officially).
π€
UE4's dedicated server will accept any number of connections.
If you have money you can get a high end CPU with 96 cores and 100GB+ RAM.
What do you want is up to you?
as far as I know UE4 server is single thread so 96 cores cant help
I didn't know that.
@rose egret even though it is single threaded you could create your own thread to do heavy calculation and broadcast result in game threqd
You can offload tasks into worker threads
@rich ridge I know that but I have no heavy task. its all engines default stuff. I think I have to do a test. though I don't know how many PC my manager could provide for me .
@rose egret I don't think your manager will provide you 100+ Desktops.
Using editor your could launch as many clients you want.
@rose egret this might help https://docs.unrealengine.com/en-US/Programming/Automation/Gauntlet/index.html
A framework to run sessions of projects in Unreal Engine that perform tests and validate results.
What would be the most optimal way for (none ticking) items to be spawned without any delay, but also as efficiently as possible. Currently the items we have in our game are replicated, but with a net update frequency of 1. Setting the update frequency to 0 does not spawn the items at all. Now I've been wondering if there is a way to force the creation / spawning of the items, but other than that NOT have the item do any further replication, except for it's destroy event. So meaning, that I want the spawned items to do no replication at all, except for their creation and destruction. But it seems that to achieve this there always needs to be a decent amount of update frequency (10 usually works well), but this means that thousands of spawned items are considered for replication 10 times per second per item (10 x 1000 items for example results in 10 000 replication considerations per second which are completely useless as the items do not need to send any replication data while being alive). It's hard to believe there is no better way of achieving this? There must be a way to force update the creation and destruction, but have replication per second disabled, right?
hello, I'm trying to call the SteamWebAPI AddItem function. can you help?
https://partner.steamgames.com/doc/webapi/IInventoryService
The problem with the current setting of 1 (or lower than 10) is that when the item is spawned it usually takes a few seconds before the item is replicated to all clients which is not what we want. I've also tried force net update on beginplay (on the server) thinking that this would force the item to be replicated as soon as it's created on the server, but this doesn't seem to work. My guess is that force net update only forces the replication of all replicated actor attributes, but ironically not the most important aspect which is it's creation and destruction..
Yes it should be never
And when you met a condition where is should replicate then set it awake and after that your need to call one function to make it replicate
force net update right?
Yes
sorry my keyboard suddenly went into azerty mode haha
This should solve your problem
Yeah I already use that function after I change a replicated property π
But you are not setting the Dormancy right?
Does this mean I still have to do a force net update on beginplay on the server?
The dormancy was set to awake by default
I never change that in code, no
I set it to never, which seems to be none
Good to know.
void ACPP_DesertPlayerController::AddSteamItem(FString WebAPIKey, int32 AppID, TArray<FSteamInventoryItemDef> ItemDefID, FString ItemPropsJSON, FString SteamID, bool bNotify, FString RequestID)
{
FString SteamCall;
SteamCall += FString("key=") + WebAPIKey;
SteamCall += FString("&input_json={\"appid\":") + FString("\"") + LexToString(AppID) + FString("\"");
for (int i = 0; i < ItemDefID.Num(); i++)
{
SteamCall += FString::Printf(TEXT(",\"itemdefid[%d]\":"), i) + FString("\"") + LexToString(ItemDefID[i].Value) + FString("\"");
}
SteamCall += FString(",\"itempropsjson\":") + FString("\"") + ItemPropsJSON + FString("\"");
SteamCall += FString(",\"steamid\":") + FString("\"") + LexToString(SteamID) + FString("\"");
SteamCall += FString(",\"notify\":") + FString("\"") + LexToString(bNotify) + FString("\"");
SteamCall += FString(",\"requestid\":") + FString("\"") + RequestID + FString("\"");
SteamCall += FString("}");
FHttpModule* Http;
Http = &FHttpModule::Get();
TSharedRef<IHttpRequest> Request = Http->CreateRequest();
//Request->OnProcessRequestComplete().BindUObject(this, &AHttpActor::OnResponseReceived);
FString Host = TEXT("https://partner.steam-api.com");
Request->SetVerb("GET");
Request->SetURL(Host / TEXT("IInventoryService") / TEXT("AddItem") / TEXT("v1") / TEXT("?") + SteamCall);
Request->ProcessRequest();
}``` Am I performing the function correctly?
@gritty pelican you can use the SteamCore::Web plugin to deal with SteamWebAPI, https://www.unrealengine.com/marketplace/en-US/product/01ba1b26572b4c67a34af72a3993ecf2
@rose egret You will want to use Push Networking once it comes out (Might be with 4.25?). This will help you decrease CPU load for higher amounts of replicated properties & objects. Without it the server will be constantly checking if a property has changed which will add an increasing amount of cpu load per replicated property.
https://github.com/EpicGames/UnrealEngine/commit/3b3eb87e75b8b6cfd59b26a33ac45b0b44c85989
Thank you, I will watch it if I canβt do it myself
@random sundial Do you have any link where I can find some more info on that upcoming function?
Seems very interesting
@void nest So far there are only the commits from what I have seen, may be more out once it releases.
The basics of it seem to be that you enable it in your engine build target (you do need to build the engine from source to enable it though) then everytime you modify a property you mark it dirty with MARK_PROPERTY_DIRTY() a bit like Fast Array Serialization.
Ok, but judging from the description of the function it seems to force a global push of all replication marked variables and objects? So I take it this includes actors that are created on the server and added to the list for replication. If an actor's update frequency is for example low which would normally mean it's existence could potentially take a bit of time to be pushed trough to clients, a function that globally forces an update could be helpful, but not sure if this is what the function does. I'll have a look anyway, thanks. π
If you enable push networking the engine won't check if properties have changed as it does now. So you need to manually tell the engine that something has changed.
Actually that may be the wrong macro. I gotta find the other commits related to push networking
Hey guys, has anyone worked with any flocking behaviour systems on multiplayer? I found a lovely asset but it's not MP supported: https://www.unrealengine.com/marketplace/en-US/product/flocking-behaviour-system-ideal-for-simulation-of-birds-fish-bees-and-more/
I figured it's maybe because it takes up too much bandwidth to replicate this sort of stuff?
@random sundial The push model is only to reduce to overhead of variable replication.
It should not be used for deciding when to or not to replicate
The idea behind push model is that when a variable or attribute is actually changed then only replicate
I didn't state that it decided when to replicate did I?
My bad, sorry.
No worries. π
push model can certainly be used to decide when to replicate
i.e. an object with no changes whatsoever makes no sense to process at all
(only works when all properties are using push model)
The point of push model is that you do decide when to replicate something. It still follows the normal replication rules, I.e. it won't replicate unless it has changed.
Just means the engine isn't checking for changed properties on it's own, you have to tell it.
Only useful for reducing CPU cost for property comparisons on the server. No other benefit really.
Doubt most of us would get any measurable benefit from it unless you're making a large-scale online game.
@chrome bay and @fleet raven then what is use of Dormancy.
how does dormancy fits into Push Model.
Is dormancy getting deprecated, I guess no?
I'm gonna have a measurable benefit because I need to replicate an actor with a few thousand sub objects that rarely change
so I'm gonna use push model to ignore all the unchanged ones
Dormancy is different, dormancy kills the entire actor channel after a while.
ye it can't be used on a finer level
yeah different tools really
what causes client/server mismatch
we have the same binaries
and same BP's
only happens if one uses source engine over launcher engine
afaict
Hey, will calling OpenLevel create a new Session and delete the existing one if the server has seamless travel off?
This code works. To issue items in the Steam.
.h
UFUNCTION(BlueprintCallable, Category = "STEAMWORKS")
void AddSteamItem(FString WebAPIKey, FString AppID, int32 AddedSteamItemID, FString SteamID, bool bNotify, FString RequestID);
virtual void OnRequestFinish(FHttpRequestPtr HttpRequest, FHttpResponsePtr HttpResponse, bool bSucceeded);
.cpp
void ACPP_DesertPlayerController::AddSteamItem(FString WebAPIKey, FString AppID, int32 AddedSteamItemID, FString SteamID, bool bNotify, FString RequestID)
{
FString Host = TEXT("https://partner.steam-api.com/IInventoryService/AddItem/v1/");
FString ItemDef = "itemdefid[0]=" + FString::FromInt(AddedSteamItemID);
FString FinallCall = Host + "?key=" + WebAPIKey + "&" + ItemDef + "&appid=" + AppID + "&steamid=" + SteamID + "¬ify=" + (bNotify ? "1" : "0") + "&requestid=" + RequestID;
TSharedRef<IHttpRequest> Request = Http->CreateRequest();
Request->OnProcessRequestComplete().BindUObject(this, &ACPP_DesertPlayerController::OnRequestFinish);
Request->SetVerb("POST");
Request->SetURL(FinallCall);
Request->ProcessRequest();
GEngine->AddOnScreenDebugMessage(-1, 15.0f, FColor::Red, FinallCall);
}
void ACPP_DesertPlayerController::OnRequestFinish(FHttpRequestPtr HttpRequest, FHttpResponsePtr HttpResponse, bool bSucceeded)
{
if (bSucceeded)
{
GEngine->AddOnScreenDebugMessage(-1, 15.0f, FColor::Red, HttpResponse->GetContentAsString());
GEngine->AddOnScreenDebugMessage(-1, 1.f, FColor::Green, FString::Printf(TEXT("SUCCESS REQUEST")));
}
if (!bSucceeded)
{
GEngine->AddOnScreenDebugMessage(-1, 15.0f, FColor::Red, HttpResponse->GetContentAsString());
GEngine->AddOnScreenDebugMessage(-1, 1.f, FColor::Red, FString::Printf(TEXT("ERROR REQUEST")));
}
}```
for use http read this post
https://wiki.unrealengine.com/UE4.10_How_To_Make_HTTP_GET_Request_in_C%2B%2B
I don't suppose anybody has experience with packet-spoofing do they? Is there a tool out there I can use to modify packets I'm sending to a Server? Note this is for testing anti-cheat code ofc not creating it... if anybody has any tools they know of can they DM me π
The easiest would be to implement your own cheats in the game code
Assuming the client can freely change anything on the client-side is the safest course anyway
Cheating has become rampant in today's online multiplayer gameplay. Drawing from decades of experience, the talk examines the impact of cheating and suggests both technical and community based strategies to stay in control.
Presented by Simon Allaeys and Aarni Rautava from Ea...
It's just to test a _validate function really
@jolly siren Did you solve your actor replication on replay issue?
Yes I did, I was destroying certain actors after scrubbing to avoid actor spam, but I resolved all that.
You were doing that manually? The code I thought did that on its own
Yes I was. It does but I was ending up with a bunch of floating gun pickups for example. Because they use physics to fall to the ground. But when scrubbing they were missing that and leaving me with floating pickups. I could have resimulated physics but that still doesn't look great.
So when you would scrub, DemoNetdriver would destroy them, respawn them but not properly assign physics?
So you just opted to destroy them for good.
@chrome bay it is a fairly good talk
Yeah, unless you scrubbed before they were dropped
And yes I was destroying them which was breaking my equipping logic. Now I'm hiding them instead shortly after scrubbing.
I think there may be another two solutions to your problem if you wanted to keep them visible. As I had a similar issue and submitted a bug fix for it, but while I submitted I put a TODO: part which was to include other edge cases such as that
i do that for all actors that have to do something on being destroyed
hide, setlifespan
When the DemoNetDriver respawns the objects, it fails to look at the settings for the rootcomponent as it exists at that time in the recording.
My fix creates a Rootcomponent template
and you can properly reapply on spawn the settings but I only did what I needed, Mobility
Simulate physics could easily be added now
Very interesting, yeah scrubbing causes loads of issues π
I was trying to make it even more robust as I bet all components not just the root would suffer from this
@winged badger just watching now π definitely useful.
but the root is a good place to start as most problems probably would happen there as is the case of Physics and Mobility
I'm assuming @jolly siren that the default class settings for your root component is having the Physics not simulated?
and you turn it on at runtime?
Developing on the Oculus Quest and running into some database issues. Went to try firebase but it needs google play services so it will not work in the quest, is there a current consensus on getting the quest pinging databases correctly? Are people just writing their own apis?
if an RPC is set as not reliable, what determines if the RPC is dropped?
is there some general congestion metric it has internally to decide based on the priority value?
packet loss, available bandwidth etc.
ok
there are some cosmetic things im doing as rpcs, because i cant find another way right now... obviously i dont want them 'reliable'
basically a way to tell all clients that 'this actor should have this position of these child parts'
i would just replicate the components, but they rotate at speed, so this would be a Bad Thing (tm)
The engine itself doesn't detect any traffic congestion or dynamic traffic control.
Well components replicate their attach parent if they are indeed replicated.
hmm
well, i just learned something new
if i have a blueprint variable set to rep notify, im getting notifies about it every tick, even when the value doesnt differ from the one before
i thought it only notified on change of value? seems not, it notifies whenever its been set, even if its set to whatever it was already. as i was using it on an axis variable from an input, it would flood the pipe
so ive added some extra logic before setting it, to not set it if the value hasnt changed
@bronze arch you also having issues with Replay ? IDK why they picked 4.26 maybe give people time to vote on it?
If it doesn't get enough votes do they just ignore it?
Rep notify will be called if the received value is different to the local value.
blueprints have their own ideas for OnRep
and its definitely not a replication callback
it just kinda doubles as one
having my own check before attempting to update the replicated variable does work
also it seems that replication will only work in some cases from the authority
e.g. the server
thats expected, yes?
its basically one way, if i want to update and replicate a variable i have to make an event with 'executes on server' set, and change the replicated value there
or it already be executing server side
yeah
yeah, makes sense then, wouldnt want the clients poking those values without authorisation
If a client wants to change something, they need to call and RPC
I mean there's nothing stopping them setting the values locally if they want to, but that change will only occur for them
Hi guys! I'm trying to use UCharacterMovementComponent::ApplyRootMotionSource manually (without the GAS plugin) and I can't make it work. It's documented that it should be called from the autonomous proxy for it to work. But the server is always applying a strong correction that won't let my character move an inch. The method is supposed to create a saved move that the server will process. Has anyone had luck using this method manually?
@lament cloak huuge thanks for the help, I've made a lot of progress with ur help, I can now get in and out of tanks and I'm moving forward with my mobile game
Also this is the last day I can flex that I'm only 16:D
thanks
in advance:D
damn
u old:D
20 is old now, damn
wdym im 22 im grandpa
when i was 16 people who are currently 16 weren't even sperms yet 
you guys seen/use this?
not the same as steam sockets in stock ue4, but very similar
what exactly is it for?/ dont we already have a system for that in ue4?
It's basically what UE4 implements
hey y'all im having some trouble with multiplayer in blueprints if anyone can help. I got movement working, but when i reparented my gamemode to inherit from Game Mode instead of Game Mode Base, the movement no longer works.
@timid moss you could call it a UDP transport layer I guess
doesn't do serialization but I'm planning to use flatbuffers for that
has some code to do w/ protobuffers but I'm still just learning about it
probably as an extra
@bitter oriole doesn't ue4's net layer assume a strict server-client model?
stuff below is FSocket isn't it?
FSocket has nothing to do with client server stuff
It's just a socket
FSocket is UE4's base socket class for TCP-style or UDP-style messaging over UDP
yes
Nevermind, FSocket actually is either TCP or UDP
I would look at UChannel for the higher level stuff
I've taken some cursory glances at IpNetDriver and it seems to be tied to UNetConnection and that to DataChannel etc. which is operating on replicated properties of actors, it seems
so what I'm getting at is I can't seem to find an injection point where I could take ue4's network transport layer and use it for my needs
What are those needs, really ? At this point it might be relevant to know π
Lockstep and P2P are two very different things
yes
lockstep p2p
no central server
only for nat punchthrough and basic matchmaking
but after players have been connected together the server's out
I trust the choice of P2P is to handle a player quitting ?
p2p is so that I don't have to pay for lots of servers
Listen server works for that purpose just as well
For the record I always advise against dedis π
But listen servers go a long way
Technically yes, the server has authority, but you also said lockstep, in which case the server can simply act as a data relay
(which does include some cheating options for him)
sure but then everything is going to the server first which then relays it onto clients
sure, didn't say that it didn't
so I'm wondering if there's a layer in the ue4 network stack that I could use only for sending/receiving data
Basically the only drawbacks from listen servers would be
- terrible at handling a disconnection from the host, though in a lockstep RTS any other player could become host rather more easily than for a shooter
- technically twice the latency, but it's lockstep so...
then there's cheating
which at this stage in my unreleased pre-pre-alpha of a game is not important
adtmittedly
and yes, latency is important
anyway - I get where you're coming from and appreciate the advice, but I'm set on moving forward with a p2p network model
if I can repurpose ue4 netcode to my needs perfect, but if not then I'll use something like valve's net transport lib
Other than FSocket, I don't think you'll reuse much
cool, appreciate the insight
hey guys
so i am getting duplicated copies of a replicated actor on client but not on server, it this correct
if yes then is there a way to remove them
or in your case, server spawns, client gets a copy, client spawns and then there were two
Right if you spawn on everyone the you would get that result πͺ
Hey I have trouble replicating door collisions.
Instead of using ReplicatedMovement, I have a float of "amount open" that is replicated and I rotate the door on server and client by this float.
In the end server and client have the door mesh in the same position
Server can move through normally
Client get's stuck in the doorframe as if the doormesh is still closed, but then moves trough, since he moves normally on the server.
It seem like client caches the collision and when I move the door mesh on client, it moves the mesh, but not the collision.
Is there a way to tell the client to not cache this collision and act as if client mesh is the authority or something? It will always be same on server and client, so I just need to disable this behaviour
@thin stratus yep that was it
@still wing You could enable collision to draw
Not sure what the console command was
show COLLISION maybe?
Hi ! I am having some weird issue, the GameMode spawn the character, give it to the controller, and WTF he unposses it ? No code call unpossess stuff =/
Here is the server side stuff
Well, what does the player unpossess ?
the PB_Player
The server travel, he spawn the BP_Player, use the new controller for possessing the pawn and magically unpossess it ...
@chilly mason Did you make any progress on P2P via manually manipulating UE4's network stack?
Unless he discussed it further after we did, I think the end of the discussion was that UE4 has a general-purpose socket class, and then the Actor channel class above that, which already assumes a server.
His choice was going to Steam's network library, which is probably the best choice he could make
Yea that makes sense
Would you need to implement that functionality into the engine source do you think?
Or could you build it as a plugin
It doesn't have to be in the engine source, since P2P is fundamentally incompatible with UE4 multiplayer. Just ignore all of UE4's multiplayer entirely and do your own
Yea
No replication, RPC, nothing like that - just use SteamLibrarySendData or something
Since the goal is a fully lockstep game, it makes a lot of sense
ah that makes sense
would it be possible to create a custom actor that derived from actor with custom replication through SteamLibrarySendData
UE4's replication system is fundamentally incompatible with P2P
Using Steam sockets is a different issue
So, depends what you ask
Not for P2P, For listen server but just manually rather than through UE4's system
As far as I understand, UE4 does use Steam networking by default when you use the Steam OSS.
So that's not the issue
You sure?
Well, what does bUseSteamNetworking control ?
Didn't they look for someone to make a plugin for this a few months ago?
I thought it still uses UE4's default networking, Just means it uses Steamworks api
By default when using Steam, you're going to be using FSocketSteam sockets
ah ok
Ah yeah, they also have a different netDriver.
FSocketSteam::SendTo calls SteamNetworkingPtr->SendP2PPacket, for example
Oh ok
huh.
And yes you can fall back to the default UE4 sockets.
You'll probably lose NAT punch
Not sure about that
i'm also not sure whether you can use Steam OSS without the Steam net driver
Cedric might know
I just want to remove the Variable tickrate really more than anything
50% sure you can as you can decide that in the config (using net driver or not)
What is relying on it though?
@fossil veldt What do you mean with variable tickrate ?
Is this going into the direction of RTS stuff?
UE4's Server Tickrate by default is synced to frame tickrate of the Game
Yeah, that's by design
Yeah I find it so hard to work with
I would much rather it just be independent like the physics tick
Usually people start asking about this stuff if they are making an RTS :D
Right, well not sure you can get away from this. You can change it for Dedi Server but that much you probably know.
But the lack of control over the tick rate in UE4 winds me up the bend
How in hell would you do it differently, though ?
Tick rate is a performance thing
It's not a design thing
It would need to run on a different thread or not?
Doesn't make sense
That sounds like a hell to manage if at all
Even if you get the network stuff on a fixed update rate, the game can't process them if it lags :D
So you are basically not much further.
If your game runs at 30fps, it's just not possible to have 60 tick rate, thread or not
Yea but essentially the send rate of the client with variable tick rate always depends on their frames
The send rate depends on the actual rate at which the gameplay state is changed
That's pretty universal
You can't change the game state without running the entire game
You can't update the network data if the data hasn't changed
If a client is unable to run the game above 30fps, no tech on Earth will give you tick rate above 30
Tick rate is the rate at which the game state is updated
The actual network update rate might be lower, but it can't be faster because it makes no sense at all except for wasting bandwidth
Yeah
If you want say 60 tick rate for your game all the time, get a dedicated server, ensure the performance is strong enough for 80fps, set framerate smoothing to 60 and you're good
Problem is that I have, If someone is peeking around a corner, you want that to always happen at the same rate
Then your game requires dedicated servers, there is no alternative
Yea but wouldn't the client send rate still be variable?
LIke if a client is running on their potato PC at 10 FPS
Of course, but that's unrelated to the server tick rate
Servers need to smooth the client's incoming data
Here is what you need to understand : if the client runs at 10fps, you will never have more than 10 new data points per second. Whether it's the movement, aim, firing inputs.
Since no more data exists, there is no more data to send
You could make a thread running at 60fps that sends new data, sure, but what would it send other than 6 times the same old location, aim and firing input ?
Total waste of bandwidth
Well the Physics thread is detached from the Game Thread isn't it?
So for things like movement you would be able to send that data
independently of the game thread
Physics, sure - but that's not what's relevant to send
What's relevant is the player's inputs
And that is very much tied to the framerate
Yea that makes sense
So what's the best way to be updating things like the player movement
Say for example I have "ServerMove"
as a function
Should I be calling that OnTick
Your player needs to send movement updates to the server that tell the server which inputs were changed over how long since the last update
Yea so you'd send the updates and a server time
The server might run at 60fps, the client at 75fps or 43fps - so it has to simulate the player's inputs locally over a period of time, merging or splitting the player input data
But I can never work out how you are meant to send the updates as I feel like I never know if I update the positions via an RPC if THAT frame a packet will actually be sent
as it's all abstracted
Or if it just throws it into a buffer
and sends it as and when
All sent at the end of the frame
Basically here is how your server tick rate works : if you have a server tick that's 16ms of delta time and you have two 10ms player input - you simulate the first one entirely, have 6ms left for a 10ms update, so you simulate these inputs for 6ms, and store the packet with a 4ms duration for the next frame
Probably with a delay, and some dynamic time stretching
And no, if you have variable frame time for gameplay as UE4 does, there really is no other option
Feel free to not use Blueprint or any game thread code, use UE4 for rendering only, and then build your own network stack + fixed-time gampelay updates
If you're doing a shooter, the stuff I describe is very much the normal
Yeah that makes sense, I don't wanna use Blueprint for any networking tbh, I find it to be inconsistent
Would you just have an Actor deriving from AInfo for the network stack then?
That controls the entire sending / receiving for each client
You keep thinking this is a network problem, but it's really not
Sending and receiving is not your issue here
Your issue is how to simulate client inputs that were created at 10fps
On a server that runs at 60fps
This isn't a network or a tech problem, it's a math problem
Yea
Feel free to not use Blueprint or any game thread code, use UE4 for rendering only, and then build your own network stack + fixed-time gampelay updates
@bitter oriole
What did you mean by the network stack
Just manually have 1 class for the RPC sending?
No, I meant ignoring UE4 multiplayer entirely
Oh right
For the record, here is how my listen server simulates remote inputs with variable framerate
It's quite simple overall
Ah ok
The server here simulates the gameplay at his own tick rate, without losing accuracy if the client is faster, and without hiccups if the client is slower
That's awesome, Thanks for that
The UE4 character does a lot more than this
Yeah, for a custom pawn you need your rollback/replay/smooth correction mechanism for the AutonomousProxy role, a smoothing mechanism for Authority, and (easiest part) an interpolating mechanism for Simulated
Also some large amount of determinism, though that's a lost cause
Does anyone know if there are any CMC properties I can change to make character location more in sync between the server and client? Players look like they are shooting next to the enemy and getting hit markers in spectator because we use clientside hit detection.
More in sync?
They will always be async due to ping.
The only thing you can do to get them "more" in sync is by reducing the error tolerance if that's what you mean
@jolly siren
yeah, I know ping will always cause them to be out of sync. Was just hoping to tighten it up more
Not sure what else I can do to improve spectating
For example, look how far he is shooting from the player and hitting in this case
https://clips.twitch.tv/PopularSmoothKathyTheRinger
@jolly siren PUBG has this problem also, I think the best way to fix this is to just stream a replay instead
Caused by lag comp. Not much you can do really
that way you're slightly behind the live gameplay but you have the exact server approximation of what happened
Shooter always sees the person they're shooting at back in time by both their ping and the victims ping combined.
Overview of the Replay system for recording and playback of gameplay
Overview of the Replay system for recording and playback of gameplay
Right, yeah was just hoping to tighten up
ah fair enough
Stream a replay as in via http streamer? This still won't be able to reproduce what each client sees tho correct?
Right, so that doesn't help either
@thin stratus Did you have a specific property in mind by "error tolerance"?
And the shooter will still lag behind
@chrome bay Surely it won't lag behind? Because it's directly the server's view of it
I figured the lag was due to the ping of receiving the packets from the server
It is - but the victim still has to send their movement to the server first
ah
And the shooter will be receiving those updates back in time, so they'll be shooting at the target back in time as far as the server is concerned
Couldn't the peer send a replay via http instead?
Not really, they may not have the full view of the game - plus how do you decide which peers view to show
If you're spectating like he was in the vod then surely you only need what that specific peer can see
you decide based on which client you spectate
So if you spectate player5 for example
player5 streams you the replay
Right, the POV you are currently watching is the peer we want at that time
Could do that yeah, and all you'd have to do, in theory, is "rewind" the victims transform a bit further based on the shooters' ping time
yeah
You would then see the victim "relatively" close to where the shooter saw them
And then if you wanted a "freecam" spectate which I assume you do
then just use the local gamestate instead
yeah we have a freecam, it works fine. Just trying to improve first person
As that looks like a pretty extreme case
@chrome bay Nah, It happens lots in PUBG
Doesn't surprise me.. but yeah seems like a bit of a paradox to solve to me
Looks nearly an indentical problem
@jolly siren Eh, yeah, lemme check
Why would I need to rewind transforms if I'm streaming the focused players replay?
@jolly siren Maybe take a look at how games in UE4 handle killcams
Should imagine it's the same principle
bool AGameNetworkManager::ExceedsAllowablePositionError(FVector LocDiff) const
{
return (LocDiff | LocDiff) > GetDefault<AGameNetworkManager>(GetClass())->MAXPOSITIONERRORSQUARED;
}
@jolly siren That MAXPOSITION thingy, can be changed via config
This would cause more corrections though if you make it smaller
okay yeah we currently have that set to MAXPOSITIONERRORSQUARED=1600
I'm becoming convinced I'm an idiot but how do I test different server tick rates when playing in editor?
if i want to load a savegame on the server and have it spawn an actor. where would you put the load function so that any spawning or modifying of actors is replicated to all of the clients
i would put it all on the pc but a dedicated server doesn't get a pc
@fossil veldt I've looked at the steam socket github impl some more and have decided against them - they're hardcoded against protobuffers which is not what I'm looking to use
You checked out RakNet?
right now I have a rudimentary implementation working based off of UE4's FSocket s and something called reliable.io
might be a good option
Are you just completely ignoring UE4's existing system then?
And just manually connecting the clients?
I'm only using FSocket, yes
Ah interesting
yeah so I've checked raknet out, briefly, along w/ others of its ilk like enet but I came to the conclusion that they're either not actively developed and/or ancient
which is fine in terms of maturity but not so great wrt performance
Aye, It's a shame FB bought raknet and then bailed on it
yes
building a system off of smaller independent components like reliable.io is how I'm approaching this
preferring single header libs over larger frameworks
yah fair
also the github steam sockets code doesn't include some of valve's proprietary tech and I'm guessing (maybe incorrectly) that it might be some of the good stuff that they're leaving out
aye
It's a shame, There used to be a P2P Support card on the UE4 Trello
I dunno if they just binned it
or it's still on the roadmap
also if you look at https://docs.unrealengine.com/en-US/Gameplay/Networking/HowTo/SteamSockets/index.html there's a version tag of 4.24 but UE4 seems to support steam net code now
How to enable the Steam network protocol layer for Unreal 4 projects.
from 4.24 on I guess?
+NetDriverDefinitions=(DefName="GameNetDriver",DriverClassName="/Script/SteamSockets.SteamSocketsNetDriver",DriverClassNameFallback="/Script/SteamSockets.SteamNetSocketsNetDriver")
oo dang
without having looked at it much, to me this implies that they're using the underlying steam sockets
that comes w/ valve's nat punchthrough and optional relay for synchronous nats (which is great)
but that's just my assumption so you'd have to check it out
Yea that's ace, I used to use a plugin called UWorks for that but the author scrapped the NAT punchthrough
was gutted
Gonna check that out
tbh nat punchthrough is a dirt simple thing to do
took me half a day but I've not used sockets in like 15 years :)
so someone w/ more brains can probably do it in a couple hours
From what I've heard it was a pain in the ass to maintain with UE4 due to OSS
oss?
online subsystem
ah
epic apparently makes changes to it a fair bit
and it likes to break lots of things
yeah I was referring to the actual client/server logic
Yea
so i have my game world generating a bunch of bushes
and when a player harvests them i want them to delete
but replicating that is being tough. i imagine it's because the players dont have authority over stuff generated by the game world.
is there a common solution to this?
from what i understand, from the playercontroller you would send a server RPC to let the server know that you want to harvest a bush. The server then will delete this bush, and that will get replicated back down to the client
thanks you'd think i'd understand that by now but hearing someone say it again was enough for me to find the problem lmao
@proper ravine this is the note I keep for myself at work. I have the same issue all the time
you should upgrade then: "if replication doesn't work client to client press this button", button gives you a nice jolt, then gives you the rest of the message
reinforced learning π
lol well at least at this point I see the note and remember the fix. I don't have to go look it up
anyone had weird issues with Net relevancy not updating actors X distance away from host?
can you elaborate?
if i want to pass a pair of arbitrary FString values to the server, for the server to place into my character as its spawning it, whats the best way to do that please?
from a client
i was thinking i could do something with the open map args
am i best to set the values after spawning, and use an rpc?
controller can send that up, if it's a respawn
otherwise, yeah option string on the travel URL
Does anybody know if its possible to disable "ack" packets from clients for specific values being replicated?
currently in a 10 players game we send an ack back to the server every single time we recieve a position update for another player, which we just don't really need to do.
These ack's are quite a large overhead on bandwidth so if possible i'd like to just disable them for position updates of other uses on the client
these ack's alone are 3.2kb/s of bandwidth which is absurd
these acks might be part of ue4's "replicated variables are always up to date" design?
maybe you can transition to unreliable rpc's but i dont know if they are lighter
i suppose the question is, how do you make "unreliable" replicated variables ?
yeah i suppose that's the better question
so what i ended up doing... is storing what i needed in the game instance
as it turned out there was a lot more than one or two values i needed
game instance as far as im aware only exists on clients, so i can stash it there, and have a combination of transient data, and non-transient saved data stored to an ini file. when i want to use it, i get the game instance and pass it to the server via an RPC marked "reliable, run on server". that way only the server sees it.
the character looks for those values directly in the game instance in begin play
@wise depot not overly familiar w/ ue4 replication but you could just write a getter/setter function pair for your variable and have that rpc unreliably
or something like an UpdatePosition() function, yeah no need for getters and setters here
When I last used unreal years ago, world origin rebasing only worked in singleplayer. I hear this is possible in multiplayer too now with the "stock" networking code.
Does this mean multiplayer maps no longer have a size limit?
Already posted this in #blueprint but was referred here
I have it setup so that when I aim, the max walk speed of the character is lowered, and then raised again when the aiming stops.
However, on the client, the movement becomes jittery and laggy when I aim
And I dont think it actually decreases speed
I know it has something to do with replication
But I'm not sure how to put it into practise
How can i tell which server to join to with advanced sessions? I'm trying to get it working on a dedicated server but it is creating 3 sessions and only one of them is valid. The session ids are just random numbers so i dont know what to do
You shouldn't have 3 sessions for one server.
if i want to store an encrypted password client side, which represents the players user account on a system, whats the easiest way to encrypt that value so that its not just plaintext in an ini file with ue4?
i do fully understand that no encryption i apply there is secure, and is just to prevent casual viewing by opening a file in notepad
so in theory i could probably just base64 it. but, better options would of course be a better option
should i use something like this https://kelheor.space/2018/11/12/how-to-encrypt-data-with-aes-256-in-ue4/ or isnt it worth the effort?
ive decided i'll just use that, with a key determined from the user's pc details.
with an aim to moving from an encrypted password to an encrypted ticket
y store password at all
Just put it in a file with no extension
If it's something the client shouldn't know, it shouldn't be on the client
The design here is likely bad
Anyone have experience integrating Discord SDK? Are there any plugins for Blueprints?
@fleet raven I could also store a session key. It still has implications that if compromised someone can play the game with it as that player, it just means that they can't use it to get into other services because near everyone uses the same password for everything when they shouldn't
if someone manages to steal your session key you have bigger problems
you know, like them apparently being able to access random files on your pc
The bigger question is why you'd be afraid of the player knowing the key
anything that happens on the players computer should be considered impossible to hide or protect in a sense. multiplayer must be designed around this.
I assume the concern is about people besides the player accessing it
though i dont know why a unique identifier should be kept from the player
The bigger question is why you'd be afraid of the player knowing the key
@bitter oriole I'm not, it is a case of not being low hanging fruit. Which is why I didn't want to expend too much energy on it
Not being plaintext in any form is probably enough
I would also ensure the key file can not be trivially used on another pc
what is it though? an actual password the player types in?
I've encrypted it using the pcs Mac address as a key. It should stop it being lifted and used on a other pc yeah
players might send their entire folder to someone else when they want to share saves or whatever, you never know what they will do
We'll it's the "get unique machine id" BP node. Which as far as I'm aware is Mac address on windows
it actually returns a random guid from the registry
which is shared between all unreal games
(on the same pc)
But unique to that pc?
yes
and this is used to identify unique players over multiplayer ?
Should be secure enough to prevent casual or accidental copying of the file to a different system
the client says to the server i am GetUniqueMachineID ?
@half jewel yes, it's either use this or use the assigned token. I can decide as it's my API
during x y z login authentication or w/e
No, the machine id is used to encrypt a copy of the password and username stored to an ini
Then those saved credentials are decrypted and used to sign in over https
ohhh that makes more sense now
The credentials are exchanged for a base64 random session id which is then used by the unreal engine based dedicated server
store the session id instead and allow resuming a session
That should be easy enough to do
yea you can make something solid i suppose, its done all the time for things like steam autosign in and epic games launcher auto sign in... user/password encryption storing and what not
should never ever store a password in a way that it can be retrieved from - even on the players pc
I agree
(of course that assumes the session id is sufficiently massive that it is not possible for someone else to guess it or have a reasonable chance at brute forcing one)
64 characters of random entrpoy encoded into base64 is sufficiently long
yes
Just use a login token
Since 4.23 I've had some issues with my character's location jittering and "teleporting" small distance while moving (on client side). In the profiler I see that serverMoveNoBase is the most frequent RPC. Anyone know what it might be?
are you using chaos for the physics movement system?
in case you do: chaos has an issue with scaled meshes
no chaos and no physics
cmc employs chaos on newer versions if activated iirc. Seen that from kaos spectrum, we figured out the issue. Downscaling the plane mesh his character was moving on top solved the issue
take a look either way if yoiu are moving on top of scaled meshes
also listen server?
might want to see your issue with a gif if possible
its world composition and moving on top of level streamed landscapes, dedicated server
It appears as a network saturation issue, but it was a clear distinction between 4.22 and 4.23
ServerMoveNoBase() means it can't resolve the base actor properly most likely
^You might need to debug why you are geting to that state
why does "is locally controlled" in blueprint not do what i think it does, in a local splitscreen match?
e.g. im using it to determine wether or not to show a umg component (hud) against a character
and one character gets a hud, thats visible to everyone, all other characters get nothing.
works fine networked with dedicated server or listen server.
how to I net serialize a TArray In Netserialize ?
``
struct FAggrAttachCompressed
{
ESlotName Slot; //name of the slot . e.g stock, body, front
uint32 CosmeticHash; //hash of the attached item name.
TArray<FAggrAttachCompressed> Attachments; //sub attachments
bool bIsAttached = false;
bool bIsFPViewOnly = false;
bool NetSerialize(FArchive& Ar, class UPackageMap* Map, bool& bOutSuccess)
{
bOutSuccess = true;
Ar << Slot << CosmeticHash << Attachments;
Ar << bIsAttached << bIsFPViewOnly;
return true;
}
};
USTRUCT()
struct FAggrDetailsCompressed
{
GENERATED_BODY()
EAggregateName AggregateName;
TArray<FAggrAttachCompressed> Sockets;
bool NetSerialize(FArchive& Ar, class UPackageMap* Map, bool& bOutSuccess)
{
bOutSuccess = true;
Ar << AggregateName;
Ar << Sockets; // problem :(
return true;
}
};
template<> struct TStructOpsTypeTraits<FAggrDetailsCompressed> : public TStructOpsTypeTraitsBase2<FAggrDetailsCompressed>
{
enum { WithNetSerializer = true };
};
``
In local splitscreen both players will be locally controlled
then why dont both players have a hud?
They will all have their own instantiated HUD class
But the HUD will likely cover the whole screen
its seems calling Ar << Sockets; doesn't call NetSerialize but << operator
this is the code
@rose egret because it will, you have to manually call NetSerialize() if you want it to use NetSerialize()
my hud doesnt cover the whole screen, its a umg widget component attached to the character that follows it
<< operator is for all archives
friend FArchive& operator<<(FArchive& Ar, FAggrAttachCompressed& A) { bool bSuccess; A.NetSerialize(Ar, nullptr, bSuccess); return Ar; }
its ok?
rather than 'traditional' hud
@rose egret no
what should i use instead of 'is locally controlled' that will work fine with both local split screen and networked multiplayer then please?
{
bOutSuccess = true;
MyType.NetSerialize(Ar, Map, bOutSuccess);
return true;
}```
found it. SafeNetSerializeTArray_WithNetSerialize
π
another question . if I use Ar << MyUEnum will it be compress like Ar.SerializeInt(EnumValue, EnumMaxValue) ?
no
If you want to do that you need to do it manually
Using Ar.SerializeBits(&Enum, MaxBits);
It's also worth pointing out that your function will serialize the entire TArray anytime one element changes
You lose per-item changes when using NetSerialize
yet another question. now that I have the following net serializable struct how does engine detect whether properties changed or not ?
``
USTRUCT()
struct FAggrDetailsCompressed
{
GENERATED_BODY()
EAggregateName AggregateName;
TArray<FAggrAttachCompressed> Attachments;
bool NetSerialize(FArchive& Ar, class UPackageMap* Map, bool& bOutSuccess);
};
``
should I add UPROPERTY() to those properties who I want to be captured ?
It mem compares them unless you override the == operator
it memcmp with the last replicated copy ? oh damn what if my struct is too big
The short answer is it's complicated, but yeah generally the replicator will keep a copy of the struct and basically do == on them to decide whether to replicate.
But it's done through reflection and goes through a bunch of templates as well, depending on whether you have a valid TStructOpsTypeTrait template defined for that struct.
You should really only use NetSerialize() if you know what you're doing. The default engine serialization is fine for most things, and for TArray<> you should probably use FFastArraySerializer where possible anyway
I am trying to Multicast from a Server Executed event - I am printing a string to test, but the string is NOT printed on any of the clients D: - halp
That current implementation will send the entire struct, including the entire array and all of it's elements anytime that struct changes. That's probably going to be worse than the default engine replication.
Just for reference, this is what im doing
@plucky jasper client probably can't call the Server RPC
the actor has to be owned by something with a owning connection
RPC's to server/client require a owning connection
Multicasts don't and must be called on a authoritive actor
hm
Its a weapon
Which is procedurally generated
trying to figure out how I would go about generating on the clients then :/
since currently im just sending a seed
and was thinking that, since the server initiates the multicast it wouldnt had been a problem :/ ?
@chrome bay thanks. I replicate that struct once as a whole.
one of the reason that I didn't use default UStruct properties is that UE4 reflection doesn't support struct recursion via arrays. thats so annoying
you would not multicast to generate the item on client
that is verybad
the weapon would be replicated
and just created on server.
Ah
I thought it was bad practice to send the entire thing across
guess I'll do that then, thanks
@plucky jasper its kind of procedurally generated weapon. (but its cosmetic only)
instead of a skin set a rifle like AK47 is made of different parts (stock, body, grip, magazine, ...)
so that players collect those parts from matches and make their own weapons .
holy NDA π
Problem is, the entire weapon is generated
So I have to create the components
since its not a fixed amount
Yeah you'll have to replicate the weapon actor and all of it's components and properties, unless the properties can be deterministically inferred from the seed
So long as the properties are non-changing ofc
So I wanted to send the seed to the client and then have them generate the weapon
I suppose I could set the seed and just have the client generate it after
yeah no changes π
The trouble is you can't reference the weapon actor or components over the network that way
They won't be resolved
So the actor and components at least, have to be generated server-side then replicated.
right
hm
currently unsure how I would go about actually generating the components
or rather send them to the clients
Well, the actor will automatically replicate the replicated components.
And any replicated properties within
oh so
If I create the components on the actor from the server it'll just be generated ?
ah
yeah
what I am doing is replicating a FAggregateDetails . clients make a hierarchy of actor from that . for us each part is a actor not a component .
Not sure if I need to replicate the seed
since I can't generate the parameters on the client that way
supposedly
Guess I will just replicate the parameters instead
I think
aaah.. so confusing lol
Ah I think I got it π
I would rep the seed, and have a generic "init" function for the components which takes in that seed
Any properties you can infer can then be set
Ah right thanks man
what would be the chain if i needed to call a function from the client to the server, which then replicates the data back to the client
but only to the client that initially called it
Either call a Client RPC
Or, use a replicated property with COND_OwnerOnly as the condition.
@rocky totem
how well does replication graph work in 4.23?
Is there anyone who has got VOIP talker working willing to lend a hand for a second?
repgraph works well enough for unreal to use in the multimillion game fortnite π
4.21 version is horrid
is 4.23 version same or improved from 4.21?
I think it's a little more stable, I've had no real issues so far in 4.24.
4.21 liked to replicate dead actor pointers for some reason
I'm not sure
We had to fix the 4.21 version somewhat but I can't remember how we did it
4.24 has a lot of shader compiler bugs so I don't want to switch to it, gonna wait for 4.25
compiling the same shaders every time I load the map
Oh weird. I've not had that yet
and the FPS is a lot lower than 4.23
for me
seems like the odd builds are the good ones
just wish 4.23 had the atmospheric light scattering that .24 has
The atmo light scattering kills perf for me
hmm
Gave it a try in a pretty much empty map, dropped from 180FPS to sub 80
oh wow
Seems more useful for archviz, but maybe it needs tuning still or there are some quality controls somewhere
But then they did mention mobile so... not sure :/
i'm sure vol clouds will also be perf hogs
yeah no doubt
the price we pay for stunning scenes
i found this code to make a component face the player's camera. it looks like it wont work in multiplayer due to the hard-coded player id 0. how do i fix that to work in multiplayer? im aware it will only be making a non-replicated change to the component position that will only display for that player.
The ID will be fine
0 will return the clients controller.
For split-screen it won't work, because both players share the same world and actors
ok, thanks
thanks, works fine
split screen seems a bit of a second class citizen tbh
a hack
it wouldnt be the only split screen specific thing i'd need to be aware of
hi, there seems to be a problem with the generation of my navigation mesh. It is not there at all when i start my vr game with a dedicated server. I load the same map without that dedicated server it works, but when ever i connect to the server, it is not there anymore. Anyone?
guys i have a basic question about OnRep variable;
When OnRep variables changes before you joining to a match, it fires function again to take new variable value after you joined?
Okay thank you
Anyone know the best way to make a zone capture point and replicate it to all the players that are on the same team as the zone that is being captured? I've tried to put the calculating variable in the game state, but when on the client, it is not calculating to the server, even when it is properly replicated. Is this the best place to put this variable?
Could someone check out my question on the unrealengine forums please β€οΈ https://answers.unrealengine.com/questions/948785/max-walk-speed-wont-be-applied-when-multicasting-i.html
(Also please ping me if you have anything to add)
Actually its not related to the casting nodes it seems, if I disconnect the casting nodes and make it all run locally, the speed is still not set when I try sprinting or crouching on a client, it only works when I do it on the server
So I guess the question just changed to, how do I change character movement speed on clients?
could someone tell me why this isn't working as far as sound replication goes? being called from Event Any Damage if that makes a difference
also just calling the multicast one w/o the server event doesn't work either
@long willow no need to do a multicast. i would make sure Max Walk Speed is replicated and set it on the server when you crouch and such. personally what i do is modify the move forwards/right functions and alter Value based on what is being done
@proper ravine is the client the owner of the object making a RPC call to the server?
problemo solvedo lol
well i mean
a tip, keep the output log open Window->Developer and its in there. when you make an RPC call that fails it shows in the output log
if it's coming off of Event Any Damage it should have ownership of itself?
oh that's handy
your any damage event should be called from the server anyways if its a MP game
give me a quick run down on how this works. what/who calls your any damage event and how is it triggered
when the player attacks it calls a server replicated event that applies radial damage
and then the structure event graph overrides the Event Any Damage node, and from there we're calling the Server->Multicast for Play Destruction Sound
so client attacks which calls a server event to apply the damage to whatever the client attacked. well your already on the server so you have no need to call another server event, you can simply call the multicast function directly (if i understood you right)
so if damage is applied on the server then Any Damage only runs on the server?
you see where your setting health to 0.0
thats in your any damage function correct?
yup
and your any damage function is called on the server right?
that's what I didn't know I think
