#multiplayer
1 messages ยท Page 660 of 1
Or any online subsystem. That was just an example. It just lets you easily identify the player's actors
You should do this inside of the Character, in the "EndPlay" function.
Because there can be multiple reasons for it to be destroyed, other than actually dying
If an Actor manages another Actors lifetime (spawns and destroys it) you should always make sure you destroy it when the outer actor gets removed
Does endplay get called when you put the player to ragdoll?
Maybe not
I think it calls when you call Destroy actor on the character
Ahhhhhh
Multiplayer is hard
No, that requires manual cleanup, but then you need both.
Cause if your character gets destroyed without going through death and ragdoll, it still needs to kill off the gun
How do i keep the stats intact even after killing and respawning the player?
And the crosshair no longer spreads with player's velocity
@mossy kindle Multiplayer is very simple when you learn to separate your machines. When developing on a class, consider how it's events will run, and how they'll be used on each machine. For the most part this is just client versus server. For more advanced classes you'll start doing prediction with client which will cause differences between the owning client, other clients and the server.
I managed to get some things working, and now the stats part is really bugging me. It doesnt wanna work! I have made the basic logic, that too with bugs, and now the UI stuff is giving problems.
Hi guys, a noob question here, currently I modified my spawn using Controller instead of using GameMode. For ChoosePlayerStart I override it to spawn the player to specific position when the game start, so the players can have a good bird eye view of the map. Despite my PlayerStart's rotation has a little pitch down but it seems like only Listen Server follows the rotation, and my clients is just look at straight forwards to 0,0,0. May I know how to match the rotation when spawning the character? It seems like it always facing where the previous camera facing atm. It happens during the match too, after I get killed, the camera will look at where you previously facing.
I have a blueprint actor that is placed on the level and I want to call RPC's on it but I get cannot call server rpc because there is no owning connection. How do I set it? Setting the owner to servers player controller on begin play didn't help
Whoever is calling the RPC needs to be the owner, and the Server needs to set them as it
so changing the owner any time a client interacts with the object?
That won't work well because changing the owner needs to be done on the server
Which you need to RPC first so that it does
See the problem ?
yup
Interaction needs to go through pawn or player controller instead, and have that class handle it server side
Is there any default implementation for detecting if a PlayerState on a Client belongs to the ListenServer host?
noop, but you can get the owner player controller and use that
Variable replication delay I noticed is like half a second to like a second sometimes
Does this only happen in the editor? Is it an editor thing
My assumption is the editor artifically makes it like 0.5s to 1s for development purposes, is that right?
Hm.. I thought there's no way replication can be this long normally so I thought it was artificially like this for the editor
I guess replication is really long
Depends how much data you're replicating
Just a primitive variable
I wouldn't test in PIE though, since one of the windows will be out of focus and run slower
Get two machines, sync the project there and work with that
Hm, another workaround is using Multicast
Nah
State should never be replicated with RPCs
Because if a player joins during the game, then they don't get the updated state
Use replication, deal with the latency in your game code, and test appropriately
State should never be replicated with RPCs? That sounds important to understand
So I have:
PlayerState with CanJump (is replicated)
PlayerController with Server_Update_CanJump event
BP_Checkpoint, on overlap will call Server_Update_CanJump and update CanJump=true for the Pawn that touches it
This is fine, right?
Anything that is state should always go through replication only
Anything that is events (as in, can be missed without breaking the game) should be RPC
Let's say you're firing an automatic gun:
- you would have start fire and stop fire as reliable RPCs from the client (only way to go since replication is server to clients only)
- you would have the "is firing" bool be a replicated bool
- you would have hit impacts be unreliable multicast RPCs
Just to clarify, RPCs are events like Server_ or Client_, right?
Yes, UFUNCTIONs with Server, Client or Multicast in it
When you say "always go through replication only", you mean it gets updated on the Server with RPC?
Wait, you said state should never be replicated with RPCs
So you mean state in PlayerState?
How else can you update state if not with Server_ RPCs?
You are mixing stuff up a bit
State Updates shouldn't happen via multicast or client rpcs, because new players won't get the call if they join later
For that you should use replicated variables or even OnRep variables to have a function connected to the change
If your client does something that should notify the server to change the state, you need a server RPC of course to notify the server
But most of the time that's only needed if it's about some input or UI event that the server doesn't know about
E.g. press fire to fire the weapon, but once the server knows you want to fire via an RPC, the server can do everything on its own
Up to dealing damage and updating a health variable
Which then replicates down to the clients
"State" here means everything that describe a state. Not necessarily the PlayerState. But health, ammo, bIsOpen, etc
Where an RPC is more for one time fire and forget events.
E.g. the explosion of a barrel
To put it simply, you should use RPCs for client-to-server, and when doing server-to-client, you should use replication for persistent change (current health, is firing weapon, aim direction), and RPCs for one-time events
I see, yeah
Like if the client wants to update CanJump in their PlayerState, they'd use a RPC Server_ call to update that
The server will update their PlayerState, and CanJump will be replicated to everyone else
Yeah
But one thing about Multicast
Multicast from what I understand calls both Server and Client, so there's no delay for the client
So a client updating CanJump via RPC Multicast_ will update their local CanJump and the server's copy as well (which will be replicated)
So it's fine to use Multicast, right?
No, you should call a server RPC and modify CanJump locally if you want to (preferably while handling the case where the server overrides that through replication)
@chrome bay Yeah. Problem is you can only do that on the server. Just made a replicated property for it. ๐คทโโ๏ธ
Typically you would store data for each RPC sent, locally ; and then when that variable replicates you would look into your requests and see if the server agreed to your change
"I setCanJump to true 60 frames ago, and to false 10 frames ago, server just replicated CanJump to true, but I should keep it to false"
Or you can only trust the client (hacks), or only the server (lag)
Hmm.. you're saying.. modify the client's local CanJump in PlayerState directly, while sending the Server_ RPC
I'm saying it depends a lot
Is there anything wrong with Multicast?
Yeah, it won't do anything in this case
Look up the tables here : https://docs.unrealengine.com/4.26/en-US/InteractiveExperiences/Networking/Actors/RPCs/
Multicast called from a client does nothing
Well, "Runs on invoking client"
Multicast is only useful to have the server talk to every currently connected client
Any client-to-server RPC is Server
You can simply assume you have 4 methods of communications :
- client to server : Server RPC
- server to client(s) for state : replication
- server to that one client that owns the actor : Client RPC
- server to all clients : Multicast RPC
I see, according to the diagram, Multicast runs on Server and Client if called from Server
But Multicast only runs on invoking client if called from the Client
You can usually do 95% of your game with server RPCs + replication
I see, but too bad about the ~0.5s delay though
The delay isn't a replication issue, it's a bandwidth + performance issue
Like I said, if you test in PIE one of your windows has 1fps
But yeah, maybe PIE might be causing it
Yeah, I'll find out how to test it with another machine
Hey is it possible to pool replicated actors somehow?
projectiles with movement
no need to pool
engine already doing that
even though you are doing it manually still no issue but ll be extra work
The Engine does not pool Actors by default o.o
Spawning and Destroying them is indeed expensive
Just pool them on the Server and start/stop replication etc.
Or just turn them off properly.
Hey, in case you haven't figured it out already, OnLogout outputs a controller ref, you'll have to cast to the controller blueprint that you are using to access that info.
yeah figured
working on the player states and game state... this is such a pita
how do you simulate lag? tried net.pktlag=10000 and net pktlag = 10000 and neither work
should they work in console?
because for me they don't
and I'm 1000% certain someone told me a command that works in console once
No idea about that, the ini file works though
guess I'll go with .ini then, thanks
how to convert struct to bytes to send in udp?
Struct::SerializeBin doesnt work
Don't multipost your questions
You need to be playing as a client in editor if you aren't already
The commands should work instantly if so, even if not in the .ini
There are actually already a range of settings that have been exposed to test without even using commands
There are min and max latency settings available when looking at the full set of MP settings
Hi! anyone who used VaRest before? i'm having some troubles getting one of the fields from a json response (i may have more chances of getting a response in here)
Do "reliable" function calls guarantee order of execution, or only that they are eventually executed?
Order is garaunteed so long as they are within the same actor (if reliable)
Okey i got where my problem is with VaRest, my setup works ok with Postman but not with UE4 and VaRest, i think the problem is with VaRest and LocalHost, anyone knows about this by any chance?
net pktlag=500
type this exactly, it should work
though 10000 is extremely too much even for testing
I test with 250 or 500 depending on the action
Yeah. 350ish is semi bad overseas satellite networking. Most things above that are kind of out of the developer's hands. So if it's over 500, people just need better providers.
For a fast-paced shooter game it should not even higher than 100 for example
Its totally okay to blame player for the lag if your netcode is not terrible ๐
does that automatically set the packet lag variance and packet loss? or you have to set them manually
If there is I would like to know too btw
I'm stuck at a part where my logic that determines the winner is in the game mode however this is inaccessible from the client side...
We play rock paper scissors.
You choose Rock -> choice recorded in the player controller and the player state
I choose Paper - > choice recorded in the player controller and the player state
Since only 1 player can use the game mode, how would I come about triggering the "determine winner" logic?
I looked into game state but frankly, I don't understand at all how to use it for this purpose.
I'm starting to wonder if I should just make a replicated actor that acts like a judge
After each player chooses their option and sends it to the server, in game mode loop through all the players and verify their choice has been made - if all choices have been made, determine who the winner is, then replicate something through game state to notify players that the game is over and who the winner was.
how would i send it to the server? switch and if server continue with game mode logic?
RPC
there's actually for all of them
Net PktLag=
Net PktLagVariance=
Net PktLoss=
Ah, thank you
Whatever event you're using where the player is choosing their option, you send that through a "Executes on Server" event on the player controller for example. Once you're on an execution path on the server, you can access game mode.
Has anyone used dynamic navmesh on a dedicated server? I'm running into an issue where it works on stand alone or listen server but doesn't update on dedicated server
not much info out there unfortunately
Okey, i finally got the full setup working (VaRest + MySql + Local Server + C# WebApi + FireBaseAuth) to save/read from MySqlDatabase into Dedicated Server.
There's quite a few things that i didn't saw anywhere else, i'm gonna do a video quickly explaining the basic setup when i have more time later
willing to pay someone for replication help >.< this started out simple and turned into a monster, dm me
Hello, I'm having a problem with network replication on my GameState BP, I can't or don't know how to properly replicate from Server to Clients.
I am changing an Array Struct on my GameState through my Server's UserWidget, unfortunately that Array Struct isn't replicated (even tho the array var is set to replicated) to clients.
no need for that. You can use the game mode to determine the winner, then set the winning playerstate in the game state. The game state is replicated to clients, so it's the ideal place to do stuff like that.
it's not the theory i have trouble with, it's the execution
so far my widgets and player controllers speak with each others on each player's ends.
Then, the player controllers add that result in the player state. So now the result is fully visible to anyone.
Now how in the world do I get this to the server's game mode?
If I have authority, then get game mode, cast, get results, multicast winner.
If I don't have authority, I'm remote... what do i do?
what the heck owns the player state? can I get a reference to the player controller from it? The get player controller array from the game state is 0...
you call the RPC
AController owns the player state. So your PlayerController does.
Controllers only exist on the owning client and the server
if you need values replicated between other clients you want to use the player state for that type of stuff.
@thin stratus your site is down again.
what does "you call the RPC" mean?!
๐
It's some common shit with WordPress running out of resources on the droplet I think
Again, I can read that stuff all day, weeks at a time and I will not tell me HOW to do it. It's nice in the sense that it explains what can and cannot be done but not how it can be done.
Based on it, I'd do an RPC from my player controller to the game mode? But that isn't visible to the client.
how about this
Widget -> PC A
???????
Widget -> PC B
what is the ???? step to make them talk to each other
oh god wordpress. there's a static gen plugin for it which might make things easier
seemingly using a chat-like logic doesn't require any player state or game state and yet still works
the compendium explains all of this
give me the page number
it tells you how to do an RPC
it also tells you the relationship of the different classes
no it doesnt ๐คฃ
bad reading comprehension?
literally page 12
page 66
and page 61
there's a table of contents
though WithValidation is actually optional these days
because I don't see it
???
again, beautiful theory
in this case you just call Server_PlaceBomb() like any other C++ function
please
like, actually read it
try to understand it
and ask specific detailed questions about stuff
we're here to help you understand
and we're giving you the info to do so
i'm just gonna put up my offer for paid advice and leave it at that or try again later. I get the theory, I don't get the practice and I have no working examples to learn from.
what exactly do you want to do?
2 player connect.
multiplayer is activated.
Player A (server) presses a button on his widget -> player state updated with variable
Player B (client) presses a button on his widget -> player state updated with variable
How and where do I make Player A aware of Player B's choice to update the widget to see that result and then how and where can I evaluate the choices to decide a winner.
I initially thought I could do it using the game mode but that isn't available for the client. So what now?
You mentioned RPCs. Where? Player controllers? State?
like, this is not a difficult set up either. It's not like I want to replicate a battle royale and such. I just want to press a button and tell the other guy about it.
Player A (server) presses a button on his widget [calls server RPC which executed instantly] -> [on server] player state updated with variable
replicated variable will be updated on clients
Player B (client) presses a button on his widget [calls server RPC] -> [on server] player state updated with variable
replicated variable will be updated on clients
since it is a widget then playercontroller
for example let PC have a RPC ServerPressButton(Variable ) that will set PlayerState->Variable = Variable
and it will be called from widget OnButtonClick = GetOwningPlayer()->ServerPressButton(1);
can use OnRep to handle property update
(exactly same in bp, just easier to write it in discord this way)
Here's something interesting I figured out thanks to your link.
- Let's say if the player presses
H, it will spawn a Checkpoint Actor. - It should spawn and show up on everyone's screen.
- Any player should be able to press
Hand spawn it, both players on Server and Client(s)
According to the chart, I need to run Multicast RPC on the Server. However, if I press H with Multicast while on a Client, then it will only run on "invoking client" which is itself.
So this trick/hack here works:
H -> Run on Server -> Run on Multicast -> Spawn Checkpoint Actor (shows up for everyone)
Alternatively, you can use Run on Server + Replication:
H -> Run on Server -> Spawn Checkpoint Actor (only shows up on Server)
But then in the BP_Checkpoint:
- Self: Replicates = true
- All variables: Replication = Replicated
This will cause it to replicate from the Server to all Clients (shows up for everyone)
The second approach is the correct one
depends
Well, yeah
In the first case all copies of the actor are fully independent
And new joiners won't see it
Maybe you want that ?
But I figure usually you don't
Second case, it's a single actor that's replicated, will show up for new joiners, and you can actually have all copies talk to eachother
Probably more logical most of the time
I see, I understand
Anyone else have a bug where you can't turn on or enable to ai debugger?
Weird only way to get it to show up was to use the console comman EnableGDT
command*
I really need an help, i uploaded the question on reddit. Any ideas? https://www.reddit.com/r/unrealengine/comments/peq8qd/help_with_client_movement/?utm_source=share&utm_medium=web2x&context=3
Jump has functionality which calls the CharacterMovementComponent
which ends up calling LaunchCharacter iirc
it's been awhile since i've looked at that code though.
can you clarify your question with text instead of a video?
for the session portion of your question, ask it in #online-subsystems
actors doesn't seem to replicate properly, i don't see host in client screen
The point is, i dont' actually know where is the problem, if in the net or in the blueprint. Also is a reddit post, the question is in the post. The client can't move, i made a gif to shove you how can't move, and also in the client you can't see the host player.
start reviewing everything starting from replication params in pawns
^
after that spawning logic
after that client movement input rpc/replication
This isn't really a question, which is why I asked for elaboration:
Using the top down template, the first video is the host, the second one is the client.
I just finished to sign the "allow client side navigation " box.
Any ideas?```
gif was having issues loading for me also
ยฏ_(ใ)_/ยฏ
I would check the function you're calling. If you're, for example, wanting the character to crouch, that's replicated in the character movement component. Something like sliding however, you'll need to manually implement all the replication steps for that as well as the integration into the CMC
Unfortunately I feel like clarifying that I'm not that of an expert, Soo i probably did not understand all of what you just said, but in any case, if you talk about the flags for replicate movement/allow client movement, inside of character blueprint and level settings, i already did that.
Yes.
The CMC is quite complicated. Like, difficult to explain over discord complicated.
I would suggest reading through it. Look at stuff like the movement mode, enums, etc.
to get an idea of how it all works.
There's probably a youtube video or something that explains it.
nice!
much better than what I had xD
i'm 100% self taught
and just read through this discord and glean info all the time
Basically i can't find what is causing the client to -1 not being able to move and -2 to not be able to see the host. I did hours of print strings and the only thing that i found was that the world of the host, actually sees 2 character's mash, the client's world only sees one. Aldo inside the host's world, the client is not even fleakering when moving, is just still.
how much you did change the character blueprints? did you add position replication?
was downloading template project meanwhile
that's enabled by default.
in regards to characters at least.
Is the top down template, and i didn't change the movement at all.
I basically tried to enable every "replicate..." Stuff i could find.
if he didn't change the pawn blueprints from template to support multiplayer he would need to do that
since it is getplayercontroller(0) everywhere
๐
AI controller and pathfollowingcomponent never runs/spawns on client if a a pawn/controller set to replicated, right?
With what should I replace getplayercontroller(0)?
yeah, ai always on authority only
what's it doing. That should be fine.
I dont want to update pawn transform each tick so I thought maybe I can just send clients the pathfinding data and simulate movement but I cant bypass the AI only on authority firewall
Soo should I set something somewhere? Really first time approaching multiplayer ๐
It was a reply to me I guess
With GetController() on pawn
Sorry, really getting confused
Can I always put 0 or i should change that
That should be the default or am I wrong?
yeah, but that would not work in mp. you have to somehow send to server your intent to move
Controller part: https://blueprintue.com/blueprint/_n2mq804/ added rpc and a replicated variable (simply Replicated), converted function to event to be easier
Character part: https://blueprintue.com/blueprint/o3a1nl73/ added rotation and cursor sync between clients
here i replaced call of SimpleMoveToLocation with sending ServerMoveTo RPC (Server, Unreliable) and now they move
Hi! question about god practices.
I'm using VaRest to make http calls to my PhpServer through a C# webapi and connect with MySql on my dedicated server.
The question is, it's okey to let the client make the calls? or it always should be the server (run on server or run owning client) on the one making this ones too?.
you should handle that authentication on your backend.
depends. if it is internal data then dedicated server to backend. if it is a public client data then client to backend with auth
It's ok for the client to make calls, but the game server should be the only one saving anything that would touch other players.
So client making calls is ok, but the values that i get from those calls should always be assigned using the server (and from there to the client)?
that makes sense
isn't it dangerous to expose the api calls to the client?
you must have authentification
plus you still use proxy and not let clients directly interact with backend servers
uh what's that setup?
yeah, but i'm not sure how much data can someone scrap from a client version
php through C# web API, what does that even mean?
yeah, i'll add authentication on the api and a webconfig to the server version for auth.
websoup
Php server (MAMP) MySql for database,
C# WebApi for calls and access to mysql
VaRest to make calls from UE4 to the Api
UE4-> VaRest -> WebApi ->MySql and back.
is it a PHP or C# backend? ๐ค
Also firebase auth for user authentication, but that's just one call with VaRest to the firebase apis
i guess he is using only database from mamp package lol
i use a spring boot java application for my interface. I have only 2 public end points. Everything else is wrapped in a stupid level of security. My REST Api handles all of the calls to my MySQL database. Sounds like you're going for a similar approach there.
yeah maybe, but mysql? I thought everyone went to postgres for relational these days
it would be C#, maybe i'm wrong but i think MAMP works with PHP on the background
uh
this option is 100% free
so is postgres
most migrated to mysql fork mariadb, then postgres and oracle. it is still fine for pet projects. i still have 5.1 server for home purposes since ancient times
and it's not owned by someone as bad as oracle
yeah, it looks similar. Mind if i ask how are you handling the calls from the clients? you let the server do it? or just authenticate as it was suggested in here and let it be
i'm okey with both options, but i don't want to change them later and my knowledge on that area is limited
HttpRequest -> web server -> database server, never skip the middle part
I have it set that the client can send updates for simple stuff like their loadouts. I handle checks to make sure they're valid in the game and then again in the backend.
yeah, that is for sure, i can't go to the database without the webserver, not sure about the client or the server making the calls
[thinking about all those MySqL CoNNEcToR plugins on the marketplace]
...which probably have GPL violations
When a client connects to the server, the server then makes those calls on the client's behalf
and the client has his token removed.
until the client disconnects from the server, then they get their token back.
i'm not even using tokens for the webapi, i need to up the security quite a bit
mysqli is as good as postgres .. people this days change to noSql DB like MongoDB
relational is used a lot, unless you're some node.js bro
I've used postgres before, I just prefer MySQL
"mysqli" isn't a RDBMS, it's a client library for PHP
I did consider using DynamoDB since we're using AWS anyways.
i looked into the nosql vs relational database and for my case relation was the best, but depending on the type of game you want, you could benefit a lot more fore something like mongo
see the magic of the JSON column type for postgres
mongo may suit your needs better.
i tried to make a setup with AWS, may god the prices...
same with firebase, i'm only using the free tier for user auth and that's it.
a realtime database is way too expensive.
i haven't found the cognito or RDB prices to be too bad.
it's just extension .. or u can say advanced version of mysql
it's still just a client library, mariadb is the common mysql fork that you might be thinking of
u don't really need noSql as it works best for big data .. machine learning is the most scope to use noSql
buzzwords
i'm in sleeping mode from hrs
oh really? maybe i'm ignorant about the market price for things like that.
I'm from argentina and the prices to local currency blew my mind
are you using ec2 for the vm too? i'm doing a local setup with Hyper-V from windows
๐
just be careful of the free tier they can end fast. some people mentioned they get billed after 3 days
we use ECS for API deployments since it's a bit easier than managing VMs
yeah, from what i read, it was mainly because of the static ip changing (if it's dynamic, they charge you).
For some reason, at some point, it changes to dynamic ip and they charge you a few bucks
ok i will keep the ip issue in my mind
i hope it's the only issue. i only run server locally for now
there is some someone mentioned this also :
You can apply for AWS Proof of Concept and receive credit of USD 300, and AWS Activate Founder of USD 1000 + Developer Support plan USD 350 if you are a startup. Espescially the proof of concept program, it's not hard to receive in my experience
i didn't tried them yet
You also have a program like that with epic services for grants, i think they are way more stricts with the requirements.
i may try to apply in the future when i have a working prototype, maybe i can get a few bucks for equipment and assets
what do you mean with ready ones?
playfab i imagine
every single one is really costfull, with this setup i can get a game working for like 100players on a dedicated server with a MSI pc from home
yea
there are definitely benefits (and drawbacks) to rolling your own stuff
also this, i really like the customization and i'm more familiar with the tools from previous years on programming.
yeah they do, but it's mainly for a "instance based" setup with a listen client, not soo much for a dedicated server
at least that's the impression that i got after searching the tools they provide
i think it's the same for epic online services
GameLift is not for Listen Clients...
GameLift is for deploying Dedicated Server instances.
they all for dedicated servers
oh maybe i got it wrong with the terms, i'm kind of new to multiplayer
searching in export data in EOS "EAS" i feel like they need to update it .. but it manages billions of users as they mentioned
Anyone knows whats the size of pointers on RPCs?
I know Epic is using some kind of network ID (GUIDs?) instead of pointers but I dont know their size / compression methods
Hmm, found it
Nice
lol
Is it normal to have 3 calls to a function when using prediction ? 1 server side, 1 client side (predicted) and 1 from server replication ?
depends on what ur doing
When using prediction? As in the network prediction plugin or GAS?
I want to make my pawn invisible from an ability with GAS
But i'm not sure how to do it correctly with HasAuthorityOrPredictionKey
BTW, I have seen the network prediction plugin for some times, but I have no idea what is about and dont find so much about it on Google or Unreal Docs.....
it's experimental, that's why
so is GAS technically ๐
So 3 calls looks fine ?
as long as each serves a purpose, yes
Well i'm not sure that's why i ask :p
I'm attempting to cobble together a multiplayer game for the jam, however, I've run into a number of replication errors.
One of the most concerning being that players on the client side seem to be stuck in 1 location, almost like they're trapped in the capsule component?
Also players on the server can't see any animations or anything like that happening on the client side.
Would anyone know where to begin to look for those errors? (Bit new to network programming in general. Also everything is done in Blueprints, if that helps.)
NP plugin gonna replace the prediction system in UE.right now there's 2 one that governs the one in CMC and another one inside GAS
basicly a new unified prediction system to solve both
From what I understand its fine
With a little bit of poking around, it would seem that my issue is on my actual character pawn class (which is like the Third Person class, but with some added features and what not).
It's weird, like I can jump around, crouch, and shoot no problem. But whenever I try to move in any given direction, it's essentially keeping me in 1 spot.
Ok thanks !
Okay, at least for the movement, I seem to have found what my error is
Because I have multiple movement types (crouching, running, etc), I'm running a lerp on my walk speed and character movement walk speed on my Event Tick. So for replication, something isn't happening.
I'm gonna play with this for a few, but I still don't know why animations aren't being replicated on the server but work just fine on the client
I most surely i'm gonna try this when I come back from work. I really this does the trick
Ayyy I fixed it
"Is locally owned" wasn't being called
And it would seem now that I'm able to move, I see 1 other error with my respawns
So I still can't teleport (although that might just be cause I wrote it wrong), however, I can move. It's just that the movement only seems to be taking the capsule component as opposed to the entire character and its various children components.
Hi there, I am working on a game demo like Smash Bro, where I want to predictively knock back other players, but seems I cant predictively move SimulatedProxy(other players), any idea about that?
I've wrestled with the CMC a lot in the past, but I also did not really find a solution for this.
Most it can do is predicting autonomous clients. Simulated Clients don't even run the same function paths and often lack information about what is going on which then needs to be replicated separately.
Maybe with the newish prediction plugin, but not sure about the state and capabilities
@thin stratus Thanks eXi! looks like our powerful CMC also has a lot of shortages...
It does
Hey everyone. I've encountered a problem with "BeginPlay" event not getting triggered in blueprints on custom player controller. Functionality attached to it works just fine. And googling didn't reveal much besides a possible cause of overriding "BeginPlay" in c++ without calling the super function (I don't have the event overridden). I have a suspicion that I missed some kind of vital information regarding player controller performance on client side. So what could cause the problem or what's the alternative to the event on client's player controller?
if you not calling super in beginplay you breaking your code
always must call super (since blueprint event is invoked from it and other things)
I didn't override "BeginPlay" at all.
Anyone also using Steam's playtest feature can't find game servers in-game ?
@chrome bay after some digging i realised that actors have a per connection net cull setting (although in the current repgraph this just inherits from global net cull settings for that actor), so with a bit of fiddling i can now do a per connection (or any other logic although obviously considerations re performance) to hook into the existing repgraph system and all the good 2d grid stuff
If you mean after you package the project, yeah same problem
so you couldn't fix it ?
I mean Steam Playtest with another app ID, server browser works fine with normal app id
Hi! one question about where to save player data so it doesn't get lost between levels.
What would be the best place to save a player's ID? (the id is used to load the data on multiple places from a MySql database and it's unique to each player)
I'm looking into gameinstance, but it seems that the client game instance and the server game instance don't communicate with each other, so wouldn't that be a security risk?.
If so, what would be the best place to put that variable so that i can set it on the server and than replicate it to the client.
You could store it in the server's game instance and then give it to the client's controller or playerstate.
probably controller so other players don't have it replicated to them, unless you specify owner only on the replication
I just tried to store it on the game instance of the player using a custom Method that executed on server and the gameinstance variables replicated, and it seems to work okey. (Each client gets their own id after login)
am i missing something?
(From the UI widget, i'm calling this method of GameInstance after doing the call to my loginApi)
Yeah that's all kinds of wrong
GameInstance doesn't support networking
No RPCs, no Replicated Variables
but i'm seeing the variables updated on each client game instance correctly, what i'm missing in there?.
Idk but it's 100% not replication
If you want to persist data between Level Changes for your Clients while they are on the Server, you use the PlayerState or PlayerController
And you make sure your GameMode has SeamlessTravel enabled
Then you can use CopyProperties in the PlayerState and or OnSwapPlayerControllers in the GameMode to move data between them
yeah, i'm setting that one up, but i gave it a try to the gameinstance and i don't understand why they are getting updated on the clients
hmm break point on rpc never hits
You are probably calling it on everyone or so
But GameInstance is not replicated. Don't create RPCs and replicated Variables on them. It's redundant
oka, i'm gonna go with the playerController Approach and check later what's happening with this
Do you know if this approach still work if the controllers are not the same class?
Yes but then you'd need to know which direction yo ugo so you can cast the controllers accordingly
It's better to have a parent class for the two controllers that has the data that both share
that makes sense, thanks
is it an expected behaviour for the contents of a replicated TArray to arrive in wrong order?
eg:
server is 0 1 2 3
client is 3 1 0 2
Sorry, i was triyn this but i don't really get it. Is it a custom function that you created inside of the player controller, "server move to"? couse it doesn't let me create one. I tried creating a new function but it doesn't let me cast to my custom character.
no, just a custom event
Hm, no shouldn't
Unless we are talking about replicated actors, they might just not be valid yet when the array replicates
Ah I see, that explains why the order is incorrect..
If the client can't resolve the id, wouldn't it be null instead?
Yeah
I don't think it should get you the wrong order
That said, array OnReps should still call "again" when everything is available iirc
yep it does call again. though even after everything is replicated, the order is still incorrect, which is interesting.
what you are showing is inside the normal Graph or inside the function that normaly contains the move to location?
normal graph
Ok now i get it
How should i do to spawn actors server side and have a reference on the client side actors ?
spawn them on authority, they will be spawned via replication on clients
i don't think you can "link" server actor with client actor manually
Yep i know they will be spawned, but i would like to store refs on the spawed actor client side, there is no way to do something like that ?
Hi! i'm having some troubles with seamless map travel.
I'm trying to carry some playerController Values when travelling, i'm using the following.
all my maps use the same GameMode, all player controller have the same base class.
Before changing maps, i edit the variables on the playerController and they are edited ok (i can do a simple print = controllervariable and it's the correct Id)
i do have seamless travel enabled on the GameMode
and i'm using "Event OnSwapPlayerControllers" on GameMode to carry the values, but this one is never triggered (i put a print and it never happens)
Transition map is setup
Does anyone have any idea what it may be?
Just in case, this is what i'm doing on the game mode.
(i tried without the custom event, it's the same)
Controllers, GameMode, GameState, PlayerState etc gets destroyed
when travelling.
@fluid summit
if you want to carry stuff over, best to use either the GameInstance (if local), or PlayerState and override CopyProperties to copy what is needed to the new playerstate.
Working on an FPS controller and need to get some pointers on best practices.
Should I attach all weapons at runtime and hide/unhide them upon pickup/interact
or...
Use attatch to component ?
What do most games do in terms of managing this in BR / multiplayer games where you can pickup and drop weapons ?
Generally you have an inventory on the player. When a player swaps to that item in their inventory, that's when you display/hide it.
You remove the item from the inventory when they drop the item, and add it when they pick it up.
i think it should work with playerController Too (if using that event) but i can't get to trigger the event, i'm gonna give up and try with playerState
Thank you
the action RPG example has a decent setup for an inventory you can look at as an example.
and you're using C++
if you're using blueprint, there's quite a number of youtube vids that cover it.
c++
i would use the RPG sample then.
currently i am just attaching to comp and using a bunch of casting methods and i feel this isnt a good setup for what im doing
Okay thanks. Ill take a look
the RPG sample uses data assets
which if you're not experienced with those, it'll be a bit of an information overload at first.
but will help in the long run.
Could anyone enlighten me on why a client's server RPC call would not appear to make any changes to the game even though I am certain that the functions are called on the server? I also know that when a listen server uses the same function it succeeds in making changes to the game that the server and client see
Okey, for some reason all my clients are servers.
(Upper left text server = has authority)
Okey this may be related
[2021.09.02-01.00.31:075][ 58]LogOnlineSession: Warning: OSS: No game present to join for session (GameSession)
they are not even running on the same server
did you select listen server in the dropdown when beginning play?
i tried with both, listen and as client (on editor and stand Alone)
as listen would definitely do what you want.
client starts a dedicated server for you
listen makes the first client the host.
and auto connects the 2nd client
yeah, i don't think in this case is something related to that
[2021.09.02-01.00.31:075][ 58]LogOnlineSession: Warning: OSS: No game present to join for session (GameSession) means nothing in this case.
where are u calling hasAuthority? some one correct me if i am wrong but having authority does not mean u are the server
on HUD - > PlayerController (0) -> Has Authority
i think it may be related to how i'm handling the maps.
I start with a "login map" and after login, they are moved into "City map"
The server default is citymap.
HasAuthority returns GetLocalRole() == ROLE_Authority
i think i'm losing the connection when changin map
seamless travel works fine in PIE
and your host will bring along any connected clients
then there's an issue when traveling from your login map to your city map
this is my travel, all before this is just api calls and HUD oriented.
open level is a hard travel iirc
Both Maps use a diferent GameMode, but both have seamless travel checked, also i have a transition map (blank map)
sorry, what do you mean by iirc?
if I recall correctly
it's a shorthand way of saying, I'm not sure if that's entirely true, but I vaguely recall it is.
i tried executing "servertravel" as a comand and the name of the map, but nothing happens.
yeah, it's a blank map
why do you need to test a client travel for both from the login screen?
why are you trying to test this from your login map?
that serves no actual purpose
your clients will never be connected to another player at that point
well, you need to login First and than move to the other map
they haven't logged in yet
i'm trying to carry some values after login (IdToken) but while trying to do so, i realized that they are no even on the same server
You can't really do it that way.
You need something like a menu map
in order to test your full workflow, you'll need to test using standalone with 2 clients.
Have 1 client host a game
and then you can connect to that map with open 127.0.0.1 in your console.
if i package the client/server and run them separatedly, that would be the same?
i'm trying to test it as if were end user
you don't package a server when you're using them as a listen server
and I understand that
oh
that's completely different
ok, so what you can do
is launch a dedicated server outside of the editor
you just need to launch the uproject with -server -log
the -log is important otherwise you need to force close it in task manager when you're done.
-log just lets you close the log window
once you have both clients in your city map, just type open 127.0.0.1 in both clients and they'll connect to the server
you should be able to do that in PIE
i'll try, but let me ask you something first, maybe the entire way i'm structuring this is wrong.
I want a login Map so that you can login user and password
after that, transition to the game map
usually there's a menu between those.
i'm not sure if i even need to change maps in here, maybe i can just put the login HUD on the same map and hide it
what do you mean by menu, a hud?
no an actual menu map
menu player controller
menu game mode
whole 9 yards
you can then have your menu connect to the game server for you.
what's the issue?
hmm, i'm gonna investigate the concept of menu on ue4
Could anyone enlighten me on why a client's server RPC call would not appear to make any changes to the game even though I am certain that the functions are called on the server? I also know that when a listen server uses the same function it succeeds in making changes to both the game that the server and client see. Is there anything strange about playercontrollers that I need to consider? All of my networking code is in C++ right now
@fading birch
depends on what you're calling. Show code please.
my guess would be something is wrong with your weapon's replication. a multicast function should work fine there.
In Third person character I call input event -> then call it on sword(gun base) class(attached to player hand)
yes I see that
Then In gun base class
okey, so it would be:
Login -> Menu for server selection -> Connect to Server xxx.xxx.xxx
I'm gonna try tomorrow with this setup, thanks!
hmm
I would highly recommend using sessions for finding your server once you get that part working.
Steam or EOS would be fine.
i'm not sure then sorry. That should work and I can't think of a reason as to why it wouldn't.
oh
check Replicates
isn't that for games like fortnite? i'm trying to do something like a persistnat world (mmoprg) but without live replication on the actors, they shared data with a database.
sessions are for a lot more than fortnite.
I would strongly advise against building an MMO in unreal
especially if you're working solo
but in that case, if you do decide to go down that path, you'll need to implement an outside of the engine system for getting servers for players. Then integrate that into your project and handle your connection there.
Thank you!
that fix it?
i want no live replication, everything is updated with calls to the database, but if it's not without a server, how do i make the calls with a secure entity? (ie, if the client is the server, i'm screwed)
would something like that work with steam or eos?
no...you'll need to be connected to a server.
If you want an offline game, then that's something differently entirely
never trust the client
basically, i'm trying to copy art of conquest
You could have a "login" server that the player connects to which hosts a basic map and can handle the player login process / communication with database for details about their characters etc.
i'm okey with moving the scope, it's just for learning, but i want to be online, even if it's just a running squeleton
that's kind of the idea with my setup at the moment, most likely i'm doing something wrong.
And to get something like that working, you'd want to probably make a call to a web API from the client which returns the server IP address of the login server for them.
if i start It on the same map that the server (citymap) it works fine, players are on the same map.
I'm not sure why i'm lossing it when changing maps.
the C# webapi and the Firebase Auth work perfect, i can access the database at any point on both maps, but i lose the connection to the server when opening a new map
i think i'm gonna look a bit more into sessions with seam/eos and if not, just stay with starting up on the same map
- You don't need to check authority in a server function
Your client should not connect to the database directly. It's a really bad idea.
- you have a redundant call to
Server_MoveVerticalif it's not authority. The client should be calling it there.
they make petitions to the server
the server should be doing the calls
- You need a function that's marked as
c UFUNCTION(Client, Reliable) void ClientMoveVertical(float VerticalInput);
that looks like your missing step
Sorry, a lot of those checks were for me to verify all of the functions are working as I expected. For 4) I have that already, but when called, it seems to just create an out of sync moving client with no intervention from the server
I plan on removing most of the checks after fixing the issue
When I call both Client_MoveVertical and Server_MoveVertical from the client there is still no change on the listen server's instance of the game
But I know that Server_MoveVertical is going through all of the functions I listed every time it's called
Although my version has Unreliable with the UFUNCTION header, not sure if that will make a difference here
I'm using a Pawn. I'm simply trying to allow a client's PlayerController to move the pawn using the Server RPC
I would use a pawn movement component then
or just use a character instead
and use the character movement component
as replication is handled for that
Ah, does floating movement comp not have replication sufficiently built in?
nope
Jeeze, not sure how I missed that
yes
well generally speaking
if it's public you can technically give it input from another class
I wouldn't go that route.
I would have a base weapon class
an actor is fine
I did a similar setup for a single player, it worked okey. Im not sure on multi
but just have the player's controller fire the weapon
and just call the fire function on the weapon.
You can handle all of that via the weapon.
Add an alternate fire etc
you can always refactor down the road.
just mark the fire function as virtual
and override your logic
for charge type weapons, you can just check that the input is still pressed and run a timer
ie:
Fire()
{
GetWorldTimerManager().SetTimer(YourTimerHandle, this, &AWeapon::OnChargeFinished, ChargeDelay, false);
}
OnChargeFinished()
{
//Firing My Laser Beam!
}
StopFire()
{
GetWorldTimerManager().ClearTimer(YourTimerHandle);
}```
actual 1s
better implementation
it can be yes.
:D
Yeah I would.
Thanks for the help Djriff, not relying on floating movement solved my issue
an excellent day for the developers
which owner are you speaking of?
attaching a component does not do that
you'll need to call Weapon->SetOwner(this); from your character.
well you're not exactly attaching it as a component
you're attaching it as an actor
via Weapon->AttachTo(this)
oddly enough
it checks if the actor it's attaching to is the owner
but doesn't actually set it
so just set the owner to your character when you equip it
and the null the owner when you unequip it
ez day
no, it just makes it so it had no owner.
the actor and the server will both have a copy of it.
replication just replicates variables across all instances of said actor
erm no
that would be the role
that determines who "owns" that particular actor
generally yes, authority is the server
ownership applies to the actor that owns the object.
for example, the owner of APlayerState is AController
no, the owner of an actor is either a nullptr
or another actor
it has nothing to do with networking
an owner for an object
it's useful for stuff like weapons, player states, etc
I'm not sure I can agree with what is explained about the Owner
Owner and Ownership is a huge part of Networking. So not sure why it's stated to have nothing to do with networking 
perhaps I misunderstood the engine code then?
I was referencing that when speaking about it.
when an owner is set does the actor then inherit the network role of w/e possessed it?
It's mostly used to define what connection owns the actor.
Very important if you want to execute Client and Server RPCs
Server is also not always Authority
A local only actor can report true for having Authority on clients
And for the role stuff, iirc only characters really use the Autonomous Role. Everything else, even if owned by a connection, should be simulated proxy and whatever the other one was. But not sure on this one. I barely use the roles.
Right. Just adding info.
๐
@tulip ferry
Feel free to scroll up and read a bit. And then ask questions if something is unclear
Means something went wrong, either owner has quit the game or there is a mistake in the code
Usually you cancel what you're doing at that point
if(GetOwner() == false)
{
return;
}
u could do (!GetOwner())
saves time when typing
Also it should be GetOwner() == nullptr
Mostly nothing. A null owner would still allow Multicast RPC iirc. It doesn't mean it's owned by the Server but in terms of RPCs it should be the same behavior. Owned by the Server, in case of a ListenServer, should mostly be handled to acknowledge that the server-client is the owner of it instead of no one or a nother client
When not talking about net connections then it's still useful to use the owner to build up a hierarchy of what spawned what and what manages what
E.g. an AI doesn't really care about Owners for RPCs, yet it makes sense to utilize an owner for Weapons spawned by that AI so you can check who owns a specific Weapon
Haha, didnt even notice that
I need some sleep
Can OnReps get denied (not called) if latency is ultimately high?
Onreps are called locally when the value replicates
So they can't be denied
And the value will replicate at some point, just maybe later
I guess meanwhile they can stack and run in very close times then
I made a pool-based and deterministic projectile spawning and so far its working great, but with extreme conditions sometimes projectiles are not visible, probably they stack and spawn together at some point
What about "packet losses" though? I noticed this only happens when pktloss=25 is set
it will also eventually replicate
that is a very big packet loss btw
Whats the ideal rate for testing?
there is no ideal rate , but 200 ping and 5% packet loss I would consider as bad internet connection but still somewhat playable
I see, thanks
I usually test with 250-500 pktlag and 10 lagvariance, but first time tried with pktloss
that also depends on what kind of game you are making. Testing 500 ping for FPS is pointless as it is unplayable no matter what
Fast-paced TPS, I expect lower than 150 ping for playable conditions from player
seems reasonable
Yeah we have a hard-cap at 450 but it's pretty much unplayable at 300 or more
Most players expect that though, they'd been conditioned ๐
100 ping is a realistic cutoff for mainstream and degraded network tbh
yeah
Another curse of 100 players is to fill up servers people gotta join ones further away
Another argument to not do that
i feel your pain there.
Just add bots to fill the missing players 
Pick a random user and their customizations from the database that is offline for the name and looks of the bot :D
Didn't FN try that ๐
To mixed response
Also that's only as easy as "Just add AI to your project" ๐
Yeah. I mention that cause Pokemon does that in their MOBA atm
They match you in Rankeds against bots (really bad bots) when you lost the previous one
And they aren't even good at hiding that
The full 5 member enemy team is just bots
But yeah, only joking around
Does it work if play montage on multicast only
Hey, I'm currently testing a way to get a repicated airplane working. I added a Floating Pawn Movement and on Server Side the Plane is moving forward like it should. However If a Client tries to move it just wont. The Input values are correctly repicated and everything is replicated.
The same setup is working with a Tank and SimpleWheeledVehicle setup. Any ideas?
are you doing posses on server as well?
Yes, the same way as with the Tank where it's working fine
are you using the same exact movement component for the tank?
No for the tank wheeled vehicle and for the plane floating
im pretty sure it would work if you used character movement and set its movement mode to flying
but thats just a workaround
you can try multicasting the add movement input and see if that works
Already tried, does not work. I can multicast or run only on server the movement input. nothing
Hey. How do I replicate this back to the client? Currently this function resides in GameMode, which is called from a player controller. As you would imagine, it works on the server, but unsure how to get it back to the client.
@rich dune
check replicate movement and should work
same as templates that unreal includes
just get rid of your tick
because input axis already is like a tick
Only character movement has proper multiplayer support, none of the other movement systems do
if you check replicate movement then floating will work as well
Well the transform will replicate to a client if you set it server side, but that's about it
thats all he needs for a plane
thats why i suggested using character movement in the start
cause it has all the prediction stuff as well
Yeah. All the complex prediction logic etc. you only get via CMC
i just dont remember if you can add that movement component to anything else than a character (talking about c++ as well)
but i guess not since it has a lot of logic regarding character
Yeah they're tied together
make sure that your function is being called on a server event
if you see that little computer on posses node, it means that its a server node
and dont use get player controller, might return the host instead of the client
for testing purposes you can change it to a dedicated server
and if get player controller is the culprit, it will work fine there
oh wait not, since you are using that controller inside a GM, which only exists on the server
OK I will try and digest this and make some changes. Yeah, I understand that Possess is only called on the server.
but still my guess is that you need to get the correct controller
that is trying to posses
because now you are getting controller at index 0
and its in GM and GM exists on the server
So I will always be getting the host.
@grizzled quartz Already tested this and Replication is ticked. Does only move on one client but not on the other client
i've tested that in clean project and using 4.24
works fine on my end
thats all i did for the pawn
or wait, now server cant see client moving ๐
brb, will figure this out
Can anybody
literally anybody
just help me
understand how to make teas
teams*
;D
Use a TeamId variable which is replicated.
PlayerState should be a good place to put it.
This one has a good tutorial https://www.youtube.com/watch?v=kDKC-LpFUz0&t=8s
Hopefully I didn't go too fast. What if these were one of the lazy tutorials, like Ian Hubert's?
Intro: (0:00)
Game Mode and Player Controller: (0:23)
Spawning Players: (0:57)
Countdown timer: (2:11)
Disable/Enable Input: (4:26)
Match timer: (5:14)
Game State: (5:40)
Timer widget: (6:34)
Errors: (8:02)
Outro: (9:31)
Ask if you have questions ...
@rich dune which engine version are you using?
4.26.0 Source build
Thanks for the help. Think I'll have to leave it for now, as getting confused. Looks like I didn't know as much about networking as I thought I did. ๐
Hi! one question.
I'm running a function on the server to change the Token ID for my playerController, after that i move to a new form, where i check if the TokenID is set.
The problem is that there's a small delay on the set of the TokenID, is there anyway to wait for the server to run one specific event before continuing the execution flow?
No there isn't. You would have to do ClientRPC back to confirm that you set it and then run your logic
yeah i just did that as a workaround, gonna leave it like that for the moment, thanks!.
Does anyone know why i may be getting this error? not sure if it's server related
The blueprints are from playerController
Not sure
But doing it on BeginPlay is also not smart
BeginPlay will call for the Server for all the Clients
So the Server is now adding multiple Widgets for itself
You need to limit this to locally controlled
And then the RPC "CheckUID" is also redundant to be an RPC as BeginPlay already calls on the Server
oh you are right, i'll ad a remote authority check
didn't knew that beginplay from controllers was called on the server
Do you have ListenServer or Dedicated ones?
dedicated
BeginPlay calls on every instance
Doesn't matter if replicated or not
And the Server has an instance of the Client's playercontroller
Okay if dedicated then the auth check is enough. Otherwise you need to keep in mind that a ListenServer does not count as Remote/Client, but still would want a HUD for itself
So IsLocalPlayerController would be wiser
that makes sense, thanks!
i think i got the problem, on checkUID i change the active Widget of the HUD.
But since i'm running ADDHUD on the server, if i run checkUID on server, it will fail to find a reference.
Got it working a intended, thanks cedric.
FloatingPawnMovement is definitly broken and not replicating
is there a way to get character movement component into a pawn and not into a character
?
noop
FloatingPawnMovement doesn't work in MP, if you're using Blueprint you're fairly restricted to hacking a character pawn into what you need.
EDIT: Actually this question doesn't fit Multiplayer exactly. Freaking generic questions. nvm
i think there's escenarios where you may run into a client having server role (like if you are using a listen server) and maybe other scenarios, but mostly yes
that should be okey then
This is theoretically okay. But it can be that the Local Role is Authority on an Actor that is simply not replicated and exists only on the Client.
If you are already using C++, you should implement Sprinting through the CMC though
Yeah, your own CMC child
And then follow the way the CMC handles Jump/Crouch
There is some info about this here:
It needs a lot of boilerplate code
But it's needed if you want smooth movement
Not everything on that page is correct though
You should never send additional RPCs to communicate data
They do this in the Boost Dodge part
Which is wrong
In that example you can use the Acceleration that the Server gets passed to know the direction of the dodge
But all in all, the info is good enough to get started
I can't figure out why health bar is not updating. Damaging works. It's pvp.
Take hit function called in any damage
damage only runs on the server.
How should I fix that :0
store health either on the character via a component, a float on the character itself, or in the player state. Mark it as replicated, and then grab that value from w/e to update your health.
If I store health var to component how should I reduce it when take damage? in any damage get component and set hp var and and after that get that hp var and update health bar?
or update health bar in that component and only reduce it on anyDamage
Made it work!
wont player controllers also have authority in the client? also if you spawn something in the server throught the pawn wont that have authority also?
@violet sentinel Could i ask for your help again? your last help really got me closer to something that work but if you see the video below it's yet to start working properly. Basically the in the host everything is ok, on the client the character moves very slow, but if i change to the host tab suddenly it starts moving like it should. Also both characters inside the host tab rotate properly, the client character inside the client tab doesn't rotate. Any idea on what could be causing this?
does it pick up the correct online subsystem ? is steam app id valid (i think you can use 420 and do LAN search)
I did not go into the steam part yet. Is all still hosted on me.
so for now i'd say experiment session search options etc
Is it different between blueprint and c++?
oh, nvm. didn't watch full video
the template code sends move RPC while LMB is down every tick causing effect you see .
ask someone how to implement ARPG-like movement that would work in multiplayer
Sorry man didn't understand what the rpc and lmb part was
look at your player controller blueprints, try understand what does it do. you can get rid of VR/HeadMountedDisplay stuff to not distract you
Ok thanks
hi all, I'm having an issue where in mutliplayer my camera will not rotate on a particular axis (the pitch value axis) on characters not on the server. This is regardless of how i set up 'use controller desired rotation' or 'use controlller roll/pitch/yaw' etc. What's confusing is I have the exact same (apart from a few constants) setup for adjusting my pitch and my yaw, but the latter works while the former doesn't?
Here is my code for turning left/right
And for rotating up/down
I checked 100 times for some setting that was different for pitch and yaw, can't find any
If the server has a hard reference to an Actor that is replicated, but the client has no such reference (e.g. a UPROPERTY on game mode, which is not replicated), is it possible that the object gets garbage collected on the client?
The replicated Actor has bAlwaysRelevant set to true in its constructor
I've added Ammo and Reloading into my blueprints, however the reloading is not replicating properly to the client (It works fine on the Server) and i'm just wondering if i've done anything wrong in my Weapon Blueprint or if i'm replicating something wrong here.
Basically, right, in my game, i have the player shooting with the Ammo going down. That's fine and working on both the server and client, the problem lies with reloading the weapon. On the server, it reloads fine, on the client its broken.
So e.g on the client, i have 25 bullets, i shoot 5, so i have 20 now. If i reload, it displays 25 bullets but when i shoot again, it shows 19. So it's not properly updating
after reloading, are you updating the number of bullets on the server?. (maybe you update it when firing, but not when reloading)
yes i am updating it on the server
if you reload on the client and don't tell the server, your client will display 25, but when you shot, it will update to whatever the server have (20 -1)
it's in a custom class called "Server_ShootInfo"
let me see if i can get a full screenshot
is there a way to show my blueprints in full without having to zoom out? it's a bit of a big blueprint, kinda
not that i'm aware
Ok so this is the shoot info for Hit Scan, below is for projectile based weapons, it's similar to this however it's getting a projectile
The reloading works the same for that, however, let's focus on the hitscan part as im sure it will be the same for projectile weapons
this is the Weapon Blueprint
and this is ran on the Character Blueprint
i'm not sure if here you are doing it on the server, shouldn't you adding a custom event "Reload" that runs on server and call it when pressing "InputReload"?
if not, you are replicating the variable, but since it's not the server updating the value, it does not get replicated down from there
im pretty sure this is a very nooby question, but google didnt really gave a clear answer so here i am. The graph is located in my character bp (yes it does replicate) and when i press vault i want to execute a function within a component (also replicated ticked) that lerps the chars position. Problem is i need to change the location on client and server side if im not mistaken right? Thats why im trying to use a multicast but my character is always getting set back to its original location by the server
something like this
aha yes! @fluid summit that's what i should've done!
Thank you very much my friend
it works now
i'm not sure i get what is the problem, can you show me the CheckFor Vault method?
oh wait, it seems it's broken again ๐
i did have a second look at it and i think its more a problem here right? this is the actual function that interpolates the location
it works fine with the Assault rifle (hitscan) but with the projectile weapon (pistol) it just kinda breaks lmao
basically as soon as i check for vault it triggers a function which sets some variables and will trigger the timeline and the function
What i would do in this case (i'm new to multiplayer, keep in mind) is
Call the vaulting action method on the server and let it execute whatever it's doing
Do the same on the client without replicating at all, so your client doesn't need to wait for the server to update (you will get some jitte if not).
you mean after im calling the try function i should replicate only the function that actually triggers the timeline if all parameters are met?
tho im still on client side and dont know how i would replicate this
i'm not so sure how timelines work on mp, here's some small tutorial i saw about it for opening doors (it's pretty much the same you are trying to do)
In this series we will be explaining how to add online multiplayer to your games. First we are going to explain how it works, then we will go into creating lobbies etc.
In Part 3 we go through how I made the online functioning doors you saw in part 2. Learn how to add replication to doors.
SUPPORT ME
Patreon I https://www.patreon.com/ryanlaley...
maybe you can get some insigth with it
nevermind i fixed it again lol
i will definitly have a look at it!
is the "Level Blueprint" of a Server Level on the server or local? As in if i use VaRest to send a JSON from the bp level, in a Server Level, will the adress of that json request be localhost(Server side) or from my computer to the servers side?
Depends if the event you're firing is fired on the client or the server.
So basicly i was thinking of creating a function in there, that will function to trigger a JSON Request to ship off data to store in a mysql database, and i was kinda hoping that i could make a rest api for the server, so that i can do a localhost, and be able for my games community to run dedicated servers as they wish
by you know, loading, unloading stats from the db
Basicly, what im tryina make rn, is that when player quits, his inv etc will store over there
Im running that exact same setup at the moment and is running okey, feel free to reach if you need any help
With regards to where make the calls, im not sure what im doing is okey in terms of security, prob would have to refactor later
I'd recommend you do it from game mode rather than the level blueprint. Level blueprints aren't really accessible from other areas, so there's no real easy ways to communicate into them, only out.
What if you make the calls on the hud (client only) and set the values after on server?
@coarse flame
So for the Dedicated server with MySqlDatabase using c# WebApi you will need the following.
-Build unreal source version (https://www.youtube.com/watch?v=TcovfE8IsHs&t=1293s)
-Add VaRest Pluging to your build (you can get the github version that matchs your UnrealSource here https://github.com/ufna/VaRest)
-Setup MySql and build a basic C# WebApi (https://www.youtube.com/watch?v=TcovfE8IsHs&t=1293s)
Hey guys,
In this tutorial we're gonna create a simple Web API with C# and MySQL.
Cheers, allready on step 3 lmfao
with that you have the basic setup and you will be able to make calls from inside the game with BP to your Api and access the database (this point may require a few more steps for the setup, feel free to reach at that point)
If i RepNotify on a Struct, do i get a notify even if i update only one member on it?
Yes
online replicated doors are a way more complicated topic than a 13 minute youtube video
unless they are super simple
they are, it's just to explain some concept, also he's really good at explaining.
how so?
seems fairly simple in concept
when you have as many features as our doors, it's desync city
ah
I was thinking a literal door just 2 states
and i was like
that's not complicated at all
shootable hinges, variable open state, breaching, peeking
oh to make matters worse, there used to a bug in the engine which would cause actors in sublevels not to replicate after seamless travel
did you see our UDN ticket? took a while
sorry to interrupt (?)
Anyone have an idea of why this is not triggering OnRep for the Struct "UserProfile"?
new value != old value.
you need to call the onrep
What do you mean? i tought that OnRep is triggered automaticly when modifying the values of the struct
oh i think i got it
you can call the onrep to force the value to update on clients
the OnRep function runs on clients, not the server
it was a diferent problem, i was passing to the "Ref Struct" the new struct (it should be the one that needs to be modified)
Does anyone know how ark made theyr servers store via mysql?
For theyr dedicated servers i mean
like how are they connecting it to run via server
they do? I would've figured they would've used an API or something
it seems like they do
ARK's Web API is used by the client to get a list of official servers and display news. Each endpoint can be accessed by sending a simple HTTP GET request. HTTPS is not supported. Some endpoints are suffixed by a ".ini" extension, but their content is not in the format of an INI file. Endpoint names are case sensitive. All API endpoints are host...
https://ark.fandom.com/wiki/Dedicated_server_setup#Backing_Up_Server_Data this seems to just imply that it's using save games
or at least dumping data to that directory locally
3 hours trying to see why my Api wasn't taking the request i'm making.
I just remembered that you can't send a json body with a GET, you need a POST.
3 H O U R S
Oof
well that's not entirely true
you can send a JSON body with a get request
just don't expect to save any of that data.
But isnt save game object kind of locking you into just a handfull of players?
well isn't that what it does?
there's nothing about setting up a mysql database here, if there is persistence between multiple servers then it'll be an API rather than directly connecting to a DB
See, with that approach, i need to know how to make the api easly configurable in order for it to be able to be deployed at other places rather than just my IP being in the games JSON Request
I'm not sure what you mean by this, usually a game backend is pretty invisible to the user
Yea, but the way i want to do it is by letting players be able to deploy they'r own dedicated server right, and im looking for ways to save data, player locations, money, inventory etc, without storing it on the clients files
I ment as in that it is hidden, but you need your game to trigger JSON Requsts in order to make the web api save example like player coordinate
Hey guys,
I am using a modular character for a game, where the player makes a character and then it gets saved to the save game. And it loads the mesh parts in character BP. Now the problem is that the mesh on every player is the same as the player's own mesh on the player screen.
Now how do i create it so that every player sees the mesh made by another player
Replication
?
The difficult part is the security of it all. By allowing anyone to run a dedicated server of your game and having your player data stored in a central database, you'd have to expose the API to your database to the public, which means that anyone could make calls to it, which in turn means people could spoof data and muck up other people's data or set their characters stats/levels to max, and give themselves copious amounts of items, and you can't necessarily "authenticate" dedicated servers run by others to make sure that the data is only coming from your game server, nor can you necessarily validate the values that they send are indeed the values that they should be.
You can't really work around this - it comes down to "never trust the client" which in this case would also be any dedicated game servers set up by the public.
If you don't care for these sorts of issues, and understand that eventually someone will be likely to do some bad things with your database, then you can just continue with a web API and allow third-party dedicated servers to communicate with it.
I want to mention a game that had some issues from allowing clients to be in control of the data: Diablo. You could join other player's games that were hosted on the machines of those players, but still use the save game files from other clients. What this would allow is for players to run their character offline, use a trainer and give themselves all the levels, stats and items they needed, and then join someone else's game with that character - cheating in such a fashion became rampant in the original Diablo, and persisted into Diablo II unless you used "realm" characters which were characters that were stored online & could only be used online on a Battle.net hosted server. Diablo III never had this problem as they completely removed offline play - you had to play with an online character on a Battle.net hosted server.
I'm sure there were still cheats on Diablo 3, but not to the extreme, nor accessibility of the first two Diablo games.
What if i only run official servers, making it only my servers will be run? How do i still go about storing it then?
Sorry if im slow, its 6 in the morning ๐
Then you can do it as you've already figured out -> Have your dedicated servers communicate through a web API to your database that isn't accessible to the public, or program in a means for UE4 to communicate to your database directly or use a plugin that provides such functionality.
If you're going to use publicly hosted dedicated servers, setting up a licensed server is a good idea. I personally wouldn't do that for anything that would include matchmaking as @sinful tree stated, you can't trust them to not muck everything up.
If you or a a cloud service you pay for (AWS, Playfab, etc) hosts your servers, you still control that and it's fine.
What do you meen licensed? AWS etc?
as in you have a license server setup. People that want to host their own dedicated servers for players to join would need to apply/purchase a license to do so from you.
if you're just hosting them on AWS, then you don't need to worry about that as you're the one hosting the server still
Ah yeah was planning that route
I'm not familiar with those games. Rust from what I can see doesn't allow you to use your character across servers. Each dedicated server would have their own save game that contains the character data for a specific player. The specific player & character would be linked to an ID of some kind (probably Steam ID) and whenever the player joins, it reads their Steam ID and then loads them the character associated to that SteamID. Data would likely be saved in intervals and when the player is leaving or gets disconnected, again associated to the ID of the player. Many games that have the ability to allow players to run their own servers will do it this way. Any issues with cheating is strictly on that one particular server where the cheating was taking place and that data doesn't get passed around anywhere else, nor can the owners of the dedicated servers potentially muck about with anyone else's data.
The way im going will be setting a api up so server communicates with a sql db located on same server for each seprrate server, forcikg you to create a character for each server you play
Pretty much like that yea hah
How would i go about setting it up like that?
i wouldn't bother with a sql database for that
