#multiplayer
1 messages Β· Page 15 of 1
Yea, the player is the owner of BP_ItemDrop.
Client presses Interact key, client sends ServerInteract(), Server adds item to player inventory, then informs client about success (show notification), then destroys.
Testing with a bit of lag and packetloss, it looks like the RPC always goes through.
I'm guessing (I don't really know) if it happens in the same frame, it ends up being written sequentially to the same send buffer / packet.
And that same packet would be processed sequentially on the client. In the editor it seems to work 100%.
We usually tend to delay destroy by 3 seconds and turning off the actor via an OnRep bool
Then there is enough time for the client to handle rpcs etc
You can also look into TearOff and TornOff if you have CPP access
What's interesting here, a "safety delay" ironically makes it more susceptible to races, since it's now 2 different packets out there in the internet (instead of 1).
The "solution" I guess is to give up on separation of concerns and just make an RPC on the PlayerController.
It doesn't matter though
Everything after 3 seconds is not interesting anymore
If you take 3 seconds to receive a package then you probably have other issues
If you want a cleaner solution then look into tearing off the actor
That lets the client handle the destruction
That's very true, but real world connections can be unpredictable from time to time
Yeah but you still have to see that whatever you are doing in that rpc is only relevant for that frame
If the client doesn't get it within 3 seconds then we typically don't care about it
It's not important RPCs that are send here
If you need to send an important rpc then move it to the controller as you said
The rpcs we send in that situation is for example to trigger some explosion effect or so
Yea I was just curious about the inner workings, the RPC isn't important enough for me to deal with the 0.001% edge case. Still worth looking into the topic, just for education : )
You can't tear off in BP? Didn't know, that's a bit odd
Seems like an oversight rather than a limitation
You can TearOff I think, but not sure TornOff exists
That's neat, didn't know about this - thanks! π
I'm guessing Destroy should better be in TornOff if it's async
that's something for a nativization day then : )
Hey guys, I'm wondering how it would be possible to replicate all until this moment spawned actors on join. I want to attach a BP_Weapon to my Player on BeginPlay as a default weapon but when the Client joins, the client does not know about the weapon and so does not see it.
It's as easy as replicating the weapon actor and attaching it to the player pawn server-side
Okay thank you, let me try and I'll update
So, first of all, it works ~~almost ~~perfect, thank you for that easy solution! :D
Edit: Yeah, now everything is literally perfect, amazing. Never expected the engine to send this stuff after join. Smart devs indeed.
I'm trying to extend the movement component's Saved Move to include an additional float value and I'm running into an issue with the Serialize function, any ideas on what I'm doing wrong here?
basing my implementation off of the ALS refactored movement component, which extends SavedMove with gameplay tag data and appears to work fine:
will ask there, thanks π
Use this
Does anyone have a link or a code snippet on how to create variables with client-sided prediction? Ammo while firing gun, stamina when running, this sort of things... I feel like I am re-inventing wheel
Is it possible/realistic to develop multiplayer in blueprints? Or should I switch to C++?
Possible? Yes. Sanely? No.
Gotcha haha. Any tips on introducing C++ to an existing blueprint project?
100% depends on the game.
Part of the issue is that you lose out on a ton of tools. Very simple and basic games can be done.
Valorant or Fortnite in BP only? Fat chance.
Civ or Among Us? Much more likely.
Basically it comes down to if you need fancy stuff and prediction.
If you're ok with ping delay before doing anything and aren't doing anything too crazy, it's doable.
You'll want at least some C++ for steam integration etc. What sort of design did you have in mind?
is there a simple solution for sending a generic payload over the network?
The question is I got a "messaging " system that needs to send or multicast a pair of { Recepient, Data } from server to client where data is a native or blueprint struct with usualy actor pointers, ints etc.
it was not a multiplayer before, but now it needs to be so can not just scrap the thing
Design as in what type of game or?
yeah
It's a simple top down survival crafter, ideally an MMO on release
I've been doing blueprints so far because of how easy it is, but I can do C++. Not sure how adding C++ to a blueprint project works though
yeah nah prolly. I mean you can certainly get the mechanics working with a couple people hanging around, but the persistence and backend will have to have a good bit of C++ involved. If it's dummy simple core mechanics like Rimworld it might be doable. Not as MMO tho, no way.
Just add it. I'd start by making a BP Function Library and putting a few functions in it. Get used to C++ work. Then start branching out.
I did BP only for years before taking the plunge and it was pretty hard at first but I'm pretty comfy now.
Alright cool, thank you! Iβll start screwing around :)
Generally speaking, just having the struct as a payload is fine enough. Depending on the usecase, could just be a replicated property.
Honestly if your scope is anything bigger than Valheim and you aren't already a leet coder and have 15 years to spend on it, don't. Valheim took 5 people who really know what they're doing 4 years to make.
Hehe Iβll keep it in mind. Thanks
And while amazing, Valheim was still very sparse on release. π
how am i put a generic ustruct into rpc if i have no type. (well void* and UScriptStruct*)
Killer feel tho, I've never played a game with such a cool style and feel to it.
actor pointers?
What are you trying to do here anyway?
"simply adding multiplayer" to existing system that never knew about it.
as i said - there is a FName and UScriptStruct input and need to do netmulticast the duo preserving data ofc
I had to do something somewhat similar for my vehicle project (VehiclePartSettings), I just made a generic struct with arrays of ints, floats, bools, and let each consumer handle it in their own custom way.
Have anyone had a problem where the landscape crashes the game? When I host as server the game runs fine. But as soon as the client joins i crashes. And only when there's a landscape... π
show crash
A world's TimeSeconds is kept after a seamless travel right?
Yeah iirc
Yes, check UWorld::InitializeActorsForPlay
Reset for non-seamless, got it
Guess I'll go with a UWorldSubsystem
Need to find out where they're initialized and if they're ported over in a seamless travel
I'm pretty sure they are, not sure where they initialized though
Doesn't seem like they're ported over no
Ah found it: #multiplayer message
#multiplayer message
That was a while back
I am using stamina in my CMC and I am sending the current stamina from client to server to check if all is good. Exactly the same way as the final location is handled. If the delta between whatever client sent and server value is too big, trigger client error (bAckGoodMove = false) and send adjustment. So far so good.
The problem is with extending adjustment. Is there any way to extend FClientAdjustment which is used in ServerData->PendingAdjustment ? It seems very much hardcoded into the CMC
You are meant to inherit from that container struct and then filling that before it's send to the client
Thanks for the response!!! Really appreciate any help. I have subclassed FCharacterMoveResponseDataContainer but annoyingly the default ServerFillResponseData(const UCharacterMovementComponent& CharacterMovement, const FClientAdjustment& PendingAdjustment) just copies the PendingAdjustment (which is MyClientAdjustment class) to internal ClientAdjustment variable which then is used Serialize().
Which means in that ClientAdjustment = PendingAdjustment; call in FCharacterMoveResponseDataContainer::ServerFillResponseData I loose any extra data and from MyClientAdjustment becomes only ClientAdjustment.
Isn't it enough to just put that extra data into the container?
Instead of the client adjustment?

Worked! Now I am sending custom Adjustments to client including stamina. Now I just need to figure out how to replay moves on client. Thanks so much for your assistance!
Client already replays moves
Theoretically if you just override the stamina and replay the moves it should work just fine. Don't even think you need to have your own saved move
The code for moving will just work based off of the new stamina value
Basically similar to how velocity works
It's just overridden from the correction and then all newer moves are played again based off of the new velocity
If that make sense :P
Oh sweet, I thought that would be much more painful! So in theory something like this?
Yeah I think so
Btw, since I see you are available for contract work via Salty Panda, would a code review after I am done with this CMC be possible?
Paid of course
Theoretically. But you'll have to contact us via email cause I don't manage our resources
Sure, will do. Thanks!
Cheers
The comment a out thinking it replays moves
What happens is that the client will set a boolean
Something like bUpdateClient or so
There is a function that gets called if that is true
Which is called something like UpdateClientAfterServerUpdate
Or so
Weird name
In there it replays the moves
In case you want to learn where that happens and how that works
If you scan the CMC for the saved moves array you will find the function I mean.
Oh right, I was looking into the source and was super confused when the replay actually happens, because it goes from
ClientHandleMoveResponse -> ClientAdjustPosition_Implementation but I didn't find any replaying there.
But I need to dig into the CMC a bit more
feels like I'm missing something - seem to be getting a lot of adjustments when running and turning: https://gyazo.com/5d3bf52a65b4faa41c87653da901c166
simulating average connection here, doesn't happen all the time but often enough that it's likely that i'm doing something wrong
this is my movement component class for reference: https://pastebin.com/V4J7pUeC (.h) https://pastebin.com/1DRtB7Sp (.cpp)
Pastebin.com is the number one paste tool since 2002. Pastebin is a website where you can store text online for a set period of time.
Pastebin.com is the number one paste tool since 2002. Pastebin is a website where you can store text online for a set period of time.
What are the variables Net_SprintCurveTime and Net_WalkCurveTime?
Maybe what is causing that many corrections is that you are sending Net_SprintCurveTime and Net_WalkCurveTime to server and if they don't match the server, you are never correcting the client to "sync up". But since those variables are not used in the pastebin code, it's hard to tell.
Or you are using those variables outside of the CMC PerformMovement scope, (for example on Pawn Tick), which would be excluded from the SavedMove replay
anyone have a way around this? trying to make a health bar that works on multiplayer.
You need to replicate a variable "health" and each client should spawn locally a widget and read from that replicated health variable
any video that accurately shows this in work? im very new to unreal
The Networking series on youtube by Epic themselves is a good for networking beginners
ive got all my health working, both players take damage seperate its just the health bar isnt workin π
My dedicated server doesn't like metahumans. π
When the client is trying to connect to it, I get errors like:
LogStreaming: Warning: Missing script import 0x7FE0EC0166871CD for package /Game/MetaHumans/Vivian/FemaleHair/Hair/Peachfuzz_M_Thin
LogStreaming: Warning: Missing Dependency
LogStreaming: Error: CreateExport: /Game/MetaHumans/Vivian/FemaleHair/Hair/Peachfuzz_M_Thin (0x1589B7F9E39136F2) /Game/MetaHumans/Vivian/FemaleHair/Hair/Peachfuzz_M_Thin (0x1589B7F9E39136F2) - Could not find class object for Peachfuzz_M_Thin```
This repeats for `Peachfuzz_M_Thin`, `Eyelashes_L_ThickCurl`, `Eyebrows_M_Messy`, `Hair_M_SideSweptFringe`, `Hair_M_SideSweptFringe_m_head_Archetype_Binding`, etc.
Anyone seen this?
Yeah that's because you haven't checked the multiplayer compendium yet
Found in this channel π
That error is telling you that widgets only exist at the local controller level
You are assigning the 2nd controller which has the local controller on client (non listen-sever player) a widget on the server
was there a spot to go for the pin emoji?
Yeah that's intentional
That means I want you to check all pins
Not just the one you're looking for
yea i just realized im sorry
those are the variables contained in the CharacterNetworkMoveData - they're set to the saved move value in ClientFillNetworkMoveData() and packaged up in Serialize() for replication
none of the move related variables are being set from outside the movement component either
is it legal to send an array of actor pointers to client by a client rpc?
Yeah, but how do you use them to effect the move outcome.
Aka, why do you need them?
Should be fine as long as all actors are replicated
they are. also would it work with an array of TScriptInterface where the objects are replicated actors or with replicated actor components?
I wasn't able to make TScriptInterface work, but theoretically yes, it should.
good question - it seems i might be missing an override so that the server actually uses those values, currently they exist to get serialized but they appear to be not used after unpacking
I think there might be some misunderstanding. As far as I know cmc, you send the sprint curve time to server, which should check if it's close enough to what the server has. But server always uses its own curve time and corrects client if the client curve time is too different compared to server.
You should never trust client. If the curve slows the movement speed over time, the client can just say the time is 0.0f indefinitely
gotcha, so in this case there's really no need to serialize and send the client's version of the curve time since the server's using its own authoritative version anyway
i've commented out the CharacterNetworkMoveData and CharacterMoveDataContainer classes & overrides, seems to work as expected, although i'm still experiencing corrections when running + turning: https://gyazo.com/ab88f29b1aef10fbd8943a4587acddc5
^again testing with emulated average connection, maybe those corrections are fine and i'm worrying over nothing? ideally it shouldn't be that frequent i'd imagine
Yes
Just remember they have to also exist on the sever
Since itβs sending GUIDs
yeah well I'm doing the backward - sending a client rpc with an array of actors to dis/enable some visuals for player
yeah this doesn't seem right https://gyazo.com/717e37390db49d6426358f7b03b36e1f
Oh wait yea I read it wrong
As long as it exists on the client
Yea
Ok looking at your code there are few things. I think PawnOwner->GetActorForwardVector().GetSafeNormal2D() is the main issue, try replacing that with controller rotation.
Also you are doing a lot of things in OnMovementUpdayed which happens after the move is performed. Try overriding walking physics function and updating the speed before a super call.
will give this a try - appreciate the help π
https://youtu.be/DoZyH86n_gs This is a great video with explanation
Higher playback speed recommended. It makes those moments of dead air where I am figuring out what the hell I wrote more palatable. Also the mumbling.
Table of Contents
2:12 Sprinting
26:14 Jetpacking
55:02 Gliding
1:26:02 Networking
This project: https://github.com/HarryPearce/JetpackTutorial
Advanced Movement Component: https://github.com/...
neither can I π€
after making those changes i'm still encountering compounding corrections when turning just the right (wrong) way - https://gyazo.com/5712ced90b51b8243b383b0f8024c0eb
here's my updated movement component for reference: https://pastebin.com/TVQe24ji https://pastebin.com/ipz4BNgL
Pastebin.com is the number one paste tool since 2002. Pastebin is a website where you can store text online for a set period of time.
Pastebin.com is the number one paste tool since 2002. Pastebin is a website where you can store text online for a set period of time.
Hi everybody!
My project is single player / multipler with listen server.
I'm working on the chat, and i was wondering if anyone knows some free services for multiplayer chat that works on an Api basis?
My desired behavior is to have both Local multiplayer chat and Global multiplayer chat (same across all sessions)
Local is really easy, i was wondering if there's some free service for the global chat.
Some sort of irc chat server would probably work (for both local and global)
Just started dipping my toes in creating multiplayer in UE5, utilizing the blueprint system.
I found a pretty cool guide from Ryan Laley around this subject. He describes Relevancy in such a way that if i choose to make an object "Always Relevant", it should replicate the object position and all that, in both client and server and owner.
However, when i made two cubes. One of which is ticked as "Always relevant", and another "Only relevant to owner". They both seem to behave in the same way. As in, if i run into the cube(simulating physics) it will move in a direction. But both the Always Relevant and the Only relevant to owner, end up in different positions when comparing client vs server.
Anyone able to point me in a direction of something i missed, or i could take a look at?
Did you set an owner for one of the cubes?
First off, nothing replicates from the client to the server. So your first sentence should read "it should replicate object position and all that from the srever to the client."
If you run into the cube on the client and move it, the server won't know about that.
(the always relevant one)
And if your other cube's owner is the server, not the client, than running into it on the server won't tell the client what is going on.
Therein, both your cubes will end up in different positions on each instance.
This applies to both cubes, btw. If the owner happens to be the client and you move it on the client, the server still won't know.
What desides the owner of the cube then?
The goal for me here, is to have a cube that is replicated and relevant for all clients. And one that is not. From this point, i can scale it up. Make sure that only relevant objects are shown. Supposedly this is important, since making everything relevant will strain a server?
Trying to access that, returns a "Database Error". Cant seem to get access to this "Bible" π
I got access to the PDF slide thingy. Seems his main link is broken or something.
Your site is down again π
Does it cover GAS MP stuff? Is that even a thing (not in gas tutorials)? I really need to start looking into GAS.
No, it doesn't.
https://github.com/tranek/GASDocumentation tranek's repo is the GAS bible
Cedric's pdf is more for getting your feet wet with networking in UE overall.
To be fair - tranek's stuff is pinned in #gameplay-ability-system
Well, thats perfect for me. Im starting from nothing here. @quasi tide π
Interesting read so far
Yeah, I guess.
It'd still be nice, though!
You might find other useful things while searching too!
Damn, reading the intro to tranek's GAS bible, i definitely need that in my next steps.
I aim to be a game designer. I already got my game designed, hard part is actually making it now π
My designed game, definitely needs the stuff from tranek as well. Thank you for that.
You're 1% done.
I'm going to have to implement GAS in my l ittle side scrolling shoot 'em up (shmup!)
I will get there. Making a multiplayer game is definitely a motivation.
Never seen a networked multiplayer shmup before. Could be fun.
Ya that's like your first car being an Ariel Atom, or your first character in Dota being Invoker.
I guess i will find out once i get into it. I tend to go big. Takes more work, but learn more while doing it.
@short sirenHonestly you won't really appreciate what GAS gives you until you've attempted to make your own framework. GAS is great but it's BIG.
What kind of design are you doing? Does it need tons of prediction etc?
But invoker is eaaaaaasy! Just memories meteor and pwn the noobs.
(I have never played invoker)
I start simple. So for now, it will be an arena with AI going at the players. The players obviously have to deal with that by destroying the AI. AI will over time get more abilities. Players will over time get more abilities. In the future i aim to add a talent system outside the game, for players to affect their characters.
Explaining a full game design is a bit much in a message, but thats the simplest i can put it down to.
Think sorta Vampire Survivors. But in a 3D environment.
I'd fucking love more orcs must die type games
The CO-OP is a big seller for making this game. For sure.
That at least sounds doable.
Glad it's not a 100% dragon science based mmo
"Yet" 
I was under the assumption that the best practice when you want to make a MP game. Is to build it as an MP game from the start. Is this a correct assumption? Is it harder to convert a fully build SP game into an MP game?
Yes
Unless you wanna make 3 games
πͺ π
The 3 games being
The game you're making already.
The game you make when you try to make it multiplayer and go "WTF Why doesn't this work" and refactor the whole damn thing.
The game you make when you realize how bad you did at the refactor and have to refactor again. This step can happen multiple times.
like my dumbass thought that it's going to be so easy to just add server client architecture later and I'll just make the systems working first with my online database
then I learnt about object replication
everything changed
tornado + meteor is the way
So something like MMO on Stadia?
Do I understand it correctly that a game studio would still create an MMO, but the client instances would run on game studio side (locally or cloud), be rendered and video streamed to clients, right?
A very high-level design
Cool idea, thanks for explaining it! I wish you best of luck and I am looking forward to seeing it implemented in some modern engine!
For this, some compression and decompression techniques are used together with intelligent rescaling, ultra, high latency, so that the perceived response time is mitigated, you can call it negative latency 
Just out of curiosity, since you are in testing phase already, do you have any early metrics? How does it compare to Stadia and other streaming services?
My apologies for my ignorance, but where does the performance boost come from? Other than the previously mentioned that because it is 100% new, it does not have legacy components.
Hey again. I re-created a POC of the system that was lagging for you (aka, server corrections). I have found that using curve for the movement prediction causes the server corrections.
When I set the value to a constant 2000.0f, no more server corrections. I guess it has to do with the different client and server tickrate, but I have not tested it fully nor did I find a proper fix. But hopefully this will help
thanks for taking the time to try and figure this out, been trying different solutions all day with not much luck, i'm starting to think it's almost time to ditch the curves in order to move on π you're right that the issue stems from a desync between the client and server tickrates as that's ultimately what's driving the curve time - I've tried messing with some ping compensation or even using move timestamps to drive it instead, it's a tough challenge to solve
What worked for me mostly was.
- When you start sprint, save the current game time (could be part of saved move)
- each tick calculate PassedTime on both client and server
- hardcode steps (if PassedTime < 1.0f, return 100.0f, PassedTime < 2.0f return 300 etc.)
- If this tick we enter a new step, lerp between the current step and new step based on the frame delta
It is rough version, but might help
i hadn't considered that approach - will mess around and see how it goes!
Hi. Iβm making 50 - 100 player βmmoβ survival game with dedicated server. Atm server is working nicely with players but I we donβt have any data saving system. So what could be best way to save data(inventory)? Database or ? We want that every server you start playing you start fresh.
And should we implement custom login or use steam?
Somehow doing the day night cycle system like this still create the sun position not being synced between the client and the server. What could be the reason ? π€ Ping me if any answer please π
BP_GameSettings is an actor placed in the level I take it?
yes it is
There's no need to have the Day / Night cycle set up as a "Run On Server" event - your Has Authority check makes sure that only the server would execute the next bit.
Make sure the actor is set as replicated.
Rather than constantly replicating the value, you could have it so the client starts their own timer for doing the position, with an infrequent update from the server.
Finally, you're probably not getting any change on your end as you're multiplying "Sun Speed" by 1 and feedind that into the rotation, which you're setting, so it's likely always teh same value going into your Set Actor Rotation node.
I did that because there are possibilities that the day / night cycle may change during the game.
The actor contains all of the game settings, I'm not sure if it's secured to set it to replicated π€
Right now I multiplied by 1 because I tried multiplying be 10 and it went to fast so I will later tweak it to be the right speed I want. But yeah good catch I forgot to add the amount to the local rotation. Let me try that
If you intend to use replicated variables to communicate things to clients, then you have to mark the actor as replicated.
If you don't then the clients don't get any of the updates and won't do the things that you're expecting them to do, like the OnRep function.
Somehow the values are still staying at 90 / 91 π€
Get rid of the Set Actor Rotation from the Start Timer event. It's not necessary as the server should also trigger the OnRep. Your timer is also too fast - timers can't actually fire faster than tick but the timer will execute the number of times it should have executed in a single frame - so really you're asking the timer to fire a little over 100 times per frame (based on 60FPS). If you need it firing every frame, then perhaps consider using event tick instead, otherwise if you're wanting to control the timer later on, perhaps lower the interval to 0.016 which is equivalent to about 60 times per second (which would match with FPS)
Also if I recall correctly some rotations won't work passed 90, you have to interpret them different past that value as they then need to go to -180? I can't recall exactly at the moment.
How to do that ? π€
You can have some component that you change the local yaw of
that's one way
yaw can loop and maybe roll can but pitch can't
Components are limited, like we can't use timelines in it for instance. The thing I don't understand the reason on why it can't go over -90 and how to solve the issue
Have a scene component that your sun is parented to, and spin that scene component
And rotate it so that you're spinning Roll or Pitch instead, right?
yaw works
i dont recall if roll does
pitch does not
just orient the component such that yaw makes it spin the way you want and you're in business
I'm rotating on the pitch right now ,so I should switch to Yaw or Roll ?
the value doesn't go up somehow
it stays stuck at 180
wait
nevermind
Funny thing is your approach could work if you set it up right. You can ADD rotation and make it loop in any axis
somehow my directional light object is set to none π€
you just can't SET rotation changing pitch and expect it to loop
Set is better for syncing, just have it like this.
OnRep_TimeVariable -> Set Sun rotation as function of time -> ??? -> Profit.
Otherwise you'll end up with clients seeing the sun at different angles
What do you mean by "Set Sun rotation as function of time" ?
but I don't see how to fit it with my current setup π€
do math to make it work.
Something like
SunRotation = (90, 0, Time * 360)
If Time is meant to go from 0-1 in one day.
Oh so Time will be replaced with how many second I want a 24h in game day to be
I'd just update Time at whatever rate you want
What do you want Time = 0.5 to mean?
Does it mean 12:30 AM?
Does it mean Noon?
It's up to you to determine what you want it to mean. I'd either do 1.0 = one day or 24 = 1 day or whatever you want.
I see
Then just have the variable live on GameState, replicate it, update it at whatever rate you wish (tick, timer, whatever), and use repnotify to have it do things clientside
assuming other systems care about time. If not, it can just live in some EnvironmentActor
my other question is why my "Directional Light" variable is set to None even if I used "Get All Actors from class" node and getting the first element, otherwise print an error
SpawnMonster -> if Time < 6 OR Time > 18 -> Spawn Night Mobs, else spawn day mobs, etc
I'd start by not doing get all actors from class. In my project we just have an EnvironmentLighting actor which has a directional light, skylight, atmosphere, all that jazz
Ours also handles latitude and longitude since our game involves flying around the planet but same idea. One actor that handles all the large scale environmental stuff
Sort of like the old classic BP_SkySphere
You have a directional light integrated in your actor ?
yeah it's just a component
directional light, skylight, atmosphere, giant earth mesh, post process stuff, lots of things.
Very old video but the skylight, sunlight, earth mesh, and atmosphere are just 1 actor. It's the only thing moving, the ship doesn't actually move.
https://www.youtube.com/watch?v=2Xuh1p-m3P8
Somehow I added a skylight + Directional light components to my actor but now my sky is kinda dark and red
push model!
does it needs a master switch to be enabled somewhere in UE5?
no, you simply need yo add netcore in the build.cs of your project and the appropriate headers in the source files
- in your lifetimereplicated props use shared params with the pushmodel enabled
what about the ini thing you had to do earlier
[SystemSettings]
net.IsPushModelEnabled=1
Just look for that variable in the engine code and check it it's still used
ah x'D probably something i've set a while ago and then forget
my apologies! @finite goblet
Anyone happen to know what actually causes the cmc to be so heavy? Prediction? I wonder what kinda of savings would occur if it was all converted into mass
Very complex mix of animation, physics, networking, input, general logic
It's not even that heavy, it's just that there's one per character so even at 300Β΅s per frame it's out of budget with 30 pawns
And hell, 30 moving objects that are skeletal meshes on top is already not particularly cheap
I have created a dedicated server but it's not opening when i use 127.0.0.1 on another PC. I found it i need a local server IP address but don't know how to find it
Hi everyone, im pretty stumped on this. I had this RPC working and I cant figure out why it wont now suddenly. Everything works in singleplayer so its all hooked up correctly, its just that i cant get the RPC_StartShooting to work when in client 2 player
im trying to debug it but it wont show me the glowing lines when i select the server type in the debug menu
what would prevent an RPC from running on server>
also i did a print string on get owner,and its showing the owner is my player character. Does that mean I have to call it from the character because its the "owning client"
Everything here looks like it should be working so long as the player controller or one of its other owned actors (like their controlled character or playerstate) is the owner. Use F9 and put some breakpoints, one on the RPC call, one maybe on the line trace. See if it stops at all.
so the break points only work when in single player, not when playing as clients online. As for the owner, i did get owner and its returning the owning player chracter.
so it seems i own the weapon properly, its just ignoring the server RPC when i play online
Are you perhaps spawning the weapon locally? Fast easy check would be to put a print string on Begin Play which should then show you Server: Print and Client: Print
Is the weapon actor marked as replicated?
the weapon shows properly the two print strings server and the clients. i draged them into the world. In terms of it being marked as replicated, yes
replicates is checked off in the details panel
Ok, so the breakpoints bit again...Put them on the branch and on the cast you have on the interface call. Also if you are selecting an instance, don't bother, leave it as none selected and let the engine just break on any instance.
Anyone know why crash dumps wouldn't be generating on windows server or linux server no matter the build configuration?
passes everything
on client
So it didin't stop at all?
nope fully executed
If it doesn't stop, that means it didn't execute.
no it did, but i simulated the steps, like it stoped the game and went to the branch, then i stepped forward
i wanted to see the step by step and each node executed normal
Gotcha
Ok here's a test we can try... You have a ref to the weapon in your character I imagine, that you're using to call this interface, yes?
yes
Create a "Run On Server" event in your character that passes along an actor reference, and pass the weapon through the RPC. While running on the server, print out the display name of the actor.
Call the RPC using an input of some kind.
Dang... Ok so this is what you're using when calling your interface too?
yes
could that cause the problem
No that should be ok.
okay good
im really stumped onthis one
is it possible that i have to set the item in hand variable to replicated?
nope that wasnt it
You're running UE5 too right?
yes ue5
There appears to be some issue with placed actors. If I spawn a replicated actor and change ownership, I can call the RPC no problem. If I use the same replicated actor but placed in the level, I can still change ownership, but RPCs run on it won't go through.
hm weird, i can try it, how should i spawn them, in my character or can i spawn them by making a spawner bp
Make a spawner BP, it shouldn't need to replicate at all itself.
Just make sure you set it up so it only spawns the stuff on the server (Has authority or Is Server branches!)
yes just did this
nothin
wait a minute
when i run set owner, do i have to do that on server
Yes
holy shit
bingo
i moved the set owner code and i mustve moved it from a place that had a server RPC
The set owner on the client is redundant, but even still, there's that strange issue with placed actors and even with their ownship changed, the RPCs don't fire on them.
I'm trying to look through the channel history see if anyone else spotted this kind of behavior.
i would assume its something with the spawn actors no being put on the server in some way
Interesting... Placed actors don't get destroyed by relevancy.... So there's definitely some weird network behavior with them.
Yeah they don't. I vaguely remember this behavior a few months back, but I would debug CallRemoteFunction and GetFunctionCallspace to figure things out
UE5 is full of landmines, so could be another one
I believe any replicated actor owned by the client must be able to fire RPCs just fine
Either way, thank you for your help
lol i got 1 more quesiton if thats okay
I got this running to a server rpc SV Kill player
essentially the multicast only works for ragdoll in offline. It does not work online. But i do also notice that when i set component replicates on the mesh, it doesnt rag doll, but it moves around like its ragdolling, i rotates and falls to its side like a stiff ragdoll
If my game is online should everything be done with events?
For example my character dashes on input, the input should call the event that calls the dash instead of calling the dash function directly?
well yes and no, its only required to be on a seperate custom event because you need to call Server and Client with them
Here is my shooting code, you can see i get the input from my client, then I call SV_ Start shooting to make the shooting happen on the server
It is so nice of you to show code, I'm always lost on how people do these things
it took me a while to get a grip on it so dont be discouraged
even now, as you can see by my questions, im not perfect either
thank you so much, I wish I had more time to watch and read some good tutorials, I'll keep learning as much as I can
youre very welcome, glad I could help
Apart from what @steel fractal said, it's better to separate your code into functions, so your code is better managed.
ya true half the stuff i couldve organized my screen shot better as well lol
You are setting a replicated property and firing an RPC right after. No one guarantees you that property has replicated when the multicast fires on clients
You use OnRep in such case
Ragdoll will look a bit different on each client, as they are simulating that on their end
But it's ok
well the issue im having is more so that it doesn ragdoll at all. Also, in terms of the IsDead variable, it is set as true on the server, in which simulate physics is being called
probably better practice to move it to an on rep, but in this istance, its not an issue of the branch returning false
unless theres more to it than that
thats a good idea, ill definitely keep it in mind for the future
i moved them to onrep and same issue, simulate physics gets called but no dice
If i check off component replicates on the mesh, this happens
so the ragdoll is happening some where, just not on everyones client
if i uncheck component replicates nothing happens to ragdoll at all
wait lmfao so that bool u were talking about was returning true so i thought all was well. I removed the branch for shits and giggles and it works, so u were right, the debugger was just not right lol
hi, imagine in APAWN::IsNetRelevantFor you want to send APawn instance to enemy player controller, but not full APawn, so it looks like an anonymous enemy object. Would you send just any of the object's components, or what would you send?
Hi again, remember this code? It should adjust values on client based on an adjustment that came from server.
I ran into an issue when the client is replaying moves. If the server adjusts stamina (aka BoostChannelPoints) from 10 to 20, client sets that in ClientHandleMoveResponse as per the last image. So far so good.
But when it starts replaying moves on the next tick, loads the oldest move in which the stamina was 10. Thus completely ignoring the adjustment from the server.
Where I set the stamina on client
Why would your move load the Stamina back in though
Because of PrepMoveFor which I have defined like so.
The question remains though, why do you do that
What's the idea behind restoring the Stamina from a SavedMove
Have a look at the Parent Class. Is it restoring Velocity?
And then ask yourself when are the SavedMoves even used.
Right, it doesn't restore velocity or position etc. Just client input.
Correct, why do you think they aren't restoring Velocity
Because if it receives a correction, it just sets it. No reason to rewind in time velocity because that is just calculated from the user input
Userinput = unpredictable, so we need to save it
velocity = predictable/calculable
Yus, the Velocity of the Server is the new truth, and based on the saved inputs the player can now get back to it's latest predicted move, with a slightly different velocity at the end, but usually not much
Same goes for your Stamina
Right, man, I owe you a beer!
Of course, it throws away every saved move that is older than the corrected one.
(just to make sure that's clear :D)
Yep, I just didn't fully realised the idea behind saved moves, I treated them like a time-travel machine to rewind time on client. Now I know, thanks again
No worries!
βThat will be 50 dollars + a week vacation thenβ π
I know FFastArraySerializer doesn't guarantee order is maintained, is there a way to manually maintain order?
You could add your own order value to each element and sort it onrep? Shrug
Or if you have something in the data already that you can sort by.
Oh lord, I am dumb.. Can I have one more question?
How do I send the current stamina level of client to the server when I remove it from saved move?
I was using ClientFillNetworkMoveData to send the stamina to server, check if it's "about right" and send adjustment if needed. But that is based on the saved moves.
Or should I still keep stamina in saved move, but don't restore it in PrepMoveFor?
Is the Client sending the Velocity to the Server?
:P
If they have different values and those different values end up causing a correction, the Stamina will be synced again
There is no need to send it
You only ever need to send UserInput and the EndLocation
Which is what UE already does
Doesn't it also send the delta time?
The sole idea of having some state and performing movement on it, it's not really needed
There are also quite some bigger things to solve with the CMC, if you for example stun someone :D
I think I am trying to slightly abuse the CMC prediction system.
I was hoping I can use it to create a Rocket League style boost pickup. When client picks up boost it goes from 50% to 60% and use it right away.
If the pickup did not happen on the server, it would correct it back to 50%. Since the "stamina/boost" is just a CMC variable like velocity or position, I thought I can just hook it up to the system.
Cause the CMC doesn't take care of that by default. You have to somewhat update the SavedMoves so that the Client is aware of being stunned. Otherwise it replays the moves without being stunned and just gets another correct at the end. Not really smooth.
The problem here is that you start having to trust the client on a value that you can't predict
But being stunned is going to end up not nice anyway because you can't possibly predict a server side correction on the client.
The Server can never know if it's an honest prediction or cheating
The initial correction can't be predicted, that's correct
But the replaying of the moves can be updated to account for being stunned
Cause the client recorded those NOT being stunned
Well fair enough π
It can as it is replaying the same moves. The boost pickup is not moving, so it will have authority over the fact if the pickup happened or not
The only way to line that up is to either update the moves, where you then need to know how many of them (how long is the stun?) or to ensure that some outside state (Am I stunned?) is in sync with the correction, so that the client can check that. But predicting removal of that is a whole nother story
Replaying moves happens if you get a correction
The goal of predicting is to not get a correction
Btw, Rocket League does not predict their boost pads etc. I'm pretty sure.
https://youtu.be/raXX9i145-Y?t=59 Here look at the big boost, they drive over it and it doesn't instantly fill up the bar.
I've been having crazy lag and/or Latency issues at EVERY kick off for months, I've finally figured out how to fix it instantly and I also have some tips for anyone having issues with latency while streaming on PC too.
I really hope this helps some people! There really are hundreds of ways to fix latency but I've never seen anyone talk about th...
My apologies, I didn't mean the replaying moves. (wrong terminology on my end)
The car will go over the boost on both client and server.
Client thinks it went over the boost correctly, so it adds 10 boost and continues boosting.
Car goes over the boost on server but (for whatever reason) the server says it doesn't count and no boost is added.
This is when the server receives the boost level from client and sees the boost is higher than it should be, so it corrects it.
Client then replays all moves since the pickup without any additional boost from that pickup.
Hope I am explaining that correctly
But something like picking up a boost doesn't need to be networked at all
Keep in mind that your movement is in sync (in the best case)
On Timestamp 1000, Server and Client, both will touch the Pickup.
So if they add the Stamina from it, it will just work
That's also why you don't need to network Jumppad boosts
Cause you step on it at the same time
"time" being the timestamp
Right, but someone else could have taken the boost already. The fact the client sees it there at client time doesn't mean it will be there at server time
In Rocket League's case it's a little more difficult thought as this "boost" can only be picked up once every so often by one player. So it does need to be networked. It's not a jump pad where you stand on and the client predicts the movement.
Yeah but you can't predict other players movement at all
They are fully simulated, so that time difference is simply unsolvable in theory
If someone drives over the Pickup, it is gone on the serverb efore you see it
But the time diff is so low, that you will probably ram them
Which I'm still curious about btw. The video pinned in here with the person talking claims to predict vehicles... Which seems like black magic to me lol.
But in 99% of the cases I can assume client is correct and adjust and replay his moves if the server disagrees. I can totally predict that
But then again, you don't need to network that boost in the prediction like Cedric said too.
It's probably what they meant honestly π
I'm not sure what you are trying to solve here actually.
If the Server has Energy to Boost and the Client doesn't, it will correct.
If the Server has no Energy to Boost and the Client does, it will correct.
If they both have or not have Energy to Boost, it is fine.
If you pick up a boost, both will pick it up in the same theoretical Timestamp, so no correction.
Boosting happens based on Input, so that is predicted and fine.
The only case you can have is when the Pickup is gone on the Server but not on the Client, as in someone drove over it that you only see the simulated ghost of.
At that point, if you send the Server the Stamina, it would tell it a value that is fake, which you can correct for visual corrections, but you gotta keep in mind that you are causing a full on movement correction because you want to fix a visual bug.
The visual bug being that the client thinks they have more stamina than they should have
Which shouldn't happen very often if at all
I believe if your game has car collision, the time diff is so minimal that you would need to intersect the other player to get that to happen, or have a super high ping, at which point it's tricky to solve aynway
man, I can't type
First of all, thank you for the explanation, I owe you several beers now.
Gears are turning in my head trying to process it all..
I think I see what your issue is you are trying to explain Pav. You're worried about the boost bar getting out of sync right?
Like not on the server, but rather when corrected on the client's side?
Or stamina.. Whatever you want to call it xD
Exactly, if the client adds 10 boost because it thinks it went over the boost, server will correct it ONLY when CMC "final position" is out of sync and at that point it will send an adjustment.
But client can be on 20% while server thinks its 10% for a while. It only corrects it when it goes to boost, but server says your velocity/final position is too much. Here fix yourself
Damn, why I am so ****** at explaining things
Yeah I understood that. I'm mainly saying you might not want to worry about that
I think it's a valid concern though.
50/50. if it happens, sure. But I'm not convinced this will happen often
But sure, let's assume it happens often and we want to fix it. Probably good to have that written here once or so
I don't think this should cause a full correction
Correct me if I'm wrong Cedric. But lets say you pick up 10 boost and had 10 boost but the server disagrees with the client picking up that 10 boost. Then the client gets corrected but will still think it had 10 extra boost and will from that point forever be in that +10 boost state.
But one can start with that of course
They already sync the Boost Value in the Correction
But only if the Movement is actually wrong cause of it
Which only happens around the 0 value I assume
So if you have 60 on client and 50 on the server, and you don't boost, it will do nothing
as in, it won't correct itself until the Server hits 0 while the Client doesn't.
Then I'm not sure what the concern is. If the server tells the boost value from a certain correction point then the client should reset the state for all steps before that correction move and set that to the new truth and then loop through the other new moves to catch up like it normally would.
The concern is that the UI shows a wrong state until that correct happens
A more extreme thing would be that both are on 50% and the Client then picks up 50% locally, showing a 100% bar while it#s actually 50
Worse case would be if the client thinks it DIDN'T pick it up but server thinks it picked it up
So on client is 10% and server is 20%. Client cannot ever boost down to (servers) 0%. It will never get corrected, as it seems that client just stopped boosting at 10%
That's impossible to fix I would say then. You can't possibly predict a wrong value before a correct happened because your client thinks it was "right".
Which will drain down to 50 and then gets correct to 0
It will always correct if they are different
Cause the Client will not boost while the server boosts
Then it gets corrected back to whatever the server has left
Doesn't matter if Client > Server or Server > Client in terms of boost value
Just not on pickup
You can send the Server the value you think you have as a Client and the Server can disagree, correcting it
Which is what they want to do
But when the client reaches 0 boost, it turns off the bWantsToBoost boolean
No it doesn't correct. I see the issue. If my client thinks it has 0 boost while on the server I have 10 boost left then it won't roll back because that's completely valid behaviour from the client.
That's wrong
bWantsToBoost is the Input Flag
Not the bCanBoost
You need to diff between that
bWantsToBoost can be true while bCanBoost is false
The Client always tells the Server I WANT TO BOOST if the key is down
That does make sense...
But that will never result in a boost if the conditions aren't met
Which is fine
So yeah, back to the issue at hand: Correcting the Boost Value without waiting for a natural CMC Correction
You can add the BoostValues matching as a condition to that CMC Correction
But that means you are "correcting" movement even though the movement was okay, just the float was not
You could send a flag in the ClientCorrection Data, that it's just a Boost Correction and not a Movement one
Or just check if the change in Value actually matters for movement
Probably a few solutions
Which would require treating the BoostValue same way as the FinalLocation and sending it from client to the server, right?
Just a sanity check
Yeah
I think that is exactly the solution from the start of the conversation, just need to avoid "loading" the old BoostValue during replay moves.
Thank you both guys! Do you have a Paypal, I would love to send you a beer for your patience with my slow-ass brain
You need the Boost Value in the SavedMove to pass it into the MoveData, or what's the idea?
Right, and the only "clean" way I see is in the FSavedMove_Character& ClientMove
What keeps you from just taking it directly from the CMC?
Great question, I have no idea how to access the CMC from FCharacterNetworkMoveData::ClientFillNetworkMoveData
ClientMove.CharacterOwner->GetCharacterMovement()?
Not sure that works
But worth a try
Yeah that should work
Native does that too
const FVector SendLocation = bDynamicBase ? ClientMove.SavedRelativeLocation : FRepMovement::RebaseOntoZeroOrigin(ClientMove.SavedLocation, ClientMove.CharacterOwner->GetCharacterMovement());
Oh right!
MP is easy! Just have everyone do their own thing! π
Just act like all the lag is part of the game
HAZAAAAAA, IT WORKS!
Lol.
A bit hacky, but it treats the BoostValue as the FinalLocation and corrects the whole thing if incorrect. I am gonna add the optimisation about just boost value incorrect
It's superhot, but instead of stopping time, people move about in time. Time jumps are simulated by lag.
Also this conversation actually cleared up a flaw in my understanding of CMC. I thought it always send a location in the client ack regardless of being a valid or invalid move, which it does not.
(Unless being corrected)
I think I learned about CMC in the last 20 minutes more than in the last 4 weeks reading the code
Again, thanks guys
Just build a game around the flaw of peeker's advantage
π
cough source2 cough
Or turn it into peeker's disadvantage. If you peek, you die
I probably won't be making an Unreal game any time soon, although my job uses Unity lol.
Don't question me being here π
Google by any chance?
Technology and community!
Let's just ignore 2D though.
π
2D is an old forbidden knowledge, we don't talk about it here
Just make a 3D game with 2D art like Cult of the Lamb did for example.
It's been workin' for Epic for this long π
Btw. Does anyone have some ideas for a fun 1-2 days multiplayer challenge? π
If you are looking for a challenge, try recreating a spinning cylinder with obstacles in UE.
https://www.youtube.com/watch?v=q-u87nhT5wk
This is in my opinion really challenging task, but might be fun for a day or two
Subscribe so you never miss a new level of Fall Guys. NO Spam, NO phony tips or tricks, ALL gameplay, ONLY Fall Guys.
All Season 4 Levels - https://www.youtube.com/watch?v=W35WkaStKFA&list=PLTgZDuddvpcPA6pMAg8McbxYvOL-nz0Db
All Season 3 Levels - https://www.youtube.com/watch?v=laEaMIgxyDQ&list=PLTgZDuddvpcM9JIY42hbwayDoUc4kvzyd
All Season 2 L...
It can be easier, as long as your game design doesn't care about lag
I really wish I had a good turn-based idea
Stuff like Gloomhaven is pretty cool
Relatively close to D&D, yet playable as a boardgame/pc game
:P maybe that helps with your good idea hunting
Atlas reactor was onto something
But they ruined their game by swearing it was p2p material
Like imagine league of legends or smite came out with a $30.00usd price tag π€‘
Then they realized no one would buy it for free. So 2 years later when everyone forgot the game existed... they made it free but you had to grind for a month to unlock 1 champion, unless you paid for the $30.00 champion pack 
The game died and they shut it down
Which BP would be the best to keep things like passwords or variables that I can control for ALL players? TIA
That you can control for all players?
Yea, for example, I want to have a specific enemy be chosen at random upon game start, the variable that controls the enemy would need to be the same for both players. If I set this variable on the character or controller, it could be set to different values.
Maybe im overthinking this lol but im not sure which BP would allow me to access the SAME value inside that variable.
Put it on a game state class.
Game states are replicated to everyone and everoyne has the same one.
Thank you!!
hi, how would you send an anonymous actor in multiplayer to enemy player? Eg. you have actors types A, B, C; but for a brief period you don't want client to know what type it is - client's only supposed to know that it is an enemy actor
What info is it that you want to send about said anonymous actor?
You'd probably have to spawn some other replicated actor that the server then updates as necessary with whatever information you want replicated. You'd probably want to override the netrelevancy of the actual player's actor to only be relevant when you want and then do the same for the other actor to be relevant only to enemy players.
thanks, I thought of something similar, I hoped there is an easier way.. something like replicating child actor only, where child actor would be the anonymous actor
I think I can do it non-authoritative which is pretty much what fall guys seems to do. Players bumping into each other causes no corrections whatsoever along with that there are some pretty bad movement cheats out there according to YouTube lol. But full authoritative behaviour I'm not sure about, the issue I feel like is that the client needs to predict the start of when those cylinders should spin. If there were no obstacles it was easy but because of the obstacles it needs to be perfectly aligned or you will constantly get corrected if you bump into anything whatsoever. I'm honestly not sure how to make it so perfectly aligned with each other that I can get it to not correct π€
I spent couple of days on the no-obstacle version, and it wasn't as straight forward as I thought. I learned a lot about base-movement in CMC and the fact it absolutely hates rotation. It is fine with movement though, just the rotation (even on a simple spinning plate) causes constant corrections from server. It was very much interesting problem for me personally, so I thought you might enjoy it.
I think I can get that to work, just not sure about obstacles.
For rotation it doesn't matter at what time frame you enter it as long as you rotate around with it, if it rotates constantly then you don't have to care about it being exactly predicted as long as the client does predict that it rotates.
But obstacles will absolutely correct you if you bump into them if they aren't exactly synced.
Let me see if I can get rotation to work first I suppose π
Best of luck! I hope you have fun as I had, but with a lot more success π
If you manage to get it to work, I would be happy to buy you couple of beers to know how you achieved it. As I mentioned, I tried and failed miserably
Local person goes broke over buying random peeps too much beer.
I feel like I owe you guys for saving weeks of debugging, but happy to drink the beer myself.
Need to get used to the fact that good advice is sometimes free, because people just want to help
Quick question, what method is a good candidate where to check if user should be boosting?
the typical if(WantsToBoost() && CanBoost() && !IsBoosting()) { StartBoosting(); }
I am doing it in UpdateCharacterStateBeforeMovement but that does not feel right
Any clue why TMap doesn't support replication?
Or TSet for that matter
Like, is it a conscious design choice or?
how would you guarantee that keys stay unique on clients?
I have a question, does replication only kick off on possessed actors? I don't think that makes much sense but I think I'm facing that issue with an actor I just spawn in and pass it some data to an UObject property which is replicated. The data isn't reflected on any client BUT the one who called the server RPC to spawn the actor
it does not, what data?
if its a pointer to an object using another actor channel, that actor has to be replicated to other clients as well, on its own
yeah it's a pointer
I'm working under the 3rd person template, I would assume that actor is fully replicated isn't it?
also, wouldn't be that a problem if said player disconnects from the server?
so how can I reliably replicate data on a random actor without any dependence on player actors?
now that I rememberw
the networking project has that chest example
for context, this is what happens, you can see client one dropping it sees Apple x2, but client two sees Apple x1, it doesn't affect the pickup as it actually gives the client two the 2 apples
and these snippets of what I have
Nevermind!
leaving this here for the record, but the issue was that I set a condition to the Quantity property of the item
DOREPLIFETIME_CONDITION(UItemBase, Quantity, COND_OwnerOnly);
I had this added recently which was causing the issue
apologies
Glad you figured it out
Hi, how do i most bandwith efficient replicate my Gamecontroller stick inputs. I have a scene component which rotates around my character using the right stick. I am able to sent this FVector via an OnRep to the client. But whats a good way to get this from a client to the server? RPCs in the tick sounds very bandwith heavy...
That's what you pretty much have to do. Make it unreliable though. That's pretty much what happens under the hood anyway for movement.
Its not unusual to RPC inputs to the Server. You can apply optimizations to them to make it smaller. You would only send exactly the information you need, also only sending when its changed.
No point sending a full FVector to represent 2 axis for example.
FVector2D would be better.
Also their quantized counterparts are even more efficient.
FVector2D_NetQuantize
alright, thanks for the infos. I will go ahead and continue with RPCs and NetQuantize Vectors
Maybe i am not smart enough...do i have to replicate my input values? I save the Values of the right stick X and Y axis in Variables and use these in a function to calculate a location. This function calls a serverRPC and pasing in the Stick values. The Values itself are replicated but i am still unable to change the location from the client. Do i need to call Server RPC for the Input itself? (binding the input to a function and call the server rpc in this function)?
Replication only occurs from Server to Client.
RPCs are the only way for a Client to tell the Server about something.
What exactly are you doing?
Why do you want the Server to know the Inputs?
i am working on a TwinStick shooter. For this the controlrotation is quite useless. My character has a scene component attached to it. This component is used to aim at and rotate the mesh towrads to. Its also used as the direction for my Gun Bullets. With the right stick i am setting the location of this scene.
so i guess all that the server needs to know is the location of the scene?
A twin stick shooter should certainly be replicating the aim direction, you can just replicate a float Yaw
Tick -> Calculate AimYaw -> RPC to server
Either that or
Tick -> Calculate AimPoint -> RPC to Server
depends on if you only have an aim direction or an aim point
if you wanna be fancy, short/16-bit is most likely enough for a direction
Just think like "What is the minimum amount of data to sync to make the server and other clients know what they need to know?"
You can easily use control rotation for your purposes.
Whether or not you want to just depends really
For a twin stick without rotation I'd just send over the AimPosition tho
so basically Tick->Calculate Aim Point (by using X and Y from the right thumbstick) and than RPC (pasing in the aim point and let the character aim to this point)?
Yeah later in tick the character aims towards AimPoint
You'll have to do some shenanigans to make aiming NOT be delayed by ping, stuff that's handled under the hood for you when you use ControlRotation
using Skip Owner on the replication condition on AimPoint will let you use it locally without being clobbered by updates from the server (ping delayed)
Also tick will want to gate by Locally Controlled for calculating aim point, don't want remote clients to try looking for mouse inputs etc
so
Tick -> LocallyControlled? -> True -> Set AimPoint -> RPC to Server -> Update Aim
-> False -> Update Aim
RPC -> Set AimPoint
the only reason i do not use controlRotation is the fact, that the simulated proxy doesnt has a PlayerController...which i need to use the ControlRotation. I thank you very much for this detailed answer. I will use the next two hours trying to get it work π
Client: "Hey Server, I'm aiming at XY" (->Server RPC)
Server: "Thanks. Let me perform some anti-cheat math so you're not shooting the enemy base from Alaska"
Server: "Let me tell the other clients about your new aim position." (->Unrel. Multicast or Replicated variable)
You'd probably use an unreliable every tick rpc for tbr client to server stuff.
Specifically for that situation.
make sure it's not any replicated variables, I'd probably only use Multicasts for that
replicated variables are reliable iirc
So it would be mor efficient to use an NetMulticast instead of an OnRep notify to sent the location from the server to the clients?
you can onrep
Onreps don't really get involved with server to client stuff. They are a response to the server replicating a variable.
make sense since i can not pass variables into OnRep's. Unreal was not confusing enough for me...thats why i thought "why not implementing multiplayer π₯Ή
Lol
I mean you'd be forgiven for finding multiplayer complicated, anything asynchronous can get very confusing quickly if not constrained by a framework. Luckily, Unreal gives you the building blocks to work with.
I've had a couple Unity projects in the past where we had to basically custom implement replication because they change their engine network solution every two Saturdays it feels like...not very pleasant to work with.
Unreal is heading that way with Iris.
Ehh - we won't really get much with Iris for years and years I believe. UE's standard networking solution is going to be around for a very long time.
There is a difference. The Unreal one works. The Unity one...well...you can't even invoke a message/RPC on your own listen server.
https://github.com/Unity-Technologies/com.unity.netcode.gameobjects/issues/1524
If anything I would think Iris would only change the underlying implementation of the network layer. Not anything forward facing to developers like how you would normally apply replicated variables and RPCs etc.
So id expect for the everyday developer it would appear business as usual.
idk enough to say. But that would be nice if it were the case.
I just imagine it'd be like a different framework that you have to route stuff through.
Yeah I only looked at it briefly
But I doubt they would introduce any major fundamental shift in how a developer would manage replication.
Whos to say though
π€·
Iris seems quite far off.
Yup, agreed.
Hello!
I am trying to make a 3D Multiplayer FPS game with UE5, i was wondering if i should start with tutorials fit for the type of game im making, or tutorials for UE5 all together. If anyone is able to help just respond to this message or send me a DM. Any tutorials that you guys rate would help! Thanks
Ask yourself, can you build a working, playable, relatively bug free and complete Single Player game?
If the answer is no then dont start trying to make a Multiplayer game.
Learn how to build something simple first.
Learn how to use the Editor properly.
Okay, thank you! i appreciate the help
Also learning the architecture of the engine is something I dismissed because I have a decent background in programming. Boy was I wrong and didn't realise that the engine comes with its own ways of achieving things so you don't have to reinvent the wheel.
Hello everyone. Can someone tell me if I can download and import assets from the marketplace on Unreal build from source?
Yup
Being an indie doesn't allow me to make my own assets haha, the marketplace is literally essential to me and my projets. π€§
Isnβt it just them trying to push networking performance as far as they can
Hi, how to handle seamless travel for GameModes with different PlayerController classes? Game throws error "Cast of A to B"
hi, anyone know how to increase 2 client framerate in the editor ? it's basically unplayable for me
it's locked or performance issue?
Not sure about 2 clients, but for main one you can tweak fps in Project settings -> search "framerate"
also there is cmd launch options
Play with your scalability settings, disable the option to lower framerate while in background
But do get two machines at some point
thanks
Why it's not possible to open a listen level for a specific port?
Yeah, as far as I know after packaging, run it with -port=1447
Full command - https://forums.unrealengine.com/t/how-to-change-listen-server-port/399618/3
I want the option to change the listen port in my game menu
Specific port could be held by another process in the OS. In most cases it will be free and cmd arg would work, but as a workaround you can display actual port in the UI, so other players will know where to connect
int32 Port; GConfig->GetInt(TEXT("URL"), TEXT("Port"), Port, GEngineIni);
ah thank you!
Hello everybody. I need help with technical implementation of a multiplayer "instance" like game.
I want to implement this on a single server to avoid complex instancing logic (don't want to run instances on individual servers).
I want to make a game where players build their own "cities" but each player is isolated in his city and they only share "shipping lanes" (city = instance).
- You are able to switch your view to the neighboring cities (You can see and interact with only one instance at a time).
- The individual city instances are supposed to be as big as possible (possibly spanning the whole world space).
I figured I would just "overlay" the actors in the world space on the server and each client would only see the actors that he can interact with.
This approach has issues, you only have limited number of collision and ray cast channels and thus you are limited to the number of overlaying actors you can have while also having UE handle 3D collisions and etc.
I also could "stack" the city instances vertically (set a max height an actor can reach i a city/instance) and move the other instances on the Z axis on the server. But this feels even more hacky π π
NOTE: The server tick rate and bandwidth is not an issue as the city building is very simple and has no "mass AI" or anything like that.
Is there a UE native way of how to handle this type of game? Or am I just thinking about this all wrong and this is a bad technical design to begin with?
Thank you for any help. Every opinion is welcome!
Nah u can make your own, it's a great way to get a nice efficient workflow built and to make sure your art style is consistent
You won't be making AAA quality stuff as a one man show, but you can make some decent assets with a little bit of work.
Never seen such an error, and it should be totally fine that they are different. Might want to debug and let us know what caused it
#fab has finally merged into #multiplayer
ok who put the foliage to block all?
yep, already found bug in my code 
Gamelift local is not working for me. I am getting this error when trying to run it: ```
Caused by: java.lang.reflect.InaccessibleObjectException: Unable to make protected final java.lang.Class java.lang.ClassLoader.defineClass(java.lang.String,byte[],int,int,java.security.ProtectionDomain) throws java.lang.ClassFormatError accessible: module java.base does not "opens java.lang" to unnamed module @270421f5
Command to run is
java -jar GameliftLocal.jar -p 9080
ok, figured it out
Need to run
java --add-opens java.base/java.lang=ALL-UNNAMED -jar GameLiftLocal.jar
How would I go through my project and make sure everything works for multiplayer? I started fairly recently but pretty much from scratch. Iβve read the documentation but it just says to βplan for multiplayerβ. Any good starting places to learn?
Lots of good info in the pins of this channel.
Oh perfect, cheers
How does UE handle client/asset updates? If I have a client/server and change anything, does a player need an entirely full new client?
That would normally make sense yeah
Thanks. Classic ue documentation
'Once you have released your project, you will probably make updates to it after the initial release. This process is known as patching.
π
<doc ends here>
Yeah I would stay away from that doc
Just use Steam, Itch.io, GOG, EGS, any normal platform
You'll get way smaller patches in any scenario barring use of encrypted pak files which don't do anything anyway
If I replicate a subobject, will all the variables in the subobject replicate aswell, that are set to be replicated?
As in a UObject?
yea
They will. Once you set it as a replicated uobject of the ActorComponent or Actor, it'll function just like any other replicated object. But you have to do the SupportedForNetworking, and.. the other function I don't remember offhand.
Yea, alright cool! π
GetLifetimeReplicatedProps π
No, the UObject one. You run it on the object's outer.
ReplicateSubobjects I think
yea, it works π
Hello, i have a preblem where when i open play as listen server and client when the hosts hunger gets to 0 both the client and the host get the death screen even though the clients health is not 0, but when the client has hunger 0 and the host still doesnt only client gets the death screen.
For starters. If you're calling a client event named Death, you shouldn't be checking client's Hunger state. Server has dictated that that character is dead. Client shouldn't care why. That and you're setting state on a Client event which means that you're not really sure what you're doing with your state. Any and all gameplay state should be set on server and client can use OnRep or RepNotify functions to handle that state changing. When server tells clients that they need to be in a state like death, don't let the client question it.
Also death should be a repnotify imo
Question about replicated physics:
Imagine football scenario and when ball touches character, it should add impulse to the ball (aka kick it).
I am running into problem where I cannot execute client-side physics on a replicated ball.
If I run this on a client, it does nothing.
BallActor->GetBallMesh()->AddImpulse(FVector(1000.0f, 0.0f, 0.0f), NAME_None, true);
The ball mesh is the root and only component etc. If it gets executed on server it works as expected.
Btw, that was the use-case for the custom physics contact modifier I was asking about ( @dark edge ).
Does unreal let you call a multicast RPC to specific clients.
-Edit- nvm unreal does not.
Replicated physics is an entire rat's nest on its own
really really hard if you need prediction
only kinda hard if you don't
Yeah, I have finished my 10th GDC talk on it and I get it's untameable beast. I just needed something that was "good enough" with higher ping. Doesn't even need to be secure.
I'm doing a physics game but we're just routing input to server and letting it play out. Works because it's a vehicle game, who cares if it takes 30ms to start your tank turning
I even found this from Dave Ratti https://www.youtube.com/watch?v=3HLvNu-j6eg&ab_channel=DaveRatti
So what happens if 2 clients each think they kicked the ball?
since they're both in the future on their screen
Yeah, that does make sense.
I was just hoping to simplify the ball-player interaction to 8 world directions. You can kick it only in those, so prediction seemed a bit doable at that point
Uses input from both
done
Whoever kicked the ball last (on server), take that direction/input
So what path does the ball take? They each see it go one way for ping ms then it just goes another way?
Whatever path the server thinks. Let them both kick it (even if not technically possible as they are far apart).
To dumb the problem down, I was thinking the typical fps lag compensation. Check if the kick was possible at that time that client claims it did the kick and if possible apply the force.
I think physics gets a lot tricker because you have 2 agents disagreeing on an event that neither one "owns"
in a shooter you just favor the shooter, easy peasy
That's why I'm glad we just went with routing input to server for gameplay purposes, there's no disagreement. I sure as hell wouldn't want to be trying to predict the motion of player-made vehicles
The approach, "just take the latest one" should work, it's not gonna look great but I hope it's gonna be good enough.
The problem is that the client cannot effect the ball physics.. No matter what I call, I cannot make the ball go anywhere on client. (With 1000 ms ping I would expect the ball to go whoosh and then teleport back as it is corrected by the server)
Tune your physics replication settings
you're constantly getting state from the server
Thanks for the great suggestion! Completely forgot about those settings
So - I thought pitch was something you had to do manually. I have Use Pawn Control Rotation checked in the CameraBoom. I haven't handled any replication yet with GetControlRotation() and all that jazz. However, the pitch does appear to be replicating and then it also does this...I haven't been able to track it down just yet. Anyone have any ideas on where I might be able to look?
Actually, I guess I do. Hmm - could've sworn this was what you were supposed to do anyway. Welp, time to do the ol' debugger stuff
Huh - that's quite interesting. The first screenshot shows the client's pitch when pointing down. The second screenshot shows the server's pitch when pointing down. Now, the server printing is the expected value. If I point down on the client and am printing that value on the client (so locally), it shows the same value (-60-ish). But when that gets replicated to others, it's like it just can't be a negative number π€
So when printing the value locally, it shows the correct expected value (-60). But when printing the received value from the client, it is incorrect and can't go below 0. Very strange indeed π€
Yup. Looks like it's intended.
Well - poop
Can anyone explain playerstate to me? For example if I want my players to have health (which is checked out by the server) I would store it in their playerstate? Can I then access the health directly from their playerstate?
You can, sure. But it depends on your game honestly.
Playerstate is pawn independent. So you put things in there that you want to remain upon a pawn respawn.
PlayerState is a class you would use to hold information you want OTHER players to know about that player.
Ooo this makes sense. So for example if I wanted to display a health bar over other players heads, that would be using playerstate?
Yeah
Sure, but probably not.
Usually Health is intrinsic to the Pawn (player visual representation)
So you would want that on the Pawn.
In some form.
Playerstate is for things that should persist beyond the player's controlled character.... For example, a Player's score in a match.
Ohhhh
Easy way to think about it.
Think an inventory.
Do you want the inventory to be destroyed if the player dies? Put it on Pawn
Want it to persist through multiple pawn spawns? Playerstate
Ohhhh
Okay
For example number of kills would be through playerstate
Like total
Score is potentially a value you want other Players to know about. Score has nothing to do with Pawns.
Hmm
But also like DevilsD said, other players have access to the playerstate if stuff is replicated.
Hmm. So for example if I wanted to display my health to other players, what would I use?
I would use the Pawn for that.
I would put that on pawn, then in an OnRep variable, update the widget component.
Dope. Thank you for the answers guys
Pawn has a lifecycle, PlayerState does not.
Having a hard time wrapping my head around the multiplayer and replication system
Health is tied to the lifecycle of a Pawn, hence you would not have it on the PlayerState.
https://forums.unrealengine.com/t/what-should-i-do-in-gamemode-gamestate-and-playerstate/93584/3 This is actually a nice little succinct explanation of some of the core stuff.
And of course - always refer to the network compendium
yes love this thing
hello, how can I run code only on the client?
I tried
if (GetLocalRole() != ROLE_Authority)
but that doesn't seem to work and it basically performs the stuff on all the clients?
nvm, found that I also have to compare the actor this code is being executed on against GetWorld()->GetGameInstance()->GetFirstLocalPlayerController()->GetPawn() to see if this is the actor my client possesses
a lot to learn still!
My thoughts as well when I see people putting ASC on PlayerState
feels weirdman
There are different reasons for that though.
one could justify health on PS in a very specific game, too
multiple Pawns with shared HP
Of course, its unlikely that was the type of game they are working on though π Best keep it simple really
Hello, I have a small problem, I am trying to make the player use different anim bs based on a variable through the anim bp, the problem is, this variable is for some reason being updated for all clients (Making all players use the different anim bs) is there just some variable replication setting im missing?
you'll need to show how are you assigning and replicating that
(most likely you used a GetPlayerController/Character/Pawn[0] connected to a Server RPC
or a Multicast
Im doing it so that if a button is pressed, it will set the variable to true, once the variable is true, it will switch to the anim bs state
what is As KLS Anim Char?
uh yes the variables are replicated to owner only, and here is what the anim bp looks like the blue lines are just connected to a pure cast of my character
need to see how you fetch the character reference
in the anim bp, or the widget
Anim BP
odds are you are fetching the wrong character at some point, which is causing your problem
this is fine
now characters don't usually have button click handlers in them, so what calls those events?
ah, nvm that was the widget screenshot
Yea
how does the widget set the character?
I cast to it on event construct
you cast what ref?
that should be fine because the widgets are local only
i strongly recommend against using the GetPlayerCharacter[0] thingy, its not safe most of the time
should I use get owner
Im just adding it to viewport once its created
how is the widget created and added to screen?
and do you have any OnReps for those variables?
I just have the variabled replicated and the option is owner only
that shouldn't do anything replication wise
as the widget sets the variable on owner only, as only owner has the widget
and you're not using RPCs to propagate them to server
so should I replicate the variables inside of the widget ?
you cant
widgets dont replicate
and it wouldnt change anything
nothing is actually replicating there as is
except the hosts player in case of listen server
but with owner onlt, not even that
@iron crest Missing a lot of core knowledge, checked Cedric's compendium?
Some truly fantastic pins on this channel too
OT but is that darker nodes?
Correct
If you have say, a time counter since the start of match - player joining immediately will have 0, player joining mid match will have 10 minutes, and so on, never getting any update ever
how to make launch character smooth in multiplayer
I'm running it on the server
and it looks so weird on the client
like it just teleports
also play montage with root motion is not smooth
I mean with Network Emulation on.
GameplayTask + root motion anim
not sure, i did not implement that system in our game, but the approach does work smoothly
Always comes back to GAS π
u'd think they would have come up with something more bp friendly for something as basic as this by now
it's the bottom one, right?
I'm guessing just using it to play a montage won't be complicated... right? π
I just want to play a montage and launch the character smoothly π
you don't need GAS to use GameplayTasks
do you have like a link that explains how to do it? I can't find anything and I'm really confused tbh
Have you checked valley of the ancient sample?
IIRC they launch their character
Not sure with the specifics
we do use GameplayTasks without GAS
Bring it over
That is part of GAS if not a custom one
I found it when going to create a new c++ class, I guess I will create it and see if it lets me use it then lol
I honestly didn't know you could only use GE in isolation.
Wonder how useful that actually would be π€
Like, doesn't GE rely on abilities themselves?
To me they come in one pack. Would be mind-blown to discover otherwise
Idk, it won't even work, it just created an empty class that gives errors when I try to compile lol
Promising start
I wish
Idk what to do. I just want to play a root motion montage smoothly on multiplayer, it can't be that complicated.. can it? or should I just remove root motion montages from my game Idk
Does World Partition work with UE5 multiplayer?
yes but in listen servers it will load the whole map for the host so unusable for listen servers
If I set a replicated variable's value in the PlayerState on a client will that change be updated for everyone else or do I need to set it on the server?
Set it on the server, server will then replicate it to everyone, including the owning client (assuming you don't have any special conditions set)
Thank you
Has anybody managed to setup a custom, non static data channel? Similar to Actor Channel but with it's own serialize\deserialize? I can setup a static channel easily, and indeed a non static one, but sending bunches doesn't look like it works ... they never make it through to the server ...
Sadly not really. Sometimes it still feels.. clunky when you spam it.
So my conclusion here is to only use root motion animations for some kind of special attacks which you can't spam.
Using that on basic attacks seems to be not great
Yet, i'm not a pro. So maybe i'm just doing it wrong
Okay, just so you know, I am looking into a solution for my own project, and I found the "ignore client movement error checks and correction" / "server accept client authoritative position" nodes which might help you make it smoother but not a perfect solution
This video here made it a lot better, but as said, also not perfect π
https://youtu.be/zD8sfoJqr14
Programas Usados:
- Cinema 4D
- Quixel
- Unreal Engine
- Blender 3D
- Davinci Resolve
- Affinity Photo
- Net Telgo delicia fibra optica, mandei a OI a merda
Contatos:
GitHub
https://github.com/nathanmiguel123?tab=repositories
Twitter
https://twitter.com/Cm77Cmtan
Facebook
Em breve
Intagran
https://www.instagram.com/homi_p...
GAS has a dependency on GameplayTasks, but reverse doesn't apply
same deal for GameplayTags
it's funny I searched 2 pages of this channel regarding root motion and you keep mentioning that you can do it with the gameplaytasks system but not once have you showed how π π not to say it's not helpful, but, just, could be more
actually .. I just realized that I was playing the montage on the client at a different playrate than the server. and now, without all the workarounds I'v added, it kinda plays smoothly I think. so maybe it worked all along?
I don't even know.
It was using c++, a guy helped but i`m not using unreal anymore
do you have the code still by any chance? would be helpful if you can share
but which git!
I'm trying to play a root motion montage on multiplayer smoothly
ah fk ye been trying to avoid that, was it complicated?
not so much
This is the only way i know to do it smoothly
It will play on both and sync for you
sounds good can you show me how?
you can check on #gameplay-ability-system
It is not hard and i`m not using unreal anymore
This part is blueprint. I don`t have unreal installed nor the project
:/
great, thanks!!
Hey Multiplayer Channel,
If i'm making a Desktop/VR Game and I want the Desktop Users to Load 1 environment with different lighting, and ExponentialHeightFog, etc while the VR user has a more basic environment but they are still "overlapping" how can i do that?
For example, the desktop user skybox and lighting is night while the vr user skybox and lighting is day but they are in the same multiplayer session.
Is there any guidance on how to generate session names for listen servers?
Not asking about how to create sessions, I already know how to do that. So far the session name has always been hardcoded and obviously that won't work in PRD
Aren't they often Username's Game?
Oh really? I don't know. I haven't seen a production game's source code manage the names before and I didn't think you could have spaces or special characters
That's simple enough if you can just plug in the username
You'd probably want a unique session name under the hood and then some display name
Right, my question was more about how to generate the unique name rather than worry about the display name so much at this point
Display name can just be a string attribute on the session
I could just use a random generator to generate strings I suppose
Is it safe to use PlayerState=>PlayerId as a unique identification that remains persistent after server travel? Because when using non seamless travel the PlayerId always changes, but with seamless travel it seems to be the same.
How else could I get unique identification for client that would remain consistent with servertravel? (In lobby, client gets a role assigned, and after travelling to match I need to see what role he got assigned)
Yes
Yeah I was wondering if there was a more ue defined approach. But certainly an FGuid would do the trick
Please tell me that I am missing something with this method signature. This is by far the most stupid design I have seen to date while looking at the online subsystem
DEFINE_ONLINE_DELEGATE_FOUR_PARAM(OnSessionUserInviteAccepted, const bool /*bWasSuccessful*/, const int32 /*ControllerId*/, FUniqueNetIdPtr /*UserId*/, const FOnlineSessionSearchResult& /*InviteResult*/);
UserId is the same user that accepted the session invite... not the ID of the friend that sent said invite
it's retarded
Its like a mailman delivers a letter that you are supposed to reply to, responding back to the person who sent it, and all you get is the company address. Ok great, so whom do I address this letter to? Oh I don't know, because there is no name listed here. Fantastic!
i think i mightve made a mistake in my replication if anyone can help. My code works fine in multiplayer and it subtracts a bullet, but in single player offline, it subtracts two. I think its related to having two RPCs doing the same thing, but how would I replicate to the client as well if i dont have both rpcs
You shouldn't need to have a run on owning client node that subtracts the bullet, that then calls the server to subtract the bullet.
Flow should be along the lines of:
Client Pushes Input > RPC to Server > Server Fires Bullet, Fire Subtracts Bullet
thats how i originally had it, but because my UI is local or something it wouldnt update
unless i have to use a server rpc to get it
Variables just don't update UI unless you have a UI binding. Otherwise, you need to call the UI to update itself somehow.
i just have it bound on tick
it works fine when i replicate to owning client
but it doesnt work when i do just server
Then you may not have something replicating properly. Perhaps your inventory component?
this is all i hjave tho in the inventory component
Even your weapon. If you want it to replicate values, it needs to be a replicated actor that was spawned by the server.
as in checking off is replicates and having a owner and stuff?
or havinbg the correct rpcs
yes thats working fine
so i basivally have to rid of owning client then figure out how to update my UI from the server
If what you say is true, in that on tick within your widget you're calling the "Ammo Message" code, then all that should be necessary is updating the ammo count while running on the server.
Again Input from player to shoot > RPC To server > Server Handles shooting the bullet & subtracting the ammo.
There is no need to have additional "Run On Server" or "Run on Client" calls to handle firing a weapon and updating an ammo count anywhere so long as everything is properly marked to replicate.
yes it works when doing just server, but i think im struggling on figuring out how to get the ammo count to display on the ui from the server.
A replicated variable means the value gets sent from the server to the client.
So if you set the variable on the server, it will propagate to the client(s).
ohhhhhh so thats what the two replication balls are for
so if i enable that on a variable i set on the server, it will always get it from the server
No
It's not about "getting" from the server. The server will attempt to replicate it, in other words, if it's available, and is pertinent for replication, and the client actually receives it, then the value of that variable on the client would be set to the same thing as what is on the server. One can still manipulate variables that are marked as replicated on the client without the server knowing about it, and it's not about the client making a request to the server to receive the value.
so to see if im understanding correctly, it sort of flags it for the server to replicate to the client?
Yes. It's marking a variable to indicate that if the value gets changed on the server, client(s) would receive the server value of that variable and have it set in their copy.
