#multiplayer
1 messages · Page 686 of 1
Was hoping for shortest route to simple login and 3 or 4 ppl in a walk around and chat server, no crazy physics or rapid update required, other than chat.
Hosted either at home/work box or AWS if that would be easier
Dedicated server with a simple fps template and chat is quite easy, just need to rpc a text to the server and multicast it back
fps to reduce skeleton animation data?
Just because it exists
ah ok, so 3rd person also good
Because network sync performance is not so critical for me (i hope) as its walk around and chat, im thinking of just buying a template UE4 and see if it works. Plan B is do more tutorials.
I looked at Cognito and OWS2 but i think they are still above my skill level
Just need two rpcs here
How many hours would it take and experienced dev to put together, Login, chat, server/client, Load Menu if i try find and pay for a dev
Depends if you want that login stuff to be specific to that server. Hours or days, if that's the case.
Whats easier, specific IP im guessing?
Steam
Steam is easiest? But can i publish tiny demo to steam. Sounds hard
Don't need to publish it really
hey
Ok thanks i found a Devaddict tutorial in UE4 for steam, ill give it a go. You have been real helpful.
so i need some advice
I'm not new to unreal but I'm super new to multiplayer
so where should i start from
@boreal crag Learn the difference between Replication and an RPC. Learn the difference between what RPCs can be sent from which machine and how they're sent/dropped/ranlocally (Learning this requires understanding ownership on clients). Learn the game framework from a multiplayer perspective (GameMode/GameState/PlayerState/PlayerController). Once you get a decent grasp on these core things, the rest is largely just tools and deeper learning.
Okay. Thanks for responding. I read about Replication and RPCs in Unreal's documentation but they're kinda vague. So if you happened to know any other way or tutorials ......
hi hi 😄
how can i make an online dedicated server game without losing money on the servers ? ps i want the game to be free 🙂
i hate microtransaction
and dlcs
just want my game to be played by thousend of people
no child has to feel the abuse of the big moneymilking industry
Don't use dedicated servers is the answer really and/or distribute your server binaries and have players host them themselves. Lots of arguments for not doing that though.
bud i want it to be online just like runescape that you can log in different worlds and stuff ?
and bring your acc with it afcourse xD
If you want dedicated servers you will have to host some official ones yourself, which will cost you money - and a fair bit of it. The trick is to make enough money from the game to pay for it (which most people will never be able to achieve)
thats why i learnt epic xD
thanks for telling me the ugly truth xD
The best multiplayer advice you can get is, make a singleplayer game.
Also to this. This has little to do with Unreal. This is backend systems architecture. Which will cost more than your hosting dedicated server worries. 😄
ooow dam, yes i got all the scripts ready from a good pack, only need to host a server
bud... when i dont listen and think like what the heck i just do it, what or how will you do it ?
its kinda like the game that i can play day in day out and for that i am willing to pay even 150 euro per month for servers , also is it okay to ask this here? im not that clever and almost always get banned for asking the wrong questions
MP on any real scale is impossible without time, money and an experienced team behind it.
reality is not 150 per month
u're not hosting a minecraft server
my handicap makes me incapeable of working, everyday i use the engine at least 10 houres to something 24 houres a day
okay so its going to be hard to make it all happen,, can i get some more info please? 😄 just give me the hard reallity, no matter what i have to do it no matter the milestones and mountains i have to climb
you will hit a bump with character movements looking not great
Really with Jambax on the scope though. Seriously. Unless you have a few dozen grand laying around to start putting a small team together for a few months or to hire a freelance studio, you're really better off starting singleplayer. You can't just make a multiplayer game. You really have to understand the engine inside and out. You have to know it's limitations and implementations. And that's just for a small 2-8 player game. You are not going to make a multi-world game on your own. At least not with enough lifespan or sanity left to enjoy it.
yes thats true, i ge
i get it a little bit now,
even when i do it on my own then, the assets of mine will be outdated only the new type of game im thinkig of will be new
thanks for the reality check
gone think of what i really want then
I'm having trouble getting a dedicated server running. My game is working as a listen server on LAN and online and the dedicated server only let players join from local machine when using shipping build, switched to development build config so it shows the log now but can't connect at all anymore
okey know i know what you all mean xD sory laran wish i could help
So it turns out the animation was 'playing' on the server, but not actually animating the skeleton it seems? My AnimNotify State's were still firing on the server, but the skeleton just wouldn't animate. Skeleton Mesh > Optimization > Visibility Based Anim Tick Option > Always Tick Pose and Refresh has it animate properly
But the AnimNotify State's don't seem to fire on the client 🤔 nvm
its not a replicated component
how would a client know if it is triggered if it is triggered on server
if it is not replicated
When animations are playing, some notifies are still triggered - but no bones are actually moved. Computing final bone transforms and skinned vertex positions is the expensive part of animation, which is why generally you don't do it for something not "on screen" or "rendered". Also since dedicated servers are usually single-threaded, you don't want to slow down your game/network logic by computing that.
Oooo makes sense. Nice to know 👍
hey guys, i'm just learning multiplayer shenanigans and I'm not sure I understand completely the Client->Server RPCs
I have a pickup in my world and I would like that when my Client overlaps it, the server sets some flag inside the Client and the Client then can react to this change
(Basically Client overlap pickup -> Server receives event, set flag on Client -> Client reacts to change)
My client is a ACharacter
I did read Cedric's PDF but something didnt click I guess
@sinful marlin a lot of animations that require say bone positions actually use a fake position
so server knows what position without needing to animate
just need to do tricks, to get perforamance and functionality
Is this a UFUNCTION(Server, Unreliable, WithValidation, BlueprintCallable) decorated function call?
WithValidation is no longer needed unless you are doing validation checks
so im correct in assuming this is a ServerRPC ?
Oh? I'm have to look more into that. Because all I care about from the animation is where the socket is that the weapons are attached to, so the weapons are in the correct location. and rotating too I suppose.
@sinful marlin you define the position, rotation is normally determinstic (ie actor forward)
or control rotation forward
@glacial stump that is a server rpc yes
overlaps run on both server and client (unless you gated it)
you just want a client rpc from the server to do something
void ClientSetOverlapFlag(bool bFlag);``` for example
server will run that on the overlapping character
but be warned, RPCs like Server and Client can only be done on a an actor owned by the player issuing the rpc.
I see!
if you dont care for the server, why can the client not set the flag themselves?
as overlaps can run on client and server
well the overlap thing was just for the example
what I want to do actually is set the flag from the client's HUD
I thought overlap would be the same as interacting with a button on the HUD
in fact, I just wanted the server to react to a client event (button click, overlap on pickup) and the server to do something to the client
and the flag in that example would be changing some damage stats inside the client's gameplay ability
perhaps i failed in trying to simplify my use case
When trying to simulate a dedicated server I have things setup as shown below, and the number of players set to 2 but I see the 2 clients, each with there 2 windows, and then, what I assume is the server, who has no associated play window. How can I fix this so that server doesn't act as a player and just acts as a dedicated server?
Do the pickup serverside.
On Server
Character overlaps
Pickup logic
Notify client (either RPC or onrep some variable. Depends on what the pickup doesl
Those are vastly different things. UI is local only so for UI
Clientside
Button pressed
Run on server event through PlayerController or Pawn
thanks a lot !!
hey look at this i didnt try this but i found this in unreal engine document
https://docs.unrealengine.com/4.27/en-US/InteractiveExperiences/Networking/HowTo/DedicatedServers/
and this one made video about it
This is a crucial step in setting up servers for YOUR unreal engine game! I hope you enjoy!
How To Get Unreal Engine Source: https://www.youtube.com/watch?v=MRJUWC90aJM
Discord Server: https://discord.gg/qwz7nW43wf
Music Credits
Song: LAKEY INSPIRED - Blossom
Music provided by Vlog No Copyright Music.
Creative Commons - Attribution-ShareAlike 3...
Alright, thanks, I'll give those a try
good luck
Hey! Just quick check - if using ReplicatedUsing then Replicated is no more needed, right?
correcto
ReplicatedUsing is a bit misleading really
but meh.. legacy
shame we don't have a big shiny new engine version coming soon that could have fixed some of these things 👀
lmao
Looking at you APawn::PawnStartFire()
oh yeee
thanks 🙂
I think I know the answer to this but I want some experienced developer backing me up:
Is it better to plan multiplayer from the start? or to try to finish the game and then slap multiplayer on? 🤔
always from the start.
You would wonder how many game studios have done just that back in the days 🤦 😁
maybe late gen5/early gen6, I think people should know better now
The fact that engines have Multiplayer capability integrated from the getgo, rather than having your own inhouse engine that would either get Multiplayer capability towards the very end of the development cycle, or integrating something external like Gamespy, meant that Multiplayer was never a forethought and always an afterthought.
With it being readily available from day0, and also the evolution in how games are made means it is now much easier for it to be a forethought.
Yep, what I expected and the same as google said. Just wanted to cover all my bases ❤️
Is there a good spot for UI to be notified when the local player is created / exists in a networked game? I can setup a delegate that would work fine if the UI comes up before the player is replicated, but that can fail if the UI tries to come up after that event
I could always check for the existence of the player, was just trying to create something a bit more centralized across the UI rather then haveing to write the logic in each section
UI for what? Also what is player in this context? Controller or Pawn?
The actual ULocalPlayer always exists
If that's what you mean?
Or do you mean Pawn/Controller?
main hud UI, with elements split off into sub UI, like a Quests lists, player health, etc, and Pawn
it depends is the go-to answer
Generally to avoid a race condition in the UI, you push out some global/easy-to-access event when those objects are created (e.g, BeginPlay, or PostInitComponents)
And the UI checks for the objects it needs at initialization time. If they aren't found, bind to that event.
But Pawns in particular can change often in an MP game
I also very strongly recommend you take a look into the AHUD class. It's a fantastic client only class that is created and maintained by the PlayerController.
AHUD is a very sensible place to manage all of your UI content, treating it as a manager of sorts.
And it's also very easy to access from classes like the player controller
good advice! I may be off kilter because somebody else on this project started setting up their own kind of UIManager and Im stuck trying to work with it
The HUD IMO is the best place. You have a valid controller to handle proper ownership of widgets as a bonus, and it's very easy to access
The HUD itself can't exist without it's owning controller, since it lives there - so initializing your widgets from it means a) they have proper player ownership and b) the controller is garaunteed to exist at that time.
Can also specify different HUD classes for different game modes, so it becomes easy to change UI to match different game types etc.
Also. It's a little out of place I feel. But GameInstance has a delegate that runs after a pawn is possessed. OnPawnControllerChangedDelegates. I've never tried using that though. I dropped a simple delegate into SetPawn override in the Controller class and have it bound in my HUD to update pawn possessions.
hmmm yeah digging around in this code some more, since they did not use AHUD as the base class (for reasons Im sure) they throw the HUD up too early (i.e. before PlayerController has SetPawn called on it)
should be easy enough to clean up and erase the edge case
That is an odd place for it :/
Why on earth would they put it there...
First guess is ancient code. But I don't know anything past 4.24 😄
Hi all, I'm getting a success on "join session", but the client isn't actually loading the new host level. Does anyone have an idea as to what is going on?
It is working on a new project I just made, but when I integrate it into a project I've been working on for a year this is happening lol
world composition is not checked
Nevermind, I got it working. Forgot to open the level as a host with listen in the options 🙂
I would make a function that you can just use so you never forget
ON multiplayer basis how can i fix this ? XD
first of all i got like 80 buildings loading
i can make this what shall i click and what shall i do as settings ?
Increase the budget in scalability ini files. You can copy BaseScalability in engine as DefaultScalabilty in project and increase the values of texture pool sizes.
thanks, is this okay to be so high ?
Depends on the scene, most large projects need to increase the defaults
how's that MP related?
okay thanks
Hey guys! I'm not entirely sure if this is the right channel to ask about this, since it falls under multiple categories, but here goes nothing.
I'm looking at the first person character template and cannot for the life of me find where/if the character system stores input. I noticed that the template has built in ClientsidePrediction and Reconsiliation, but cannot find how its being implemented. The only thing I've found is where the Pawn Sets the controller state apon receiving a replication(Screenshot). But this doesn't explain how in the case of mispredicting, the player reacts fine to the input that's still in transit to the server. Does anyone here have a good understanding of how this whole system works, cause any help would be greatly appreciated.
it doesnt store input
client sends the data via the CMC (which is done on tick), via the move autonomous function
server uses the data and move itself and then sends to others for simulation
if server does not agree, it sends a client correct back, again throigh the cmc
If a property in a struct is marked as NotReplicated but a copy of the struct is sent to the client via an RPC, is there actually any bandwidth savings going on there or will it still send the amount of bytes that property takes up in it's default state as part of the full struct being sent?
Only Replicated properties are sent.
That explains sooo much, thank you.
Interesting so the server sends a fresh copy of the struct but strips out NonReplicated properties entirely, saving bandwidth? I had thought it works this way for a regular replicated struct but didn't think client RPCs would work this way too
You can further implement your own optimizations by setting up the struct with a NetSerialize function.
Take a look at FHitResult for example.
Or FVector_NetQuantize
Thank you will do
How does it even work when the struct is sent in a client RPC, does the client re-create the NotReplicated vars locally to their default values somehow?
The type of RPC doesnt matter, they are sent in exactly the same way.
Their values will be default initialized when the Struct is created
So the client would create their own full copy of the struct and only the replicated props are copied in from the RPC behind the scenes?
Meaning there's not loads of bandwidth wasted sending the entire struct?
More or less.
That's greatl
Hugely useful when you have data that is much more easily sent as one package
But has some server only properties that don't need to make it down to the client
No need to make separate structs etc.
Keeps it nice and clean
Does SetOwner not work for ACharacter? Is the only way to set ownership of an ACharacter is by possessing it?
To clarify: I need to perform an action on my ACharacter class, but only for 1 particular client in the server. This client does NOT possess the ACharacter. I thought I could do this by setting ownership of the ACharacter to the client.
For context, the ACharacter is a mech and the client is a different pawn inside of it
it works just fine
For whatever reason, Replication via Run on owning Client just does not execute
I've verified via a print string that the owner is the pawn that I am controlling
you need to set owner server side
and for server/client RPCs doesn't even matter who the owner is, as long as top owner is the player controller
Thanks @winged badger. AFAIK I am doing it server side, but no dice.
Please let me know if I'm asking the question on a wrong channel or if I shouldn't send log files here. I'm overriding a blueprint RPC event that set as run on server from a child blueprint class. As soon as my code reaches to the RPC call node the editor crashes with the log below. It doesn't seem like it's happening on an empty project. Is there a way to debug/resolve the issue?
0x0000000000000000 is a null pointer. This means that you are probably trying to call a function on an object that doesn't exist
Hey guys . I am currently making a game on Steam Online SubSystem ,A game is kind of an Business app , where people intteract, talk and exchange some job infos . And each player got some data like : email, phone number , company name etc. which they will enter during gameplay , and other players can see this info . So the question is , where to store this data online ? Do i need to integrate an external Data Base , or Steam got one ?
You need your own database
By the way is there a way to do this project without Subsystems like Steam,Xbox etc . So Basically you just run your game and just play online , without any additional Steam or other softwares downloaded ? hope you got the point
my project is designed for office worker , and they dont really know what steam is , so they just download a packaged file from web site , install and starts to play .without any other extra soft downloaded . If answer is " YES , YOU CAN DO " . so how to do this ? by public IP addreses ?
If you have an online database for details it sounds like that should also handle matchmaking etc
are player controllers (of type APlayerController or a derived class) replicated by default, or do I need to add bReplicated = true to the constructor of my custom PC class?
replicated by default
thanks! seemed silly to add it if i didnt need to 😛
Guys, When I travel between maps, the client cannot complete the travel process. is there anyone who can help?
you gotta make sure to servertravel
I followed this ip based dedicated server example, and while I can connect via local ip, i can't for the life of me get it to work over the internet. I believe I have my 7777 port forward correctly, and have tried to connect from outside my network, but no go.. no registration of the connection at all in the server log. Anyone have any tips/pointers for getting this simple ip based dedicated server example to work over the internet: https://docs.unrealengine.com/4.27/en-US/InteractiveExperiences/Networking/HowTo/DedicatedServers/
ı wrote servertravel. Should ı write ServerTravel
I made like this it doesnt work for client
its working server
but not working client
@verbal tendon
Can anyone recommend fastest/easiest way to make sure your 7777 port is forwarded properly. If i spin up my dedicated server and it says it is listening on port 7777, and I check here, it tells me it's closed. I've added windows firewall rule for udp for 7777 to always be open. I've port forwarded internal and external ports for both udp/tcp.. i have port forwarding software that tells me 7777 is open, but sites like this tell me it is closed: https://www.yougetsignal.com/tools/open-ports/
The port forwarding tester is a utility used to identify your external IP address and detect open ports on your connection. This tool is useful for finding out if your port forwarding is setup correctly or if your server applications are being blocked by a firewall.
The client needs to be connected to the server first, and only the server does the level loading, it'll take all clients with it
It used to work but now it doesn't work so I don't think there will be a problem with the size of the map.
Leave port forwarding to Steam/EOS/etc... I don't think you should concern yourself with that when making your game. Is there a particular reason that you would need to?
I want to use AWS only @verbal tendon
And you ports are not open on an AWS instance?
I am just trying to get it working locally on a static IP first, before the linux cross compile / docker stuff
Your home computer will not have open ports, that's going to need you to configure in your router, and how that works differs from one manufacturer to another. In general using AWS or any online hosted server there will be no such issue, other than that you'll potentially need to do firewall configurations through their admin website
If you just need to test that your Multiplayer logic works, you can have the game running twice on your computer ( assuming you're doing manual connection, and not using Steam ), your computer's IP is 127.0.0.1 for connecting two instances that you run on the same machine
The AWS stuff is honestly a whole nother layer i need to learn so hoping to park it here for the moment, and learn that later.
Yes the localhost with local ip connection with 127.0.0.1 does work
Then there's nothing more you need to test, for the time being
ı rendering now an then ı will answer u but ı think mine 25+
@verbal tendon I'm working with a few others on this project scattered across the globe
Just starting it though.
Are you all new to Unreal Engine?
No, I have used steam before with multiplayer setups an steam pipe, and know my way around with multiplayer from the blueprint side.
Just can't get connected with this dedicated server so i can be on my way.
Is there a good list somewhere to check through for port forwarding issues?
I'm not sure how else I can say this. Port forwarding is not something you should ever have to deal with. That's what existing solutions are for
It's a thing of the past. If you absolutely need to use Steam you're going to need two computers on two separate networks. If you want to easily test on one computer you can look into setting up EOS: https://dev.epicgames.com/docs/services/en-US/GameServices/Overview/index.html which is cross platform
But they all cost money? I guess i can move to AWS sooner. Would you recommend any online subsystems for use with AWS?
ok, i'll have a look at EOS.
Thanks for your help/suggestions.
@verbal tendon is there a blueprint ready implimentation of EOS?
There's a plugin for that
But frankly dedicated server + blueprint only is just weird
Understand. Then are there any good guides on getting the basic setup going with C++ available? I'm still beginner there so need guides..
There's that plugin I mentioned, and the API doc
"beginner" and "AWS dedicated servers with EOS" are two foreign concepts
As a beginner I wouldn't recommend diving into everything at once
Make a fun singleplayer game first using Unreal Engine
Learn C++ independently of UE
Once you have experience with both of these indepdently, start combining them. Then once you've had some time combining them, add a third element like Multiplayer
Eh I learned C++ independently and forgot absolutely everything when returning to UE, it's easier imo to learn while doing in UE so translating BPs and stuff
But agreed that singleplayer + learning to code separate from multiplayer for sure
And learning the engine
There's a whole lot to it
I've used EOScore in the past, that has support for BP and is easy to use. However you will need to configure the EOS backend properly on Epic's website, but using a plugin is definitely the way to go
If you forgot everything then you didn't get into it much, no offense. I know C++ is not the easiest language to get into, but the programming concepts are shared among programming languages. One uses logic to create solutions, patterns, algorithms and data structures used across languages are very largely the same, only the programming language used to describe your solution differs.
Basically learning loads of pure C++ tutorials kind of rolled off me, it was a lot of theory and not much practice and I was not motivated to make a compiler print out numbers and text. Learning it and making cool gameplay stuff happen in UE just was a much more visual way for it to stick with me, not to mention I already had a good foundation and games made with BP, so there was a lot of Aha moments when translating BP's that I already had working to C++
As I actually cared and practiced far more
Now I love learning about it much more
But I wouldn't have stuck with it otherwise
Two things you really need to have a good grasp onto in C++:
- pointers, specifically lifetime management / dangling pointers which is difficult to debug
- using a debugger (which is surprisingly not common in tutorials despite being the way you normally work)
Rest is optional
Well, the rest just comes naturally
Lifetimes and scopes are probably another one but if you've got pointers down you probably got that too
Multiplayer code is a shitton more difficult than run-of-the-mill Unreal C++ code
Interestingly I still rarely use the debugger even though I sort of know how it works. I find printing easier even though it's kind of dumb. I'm sure I'll run into problems where I need to inspect vars and step around but so far I haven't been hit with such a problem
Printing is very fine and very relevant, but I don't remember when I last ran C++ outside a debugger
I'm just not used to launching with the debugger at all, I always launch with Ctrl + F5
That's just weird, you could press one key less and have the ability to inspect anything, get the full state immediately when you have a crash, etc
Yeah I suppose I didn't like the idea of the debugger whirring and doing stuff in the background while I work on level design or whatever
It makes sense though
In my experience debuggers are as much a rarity in gamedev land than they are "how you run a program" in the software industry
It's really weird
Seems a lot of people rely on the print method for gamedev too I'm not sure why
I need to just get more comfortable with them
Prints and debugger aren't exclusive at all, I have loads of logging in my game, and I routinely use logs for debugging - they complement the debugger nicely to get a history of what happened since the debugger doesn't have more than a snapshot
And hell, once you ship a game you become very familiar with debugging anyway since you only get core dumps back
Printing information to screen is usually for issues that you are actively trying to track down. The debugger helps you in cases where you run into unexpected problems, and it lets you inspect the callstack and local variables when shit hits the fan. It's an invaluable tool.
Is there any way for me to have a client RPC that doesn't execute in single-player haha? I only want it to send from server to client in the context of multiplayer
That's odd. Why? What is the RPC for?
Basically I have a variable that I'm not replicating due to it being updated REALLY frequently. So I basically have some "triggers" which are intended to have the server force a value on the owning client.
Hard to explain over chat, but it's working the way I expected. Except for the fact that I really don't need/want the client RPC to be executed on a single player game due to some stuff that happens in the function.
Mmm. I mean you could just do a simple check in the function to not run if it reports as IsServer. Assuming that you don't need it for a Listenserver player either. Though there's also a straight Standalone check.
Seems like NetDeltaSerialize is being called every frame, this seems not right, right?
on a fast array
Searching for it here Jamblax says its called every time its considered for replication so maybe it's fine
I'm graduating with two CS bachelors in May and only one programming class I've taken has even mentioned using a debugger - and it was for assembly lol.
That's okay. You should see the number of college students who show up in the BP channel programming entire games in the level blueprint.

^ I heard that emote.
I wish my college would teach Unreal, or at the very least, C++. It only teaches Unity and Java/C# 😦
Unreal is a little slow in that regard since it hasn't been community free for too long. Much less interest in it before a couple of years after UE4's 4.0 release.
nt
I set up a super simple version of ownership change that I am trying to replicate, but cant seem to get it to the owning client. Happy to screenshare it in VOIP if anyone has the time 😄
- Client on dedicated server interacts with button. Button grabs some arbitrary other actor along with the PC of the interacting client.
- Button sends reference of client PC to the arbitrary other actor
- arbitrary other actor verifies through
print stringthat the PC is the client PC. It changes the owner. but doesnt get called locally on the client
So when I start my dedicated server and have my friend successfully join. They cannot call any RPC's but I can. I don't understand why?
My above example works when the arbitrary actor is a regular actor, but does NOT work when it is a character
it seems to require possession
is there any way around this?
Well the only RPC's a client can really call are Server RPC's, and they must own the actor/object making the call. Client and Multicasts won't do anything when called from a client.
Rpc is definitely being called on the server.
What do you mean by "They cannot call any RPC's" then?
Hi guys, im trying to create a health system which works online. How could I replicate this code?
Mark Health as a replicated variable. Then any time it changes on the server, it will automatically replicate the value for you
I have done that but the damage effects all of the players
? If you marked your health variable to replicate, it will only replicate to the client instances of that object. I.e. if you got char A and char B, (and they're replicated) and Char B health is reduced to 80 on server, If it's marked replicated, it will make char B health 80 on all the clients.
Does the float variable need something to make it not be the same across all the clients
Or am I meant to cast to player 1 or something?
a single characters should be the same across all clients, no..? Or are all characters healths being set to the same value?
Try checking if you are on the server at the beginning of that event.
I think they might be all set to the same value
I think it's detecting one player is in the box collision then setting all players hp
not sure how to fix
Well I'm guessing that code's being run on all clients whenever that event is triggered (idk how you're triggering it), and so they're all reducing their health because get player character is returning the one they are controlling (i assume)
I think i understand
Try throwing this at the beginning of your event:
Ok
the is server and branch nodes. then have the rest of your code branching off the true output
Judging by the name of the node, I assume it checks whether you're on the server or not? True means you are on the server, false means you are on the client?
I suppose
Hey I was wondering how I can get the server to destroy the actor upon touched. Attached is my current bp. Someone said that I would need to get the server to destroy it for every client.
Once you destroy a replicated actor on the server, it will destroy it on clients. So you should only need to call DieOnServer
well what if the player is a client?
like the player who touched another player
It doesn't matter, if an actor is destroyed on the server, it will be destroyed on all the clients it is replicated too.
but what if this is running on a client
If you call DieOnServer from a replicated actor that the client owns, it will run that on the server.
So if player a calls DieOnServer, it will make an rpc to the server, where it will run DieOnServer, destroy itself on the server, then destroy it on all clients.
well this doesn't work on the client
Because you are calling Die Client first. It's destroying itself before it ever make the call to the server
after I remove it, it still doesn't work
If DieOnServer isn't being called, then either the actor isn't replicated or the client doesn't own the actor making the call.
What is DieOnServer being called from in those snippets? Are you calling it from the character the controller is possessing?
mhm
and DieOnServer isn't being called at all? You're not seeing that print statement in the log at all?
put a PrintString inside the Die on Server event just to make sure the Server is getting it
I did
so you aren't seeing the print string from DieOnServer?
o i missed that
🤔 where is this blueprint code sitting. Is this on your character?
Show me what your plugging into the target for DieOnServer
What is the input object of that cast coming from?
Because if that object is not an object owned by the client, the server RPC won't go through
so what should I do
ideally code like this should run on the Server and the Server could just destroy the Actor no problem
does the hit event you are using also run on the Server?
you could but that is a huge security problem lol
true
but if you dont care about that for this game you could do it
how should I handle it?
What you can do for now, is change your DieOnServer event to take an actor for input. Then pass the actor from your cast into that
and leave the target as self
Yeah, because what ever you are doing to "hit" the other players is done locally
you could do an Overlap event instead of a Hit event
as a weird solution
i think that runs on Server too
wanna go in voice chat?
You can just move whatever logic you are doing to do the hit into a server rpc.
let me try it
Player presses input -> Makes server rpc to do the "hit" -> Server does the hit -> destroys object hit
ebic
🥳
also the CapsuleOverlapActors node would work more closely as the hit event did
another question
for ragdolling
only the server can see it and the client cant
can you create a custom event for ragdolling and have it run on the client and have it be secure?
absolutely there shouldnt be many security concerns RPC-ing from Server to Client
gotcha
its me again
having another multiplayer issue
with my rotating heads
it works on the client
and shows to the server
but when the server rotates, the client doesn't update properly
that is all running on tick
and it is updated in the anim bp
i dont think you have any replication there
I tried all the replications
the Server can see the Clients' because the Server is running this for each character
try it with 2 clients and check if they can see each other's properly
no the other client is the same way
so the server and that client are the only people who see it
that makes sense
but yeah the engine already replicates the look direction in GetBaseAimRotation()
but yeah that would require some restructuring
so how should I?
Hi! what do you all people think of abstract classes?.
I want to move some of my actors to just "Structs" of data and use an abstract class reference to process that data in diferent ways depending on wich subclass it's on.
ForExample: Struct with ref to class BaseClass. I can take the data struct into the abstract class and get some result.
Other class can be child of that baseClass and process the data with a diferent result.
I'm mainly trying to avoid having to spawn the actors in the game, but still rip the benefits of here inheritance
Do you think it's a good way to do something like that or do you know of some better?
im a huge advocate for using the what the engine gives you so i would go with the GetBaseAimRotation()
here is an example
but only the Pitch is replicated
if you need Roll or Yaw then you will need to replicate those yourself (ideally by overriding GetBaseAimRotation() if youre using cpp)
also the cpp channel is really good at that stuff
how can I replicate them with BPs?
I need the Yaw
wait nvm
Does it copy that from ControlRotation or what?
Yeah it uses that but if the Pawn has no Controller (ie. it is a Simulated Proxy) then it uses the replicated pitch
Is there any reason to use seamless travel instead of loading / unloading sublevels and have your multiplayer maps each be a sublevel in one persistent level if you don't need to change the GM or other properties when traveling?
Currently this implementation works to replicate Attach Actor to Component but would this be a good or bad way of doing it?
You are sending too much data
That's what I figured
Any suggestions on what would be better, it's currently for showing the player's gun, which is a child actor component.
Odd bug on a Listen Server
I have two player starts located on the map
When I press play with 2 players, the server and client starting point is always random (not intentional, this is just what always happens)
It seems that if my client starts in the 'wrong' one certain functions aren't replicated
Anyone experience something like this?
if i call get game instance from a client, will it get the clients game instance or the server's game instnace?
GameInstance has nothing to do with networking. It is a local only object. So you'll get that machine's game instance when that function is ran there.
does the player controller get destroyed when starting a new level? ie, opening a new level with a listen option
Yes
I remember someone said loading sub-levels on a client will cause loading that level on everyone, is that true?
little late but yeah, i was told that theres no way to load a separate level on a per client basis
Does anyone know if setting an array element causes a rep notify?
Hey! Is there a way to uniquely replicate a variable to some specific connections? Like a way to do DOREPLIFETIME_ACTIVE_OVERRIDE but also taking into account each connection
Yes, changing an array element's value or even changing a struct's value that is an array element will cause replication.
Sounds like a case for something to replicate through the controller, or for whatever replicating to be owned by that client.
i can't :/ for some context i'm using the gameplay ability system and in our game you can using a skill see other players health, so for now health is only OwnerOnly, but ideally I wanted to control replication based on which skill you have, but it may be a bad idea because it adds some dependency to the skill manager..
I think i'm gonna just use COND_None ^^
why is my camera component Z axis not replicated ?
Hello. I have some questions about 'onrep' variables. When is the 'onrep' function called? If I change an 'onrep' variable on server, will the 'onrep' function only trigger on server, or on server and all clients? If I change the 'onrep' variable on a client, do I assume 'onrep' to be literally 'on replication' and since there is no replication, it will only trigger on client?
In C++, OnRep only fires on clients when a different value replicates
In Blueprint it's both
Different?
Not equal to the previous one
And changing a value on server doesn't always lead to OnRep calls - if you change an int to 1, 2, 3 over a second, you will likely see 1 and 3 on clients
Why? Because it is slow?
Because fast changes cannot be properly replicated in real world conditions and so they're dropped
So im using BP and for some reason my player 2+ doesnt look around all of a sudden, can only move camera while either left or right mouse is held down, though the WASD does work. Anyone know what could be causing this???
Side note its not showing cursor, which is the first thing i thought it could be.
Solution: There wasnt a "set input mode game only" after closing lobby. Dunno why player 1 didnt need that nor why it was working before but its fixed now!
It seems like my OnComponentHit delegate is only getting called on the server when I expected it to run on both server and client. Any idea why? This is how I set it up in my constructor:
StaticMeshComponent->OnComponentHit.AddDynamic(MovementComponent, &UMyMovementComponent::OnCollision);
Is it because I'm passing in a method of one of my components rather than on my actor? I thought that would be a nicer way to separate some of the movement related things into that component rather than the actor itself.
For your first question, I think you can put this in DefaultEngine.ini in Your Project/Config/DefaultEngine.ini:
[Core.Log]
LogNetPlayerMovement=Verbose
That worked for me for some other log categories.
I am still super confused here
When playing as a client, sometimes certain actions don't seem to propagate correctly, or certain variables don't seem to correctly replicate
for instance inventory. I press play, pickup an item, and I see that my inventory count is 1
I exit and press play again, pickup item, and see that although item is correctly attached to the player in the server and client world outliner, the inventory count is 0
The only correlation I've found so far is that it seems to depend on whether the player randomly spawns on one of the two NetworkPlayerStart points in the world (If starting on left one, everything replicates correctly, if starting on right one, issues arise)
But even this isn't consistent. Once I restart the editor, the 'bad' spawn point may now be the left one instead of the right one
Has anyone experienced something like this?
Edit: I think I've narrowed my issue down to a couple actors having some sort of blueprint corruption
These actors don't seem like they should be related (just random actors in the scene) but deleting them seems to stop this issue from happening. Placing any of them back in the scene leads to this issue happening again.
Ok this is way to advanced for me to understand. But im doing a tutorial for Advanced Session. It doesnt say a version hust its 4.13 and beyond. So i put it in my 4.26 game, then it came up with not the right version, tried rebuilding but failed.
Anyone has a solution?
What kind of tech stacks do MUD type games use, or the generic "non-realtime" multiplayer mobile game. You'd only be sending requests from each player like every few seconds. Would it be some kind of simple WebSockets server, or literally just firing off API requests straight from the engine and awaiting responses?
I imagine you'd use a BaaS like PlayFab in there somewhere
I have no idea why you'd want to involve something like playfab in a MUD. At most you'd need a decent webserver, maybe a realtime websocket api like socket.io or signalr
But this is so far removed from unreal I'm not sure why you're asking it here.
Because I'd probably build it in unreal. MUD was an example of non-realtime multiplayer... I don't know what term to use to describe it. PlayFab for user authentication, data etc.
Ok, playfab's non-multiplayer services make more sense.
For non-realtime multiplayer the easiest way to go is probably something web-based for the server but tbh it doesn't really matter that much because it isn't realtime.
Websockets are a good way to deal with persistent connections in that way, like you said, and you could optionally use a library on top of it like I mentioned (socket.io or signalr) which provides a nicer api at least on the server side. For the client in unreal you'd be a bit on your own unless you can find a C++ implementation of their protocols (or roll your own websocket-based protocol entirely).
Yeah checking out Socket.Io now, it looks nice. I also have no idea, but I am really interested in learning.
More research ahead 😅
Yeah? Checking them out now
https://docs.unrealengine.com/4.27/en-US/InteractiveExperiences/Networking/HowTo/SteamSockets/
This?
Ah yeah cool. I'd want to send the packets to a server rather than a SteamID, wouldn't I?
it depends on how you want to set it up
if you want dedicated servers, your own socket api will be needed
if you want to just communicate between clients, p2p is good
Would be minimal client-to-client comms.
Its so simple that its almost like using UE as a web frontend, haha
So I made system where a line trace kills a player, then the player respawns. This is all fully replicated and working great but I have one bug. If I kill player A then I kill player B before player A respawns, player A never finishes its respawn code so he just lays on the ground but player B respawns just fine. Maybe I could get some help?
I mean that seems very specific to your respawn logic.
True
I wish i could show somebody the pipeline. Its not complicated at all
Take 5 min
Im going straight from the player character to the gamemode
The code gets terminated as soon as the same procedure gets called on another character
theres only 1 gamemode but your trying to call the respawn on 2 players. my guess is that you have delays in the gamemode that are getting clogged up when more than 1 respawn is called. thats my random guess but people can help you better if you upload screenshots of your system in the chat.
This needs to be a timer in the server version of the PlayerController.
Can you call replicated events from the player controller?
Server version of player controller?
Why does it need to be a replicated event? This is all server authoritive spawning logic.
oh yhea. delays are working against you here. if you have a delay running, then you cant call the event again, itll get clogged. so whats happening is the first execution is going through then the second execution is getting blocked because you already have the delay running.
if you put the respawn logic in the character/PC then you can have multiple delays running, 1 per character. The reason it cant be in the gamemode is because theres 1 gamemode so it cant run multiple delays without extra complications.
Yeah. Only way GameMode could handle this alone is with an map of controllers/deathtime that have pawns that are killed off, and checking it on tick or similar. Bit hacky though. Realistically this just needs to be a timer in the PlayerController. GameMode registers that a pawn was killed, gets the controller, calls an event on it that starts the timer. On Timer end, you can have that controller ask GameMode to restart it's character.
Best part is. If you do this in controller, you have an easy way to replicate a simple float of server time for death in the controller to the owning player. Easy way to display a time til respawn widget too.
Thank you! @kindred widget I'll get to work
and @heady python
This is located in the playercontroller^^
Why are you sending the controller to itself? O.o
Respawn Player should have a "Is Server" branch check on it - you don't want players firing it.
The cast to player controller is completely unnecessary if you're already in the player controller.
The unposses target should just be a reference to "Self"
The "Get All Actors of Class" output you can just use a "Random" node pulled off from the output to get a random start spot.
You only need to get the game mode, you don't need to cast it.
Cause i need the specific player controller of the person who i shot, not my own.
If i did what you just said it would kill and respawn me when i shoot somebody else
You should be calling this function on the player controller you're wanting to restart, not on the player controller that defeated it, and that should be done while on the server end.
ie. My client presses shoot button > RPC to Server target hit (depending on the type of weapon) > Bullet Hits Target Character > Server Subtracts Health from Target Character > Character's health is below 0, they are now dead > Server Gets Controller of dead character > Calls Respawn Player on player controller that is dead.
If I had to go to the front desk to inform them that someone I shot in laser tag arena was dead, there would be a lot of players never getting reset.
lol
You'll get used to it. 😄 Give it time and it just kinda starts to all fit into place.
I built everything else from the ground up though lol
Alright its been fixed haha
You guys just taught me something so important
I feel like something just clicked
It's a good pillar of OOP to keep in mind. Don't make classes, or even instances do things that are better handled by something else.
@sinful marlin If the code is setup with the is server condition it only damages one player and the other cant take damage, whereas I need it to damage the player standing on the box collision
hi
i need to connect dedicated server to database
what is the best solution for this
connect server directly to database
No, you need a Web server that verifies connections come from a real dedicated server (to avoid third parties sending requests) and processes DB requests, probably through a simple json API
or comunicate from unreal server to other server which is connected to database (node server for example)
why??
unreal not supporting connecting to database natively?
Do you want your database to be publicly accessible on the Internet?
Do you want to write SQL queries in Unreal Engine - and push dedicated server updates any time you need to fix a query?
Do you want a dedicated server, when hacked by a cheater, to have full control over your entire player data?
Are you okay with players being only able to see their player data once they're connected to a dedicated server - after your main menu etc?
i got the point
All of these are likely "no" and are solved with an intermediate server that's read-only for clients with a verified API for trusted servers
now another question
to comunicate with u server and let's say node server
what is the best model
http request or websocket connection
Depends on your server tech I guess
I'd go for https since that's like 5 lines in Unreal
i building my own server all option are open for me
Whichever tech you like more I guess, it probably won't matter much
i think http req will eat the server resources i will see if unreal support redis or rabbitmq
i need to ask onother question
Depends on traffic of course, though for the average successful indie you're looking at a few requests per second
now i had 2 levels world and city and i need chat to be available in both levels
if player A in city level and player B in world level how can they xan chat with each other
At what point in that snippet is damage being applied? Also that Get Player Controller node will return the first player controller on the server. Idk if that's what you're going for or not, but if you are running a listen-server, that'll get the pc of the host, dedicated it will be the first player that connected (i think, i havent tested myself).
Also you shouldn't really be doing widget related stuff on the server. You want to do that stuff client-side.
Can you even have people in separate levels but still "together" in UE (without big changes I guess)? Wouldn't they be in different Worlds?
i was having prblem with node server sending http req to the same server to be exec in php
and guss what this was making high traffic problem in server
Assuming you manage to get say 1,000 players online, and they send a request every 10s, that's still a reasonable 100 request per second
Servers can bulk the requests together, and it gets reasonable
i have experience in web in general but have no experience in unreal
so i have some questions to start designing my network model
now, do i need to make chat server in node js or i can make it with unreal?
if unreal can handel the feature it will be good to use it
but i still can't figure out how the players from different world have chat
text or voice chat
not only chat many real time feature
These aren't Unreal questions
I just asked about that lol: #multiplayer message
These are online architecture questions, really, ones that hint at a game with a team of 50
Lorash's got you a hint toward XMPP but then you probably want to prototype stuff to see if that's what you need
Seriously, this isn't Unreal stuff here
Unreal's networking support is for client-to-server and doesn't support chat or database servers directly - you need to build upon sockets, http, plugins
Also, if you are talking voice chat there's a bunch of legal concerns/mandates surrounding that.
What is the proper way for playing anim sequences in multiplayer? Can UE handle late joiners on its own while playing a runtime cinematic?
And how much data it's sending from server to clients? If I have too much objects changing their states in the sequence, wouldn't it bloat the bandwith?
add a ingame webbrowser and tell them to use discord
https://tenor.com/view/big-brain-markiplier-gif-14835823
My brain is kinda going down a spiral and I need a sanity check. I have a lobby where players load in and select a character. I am using ServerTravel to transition to another map.
When the players travel, their GameState is re-used but the properties are lost unless I override CopyProperties, which is fine.
But in this scenario, where does it make sense to store the character each player selected? Should it be done in the playerstate with CopyProperties or should it be done in the server's gameinstance?
I have a question about replication efficiency.
Would it be worthwhile to replicate a GUID for lookup in an unreplicated array of actor references, rather than replicate the actor references directly?
Any advice would be appreciated.
Cheers.
Actors are replicated with 4 byte identifiers, FGuid is a lot more
Really!?
I never would have guessed actor references were cheaper than GUIDs.
And if I could use an integer instead of an actor reference again for lookup, would that save me much bandwidth or is it acceptable to replicate actor references?
Huh, and I've been using replicated GUIDs to avoid replicating my projectiles (which number in the dozens).
I would not store it on the servers game instance. The game instance exists as long as the game is running(afaik) and it seems pointless to have data stored there that you don't need for the life of the program.
Replicating actor references is routine stuff, same size as a float
Thanks again, Stranger.
Hello, I'm looking for examples of a seamless transition. It will help me a lot
Aren't UObject references use FNetGUID that is 2 bytes?
🤔
Isn't it 32b?
Sorry, FNetworkGUID
Hello, I'm working on rounds based game where players gets some points on each level
Each round have a different map, my logic where I keep the points is in GameMode.
But if I change the level the data will be reseted, where should I store it?
I tried seamless travel but the data in gamemode still resets
PlayerState has a hand-over system for after travel, so maybe GameState does or can get one
Failing that, GameInstance on the server should store the data
If I'm not wrong, Game Instance exists until you close the game, so if I plan to make a main menu where you can connect to any server. I should clear the data stored in GameInstance each time the players will disconnect, right?
GameInstance on the server
No main menu there
If you're working off player data - the player data can be kept on PlayerState
GameMode, GameState are reset
I see, then I'll start learning about GameInstance, I just thought the data will persist in GameMode because of https://docs.unrealengine.com/4.27/en-US/InteractiveExperiences/Networking/Travelling/ -> Persisting Actors across Seamless Travel -> The GameMode actor (server only)
Thanks for the informations
Seriously though, PlayerState
If ti's player data
Does PostLogin get called when doing a ServerTravel? And if not, is there a similar function that can be used to determine when a player completes the travel?
Nvm, found it: PostSeamlessTravel
Seamless travel meaning any black blinking?
I don't understand seamless travel mechanic. I try to use it. But player respawns at start point as usual 😦
"black blinking"?
Loading screen
For example. Can I use some caVe as transition level. And reconnect to another server without any visible issues?
It's all the same server, I think SeamlessTravel just refers to the server transitioning maps and pulling all the currently connected players along with it
A lot of questions. From other side I read documentation. From another any tutorial or example 😦
I think the "transitionlevel" isn't supposed to be an actual level with content, it's just an empty area to temporarily store players while the first level is unloaded and the new level is loaded.
Hm, no idea how it is handled between servers. I would think an external connection would be needed to bridge that gap.
but I've never done it so I have no real idea
I assumed its a real small level as Gateway
mysterious feature for me....
So why exists NON seamless trevel mode? If in both cases seam exists. Just not to destroy all players?
Ok. I found that transition does not work for two different servers. Thanks, this question solved.
As you found out, any connection to a server is non seamless
ahh the joy of server travelling 😄
Multicast called off begin play execute on both server and client
But when called after 55s out of event tick execute only on server any idea why ?
getting this error when hosting a session
works in editor not when packaged
using epic online services btw
Debug it
how so
You said EOS, so no, not just Blueprints
If you can't do the debugging you'll have to ask whoever wrote the EOS support
Trying to get a dedicated server compiled on Linux - for the first time --- is there really no way to complete this the first time w/o using VS to generate the project files as explained here? https://medium.com/swlh/building-and-hosting-an-unreal-engine-dedicated-server-with-aws-and-docker-75317780c567
What's wrong with the generate project ?
Im on a remote Linux server
Usually you compile from Windows
I'm trying to set up a the CICD workflow for the builds
I'm a DevOps guy I just don't know how to work with Unreal yet
I'm finding all sorts of documentation about being able to compile just fine on Linux
But not a complete example of showing how to set up the target.cs file
Gotta have to check the Linux build instructions, yeah
They all reference to using visual studio and building the project from there
Everything seems to go back to that doc I posted the link to a few minutes ago
They all say open up the solutions file in visual studio, to generate the product files for the server build
That's just if you want to cross-compile from windows.
Unreal's build tools don't rely on project files whatsoever. If you want to use VS to build, then you generate project files for VS.
Thank you - I dont know why I wasn't finding that
yeah it seemed weird to me.. I knew there had to be way..
I believe the default on linux (without cross-compiling) is to generate a makefile. But pretty much all of unreal's supported project formats just forward commands to UnrealBuildTool which is the "real" thing that does the building.
You can either go the makefile route like in that doc page or call UBT directly (or call UBT via automation tool).
makefile is probably the best if you're actively doing development yourself, UBT/AutomationTool are best for CI setups.
Does anyone know if there's any significant differences between calling a Client RPC on every PlayerController vs calling a Multicast RPC on PlayerController?
in terms of network traffic and what not
Yes, player controllers only exist on the owning client and the server. A multicast will only end up called on that owning client.
ok player controller was a bad example, Pawn
that doesn't make sense either, maybe im overthinking it
In terms of network traffic it should be minimally different. Just use multicast if you know everything needs the call.
Nah, pawn makes sense
that should exist on all clients
Cool, thank you for your help!
now i Just need to translate this over into docker
ue4-docker's docs are not being helpful
Probably want to try it yourself first since compiling will take like 4 hours
🥲
okay cool, I think I got it, now I gotta fix these build errors - thanks again @bitter oriole and @hollow eagle
I turned my cloud server up to the $800/mo tier for like 20 minutes to do that once. Make sure you remember to downsize it after if you do that.
ive spent the past week working with the ue4-docker, ask any questions! their discord is also super helpful.
just dont forget linux is useless for building windows clients
Whew ya I might get fancy and do some spot instance for the builds, but at the moment I can just wait 3 hours to upgrade UE versions 🙂
Ah thanks ! I think I got everything else going, excited to get this automated workflow going for my project
good luck! if you ever need it, i recently also wrote a python bot for building using the UE4 CLI and then uploading those compressed builds to google cloud, allowing the users to generate secure links with a discord button to download. I also have an option for uploading the builds to AWS and deploying them as a gamelift fleet. The code is kinda rough as I wrote it in 2 days but I can make the repo public and send it if you want!
Regarding pointers, how are they translated over the network? I have this method on my player controller:
UFUNCTION(Server, Reliable)
virtual void SetStartingKit_Server(class UMYStartingKitBaseDA* InStartingKit);
UMYStartingKitBaseDA IsA DataAsset. That is called from a helper method from a wbp (as seen in attached image) but I'm curious how that pointer translates to anything useful on the server 🤔. It works, it sets that on the server, but, how? Correct me if I'm wrong, but aren't I just passing in a memory address to the RPC?
From https://nerivec.github.io/old-ue4-wiki/pages/replication.html#Basic_Actor_Replication:
"Another part of the puzzle here is network GUIDs. Unreal generates a GUID for an instance of an object and stores objects in a replication map based on GUID. Objects are sent with a GUID identifier over the network. When Unreal replicates the value of a UPROPERTY that is a UObject* it is really replicating the GUID of that object, not the pointer address."
I'm assuming it's doing a similar thing for the argument then? I assume the reason it doesn't resolve to nullptr is because it's an asset, and not something created during play like an Actor?
DataAssets can be found using the exact path
transient created stuff does not actually exist via a path
Wow that sounds awesome - yeah you should make it public for your own notoriety ! I would definitely check it out
Yeah thanks! There’s still some bugs with some async functions but I’ll put it up later today or tomorrow. I had a real fun time with discord widgets and you can select your branch you wish to build from, your build config target platform etc.
Oooo. Gotcha gotcha 👍
funnily enough I have the same script but in power shell
question, lets say i have a replicated component and a replicated actor, then my own character. the replicated actor has this replicated component on it. if i set my character to be the owner of the replicated actor, can i make RPC calls on that replicated component? im a tad confused since the replicated actor would still be the owner of the component but i would then be the owner of the replicated actor that ownes the component
im assuming yes but am not far enough along yet to test it
I've just tested this and it does indeed work. Taking ownership of a replicated actor that has a replicated component allows you to use RPCs within the component.
Is this node safe to use? I have trouble getting server initiated movements smoothly replicated to the owning client.
like a knockback from another player
If temporary for fast movements, yes. If you leave it enabled, then malicious clients could make their characters teleport wherever they want.
I enable it before applying a force and disable it afterwards.
but what's the best practice to smoothly replicate character movement from server to the autonomous client?
I believe it's a matter of building the movement into the character movement component which requires some decent understanding of C++ and how the component works.
But even I'm not 100% on that.
It even says this on that node:
So, if you're having to move something fast, this may be the only way to reliably do it, regardless if it is built into the CMC.
yeah I believe this is only used for fast movement
There should be a way to safely do it for non extreme cases.
I'm just starting to learn to add some custom movement mode to the movement component, but haven't seen reverse examples yet
How do you guys designing your interaction system ?? Actually I’m just sending the client interacted actor to the server and verifying if distance are matching etc but I doesn’t feel confident about this way
Someone could just send a cheated actor to the server
And i can’t trace from the server cause we designed interactable items a bit weird
Not sure what your drawback on this is? Client can't cheat this. They're just sending over the actor that was interacted with. Server still has to resolve that on the server side, which gets the server's location of the item and the character to do the distance check. Client can't cheat that because it has no way to cheat server's version of those two locations.
Does CPU overhead of replicating variables increase by the size of the data or is it a constant value per replicated property?
Yeah but he gets the client actor
Client trace -> hits an item -> send it to the server with a rpc -> server doing checks
The server actually has the client actor not the server version of it
It doesn't matter. If the Server says an actor is at location 2000,0,0. And a Client says it's at 1000,0,0, and you send that actor through an RPC to server. That actor is at location 2000,0,0.
So I can easily cheat an actor on my client and it will be send to the server
You cannot cheat that unless you allow the client to send vector data. If you're just sending a pointer, they cannot cheat that.
Are you sure of that.. ? Is that not like server holds the real version of the actor and the client the simulated one (if the actor is replicated)
So actually I’m sending the simulated version of the actor to the server
What you're sending is a lookup ID basically. Client gets a local pointer, sends RPC. That code resolves that pointer into a lookup ID. When RPC arrives on server, it turns that ID back into a pointer, pointing at the actor that is on server.
Ohh I didn’t know at all lol.. Is this something we can see in the source code ?? Do you have the file related to this I might give it a look to understand how sending pointer to server works 😄
So sending pointer is the best way to avoid cheating (for replicated actor.)
« a network ID is established for the object, which creates a mapping between server and client. This is then used by the latter process - a pointer is mapped to an ID, the ID is passed over the network, the receiving machine looks up the ID and locates its copy of the object in memory. »
Trust only what you must from the client and minimize what they're directly allowed to do. Eg. If you were making a shop where a player could buy items from, you wouldn't let the client tell the server "Buy Item of class XYZ for 1 gold" but instead you would only let them say "Buy the item in slot X" and the server would then figure out what it is they wanted to buy and for how much.
I know that I was just stating that sending a replicated actor’s pointer is more safe than sending other data(location etc)
Absolutely
🤨
Also can cheaters call RPC ?
Not sure what the classification of a cheater is? A client has one single networking tool available to them, and that is a ServerRPC. A ServerRPC can only ever be called from an actor that the server has allowed the client to own. The defaults for this is a client's Controller, it's PlayerState and any possessed Pawn. Client has no ability to replicate anything, and no ability to communicate with other clients.
I know that, but they can easily hook a function that call an RPC or so ?
I mean, they could call it, sure.
What it does depends on your server code though.
I was just talking about calling a rpc from hand in an external program (a cheat) not manipulating data
And things like AHK is nearly impossible to detect without an anti cheat software
Depends on anti cheat. Battle Eye has one Server lib and a client one, server one is for the game backend, client one for the player
Same for Vanguard (Valo anti cheat) that is runned out of the game
That's not the same thing that lorash is talking about.
Lorash is talking about not trusting the client.
The primary way you protect against cheating is simply by not trusting what the client sends.
You can’t always do that
Frankly you can.
Client side anticheat is essentially about slowing down the cheat development, making it more expensive, and limiting how many groups can engage in it. You still need to have security on the server, but some classes of cheats are literally impossible to prevent server-side only, so you have to do more
Most clientside anti-cheat is about preventing things that aren't possible to detect serverside.
Wallhacks, memory manipulation, aimbot, etc.
That’s what I was talking about when saying « you can’t always do that »
Wallhacks can be limited in multiple ways but you can't prevent clicks
Then you didn't read what I said - the primary way you protect, not the only way.
Anti cheat software does detects things like AHK triggerbot now
But it wasnt detected in games a few years ago..
Last year someone developed an AI that analyzses the screen and rotates the mouse towards the humanoid shapes. None of the games or companies able to detect or stop that.
To answer the original question more directly, RPCs can be fudged the same way any data coming from a client can be fudged. The solution to that is simple - don't assume what the client sends is correct.
If a client fires a weapon, don't design your "fire" rpc such that the client says "I shot the other player!". Do design it such that the client says "I want to shoot this weapon", and the server decides on its own whether it actually hit something.
I saw smth like that on Reddit, it was even on consoles
As for anti-cheat, there is no singular anti-cheat, no single set of technology, and anti-cheat tech is kept very secret due to it being a game of information. And even "generic" ones like EAC can't be entirely generic for them to be truly useful.
General methods are known, but very little is willingly shared.
I already know all of that, was just asking if RPC can be called by cheats (so aka, are rpc integrating built in protection)
And that's been answered.
Are we talking about same thing? https://youtu.be/SZ3KNqkFAnk
I was talking about this one
Yeah
It’s been shutdown in a few weeks
It was a PoC, never released but Activision messaged the creator and you know what followed
I haven't followed the issue, I heard Activision was on the case though
So in the end Activision couldn't prevent the cheat but warned the creator?
Yeah the creator got afraid and quickly made a message on twitter lol
Exactly
They said they could sue him etc so he ended all of that
And said on twitter « it was just a PoC blah blah im not a cheater »
Exactly lol
As of Ricochet (new COD anti cheat) someone know if it’s already been broke ?
I'm not sure if that's even illegal though, it's not made for Warzone, it can shoot humanoid targets on Counter Strike too
Just show a moving humanoid target and it will press the button virtually
It was still an external software used on a CoD game to ruin other players experience so I think they can sue him for that
I don’t know anything about « laws » about cheaters
Fortnite and PUBG already sued people for that if I’m not wrong
Yeah, law is more strong compared to anti-cheat softwares
But in the end, someday it will appear again in the deepness of cheat forums and everyone will start to use it 🤷♂️ There are closed forums especially created for that
I'm just wondering how they are going to prevent this
But still, why they doesn’t sue cheat « company »
Like EO
Or so
Activision know that EO is creating cheats, they make people pay for it so what don’t sue them, they can but they don’t do anything 🤨
They can’t tbh
You can’t detect a trigger bot except by detecting the software itself
The thing showed in the video was running on PC ? (the ai software)
The game was running on console
On next gen console
That’s why it’s powerful I guess
That’s literally not the same.
Meh i don't do that, the client tells me who they hit 😛
It’s an AI
Not something you injecting into a game
It’s an AI that scans your screen
It doesn’t read or write the game data it doesn’t even have access to it cause it’s on console
So literally not the same tbh
Yeah but you do server checks
angle between player and the damage (ie player has to be looking roughly at the damaged target)
for shooting weapons, etc
So you have a tolerance ig
yeah cause you can't be super precise
Like 10cm around the damage point
So you checking that player yaw is around target damage
But what if it changed since it shoot
it won't, the server is always behind the client
when the server gets the RPC, it would have been in (roughly) the correct rotation
hence why you have a fudge factor
Yeah but imagine I have a lot of ping, between the time I shoot and the server gets the rpc called, i could changed my rotation
The point is just to stop 180 noscope 5km headshots.
or blatant shooting backwards, etc
but the server is always behind though, and it works well
even under 500ping with 5percent packet loss
if your lagging that hard, expect things to miss or shots not to register
magic bullets
you just need to make it work the best for about 200ms ping
100ms it should be playable
to check the yaw angle
you just tracing from player rotation to the target
on the server
no
No need for a trace.
how then ? 🤔
IsNearlyEqual(PlayerRotation.Yaw, (TargetPoint-StartPoint).Normalize.Rotator.Yaw) Or anything similar.
const FVector ViewDir = (Impact.Location - Origin).GetSafeNormal();
const float DotHitDir = FVector::DotProduct(GetInstigator()->GetViewRotation().Vector(), ViewDir);
if (DotHitDir < MaxYaw)
....
this is from shootergame (won't show my code, cause you know... anti cheat), but it was to give an example
(Impact.Location - Origin).GetSafeNormal()
Is this a shortcut of FRotationMatrix::MakeFromX();? 🤔
it's in ShooterWeapon ?
That is just simple vector math. (WorldLocation1 - WorldLocation2).ShortenToLengthOf1 and you have a UnitVector in the world direction from Location2 to Location1
It's same as FRotationMatrix::MakeFromX().Rotator().Vector() then 🤔
Just asked because what I wrote above is ugly
Might use (vec1 - vec2).getsafenormal() next time
Also this kind of checks are not good for projectile weapons ?
FRotationMatrix::MakeFromX().Rotator().Vector() < is not the same though?
i use this for hitscan only
DependsTM
You got no checks for projectile weapons ? (even if they are handled only on server)
i'm sure UT4 has something about that but i don't remember lol
not for the yaw angle
UT4's solution is really convoluted but it kind of has to be because of the nature of the game
fwiw, more competitive action games (think something like CS) tend not to use the above method and instead have a much more complicated process that involves rolling back the state of the world to compensate for lag. There may still be some allowed deviation but it needs to be much less. The downside is it's much more complicated to build and has more performance implications.
UT probably does something like this ^
Pretty much any competitive FPS has to do rollbacks
lag comp only matters if server decides who is auth
err who is hit*
Fortnite for example trusts the client on who they hit
A nice and detailed read about this: https://www.gabrielgambetta.com/client-server-game-architecture.html
server just does validity checks
Second page, not the one I linked
yeah but they do checks like you said above
also the classic article - https://developer.valvesoftware.com/wiki/Source_Multiplayer_Networking
from what dave ratti said, it just "basic checks"
PUBG does this, afaik
especially in a 100 player battle royale
they do use only projectile weapon ? 🤔
the less work the server has to do, the better
Probably
They might fire a hitscan too if distance is close
Squad (milsim game made with UE4) doesnt fire a projectile if target is too close
i played a game similar to squad and i was wondering if they did same as quad for firing (hitscan for close range, proj for long range)
Hell let loose
smth like that
firing a projectile if too close is a waste of resources
Jambax is the senior programmer of that game
Halo is a good example of having almost no hitscan. Though at least in H3 they also fallback to hitscan if there's a hit in a very short range (which resulted in an interesting bug related to FPS in the MCC release of H3).
They do what ARMA 3 doing, firing fake pooled projectiles on client
yeah he told me about that
i only fire projectiles from Sniper or explosive type weapons (RPGs/Grenade launchers)
so they don't use hitscan for close range ?? @peak sentinel
I don't know?? I'm not a developer of HLL 😄
From what I heard from Jambax they only use projectiles
Cries in Bullet Hell game 😦
yeah but so you for example, for snipers you fire a projectile even on close range ? 🤔
instead of full blown actor with projectile movement comp
no, i fire hitscan at point blank
I wonder how HLL handle projectile spawning on a veeery close range
My projectiles spawn behind the enemy or go another direction
Yeah but still they do line traces
And update the delta position
They just have a niagara comp that can live in the world, stored inside the struct
And some basic functions to update the world position based on velocity
which is what we do in RS2 with projectiles
we fake them a lot
weapon shots look like projectiles, but they are not
they still have travel time, etc
They're all projectiles from the moment they're fired to the moment of impact. We don't use hitscan at close-range, but I believe Sandstorm does, possibly squad too.
but is this engine PMC ?
But yeah not using actors for anything other than big projectiles that have big explosions radii etc.
or custom projectile
Custom data projectile
Not using actors, way too expensive
100 players walking around with machine guns is bad enough 😄
but so you trace first
before deciding if you have to hitscan or launch a projectile
not in RS2 no
on your personal project
so tracing decisions on client, sending the FHitResult to server and let him decide if hitscan or projectile ?
for snipers, yes
yeah, all my weapons are projectile based, like h1z1 if u played it
client has a rough idea if its going to be a projectile shot
and does not store the unconfirmed hit data
Btw anyone knows about this?
bit of both really
depends how often your comparing it (but the push model can assist there too), and how complex the comparison is
yeah but is that know too much Client->Server communication, like if you doing the tracing decision on client and then sending this to the server to let him decide if it should shot a projectile (on server) or send another RPC to client to fire an hitscan shot
I think it eventually calls to do IsIdentical() or something
It's in RepLayout somewhere
CompareProperties_R or some weird name
So most of the replication cost comes from comparing values?
I thought sending them over the network was expensive
Rather than comparision
Oh well, both are
potentially
comparing two floats is nothing
comparing two arrays less so
you alleviate a lot of performance cost server-side by reducing the amount of comparisons and checks you need to do, e.g. lowering update frequency, avoiding having to serialize multiple times for each connection etc.
That's what Rep Graph + Push Model are for
I haven't used Rep Graph yet, tbh I dont even know what its for
But literally almost everyhing is push model
lots of actors + lots of connections RE rep graph
Not really worth it for most projects
We have ~100 moving pawns like RS2
But only 4 connections
There isnt any spawning cost too, thanks to pooling
Should I consider it?
Only if the server is spending too much time checking actors, then maybe worth investigating
But it's not super straightforward to switch to generally
And has some fun "gotchas"
Uh, I can imagine 😅 Thanks for letting me know
An actor with DORM_DormantAll can't detect overlaps on server ?
So I've moved from using Seamless travel to instead just use level streaming to load in different levels and so far it's working great for MP since only 1 level needs to be loaded for all players at the same time. Are there any downsides to this approach or can I safely do it for all levels in my game?
It removes many of the downsides of traveling (having to wait for clients to reconnect, longer load times between levels, no need to worry about CopyProperties or other persisting of data, not having to deal with dangling UI pointers in the PC etc.)
They can't move individually, the maps are small and travel is often so all players need to move to the next map together. This is where seamless really started slowing matches down
Yeah luckily they are all centered around the origin
Max bounds are 30K units from the origin
Good to know that it's a viable approach in that case
Now I'm just looking for some hidden sublevel limit or something as I have a lot of levels but for 30-40 it's fine so far
I'll need to go over 100 eventually
Another nice perk is that I can travel quickly to any level in PIE (using this level streaming method) without having to launch a standalone game since seamless travel doesn't work in editor
The "Detailed Explanation" at the bottom of this goes page into a bit of detail with pointer replication: https://nerivec.github.io/old-ue4-wiki/pages/replication.html#Detailed_Explanation
i checked at the source code since then
but thx
All that in PowerShell?? Wow sounds rough! Just out of curiosity, how did you handle the automatic distribution of your build for your team to use? I used the discord widgets to store informations for generating signed URLs. Did you have a dictionary of old builds you could access?
Well I know it has a lot but I just didn’t think anyone still used power shell scripting for “programs”. I feel like you’re just shooting your self in the foot not using typescript or python. I felt silly writing a bash script the other day because i was too lazy to setup python properly on centos, guess it’s more normal than I thought!
Now I’m curious to see how people make this stuff in PowerShell, off to YouTube :)
Does the RepNotify event only trigger for the server? thought it would trigger for clients too
but i guess it makes sense because it would be inefficient to fire back to all clients, so people can choose to implement if they wanna rebroadcast to clients on an event
Repnotifies can call on clients as well. What class are you setting the rep notify in?
Also RepNotifies have no actual networking in them. They are nothing more than a function that is called after a value arrives on a client. So there is no broadcasting or anything with them besides the value being replicated as usual.
Im doing it on a random actor that ive created that does replicates
And They're also not called on server by default. Blueprint Setter nodes actually call the OnRep directly. On C++, you have to call that manually if you want it to run on the server. Fun fact, making a replicated integer, and doing a ++ does not fire the OnRep.
I'm doing on blueprints
Check AlwaysRelevent setting. If your object is replicated and not running client onreps.
should it be alwaysrelevant?