#multiplayer
1 messages ยท Page 295 of 1
I think a lot of strategy games used to do it, age of empires and the like
Diablo 1 was P2P
The original mw2 was also p2p. I have flashbacks from the host migration
If there's host migration then it's not p2p. Thats a listen server.
The idea of someone being the "host" is the giveaway. They are acting as the server in that scenario.
P2P basically means that everyone is running their own simulation of the game and sending all relevant data out to everyone else.
There shouldn't be any interruption in the gameplay at all if any player leaves in a P2P setup.
Oh :0
What is nice about host migration is that the game that was playing isn't just abandoned completely when the host leaves.
It just picks someone else, and everyone reconnects to them.
Unreal doesn't have host migration that I'm aware of ._.
Not out of the box
Its not something trivial to add either.
Plenty of things are only done on the server. So linking that up with a client is a tall ask.
Basically everything has to be replicated to everyone all the time @_@
I don't understand why mw2 went with listen servers over even community dedicated servers
Cost
Because Bobby likes money.
That would be why
I would have thought the cost is comparable to just doing dedicated support since you are doing the multiplayer work anyway
The less money Bobby would spend on the game, the more of a bonus he would get.
The older CoD games were all Dedi Servers, with some "Official" servers
Mostly community servers
CoD was gaining in popularity
And so was the MP side of gaming
Due to incraesed speed of internet
They had to make a choice
GTA5 is P2P, hence the stupid amount of hackers in open online play.
anyone idea why client1 is not set correctly? it does not have input or correct camera view.
probably not possessing pawn. Is the camera at (0, 0 ,0)?
yes camera is at 0,0,0 but the spring arm has a fixed angle
any idea ?
you're clients pawn isn't being possessed
does CMC reconciliation prevents speedhacks and teleport cheats? or it is only for packet loss?
listen servers actually, there was a host player
and it didn't use P2P as a transport either, you had to have ports open or upnp enabled so that your NAT type showed as "open" for even a chance to be host
Wasn't it listen servers on pc too? I'm sure one of them was.
Yes
Listem server setup was 100% what they were cause host migration makes no sense in p2p
assuming my initial speed and max speed are the same in the projectile movement component, if i multiply that by the elapsed time i will get the distance traversed in a frame right?
I couldn't remember if CoD4 has host migration or not. I knew MW2 did.
MW2 had it on PC to much everyone's dismay
MW3 had a weird system where it had listen server matchmaking but unranked dedicated servers (people later figured out how to make them ranked)
But pretty much all CoD games have been dedicated servers for the last decade or more on all platforms
how CMC handles movement of player on listen server?
first predicts own movement and then simulate it resulting in two identical operations ?
As in for the host?
Pretty sure it just happens that 1 time.
Theres nothing to "predict", or "compare", you are the server.
i want to cancel reload through CMC (using sprint flag), so client will predict the cancel (stops anim montage) and server needs to send multicast to stop animation on other clients
so will UpdateFromCompressedFlags trigger for player on listen server?
i need to learn more about CMC, so far i dont know what i am doing
also does CMC trusts user timestamp/deltatime or server is calculating own deltatime based on time when moves arrived?
i would take a look into the character actor / CMC on how bIsCrouched is set and do something similar with a replicated bIsSprinting flag and have the animation blueprint handle playing the sprint animation with a state matching or something based on that value
Probably not the brightest of ideas, but anyone know how to replicate an actor A spawning inside another actor B which then A attaches itself to B?
I have it working, but on client, it occasionally shoots itself out in a random direction before stopping, staying on that fixed distance away it's intended position. I've tried to make "A" and "B" just how 0 collision enabled by default and it would somehow still happen.
Before this, I've tried to, at runtime, call SetActorEnableCollision(false) and still no luck.. I assume SetActorEnableCollision() replicates since without calling it, the client is able to interact with the object at its client position.
Oddly, the one with greatest chance of it working was creating my own replicated variable and OnRepNotify() and OnBegin(), disable the collision locally, however, it still occassionaly fails.
Though in all honesty, the one that works the best would be to just call AttachTo() on clients, which I used to do, but when I looked around, it's said to be able to replicate, so I started messing around with not doing the AttachTo() on clients
Attachment should be replicated, so if A is replicated and attaches itself to B, it should handle that locally. If it breaks even with collision off, then it's not collision related. What does "shoots itself out" even mean here? Isn't wrongly placed or literally simulating physics and flying away? If it's physics, you might want to disable that until the Actor is attached. You can override OnRep_AttachmentXYZ (I can't recall what it was called) inside A and handle enabling collision etc. there maybe.
What I mean is that for a frame or 2, on clients, I see it in the position it should be, but after that, it randomly offsets itself, only visibly on clients.
It'll still move like an attached actor should, but it stays fixed at that offset.
I can detach the actor and re-attach it with a button, which goes through the same code path as when I attach on spawn, but it would still sometimes not show up in the proper position.
On the Server, or running standalone, it always works as intended
That's probably some race-condition between its replicated Transform and the Attachment Replication. I think there was some code that fills replicated movement (read: actor location/rotation) when the actor is attached. Might be that something goes wrong there.
Although it does seem Epic is handling that case by now.
void AActor::OnRep_ReplicatedMovement()
{
// Since ReplicatedMovement and AttachmentReplication are REPNOTIFY_Always (and OnRep_AttachmentReplication may call OnRep_ReplicatedMovement directly),
// this check is needed since this can still be called on actors for which bReplicateMovement is false - for example, during fast-forward in replay playback.
// When this happens, the values in ReplicatedMovement aren't valid, and must be ignored.
if (!IsReplicatingMovement())
{
return;
}
Although it does seem Epic is handling that case by now.
void AActor::OnRep_ReplicatedMovement()
{
// Since ReplicatedMovement and AttachmentReplication are REPNOTIFY_Always (and OnRep_AttachmentReplication may call OnRep_ReplicatedMovement directly),
// this check is needed since this can still be called on actors for which bReplicateMovement is false - for example, during fast-forward in replay playback.
// When this happens, the values in ReplicatedMovement aren't valid, and must be ignored.
if (!IsReplicatingMovement())
{
return;
}
Maybe you have replicated movement enabled?
I do indeed have replicated movement enabled. I'll try disabling it to see if that works
Disabled the replicates movement and it doesn't seem to help much...
This right here is what it's looking like with the editor being the server... I also tried doing the detach and unattach, but it seems I'm getting lucky and the bug isn't getting triggered
What version of UE is this fix on? I'm looking at my Actor.cpp file and that's not applied on 5.6.1
How to prevent delta time inflation exploit in CMC? I can just set high SetGlobalTimeDilation on client and CMC server allows this client move faster...
found it, and i am really surprised this is not on by default:
bMovementTimeDiscrepancyDetection
probably because it costs
Question: I have an ability that is running and it is getting called on client and server (for montage purposes), i have set it to spawn a projectile if it hasAuthority, the projectile is set to replicated (tried every single flag possible) and set it to replicated in code as well, but it wont spawn for the client, works fine if you are the server and replicates fine if you are the server, but if you are the client it doesnt even create the projectile server side at all? i included a print string to show its getting called on both the client and server, anyone got any ideas?
i did try changing the function to Server, Reliable but had the same issue (and my montages stopped working client side)
the projectile has these three but i have tried also ticking all the "replicate component" ones as well
hmm i added an output to finish spawning and it is returning the actor? hmm
all the locations are correct
Pretty inconsistent on the coding standard there, but the only thing I'd assume in this instance is that whereever that HasAuthority() block is, is never hit on the server from a remote client
haha im never consistent, i will clean it up once i can actually get it working ๐
I have put breakpoints in the c++ code inside the has authority block and it is getting hit so I am not sure its getting blocked
i stuck this on the character class as well just to rule out ownership issues
I'm not sure why you commented out the p->FinishSpawning line, the UGameplayStatics function does the exact same thing
i guessed it would but i saw it in a post and gave it a go on the off chance
you need to F12 a little bit more
does the actor spawn at all? is the transform actually valid?
the transform is valid, when using it from the server as server it matches pretty much as if i was running as client (ever so slightly different as i dont quite always stand in the same spot but it defo is the right location)
as for spawning at all, when i create it i had the outliner set to filter for it and it doesnt show at all so I am assuming even though its created its never added to the world
but that might not be true if the outliner is slow to update?
I would not use the outliner for this, I'd probably use some kind of debug print or breakpoint
if you use play as client, so no host player at all, is the block hit?
yes, put breakpoint on finish spawning and i have been playing as client
its super weird, not had this issue with any of my other multiplayer stuff for years so i must be missing something obvious
nuclear option: always relevant
I set lifespan to something stupid like 100 to make sure it wasnt a timing issue
if it still doesn't show then, there must be something else fundamentally wrong and it won't be because of net culling
yeah, ok, i will switch to calling this function on a keypress directly and see if its something further up the chain
also it may help to have some debug visualisation for the start pos and the direction
will see if i can get it to drawn a debug sphere or something on the points
hmmm calling the function directly on keypress works and spawns it but the target location/direction seems completely wrong so will look into that first to rule that out as the main issue
looks like the camera location and rotation was off for some reason so pulling it from the camera manager instead and that seems to work, just testing all sides to confirm if that was the issue
ok, so that fixed the replication issue, very weird behaviour from the clients camera, going to the camera manager was getting the right locations, not sure why the rotation would be different on a client but hey ho thats solved that
i now have an issue with the niagra bullet trail, its straight on the server ,wiggly on the client?
seems like the velocity parameter isnt getting replicated properly, hopefully simple fix, something i can work on ๐ thanks for your help, seem to have gotten to the crux of it ๐
Can any help me understand how I would RPC from a widget? For context, i have a button that pauses time (not time dilation) and calls the relevant 'Call on Server' event on a replicated component (placed on the game state). This however never gets calls on the server when clicked from the client.
I assume its my understanding of ownership (in relation to replication) that's tripping me up.
You can only call RPCs on replicated actors or their components that are owned by the client. Unfortunately because your component is on the gamestate, the client cannot call an RPC on it as it wouldn't be owned by that client.
Typical RPC avenues for clients are their controlled Pawn, PlayerController and PlayerState.
Any other actors you mark as owned by one of these actors would allow the client associated to them to call RPCs on those actors.
Teeeechnically
The components don't need to be replicated. Just name stable. You can RPC through a component that isn't replicated as long as the actor it belongs to is. Fun weirdness.
So to make sure I understand correctly, there's no way to RPC to the game state (and its components) directly and instead would require some sort of intermediary owned by the client to take the RPC and then call the relevant function on the server?
Correct
if it helps you can use actor components to split the code up a fair bit
for example a component on the player controller
When I do a system, usually have a ManagerComponent somewhere like GameState. Then my PlayerState or PlayerController houses an Agent to the system. Agent is meant as my player's control into it, RPCs, etc by talking to the manager on the server. Manager handles the general system state.
That's what I was just thinking. Kinda like a company component.
So for my example, there's not actually any point having any 'Run On Server' events in the component placed on the game state as they can never be called. (meaningfully that is)
So instead I would do something like Btn Press -> GetCompanyComp (from something related to the player) -> Call RPC function -> GetTargetComponent (on game state server side) -> Call desired function.
Yeah pretty much.
This is one of the reasons I stopped using the HUD class overall
Because I was just having to route UI network through the player controller anyway
So now, my PC is pretty much my HUD. Be it through a component or the PC directly (small games, I don't really care)
Yea it seems to do the trick. Just trying to figure out the best way to dynamically add the companion component without causing issues. ๐
I've been able to do it using the PostLogin event on the game mode but i'd like to have the original component add it but I'm not sure sure how I might do it yet.
I'd just put the component on the PC and GS directly. And just build it out normally.
Don't know why you need any kind of dynamic stuff.
So like - UHudControllerComponent and put that on your PC. Then route your RPCs through that.
You'd just write it to be specific to your game
That is one way but if its dynamic it can add it when needed and also saves me having to add it to different controllers and/or player states. Although I am starting to think the juice isn't worth the squeeze. ๐
Just put the component on the base class
I don't really have my playerstate control anything or route anything from the UI. All UI actions get routed through my PC in some way.
Just how I go about it.
ok so im trying to think of a design choice here, Bullets/Projectiles, I have them for most weapons, and while they replicate now they are a bit janky client side. I have seen various routes for this but unsure what is the best option.
Mine is a 4 player Co-op with pistols/assault rifles/shotguns/ grenade launchers
I used to just do line trace for pistols and rifles and the shotgun spread but it wasnt visually great for clients so switched to projectile movement actors. grenades bounce around so defo need those as they are. Just trying to think what would be best optimization for 4 players spamming assault rifles? could be a fair few bullets the engine would need to replicate?
I have thought about doing object pooling for spawning but havent implemented it yet, some people say to line trace server side and projectile net multicast client side but not sure how that would work when it came to corrections etc?
its probably an old topic of conversation, just would like some opinions for optimization purposes ๐
the addition is its a space survival game so i ideally was thinking of swapping the standard bullets out for fancy particles or lasers etc
Are you asking for net optimization or game optimization?
i suppose net optimization, ill probably use an object pool for game optimization
You can start by just thingking the minimal ammount of data to exchange.
And probably get into bit field as well.
You can pack a lot of state in that.
E.g if the shot is a head shot, critical, etc.
not really looked at bit shifting/flags in unreal, anything particularly different?
from a standard c++ perspective
Different to what? If we r talking about net optimization, instead of sending struct data, you can just send 8 bits of binaries each one representing a state.
You can save a lot of bandwith given the right context.
i meant is there any special syntax that unreal enforces for bits, macro tags or anything like that ๐ ill have a google
maybe a bit of a philosophical sidetrack but how do you call a pool of pools ?
the first rule for optimization is to measure it by profiling
and then after you are done profiling you profile it a bit more
Also might want to elaborate on whats janky.
maybe go back step 1 if step 2 shows that you need more profiling
Step one is to find the root problem. Not quiet sure what client side feel janky suppose to be.
just do client side raycasts for hit detection if they shoot at something
easiest way to make it feel correct
Btw if its a co op game habe more liniency for the client. If they r not super lagging just trust what the client says.
Every shooter game afaik competetive or not still trust the client to some degree.
the replicated janky is movement, i am using projectile component, server it fires straight and true, client the replicated one keeps jumping sideways a bit and back again as it travels forward, almost like correction lag? but all the time
if you have to ask how to do it you wont make server auth feel right
Server just validate if the shoot is close enough.
if you have a rubber banding issue its either your server that is dying or something else that fucked up
Im not deep into my combat.
Atm my projectile on the client have 2 version. One that is locally spawned by the predicting client, the other being the one replicated from the server.
i spawn the projectile at location, rotated to target and let it fly off at a speed for a lifetime, I cant imagine rubber banding would happen as it is such a simple request?
For the netcode, i just tell server as client which direction im shooting at.
Server just spawn a projectile based on the direction.
why would you need to network anything more then the initial fire location?
just spawn a bullet on client
but its just purely visual and if the client hit something with his raycast you also network a damage call
i want other clients to see the visual as well, also if i spawned just on the client i would have to turn off collisions for that and probably just do line trace on the server right?
@reef ember so you are not spawning the projectile locally for predicting client?
You dont want the projectile to appear 0.2 after they shoot if the clirnt havr 100 ms.
spawn a bullet on each client for visuals
check locally for what u hit
the underlying issue with your bullet replication might be that it doesn't have an owning channel
Client shoot -> client spawn proj -> client tell server i fire at this direction.
Server receive rpc. Tell everyone to spawn a projectile on the direction the client says.
Not sure how ownership part of the equation.
doesnt it need to have one for networking or something like that, not sure what exactly its called
For what purpose
for sending data
hmmm as its a co-op i suppose i dont need to be strict on server first so that might work, the only issue i would have is i have physics objects, client fireing bullet hits physics object but not on server, how would that work?
send the hit impulse to the server to move it
it doesn't matter where u hit something
Doesnt matter co op or competetive. Shooting should be predicted otherwise the experience is really shitty.
if its server auth yes
You dont want to start seeing your bullet or walking a few micro seconds after you commit the action.
but i dont think he will be able to implement his own prediction that easily
but doesnt prediction require the same actor on the server for it to correct to? (in this instance)
even entire teams struggle with getting it right, if the ping is bad its never gonna feel good anyway
Server auth or not doesnt matter. If you want server to have the say for what ever reason, you should still predict the visual on client. At the bare minimum the visual.
Not soo much to do with correction i think. Cant imagine what you picturing.
For unreal projectile.
Client shoot client spawn proj. Server gets the rpc snd replicate to client.
The client then interpolate the position of the locally spawned projectile to the incoming proj location from the server afaik.
what i am picturing? hmm
server says the bullet on a path hits a character
client says the bullet misses
how can you predict the travelling bullet server side without having the bullet?
interpolate positions of locally spawned and incoming sounds crazy
you never know what is gonna hit and not hit with high ping
Client shoot, client spawn projectile, client tell server hey i shoot at this direction.
Server say ok, spawn proj shooting at that direction and replicate that to everyone.
Theres treshold, its up to designer.
oh so i am looking at this completely backwards
You can just go full on server check if the player ping is too much.
But when ping is below 120 ms, trust the client to some degree (or just fully for co op)
he's just giving you one particular solution
im spawning server and then getting server to spawn client versions rather than client first then server
i've worked on multiple really large shooter games and more often then you think everything is literally just client auth
with very little checking on server
if your project has less then 10k users you dont need to care about hackers at all
my game is out but currently early access singleplayer and barely any sales so trying to optimize and get coop in ๐
games with 200k+ players per month are client auth and nobody knows
And thats the problem. Have you play with ping? Ppl gonna break their keyboard fr.
to make it feel good it needs to be fast and simple
Instant uninstall if my character jump 0.2 seconds after i press space bar.
try simulating with 300 ping yes
You want to predict what you can.
In the case of movement snd attacking you want to predict that.
we had an australia preset with 2000ms ping and 95% packet loss
Also in shooting game its better to have better experience for the predicting client.
Thats why in many games you die even after you get into the safety of the wall.
Otherwise it would be a shit experience for the shooting player that did the headshot.
I thought server needed to be first for the corrections to work so fair ๐ I will do client first then and just get the visuals sent around
if the game is co op it means you are shooting at AI
never even consider doing anything more then just client for shooting at AI
Nothing to do with correction though. At least in this context imo.
U r just handling at the bare minimum the visual.
yeah mine is players vs AI
it's a waste of networking space to send anything more then the hp damage update in the ai character
and maybe a rpc call for visual effects like blood on the other clients
but that can be triggered by the health updating
I am using the GAS system so i think that handles effects quite well
(switched to GAS recently as it was better than what i had lol)
i dont want to work with any project that uses it but its a personal preference
vastly prefer my own ability systems
Soo generic and fit many gloves. Chances are ppl gonna roll worse tyer anyway.
playing an effect is literally just triggering a vfx system from code i dont need no gas for that
yeah it's too generic
the code i wrote for weapons etc was ok but very flawed when it comes to networking, had endless issues so i ripped it out
i just write a project specific ability system with minimal code and i love that every time
gas wont magically solve those issues you can create bad setups with it but i guess it might help you if you really dont know
I tend to write everything in plugins lol
so i can just drag and drop into other projects
lol
i have 4 other game projects that use the majority of the same plugins so just made sense to encapsulate the code
its fair im just traumatized by this one particular intern who tried explaining away each design decision of why he wrote horrible code with "but i want to turn it into a framework" even if it was just a single line of code he would wrap it in 4 layers of abstraction and then cut it out of the project into its own plugin
not sure why interns always strive to be the best code obfuscator ever
oh god ๐ nah nothing like that, only thing i am doing is saving me writing the same code all the time ๐
Fresh out of university. No live experience. Bad habits drilled into them. ๐
no matter how many times i write a shield component its pretty much going to be the same thing ๐
personally i would just copy the code
ive been a c++ and web programmer for 19 years, i have zero excuse for bad code haha
but we all have our days ๐
especially when beer gets involved
dont talk to me about claude ๐
ive made some of the best things ever coded when smashed on alchohol
yeah it's so horrible right
absolutely insane how much work it can save, who would consider using it
the urge to ping our local AIvangelist to spread the word of the new machine uprising
im not against the premise, i am against people blindly using it and not understanding what its outputting, you can only learn to code if you actually try it yourself ๐
had a junior at my work years ago that used to copy everything from stack overflow, OMG nothing ever worked
hey i copied this very complicated code and i tried compiling it why it doesn't work boss?
"ahhhh" thats one of my traumitized events ๐
that and code review "It works on my machine" -> they forgot to push all the code in git and I am working with their old branch
thank the lord for PCH
did u take them out of the back and terminate their service
haha repeat offenders, for sure, but i have rules now in place, dont bother me for a code review unless you have done all of these things first ๐
if you havent i will delete your branch
i had a boss years ago that always erased what you had in git stash before he started ๐ learnt never to leave something there lol
you should silently add things to the rules to keep them on their toes like make them write and record a short video essay about the coder's personality, why they think this code review would enhance collaboration in the company, and the benefits it might bestow upon them, how they felt while coding it, etc..
haha, not bad for sure, i did get a guy to write a full idiot proof documents on git rebase becuase he used it wrong and deleted 15 commits
i feel old haha
so many memories, its a supprise i still have hair and it isnt all grey yet
(same)
I kind of agree with the meme
it's probably at the tipping point where the default mode networks gets knocked off enough so you just surf code without the monkey interrupting all day
Yep, but only works once in a while, even if you have the precise dose, taking it each day does not work ๐
Hey, I'm using actor components where all my logic happens, and when the actor is destroyed I want to do cleanup on both the server and client side (I'm using a listen server). However, this event on the owning client doesn't happen except for the client who is also the server. I know it's because I'm calling it on destroy, because if I call this event before destroying the actor then everything works fine.
Is there something I can do about it, or do I have to change my cleanup logic so it doesn't rely on "destroy actor" to finish this item?
that rpc says it is replicated to the owning client, it might need to be multicast here
Endplay may be too late to send an RPC, and, yea, unless that actor is owned by a client, then sending to client won't work.
If you call it upon destroying the object why can't you just react to it also being destroyed on the client?
that way it won't randomly miss
Client owns that actor, so it's not an issue. It works fine if it's called just before EndPlay, so yeah, it's probably too late. I didn't react to it being destroyed on the client either, mostly for convenience, because this event might also be called in different places and at different times. But you're right, I should call it on the client EndPlay as well rather than relying on RPC
I've read about replication and watched a few videos and most sources state that you should not use RPCs whenever you can get away with it.
In cases where the server needs to send data to a client (and it is only ever a one way communication) I just use a replicated property.
I've defined these as FFooPayload, but I've run into a problem that somehow (maybe due to defensive programming) I've just ran into and realized.
These payloads are replicated initially with all default values to the client(s). One solution I was suggested was to add a bool to these payloads (bInitialized) and check that in the replication callbacks before acting upon them (so I know when the payload is actually sent with valid data).
This kinda feels like a hack (the whole replicated property for these essentially "RPCs").
I was wondering if there's a better way and would love to hear the input of people with experience on this subject.
Can you give one sourcw that says you should not use RPC "when you can get away with it"?
That doesnt make the slightest sense when RPC is the only way for client to communicate with server.
Ofc there are times where people dp war crime with RPC.
Because that's a case where you can't get away with it.
Like updating variable that could have just been replicated.
Im asking for a source. It just sounds like someone hasnt got the idea about RPC.
I think it was a YT video about replication or maybe a blogpost. I've read it a few months ago, but it stuck with me.
I can try to look
The source also covered RPC's and talked about when to use what
Well in the case of YT video especially the multiplayer bp tutorial. 90% of them doesnt even do it correctly.
And they just copy paste each other mistake.
I'll try to dig it up for you
@austere mauve I wouldnt care about it cuz im gonna ignore the idea anyway.
Its just a wrong statement to make.
Okay, so to answer my question. I should just use RPC's for that specific case too?
It varies.
Data related to timers.
Data related to drafting cards (server sends x options to choose from client answers with what it choose). This example I know I need an RPC for the client->server, but for the server->client currently I use a replicated payload property.
Specific context is needed.
Lets talk about the timer. Is there a reason that you need to constantly update the timer from server to client?
Do time get added or deduced?
If not you can just have the server tell the client that the timer has started then client can just deduct the time on its own.
Also why would the client initate the timer?
Wdym client -> server for timer?
That sounds like a design problem to me. Timer should be auth by the server.
The timer is kinda complicated. I just replicate the data for the initiation of the timer. I calculate remaining time before starting a timer on the client and then start one there too.
So a timer runs on both the server and the client.
It's server authoritative and I could write a whol ass paragraph on how it works if you want me to get into specific details.
TLDR:
- I send the absolute minimun data required.
- I do not replicate each tick of the timer (or any).
- It is server authoritative.
- Client and server both run their own timer.
- Clients don't initiate a timer (as in client tells server to start one. The server always is the one initiating it.)
So any specific issue with the timer?
The timer is actually working perfectly fine.
I would just like to do things right.
I want to know if the way I do it is a hack or a proper acceptable solution.
For the record and anyone reading later.
I will keep using replicated properties for these stuff because:
- They handle DC & reconnect persistence for free.
- Using an RPC here would mean if I want to solve DC & reconnect I would need to set a replicated property anyways, so I would just add unnecessary complexity.
I will only use RPCs for stuff that are only relevant to participants who are actively connected at the moment of firing it (I guess that's how it should be used anyways).
I wanted to ask for a sanity check. The whole logic in MyGameMode should never be included in Client build. So I put MyGameMode into server only module, but then it's pain to exclude BP_MyGameMode from client cooking as it's referenced by the MyLevel -> GameModeOverride.
Should I move it to shared module and hollow it out using #WITH_SERVER_CODE ? But then if server-only logic is added to BP_GameMode, it still get's shipped to clients... Been stuck on this for days
Putting the entire game mode in a server-only module sounds bonkers
#if WITH_SERVER_CODE in function bodies is sufficient
void UCyExperienceManager::Initialize_Server()
{
// The server attempts to resolve the schema from the world URL/CLI/WorldSettings/etc.
// Clients wait for the schema to be replicated from the server instead.
if (GetOwnerRole() != ROLE_Authority)
{
CY_EXPERIENCES_LOG(Warning, "Called on client. Initialization will not proceed.");
return;
}
#if WITH_SERVER_CODE
CY_EXPERIENCES_LOG(Verbose, "Starting server initialization.");
CY_CHECK(
!SchemaBundleHandle.IsValid(),
"This should always be invalid when initializing. This indicates Initialize is being called twice.");
const UCyExperienceSchema* NewSchema = ResolveExperienceSchema();
if (!IsValid(NewSchema))
{
CY_EXPERIENCES_LOG(Warning, "No Experience Schema found. Experience system will not be initialized.");
return;
}
Schema = NewSchema;
// Load schema's bundles
CY_EXPERIENCES_LOG(Verbose, "Loading schema bundles...");
SchemaBundleHandle = Schema->LoadGameplayBundle(FStreamableDelegate::CreateUObject(this, &ThisClass::OnSchemaBundlesLoaded));
#endif
}
Most of my server-only functions look like this; guard clause at top then the rest of the function is a no-op on client builds
But considering that the client should never create it, it feels like prime example of what should go to server only module. Same goes for GameSession.
In the most literal sense you are correct, but splitting it out into a separate module and/or ifdef-ing entire classes and functions is a quick way to make sure nothing ever compiles
IMO it is enough to make all of the sensitive functions no-ops
Yeah, thanks for the sanity check. Need to be careful that BP_MyGameMode or BP_MyGameSession doesn't pull in more assets into client build.
Those BPs might be lean, but if they pull in bunch of other server-only bps it can grow the build.
Btw, is there a way to exclude assets dir from cooking for specific target? For example ServerOnly folder that never cooks for client?
Not sure, haven't had the need to do anything like that so far
I'm not sure if that's even a good/common approach tbh
I can't think of any assets in our project that would be dangerous for a client to get their hands on. Clients have very few privileges to just beam data up to the server in the first place
I would say it's partly is about the security, not leaking how servers register, the endpoints etc. Which yeah, security by obscurity is not the best approach but it's another layer.
But party is about not including in the client build server only assets. Each MB can count for client builds, expecially on Mobile so I wanted to have a clean separation of what goes to client and what is server-side only.
I think it would be okay to have something like that.
I will do the same for debug stuff (debug stat editors and such). I put all of them in a DEV folder and will exclude it from shipping builds.
You can easily exclude from shipping builds, but I don't think there's any easy to to discriminate a client versus server build here
Things like endpoints/urls/etc, my approach would be to use environment variables anyways, not assets
This way you don't have to send a game update to your dedicated server.
Also makes it way easier to use with docker.
Dedicated server .ini files are probably my approach. But it still feels there should be a clean separation...
I did try looking some stuff up on that, but I found this article saying that RunUAT does not propagate INI file overrides: https://medium.com/disruptivegames/config-injection-during-unreal-engine-4-builds-87e02b7ecc09
For size have you checked if it's actually a problem to include it?
For security you could extract critical stuff to your .ini files and fill in the rest of the sensitive logic with dependency injection.
DedicatedServer-prefixed inis are an option and you can use CustomConfig (with a native project) in the server target
The size is probably not a problem now, but it will result in me constantly having to check what is each game mode pulling in as the project grows.
I will try to keep it separated for now and will report back with my findings when I give up. Thanks folks
okey, my heads bleeding... this is cast from a player controller its suppose to create a widget for all players
but its not working ! ??
Because you are not iterrating over all PCs and asking them to create a widget. You are saying to all PCs that a specific PC should create a widget.
Second issue is that PCs are replicated only to the owner, so that multicast get's always replicated to 1 PC, regardless of how many PCs are actually in game.
Try on server-side a for loop over all PCs and call client-side event on each of them to create a widget.
Or even better, replicate a variable "bShouldShowWidgetX` and if that becomes true, show widget. If it becomes false, hide widget.
your right... im dumb ty
Multicast in controller is useless.
Controller only exist on the server and owning client.
@queen escarp also i dont know about using rpc to start a timer.
Wat about player that drop in after
yeah its not a "timer" its only a widget that use an animation,
you wont be able to join after timer starts
It does say count down though.
yeah but its not a timer, its a widget playing animations that act as a cd xD
i just did it quick, might have to redo it so it syncs
This is my zone here!
Multiplayer Twin Stick Shooter Example on GitHub - Create by @rough iron
https://github.com/moritz-wundke/MPTwinStickShooterWithUE4
Blueprint Multiplayer Tutorial Series by Epic Games including basic Lobby, Chararacter Selection and Chat
https://www.youtube.com/playlist?list=PLZlv_N0_O1gYqSlbGQVKsRg6fpxWndZqZ
Thx ๐
๐ป
Network Compendium | 100+ Pages to get started with Multiplayer in UE4 | Current Version: 1.4.0 - Created by @thin stratus
http://cedric.bnslv.de/unreal-engine-4-network-compendium-released/
Example code for Sessions in C++ - Create by @thin stratus
http://cedric.bnslv.de/sessions-in-cpp/
Person to ask would probably me @slate topaz
this is my home
@thin stratus heads up, you can only pin 50 things. So don't go pin crazy
hahaha
This rocks Cedric, Thanks!
(: No biggie
This is my swamp
We forgot to set ourselfs to replicated
Hey everybody, I was wondering if any of you could help me with an issue I have been having.
Pretty much in this game we fire a projectile that doesn't use the ProjectileComponent but just a StaticMeshActor. Right now, there is a bit of lag when a client fires the actor (Server runs fine). I have tried increasing the NetUpdateFrequency's but there wasn't much of a change. Is there another variable I can adjust that might have more of an impact or some way to fire the projectile locally and correct once on the server? I am using blueprint, also.
wait you are or aren't using projectile movement. I'm a bit confused by your post ๐
@fiery jetty either way, if you are telling the server to spawn the projectile there will be a lag. If you want you can spawn a non replicated version on the clients side as a part of your local firing FX
@thin stratus I was there, I just didn't answer much because the last time I did the guy I helped got mad that it wasn't the answer he wanted.
I can't use projectile movement. I will look into it more, but if I shoot the actor locally, it doesn't show on other clients
the local one would just be for visuals for the local player, then the server tells everyone else to spawn a projectile, and spawns one itself which does the stuff. Bit curious though because projectile movement might be hard to do UT has its own specific movement code for it
Sounds like you don't understand basic replication in UE4. You should go read up on the docs and also read http://cedric.bnslv.de/unreal-engine-4-network-compendium-released/
It's not an issue of replication, but how I would get rid of latency when waiting for the server. What I am shooting is a bigger object and it feels clunky waiting for the say 200ms round trip from firing the obejct, waiting for the server to fire, and then recieving the update that "Yes, we have fired an object"
yeah then you probably just want to spawn one that isn't replicated locally, but have the server define the hits. No real way to overcome latency unless you want to make it client authoritive
no, that is not true. Don't listen to that
That is totally not true
at all
Sam, first off. You should be using projectile movement as it will save you a lot of time. Second, you need to spawn it on server (which you are) Don't ever, ever give client authority on something like that
ever
there are exceptions, but in your case. Just leave everything to the server
What I am firing is something like a car or a big box. I want to be able to interact with the object after it's fired too
depends on how you are making the game, borderlands uses client authority iirc, but the best way is to fake it on the client and have the server define the final results
That is because borderlands is a P2P game lmao
With projectile movement you can't do something like adding force to it or pushing it around. Plus, it gives a fake result when dealing bigger more realistic objects
yerp so depends on how you want to do the game, or how "secure" it needs to be
otherwise simulate on the client and let the server control important stuff
Even borderlands still handles damage on the server. Which is the client because it is P2P.
you don't want to handle that kind of stuff on the client, it'll just come back and bite you in the ass
If you are spawning an object that does not have projectile movement, but is simulating physics on multiplayer it gets really difficult @fiery jetty
Best thing to do
Rama wrote some physics code for this type of thing, but again it is client authoritive
actually
try this first
Allow the client to spawn/move the projectile, and just have it ask the server if it can do it.
Don't let the client control it
but give the client control while being on a leash
What you are trying to do is not easy. We all know how good UE4 is with multiplayer physics
Out of curiosity, I didn't really think about it yet, but do SM with physics have replication values, e.g. set a physic barrel to rep and every client sees the proper location of it on their end.
The client can spawn it, but only if it spawns on the server do the rest of the clients see it.
@dusk granite I actually got physics barrels working pretty well with a hacky solution, using a projectile movement in them with 0 velocity, but simulate on the SM, it does keep the barrel position updated on all clients.
Though I would not have too many of them in a level...
If I spawn on both locally and server, the one locally is skewed due to the physics not being deterministic. Plus with something like a car, it collides with the server one when it spawns in later
@heady delta neat, I might have to delve into that sometime soon, would only need this or one or two objects anyway.
The way UE4 handles network movement is it does the movement on the client, does the movement on the server, and then syncs the two together where the server always wins. You can see how they do it in CharacterMovementComponent.cpp. It is pretty kewl how they create a queue of moves and then play them on the client and server. This is also what powers their Network Replay functionality. And you can create your own custom server moves!
This seems like a crazy hack, but I wonder if you could use a Character as projectile and then use a custom movement mode with your own custom move actions.
It would be better if they took the network move functionality out of CharacterMovementComponent and made a generic component you could add to any actor.
why the fuck would you do that
@glad knot character movement doesnt work unless a controller is assigned to it ๐ฆ
yeah, a ton of network stuff doesn't work without a player controller ๐ฆ
It is one of the most common issues I run into.
I wanted to have players be able to control vehicles whilst still controlling a pawn, that solution did not work for that reason ๐ฆ
I do think it would be kewl to take the awesome network code in the CharacterMovementComponent and make it usable on other actors
The whole movement synching and move queing is really well done.
I used it for large boats, ๐
kewl
I used it for a climbing system, so I had to add my own custom moves to the movement queue.
I sexually identify as a single, pringle, ready to mingle
wheere is that monkey emoji...
@sand juniper I secually identify as a noob UE4 programmer.
emoji FTW
Well, first, I might try to do something like spawn on the client and when the server version spawns on the client delete the old one. The server would have to guess where the clients version would be 100ms per say after it was fired though
discord emoji game is weak...
@stiff wasp I sexually identify as Allar, king of Unreal 4 :D
Allar is hero of the peole
Why are you doing this?
@fiery jetty what are you doing exactly, like spawning pickupables? a bathtub? describe the thing
I want to interact with something like a car and shoot them
I sexually Identify as the ghost pirate Le chuck.
@sand juniper >.<
if what you're moving is gameplay important, like everyone needs to know the exact location I'd say do a hybrid. The client tells the server it's starting to move it, the server does all the calculations, and the client simulates it on their end to save on replication data, but the server sends out a PROPER location every so often so that the client gets the real location but just not the whole time as it's simulating the rest. Pretty sure that's how the rockets from UT worked back in UT2k4 days
@calm hound UE4 does that naturally with the actors from what I can tell, but it's specifically the spawning where I NEED to wait for the server to spawn the object. With something like movement you can do the input locally and the server corrects it. I can't call SpawnActor from a client because other clients won't see it.
.>
As far as I know from looking at the engine code, Actors and Pawns do not contain the code for smooth network movement.
Them replicating isn't the issue, it's the 15ish frames of latency it takes from clicking the mouse to it actually spawning feels unresponsive.
yep, it does... I agree
and you should really be testing with higher packet lag.
I use console command PktLag 200
or sometimes even PktLag 500
I have tested with somebody in Austin and I am in Chicago
what is it you're trying to accomplish? SpawnActor() has been said to be very slow. So some work arounds have been to do a sort of recycle system
for example, if you were to spawn a bunch of bullet casings when firing a gun. Instead of calling SpawnActor() 150 times, you spawn a handful and then use what was already spawned and cycle through them to constantly to make it look like you're spawning that many when in reality you're just changing its position and some variables which is quicker
could pre-spawn the object, and then just show/hide it when needed
^ the solution you should look into
Hm, yes that could work.
If its always the same mesh you can just throw it somewhere under the map to be spawned on beginplay
So just deactive the object and then when I need it setlocation and velocity?
exactly
Hmm, alrighty! I will tell you how that turns out
the problem with SpawnActor() is you're literally spawning it, then replicating ALL its variables to the client that are considered dirty. So it has to do some processing. If it's already spawned, all you're doing is replicating a single variable of "show me!" or "put me here!" rather than all of that, PLUS everythign that makes up the actor
Yeah, imagine doing that with a saved game
which is why most games now a days have issues with saving, because it's trying to sync with the cloud every step of the way. It's a lot of bandwidth and thinking back and forth
Aye, and that was what I was GOING to do in my very first full Multiplayer game...
However, I've taken a step back and thought about a few things, because the design of such a system may not be in my best interests ๐
Usually not. I still think you should design games as if the world isn't connected to fast internet 24/7.
trying to just brute force everything through the line isn't usually a good solution, but it's what most people try to do now a days because "it can handle it" mentality
Aye
I am a thinker
If something doesn't feel right, especially after quick prototyping... I take a grand look at the whole project one more time to see if it's truly a neccessity
I wouldn't use that
As an intro
There are a lot of official docs that I would say you should read first
intro to UE4 networking
ah ok. just official docs from ue docs?
Setting up networked games for multiplayer.
Then read all of that
And read Cedric's stuff
Which is pinned
But start with the video series, but read the official docs too
It'll answer a lot of your questions
that tutorial isn't bad. It gets you into the idea of replication. But it's a lot to digest when you don't understand what you're doing
shootergame is good to look at
ok great. thanks for the links and refs
@thin stratus hmmm, would it be possible to put version number to your PDF announcements? ๐
I know I go poll that fill every now and then to see if it's been changed
was thinking pinned message and your site page
I don't think either has one
I haven't even seen the forum post
Daaaamn, i'll fix it
it's not a big deal, would just be more convenient ๐
Should be fixed in all 3 places
nice! thank you
for change and actual PDF!
oh wow now I see that you just updated it as well ๐
Only a small change
As my PullRequest for the PlayerState Functions went through in 4.13
nice
hi guys, Im back with more stupid questions :)
in multiplayer, how can I differentiate between 2 players? I understand there is a difference between server and client, but Im looking for something like an "array of players" if that makes sense
If I'm not mistaken, there should be an array of controllers that are connected
(player controllers, just to avoid confusion)
No array of controllers
The Client only has his own Controller
And the Server has all of them, but not directly group somewhere
But what exists is an Array of PlayerStates
You can find that in the GameState
PlayerStates as well as GameState are replicated
So the PlayerState is the place where you want to store Names, Score, etc
Each Client and the Server can acces the GameState easily as well as the Array and then also the PlayerStates
so easily usable for a Scoreboard or whatever
@pliant cypress
It should also have a unique ID per PlayerState, but that is session based on not unique for reconnecting
So if someone leaves and comes back later, the ID will be different
Ahh nice I need to implement reconnects
Hey! I'm currently developing a multiplayer game, that has physics-driven gameplay. If anybody has some experience doing this, I'd love to hear your thought on this approach: https://forums.unrealengine.com/showthread.php?122241-Physic-driven-gameplay-over-network&p=591745
Hello folks!
I am on this topic for a while now: Correctly networking our gameplay, which uses physics based movement. I started out creating my basic multiplayer setup, including an online testing environment using Steam, then tried to fit our game to work in a networked setup.
The game: Basically airhockey, where the player controls a paddle and needs to hit the puck to hit something with it.
My problem: I ended up with synchronization issues between the clients, meaning that the
is there any released physx simulated ue4 game that actually does physics networking properly?
by properly I now mean no lag and no instant server corrections that make things just jump around
Hmm... Rocket League?
not ue4 game
custom networking solution, no physx
as far as I know, unreal doesn't do physics prediction out of the box
and if you need server authority, you'll get lag
Hm, I wonder how their custom solution looks like
Yeah... I started the problem with the mindset "can't be so hard, right?" .. then, as I learned more "hmmm... might be tricky"... and now I'm like ... "well, have I gotten into?!"
๐
I plan to implement this myself: http://gabrielgambetta.com/fast_paced_multiplayer.html
but it involves custom physics integrators and bypassing physx mostly on my case
got the physics engine part running already
From my understanding, I think Rocket League uses custom physics
it's similar concept as what ue4's character movement component does but needs more precision
as chars physics are way simplified
ok. Would like to hear more about your progress! Do you update a forum topic or similar?
I read an article about rocket league where they said they used bullet for it's physics and had custom netwroking solution but on other GDC talk they said they had completely custom physics
I'm pretty sure latter is true
because it makes more sense for that kind of gameplay
they still probably use physics engine for collisions though
yeah, I think so too. Rocket League just feels too good, even with a 100+ ping. They seem to have put a lot of work into it
I don't have a thread, and it's going to be highly specific thing for my racing game anyway, so it'll never be some generic solution
I need all collision responses to suit that kind of gameplay well
where generic physx collisions usually fail
if you want to do it properly, steps mentioned on that gambetta article are pretty good
here is an interesting answer from Psyonix:
Yeah, I thought in there GDC talk he mentioned how they just ended making a simplfied physics for the sake of gameplay and networking
Q: Hey, guys! Thanks for answering questions today! As a fellow dev team we wanted to ask:
How do you resolve the car-ball collisions in high latency conditions when multiple cars are influencing the ball movement velocity within a short timespan?
A: From Jared Cone, our lead gameplay programmer who did all of the network simulation work:
Server: There is nothing to resolve, the server is authoritatively running the simulation using the clients' inputs.
Clients: When clients receive a physics state update from the server, they look back in time to see if the state is different from what they thought it was. If it is different, they rewind their entire physics state back in time and apply the correction. Then they fast-forward the physics state back to the client's present time.
So the position of the ball that clients see is not where the server says it is, it's where the clients predict it will be by the time their input reaches the server. This is how the server is able to be completely authoritative and doesn't have to resolve anything - the clients are basically "leading the shot" without even knowing it.
The side-effect is clients predict other clients' vehicles too, which is where most players' perceptions of lag start to show. For example, they couldn't have predicted the other car was going to jump a split second before hitting the ball so they mis-predict a low hit instead of a high hit, which gets corrected shortly after. Overall we found predicting other vehicles has far fewer visual artifacts than not.
their GDC talk was great
video is out somewhere, probably on that thread too
@keen frigate yes, that's exactly the same thing I'm planning to do
if you read the article I linked, he explains the reasons behind it too
oh wow
I linked the wrong one ๐
one sec
that's the right one
heh
my bad
yes i figured ๐ thanks, will read this tonight!
I can explain how that would work on unreal side
but can also explain why it'll be pita on physx
I'll just make a quick list, you can ask me later more about fixes on these if you really want to go that route
do note though that I don't know much about ue4's networking side itself, I just know the parts that are needed are not there
ue4's client prediction basically exists only for characters
at least that's what I've seen myself when looking at the code
ue4 vehicles could have some simple dead reckoning implemented but if it's there, it sure isn't working properly
Yes that's true, the Characters work very good out of the box. They are not physics-driven though
so sadly, we can't just copy paste and change some stuff around. Is it even possible to rewind and resimulate easily with PhysX?
essentially, we would need to save all rigidbody states since the last server update, right? and then rewind and resimulate, as mentioned in the AMA
main things to solve here are:
- unreal doesn't tick physics at fixed timesteps, so they operate at different speed on each computer, making timestamps between physics ticks useless, each computer has different simulation
- there's no rewind and resimulation on physx build-in
both are solvable
but latter requires a lot of thought
Using a Fixed Timestep for the Physics Engine
Hi, I've wanted to implement a fixed physics timestep for my game that is not tied to my game framerate, because of a few improvements it has for the kind of physics I needed.
Normally the physics engine is tied to the actual game framerate (up to a specific framerate, in which the physics simulation starts to run slower). That means that if your framerate is lower, you will have a longer tick in the physics engine as well. The longer the
that tutorial doesn't fully cover everything though
and I'd personally put some failsafe on fixed stepping as well, like I've commented on that thread later on
also, if you just rewind and resimulate the whole physics scene every time you get new player data from past, that'll get really expensive to compute
that is, if you have many players
if it's some co-op game, it's probably just fine
with more custom solution, you could just simulate the part that has changed
Thanks for the link!
all in all, you need to make custom engine version if you want to network physx properly
I will see how far I'll get while utilizing physX. You gave me a lot of good advice, thanks for that! I will post here and to my thread in the forums once I got more ๐
np
oh
one more thing
if you don't need server authority
things can be a lot simpler
but you'd still need to fix the timesteps or at very least use substepping
in such case, you'd just simulate each client on their own computer and predict other players pawns positions, sync the data on server and correct other players positions from server data
that would allow cheating though
if ue4 vehicles has some kind of prediction built in, it would work like that btw
exactly ๐ I think for a game that you want to be competitive and is physics-driven, server-authority is a must-have
found another quote from Psyonix: "How much tuning did the physics take?
Too many hours to count. If you include the original game as R&D, weโve spent three-plus years just perfecting the physics."
๐
so tempted to make rocket league clone for next game jam
starts in one hour ๐
you couldn't even think of the networking on that time frame though
I'm planning to take part in this one as well.!
Spends an hour talking about how horrible Unreal replicated physics is, and it some how results in wanting to do just that for a game jam
^
nah
it would need to be local co-op or bots
or not co-op but split screen
that's not a task that can be done in a weekend even you knew all the bits already
but @keen frigate mentioned they spend over 3 years perfecting the physics so it sounds like a challenge :p
just do a civilization type of multiplayer. Will be much easier ๐
I'd never do networked game for gamejam
Could do a game jam version where youre the spectator WATCHING from afar
so they can't see the bad physics
Spectator Simulator lol.
Anyone know why this is not working? On Server & Client?
If I have a replicated struct on a class, does the entire struct get networked if I change one of its members? Or is UE4 smart enough to only send the diff of the struct?
I for the life of me cannot get client animations working correctly. Basically I have a replicated enum (Set to COND_SimulatedOnly so other people can see the change, but it won't change the client/server) that changes depending on the input. Has three values: Idle, Charging and Attacking.
MouseDown = Charging
MouseUp = Attacking
On both of these events I send an RPC to the server to acknowledge that it happened
In the character classes function ClearJumpInput I reset the value of that enum to Idle if that value was Attacking last frame
In my animation instance I poll for these changes in the Enum and change animations according to the value. It works flawlessly on the server I mean absolute gold but on the client it doesn't see that the value has changed to Attacking then reset again. The server however sees the client attacking and everything is hunky-dory.
Am I missing something? Does the ClearJumpInput call get called more often on the client then the server or do animation instances run at different tick rates on clients or something? Trying to work out why the client's anim instance doesn't notice the change
(Sorry for wall of text / potentially shitty explanation)
Of? code, Anim instance BP or ?? sorry
Your code
No worries, one sec
tag me when you post it, cause I have another channel open
Zoomed in and pushed all together for extra readability ๐ @stiff wasp
Second Image - bChargeAttack used for setting another Montage after the current montage is complete (if the user has queued another attack)
the problem is you can't see it on client right?
Yep, the client plays the charge animation then doesn't play the attacking animation
Meaning bChargeAttack is not set
So, the client does not even see the attack? Does the server see the attack? Cause if no one sees it then it is a animation problem
The server sees the attack, the client doesn't play it locally
ah okay
if I remove the code in Clear Input (in combat system) it works fine for the client
it just never stops attacking
yeah
i see that
So
If you comment out the code in clear input, server still sees it right? It should based off the code I see
yep
alright, there is your problem
Well
actually
what kind of attack is it?
is it a melee attack?
Yep
can the client deal damage even though they don't see the animation?
This anim instance is used for both the First person model and the third person model
yes
alright. Then the clear input is the problem.
I just find it bizzare that locally it won't play when its the same code :/. The server isn't dictating the animation (well shouldn't be)
Yeah, it gets called by ClearJumpInput in Character which is called by Perform Movement in the Character Movement Class
I use the same logic no problem for movement animations/input
Which is why im very confused haha
Alright. Well, it is almost 6 am for me, and I've not slept in the past four days. So bare with me
it may take me a minute to actually type what i want to say
simply put
you need to do something that clears your input, but gives it enough time to complete the animation. Could it be that it was clearing input before the animation could play
Where is ProcessCombat called from?
Also I owe you 1 plugin still Jack, I've had a shit week.
I mean there's a few things there... bChargeAttack might not be getting replicated to the client properly if its set on the server
The general pattern I've used for replicating animation so it works on all clients is just a replicated variable with a state, and use a rep notify to trigger the animations, then every client will play it when they receive it.
aye, but he said that it works if he comments out his clear input
so if something was not getting replicated, then that would not happen
fuck, i need some coffee for this
Not seeing enough code to know whats going on, but the pattern in general seems a bit odd for it
Process Combat is in the "tick" of the Animation Instance. bChargeAttack is set locally per instance of the animation but is driven by the networked input enum
As for the problem yeah @stiff wasp I figured that would be case but had hoped it was just another silly issue on my end.
It's probably best that I seperate the input states from the animation anyway to be fair
it would be
OHH hahaa just realised who you were. No worries
๐
Ahh well, nothing major was only doing a minor rewrite this arvo. Got it working nicely then decided to check on the client and boom doesn't work.
WELCOME TO NETWORKING
haha ohh i know
but its local so in theory, it should just work
but nothings ever easy
Major reason for the re-write was for easier pausing of animations so I can do the hit pauses at your suggestion @cinder hemlock ๐
I think that would have been Chris's suggestion
Haha ohh true. Well I now know who it is haha
And by hit-pause I think he meant slow-mo, not physically pausing an animation
Which you can do by TIMESCALE
(I dont know how that works in MP)
Yep certainly can, but figured be easier to do it via the Montage rather then affecting the whole animation and what not
But just slowing a montage doesn't do much if the rest of the game is moving at realtime?
That's true but the idea would be that it would affect the player you are hitting and yourself
Had a bad feeling about changing timescale in MP
Isn't that the point though?
Its a disadvantage to the player if you just slow them, from a gameplay perspective
You wouldn't want to just affect one player
The 1v1 scenario it sounds great, im just trying to think for other players
refer to headshots from Killing Floor.
Doesn't that effect everyone on the server?
yeah
but from a gameplay perspective, its a disadvantage if you are slowed down.
and no one else is
And for other players it'd look fuckin weirdddddd if one person was just pausing or doing something slow
Hmm yeah, but equally I didn't want the entire server to be slowed. Especially on a sword hit which could occur fairly reguarly
Yeah that's true
That's why you just do it for important stuff, like a headshot or a decap
KF did it randomly for headshots I believe
Yeah was thinking for our perfect hit but more in the cinematic sense so the person would die. It would slow down for him and you would see some sick blood spurting before it sped up after a half a second or so
But that's a good point
(in terms of looking weird for everyone)
You can also have some other factors in determining whether to kick everyone into slow-mo
If its always 1v1, just do it
If its lots of players, have a threshold for X of them being in range/view of the player who was just brutally killed, because it'd look pretty cool to them as well
Yeah
But providing you have a screen effect and some cool trigger audio, people pick it up pretty fast
Is timescale dictated by the server on a world basis or can you set local client timescale?
Yeah definitely
It's really juicy in KF
I would think in a replicated environment, the time delta would be server dictated otherwise it would mess things up really bad if a client went out of sync
So thats your point of reference. I'm pretty sure timescale is server auth, but I've never tried it in UE4 before in MP
Like is it a replicated thing or handled over a network environment automatically, I don't know that
Yeah 100% @granite jolt
Another benefit of using montages is we can pause them after attacks (to slow the attack speed down) rather then adding/removing frames to the animation
I dont think there's anythinng wrong with using Montages, just think your structure is a bit odd
tying your input to animation too much
No doubt!
Just one of those yay got it working scenarios, then turns out its a giant lie!
just don't be that guy that uses root motion animations in multiplayer
Hahaha
Oh god no.
I've specifically said to my artists its a shit storm we are not doing that
Yeahhh but lets be honest, when did artists ever listen?? ๐
Basically the response was "But mummmmmm"
hahaha
Now that I've said no they are determined to try and use them
100% didn't know what they were before I said no
But by fury and thunder I shall strike their animations down!
Just add a plugin to your project
that whenever an animation has root motion turned on
your angry face pops up on the screen.
damn why can't I +1 that comment Wraiyth :p
will calling a server RPC on the server happen within the same tick or not until the next tick?
If called from client will probably be many ticks after.
If called from the server itself, I would guess function is called directly from given scope.
is it possible to change hte volume of VOIP in game based on a person's proximity to the source?
@olive oxide https://forums.unrealengine.com/showthread.php?98918-Voice-attenuation-and-Filters-(Steam-VOIP-or-similar)
Hey guys,
I did a bit of looking around before hand its churning up the same sort of results, it doesn't look like much of the VOIP information (especially steams) is accessible to the Blueprint section of UE4.
I may be wrong but here is what I want to achieve.
I want to be able to apply a radio/static effect to the players voices when they communicate in this co-op game, as well as change the VOIP sounds from being UI to Attenuated (actual real world positional locations).
e.g. DayZ
@fringe dove depends on your ping.
@olive oxide I added complete support for spatialized in world voice a couple weeks ago, I might try and make a pull request
@stiff wasp I was just wondering if it is something latency critical, if it is better to detect when you are a listen server and run the server function implementation directly instead of calling the RPC, or if it would end up running without delay anyway; tried looking at the generated.h for the server rpc and didn't get very far
@stiff wasp stepped through it with the debugger a bit, it looks like it calls it right away locally and doesn't go through loopback or anything, which is good
so I think it should all happen immediately
@nocturne token err, is this still true? "Steam will only return sessions within your Steam region and sometimes sessions related to the people on your friends list. [...] To correct this, please refer to my GenericPlatformTools plugin. (At the time of this writing, GenericPlatformTools documentation does not exist.)"
has GenericPlatformTools been published anywhere?
Lol, not yet. Priorities changed
@nocturne token how involved is it to just patch in that one change? making a VR game and worried about low player pops.. really will suck if things are divided by region
I'm ok with just hardcoding it in, but don't know where to look
I see presence mentioned in a few spots:
Private/OnlineFriendsInterfaceSteam.cpp
Private/OnlineFriendsInterfaceSteam.h
Private/OnlineSessionAsyncLobbySteam.cpp
Private/OnlineSessionAsyncServerSteam.cpp
Its like a fuckton of code
Unless you are okay editing the engine and not making a plugin
Then you just have to set presence in the session settings to false
ok, yeah I think I'm fine just doing that and not having it as a plugin
already had to modify a lot of voice chat stuff and couldn't work my changes into a plugin
@jolly siren I'm using a listen server right now; is that pull request just for dedicated?
@fringe dove yeah I think so
Hey guys.
Any way to Seamless Travel when creating a session?
When using Open level with Listen option on session creation, all works as expected.
When using ServerTravel or ClientTravel with Seamless travel enabled, clients cannot connect, even though session works as expected on the host.
Any one knows why?
Thats a good queation
... phone typing
I havent tried doing that myself but I am curious
If you find out, let me know
@shy magnet What version of the engine are you using?
We had an issue in early 4.12 or maybe 4.11 where client travel wouldn't work with seamless enabled
Also is this in PIE?
@shy magnet Set seamless travel true (bSeamlessTravel) in game mode
And then use a console command to travel
there's some forum posts on it - can't dig it up right now for you
@olive oxide and others: We started working with proximity VOIP in our game... We ended up havign to use Steam's system to simply mute and unmute players when they got in range. It's not particularly easy to do VOIP through an ingame speaker
not on Steam's library anyway
In 4.12 I belive VOIP entirely broke for us
I'm running with source engine build, and was going to make a plugin for folks like me - would anyone want a 'Launch/Build Dedicated Server' options panel/button in the editor?
I.e. click to launch a 'Development' config dedicated server, can change drop-down to DebugGame, etc
Throw out anything that would make that more useful to you (or at all).
Am I doing anything wrong when clients projectiles spawns 100-150 uu infront of spawn location?
I guess it's pretty obvious I am, but I was wondering if it could just be that the client spawns the particle once the projectile has already moved on the server
I thought it would be better to have the particle activate once projectile spawns, since it's already replicated
Instead of doing a multicast event from instigator client for the particles
Find Session isn't working for me on 4.13...
I was on 4.12.5 and doing ServerTravel would load the level I wanted to travel to, but then really quickly load me back into the level I was just in. If I clicked "Create Session" again, it would then load me into the proper level and keep me there.
I updated to 4.13 and now the ServerTravel magically works but Find Session takes forever to come back and also shows 0 results when I should have a game out there.
Anyone experiencing these problems?
You are searching a LAN game? Or do you have a SubSystem like Steam active?
And for the seamless travel people, are you guys trying that in PIE? Or standalone?
Using Seamless travel on Standalone (Steam), v4,13.
Seamless travel works just fine for us when already in a session, but when I want to travel to for example lobby after the session is created, it works correctly using seamless travel, but clients cannot connect to session. While if host does a openLevel with listen as option, clients are able to connect just fine.
Why do you need a ServerTravel on the first Travel?
Mainly, I wanted a consistent travel method throughout, Seamless travel is great because it doesn't block the game thread, so we have own special loadingscreens etc.
Can I see my session with bIsLanQuery=false. Or i'm need use another steamid for it?
Hi guys
I think sessions are broken in 4.13
in BP at least, I'm having major issues getting it to work as well
Can't find sessions, and therefore don't know if I can join them either
neo did you follow the Unreal Engine YT tutorial to make your system?
What does the log say? :P
For me, bIsLAN is false. I'm using Steam in standalone. I've implemented steam in 4.10 in another game and it worked fine. I'm doing this all in c++
And like I said, 4.12.5's create and find sessions worked fine. As soon as I updated to 4.13, no code changes to my own project, Create and/or Find Sessions broke
Also why does it matter what kind of travel we want to use? They should work how they say they should work. And Server travel works fine in 4.10. Traveling seems broken in 4.12.5.
My project is on early stage of development and traveling works well in blueprints
@amber plume Are @shy magnet and you on the same project?
Cause that was not directed at you :P
Neo said seamless travel. I said server travel. You asked about server travel
There may be a misunderstanding here. That's just what my understanding is
I'll have to check
Yeah, I inteprated ServerTravel in his "seamless travel", as he compared it to "openLevel"
Ok
The reason why I asked it though, is that if it's really broken, you may be interested in work arounds until a fix comes up.
That's why I'm asking.
Or better, neo might be interested
I'm probably going to look at the engine code
If you are good with Engine Code and willing to change source, then yeah, you might want to check the History of the Session relevant classes
And see if they changed something
It was just so late last night and I had enough foolery lol
Yeah, it's a pain sometimes. (:
But ,without actually knowing what's up, i would just say: Check the Logs (maybe with Verbose logging on for LogOnline)
And then check the Source
Yeah that's my next steps for sure. I'm just checking to see if anyone else is experiencing issues too
I'm having session issues as well (I can find and join the LAN session with Steam but it never loads the map / times out during the connection - works fine with SubsystemNull): https://answers.unrealengine.com/questions/486484/unable-to-connect-to-lan-match-over-steam-after-su.html
^ any more ideas to try on that appreciated ^
@turbid stratus I was having issues joining a game/server travelling on 4.12.5. I have issues finding sessions on 4.13
I'm looking into my issues on 4.13 now
I really have no idea how to find out the problem for my issue. Is anyone able to Find Sessions successfully using Unreal 4.13 (meaning it returns more than 0 results)?
The issue would be in the steam plugin
there's a big thread on this
My logs say nothing when I call IOnlineSubsystem::FindSession
it's a bit tear-soaked too
Oh really?
lemme find it for you
Thank you very much
Our game got greenlit on Steam (http://steamcommunity.com/sharedfiles/filedetails/?id=488647470) just a few days ago. We then proceeded to purchase a dedicated server in order to start our business on Steam, only to be greeted by an unwelcome surprise: dedicated servers won't work.
Allow me to elaborate: after 3 days we (as of yet) are unable to connect to our dedicated server and play the game. Logs are completely clean of any useful information so we're completely in the dark in regards to
it's a really long thread, maybe some of the later pages will help
Wait a minute
My issue is that I had steam's Find Sessions working
Now in 4.13 it does not
@shrewd oxide Wow. Thanks for making me search answerhub again. I guess I missed a post about it.
https://answers.unrealengine.com/questions/484873/413-steam-setup-not-working.html
For anyone having issues with Steam networking, look at that answerhub page and make sure you made the two necessary changes suggested
haha
half the time I go searching for something only to find I'm the top google result and had the same problem last year.
that feels like a project migration feature that they missed
Nice little gotchas, heh
well thats the interesting thing - find sessions is actually working for me on 4.13 (as far as finding my LAN match goes, anyway.. haven't had a chance to test non-LAN yet)
checking out those pages linked above now
I can get the Steam overlay working... but finding Steam sessions (or LAN sessions for that matter) doesn't work. Has anyone had success?
scroll up
Yeah, I found that thread yesterday, made the changes, but "find sessions" either return 0 results or flat out fails for me.
I guess i have to make a really simple example to test out with
I did, but not with a description of my problem, will do though.
Was hoping for some new magic bullet, guess it isn't found yet
steam stuff is pretty advanced stuff, only a few users actually have to deal with it I reckon
You almost have to have it if you want to do multiplayer though. And I want to have multiplayer
yeah. I have plenty of other stuff yet to do, so I'll just have to do that while waiting.
I really just wanted to playtest ๐
my god, over happy smileys here on discord
Can I debug steam sessions in VS2015? Steam working only Standalone game ๐ฆ
Just checking if you're aware. You can't test multiple clients on the same machine when you're playing in the editor
you have to use seperate machines as far as I'm aware
At least that's what he tells you in this tutorial series:
https://www.youtube.com/watch?v=abmzWUWxy1U&list=PLZlv_N0_O1gYqSlbGQVKsRg6fpxWndZqZ
in video 24
Thank you:)
anyone know if voip was fixed in 4.13?
ahh looks like someone has said it is fixed
I'll have to test it out
^^ that was an excellent tutorial btw, even if you know multiplayer its good to watch and see how it's done "properly"
@long hollow i found it was really hard to sit through it because there was so much umg / designer stuff
@long hollow i wish there was a more distilled version
that said, any new content is good
yeah i know, i actually spent 4 days doing it, just to get back in to using BP with multiplayer, but i still ended up with a bug somehow lol
once i fix it, i may put the project up for download, for people who wont follow a video and do BP at the same time lol
There is a download of the project somewhere on the forums
now you tell me lol but it was fun to do
@turbid hatch Hey, I had the exact same problem as you. I followed the link I gave earlier to fix
Are you ABSOLUTELY SURE you followed everything the person said?
I would copy/paste their DefaultEngine.ini changes instead of going line by line thinking "I already have that". Then make sure you go into the editor, select Edit>Plugins>Online Platform. Scroll down to "Online Subsystem Steam" and click the checkbox to enable it. Then you will have to restart the editor.
hugs multiplayer
_hugs @stiff wasp _
hands down the best multiplayer level design ever https://gyazo.com/a5848c8c438d4675e98a30d568bfa9ea
can't beat that
@thin stratus you should join VC
VC?
alrighty
i'll be here all day cause I don't have a life, so feel free to jump in and say hi
I would like to, but i won't be home till next week
your avatar is a skull, I'm not sure about the alive thing either
^ he got you
you should read the words above and below it
oh, it says "Sleep when you are dead"
and it is a picture of a skull
so I've been dead for a long time :D
Hmmm
Hi noob programmer here, can someone tell me some practical scenarios when a UFUNCTION should be passed with Server or Client? I'm still not really quite sure when you would want something to be called from client and executed on server and vice versa
Use a potion - send to server command about it
Server can use multicast to play drink potion animation on the all clients
^ or when something needs to be done but only the server can do it (like, a function or variable that's in game mode for security reasons, since that only exists on the server), then sometimes client will need to utilize server that way.
I totally did a sneaky post in that answerhub thread to try and draw attention to my own, since someone actually showed up to help there. I'm not really a bad person (that thread was marked as answered anyway)
@amber plume so you mentioned having issues joining / server travelling on 4.12.5 - can you recall how you fixed it?
Updated to 4.13
ServerTravel was traveling to the level I specified briefly, then returning me back to the level I came from
but every time after the first time it worked fine
so I updated to 4.13 and followed the steps in that answerhub link way up above and everything works fine
ah, ok, doesn't sound the same as my problem (mine never travels at all, though it joins the "session" ok)
but 4.13 appeared to be giving me issues with finding sessions.
really what was probably happening was steam wasn't being used at all
Are you using BPs? If so, I have heard a lot of blueprint multiplayer stuff broke in 4.13. Have not tried it for myself, however.
I'm using C++.
Ah. Good ;) Well, can't really help you as I've not had a chance to even download 4.13 yet.
It might be a bug
Are you using Steam?
Ok. Good job!
Thanks!
Now I'm trying to update my pull request to 4.13 engine version
so that Steam authentication works on the latest version
Okay. If there are weird issues with finding sessions and what not, check this out: https://answers.unrealengine.com/questions/484873/413-steam-setup-not-working.html
๐
OK so I just successfully connected with Steam over the net.. so it seems like just LAN matches are failing to connect
(my nephew will never help me test again, I ruthlessly pwned him in multiplayer ๐ )
hahaha, you can't lose at your own game :P
its an RTS of sorts too, so it was a slow death
can someone help me understand how to solve something for multiplayer? im new and really need help lol. can i post a few pics?
post away someone will help if they can
okay so an explanation first. I made an event dispatcher in third person character blueprint. I then have another component blueprint called platform, and I bound the event there. I call the event from third person character to locate any actor that has that "platform" component
The Get Player Character obviously messes up multiplayer
My question is is it possible to somehow get a reference to the caller of the event?
the other logic is to just simply draw a debug line from the player to the platform
add the player character as a param in the event dispatcher?
and when calling, hook up self?
tried that ๐ฆ
I did that and for the top actor location, i plugged in the param from the event dispatcher, but it doesn't matter because the event is only bound to the player character for index 0
use a ForEach to bind it for all player characters? but I dunno, feels like there is a better way to do what you're trying to do
like maintain an array of the platforms somewhere, where the characters can just access them directly
yeah idk
i feel like this is the best way according to their docs, but i will play around with it and see if i can figure it out
thx
well I'm a bit baffled now.. why on earth can I join a hosted game fine over the internet using OnlineSubsystemSteam, but not over LAN (even by just typing "open ipaddress"). LAN match works fine with OnlineSubsystemNull.
@wintry flower what about Blueprint Interfaces https://docs.unrealengine.com/latest/INT/Engine/Blueprints/UserGuide/Types/Interface/
Blueprints that declare functions to define an interface between Blueprints.
i fixed it with the foreach like @turbid stratus recommended, however I thought he meant a foreach of the platforms...or something. idk i'm tired. i can't believe that's all it took
now both can draw lasers :D. trust me there's a point to this for my game idea lol
okay so that only works if there's 2 players, no more :/. My game is only gonna be 2 players so that's fine, but I would still like to know why. so dumb
either the lasers are coming from somewhere awkward or they're targeting somewhere awkward
lol
yeah they just come out from the center which happens to be an awkward spot
i shall change that ๐
and use real lasers instead of debug lines
@sterile obsidian It depends on the game type
It's a per level based game PvE
so. no PvP
I've read the Multiplayer compendium. My optimistic self thinks that it shoudn't be super hard
but it'll be a pain redoing replication for most of the objects in game
You just have to replicate the right stuff
@sterile obsidian in general, worst state is you have to re-code the game. Less worse states depend on your game and how much is actually Network related
If you used root motion animations... lol good luck
not something I would want to do, based on my limited replication experience
After doing this current game as a bit of an experiment (to get a PC game released on my own with MP), I'm thinking twice about including the planned co-op for the next game... I know now that it will basically double the complication/time expense of most stuff (may not be that way for everyone, is for me).. but I'm gonna try for it anyway. But by god I'd never make it SP and then try and convert over... The only way for me is to make it work from day one in co-op and keep it working the whole time, making sure that new stuff is tested in MP. More time as you go but way less headaches and despair near the end (and if you run into any problems you can get help in a non-urgent way, instead of discovering them all at the end).