#multiplayer
1 messages ยท Page 533 of 1
this way you can issue your servers an api key or something
and reject any request that doesn't have an api key
this way random people can find your api... but they can't do anything because you outright reject things that come through
and if an API key leaks, you can just regenerate it
it gives you a fairly powerful layer of security
that you don't get if you are just accepting direct connections to the SQL server
I'm sorry but I don't know much about web server stuff for HTTPS, but are API keys dynamically generated or are they static where I go onto the webserver, manually generate it, and copy and paste it into the UE4 dedicated server code?
it depends on your implementation
I'm sure there are some free, open source implementations of a basic rest api framework
in a language of your choice
I would do that if I wanted a static amount of Dedicated Servers?
uhm
are you absolutely 100% sure you are doing a static number of servers?
like "this is the decision i'm doing and will never go back on it"
No, I'm just talking generally. I want a dynamic amount of servers. But I want to limit the amount of servers on at will (for testing purposes and closed access or something, so there are never more than 3-4 servers online at a given moment)
then do the api method
it's flexible and doesn't add that much work over just doing an sql server
does UE offer any framework for sending/receiving http requests for this sort of thing?
That's a good question
yes
like im literally building a dedi server right now (for learning)
And for this "rest api" what exactly is that? Is this something implemented into the dedicated server or the webserver that connects to the database?
I've tinkered with ASP but never really dove into it
I'm more into C# so I'll probably use that for the web server portion
REST is a style of web api
it's relatively trivial to implement
asp.net is a good way to get started
just google like "ASP.NET REST Api tutorial"
Hands on lab: Use Web API in ASP.NET 4.x to build a simple REST API for a contact manager application.
thats pretty old (from 2013
something like this: https://docs.microsoft.com/en-us/aspnet/core/tutorials/first-web-api?view=aspnetcore-3.1&tabs=visual-studio
Learn how to build a web API with ASP.NET Core.
So the picture it shows is exactly what I'm trying to achieve? The Client being the Dedicated Servers, controller being the web server, and the data access layer being the database?
if i recall this is the video i watched that helped me understand how to implement what i was trying to do
https://www.youtube.com/watch?v=bIiEv__QNxw
Full courses: https://www.iamtimcorey.com/courses
Source Code: https://leadmagnets.app/?Resource=MVCDataAccess
Patreon: https://patreon.com/IAmTimCorey
Newsletter signup: https://signup.iamtimcorey.com/
Tutorials are excellent at teaching you about a piece of the overall de...
if I were to use an SQL database (what I'm going for unless if you think there is a better alternative) I would put the SQL query code in the web API code?
i made procedures on my database and use the web api to call those procedures and not access the DB stuff directly
such as a procedure to check if a certain string exists in a table or something and one to retrieve data and such. just very specific things
if you are using C#, there is a really good connector to SQL
that you don't have to write SQL queries
it's absurdly good
So I could make a procedure that fetches player inventory information
@gleaming vector What's it called? And it's for ASP.NET?
yes, a procedure that takes in a player ID or something to identify them, search through the DB until it finds the data and returns it back
for C#, if you add "core" to your google searches you get modern C# tutorials and tools
In this series of tutorials, you learn how to build an ASP.NET MVC 5 application that uses Entity Framework 6 for data access.
This was made about a year ago
The one I posted is modern or old?
But looking at this
protected override void OnConfiguring(DbContextOptionsBuilder optionsBuilder)
{
optionsBuilder.UseSqlServer(
@"Server=(localdb)\mssqllocaldb;Database=Blogging;Integrated Security=True");
}
It's basically using a SQL server but does a lot of the querying statements for you?
yep
it has a few connectors too
so you can use mysql, postgres, mongo, etc
it defaults to MS SQL
nuget has all the connectors
This is really cool ngl. Should the SQL server be on the same thing as the web server so it's just a local database according to the web server or should the SQL server be hosted off in another place?
your call
Is there any downside to having it local? Since the website will only be accessible by me and the dedicated servers
simply putting it behind a ASP page (or other rest implementation) gives you flexibility and security
you can move it later if you want
And having the SQL server somewhere else would just increase latency
so it really doesn't matter
Fair enough
you just move the server, migrate the data, and then change the connect string
so far EF looks literally effortless
if it were me i would not use EF
EF has issues scaling
dapper never has issues scaling
but, for small scale like you are targeting and the fact that you don't really know what you are doing, it's pretty great
if you want to make sure you have a solid system, don't use EF. its dangerous for beginners that are trying to make large scale stuff
i dont think he's going large scale, i'm just trying to recommend against directly connecting to a SQL database from a dedicated server ๐
So the general work flow would look something like this?
Client picks item up and sends RPC to server -> Dedicated Server then validates if pickup is legite using server knowledge such as location, if true sends an HTTP request to ASP server -> ASP server then uses EF to add item to players inventory in the DB
yes
so, if you want to get real fancy
servers send the request with some API key
but you can have a Get Inventory http call that returns the player's inventory
and let clients access it
since they dont have the server API key, they wont be able to change things
so like your server could do something like
yourservice.com/api/push/inventory?apikey=abc123&inventorydata=whatever
and clients can do
yourservice.com/api/get/inventory?playerid=123
Are API keys basically just, keys to allow the dedicated servers to send modification requests?
yeah
it's just a param you check
for your inventory endpoint
if it's invalid, reject
How would you dynamically assign API keys? So that when a new dedicated server is started by Steamworks or something to act as the master server it says "yes this is a valid server"?
Wait no
The ASP is the master server, so it would just spin off the UE4 server with an API key?
just put them in the database
ie, create the api key, toss it in the db
when a server makes a request, check to see if the api key is a valid api key
by checking it against all keys
quick and dirty simple solution
quick question, in your push functions (methods or whatever) do you do a normal check like if apikey == blablabla the push data and on the client dont do the check for an api key since its just a getter function to get the inventory?
But the ASP server is technically the master server, and that is what creates new UE4 Dedicated Servers for gameplay?
uh, no
Wait no, there needs to be another server in here somewhere
it's just an interface for your sql server
you can make it do that
but, you are on your own for that, i've never done orchestration like that
there is a good service for that
that is open source
i forget what it's called tho
starts with a k
So the optimal thing would be
- Dedicated Server
- Master Server (the one players connect to upon launch, matchmaking, etc.)
- ASP.NET server for database queries
Agones is a library for hosting, running and scaling dedicated game servers on Kubernetes.
thats it
Something needs to be responsible in spinning up new UE4 servers, and therefore assigning an API key to that server, and probably other stuff such as heartbeat so it knows when to remove the API key from the DB
honestly
to get started
just hardcode it
you can deal with the dynamic part later
That's true, but what I said with the master server upon client launching the game seems to be the best case, because that master server would monitor the dedicated servers
like, make a guid, remove the dashes, and voila, hardcoded api key thats hard to guess
Pardon my art skills but in my idea it would look something like this
you can do something like that
The master server creates and monitors gameplay servers, and when it is created it asks ASP for a new API key to assign to the new gameplay server
The main drawback that I can see is that the master server will have one static API key
But anyway, I can't thank you enough for how helpful you've been, but thank you. It's a huge help
I'm using a dedicated server for multiplayer. However, I want to have people be able to group up before they start match making and join a dedicated server. What's the best way to go about this?
When the client starts up the game, they aren't connected to any server, and only connect to one when they begin match making. Do I need to have a dedicated server for groups prior to that or can I just have them join the client which acts as a sort of listen server?
why not create a multicast when the host tries to join the other server that has all the connected clients connect to the new server and then the host connects? just a thought for something similar
That's what i'm not sure about. Is the best way of building a group before connecting to a dedicated server just setting the group leader (all clients initially) as a self listen server?
we're using Gamelift, which supports group match making easily enough, i'm just curious about best practices.
@fading birch Probably PartyBeacons
I had looked into those actually
wasn't sure if that was the best solution
i've never used them before.
PartyBeacons are just Actors that enable RPCs between Players essentially.
Or at least, RPCs between the BeaconHost and the BeaconClients
part of this correct? https://docs.unrealengine.com/en-US/Gameplay/Networking/OnlineBeacons/index.html
Yeah PartyBeacons = OnlineBeacons
neat
The Player that is "hosting" (your group leader) will be the BeaconHost, other Players that want to join his party will become BeaconClients.
yeah, there's a nice tutorial on it actually: https://forums.unrealengine.com/community/community-content-tools-and-tutorials/1355434-onlinebeacons-tutorial-with-blueprint-access
The BeaconClients just let the BeaconHost know what their Unique Data is relevant to MatchMaking and then when the BeaconHost is ready, you send that stuff off to GameLift to get a Match result.
The BeaconHost can then let each of the BeaconClients know when to travel to the Server they were Matched into.
are you experienced in using gamelift?
i'm currently reading through all of the documentation, but I had some UE4 specific questions
Ive integrated it before yes.
mind if I DM you some questions about it?
Just ask me here.
it's not really on topic, at least I don't think so
true lol
What are your thoughts on the GameLift Client SDK plugin?
it seems to be missing some key functionality
We used to use that.
We dont anymore.
We use Lambda instead for calls into GameLift.
ah ok
Only the Dedicated Server interfaces with the GameLiftServerSDK
For obvious reasons.
We heavily modified the GameLiftClientSDK plugin but then said stuff it and went to Lambda.
It was much easier.
And safer.
i've not worked with Lambda
Lambda is really easy to work with.
Its online interface is quite easy to pick up, your writing the functions in JavaScript.
Its got some good documentation.
But you are right, the GameLiftClientSDK was lacking in functionality.
Its very bare bones.
Gives you the bare minimum to get sessions setup and joining them.
If your game isnt complex, you could probably get away with using it.
But if you want the more advanced match making stuff that GameLift offers you wont get far with the GameLiftClientSDK plugin.
isn't matchmaking already provided by the OnlineSubsystem interfaces (ie. Steam/Xbox Online Subsystem)?
I'm not using those
gamelift has it's own version of match making, called Flex Matchmaking
which looks over all of the fleets and game sessions you have
and i'll look into Lambda
is there a UE4 flavored guide for it?
i'm familiar with http protocols and the like, our backend is actually java and mysql entirely
Nope, your completely on your own when it comes to anything else other than GameLift itself haha.
Why not use the online subsystem matchmaking? Im thinking about what im going to do so curious why you decided not to use those
Once you compile the Lambda binaries your good to go.
Well not quite good to go, you have to link those .dlls into the plugin your using to expose them to UE4.
There is a tutorial on that somewhere on the Web
@timid moss Depends on what your games complexity is like i guess and other systems you are using.
We use GameLift because we are using other AWS Services for Player Data Storage etc etc and other things.
im just wondering if using online subsystem limits you. like it should work fine right?
i feel like it might be more complicated not using them
If your using it now and it works then sure?
OSS works fine, if you use Steam
If you don't want to ship on Steam, it's problematic
if you need an introduction
https://www.youtube.com/watch?v=Ed7f6gvd-l4&list=PLnHeglBaPYu9Iyr5jwiCEdKopTq0zvuK7
In this video we setup our project to work with by creating a new main menu level/pawn/gamemode/gameinstance and such. If you can I recommend you go ahead and port forward TCP/UPD 7777 and 27015
DefaultEngine.ini:
[/Script/Engine.GameEngine]
+NetDriverDefinitions=(DefName="Ga...
lets say i want to ship on steam and console platforms. is that problematic then?
it depends entirely on what you're trying to do
we're choosing to use gamelift because it's cheap
You'll need to look at which features each platform OSS supports
and we need scaling servers
to meet the needs
@fossil spoke thanks for the info, i'll look into Lambda
๐
I have very little experience with node js, but i'm sure i'll figure it out.
I was the same, but its piss easy once you have a bit of a go at it.
atm we're just throwing our build on gamelift and i'm throwing the manually created gamelift session arn into our backend database.
yeah, we're actually using socketio for our chat
granted, I have one of our other developers working on that, since he's far more experienced with node js than I lol
we're just manually creating a game session at this point in time
I kind of had the gamelift stuff dumped into my lap
so i'm figuring it out as I go
Oh ok
i know it's not the most elegant solution lol
but it works for quick dirty tests that aren't locally hosted.
Baby steps. There are alot of undocumented "gotchas" that i ran into as well just FYI.
mmhmm
ran into a few of those myself already
the documentation for gamelift is also pretty shit
it says you should do xyz but not what xyz actually is or how
Yeah, we have an Amazon Rep we keep in touch with. I usually let him know when stuff isnt right. We have found multiple bugs across their systems lol
mmhmm
unfortunately my friend who works at amazon doesn't work in that department
he's in the echo dot area >>
Its a large company lol
some of the code that he's gone through is 
Anyway, moving a bit offtopic. If you have anymore questions just ping me here.
will do!
hello guys
does anyone know how often I can call FlushNetDormancy without losing performance?
Will it be fine to call it 2-3 times during one second or should i just switch dormancy for this second?
Doesn't matter because it won't go back to dormant state until clients acknowledge the last-sent state anyway
Should definitely avoid switching too often though.
If an actor is dormant for a short while it closes the actor channel, then you have to open up a new one which sends all properties again.
Including COND_Initial properties, etc.
@cloud apex
Dormancy can end up being more expensive if you don't use it correctly.
@chrome bay
Thank you. I didn't know about resending properties. Gonna do some refactor now
dormancy is for things that maybe idle the entire game, like in Fortnite, the trees are all dormant, pickups are dormant once they are on the ground (don't need to be replicated anymore as they don't move/dont change)
kinda thing
Hello guys. I was wondering how dedicated server management works when your game is published. Specifically the part where you choose a hosting service to host your servers like on Azure or something. So what I'm confused about is when your server isn't hosting any UE4 Dedicated server instances, does it shut down so that you won't be billed for any inactive moments? Or does it just stay on even though it's not running any Dedicated servers?
You probably should build such a system, yes
Starting and stopping UE4 servers on your hosting provider is likely a service you need to build yourself
I understand but I'm confused about what happens when, for example you close all of the UE4 Servers that were being ran on that computer server. Does the computer server stay on? And you still get billed for that time?
Like do you get charged even though the server isn't currently runnng any UE4 Serrvers?
I think it depends on the provider to be honest, but I wanna say probably yes
I would imagine that you'll always have to have a few servers running anyway, otherwise players won't be able to find any games.
I think Gamelift has some auto-scaling system where it spools up new instances as existing ones get full, but I don't know much more than that.
It just bothers me that even though there are no ue4 servers running you are still being charged for the ACTUAL server that isn't running any UE4 servers. Is this just a widely accepted reality or something?
Is there any way to see what the simulated ping is?
Yep, accepted reality. You will always need some servers running anyway
Even if nobody is playing.
The bill probalby won't be as much though if it's not using as much CPU though right?
on basic server offers, you pay for a specific config, so yes you pay the same even if it's idle.
Amazon, Azure etc have offers with automatic scale for games, don't know how it works / how much it costs though
Yeah you just pay for a server spec AFAIK, and it's running all the time. They don't bill you based on how much the machine is being used because that's still a machine and/or a bunch of resources they set aside for you either way.
(Playfab, Gamelift...)
I think all of those automatic scaling things you have to manually do some scripting/interfacing with UE4 to get them fully working anyway.
However some are billed on the hour and monthly, meaning there is a maximum, but if you are careful about when you shut down the server, it will cost you less
Also this is why dedicated servers for indie games are overkill
If you must have them, pay to host a few official servers then use a third-party service to let players "rent" them
That seems to have worked out well for us
intresting
which third party do you recommend for this kind of stuff?
Well we're using G-Portal and Nitrado. I've not had much to do with dealing with them directly, but the process seems pretty straightforward
good to know, thanks ๐
I think tbh it depends on your community as well, some cost more than others etc.
Unfortunately a 100 player game needs beefy servers ๐ฆ
sure
anyone know much about Agones? I started looking at it a little.
i still am kind of confused on what it's for but it looks kind of important
Is there a way to extend FClientAdjustment and put additional info about the state of the character that the server sends back? What is the recommended way of doing this, and is there any guide that covers this?
In my case, resetting the position and moventmode of the character isn't enough, I also need to know the state relevant to climbing etc so that I can resimulate from the correct state
Don't think so. you'll need to create your own Server network data type, and override SendClientAdjustment to call some custom RPC's instead of the existing ones
@timid moss Basically here is my opinion as a commercial indie : designing your game so that it never needs dedicated server, removes an immense amount of work to be done, and avoids costs that could possibly end up larger than the game revenue at some point in its lifetime. Specifically when it sells only a few copies every week buyt some players keep playing. Building instead a cooperative game, where you can simply play with friends without a dedicated server, is a much more reliable way.
@chrome bay I see. Seems doable, thanks
@bitter oriole I can see that. but going the method of a listening server doesn't seam secure when using a database to store player stats/progression. because if the player is the server it leaves room for potential database exploits since the server read/writes to the database right? It makes it easier for them to basically modify their player level/stats.
u can manage data with coud functions
If you have a single centralized server for all player stats, then yes, you need dedicated servers to talk to that server
The point I'm making is that this kind of game design is not practical for indies
Singleplayer, or coop multiplayer games, are way, way less dangerous
(Technically and financially)
How do you manage Player discoveries NAT punch through etc with listening servers?
a database cost basically nothing tho
does Steam handle that for you?
Yes, Steam handles that stuff
cool, good to know
cloud functions can also handle a lot, so u wont need to have a server up 24/7
The database server isn't the tricky part, really. The tricky part is dedicated servers.
Database server that clients can write to is... not a great design
Unless all of the database data is easy to check for fraud, of course. Some games work well for that.
the database would need to be exposed through a REST or GraphQL like API to be accessed by a client securely
(on the server side, can be achieved relativly quickly with hasura.io and the likes)
It's still not going to be very secure if you have no way to verify the gameplay
The technology is not the issue here
yes indeed
If you market your game and hype it up correctly you could get patrons to help support the servers if your going dedicated server route.
i feel l ike thats a possibility
Yes, it is. But think clearly about the likely sales of your game
Do a min sales, max sales estimate
Calculate your costs over a year
And do the math
I just really like the idea of games with large player count. and that's really only possible with dedicated server since it doesn't render stuff. So thats kind of my inspiration
Of course the problem with large player counts is that you need large sales
very true
If you sell say 1,000 copies at $20 on Steam, which is quite nice, you'll make $10k before tax, and you'll have between 10 and 50 online players, so only a few dedicated server instances to pay for during ~2 years. Calculate the cost of that, and see it if works out. It probably does. Do it for if you sell 10 copies, too.
Basically check that GamePrice / 2 is very much larger than InstanceCostPerHour * 24 * 365 / PlayerCountPerMap
wait a minute. is there any indie out there trying to make dedicated server game ? lol
warframe manages to do authoritative rewards with the game itself being hosted on the players computer somehow
All of them for some reason.
I'm not sure exactly what they do
@hazy siren It's possible that a spectating client connects to the game to check what happens. AFAIK, Destiny does the same, with no dedicated servers other than to serve this kind of authoritative stuff.
It's definitely much harder
they do something to verify the gameplay but it's not live
you can start a game, disconnect your internet, play the entire mission, complete it, then re-activate your internet and receive your rewards
and because the rewards includes drops you have to physically run over there's some level of trusting the hosting player
a few years ago there was some issue with people being able to send forged messages and claim stuff without actually playing but it doesn't seem to happen at any noticeable scale now, I've always been a little curious about what they do maybe I'll dig into it
Then they probably upload a replay of sorts
it's really forgiving on the time, too, I had my internet go out mid game once, it stayed out for a couple hours and when it came back on it completed normally
and yet theres a robust player economy without any of the signs that people are able to just magic up loot
I'm trying to wrap my head around the NetworkPrediction plugin, so far I've implemented my own basic simulation/movecomponent based on the flyingmovement, it's working fine but the "RepProxy_Simulated.bAllowSimulatedExtrapolation" flag seems to be producing weird behaviours for remote pawn. Either I turn extrapolation on and my movement keeps on going for a long time (like 0.5s) before teleporting back to it's final destination, or I turn it off and I see a lot of acceleration/deceleration during movements. Is there a good way to reduce those ? Would you recommend turning the flag on or off ?
guys how you write pickup for a fast peace FPS game ?
do I need to apply the pick up locally or just send an rpc to server and wait for result ?
has anyone gotten steam to work with gamelift?
i get incompatible_net_id warning when a client that uses steam to connect to a gamelift server. but i dont know if gamelift can host a game with steam enable
@bitter oriole or do it Conan Exiles way, where they bundle dedicated server with game and when you want to play coop it simply run the instance of server locally ? (;
i found that making game to use listen servers extremly painful compared to dedicated/standalone
you get issues of both, for no quantifiable benefit at least for me.
Is there a ticks per second counter for dedicated servers? Looking for the variable.
running a dedicated server locally will double your memory usage
and increase cpu load
is there any article , document , .. to show the usage of net dormancy ?
won't be noticeable if you have enough cores and RAM
Reliable (TCP) are assessed in the order they are sent right? ๐
@eternal anchor IMHO listen server is way easier than dedicated. Players launch the game, can seamlessly join or be joined by a friend, no setup of any kind required ; and for developers it's literally zero effort.
@final thicket Reliable is not using TCP AFAIK
But yes order should be maintained
Oh, what protocol is it using?
That's really interesting, so they just added the functionality in engine
@bitter oriole it can get tricky keeping the game thread on listen server down to acceptable time
Compared to running a full dedicated server on the same machine ? please
it does do everything clients and server do on a single gamethread
3 years in, it accumulates
But then your dedicated server still needs to run the entire server code for every player, which will dwarf the client game code
compared to running all server code for every player + additional 7-8ms to run client code
in that aspect, at least, dedis are easier
๐ค
probably the only aspect in which its easier to do dedi then listen though
what if the map is so big and listen server cant load that much graphical assets ?
but not mesh and texures
Textures are stream based on the client so that won't change anything, listen or not
Unseen graphical assets are not very expensive no?
Doesn't dedicated server only load hitbox's as well?
complex trace would fail with only hitboxes
The difference is null on GPU
if its listen server I cant load the map practically by level streaming ?
Only for CCD?
No, anywhere
Really seems wasteful
No, it's required
To load the mesh's without collisions?
dedi could get away with not loading textures though
huuum you solved one of my future problems ๐ I wanned a listen server open world ๐
well, if you're running both on same machine, you wouldn't end up loading the textures twice
since 2 unreal processes don't share resources
As to CPU - Let's assume your 5 players all need 3ms on server, and the client needs 8ms - then you just lost 60fps alright, down to 40fps. Separate dedi instance would fit just right for 60fps. But then again, the dedicated server alone was 15ms on game thread to start with, very close to not running 60fps either...
So yeah, it is a possible optimization
At the cost of much worse user experience imho
As in, sure, people will do it - but the barrier of entry makes it less likely
you don't need full mesh
just collision data
either way I have unfortunete pleasure of working on listen server now
and from development point of view
NEVER AGAN
AGAIN*
won't touch it wil mile long stick
can't logically split behavior
Split how ?
with client-server model I can assume somet things run on either but never on both, for example server will always handle loading player data
on listen server well not that obvious who should have authority about it
I really don't see the issue here. The host has authority, so you just send all the data there, handle the spawning there just like a regular dedicated
In my game the client save data is RPC'd to the server on login, the host spawn assets for the new client, and that's it
I don't see how different it would be for a dedi
... okay ? That doesn't sound like "NEVER AGAIN" stuff to me
Compared to say, having to work from engine source, shipping two different executables, etc
well for me it is way easier
compile in few minutes
deploy and run
and I have server and two exactly the same clients without client + server in one executable
๐คทโโ๏ธ vs nothing to compile at all
Anyway, perspectives I guess
I did both for a few years and imho listen is incredibly easier
unimaginable for me, there is always some creeping gameplay issue behind corner -;-
or maybe
i just have way more experience creating dedicated servers
The only additional listen-specific behaviour I see in my game is needing to smooth movement on the server when client input runs at a much lower framerate
But I'm skeptical as to whether the dedi could work without
Plus it's literally 10 lines
how do I draw debug NetCullDistance ?
all my stuff works with both listen server and dedicated, it doesn't really seem any more complex than not
sure there is a few extra branches here and there but that's not a major problem
So I hide bones on my zombies such as arms and legs, for my dismemberment system. It works but If I shoot a shotgun into a horde of zombies it's just too much to handle and clients desync for a few seconds. What's the proper way and place to handle this system? In the zombie blueprint I simply check for the closest bone to where he was just shot and then hide it if it's not already hidden. It's all ran on a OnServer event. As you can see in the graph, It spikes really high when I shoot into the horde of zombies. It's just too much for the network to handle.
https://i.gyazo.com/02a21e1a1476a2a0b72343279275321d.png
Hmmm Ok so I accidentally had "Reliable" checked for the RunOnServer event. When I unchecked it the game doesn't seem to desync/lag now. https://i.gyazo.com/c08bb1a6ae2c0385b174ca2def837ae9.png
If anyone out there with more experience can tell me if the second graph is acceptable I would greatly appreciate it. ๐
reliable RPC are limited per frame
once you hit limit it blockes other packets until reliable RPCs are processed
If you drop reliables you get kicked instantly IIRC
hey guys, just a quick question. I'm setting up a points system for my game and I wanted to know if simply setting the player's points variable to replicated could prevent cheaters
It won't prevent cheats no
where and how should I store it then?
preventing cheats mean architecting the game in such a way where the server is authoritative over the state of the game.
Whether a variable is replicated or not isn't really in the same vein
Preventing cheats require a complex balance of client-side anticheat measures, server-side validation and authority over data, and reporting & banning systems.
Imagine that all data you get from the client is complete nonsense, and have the server deal with it.
by preventing cheaters, I just meant preventing them from changing that one variable
You can't stop cheaters changing a value on their local machine
totally impossible
What you do is just make sure that if the client ever tells that value to the Server, the Server doesn't blindly accept it.
You can't prevent cheaters from doing absolutely anything on their local machine, if we're being real
Yeah exactly
Cheaters cheat by changing things on the server too
let's say I have an array of player's points in the game state. If a player kills another player, the server detects that the killed player is dead and retrieves a reference to the killer. if the server then changes the point value in the array (at the killer's index) would that work to prevent someone from just changing their points client side?
Yep. The trick is to make sure it only ever affects them, and not the server nor anyone else
I mean changing it on client side and then that gets put on the server
I am fully aware that people can change anything clientside
You can't change any server-side values unless you're sending RPC's to it asking it to do so
So everything the client does should be validated
How you handle that is entirely up to the game
Clients do not have the authority to change GameState
Or server-side data
Clients can only call RPCs
So secure that and you'll be fine
a quick example, lets use health. lets set health to replicate. since we know we dont want a player to be able to change their health (like with a memory editor like cheat engine) we know that the server must have authority over our health. this means we should only change our health from the server. so lets say our health is at 10 and we open cheat engine to change it to 100. the client that did this will see their health as 100 until the server changes their health value (for example if we got shot) in which case their health gets set back to what its suppose to be which would be a value less than 10. the client can alter the value all he likes but the server has authority over it. just a quick example
someone correct me if i made a mistake
Think of the client as toddlers asking an adult to do something for them.
The adult says yes or no, and if it has to say no too many times, it boots the little shit.
one more question, is there a way to know on a client (specifically inside the playercontroller) when it has joined a session?
oh wait I guess beginPlay does that in a way
@cerulean escarp there is on post login in the game mode.
oh that works even better, thank you!
Does anyone know if there is an event that triggers when PlayerState is created in multiplayer?
Right now I have a UI widget created on PlayerController::BeginPlay(), and it tries to pull information from PlayerState, but the PlayerState is coming back null initially
@analog rover Both the PlayerController and the Pawn classes have an OnRep_PlayerState function as their PlayerState properties are Replicated.
That would be a safe time to access the PlayerState.
@fossil spoke will that get replicated on the initial creation of the PlayerState?
Yes
Will it also happen for the player running the server? (In the case of a listen server)
Most likely, the Server should also be calling OnRep_PlayerState itself i assume. Would have to check the code.
Great! Thanks for the help!
The Server doesn't call OnRep_PlayerState itself, In C++ you have to manually call OnReps on the Server and AFAIK none of the game framework does that.
But yeah, OnRep_PlayerState() will be called on clients when the player state pointer changes (not when the properties of said playerstate change though)
Hi everyone, I'm using a SpectatorPawn, I was sure that it worked out of the box with networking, however I'm not so sure anymore as if I play as standalone editor + dedicated server, I can't make it move, as if the server was overriding my inputs
or at least something strange is happening, as even by sending my local transform to the server with a RPC, nothing happen.
(it's a child spectatorpawn so not handled as a "spectator")
ok it seems to be a bug with VR being involved in the mix.
if I destroy replicated actors on server, will the server take net relevancy into account or it just destroys the actor even if they aren't in the net cull distance ?
if they are spawned at runtime, they won't even exist unless they were in net relevancy range
on clients
client doesn't keep out of data actor around, it destroys it when its not relevant
not sure for actors loaded from the package and explicitly destroying them while out of range
wait. client destroys the replicated actor if its outside of relevancy ? why ! I don't want that
it spawns it again when it enters the relevancy range again
then I have to change my whole design. is there any reason that client destroys the actor ? doesn't make sense for me
btw my pawn has references to actors that are outside of relevancy ! so they become null ?
๐ฐ
you should override the IsNetRelevantFor then
to keep them alive if they happen to be referenced by the pawn
Yeah the client will destroy them if they aren't relevant anymore, that's pretty much the whole point of relevancy.
You'll also receive it if the actor goes out of relevancy range and comes back again, or if the actor "wakes" from dormancy
Is there any way to simulate a large-scale multiplayer battle and how player numbers would affect ping/performance without hosting a stress test with real players?
I have a game idea but it hinges on having decent performance at around 100 players per server, so I want to be able to test out things as I keep developing the game, and at each step of the way make sure what I implement doesn't tank network performance
run 100 clients on cloud servers
Yeah that's what I imagine would have to be done too :/
Wonder if there's a service that offers that
A service that would run your UE4 game clients, have them connect in some automated way to your game server everytime you update the game ?
This is going to have to be part of your company's continuous integration setup
Yeah, it would be rather tricky to get the clients on the cloud updated each time you'd make a change, so a SaaS for that would probably not work.
Guess the only choice is to get 20 computers to run 5 clients each. :/
100 players per level is dumb anyway
yeah, if the game requires 100 players to work, you better have fortnite-level marketing to ensure there are enough players for matchmaking to not take 3 hours...
Reminder than less than 5% of all Steam games ever reach 100 online players
Reminder than 100 online players usually mean 10,000 launch sales at least
That doesn't make it "dumb".
You don't think it's dumb to bank your entire game on being a breakthrough hit ?
Launched 100 player game (continues to be relatively successful)
Would absolutely never do it again
Without a good size team, QA, a publisher and somebody else's money, forget about it.
I mean if you're doing it for fun good for you, but don't remortage your house for it, that's all.
somebody else's money
๐
Maybe "dumb" is a bit agressive - I'm not saying people trying something are being stupid. What I mean to say is - any mistake instantly kills such a game, and it's going to be a high investment effort.
I know that getting 100 concurrent players in matches tends to be an issue and that dead indie multiplayer games are common.
It's not 2003 any more where all players in the world either played Q3, UT2k3, Tribes or CS 1.6 ๐
Being free to play and with fornitesy graphics ought to help a bit though hopefully.
But yeah, I think having "100 player servers" as a marketing thing can be a good thing though. With survival games and battle royales, you're kind of expected to be able to reach those numbers at this point
Even if realistically people would just play with up to say 20 players on a server, just the fact that it could reach 100 is a selling point
Does anyone know why i can't join a session through steam? I have two different steam accounts but no matter how much i click on the server i have hosted, i can't join it!
I have set everything in the ini file and in the .build files. I am also using the advanced Sessions plugin
Are you testing from two different machines? Or a vm?
two different machines. On different networks
What is the error that join session is giving you?
though one of them is mobile data. It doesn't give me any but when i try it locally without steam it does work
but if steam was working i wouldn't be able to find any servers, which means steam is set correctly, no?
So there is nothing in your logs after clicking join?
It will be under Saved/Logs
that seems to be the log in the engine i am referring to a build version
Saved/Logs
Is this a shipping build?
Did you distribute it via steam?
Or just packaged and copied the directory over?
i selected development as i always do and no i had to upload it to google drive and then send it over to my friend!
what should i be looking for? Errors?
yeah any warnings or errors around the session joining
You probably want to log everything that happens, on both sides. Add logs everywhere in your code, and then you can read them
i get a lot of these
LogOnlineSession: Warning: STEAM: Unknown or unsupported data type from Steam key data type 04109775241103101258
I googled it and it has to do with dedicated servers where mine is not a dedicated server. Host is the player
does UE4 sort replication of actors by distance ?
given the assumption I have 1000 relevant actors all with the same config and a changed property. how are they replicated ?
@zinc garden if a game is advertised with "up to 100 player battles" and most players go and only see 15 people online you get a lot of negative reviews saying "no actual players". self destruct mode initiated.
since inventory is mainly in UMG, do u need to secure that?
UI in general should not have anything to do with multiplayer
Use an actor or a component for the inventory data, and show what's locally on the client in UI
@rose egret Look up Replication Graph
complicated ๐
There's a relevancy and dormancy system as well
are root scene component's properties replicated by default ?
up to how much of a ping do you guys usually test your movement replication?
Just a quick question - refresh my memory. ue4 steam stuff does not auto do a nat punch type thing in ue4 as in.. you still need to configure and open ports right?
as far as you r computer firewall and router.
afaik yes i always port forward 7777 and it seems to be good to know. i think steam does it for you though if you go that route
Hi, I have a Character that is replicating, and I want it to send a message to another actor without that replicating. I've tried creating custom events that 'do not replicate' and 'run only on client' but the message is still always replicated to all clients. Does anyone know of a way around this?
(i'm using blueprints)
how do I make games with local/online multiplayer work
@royal abyss that is very broad. Much like asking how do I make game
hold on
So it's mainly Local mutliplayer that i'm confused on
How do I make it look good? Do I just do the traditional 4 player split screen
Has anyone here worked on a custom OnlineSubsystem or net driver in UE? Docs from Epic are pretty thin, so been reading through the code.
^would like to gather info on this as well
Thinking about ways to setup a distributed server architecture. I do IaaS/PaaS and low-level networking for a living, that part's easy for me, but trying to figure out a decent strategy for steering clients on the UE side
I see the Steam net driver is basically a pretend socket driver that just uses the Steam relay tunnels underneath
That might be overkill for what I have in mind though. I think distributed servers/client steering can work with just orchestrating the client/server session management
Since servers don't talk to each other or know about each other, I'm just thinking something along the lines of overlapping transition area between two maps on two servers, client connects to second server when approaching, streams in new map, starts replicating to new server in parallel, unload old map after passing through area, disconnect from first server
Origin rebasing and world positions in theory wouldn't be a concern until the authority handoff
This is very similar to how Destiny handles changing zones.
Another option is a session proxy that all clients go through, that handles the server session handshakes, and can multiplex to multiple servers, so clients don't know they've changed servers, just maps/origins
A reference for the server session protocol would be handy there :P
oops wrong channel
looking for a little guidance here on where to get started. im familiar with the online subsystem with creating/find/joining sessions as well as through steam. im trying to have it so a player can host their own listen server (outside of steam, just on their own) and have others be able to find the session hosted. im trying to figure out how people generally go about this with UE, are they creating their own online subsystem? are they modifying the NULL subsystem? i understand that i need to create a master server to have the servers advertise themselves which i can probably do without to much trouble, but what im not quite sure on is what the general way is that people go about creating these sessions to advertise on their master server
The default online subsystem doesn't provide any matchmaking capability, so you'll have to provide your own. The Online Subsystem provides the basic building blocks necessary to match players up to active sessions. It does not provide any specific type of matchmaking built-in with the base implementation. However, implementations on platforms that provide matchmaking services do expose access to those services. from https://docs.unrealengine.com/en-US/Programming/Online/SessionInterface/#matchmaking-findingsessions
So you could run a web service that provides a list of ip/port combos
And query it in your custom subsystem
never actually saw that page, reading now. thank you
It's also possible it will pickup LAN servers automatically, if you enable the option
@spring ingot thank you but im not using blueprint or hosting via steam as i already know how to do all of that. what im trying to do is setup a master server (probably using asp.net as thats what i used before to create a simple web api for my client applications) and when a player tries to host a listen server from in the game have it advertise the server on my master server so that other players can find it, pull info necessary info from it, and connect to it.
Sure. So then yeah, you could use simple HTTP verbs to POST/DELETE servers from the list, and have the clients GET to find ip/port combos
the part im confused on is where/how do people normally implement this functionality inside of their game. thats why i was wondering if people make their own online subsystem or modify the null subsystem and that sort of thing
https://docs.unrealengine.com/en-US/API/Runtime/Engine/GameFramework/AGameSession/index.html is full of the virtual functions you can override in a derived class, and includes RegisterServer() for example
https://docs.unrealengine.com/en-US/API/Runtime/Engine/GameFramework/AGameModeBase/index.html has a reference to a GameSession
So you can make a custom session and add in your functionality, and tie it to your game mode
That looks like the way it's intended to be customized
yep literally just found this and it started to piece it together XD
While the session interface performs all of the session handling, the game doesn't generally interact directly with it. Instead, the Game Session, AGameSession, acts as a game-specific wrapper around the session interface and the game code makes calls to it when it needs to interact with the session. The game session is created and owned by the game mode, AGameModeBase, and also only exists on the server when running an online game.
thats good to know
I'm making a dismemberment system similiar to call of duty zombies. The only part I'm not sure about is the spawning of the dismembered limb. Should I spawn it on server? Or is that too much? From my calculations it "could" possibly have to spawn 100 limbs at one time if a player somehow managed to shoot a horde of zombies and blast each of their limbs off. Ideas? I just want it optimized
well what in the world could the player be shooting in order to it detach 100 limbs? is this a dedi server?
It's a listen server. So here's the worst case scenario. A player gathers up a horde of 25 zombies (which is the max I allow). Then he gets an upgraded shotgun that shoots 8 pellets aka linetraces, and the shotgun has penetration. So he unloads the full auto shotgun into the horde of zombies and manages to dismember all of the limbs for each zombie in the horde. That would overload the network ๐ฆ How can I spawn the limbs but not replicate it? Is that possible. It's not a necessary thing for gameplay, it just looks cool
what about replicating the event and spawning them on the client instead? such as create a struct containing a reference to the zombie and an array of limbs to be dismembered, figure out what zombies and what limbs need to be dismembered from the line traces, send that info over the network and have the clients do all of the spawning/dismembering?
Hmmm So I'm still confused. So this is the way I've got it so far, The player shoots the linetrace, the linetrace calls the "was hit interface". The zombie recieves the was hit interface which let the zombie know where he was shot and who shot him. Then the zombie dismembers himself accordingly and give the person points.
need the source version of UE4, need visual studio installed. must create a c++ class (just an empty class as there doesnt need to be any code in it) and compile it with visual studio. from there you need to do other settings but theres a full tutorial on it on youtube with blueprint
@twin juniper what are we calling an online game - how many players, 2-10, 10-30, 30-100, or more than 100?
2-10 you can do with blueprints
You're likely gonna have to touch on a bit C++ for something like that, but it sounds do-able in just the blueprints for most of the work
@ocean geyser So since my linetrace is runOnServer the zombie does his dismembering onServer as well so I just simply set a few OnRep boolean variables such as "hasHead?", "hasLeftLeg?" etc. and hide the bones in the OnRep for clients. I just can't figure out how to do the spawning of the limbs like you said. It makes sense to let clients do their own spawning I just don't know how to get off of the Server event i'm on and
make every client spawn a limb
I don't think so
4 players is very manageable
UE is written in C++ and you'll encounter it for anything non-trivial
You can do most things with blueprints
heres an example on how i create/join/find sessions and it works with steam as well, contains the .h and .cpp for the game instance
It won't give you same performance as C++, but it can get close enough if we're talking about a 4 player game
@cedar finch create the struct containing the reference to the zombie and an array of bones to dismember. create an OnRep array of that struct. on the server when the line trace hits the zombies and such have it fill that array with the required info. in the onrep have it loop through that array and do what it needs to to dismember the bones and such for each hit zombie
I don't want the limbs to spawn later though. The OnRep is more for a state of something and spawning the limbs that go flying off is just an aesthetic one time feature. If I spawn them in the OnRep then a player that's not network relevant that becomes network relevant would see tons of limbs start spawning all over the place lol.
multicast and pass in that array then for a one time event
So doing that should only use one multicast RPC and then spawn the limbs locally for each client correct? Instead of 100 RPC's right?
pretty much since your just spawning everything on the client instead of the server. when you spawn them for the host you will want to figure out how to make it so that the limbs dont spawn on the connected clients (only spawn them for the host)
Thanks Cody ๐ I'll give it a try.
Anyone know why today my netprofiler is not creating files? It worked yesterday but today when I enter the console command "netprofile enable" and "netprofile disable" nothing is created. ๐ฆ I only have files from 4/9/2020 and nothing from today ๐ฆ
Hahahahaha whoops
But foreal why is it not working? I tried restarting ue4 and everything ๐ฆ
no idea :/
Wait.............
It moved them to the top because of the naming convention
4/10 gets put to the top of the list so I have a bunch of 4/4, 4/5, --->> 4/9 then I couldn't figure out where 4/10 was. Turns out it was at the very top. ๐คฆโโ๏ธ
@meager spade Do you know what number I should never get close to or exceed on this graph? https://i.gyazo.com/884a658d16deab2013a414d5642773a3.png
I have a question my second player don't load the server level do you know where that can be from ? https://youtu.be/1ao3-lTrteI
hey guys, I'm using AdvancedSessions in my game and I'm having an issue where when I press the "refresh" button to find sessions it can never find my server (this only happens on packaged builds). I am running the server on an AWS server. I am able to connect to it if I type open <ipaddress> into the console. I don't have this problem when running a dedicated server through PIE. I am also running the server with -nosteam, and I do not have steam open when attempting to connect on my computer. any ideas?
@spring ingot question, i made a small webapi to test with and in UE when you create the server and travel to the new map i have the gamemode call a custom function i made called Register, that function sends a few things to the webapi (server name, max players, and test ip 127.0.0.1) and i was able to retrieve it just fine. my question is what information should be send as connection info? should i go the route of sending the ip address of the server to the webapi so clients connect to that?
I'd think so. Not sure how else you intend to get clients to connect if not. Other than custom DNS or some kind of proxying, that is
figured, wasnt sure if there was something special but i figured id check. thank you
Nah, if it's internet connections, that's how you'll have to do it
nothing more annoying than having to fix desynch bugs
https://gyazo.com/e7c57e463dc1a07ee99cef3caf7459bc
Anyone have a idea why replication on the clients are so buggy?
Can someone lead me to a video or something that could help me with lowering another clients "health" variable using the server? i tried everything and im so lost, how do you even reference someone you hit? you can only cast to a blueprint but that blueprint is the one ALL clients use.
Not every actor exists on all players. And a reference is always based on where you are right now.
Usually you want to go to the server already when the player executes input. E.g. via a server rpc.
@weak dawn looks like they don't like that floor? Does that happen on other surfaces too.
What do you mean not all actors exist on all players? @thin stratus
Yeah
@tall pine you can check things like "HasBegunPlay" if that helps
No, only the elevator surface bugs out. I'm new to all the replication events but it works fine on the server...
That could be because the server owns the actor or something.
@swift cargo Well you wrote that the actor you reference and then cast to is the one all clients use. That's maybe true, but things like PlayerController or GameMode have special rules. They don't exists on all players equally. Server and Clients have each their own bubble with actor instances. Some replicated some not. Did you read the compendium that is attached to this channel?
@weak dawn looks more like they are fighting over falling/walking
The surface might be slightly lower on the client
Client says he is falling, then server corrects him back upwards
Then he says he's falling again
Yeah....
Make sure the elevator surface is in sync
It's odd because some times it works fine
I feel stepped on for even asking. why am I here?
@thin stratus Could it be the method that I'm using that could effect the clients?
I simply asked if you read the compendium. @swift cargo
@weak dawn yeah
That could get out of sync
Yeah, it could. But what would be more effective/safe?
You should try to move the whole actor on server and client and in addition enable replicated movement on it
Still not pretty with higher pings, but we don't really have something for that problem in bps
I haven't read it. I don't know of it.
Then please check the pinned messages of this channel. It should help you getting started
I won't link a heath reducing tutorial. You should be able to find that yourself if it exists. I'm more for learning the basics so you don't need that tutorial.
@thin stratus : so we should still go with replication, but just check to see if we have initialized yet?
Hi, I'm wondering if anyone can help with a hopefully simple question. I'm trying to get objects to highlight if a player looks at them, but currently the objects highlight for ALL players because the player characters are replicated. How can I call a function from a replicated player character, without that message replicating for everyone? I've tried running it through custom events that don't replicate, or only run on server, but these don't work. Any help massively appreciated ๐
@normal jacinth : why would a function on a replicated player would be broadcast to everyone? Unless you're the server and the function is multi-cast, that function call shouldn't be broadcasted to everyone
That was just an assumption of mine; the object is highlighting for everyone, even though the function is not replicating
I've set the object not to replicate either, even though I do need it to
For some reason, this broadcasts to all clients
you can set the breakpoint on the function on one of the client and see why it gets called?
The client that you don't want to see the highlight
I'll look into that; I'm not experienced with debugging in multiplayer
it seems to work fine in PIE, but breaks in Standalone
I've made some progress; if I set the function to 'Run on Owning Client' it doesn't replicate from the client, but it does still replicate if it's from the server
I narrowed the problem down to the first person camera, which is replicating, as it need it to for something else
Any ideas why this isnt working?
When event anydamage is hooked up to a printString it DOES NOT print anything. so i dont know what i did wrong, im hitting just fine.
are APPLYDamage and ANYDamage different functions?
I'm not sure, but that would seem to be where your issue is
try making a custom function
all the tutorials done on multiplayer damage use this format
ApplyDamage is being set on the actor your trace hits, but AnyDamage is being called on the actor that is dealing the damage
so unless you're damaging yourself I wouldn't expect that to print anything
not sure how your project is set up though
Anydamage is called when you take damage from apply damage. so if im shooting another player it triggers THIER "anydamage".
right?
"RAT" is the player, all players use "RAT"
Anything wrong with this? because it dont work... @normal jacinth
does the line trace succeed?
you cant access a node across RPC's

you need to pass that into the RPC
yeah you need to plug the actor that you hit into the custom event
Server Damage should have a input pin Actor
and your function call should take the hit actor
"cant add pins on this type of event node!" @meager spade
why can't you?
i dunno, it just says i cant.
click on the RPC node
in the details panel
click + next to input
select Actor as the type
"Actor Layer"?
the fruck
it takes it now
ok good
It works now, i have no idea how it works so imma go stare for a while.
thanks for your patience and help @meager spade
np
So wait, when im casting to something, im not really acting as that object?
so for example
Rat is a Character, which is based on Pawn, which is based Actor, which is based on Object
you can store Rat in a Object reference, but when you access that Object reference, you can't access any of Rat's functions/properties, cause the engine only knows is as Object. This is what casting does, it tells the engine, this Object is a Rat.
my brain just grew
so that HitResult
stores an Actor
for the reason, you can hit ANY actor
it doesn't care
but you care cause you want to call a function on a specific Actor
so you cast that Actor to Rat, so you can access its stuff.
if that Actor was NOT a Rat, the cast will fail.
I see.
also with regards to your bp above
when you call a RPC
it runs on a different copy of that blueprint
thats why it didn't work
ah
so the Server didn't have that hit result
also, one thing. the hit goes through 1 or 2 times and then ceases.
could be anything :/
yeah without any context, that's like asking me what the colour of your hair is ๐
or if you have hair.. :/
heck
I solved my earlier problem if anyone is interested; I'm replicating the First Person Camera as others need to see your camera's position. So when I call it for line traces, the server was actually using EVERYONE'S camera for that trace. To work around this, I pull the camera's reference from the player's controller, which is unique, so I only get that person's camera and not everyone else's. I'm sure this is messy, but it works.
hi all! dunno if this is the right channel to ask,, but.
When trying to run my level in the editor I get the following "Couldn't spawn player. Failed to find PlayerStart"(dedicated server off). With dedicated server on, it works fine. I have spawn as spectators set to true. But either value there does not seem to matter.
Just to note, I have overridden ChoosePlayerStart in blueprints where I select a PlayerStart based on tags (RedTeam, BlueTeam). I gather all the PlayerStarts into RedTeam/BlueTeam arrays in the BeginPlay event. Can it be that ChoosePlayerStart runs before BeginPlay when I have dedicated server off? Setting any breakpoints does not seem to work.
I think you need to add a delay of about 2-3 seconds after a Begin play, I've seen that in a few tutorials
Goodday Guys ...
Im trying this event on 2 Clients
client 1 : Working normally
client 2 : When its jumping the client 1 Also Jumping
When Client 2 Fire this Event Both Players Effect this
@normal jacinth thanks! I really hate using timing delays though! Feels too unstable when accounting for latency. It seems (using breakpoints) that FindPlayerStart runs before BeginPlay and that probably has something to do with it. Breakpoints in my ConstructionScripts are not hit either
seems that was indeed the case. I managed to fix it in an ugly way by using a one time check on the first FindPlayerStart invocation to populate my PlayerStart arrays
@odd iron I'm no expert on this, but it seems that you are always using Player Index 0 for "launch character" for one. You want to have an input event on each client that invokes an event that runs on the server that launches the correct player based on who invoked it
"Client WallJump" says that it is run on server
Hello
The thing is even if you are using GetPlayerCharacter index 0 in Multiplayer Method the engine automatically will handle the other player's indexes ,,,
about the Wall Jump run on server i've tried all of the replication Options
On the server. Character 0 is the character possessed by PlayerController0, which is the first player controller spawned in the server. On the Client, Character0 is always a reference to the character that that client's Player Controller is possessing.
If you leave your event the same as it is when you posted it, and change that to Character 1, player two's character would launch
but in my other project im using index 0 and i have no problem with replication
I don't know what you're doing differently in your other project, but GetPlayerPawn, GetPlayerController, GetPlayerCharacter, all work differently based on whether it's ran on client or server. Since that event is ran on Server, it will always reference the character possesed by PlayerController0, which the server knows as the first player controller spawned. Which would be player 1.
So in this case how can i the correct index
I'm not sure of the correct way to implement stuff like that. Still learning multiplayer aspects myself. You might be able to use GetCharacter0 from an event ran on the client, and pass that character reference to an event ran on the server, which then uses that reference to launch the character.
oh now i see
on my other project im using the Character_BP for this events thats why its replicating without any issue
in this project im using player controller so im getting reference for character 0 index
thats why
Ah, yeah, much easier to get a reference to self.
yes because its will get a copy from every client
i mean its will get the correct one
I'm not sure of the correct way to implement stuff like that. Still learning multiplayer aspects myself. You might be able to use GetCharacter0 from an event ran on the client, and pass that character reference to an event ran on the server, which then uses that reference to launch the character.
@kindred widget This might work i will give it a try
nope its didnt work Authaer
@odd iron When you are running the game in the editor, one of the clients is usually the server also. You can use the little 'run dedicated server' checkbox in the play settings to make sure no client is also the server
that way all the clients you are testing with will have the same behaviour
Yes that what i'm Doing
Something I found out the hard way myself ๐
I have 2nd game almost done still looking for environmental .. All Replication stuff working finally
But the thing is movement events and its own replication im doing that locally in Character_BP not in Controller
so thats why i have no issue with movement
and thats what i will do
Ok Guys thanks i found the problem i was force setting the Index of Jump function 0 thats why
Guys can anyone help when I try to play game in multiplayer if i move client its movement are not shown in server
is the client set to replicate
How to do so
the actor I mean
open it, I'm assuming your using blueprint, search for replicate and look at the options
If i am not wrong movement component is replicated by default
it is
No, I am using cpp
any custom movement work?
that's weird. I'd close the editor, compile and re-open it and try again just to see if it's one of those things
Done already
Also tried disabling other replicated component
How can i know, which components of game should i replicate?
only one that need it, such as if you have a replicated variable in a component that you want replicated
Weapon swap is working weirdly in client should i replicate it
depends on how you do it. I'd do an onrep event on the weapon variable. when you switch weapons tell the server to change the weapon in hand which will fire the onrep event and change. jn the onrep put your code to change the weapon
Question about replication:
- I follow the Shooter MP example from UE, and I replicate the health state to have OnHit or OnDeath()
- I run into a bug today that the AI on client became irrelevant, and the last state on the server is OnDeath
- As soon as the client becomes relevant again, the state is synced, and we call OnDeath() on the client, before its BeginPlay() get called. This results in a crash
So my question is: what's a good way to address this? Do we check to see if we haven't initialized in OnDeath and don't proceed with the logic?
Or do we only sync the state within a certain amount of time, so that if too long has passed, then I skip the sync?
.45.0
?
sorry! my infant grabbed the keyboard...
ha ha ha he / she wants to learn how to code
he/she should know by now that floats dont have 2 decimal points, teach them early
if I call this on server. what happens to the client RPC in the clients ? would it get null pointer ?
pPawn->ClientPickItem(pItemActor);
pItemActor->Destroy();
Quick question; I'm trying to carry over data (the player character's static mesh) across a server travel command. But it looks like the player controller is deleted and loaded up again, even though the documentation says this should persist. Does anyone know how I can carry across data?
I have a different GameMode in the lobby to the map, which might be why this is happening
@rose egret its a risk that it will be destroyed to early. i would instead create a boolean on the class for pItemActor called ispickedup. to be safe i would make another rpc call to the server after ClientPickItem is finished running to let it know that youve finished doing everything you want to with the item and to go ahead and destroy it
@normal jacinth are you using seamless travel?
yes
im pretty sure the info on the player controller (thats on the server) carries over
or is that failing to carry over for you as well?
yes but the game mode is changing, could that be it?
not sure, try without changing the game mode and test to see?
oh it works if I use game instance ๐
yea, game instance is persistent from the start to end of the game so that will work. idk if it can be replicated from the server so idk how safe it will be to prevent cheating if you have all the data in there (depending on the data)
not fussed on cheating ๐ thanks tho!
is there some way to get world time that is at least roughly equal on server and client ?
the ServerWorldTimeSecondsDelta on game state jitters slightly which makes it a non starter for animation based on it
Hello there, I have a question on how to properly debug network code. I have looked at literally ever pinned item on this channel, read documentation and other stuff but I still don't understand how to actually test if the code I am writing is any good.
There is the profiler, but even if I use that, how do I know if the result is good or bad?
I have yet to find any information for example on the speed at which the server or client for that matter send updates to eachother
@fleet raven there is no proper synched time
i have seen many posts of people trying to get a nice synched value between server/client
but the engine ServerWorldTimeSeconds is just garbage
well I want to make a weapon pickup that spins, and has at least somewhat the same rotation on the server and client
the closest you can get is asking the server for his time, adjust it by ping time / 2
for the closest, its not accurate, but close
but i tend not to bother with visualization things like that
cause its uncommon for people to know that is not spinning the same as someone else
I want to create a multiplayer with the pawn class. How should I do this? Should the client press w and then the server moves the player and replicates the movement or should the client move the player and the server replicates the new transform or what is the best way to do this in Blueprints
Its a lan multiplayer
Does anyone have any recommendations when trying to get cross-play working. My current plan is to use either AWS or SpatialOS to host the backend and session + player data for people to connect to a match and have beacon ports available for people to connect through and get information cross platform in the lobby, perhaps with the UParty class and/or PartyBeacons and then the game session will be instantiated by AWS/SpatialOS with authentication tokens.
Is that a good way in going about it or do people have a different way in going about it? Also, is it possible to do crossplay with a solely Steam dedicated server or nah
hi there friends! trying to figure out the best place, i posted in #blueprint but someone said I should come here but basically we have these zones where you can walk into it and open up UI Widgets and this causes some issues. we're currently just using the ThirdPersonCharacter for this but if multiple players are in the session; they can also get the prompt whilst not being in the zone
show how you setup the overlap event
so basically when player step into the zone i just show a little bit of text letting them know they can buy(while also setting the variable so they can actually buy) and when they leave i just remove it and undo the variable
and then in the player character blueprint we just have the widget that they can pull up to actually buy
and more than obviously i would just like for the player that's actually in the zone to be able to buy
@tawny raven your using GetPlayerCharacter at index 0 for the overlap event, this is causing the event to fire for each client when a player overlaps/stops overlapping. you can drag off of the OtherActor pin and cast it to third person character, then do IsLocallyControlled. if it is then do what you need with the widget
so like this?
and then check if its locally controlled
good
alright so that is for green zone i had, i have another zone which is red and that will just automatically sell and then give another currency from the backend i have in-place. how would I go about having just the person in the zone selling?
try the is locally controlled as well?
same thing
alrighty, i'll get my friend to test it out with me and then report the results back 
sweet, goodluck
thanks a million! it's really appreciated
np
Hey everyone,
i have got an error with the advanced sessions plugin. Advanced sessions plugin won't work for me, i get an error like this any ideas? logOnlineSession: Warning: STEAM: Unknown or unsupported data type from Steam key data mod Stellaris
I have setup everything in the .ini file and the build.cs file
does this occur when just CreateSession fires?
so the session is created correctly?
Yes!
can i see where you try to join the session
the blueprint around where the error occurs
and the error occurs just on the findsession node? for example if you disconnect the OnSuccess exec pin does the same errors show? is it getting any of the values from the server?
well if i remove the pin then the list doesn't get updated and i can't click on the server i want to join so i don't think the error is in the find advanced sessions
so it does infact find the session then?
yes!
alrighty so when testing with my friend most things work great! however, i noticed that when either of us step into the zone it does still pop-up the text even though i do have that. but if we aren't in the zone we can't buy so that's good
should i check if it's locally controlled before or after the cast
All of the sudden, I can only see that method being called on the client. This makes zero sense.
I am not running the dedicated server under the same process
@tawny raven im not sure if AActor has the function IsLocallyControlled on it so thats why i said to do it after the cast, but you can find out easy. it shouldnt matter if its infront of behind the cast
Yet I still get the message output in the PIE output window and not the server window
The method is super complex. Here it is
void ARaevinPlayerController::ServerPrintDebugInventory2_Implementation()
{
UE_LOG(LogTemp, Warning, TEXT("%s() called"), TEXT(__FUNCTION__));
}
I tried with both DebugEditor and Development Editor configuration.
ive had some weird behavior before when i didnt include the validate/implementation in the header, might be worth seeing on the odd chance if thats the cause?
By header, do you mean the metadata specifying WithValidation?
Or do you mean I need to include a .h file
try including it in the .h
@ocean geyser I take it you don't have any idea either? This has been going on for some days and no one seems to know the answer!
no clue, never used advanced sessions before and never had that issue via steam
ok
What is the best way to move a pawn in a lan multiplayer game? Move on client and set transfrom on server to replicate or move directly on the server and replicate?
No luck. I already had the _WithValidation method implemented. I tried moving it to the header file and it still executes the method on the client.
I've tried re-generating the VS files from the uproject and building the project again
still same behavior. I never have run into this problem before. On my other project, I have used a bunch of Server and Client RPC calls..
Maybe I have to delete all intermediates and try again
@oblique mountain its more snappy to move the pawn on the client and then server for replication. if you move the pawn only on the server then you might feel some latency between the movements
okay i did something different than this https://cdn.discordapp.com/attachments/221799385611239424/698658379949670450/unknown.png and just checked if it was locally controlled off the thirdpersoncharacter and it works so nice
thanks again!
@ocean geyser but if I move the pawn on the client and then replicate to the server it is also laggy. Maybe because the server then sets the transform for the client again even if the client moves in the meantime? How can I avoid the laggy movement?
character movement component should already bet setup for this, depending on the style of movement your looking for its worth looking into before writing it yourself
but I'm using a pawn because its a none human player
@ocean geyser I agree with Cody. https://www.udemy.com/share/101DtcB0Aecl9TRXw=/ is a good course to take too - the author goes into building a custom cmc
Udemy is the world's largest destination for online courses. Discover an online course on Udemy.com and start learning a new skill today.
at a basic level
and covers lag and position tolerance / etc.
Deleted my intermediates folder, built the project, and I still am getting the same behavior - the server rpc is only being executed on the client
arg
that makes 0 sense
was talking to him
oh
sorry
I know it does
Maybe me installing Origin / Apex / Wolcen broke the engine since each one of them installed a VC++ Redist?
Granted I have the build config (I have the source build on my machine) pointed at a specific C++ version, so I don't know why that would matter...
Ok
going full nuclear
I deleted the intermediate, derived data, and binaries folder. Regenerated the sln, and now I am doing an actual Build -> Rebuild All
do you have any other server RPC's in that class?
I just created one that is super basic
I'm about to test it
First trying without the WithValidation and then I'll try with it if that doesn't work
same thing without the WithValidation
now trying with the _WithValidation
same deal
Server process doesn't show that method being fired off
The header file:
and the last one, finally, is the cpp file
I'm calling Super from the constructor and in begin play, so I'm not hitting that particular pitfall that devs sometimes run into
oh ffs
It was because I was calling _Implementation
I thought you had to call that within the C++ code anytime there was an _Implementation method generated
ServerPrintTestMessage() lol
otherwise you would hit a never ending loop
that fires the validation, if validation is false it diconnects caller, if true it runs implementation
I guess that is just with NativeImplementedEvent
always call the normal function, not implementation
nah, just call the regular Server function. That will call implementation and validation
its an amazing system...10 out of 10
Well with NativeImplementedEvent or whatever it is, I have always had to call the _Implementation method
otherwise the game will freeze
or yeah..thats differnet
and not unfreeze
You shouldnt be calling _Implementation functions unless you know why you need to, always call the UFUNCTION() declaration function signature.
The Engine will always manage calling the _Implementation and _Validate functions on your behalf.
Ok. Will do in the future. Thanks for all of your help everyone.
Ok, so now the reason why I was trying to do a server call in the first place... maybe someone can help me with my original problem. I'm not quite sure how to describe the issue without using a giant wall of text. I'm going to try though.
I am replicating custom UObjects
This appears to work out just fine with one major catch
Basically, an inventory component, when HasAuthority() == true, will grab a list of these custom objects from the inventory actor.
then the inventory component stores the array of references of these uobjects in its own class, which in turn fires off the OnRep_ methods on the client. I can see the objects in the OnRep methods are populated correctly
UCLASS(BlueprintType)
class RAEVIN_API URaevinInventorySlotSet : public URaevinNetworkObject
{
GENERATED_BODY()
public:
UPROPERTY(VisibleAnywhere, BlueprintReadOnly, Replicated)
int32 SlotNumber = -1;
UPROPERTY(VisibleAnywhere, BlueprintReadOnly, Replicated)
bool IsPrimarySlot = false;
// The column number of the grid in which this set currently belongs
UPROPERTY(VisibleAnywhere, BlueprintReadOnly, Replicated)
int32 ColumnNumber = 0;
// The row number of the grid in which this set currently belongs
UPROPERTY(VisibleAnywhere, BlueprintReadOnly, Replicated)
int32 RowNumber = 0;
UPROPERTY(VisibleAnywhere, BlueprintReadOnly, Replicated)
class URaevinInventorySlot* ItemSlot;
UFUNCTION(BlueprintPure, BlueprintCallable)
bool IsValidItemSlot() const { return (ItemSlot != nullptr && !ItemSlot->IsPendingKill()); }
protected:
private:
public:
void GetLifetimeReplicatedProps(TArray<class FLifetimeProperty>& OutLifetimeProps) const override;
protected:
private:
};
UCLASS(BlueprintType)
class RAEVIN_API URaevinInventorySlot : public URaevinNetworkObject
{
GENERATED_BODY()
public:
UPROPERTY(VisibleAnywhere, BlueprintReadOnly, Replicated)
int32 Quantity = 0;
UPROPERTY(VisibleAnywhere, BlueprintReadOnly, Replicated)
FGuid UniqueItemId;
UPROPERTY(VisibleAnywhere, BlueprintReadOnly, Replicated)
FGuid ItemTypeId;
UPROPERTY(EditAnywhere, BlueprintReadWrite, Replicated)
int32 ColumnIndex;
UPROPERTY(EditAnywhere, BlueprintReadWrite, Replicated)
int32 RowIndex;
UPROPERTY(VisibleAnywhere, BlueprintReadOnly, Replicated)
class URaevinWorldItemDefinition* ItemDefinition;
protected:
private:
UPROPERTY(Replicated)
bool bNeedsDumped = false;
public:
void SetNeedsDumped(bool InNeedsDumped);
UFUNCTION(BlueprintPure, BlueprintCallable)
bool NeedsDumped() const { return bNeedsDumped; }
void GetLifetimeReplicatedProps(TArray<class FLifetimeProperty>& OutLifetimeProps) const override;
protected:
private:
};
Immediately after the OnRep_ methods fire off, I call the client version of DebugPrintInventory method, and the top-level URaevinItemSlotSet is there and valid, the child object ItemSlot property is nullptr
I don't understand
For there to be an X in the grid cell, the ItemSlot property cannot be nullptr
so there you can see (and in debugging I can see) that the item slot prop is not nullptr
Immediately after the OnRep_ is fired off, the client shows all of the child item slots nullptr
If I call the server version of the PrintDebugInventory method, it still shows all of the items are there and valid
So they were not garbage collected...
not on the server anyways
I don't know, that was still a wall of text. Hopefully I didn't melt everyone's brain.
i just skimmed that
but if your inventory is replicating an array of references to replicated actors that were just spawned
there is no guarantee, whatsoever, that those actors will have replicated by the time your inventory array does
@crystal crag
I think I found a much better way to convey my problem
you can replace the Actor in the above statement with any kind of replicated UObject really
let me try it again
side note, its easier to make an UMG widget then to get those logs to print like a table
As shown in that screenshot, the On_Rep method being called on the client, the parent / child object are both valid
this is being replicated from the server to the client
UPROPERTY(ReplicatedUsing = OnRep_InventorySlotsChanged)
So on the client it see the valid objects
how do you know it does?
it just sees the number
doesn't mean the objects are on the client yet
if you spawn an object on the server