#multiplayer
1 messages Β· Page 595 of 1
You'd spawn them on the server as a replicated actor, or if you don't want them replicated, make a replicated property in the Pawn or somewhere that could spawn them client side only.
What are you trying to do though? What is the item you're spawning and attaching to the player?
i have an spatial inventory i can drag and drop iitems on the ground
but i want other players to beable to pick them up
just was thinking of best spot to do all this
when i drop an item from inventory it uses gamestate
function*
I guess i can keep using game state
What do you mean when you say spatial inventory?
diablo 2
grid
it uses a component for the inventory but trying to keep the component clean and bare so i can reuse it
Initially I'd probably say Gamestate is useless here. Pretty much all of that can be done from the component. What is the component a part of?
a part of? like my player uses it but i want npc to use it too
for like trading
i can show you the tutorial i followed
So it's on the Pawn?
yah
Some of you have requested a way to leave me a tip so I've created a PayPal and a Patreon.
PayPal: https://paypal.me/reidschannel?locale.x=en_US Patreon: https://www.patreon.com/reidtreharne
Discord: https://discord.gg/PdvudWx
Icons: https://www.dropbox.com/s/a0hhuf4hky5n9mu/InventoryResources.zip?dl=0
i did add a decent amount of functionality though
You should be able to do that fairly easy then. Just create a drop function that gets the owner's location and do whatever little drop animation you want and allow players to call it. You'll avoid using a different class for it too.
yah i got all the functionality just need to add the remove item from my equipment slots
just was thinking of best spot for logic but i guess rpc in my pawn should be fine
i have a base class for the pawn so that would be used for npcs
If you network the component, you can use it itself to server RPC to the server version of itself from the client, and have the server version spawn the dropped item.
well i don't need it to able to really drop items thats almost additional functionality
because i plan on npcs using the component
so you can buy items from them and stuff
network the component?
like how do you do that?
oo you mean to make rpcs in the component?
probably will end up doing that for trading
kinda have too
Yeah. It avoids using the Pawn itself, so you can keep encapsulation without casting to the Pawn. That way there's no direct references to the player or the NPC
hmm thanks i'll try to do that
Hello everyone!
In Camera actor there is a auto activate for player option. Is there a default way to do this for all multiplayer controllers?
Does SomeReplicatedProperty_OnRep() get called after all replicated properties were called by any chance (can I assume that other replicated properties are up to date inside an OnRep()?)
Or should I use a post replication function type thing with some flags set up?
Replicated properties are not atomic
PropertyA and PropertyB may not replicate in the same packet even if they were changed together
Oh, not sure why my impression was that they were
Does putting them in a ustruct as uproperties ensure that they are?
No
Oof
AFAIK, marking the struct atomic, does ensure that though
Is it just a matter of adding Atomic in the ustruct specifiers? neat
The real question is why did I have no idea that the atomic notion exist up until now 
Hmmz I am having a weird issue with replicating a random seed, then setting seed and resetting a non-replicated randomstream on both client and server, same seed, still getting mostly identical results, but not entirely :/
it might not be the randomseed's fault, might be that some instances of a ISM aren't instanced.. hmm
At least theoretically when I spawn a replicated actor on the server with a transform, the replicated actor should have an identical transform, if always spawn/ignore collisions, no physics or collision interfering I think
Just weird that it looks almost identical but some pieces (crystals and gold) are bigger, scaling also follows the same randomstream, positions seem right, some pieces seem missing, but most are correct
Are you sure that the order of calls to random stream is consistent on all clients ?
Hmm, it is blueprints with nodes, if of some reason the order of nodes varies IDK but hope not
On the same machine, two windows two players in PIE
"one process"
Define "order of nodes"
But yeah you could be on to something there.. order of nodes, just the linking between them, it is a chain of nodes after eachother
the "run in one process" not sure what it does with blueprints, neither if always nodes are executed in the same order (if not needed to be)
I could do a sequence instead of a long chain, just thinking loud
if of some reason the chain is executed not equal hence the result varies, but the "sum" of the chain nodes, the number of nodes, keeps the result appearing almost correct
weird..
The order of Blueprints is not guaranteed
The order of nodes whithin a Blueprint is
Yeah, I just put the nodes in a sequence, I discovered what seems to be wrong, it chooses a random ISM to make an instance in, to vary pieces of crystal, it uses a random integer in range from stream, but it uses the ISMs_Crystals length as a max, which should be identical but I'll have to look at it..
they should be identical, just two different pieces, array set in constructor.. hmm, but the difference on client server is that it is not the same piece
random integer in range 0-1 .. when it is the same piece on server and client, the size is the same, position, rotation, everything, but for some odd pieces it appears to fail
I think I've found it.. OreNrPieces is set from another randomstream on the server, which I also need to sync up.. OreNrPieces shouldn't have been replicated, it was
Quick question in regards to implementation design.. I want it so when simulated proxies get hit with a bullet, that when they die, their corpse will take some impulse vector to apply physical force on the ragdoll
Before I was using an RPC of the form MulticastReceivePackedBulletsDamageAndDie(BunchOfBullets, ImpulseVector), but then I realized that my IsAlive boolean (which I set to off in that function) should instead be a replicated property. Naturally on OnRep_IsAlive, I should ragdolize the character if it was alive and is now not. But in this case, I have no good way of applying any impulse vector. Right now my solution, is on the server, when a player dies from a bullet, call MulticastReceivePackedBulletsDamageAndDie(BunchOfBullets, ImpulseVector), AND set IsAlive to false, but that feels like double the work and not ideal as well
Is there any good way to go about this?
Problem fixed, now they're identical π
@unkempt tiger How does your damage work? Like clients shooting other characters. Is this all done server side, or do you use Client side input when they shoot something, and fake their shots on all other clients?
It's kind of an involved system, basically inputs are synchronized and played on every instance, predicting client, server and simulated proxies. Inputs generate bullets - meaning the bullets are simulated on all instances too. When a locally controlled player shoots a bullet and hits another player, it sends a request of consideration to the server with the hit results, the server validates them by finding the corresponding bullet, tweaks them to its liking etc, and then multicasts the server-authed results
@unkempt tiger in HLL we replicate the damage event with the health state
As part of the same struct, that way they can never arrive independently
And is that struct with an atomic specifier? @chrome bay
It's just a USTRUCT with the following uproperties:
UPROPERTY(Transient) FDamageEvent GeneralDamageEvent;
UPROPERTY(Transient) FPointDamageEvent PointDamageEvent;
UPROPERTY(Transient) FRadialDamageEvent RadialDamageEvent;```
And a few others, but ultimately that's all there is
What does transient mean? Also I understood that it's not guaranteed that uproperties of a replicated struct will all replicate at once unless the struct is marked as atomic?
AFAIK all struct properties should be received at once, at least they seem to be in this case
Assuming you modify them all in the same network frame anyway
I'm not sure if Atomic is required, I don't have it specified
Huh, alright, I guess it's worth testing then
I've never had any issues with it that way anyway
When we had them as separate properties, it caused trouble all the time
So I suppose that the engine kind of guarantees that your new property values' are replicated properly simply because of the health change?
What if something lowers the health, but there was no damage event somehow, if that exists? How do clients know that the player was in fact not damaged?
It's likely just something where the actual replicated property itself is checked if it's different. If it is, it'll replicate all of the changed parts. So if it's a struct, every change in it would get replicated together.
Hi all. Has any of you guys any info about how I can go about the creation of a join/drop menu for local multiplayer? Or specifically how I can detect gamepad input by index? Do I have to create player controllers first?
Any help would be much appreciated. Thanks in advance, have a good rest of your day, evening or night. My googling session wasn't that fruitful. "GetUserIndex" from KeyEvent always returns 0.
iirc you create players
not just player controllers
game instance should have functions for that
@unkempt tiger there's a byte in the struct that we increment too to ensure replication
And some flags for what is relevant at the tike
@unkempt tiger for custom net serialize, with flags for whats relevant, FHitResults NetSerialize function in the engine is an excellent example
Anyone have an idea on why 'SetControlRotation' on Controller is smoother vs setting rotation via Pawn?
Using CMC with multi.
on rotation w/ setting on pawn it's just a very subtle jitter; like it's updating every ms on the turn.
Using the built-in behaviour works with the network prediction
Arbitrarily setting it's rotation won't be part of that
UCharacterMovementComponent::PhysicsRotation
That's where the rotation is calculated at least
hello quick q
where should I store variables that I dont want to get reset when I servertravel to another level?
Cuz I have some replicated variables on each player with different values and when I servertravel boom they all get to the dfault value
PlayerState, using some of the functions inside that check what's kept
@shadow schooner ```cpp
/** called by seamless travel when initializing a player on the other side - copy properties to the new PlayerState that should persist /
virtual void SeamlessTravelTo(class APlayerState NewPlayerState);
there is also
virtual void CopyProperties(APlayerState* PlayerState);
hey guys quick question. I might have understood something wrong here:
https://docs.unrealengine.com/en-US/Support/Builds/ReleaseNotes/4_25/index.html
New: Full address protocol resolution and round robin connection attempts are now made in the IpNetDriver/IpConnection classes automatically. This enables connecting over both IPv6 and IPv4 networks, and takes advantage of platforms that can use both in order to find the best method to connect to a server.
Platforms where this behavior is not desired must call DisableAddressResolution either in their connection class constructor or in InitLocalConnection and InitRemoteConnection before calling any base class functionality. This will make sure that resolution is properly disabled for inherited IpConnection classes.
For testing, users can take advantage of CVARs such as net.DebugAppendResolverAddress which will always add the value to any address resolution done and net.IpConnectionDisableResolution which will disable address resolution on any future connections made.
and
New: IPv6 support is now included by default in all desktop platform builds, but is disabled. Setting the CVAR net.DisableIPv6 to 0 will enable IPv6, provided there is device OS level support.
Network addresses should be passed through a resolution method like GetAddressInfo in order to express the address in the best way possible.
SetIp and GetAddressFromString are still usable, but may require address translation in usages where connection protocols are not defined anywhere.
does that mean we can use ipv6 to enable sessions now?
Thanks for your answer π
As per my understanding This is something which is implemented at OSS level.
So for multiplayer and replication use cases you should not worry about ipv4 or ipv6
when I connect players via my matchmaking server I need to provide the IP tho. Using v4 and v6 here is a big difference. As far as I knew it wasnt possible to use ipv6 so far
but I could be wrong here
thatΒ΄s the reason for my question
If you see the OSS like epic or steam they do have custom network driver class.
And yes for matchmaking and session fall into OSS layer.
I know but due to some limitations I cannot use third party OSS
It's very difficult to maintain OSS by yourself. Whatever OSS you are using you have ask for ipv6 support from them
Are you using your own OSS with your own backend???
yes
I am using my own backend
but NAT punch through / relay is a big problem here tbh
the rest is fine
I thought using ipv6 might help to solve this problem
or at least help
I m not god level expert in networking..
Do your machine have ipv6 address?
which does not
so you do not have ipv6?
My ISP gave me ipv4 address.
ok
I would need to test theses things. But unreal supporting it is a basic requirement for it
sooo.. does it? π
If the machine doesn't have ipv6 address so how come hosting session will have ipv6 address??
I have not one machine without ipv6 adresse
Just a quick hack... The mobile network do support ipv6, you can use it via USB tethering...@thorn cairn
You need to enable ipv6 in Android in networking settings first
I am only shipping for desktop right now
hi all anyone know how to ignore error for dedicated server. it is easy to close the server if there are some error
That was a trick to get ipv6 address in your desktop so that you can test π
What do you mean by error?
The dedicated server doesn't close(exit) automatically on error.. the server closes on fatal exception
after some more research due to your points
yes I have no idea why it have fatal error
I guess you are using windows dedicated server?
If yes then on fatal expection the window will close and you can't see the exact crash log..
I think you can attack debugger to your dedicated server..
Your dedicated server is also a process.. and you can attach debugger to a process in vs
ic let me try thx
In C++, OnRep doesn't run automatically. You have to call it yourself unlike Blueprint OnRep
Doesn't run automatically on the server*
Just on the server, at all. It will only run Client OnReps if you just set a variable. So for example, that code would never call the OnRep on the server, ever.
Yep. I see a lot of people wrap a lot of their replicated values in a function for that. Sets it and calls the OnRep afterwards in the same call.
do level blueprints only exist localy?
i am trying to understand how they work in replication
i was under the impression that they had a server counter part
but i have to call a server function inside the level BP in order for it to affect replicated players
for example, for a pawn if i do something on tick it will do that same thing both on the server and on the client because they both have the same function but the same doesnt seem to apply to level blueprints
As per my understanding levels are not replicated. And thus level blueprints can't replicate too.
Levels are like solid state and will not change no matter what, so need to replicate. Server only interested to updates the pawn's transform as per his copy of level and the same transform is replicated to clients and it works perfectly fine because the client's level is also same as that of server
If you are to connected to a server then both the client and server needs to have same map
To be specific same version of map
Else connection will be refused
By server
why cant you just put that string in the game state and replicate it?
cant you simplify the string some how?
If you think string replication is bad..then how are you replicating string when clients are connected???
What are the strings for exactly? What do they have access to that both the client and the server wouldn't through some other datatype means?
maybe you can have a float with the string version, and then when that float changes you can fetch the thing
i dunno man, why dont you explain the system in more detail
Why don't you create map of these and send ids across?
maybe we can brain storm something
steam makes you download the file itself in the case of user profile images
man thats a task and a half
there arent many games doing that
if any at all
Either way. Replicating a string once isn't terrible if it's necessary. The only real difference I know of the RPC vs Replication is the very tiny amount of CPU overhead of checking the replication. Replication is of course easier to manage in that regard without all of the RPC back and forth.
Not something I'd do every second or so to every client, but every so often isn't going to break anything.
sincei ts virtual production you dont have to woorry that much about performance i think you can handle a string
do it like i said, make a version check with a float
and then when it changes get the string
The best posible way is your client upload the file to S3 or similar storage and once upload is done you broadcast the link to other clients.
dude your asking like ID software level stuff, speaking for my self its hard to have a grasp on that, maybe your on a level where you have to make your own new systems
This was you aren't choking the replication driver
so they edit the mesh itself?
so you want to replicate 1000's of actors each with their names and colors and stuff and they all have to replicate properly
just to make sure i understand correctly
so if they are important only before spawn you only need to replicate them once no?
As your mentioned your players can import fbx means you have to somehow replication mesh and skel mesh too ..m
its very hard to come up with solutions when you dont have a proper grasp of the concept
And Engine doesn't replicate mesh and skel mesh
dude give us a general description of the idea
its easier
so only the host can change stuff?
how is that an issue?
Can host import anything during gameplay??
if only the host is making the changes i dont think that is going to bottle neck anything
Then use S3 or similar to store session based uploads
And once uploaded broadcast the S3 to clients and they download model from link and show
unless the host is making changes every second there should be no issue i think
There is a problem
And that is client doesn't have those static meshes
well but he said the issue has nothign to do with that
Before replication client needs to download those runtime meshes or assets
hes problem is with replicating strings
which i dont think is a problem at all in this scenario, if you had maybe 50 user all changing those strings at run time then yes, but it is only the host
theres no way its gonna bottle neck anything unless the host is sending half a bible each time
well, if the function is realiable it will probably just retry again like a TCP packet
i am not sure how the reliable stuff works in UE4 but i assume it is similar to a TCP protocol
If you persist the fbx model in S3 then upon reconnect your client will know which mesh or skel to show without asking the host.
so even if it jams it will go through eventualy although with a bit of lag
ye, the reliable stuff is a topic that i would like to know aswell
if you know any 1 at epic that knows about that stuff let me know
oh π
Using cloud storage will free the host to update the client every time clients connect... Thus host upload files and forget about updating to clients.
that would probably add aditional costs no?
Yes definitely π
EOS has player storage interface, but it doesn't offer 1:N access
So you can't use that one
you could call a MULTICAST when the host submits a change
It's not like you always need cloud storage .. you can also use CDN too.. I believe CDN is cheaper than cloud storage
And I think CDN is automatically cleaned up after sometime
i still think that the string replication wouldnt make that much of a diference tho
how realistic is it that you would have hundreds of models in a session?
even if you have that many could you simply not do distance culling?
Can host go offline? If yes then what happens?
it feels like you would need to replicate in batches, since its not a game it should be fine but i am not sure if UE4 can do that
I think @limber gyro is quite right.
Since you aren't using dedicated server, cloud storage won't make much sense
it would be more elegant that messing around with external servers
There is batch RPC, have a look at that too
whats GAS?
Gameplay ability system
oh
This doc is specific to GAS β½
its the same principle
man UE4 has so much shit, every time i feel like i have a small grasp on most systems something new pops up
if you are going to send X amount of RPC's the same frame (from different things) you can batch them to a single RPC
So i currently have GAS implemented, and currently working on the weapon firing.
Now i know a lot of games, the weapon is fired on both client and server at
otherwise you want to maybe space out your RPCs on tick using some kinda timestep
I learnt about batch RPC from above link
And this man @meager spade
i also batch Gameplay Cues to a single RPC for weapons
so i can send 3-4 cues through the system, but server will only ever do one 1 multicast RPC for those 3-4 cues
man i am so glad my game doesnt have to worry about net bottlenecks
small arena maps with 6 players tops
makes things so much easier
still nice to reduce that stuff down tho
but my weapons originally was 3 rpcs per shot
till i batched them
ye i know, but since i dont have the experience/confidence/resources/time to dig into those systems i try to work around it by design
instead of having 10 shots per second i will have just 1
or if i have 1 character with 5 shots per second the others will have 1 shot every 2 seconds
its not ideal but i havent had any issues with replication so far
and i have my servers in playfab which are in the USA i play from portugal and tested with a guy from india
and we had like 30 ping
it also helps that the game itself is simple
anyways, i have a question, if i call an rpc from the level BP that damages all players if they are inside a specific are and i call it from evry client am i safe to assume that the damage will be multiplied by the amount of player in the game?
i was trying to understand how to achieve proper replication with level BP's but then Tank start with his issue and went from there lol
well the thing is i dont think it does
at least in the level BP
i mean level bp is an actor
owned by the world
err server*
so why not just have server damage all pawns?
no rpc's involved
ok so heres where i am confused
i have a level that after X time moves all players to X location
if i do it in the tick that doesnt work
i have to do it in an RPC
for the player to actualy be teleported
is confused what does one have to do with the other
thats why i am confused, i was under the impression that since the tick exists in both the server and client it would work without an RPC
they should tho i wouldn't rely on that for timing purposes
client can tick later than server (by some margin)
not in single process PIE
in real world games
but thats hardly a worthy test
ok so now it worked for some reason
bruh
but i am 100% sure i had issues with that
i think i didnt work in packaged version
suspects sonicphi could benefit from a good night's sleep
hahahahaha
some times its the best solution
but seriously i am 100% it didnt work before
maybe i forgot something i dunno, happens some times
if i test this and it doesnt work without the rpc imma come back here and ask you both for my hour back cause thats how long it takes to upload stuff to play fab π
does anyone know how to transition from waiting post match back to waiting to start or inprogress even?
Once End match is called I can't seem to get ready for another match ... there doesn't seem to be a way to set the readyformatchstart bool
Match start transitions from waiting to start to in progress if called manually or "ready to start is true"
however UE4 documentation states nothing about Going from post match to reset other than "watiting on match is called after map load"
I don't want to reload the map
I want to force another round in the same session without traveling back to the same map
UPDATE************** It's not documented well but this page needs to mention that "Restart Game" will by default do all necessary things to progress back to "waiting on match start"
Hey guys, is there any heartbeat system already built in, inside Unreal networking, which we can use, i know server knows, if client has been disconnected, becasue of handshake it tries to do and also the, client timeout time.
Any idea if I spawn this way, the client has no control. But If I directly get GetActorTransform then spawn, it works.
π€£
add questions to the sea of unanswered pile
lol
@summer tide btw
you don't have to -1 a get random int function
if you look at the cpp behind the function its 0 - max length
Actually its in the tooltip now
Strange it seems it only gets one and I have 10 player starts.
three each beside the last one
Why? I have a logic to check
Length of an array is the count from 0-9 (10) elements random int from that 0-9 - 1 will interate through all of them
the function handles the -1 for you
as specified in the tooltip
a random int from the max - 1
meaning it will radomly give you 0-9
Yea I got that part, but Why Im only storing 1 transform of player start in the array.
because your getting the playerstart in the controller
Your also getting the playerstart on the server
why are you not calling a replicated to server event from the client?
get playerstart locations init local playerstuff
Create you a function to get this
from output get actor transform and feed the spawnactorfrom class-> possess
you can run this in playercontroller but do it as a replicated from owning client back to server if owner
otherwise if server it runs (for listen client)
So Owning Client Event -> Server Event; Server Event spawns the player?
In my gamemode I call init play(replicated to owning client if server) on the playercontroller
Then i call a (Run on server) which calls this get random spawn loc and possesses from that call
Event begin play can't be used really because it fires for the server and clients. I use handle starting new player in the gamemode
This way its seamless travel "safe"
wont cause issues down the road
The only thing I do off begin play in my controller is store the server gameinstance for vivox session IDs
Everything else is fired from the gamemode telling my controllers to init play
Which runs on the owning clients and request info from the server in the event the server needs to do something or give the client info
That's in my gamemode
oh
the switch node confused me
you don't need that
gamemode only exist on the server
there is no remote
When cooking on shipping mode, all my clients think they're in standalone mode and never even try to connect to the server. Is this normal behavior and I have to set some specific properties for clients to know they are clients? Or did I break the out of the box functionality somehow?
your game instance var for the server needs to be set on begin play
not on server spawn character
you'll be resetting your gameinstance var for every client join
I do have one but for some reason it doesn't find it mayube that gets called before begin play
?
no
i think your checking for client gameinstance somewhere
Clients and server have thier own "gameinstance"
for clients you set gameinstance_c
on client init
"run on owning client"
for server you set gameinstance_s on controller begin play
if you want to get them seperately
otherwise you just got to understand how to call the get var behind "client side events" vs "server side events" and use valid checks
but the gameinstance is always there on begin play for the server
So I store selected map name in my game instance fyi
Thats fine
I can't use your random function i need to compare against the map name
why?
your getting all playerstarts
an object outputs
you can get the transform directly from there
I renamed my player start to map, map 2, map 3, othermap, othermap 2, othermap 3, etc
Let's say I have 4 biomes
yeah
each biome has 3 player starts.
at this point you create a "map" for each biome
you store the name of the boime in the playerstart
All in a single world
you look up against that "map"
then get random from the lookup
BiomeName -> playerstarts
If you need flip the map around
make each playerstart unique but the description can be the biome (since the key does need to be unique)
You think that's causing the issue that I'm having or this approach is better
I think you likely have something going on in that speggetti
I also think you have logic confused on how gameinstance works
gameinstances is local only
server cannot write to the clients gameinstance
the client has to set things based on what it knows
when determining what properties to replicate, how does UE4 check for equality (so it could delta serialize)? Do I need to override some operator like ==?
@summer tide
I'm not sure why your storing levelname in the gameinstance anyway
You can pretty much call this anytime you need to
Returns for both server and clients
I should say biome name, since they are in a single world
ok got ya
So
when you get your random playerstart
and it picks an int
Just do this
it outputs the object and the playerstart tag name
you can use the playerstart tag for the biome name
and understand where your spawning
but here is the deal
if you set this "on the server thats spawning the pawn"
its just setting in server gameinstance
not the clients
you'll have run the set value in gameinstance on the client
if you want the client gameinstance to understand "where they spawned" then you'll need to call a run on owning cllient to set the biome name there in "the clients gameinstance"
yeah i just found out what he was trying to do
lmao
hes trying to pull gameinstance info from the client to look up and use on the server to spawn
and yeah he's not rpcing on gameinstance
its in the playercontroller
I fixed my logic, I had the contains param input reversed. Now trying to fix the replication issue. So I need to save the transform on client side as wel as you mentioned
Well
You have to understand that you'll need to get the transform from the client to spawn on the server if thats your intention
are you trying to "save" where they spawn basically?
Not save I mean store the transform of the player starts in a variable
why?
Oh wait let me implement your function first
if your only using it to store playerstarts then do it on init play or on the server begin play
oh that will work then let me do that
but the honest truth is storing an array of playerstart objects is likely more future proof
you can get transfrorm, start tag, actor tags, etc
I can only use GetActorOfClass to get the player starts how else you do that
The reason i do it from a function is my playerstarts "move"
so i get them on init play on controller from gamemode
but if yours are static you can literally build the array and store the var on begin play
The only reason game instance needs to know is if you want to save it across levels
or dump it to a save file
I have a checkpoint function that destroys the playstart and spawns a new one for progression "since unreal won't let a playerstart be movable"
still something I think is goofy
So If I add transform in begin play. THe server doesn't spawn only client does. I screw up something?
So in ctrl , Owning Client Event calling the Server Event and Server event is spawning.
huh?
are you getting from controller or gameinstance?
if your storing in game instance and then pulling then thats why
like i said you can't cross talk
each client "including listen server" only has access to thier own instance
@severe nymph i am fairly sure you can attach the PlayerStart to another Actor then teleport that Actor around
@winged badger ok awsome
thats a nice tip haven't tried it
i only tried to teleport the actual playerstart actor
tried set actor location too
i don't remember what im doing exactly anymore
but PlayerStates have the same base, Ainfo
and i do attach mine to my Pawns just fine
So Uno where should I store the selected map anme if not game-instance
your boimes are server info
your server understands them
your playerstarts again should be an array you build
objects
event begin play get all actors of class add to array
boom
playerstart array populated
in the server spawn logic you spawn the client from the transform you want them to spawn at
that apporoach is suspect
if you want to match the biomes you save a gameinstance var = serverside var
FindPlayerStart is usually called way before BeginPlay
and there is the matter of AGameModeBase::ShouldStartAtStartSpot as well
what?
which makes controllers pick a cached StartSpot
that they cached immediately upon loading a level
this is in playercontroller
without any info from lobby
its litterally comes in after map load
before posession
not talking about on level begin play
its the same thing
not talking about gamemode begin play
they get called together
what?
^
is way too late
that is wrong
with GameMode
StartMatch calls DispatchBeginPlay
which is when world calls BeginPlay on all Actors in it
Um.. they have tools you can run that state otherwise and also editor vs standalone has a different order call
so you might be getting things confused there
i literally know that source code like the palm of my hand
I can promise you
if you print event begin play in a map and on a playercontroller you'll get the map first 99% of the time
if not 100%
it does whenever the map load completes and all starts are loaded
before the freaking controller calls build an array of the object
order of operations is indeed the topic here
and you have to cover the following 2 scenarios
1 - intentionally delaying BeginPlay
which is very very common, especially with seamless travel that Korvax uses iirc
2 - after seamless travel, unless the PC class changed from departing to arriving map
I don't delay begin play
PC won't call BeginPlay
its the same instance
that why you have a gamemode client side call
intit play from handle starting new player
so
and by now i feel like you just want to debate
you seamless travel
I'm good
first thing a departing controller calls when arriving on target world
is NotifyWorldLoaded
then it calls ServerNotifyWorldLoaded
i was here to help and i've been doing this long enough to know that when someone says "intentionally delay begin play" they have bigger issues
that calls HandleSeamlessTravelPlayer into GenericPlayerInitializations then into HandleStartinNewPlayer
if you are doing anything like overriding ReadyToStartMatch (so you can wait till all travelling players loaded)
to say, return NumTravellingPlayers == 0;
your entire setup explodes
Or you can just tick delayed start and handle it manually
but sure
I do things the right way based on I have my own functions before just letting the gamemode fire off match logic
what we do is procedurally spawn 30k actor level on server and client separately
then we network actors after the fact
the functions themselves literally say "you should override"
and then we let BeginPlay get called
The point being here... that for him the server needs a collection of playerstarts (array)
if you have preplaced player starts on the level
the map is loaded for the server and begin play is called for the server controller afterwards
he can build it there
just fine
you can just override PreSave on custom LevelScriptActor
to stash them in an array in editor time
and not having to search one single thing at runtime
BP equivalent would be putting all PlayerStarts in LevelBP's array
hes struggling with reading from a client gameinsatance to match the server biome name
and your trying to offer him this advice and crap on loading an array in begin play ... sheesh man
that was your advice, and it was bad
its like einstien trying to teach relativity to a 9 year old
he's gotta crawl
then walk
then run
again my advice isn't bad
its simple
and honestly there are thousands of youtube videos from UE staff offering much worse advice
or simply not understanding things
epic MP tutorial supposedly has replicated array of PlayerCOntrollers in GameMode
this is GameModeBase
Epic's docs is like patriotism or religion. They live in your heart.
possibly, can't say i use it
GameMode has few subtle differences
and those docs are made by same people who make tutorials you mentioned above π
This is the gameflow chart that shows order of operation differences between editor and standalone
if you print from each you will get this output today
I literally live by this and the Network_Compendium
what? no it isnj't
beginplay in gamemode gets called way before startmatch
startmatch without any changes occurs litterally right after begin play the readytostartmatch bool returns true and then the matchstatechange event fires
and you're printstringing all of this in editor?
no
but wouldn't matter
after egine start this order is the same
the only difference being in PIE you can't test server travel
ending start order doesn't matter, only what happens after world loads
for this discussion
but order after UWORLD is the same in standalone and editor
get a bland project and test it
and i never said it wasn't
its easy
put some breakpoints in, walk through the source code as it executes
gamemode calls right after UWORLD
startmatch can't be called on a null ptr
its exist in mode base
I understand it
i don't need to put breakpoints
there is no way that a delegate that exist in a class gets called before the class contructor
and this is pointless, as you need to unlearn few of your assertions
but doesn't matter
so, good night
I'll record a video printing it out
after i've posted the docs
source states the same thing
if it doesn't then you show me
explain to me how a function and delegate that exist within a class can somehow get called before its contructor
thats like saying a component tick can start before its part of an actor
the "source" actually proves you wrong
yeah thats what I said its a member of gamemode ... its called after the constuctor after the pointer ... after the class init
UWORD-BeginPlay-> Gamemode->Constructor->Startplay->Startmatch
that has nothing to do with what we are talking about
And yes i came to the conclusing zlo wasn't on the same page a while back
Dumb q, but I assume people roll their own network code - i.e. a custom movement component w/ no network code.
but he was determined to correct me on this other thing anyway
Put it like this
the day he can get gamemode begin play to fire after start match
I'll give him a million bucks
the point was, PlayerController, and every Actor can end up calling BeginPlay a full minute after all the PlayerPawns are spawned at their PlayerStarts
a pawn doesn't need a playercontroller
including the GameMode
thats dumb
of course that can happen
but gamemode will fire
and will begin play
well before match start
and controller will also fire after map load
regardless of possession
and honestly i'm simply waisting my time now
this conversation is no longer constructive
I simply value my time too much
void ARTS_GameMode::HandleMatchHasStarted()
{
GameSession->HandleMatchHasStarted();
// start human players first
if (!ShouldShowHeroSelectionMenu())
{
for (FConstPlayerControllerIterator Iterator = GetWorld()->GetPlayerControllerIterator(); Iterator; ++Iterator)
{
APlayerController* PlayerController = Iterator->Get();
if ((PlayerController->GetPawn() == nullptr) && PlayerCanStart(PlayerController))
{
StartPlayer(PlayerController);
}
}
}
// Make sure level streaming is up to date before triggering NotifyMatchStarted
GEngine->BlockTillLevelStreamingCompleted(GetWorld());
// First fire BeginPlay, if we haven't already in waiting to start match
GetWorldSettings()->NotifyBeginPlay();
if anyone else needs help without someone jumping on my help @ me
last line is where the world starts calling BeginPlay on Actors
which is after SetMatchState(InProgress)
cause apperently the first person to make a dent in the sea of unanswered is only here to catch crap
and then comes AGameMode::BeginPlay
SetMatchState(InProgress) is also called from StartMatch
for my part i will admit i did not know the function in the World was also called BeginPlay
spawn actors of course is after startmatch
GameMode still can't call BeginPlay before it starts the match
now your spinning off in another direction
nor can any World Actor
put some breakpoints instead of reading print strings backwards, please π
now, good night
PS. UWorld::BeginPlay() != AGameMode::BeginPlay
LogBlueprintUserMessages: [DeathMatch_GM_C_0] Server: BeginPlay```
LogGameMode: Display: Match State Changed from WaitingToStart to InProgress
LogBlueprintUserMessages: [DeathMatch_GM_C_0] Server: BeginPlay```
yes ... apparently in 4.26 preview
logs read top down
or without delayed start
and BeginPlay being the last one to be called is an extremely powerful tool
The delegate for echanged match state fires before beginplay
as you can control when it is called
so the docs are wrong
technically, yes and no
well i'm not one to not get a lession or be too stubborn to learn
World is not an actor
so it does call its BeginPlay function first
heheh
was only trying to help but apparently caught a lession myself π
π
my bad zlo ... seriously
so used to using delayed start or readytostart override ... i haven't tested vanilla behavior on gamemode in a "long" time
I was ready to lose money on it π
no harm done, and we all learned a bit from it, i'd say
The true lesson..
was humility.

If I'm getting into making my own lil Network code for UE just for shits and giggles, is there a good resource to learn from?
@winged badger maybe you know better for this
say i want to disable input for all clients until after match start
how would you handle that?
how cheat proof?
if the answer is "very" only thing you can do is unpossess
everything else can be hacked client side
The way I was doing it now I was getting the new player waiting until posesssion is relevant and calling disable input from gamemode
basically I want them just standing there able to look around and stuff but not move
if the game is competitive
I don't want to handle spectating
its a VR game
i'd rather not
I also don't like promoting the fly around and "private chat"
it is at risk of cheating?
Well ... I just find ppl take advantage of spectating too much
unless you really limit the spectator
at that point I simply spawn them still in their characters
not deal with the extra class
which is easier to do then limit CMC< especially from BP
I really need disable input
limiting movement on the movement component doesn't keep them from gripping
swap the input components
"i have climb"
have one for the start
that allows few things you can do while waiting
and then swap it for the "real" one
using a "is server" node in a level BP would be the same as "has authority"?
since the map actor is spawned on the server it should be the same right?
is "is server" the same as "#if ue_server"?
ty
preprocessor directive to compile things only for server targets has nothing to do with it
I think I've got enough eggs in a row to make the dive but I wanna see if this doesn't pass the smell test to anyone of you smarter people here:
Using the oculus online subsystem I can handle creating sessions/inviting people/yada yada. Then using the awesome tutorial by Flopperam I can setup a fleet that would be on the receiving end of those create/join session calls yea?
Are there any super unique gotchas specifically trying to implement oculus online subsystem this way? Seems relatively... straight forward (I'm gonna regret those words)
if a server function spawns sound at location or spawns sound attached, that will be heard by all clients correct?
incorrect
if that sound is in the world basically then you will hear it (attached spawned by server)
if you spawn sound at location replication isn't handled
you'll have to multicast it
okay..so spawning a sound is different from spawning an actor?
I'm thinking more in a context of a listen server where we'd want/need the host to also see/hear these effects
its the same
listen server just has a client
but replication if done correctly can transition from listen server to dedicated without much modification
basically if you place an audio actor in the level its part of the map
net load on client
by default
but if you spawn it, you need to multicast the spawn
meaning clients hear the sound
if you spawn the sound attached then it attaches to a netload on client actor
usually resulting in all clients hearing it if its on an actor in your world
unless that actor isn't replicated at all
then no
you won't hear it
also with UE4 it depends alot on what drives these events
if its overlap or hit
some delegates are already "fire on all"
a hit for example
doesn't need to be replicated
it fires on all
it will send logic down the chain on server/clients for that hit
if you place a spawn sound node there
then there is no need to rep
okay.
that makes sense.
I just didn't realize that spawn sound wouldn't automatically replicated like a spawn actor
well ... an actor with replicates and net load when spawned is handled ... if you spawn a sound or atttach a sound component to that actor it's usually handled but that isn't the case for at location or attached "in general"
alot depends on whats calling the logic ... the type of event firing, if you want it in sync ... if its a state or a fire and forget (multicast)
Right now it's a weapon sound attached to a barrel, I want to make sure the sound follows the barrel as the players are moving quickly and the sound isn't entirely instant. So I don't want to use "play sound at location" so I thought if I spawned it attached it would move with the actor, and then I could bind and destroy it when it was done.
but I'll have to spawn it on the host and then multi spawn it on the clients. which is fine.
just good to know before I test it and scratch my head wondering why it wasn't working
well
I usually don't use replicated projectiles
I multicast them
I spawn a local copy
and the sound
then multicast out to everyone but self
hit scan, not projectiles.
same concept
line trace on client rpc to server multicast from server to all but self
and this is the firing sound, not the projectile sound itself.
have an event called Local
call it spawn sounds do stuff etc
call a server event that calls it
then multicast it
to everyone but self
all but owning client
okay I'll try that. Thanks.
this also negates the feeling of lag
otherwise every client is going to feel this latency and hear things late etc
but on normal architecture, isn't weapon firing done through the server?
but isn't even pulling the trigger itself done through the server?
no....
most examples I've seen of this have your weapon fire input directly connected to a server call to fire the weapon
because the client has to check with the server to make sure it can fire the weapon at the time.
So as not to bypass fire rates or anything like that.
lol
you been watching too many "old epic tutorials"
but no
an input event comes from controller index 0 for every local client
and directly controls the possessed actor
only if that actor is a character and has a character movement component does it do things like client prediction
only if the actor is replicated can you even look at things from a server or rpc standpoint
the switch has authority node will actually branch your logic on server (authority) / remote(client)
if everything went through the server first then there wouldn't be a need to branch off this
or even have a method of understanding the logic control
"net load on client" is actually another tell that when you wrap your head around it explains that the client has a copy of "these actors"
they exist both on the server and the client and you control the state/sync with rpcs/replication/rep notify
If you told your logic to do everything on the server side then your clients would be waiting around forever to see things like sound effects or bullets "120ms" of latency feels horrid if your waiting around that long for everything
so you do things locally now and you keep your fingers crossed that the server (agrees with you) then if it doesn't it corrects you
and then you have players complaining "my screen showed me shooting them but no damage registered".
yes
but you'd rather that complaining
believe me
ppl complain about rubber banding
but they would rather that
than a big ass 120 to 200ms delay between pressing forward and walking
its why UE4 actually has this built into the CMC
its also why on fortnite or Unreal Tournament you see exaclty that situation where lag kicks someones rear end and they swear on their screen they shot someone but the server corrected them
I don't think anyone actually "waits on the client side" for a response from the server for most things.... they check back for a "correction state"
some things you will want to branch off authority on "damage" "hits" "overlaps" etc
then you'll multicast out
but input events
hell no
fire that anim
fire that sound
on hit squirt that blood
then athority check then multicast
for everyone except local for effects
I've played games like that they were garbage. You run up behind someone shoot them several times in the back over 2 seconds then they turn around and shoot you once and you're dead
ok ... i'm just trying to help
heh welcome to Latency
I've also played games where i fire and it takes 2 seconds to see an animation or get feedback
and its garbage
no way to fix it, just have to work around it
and the way you're suggesting is equally garbage.
nope
been doing it a long time
its called client prediction
its built into UE4 CMC
Fortnite all weapons fire on the client, server is the only thing that applies damage. Same as overwatch, and mostly all competitive games.
π
Same as movement, its all predicted
players want instant response, having a delay before they get an action is terrible
and having actions mean nothing is also terrible
sure, rubber banding and missed shots is a pain, but its better than you shooting then die without seeing your gun fire.
it's no different than seeing your gun fire and them not die and then you die.
it amounts to the same thing
if both options are shitty don't act like one is better than the other when it isn't.
hes saying its better to just make no input register until the server replies
he saying not to use client prediction at all
at least a correction can come across eventually sheesh
why would companies spend money and years of dev work on prediction and stuff?
Don't put words in my mouth.
I've played games that have both and they're equally crap unless you've got a AAA company behind them can afford local servers for everyone.
even with local servers
that "rail gun" to ping ratio
there is latency!
haha
still have to go through a server
predicting damage is also terrible
Civ latency makes me cry
seen games where you see them get damaged, then half a second later, boom they have full health π
how is latency linked to gamethread?
maybe runing on a 3090 being devved for apple
o_0
latency comes from everywhere but yes... net latency comes after the stat unit/fps/ai and general overhead
but most RTS games even local can feel like dog poo
no its not
i mean if your gamethread is at 100ms or something sure
then it may not push net updates
but overall feeling of responsiveness is
but latency we are talking about is the client <> server
yes specifically yes
I might have misread the comments and thought we were getting off on general game performance
but yes they all play a part performance is also key
faster those RPCs and Netupdates go out, the smoother also
but your biggest bottleneck for client <> server is always the connection, and distance from the server.
quick question about replication, if i set a variable to not replicated can the server access it and change it,the variable is in the player pawn, I am trying to have it not share with the client.
ofc
anyone can change
a replicated actor exists on server and all clients
(well kinda, but in general)
ok if the client doesnt need to know the values of a certain variable
net relevancy plays a part in that
if its server only and only used on server, you can wrap it with #WITH_SERVER but everywhere you use it must also wrap it.
else just leave it not replicated and only change it and read it on the server
I created my own OnlineSubSystem as a Plugin, put it in the plugin folder... now when launching the client cant find that subsystem
LogOnline: Warning: OSS: TryLoadSubsystemAndSetDefault: LoadSubsystemModule([OnlineSubsystemEthos]) failed
LogModuleManager: Warning: ModuleManager: Unable to load module 'OnlineSubsystemEthos' - 0 instances of that module name found.
Is there something Specific I need to add it to the search path or module loading path?
@dull lance I guess there is no detailed documentation on this.. you will have to explore GAS β½ system to get full understanding of batch rpc
I feel like I spend more time reading the multiplayer discord channel to learn things than I actually spend working on my game these days... Help.
any idea why OnRep_Pawn inside the PlayerController class is getting called twice per client? I wanted to use that as a place to call a Blueprint Event for clients to set up their UI, but i'm getting duplication. every client calls it exactly twice at the start of the game
nvm, i'll use AcknowledgePossession instead I think
hello I asked yesterday but I went offline
how can I save replicated values from a level to another with blueprints?
I didnt quite understand the thing with saving into playerstate
@shadow schooner what kind of values you want to save?
Are they fundamental types or custom types?
Just declare.
UPROPERTY(Replicated)
int Level.
Inside your PlayerState
Guide to using Replicated and RepNotify Variables in Blueprints.
do this in PlayerState
for each player they will have their own variables in their PlayerState
every player have their own copy of player state
and I have the variables I want
and I have this
but when I servertravel every variable value for every player sets to default
i guess no
it is
then he can do it
yes right
just copy from current player state to the new whatever you like
just set your variables value in NewPlayerState and you are done
and make sure those variables are exposed to blueprint too.
class MyPlayerState{
UPROPERTY(Replicated, BlueprintReadOnly, EditAnywhere)
int kills
}
something like this
this question doesn't have any context
good balance of blueprint and code is best, but i would personally recommend doing all network code in c++, as blueprint has very few tools available
and how can I learn replication and networking better in depth. Only from the docs or there are good tutorial,videos or even powerpoint presentations?
@shadow schooner always good to check pinned messages on channels when looking for resources here
but isnt that doc supposed to be a little bit outdated?
oh okk
It could be a littttttle bit outdated, but this are mostly the basics and they will probably never change.