#multiplayer
1 messages · Page 681 of 1
Ya it can make the code a bit wacky, I tend to check for things in tick on the client, and when it exists I flip a bool and run some "first time setup" function
Basically a checklist of things that need to exist before doing anything else
yeah, same. But it gets annoying, once things get complex. Our app already is kinda suffering from a mess of initialization order, or was - I am just refactoring large parts of it, and hence want to avoid any more "we need to wait for X Y to initialoze"
Haha been down that road before
can someone help with small issue?
Where are they getting the cursor location from
Before event tick check if the actor is Locally Controlled
In other words, it appears you're making every actor rotate to your controller's settings. Instead of only the ones you control.
Sorry not before event tick but before rotate
im new to multiplayer so replication and all this is so new
I hear ya lol
Its a mind bender
But ya you'll be using that node a lot, making sure things are yours before doing anything.
and would that be similar solution to widgets showing the clients variables or something different
Depending how you have it set up you may want to check if its Your locally controlled actor or the server. So that the server can also rotate and then tell the observing clients that you rotated.
And ya probably
But that means the server needs to be aware of where your cursor is. I cant remember what the default behavior is there
ok
Always think about player-owned actors of having 3 versions. Theres the server's, yours, and observing clients (also called simulated proxy).
Its all one actor but each 3 may interact with it differently
alright thanks for the help
how can i make my get player controller so that all the players make a session or which node do that
When you package your project as Server and then client, how do you execute (Admin) functions on server? do you have to make another "client but with authority" package for the admins?
Hmm, a RepNotify on the client of an object is firing before its begin play. I wouldn't expect that to be possible. Any good recommendations on how to deal with that?
they can be called before beginplay

you could just use a bool to only run the logic once
then either run it at one point or another
I would think a separate client for admins wouldn't be necessary so long as you are somehow authenticating your admins before allowing them to use any commands.
ie. If you have a chat input window in your game, you could require a /adminpassword command that on the server can validate the appropriate password for the server, and only then after entering the right password, allow them to use the admin commands.
Yea but i dont feel thats the safest way, i dont want any of these rpcs be on the client side
It really wouldn't matter - if the server has the RPC available and your admins aren't authenticated, that means someone malicious could be able to potentially spoof the required packets to execute the RPCs to the server anyway.
i'll just make another client for admins, not a game, just an interface with buttons like adding items and other stuff
The rpcs on the server will have checks
I'm thinking to replace CMC with a custom movement component for AI characters, anyone did that before?
In ACharacter afaik CMC drives almost everything including the skeletal mesh pose
My plan is to disable everything related with CMC and override required functions, then bind my own movement component
At that point you can just make a Pawn
Or rather a sub class of that
And implement your own MC on top of that
@peak sentinel
That's what I wanted to do first but the project I'm working on started at 4.23 and we never thought coming this far
So every logic coded inside an ACharacter
I'm trying to get away with this cheap idea 😄
Hm not sure then. I mean you can try but the character and CMC are connected so much it might be a lost battle
I understand, thanks for the input
Not sure if needed. Check UTs rcon code for ways to set this up properly.
You can surround the inner code implementation of the RPC with WITH_SERVER (I think).
That will at least make sure the code doesn't exist on the client
Last time I made a custom MC I had to base it on a pawn. But I understand that you might be too far in the project to do that
how to make a get player controller for every player in the game or which node can do that.
You can either keep track of them yourself by storing them or use GetAllActorsOfClass for this
Just keep in mind that this only makes sense on the server
The Client's controller is GetPlayerController(0)
Or relative to where you are
e.g. GetController in a Pawn on Client Side.
GetOwner in the PlayerState on Client Side.
GetOwner in the PlayerCameraManager.
GetOwningPlayer in a Widget.
But again, Clients can only get their own
You can't get another clients PC
Only the server can
yes but if there are more clients the button for my menu dont work for the other clients
Might need clarification for this. Why do you need all clients to make a session?
not all but if i client want to make that he can make the session
Not sure then. Creating a session with GetPlayerController0 should work to create a session for that machine. Though I don't know how that works while already in a session with other people. Haven't tested that.
Yeah, I need to convert a lot of things to interface to make them communicate with AI system
But where we are currently is a mess anyway
It's just a tradeoff, if disabling CMC is going to be a bigger problem we will just migrate to Pawn
@ancient adder a lot of games they have a database on the server of admin allowed ID's (like steam id, for example), when you login, if your id is on the list, server marks you as admin. When you send any "admin" command in, it verifies your ID against that list before running any functionality
not sure where or how that can not be safe?
hi, i'm wondering how i can ping dedicated players, does anyone have information, I can ping sessions, but I can't ping ip addresses
@lost inlet hello, do you know anything about this
Hm why is MAX_BURST_COUNT_BYTE 63 instead of 64 here? https://jambax.co.uk/better-burst-counters/
63 = 11 1111 -> 6 Bits
64 = 100 0000 -> 7 Bits
Wouldn't 7 bits be 2^7 - 1 = 127 as the max value?
Since a uint8 is 255 as max value, which is 2^8 - 1. So yeah nvm 63 makes sense because you are starting at 0
There is a mistake in the code for that article though
// We may have fired a burst then immediately stopped (e.g, shotgun, semi-auto etc.)
if (BurstCounter.StoppedFiring(PreviousValue))
{
OnBurstStopped();
}
I assume it should be
// We may have fired a burst then immediately stopped (e.g, shotgun, semi-auto etc.)
if (BurstCounter.HasBurstStopped())
{
OnBurstStopped();
}
And another in the net serialize
Ar.SerializeBits(&bIsIncrementing, 1);
Should be
Ar.SerializeBits(&bIsFiring, 1);
Yeah, but you need 7 bits to display 64
where 6 of them are 0
right yeah makes sense
hey i want to make a multiplayer fps game but i couldn't find a tutorial
idk where to get started
i tried looking at the docs but i prefer a video compared to text
I would start with ShooterGame https://docs.unrealengine.com/4.27/en-US/Resources/SampleGames/ShooterGame/
And a udemy course like this if you need video walkthroughs https://www.udemy.com/course/unrealengine-cpp/
where can i change my get player controller for
yes I've seen this, but how is this supposed to help?
like the doc is fine
but it doesn't explain a lot
that's what I did
You can also check the UT source code on GitHub and learn from that
i got confused but understood some part of it
what's UT?
Unreal Tournament
ok
But overall, despite maybe the C++ cource Ethan linked, I'm not sure what other resources are out there
i see
Specifically for multiplayer
how did you guys learn multiplayer?
Try and error
ok
i started unreal about 2 weeks ago
i followed a bunch of tutorials
So you know exactly what all the game framework classes do?
but i don't have any ideas of a game i can make
and i also wanted to make a multiplayer game
but maybe i should do something easier first
Honest truth is that you are jumping a lot of steps
yeah i know
I can't put a number on that. Multiplayer is a whole nother world.
Getting a variabel to replicate or seeing another player is easy. But it soon gets super complicated when you actually try to implement feature.
And there are high chances you create your feature wrong and they only work cause you didn't test outside the editor and what not
It's super important that you are very comfortable with the engine already
I would suggest you try to learn about the Game Framework first
Understand what all the classes are for
Maybe make a singleplayer shooter first
Then try to make it again for multiplayer when you think you understood it all
yeah
Game Framework being things like PlayerController, Pawn, Character, PlayerState, GameMode, GameState
PlayerCameraManager, when does what call, how do they interact, who owns whom
What functions do actors have that you can use to init and react to things
Which classes should hold which variables
How to easily get references, how to connect it all to the UI
Itt akes a bit
ok do you think i should learn C++
Simply said, yeah 1000%
For Singleplayer and for hobby stuff
maybe not
For Multiplayer yes
Blueprints only have a veeeeery small part of multiplayer functions and variables exposed
okay
You will be way more agile when you know c++
I'll start learning c++
What?
I would say you should start learning the Engine with Blueprints
And then go a step further and recreate your singleplayer BP project to c++ step by step
And then recreate it again with multiplayer
Take something small though
i already did that part
Alright
the "get player controller" node where can i change it for or how can i make it so that the index is for all the players
On Client Side, the Index is only meant for local players
On Server Side I have never used that Index
Not sure what you mean with change
I already explained to you how you can get the PlayerController in various scenarios and that you can only get the client one and not the one from other clients.
And that the Server can use the GetAllActorsOfClass node to get all client versions
i dont can choose a local player
If you only have one local player, so no splitscreen multiplayer, then the index 0 is the only you can use for clients
Hey guys, not sure where the best place to ask this but -- I have a game that's single player with multiplayer option. I want to save progress, I think on a server (I have a webserver and DB set up pretty quickly) but I'm not sure if UE offers a more seamless way to accomplish this? I want to save info like, player coins, player xp, etc.
Is it better to save that kind of thing on a server, or just say whatever and do it local?
I got a beacon question.
In a very far fetched hypothetical situation, if my game goes successful enough to have say 20000 concurrent players , then if even 2000 of them browse the servers at the same time each server would be connected to 2000 client beacons! which means 2000 client beacon actors on each server?
that is now how beacons work
hmm, is that how online services figure out the ping for everyone who is browsing server lists?
by pinging every server on the list from the client?
@quick shale If you want the save file to remain with the server files, just save it locally in Unreal save files. This will cause it to save on the server machine when running a server, and locally on the local player's machine when playing single player.
@kindred widget
Thanks for your response!
Do you have a reference of where I can read on this?
The multiplayer is a "round" model (making this up), so players can play rounds and then return to a lobby where they are alone.
A player needs to have a token to play a round, which they can get every hour by default. Right now I'm posting to my webserver to see if time had elapsed, and give them the token if it had. I just wonder if I'm doing more work than I need to...
can unreal servers (dedicated I guess) accomplish this too...? I come from a web-dev background I clearly need to do some reading.
Is it fine to replicate a bunch of data that may not be used (for convenience to have it all in 1 struct) when dealing damage? I started small with simply the damage number and damaging actor but it's now ballooned to have the damaged actor, crits, damage type and other info about each damage taken
I'm not using the UE damage system but I suppose if you did replicate an FPointDamageEvent you'd be replicating way more info than I am now
Seems to be a tradeoff of bandwidth vs code clarity (Having a single struct with some data that won't always be used vs trying to replicate conditional stuff separately)
But if people DO replicate stuff like FPointDamageEvent, there's loads of situational stuff there that wouldn't be needed every time so I am fine
I don't really know any specific documentation on it. But you're basically describing the same way that ARK:SE handles saving and I have a bit of experience hosting servers for it. The game can be played singleplayer, Coop, or it can launch dedicated servers and have clients connect to them. Basically Standalone, ListenServer, and DedicatedServer in UE4 terms .
But in all of these cases it saves in the same manner regardless of which way you play it. The server application is just a slimmed down version of the application basically with no rendering but it's programming still mostly functions the same as if it was launched like the normal game. It just doesn't get a player controller and such. So if it saves to a local file, it's the same as if a player saved their game to a local file, only it happens on whatever machine the server is ran on, and it can be programmed to read from them as well.
In fact this same save manner is how ARK:SE allows it's server transfers. It's why you need to run server applications from the same folders with different command lines to have multiple connected servers, because they read from the same save files. So if a player wants to go from map1 to map2, you load them both up, and then the player's character data is saved to file, and then they're disconnected and they connect to map2, and read from the same save file to recreate the character on the other server.
how?
i now
how can i get my get player controller node for the clients
that playing
i try to get "get all actors of class" but that dont work
GetPlayerControler at index 0
it dont work for my clients i try it out on web
Again, each client can ever only access their own
There is no way to change that
PlayerControllers of other online players are not existing on a Client
Only the Server has them all
And for the Server it will 100% work to use the GetAllActors node
Unless you call it at the wrong point in time
You can't change GetPlayerController to retrieve other player's PCs. It's impossible for Clients
If you need shared information you need to use the PlayerStates
is it easy to run a two player game with split screen on 2 monitors (1 pc)
i try to run it on web and i get black screen when i click on my host button
Is there a logical reason why, if a user changes the dedicated server port & queryport, client is unable to connect? SteamNetDriver.
On default ports it works fine
Server does show up in the server listing, but cannot connect to it
(The ports themselves are also known to work fine, as other games he runs operate just fine on those ports. And the instances using those ports are also closed before testing.)
Having an issue with Advanced Sessions. I can play single player no problem. I can host an advanced session no problem with the packaged game before pushing to steam (though I should add I don’t get the steam overlay). But as soon as I push it to steam and host it running from there, it create the session, travels to the map, and almost immediately closes the session. I do get the steam overlay and my proper game name when running it on steam.
Any ideas?
where can i find the ports
im new with multiplayer
For instance
Listen server, but I was assuming it'd be the same for a dedi
its working but i post it for my self on itch.io and the server dont want to host i get black screen
Hey guys got a weird issue. When i enable use acceleration for paths on the movement component, i can no longer move my clients pawnss using SimpleMoveToLocation. Can anyone explain why this happens?
Sorted it now. If anyone ever comes across this make sure this is checked.
how do you debug and fix rubber banding specifically when using the CharacterMovementcomponent? Is there any tools?
Hello. I put together a quick, simple, multiplayer third person template project to understand how to pass the selected character class into the level that's being hosted. The problem is that the client connects and gets the hosting player's selected class instead. If someone has a chance to look at it and tell me what I'm missing I'd greatly appreciate it.
I have full rez, clear screenshots of every aspect of the project here:
https://imgur.com/a/GRyyi9m
and you can download the project itself here (it's very clean, only the Epic third person content is in the project file):
https://drive.google.com/file/d/1UXP_L9JPg3A6BgQJ7D7Rw217RrMAQG6U/view?usp=sharing
Again, it's very tiny and easy to look at. Hopefully someone can get me pointed in the right direction or add what I'm missing to the project and repost it.
EDIT/UPDATE: Please see a few posts down for the completed working project file (special thanks to Datura for the most excellent help!)
Game Mode only exists on the server (or host). In your game mode you have the below code, which would be reading only the game instance of the server.
In order to communicate the the selected character, the client that selected it would need to send it's selected class through an RPC to the server advising the server what class they want, which should probably be done on the player controller.
Flow should probably go:
(On Server's Game Mode):
Handle Starting New Player > RPC "Run on Client" Reliable Event on "New Player" player controller named something like "Retrieve Selected Character"
"Retrieve Selected Character" on the player controller > Reads selected character from Game Instance > RPC "Run on Server" Reliable Event still on the Player Controller named something like "Send Selected Character", passing through the selected class (for now that's fine, but you may want to consider using an enumerator to lock down the actual class selections)
"Send Selected Character" on the player controller > Can now return to your game mode with the selected character and spawn the actor, etc.
@sinful tree Thank you for the reply. Let me see if I can work that out based on your description.
Well, Datura's idea got me pretty close. I'm still working at trying to get it. Here is the updated PlayGameMode with the run on client call to Retrieve Selected Character in it's StartingNewPlayer as well as the updated PlayPC with the Retrieve Selected Character (owning client - which does load it's character class correctly it appears) and Send Selected Character (which then switches it back to the hosts chracter unfortunately).
If I didn't implement that per @sinful tree recommendation correctly, please let me know.
There is also a screenshot of the output and you can see that it's getting close, but still not working. Any further help is appreciated.
Harlaylooyar! With your help @sinful tree I did finally get it. I ended up using a save game. If you can work out how to do it without a save game, that would be better, but at least I'm beginning to understand the flow of things.
What I ended up doing was splitting out the StartingNewPlayer handler into two pieces. First calling the RetrieveSelectedCharacter owning client event, then I made one called SpawnMe which is the rest of the code after the owning client event call.
Between those events, in the PlayPC player controller, I opened a save game created between the main menu widget and the game instance. Having the server open that from the PlayerController is sending the correct information to the GameMode.
EDIT: Screenshots and link pulled because it turns out it wasn't working even though it was in PIE. Booo! Maybe not working (although in PIE it appears to be).. testing more and investigating Datura's reply.
This is still not right - the server is loading the save game on their end, not on the client, so whatever value is saved on the server is being loaded. You should be able to pass through the class reference on the event by adding an input to the event:
Doh! Okay, I'll edit my last post and give it some more tries using this image you sent
Yup.. it works in the editor 2 standalone in the PIE, but when I packaged it and ran it on 2 PC's the client was blue still. Thanks again for your assistance. It's MUCH appreciated! Now I'm looking at the image you posted and seeing how to work that into it.
YESSSSS!!! but... before I get too carried away with victory, please look at this and tell me if it looks correct. I can tell you that it is working both in PIE for 2 client and 2 standalone as well as on 2 PC's after it's packaged. If you think it looks good, I'll post the project file for reference.
New GameMode and PlayerController event graphs:
https://imgur.com/a/cRMR0FK
Edit: Here is the working (actually properly working) project file for anyone interested or whom it may help:
https://drive.google.com/file/d/1QPp3wpSMnTMPoEq16kdx2Fz-_KULSh5v/view?usp=sharing
Yep, looks good.
Thank you sooooo much!!!!! That was amazing and really helped my understanding of when to call server/owning client and such.
which initiates first gamemode or gamestate?
i try to upload my game to itch.io for my self to test it but if i want to host a session i get black screen
@shrewd tinsel GameMode spawns GameState.
I have a question, if I want to create an event on the Level Blueprint (Ex. Start a cinematic or spawn an enemy when a player touches a trigger) how it should be made? Is the level Blueprint only on server? Only on client?
Each client and the server has an instance of the level blueprint.
So, if I wanted to start a cinematic if a player touches a trigger, it should be executed in all the clients and the server, right?
Every client checks if the same trigger gets overlapped and fire all at the same time, right?
where can i find tutorials for client side prediction and client interpolation
@lusty badger This depends on the level size and relevence. If Client 1 is far away from Client2 and Client2 steps on the trigger, Client1's level blueprint won't know this. Realistically you're best off not doing anything on the clients, no local checks. Server has access to real data, if a player steps on the trigger on the server, it can get the local GameState and multicast a cinematic or something.
Oka, thanks a lot!
@steep abyss does not mean cheating in the slightest
it just means the client and server got out of sync, could be for a number reasons.
Anyone having experience with footstep sounds in multiplayer?
Right now i play the footsteps localy through anim notify
This goes for everything. If it doesn't need to be sync'd - don't do it. Simulate locally.
Does NetUpdateFrequency affect Multicast RPCs?
As in if NetUpdateFrequency = 1.0f; could there be up to an entire second before people see the multicast RPC?
Similar to how it is with OnRep variables
If I replicate an array of pointers to actors, does the server send just the references to clients? E.g I'd need all locations of actors that are perceived by AI (which runs on server) on clients. Is replicating a list of FVector cheaper for net bandwith than replicating pointers to actors?
Yeah you are just replicating 4 bytes per pointer
The client can then get all the other stuff like location locally
thanks!
Replicating an fVector is NOT cheaper to clarify! 🙂
would be 12 bytes just for the location
Thats what I wanted to hear 😄
negative
Nice so they can stay at 1.0f but still be responsively seen?
yep, update frequency only affects property comparisons
Great ty
I'm relatively new to networking so mind my ignorance.
I'm working with a dedicated server and can not get over this small hump. I already have persistence set up.
I'm trying to get usernames and character names displaying to every user. I'm pretty certain that everyone does in fact know eachother's names (based on some print strings), but I can't get an already connected character's name displaying on their widget component to newly connected users.
Currently all I have is this, being called only once all the character's data is retrieved from my external database (not on begin play). https://prnt.sc/22rsjbe
How would I make sure that new connections can see old connections' names on their respective widget components?
Edit: pressed enter too fast. Adding more detail There we go
Does anyone have any documentation on seamless server travel besides spending hours reading the source code to try and figure out the execution process?
Something I've noticed today is how often I've been designing to only send the absolute required data to minimize bandwith consumption but how this actually makes my code a lot more bloated than it should be. For example I often make a struct on the client, and then do something with it like fire a weapon, then I send only the absolute essential parts of the struct up as individual properties to the server, who then recreates the struct and runs the same logic. In the event that the struct only had say an extra pointer (4 bytes) or a quantized vector that wouldn't be used 100% of the time, would you say it's still fine to replicate this kind of info (all in the one struct) to just keep the info in one place and make it much easier to pass the data around?
Say in a 6 player game, even if this redundant data is sent frequently, it's still only 4 bytes a pop which to me feels like it could be completely fine to just include for the sake of convenience / code clarity
So when I refactor it's FAR easier to just pass the struct into server / client / multicast RPCs rather than splitting all the individual properties out, remaking the structs etc.
Get their name locally from their player state
Where would I do this? Begin play?
Whenever you are setting up the widget component when a new player joins
Trying to find a better way to explain my issue -- everyone knows eachother's names, I can get names displaying via print strings perfectly fine.
User A joins the game, then user B joins the game.
User A can see B's name on B's widget component, but B cannot see A's name on A's widget component.
Both A and B can see eachother's names via a print string when they join.
I should mention the logic to initialize names on the widget component happens on Username's RepNotify.
The bloat is something that unfortunately can't be avoided with Unreal out of the box. You'll need custom solutions to address that, whilst working around UHT not having template/macro support.
You could build your own networking utilities on top of Unreal: Have custom serialization and map structs to an enum with a bunch of macros to make you write the least amount of code every time you implement a new RPC. It's not fun, but it's doable.
Yeah that's definitely out of my league from a technical standpoint. I just really wonder how noticeable a few extra bytes per struct really is
Meaning I waste a bit of bandwidth packing some redundant data
But it ends up being practically the same because it's nowhere near saturating the bandwidth?
For example I have disabled replicated movement on projectiles now but need to pack a bit more info into the struct that I'm passing up for each projectile: maybe the extra ~16 bytes of redundant data is actually far lower than the bandwidth required for a replicated projectile?
This isn't true. NetUpdateFrequency does affect unreliable multicast rpcs. But no other rpcs
Ok so in that case a player may wait up to an entire second before seeing the unreliable RPC?
If it's reliable however they'd see it ASAP?
correct, if no other properties are being replicated on that actor then an unreliable multicast rpc would take up to an entire second if you don't use a ForceNetUpdate. (With a NetUpdateFrequency of 1)
Hmm according to UDN all RPC's are sent on the frame they are called :/
But (of course) there's an old answerhub posts that says otherwise..
Worth testing I guess 😄
If you're using the code in the screenshot you provided earlier where you're using a multicast, then that's possibly where it's failing. The Set w/Notify should happen only on the server, no multicast required. When a new person joins a game and the other player's character is loaded, the OnRep will fire and you can have the widgets set up the name to display as you've stated you're already doing.
If that doesn't fix it, posting your OnRep function of your Username variable could help narrow it down.
When trying to show steam avatars in a shipping build, I am getting white squares occasionally on several images. Sometimes, when I load it it is fine
https://www.reddit.com/r/unrealengine/comments/8ngu8l/white_squares_instead_of_steam_player_profile/
2 votes and 2 comments so far on Reddit
There seems to not be an answer to this. When I run it in a non shipping build, it works perfectly. However, I am querying every time. Maybe this is the issue and one is limited by calls to the API in the game?
Ah! Bloody thank you! Will give this a shot tomorrow
This is incorrect.
Unreliable Multicast RPCs are actually queued up and sent out with Property data. Reliable and Unreliable unicast (client/server) RPCs will be sent immediately.
Unless it's changed recently
u probably need to set friction to 0, not sure
i ma trying to call this on the server
if (usingPlayfab)
{
UE_LOG(LogTemp, Warning, TEXT("On init inside"));
PlayfabOnInit();
}
but its being ignored for some reason, that conditional is 100% true
when i play in the editor it gets called
Mar 16, 2021.Knowledge When using Unreal’s replication system, you may find yourself concerned with the performance characteristics of using replicated properties vs. using RPCs, and it can be unclear which option is the best choice for certain situations. This article seeks to provide an in-depth look at using replicated properties vs. RPCs an...
Specific quote from that page:
At this point, if you’re using an unreliable multicast RPC or if we’re forcing the RPC to be queued, that data will be cached off and then sent with replicated property data later anyway. If we’re not queueing, we’ll go ahead and try to send it immediately.
I have a struct set to use RepNotify and it contains an array of Actors of the same type, all the Actors has a float variable called Quantity.
I expected whenever any of the Actor's Quantity value change, the RepNotify for the struct will be fired, but this wasn't the case when I tested.
Is this intended?
Yes
RepNotify fires when the replicated property changes - not when the internal actor pointers change a value.
Ahh crap, do you know a good workaround for this ?
The actors themselves need a rep notify for the property, then you can use delegates to listen for changes in whatever object is storing references to them.
hmmm okay, thanks!
hey guys naïve question on prop replication: if the owner of an actor (i.e. player state) changes the value of a replicated property should the property be replicated from the owner to the server, right? If so, should the server propagate the changes back to the rest of the clients?
@wheat grailReplication is never from clients. As far as Networking goes, Clients can literally do ONE thing. That is a ServerRPC. All replication is Server to Client, and all other RPCs should be called on the server.
You sure? My understanding is that the owner client can replicate a property to the server
Very sure. Replication is always one way.
Roger that. Thanks for the confirmation
There's nothing stopping any client modifying a replicated variable, but it'll just leave them out of sync with the Server
I guess I got misslead by the viewport, I started a listen server and then on the (other viewport, the client) I modify the property and I saw it changing on the outliner
Some people hate it, but I really like Kismet's PrintString for network testing like that. Since it displays which machine it's printing from.
So the "optimal" workflow would be Owner calls UFunc tagged with Server and that fun is the one that modifies the Rep prop?
That's the usual workflow. At least for most things. But this also depends. For instance take for example you have a client authoritive property like a cursor location. Client has authority over this. They set it locally but also RPC it to server. But the replication condition is set to SkipOwner. So the server only replicates it to non owning clients. Mostly the same setup, except that the owning client also sets the value locally before the ServerRPC call.
In other words, Optimal really just depends on what you need to achieve with it.
Cool. Thanks @kindred widget
@grim geode Personally, I would just override OnUnPossess in your controller. Before calling Super, set another pointer to the Character, then possess the vehicle. You can then also use this other pointer to attach the skeletal mesh to the vehicle, etc. Should work easily by just calling possess on the vehicle after that override. Then on vehicle exit, you can just possess the saved character pointer.
Technically you probably don't need to override. You could just set the character and leave it there I suppose.
anyone has any good recommandations for a course on FPS multiplayer. I found this one and want to know if I should get it: https://devaddict.teachable.com/p/multiplayer-fps-inspired-by-cs-go
@amber slateDoesn't look bad for a $25 course. But to be fair there is a plethora of free information online if you're willing to look for it. That also looks blueprint specific, blueprints severely limit your networking capabilities. Workable for a CG:GO clone I suppose.
im not really looking to make a csgo clone
but more of an fps game
and this one looks the best
I couldn't find a lot of info online
that was free
FPS game constitutes a lot of things. There are dozens of arena(CTF, KOTH, DM) shooter tutorials, as well as survival game tutorials online. Most are blueprint friendly because most people aren't willing to learn C++ or are scared of it.
so what would be the best way to learn how to make a online fps game?
is there like a course
or tutorial
How much Unreal or game design experience do you have in general?
I have work in Unity for about 2 years
but decided to switch to Unreal about 1-2 months ago
Did you work through the official quick start?
This is a great start imo.
https://docs.unrealengine.com/4.27/en-US/InteractiveExperiences/Networking/QuickStart/
i tried but I only saw stuff about replication
but there is no tutorial about making stuff like TDM
I'd recommend checking out some youtube channels and the Learn tab. They're terrible about teaching best practice, but they will teach you your way around the engine. After you're semi comfortable with that, you can start focusing on the better practice stuff. And if you're absolutely certain about multiplayer I strongly recommend some C++. Unreal's wrapped C++ is extremely easy to learn. I don't know C#, but it looks relatively similar, might be easy to translate any C# skills you have.
i tried C++ but idk how to remember all the stuff
like there is so much to remember
it's confusing
You don't really remember it. It's like math. You're going to forget it a few times. Do it a couple times. Remember how to look things you forget up, eventually it just sticks like any other knowledge.
I guess it comes down to how you like to learn. I prefer to go through the basics then start experimenting with those.
You might prefer following a more advanced tutorial.
wait
If you wanna make any multiplayer you need to have a thorough understanding of network Ownership and Replication.
I'm sure you'll learn something from it 🤷♀️
ig
is there any tutorials that are useful
because all I see from youtube
is half finished stuff
that only covers basic stuff like shooting and health
Yeah, dunno. I mean I have no intention of making a city builder ever, but I learned the engine from a badly structured city builder tutorial series. Just went through like 23 15-30 minute episodes. Did what they did. Then went back and rewatched all of them, and went through the project I had created for it and paused to look up terminology, etc. It worked for me and was free. 🤷♂️
yeah ig but I can't find any good tutorials online
Major note, curiosity will serve you best in anything tech development related. It doesn't really have to directly pertain to what you want to work on. You'd be surprised how seemingly useless information can fall into place after it's presented a couple different ways.
I dunno. I'd recommend just finding a survival game tutorial series on youtube. Doesn't really need to be multiplayer, but most are. They'll teach you some weapon and inventory handling, basic UI, they should cover at least the basics of data handling, maybe some level design if you're lucky.
Also, having GDC talks on if you're not super busy is nice. 😄
do you have any survival series recommandation?
I found this one and it seems good
Project files : https://www.patreon.com/posts/37703275
I am going to start a new series on how to make a survival game in Unreal engine. This is the first episode. Here, we are going to setup a simple island level to start the survival. A small island where player will begin the game.
Full Survival tutorial series : https://youtube.com/playlist...
what do you think
What prop could serve on the aplayercontroller to test equality over the network and local controllers?
How do you add a hard object pointer to an FArchive?
Or should I be using a SoftObjectPtr
@amber slate Seems to cover a lot of basics. I'd go with it, sure. Shouldn't be a bad start to get acquainted with a lot of systems.
hmm My understanding was that the PlayerControllers are in all instances of the application. However
/** List of all the player controllers in the world. */
TArray<TWeakObjectPtr<class APlayerController> > PlayerControllerList; ```
That only contains the client player controller in the client (but all of them in the server). If that's the case, how can one access to the player state of a simulated pc?
(The code is from UWorld)
PlayerControllers exist only on the server and their owning client. They do not exist on simulated clients.
Normally to get a state, you either go through their Pawn, or Gamestate.
Pawn has a PlayerState getter or pointer. And GameState holds all PlayerStates in the PlayerArray property.
Aghh lost a lot of time due to that. Thanks for the clarification
From Cedric's compendium in the pins. This really helped me to understand what existed where.
In NetSerialize() of a Struct, if I call PackageMap->SerializeObject() on a client, and that object isn't loaded yet, will it load it?
I suppose I could just try it...
Is there a huge difference in doing weapon FX via burst counters with an OnRep int compared to doing a multicast RPC?
Obviously I assume the RPC will be more expensive but I wonder if it's a difference that isn't worth caring about
no idea what "burst counters" is
but i assume its some kinda replicated prop which gets incremented
i don't do that for my weapons, i use replicated paths where possible (for muzzle flashes, etc)
and a single multicast rpc (unreliable) for the shot fx
client always plays its locally
BunchSize=97519, MaximumSize=65536 ```
Is there any way we can increase the size of the array, and can someone help me understand, whats going on.
I have around 40 replicated actors, which has around 1kb of rep notified strings.
so when other users join the server they dont get anything, because they get this error, which means i sending too much data.
Can someone provide me an approach where i can replicate these actors, and also make them as much optimized as possible.
Everything in blueprints for now.
so i was right, yeah i don't do that stuff
the new sample project from Epic will throw shooter game in the trash 😛
what sample project?
how do I learn multiplayer C++? is there any good tutorial?
On the epic docs they say about RPC "1. They must be called from Actors.". However, I have a RPC in a PlayerState being called from an UObject (custom view model) that its outer is a widget which belongs to the PC. Is ownership what they mean? Because it's working just fine :/
https://www.youtube.com/watch?v=JOJP0CvpB8w
This video, the docs and the network compendium are golden resources
An overview of the essential concepts for writing multiplayer game code in Unreal, in under 25
minutes or your money back.
Sample project: https://github.com/awforsythe/Repsi/
Patreon: https://patreon.com/alexforsythe
Twitter: https://twitter.com/alexforsythe
00:00 - Introduction
01:24 - Net Mode
03:33 - Replication System Basics
05:13 - Acto...
In order for RPCs to be called, they require a owner chain that has a NetOwningConnection.
ty
If the Owner is the PlayerController then your all good as the PlayerController is the NetOwningConnection.
@fossil spoke cool thanks. That was my thought but the sentence above made me think I was missing something
??
Anyone know the proper protocol for sending players to different maps?
I wrote a function in C++ that uses the APlayerController::ClientTravelmethod. I've set everything up with seamless travel, using stand alone etc. The player is sent the map but is never spawned there even when I use the handle starting new player event rather than the on post login event.
I feel like I know the issue, since the player in their original map never gets despawned the player controller has a hard time possessing the actor in the different level, but I just cant seem to get this to work in practice.
Any help would be much apricated.
This is what I am using to send and spawn players, the c++ is the server travel function referenced in the blueprint
@gleaming kite Tell the Server to travel. It will cause all Players to travel automatically as well.
You dont have to manage that on your own.
Also as another note, things work perfectly when only having one client connected, presumably due to the original world getting destroyed
But I am trying to get only a certain player to travel
Doesnt work like that
No
Looking at this, i feel like it implies that you can send one player to a new map but keep them on the same server
Not without some serious setup. As the Players you dont want to travel would need to be disconnected from the Server cleanly without initiating their own travel out of the level they are in
Its used internally as part of Server travel to tell the Client to move to the new Map the Server is about to load up.
the traveling is working for me, it sends me to the other level and i can see it, just doesnt spawn me in
Most likely because the Player still thinks its in the Server which means its waiting to be told to spawn 🤷
As i said, its not a usual setup and there are probably many nuanced issues you will encounter.
gotcha, would it just be easier to teleport the server to a level under the map? All im trying to do is send the player to a single player level where they have to escape in time, then they can get back to the multiplayer game
So like the Gulag in CoD?
pretty much, but not multiplayer, you have to escape a monster
Thats a bit trickier.
i mean it can be multiplayer, like the gulag in cod but you fight an ai, if that makes it easier
I honestly dont know how you would solve this off the top of my head.
any resources you could point me towards?
Id say the Gulag is just that, an area under the map which Players are teleported to.
So you could do that
But creating it so that its a single instance per Player isnt easy.
ah really, might run into issues when multiple players try to access the map
While also remaining connected to the Server
hmm yeah, ill try to think of something. If anyone else is reading this in the future, feel free to chime in with your idea.
after thinking about it. Pretty sure the easiest option is the teleport under the map like you said. My gulag type level is procedurally generated anyway so I could easily spawn new instances and expand downwards for each player (theres only going to be a few players). That being said, is there any huge performance obstacles that come with that? Perhaps spawning multiple procedural rooms at a time during the game. Is there a way to do network culling in a way where the "maps" are so far apart that none of the clients actually load the rooms unless they are there?
IF I set an actor with - SetAutonomousProxy(true) on the server does that mean the client owning it can now change the position?
Just wanted to say thank you a lot for your help. You saved me hours and hours. Never got the chance to thank you because I was a little bummed it just wasn’t possible. Anyways thanks again for helping!
Hi guys, question, is there a standard way or a best way to load player data from a database once a client connects to the server? I know how to load the data, but I don't know exactly where I should do it. PostLogin in the gamemode, I can begin loading it all, then sending to client once it's complete, however, the client would load without any data and then all the items/etc. would just suddenly appear. Would it be better to have the client show a loading UI or something then once the data is received, hide the loading UI? Or idk, is there any way to have the client not finish loading the server map until an RPC is called or something idk, halp
We make the Server pull down Client information from an external service after a Player has connected.
The Server then sends an RPC to the Client letting them know that its received their data.
However we setup extra functionality to extend a Loading Screen in order to allow the Server to dictate to the Client when they are allowed to participate in the level.
The Client moves past the Loading Screen once it receives this RPC.
That's what I was thinking, any tips on what class I have to edit to achieve this?
Or is it a whole custom loading screen system
full custom
Got it, thanks
Hey. After enabling the Steam online subsystem, testing with "Number of players" set to 2 in the editor doesn't work anymore, they don't connect. I see this in the console, anyone knows why this could be?
Hmm yeah though in a different game we've made, we can still connect two clients in the editor even if we have enabled the Steam online subsystem
whats your fallback net driver?
Is the FFastArraySerializer beneficial for RPCs, or only for Replicated variables?
I need to replicate a big array but it's a one-time event so RPC seems more fitting.
I can also enable-disable replication but seems a bit hacky
Replicated Vars
If you need to send it via an RPC it makes no difference
It'll send the whole thing in one chunk, unless it overflows for some reason.
I see, makes sense. Thank you! :)
I have an actor that is not owned, its just placed out in the world but I want to have it do things that need to be done on server and it comes up saying that it has no owning connection so the event wont be processed. I know that the server events have to be called from the owning client but how do you get an actor with no owner to do stuff on the server? I set the events to multicast and then I didnt get that message but I have a feeling its not that simple
Is there a quick way for me to have an android phone & an editor client connect to the same map?
Client has one ability to connect with one other machine and that is the server. Clients cannot contact other clients, clients cannot replicate or do any other RPC besides a ServerRPC. To that end. The most common way to handle things like what you've described is an interaction interface. Picture an FPS in this case. You look at a weapon and press F, look at a keypad to a locked door to press F and hack it, look at a door itself to press F and open it. All of these are done from the exact same function call. There are best methods for this but it really depends on your game type, the discussion can get incredibly indepth. To cut a lot of that off, In short put a basic RPC on your PlayerController. Have your interaction, where ever you keep it get the local controller and call that RPC, and pass in the hit actor from your line trace or whatever. The RPC can have a single argument of an Actor type. On the other side, on the server, you use that pointer to call in interface event on that actor pointer if it's valid. On your.. whatever you're placing in the level, you implement that interface and that interface interaction event and have that thing do whatever it needs to do on server and set the replicated state that clients need to realize something happened on the server.
So like I am trying to do a multiplayer weather system and I have it all inside an actor I placed in the world, I setup a timer so that it could begin raining at random times while playing. Only the variable I am using for the weather cooldown uses a random float and is getting set on each client individually, so they all have different times where it may be raining for one person but not another. I was trying to call to change that variable on the server but the owning connection issue happened, so ultimately I am trying to get some kind of server call to change the variables I need so that they are the same for all the players and it only gets called once on the server but from inside the actor it is calling for each player in the game separately.
port forwarding?
You were all right, Subsystems totally don't replicate, and what's worse GameInstanceSubsystems look like they replicate in the editor (I guess because there's only one local GameInstance?)
hi guys, just joined here. I'm wondering if someone can direct me to a proper channel if this concern should not be here. I wanted to show my webcam video to other players in a multi-player game so that everyone can see my local webcam feed. I already tried opening a URL using a MediaPlayer object but it keeps on playing only local video of each player. I wanted to stream my webcam video to all players and probably attach it as a material in a cube mesh. I heard I should have a media server. Is this the way to go? Any free options for this? I was in the direction of using umediaserver (umediaserver.net) but it was limited and had to pay for the extended usage. **sorry to butt in...newbie..
Instead of bothering with trying to keep clients in sync with timers, switch up your thought process. Upkeep is very bad. The client doesn't have to care about the next weather. You could simply replicate the current weather, and have the client's weather set up to interp to that weather. If you need crazy fine tuned controls, you could even have an array that has weather's current states and make the client set up their weather based on that and interp to the new state when server sends a new weather state. Now server is the only one that has to do any form of authoritive weather logic. The rest of the syncing can be done based on ServerTime in the GameState. It should leave you relatively always in sync with very little network overhead.
God, thats much better, I got it in my head to do it with timers and couldnt think of any other way to do it. I could not get them to all sync up but I will give this a try instead
What is the life cycle of the GameInstance in the client? Does it persist during travels?
GameInstance persists everything. A GameInstance has no bearing on Networking. It simply exists for the lifetime of the entire application.
Great. That's true even if the client changes the server?
As long as they don't close their game, yes. No level loading, either hard loading or streaming will ever destroy a GameInstance.
what is a general default value for Net Update frequency ?
how do i know if the number i set in my net update frequency is enough or too much
Can you call from the server to a player controller an RPC "Client" UFunction?
UFUNCTION(Client, Reliable/Unreliable) on the controller.
So In my gamemode instance i'm calling this
this is the function
It only works on the server controller and thats it
Am I missing something
Decided to write out a few debugs to check and instead send a string of the controller I'm calling the method on with it
I have no clue why the client isn't PlayerController_1
How many players are there in the server? just one?
Two
my viewport and separate view port
If you search PlayerController in teh editor while you're in PIE how many show up?
also, make sure your NetMode is set to ListenServer or PlayAsClient and not Offline mode
Right under where you set the number of players in PIE
NVM i see your screenshot in #cpp has the netmode set correctly
So I'd confirm if InitNewPlayer is actually being called for the 2nd player
yeah there is only controller 😐
but I can debug it and get it
shows the _1 in autos]
I bet InitNewPlayer isn't being called for some reason
I think there's some weirdness there with PIE, ringing a bell
Mines the correct one according to that issue you linked
And thats actually being called twice?
yeah
Actually think this GEngine SCreen debug message prints to all open windows
Oh maybe it's too early for replication?
This is showing them debug messages even on different clients
like gamemode shouldn't be on a client right?
nope game mode should only be on the server
ya I think it does this in blueprints too, I usually use UE_LOG
which prints to the console log
and that doesn't replicate
not super familiar with onscreendebugmessage
I think it might be just the way I'm testing and its got me confused
cause the one controller does hit the breakpoint and does what its suppose to do however the client doesn't
would be nice if I could breakpoint the client
Tried to use a server rpc to log it. only worked on the server one
I guess maybe cause the server doesn't owner the controller?
own*
Okay managed to fix it by moving the call to PostLogin. However when I pass the pointer from the newer created object and send it along its null on the client?
is the actor replicated?
Actor has to be replicated and don't expect it to be there when the client RPC arrives.
i wouldn't use RPC for that to start with, earliest time that Unit is usable on client is when it calls its PostNetInit function
if the server were to SetOwner on the unit (which it probably should anyways) when it spawns it, the unit can then register with its Owner client side
during PostNetInit
(before calling Super)
unless the unit is preplaced on the level, that RPC has a good chance to fail under network load, as the Unit actor will not have replicated in time
hi, anyone here was able to stream a player's webcam in a multi-player game where all players can see that webcam video of 1 player? need a guide...thanks!
you probably want a browser window in game, where that one player just replicates the url for his stream, i would not push that stream through unreal
How u guys handle projectile in MP ? I wanted to do things client authoritative with raycast but since i'm not using these and using projectile component instead i'm wondering how yall manage that, all on server ? or full client and sending to server if projectile has hit smth
Jambax explains how they are handling projectiles in Hell Let Loose (100 player PvP game)
So with seamless travel are all the essential Game Mode events like PostLogin, Find Player Start, etc.. not called again since technically they were already called and we are just moving maps and the Game Mode persists as it was prior? I'm starting to think maybe Seamless travel isn't what I want.
Login is not called (and subsequently PostLogin) on Seamless Travel.
Both the GameMode and PlayerController have functions which are called in their stead though
Is there an Order of Execution graph that might also say what is called and what isn't?
Well if you are saying maybe and it isn't pinned then no lol
Using both C++ and BP. I know I can look at the code.
Take a look at HandleSeamlessTravelPlayer
Search for its usage, it should lead you in the right track
Is your game Multiplayer?
Yup
Are you switching the Server to a new Map?
Yup
Use Seamless Travel
Awesome, thanks
Why do you think you shouldnt use it?
If you dont use Seamless Travel then you will cause all Clients to disconnect.
And only the Server will travel.
As soon as I enabled it and did some re-organizing of logic everything is broken
Previously I was just connecting in Lobby, and traveling without seamless travel and clients still seemed connected on map change
This is a strictly LAN game FYI
IDK if that changes anything
Cant remember if LAN requires Seamless Travel
Why did you change if it was working?
Thought seamless travel was the right way to do it
and intended way to handle the situation, seemed neater
I think before I just had an actor that would host on loop (if told to) and the clients all just connected to the first hosted server they found (on loop until connected).
So I guess it was just traveling and the connecting loop just re-connected everything again
but they were spawning correctly and server could spectate
now instead I'm making a single connecting actor in the game instance that travels with each map change.
As soon as I enabled seamless travel though, the Server wasn't a free floating spectator aka wouldn't move, the clients were not showing on the server guess they were not spawning
Client were also spawning in the air not the Player Start
I think I'm just not following Epics design pattern here and I'm going from doing whatever I wanted to trying to follow their flow without knowing it real well
Ok solving issues... Have server spectating again and I think the issue with the clients is the Connection Actor persists only on server not on Clients despite replicating it
Ah the UMG isn't replicated despite being on an actor that is replicated... Gonna call it a night and think about this after having rested.
any way to make a multicast reliable for one client? i am multicasting something that the owning client should always get but other clients i don't care if it gets dropped. if not i can send 2 rpcs but that seems silly
No
We're having some server travel issues too. After traveling and spawning a new pawn for the player, that pawn doesn't seem to tick on the client
Or, it's ticking, but it's not animating or recieving input or anything
Only if traveling? Are you in the correct InputMode?
and it did call BeginPlay?
not calling a Super on PostNetInit or BeginPlay itself can cause that issue
ditto for GameState, if it didn't Dispatch BeginPlay to world because one of its OnReps is overriden or GetLifetimeReplicatedProps is missing Super
I've been trying to comprehend the FGameplayTag NetSerialize_Packed function. I'm not quite following it though. How is that packed and unpacked? I understand that the original tag is simply serialized as a FName, but the FastReplication stuff I'm a little iffy on. I vaguely understand that it's being serialized as a uint16? At least that seems to be what FGameplayTagNetIndex is, but what is the point of defining it like they do?
How do you mean?
Looks like they don't pack to uint16 specifically, they pack to the smallest size possible.
Based on a quick skim of SerializeTagNetIndexPacked
Oh. Yeah I see that now. The FGameplayTagNetIndex is what threw me off for a moment.
I don't understand the necessity for the typedef
Easy increase later if necessary, or?
I guess so yeah
@glacial prairie Tagging you here for the multiplayer question. Listenserver is just a client application that also is a server. Console shooter games use this a lot to have one player host a match for instance. It saves you the effort of requiring either you or your playerbase to start a dedicated server instance.
Dedicated servers are just a game process that is ran without cosmetics like rendering, cosmetic stuff like particles and materials, sounds, etc are disabled or left out entirely.
You're not required to choose one or the other. Some games can use both. For instance ARK:SE has a standalone for singleplayer, a listenserver setup for coop play, and a dedicated server for larger servers. On top of that they allow the community to run their own dedicated servers as well as hosting their own official servers.
A ton of your net code won't differ with the two either.
is there a way to stop the game world from closing if a host disconnects? I'd like an end screen to pop up over top the game that ended, but anytime the host closes connection it immediately kicks the player back to the menu.
There should be function to override in somewhere but I dont remember
But it will kick you out of the map if I'm not wrong
You cant stay in the same map when host disconnected
yes, that's what I want to prevent. I've been looking for anyway to do this, but can't find anything on it. Right now my only other option I can see is to bypass ue's networking altogether and implement my own.
my networking needs are fairly minimal, so switching won't be a very difficult prospect, was just looking to see if I haven't overlooked anything.
You'll have to do engine changes for this
The engine does kick you to the default map whenever a network error occurs
ok, guess it's implementing my own solution it is then. thanks!
Does it worth though 😅
it's a card game, so I basically just need some fairly simple networking rpc's, 99% of the logic is handled by the clients already.
For what it's worth you can also simply display the end screen from the default map
Black screen, loading screen, end card
You can also change the default map at runtime
So it's not like you're stuck
I will start developing with c++ and learn the ue4 and will start to learn how multiplayer works what can i do best
Yes, I've considered that as well. But I honestly don't like the abruptness that it causes. player is playing game, then without warning they are suddenly presented a black screen followed by "host has disconnected" message. This imo is a bad user experience i'd like to avoid.
Doesn't need to be a black screen. It's very easy to make a loading screen for hard travel.
I think it's like two bindings and a function call with a widget.
yes, that's not the point, it's the abrupt change that's the problem.
The abruptness of a sudden "game ended" score card is most certainly annoying, but it's also something you can have working today without reinventing the wheel, considering most hosts don't alt+F4 the game
If my network needs were more substancial I'd probably just accept it, but since I basically just need a few function calls it's not a problem. I've implemented networking before so it's not like i'm a stranger to sockets. I just wanted to check if there was anything I was missing before doing it is all.
Sockets are going to be problematic in other ways, though
Gonna need to implement NAT punch, and see if you can use Steam sockets to survive DDOS, chiefly
To be fair, I'd be shocked if the default level travel wasn't virtual somewhere.
It's not
Easy to edit though, unless the failing actor channels trigger other issues
If the problem is just UX, this could be solved in other creative ways imo, but if you insist on engine changes 🤷♂️
If you want a seamless experience, it's dedicated servers or engine changes
Wanting a seamless experience is reasonable
Yo, a server can't have or run more than 1 map at the sametime, so if i want to make a game with multiple maps all running at the same time i need multiple servers, am i correct?
Yep
Is it possible to communicate between 2 servers using blueprints?
maybe some way to rpc
Yes you can
With RPC or there is something else for it?
You can mark events as Replicates
i dont think rpc is possible because you need to cast to get the "target" for rpc as far as i know
and you can replicate variables
"Between two servers"
Oh wait
yes
i was wondering how replication would work there lmao
no default nodes or work arounds?
I was really partial to Ark's method. But it does have some drawbacks. They just save character files to the server's local area, and then mark them as "Transfering". Then you can log onto another server and use that info to spawn the character.
ark stores data to disk you mean?
Mm hmm. And loaded on the other server at login, likely through Steam ID
Though they also launch the server from the same location which means they save to the same location. They just launch the server application with different command lines to load different maps.
so there is no way to use direct connection between them with blueprints?without adding extra nodes
None that I'm aware of. Most of that kind of behavior falls under backend systems managing as far as I was aware.
and how did you know how ark works? im curious
I play it. I host personal servers for my wife and I. Have the server transfer ability set up and such.
I was thinking of making a master server but it seems too hard atm, i think i'll go with ark way of doing it
is for a simple testing shooter game listen or dedicated server better?
@ancient adder Ark basically does this. It's a command line that opens the ShooterGameServer.exe with the following command line. The first is the Map name, and then any parameters separated by ?. Unreal has a few functions for parsing options strings. Normally you pass that same string into OpenLevel.
start ShooterGameServer.exe "TheIsland?listen?SessionName=AuthaerIsland?bAllowUnlimitedRespecs=true?OverrideOfficialDifficulty=5.0?ShowFloatingDamageText=true?QueryPort=27016?Port=7777" -NoBattlEye -NoTransferFromFiltering -clusterid=AuthaerGameCluster -exclusivejoin -noundermeshchecking
exit```
There are multiple versions of this. Mostly one per Map name.
This is Ark's project directory. Typical. All saved data goes to Saved/SavedArks
That allows any instance server application launched from this project folder to access that saved data and use it.
for a shooting game its a dedicated or listen server for test better?
i was doing it wrong till now like a stupid guy, your post made me realize it, i was making a folder "package" for each server even tho i was using the parameters to open the map, im slapping my self now, why was i packaging each server alone while using map parameters to open a map lol
Ark's network engineer was a genius, considering the tools they had to work with at the time. 😄 Though whoever handled their asset data loading needs a hard schooling in soft object pointers.
or their player animations 😂
Hey guys, at what point the player state is created? In post login I can see the pawn created but the player state is not there yet (on the client). Is there a hook that it's called after creation or something?
Start with listen server so you can actually see what is happening in the server
Hey with what should I create my first game (Blueprint, C++) I can choose. I would like to code myself and everything that has physics and weitetes zutun is done in blueprint
See initPlayerState in controller class
Am I actually right about that? My engine (game) has an OnFire function to tell the server that the server must have a Server_OnFire function? (For shots)
WHO you mean
If you need all players to be notified of a value change, put it in Playerstate.
@kindred widget is that the way how it works by listen server
controllers only exist on the owning client and the server
if you need to broadcast a variable change to all players, then the player state is what you need to use
Server, and owning client. No simulated clients.
Possibly. Depends on the game really. Some games for instance use semi client authoritive hits and do all shooting locally for better feel to the player, but also have server notify that they've done a shot, and then on hit tell server that they hit something. Server can do some checks to verify, etc. It's a very heavy conversation.
That really has no affect on the netcode in question.
Ok
A listenserver is just a server instance that is also a local player. The server still does server authoritve things. And the local player still runs function calls the same as a client would for the most part, the function flow is the same.
The only difference is that when a server player runs those functions it doesn't network, it runs them locally. But you don't have to specify that yourself, Unreal's underlying code handles it for you.
Nice
Hi, I'm creating a small game and want 1 dedicated server. I'm not familiar with how dedicated servers work. Where do I rent a dedicated server? The Unreal docs says to create a build target. How do I run the build target on the dedicated server? Do dedicated servers usually provide remote access or something?
hi, how can i replicate the AI death event to all others clients?
build from git source @uncut atlas docs online.. it takes on hdd by me 8 hours
but i switch to ssd tooks 30 mins
Ok. I don't plan on adding microtransactions. I just want the game to persist and have players leave and join as they wish. Do you know a good company to rent a computer where the dedicated server program can run on?
Ok thanks!
Is there a way to handle logout when a user quits the game under any circumstance or is it normal to depend on the timeout to handle that?
check if process running? idk
Hey guys, im working on a simple car project. There is issue when 2 people gets into the car ( one player is driver - the one who possess the car & the other player is the passenger - passenger just attaches to the car ) When moving the passenger's movement is lagging but driver's movement is smooth. Anyone know how to fix this ? I have attached a clip for your guys reference.
yes, you can override OnNetCleanup in the player controller and call w/e you want there.
@lament minnow Your issue was bugging me. I don't know if you solved that. I refused to accept that it couldn't be overridden. Turns out it was fairly simple actually. Two Overrides. You need your own UOnlineSession, and your own UGameInstance.
In First create the UOnlineSession. Override HandleDisconnect I had this. ShowGameOverDisplay is just a BIE that I used to create a widget in BP.
void UTarrionOnlineSession::HandleDisconnect(UWorld* World, UNetDriver* NetDriver)
{
if (ATarrionTacticalHUD* HUD = UTarrionObjectLibrary::GetHUD<ATarrionTacticalHUD>(this))
{
HUD->ShowGameOverDisplay();
}
else //HUD not found, call super to return to main menu
{
Super::HandleDisconnect(World, NetDriver);
}
}
Then in your GameInstance. Override this for the Session. I hard coded it for testing.
TSubclassOf<UOnlineSession> UTarrionGameInstance::GetOnlineSessionClass()
{
return UTarrionOnlineSession::StaticClass();
}
Play as Listenserver, 2+ players, Turn off RunUnderOneProcess so that they all run as Standalone. Play, and then close Server's window. The Widget should show up for all clients with no map travel.
Hey guys, is there something special about montages and networking? Im asking because Im using GAS and using the PlayMontageAndWait task and the thing is, I create in runtime the montage from an animation for convenience but it isnt being replicated and outputs the following warning
LogNetPackageMap: Warning: FNetGUIDCache::SupportsObject: AnimMontage /Engine/Transient.AnimMontage_7 NOT Supported.
I guess it's due to it only existing locally. I could create the montage assets and store them but I was wondering if the same behavior could be archived without using montages but animation directly?
I think this is more related to you making something runtime
And expecting it to magically resolve over the network
@wheat grail
You will need to create the Montage as an asset
Which I would suggest anyway :P
@thin stratus That is what I think but what bothers me is to use montage assets just for that use case. My question I guess is more towards if the necessary condition is it to be an asset rather than a montage, technically I could replicate the behavior with a regular animation by recreating the montage right after the replication happens in the simulated proxy.
But I guess you're right, I was avoiding montage assets because even if I created them via a script it adds overhead in my workflow..
Doesn't help avoiding something that a System expects you to create
You just add problems
Fantastic, thats exactly what i was looking for. Thanks!
I have 2 dedicated servers running, first i connect to server 1 then when i hit lets say start button it executes a console command(on client by client) to connect to server 2 and server 2 spawns a character and lets my controller posses it, but the problem is i cannot move at all
When i open the game and type the server ip in ` it works fine
And also by calling open level with console command node(on server) while providing the "specific player" doesnt work, am i doing it wrong?
I need to add a value to an array using RPC event(bcoz need to replicate it in every client) and display the array using widget; So in this scenario "If I add a value to an array" using RPC event is there any trick or way to get back response whether that process finish or not other than use a delay. because if client's ping is so high that delay would also not work. anyone know better solution for this?
If you're setting it from the server, just set the value. If it's a client set value. ServerRPC, and add it to the replicated array and call the delegate after so that listenserver's ui can use it. Mark the array as OnRep, and use the OnRep function to call a delegate. Bind that delegate in the widget. when it runs, you know the array has replicated changes from the server.
ok thank you, ill try it
I realize I may be asking for a simple asnwer to a complicated topic but...
is the difference between Unreliable and Reliable RPC calls, simply that one is sent through UDP and the other on TCP?
I could be mistaken, but I don't believe any of UE4's networking uses TCP.
Interesting, I wonder how reliable calls work then
I see
So does unreliable calculate heavy traffic or heavy cpu load on wether it should be called or not? Does anyone know a good article about this?
It just isn't sent again if it fails
whereas reliables will be resent and processed in order
If a reliable never reaches the client they are kicked.
😮
..but that rarely happens unless something went very wrong
that sounds a lot like tcp
i.e. massive packet loss for several seconds
It's not TCP, but a reliable is considered as important - so if a client doesn't receive it, the server can't know whether they are in sync or not
i see
Does Anybody have experience with ark servers/ ShooterGame server?
Dm me
i got this error
hi, how can i replicate the AI death event to all others clients?
is there any way to save an int using steam? bc i want to do a leveling up system
you can just use a save file
Or if it must be stored on steam, you can use steam stats
The engine doesn't have a decent implementation of it though, you'll need to do it yourself
wouldn't they be able to modify it?
yes but technically anybody with knowledge of the Steam API can modify their online stats anyway unless you use the official game server stuff
okay ig i'll just use a save file
it's not like the lvl do anything useful
it's just to show how much time you wasted on the game
It's essentially the same system achievements and leaderboards use on steam.
yes i will add achievements
Unless they're one-off unlocks you'll need to implement stats anyway then
wdym
The engines built-in steam implementation is quite underwhelming
yeah
Most of the features are missing, many are not fully implemented - cheevos being one of them
the only part of steam i'll use will be matchmaking and achievements
Do yourself a favour and move the Steam plugin into your project directly, you'll no doubt need to modify it often
at least it is a plugin now
how would I do that? Get it from the engine and move it to the project??
yeah. any plugin in your game directory overrides the engine one
Which is a nice way to modify engine plugins without using a source build
okay
but what changes
if i just move it from engine to project
it's still the same plugin right?
You don't have to do this btw - but just bear in mind there's a reason there's about 10 Steam implementations on UE marketplace
can someone help me please i have this function that decrease AI's HP the problem is that it works only on server pawn, all the other clients do damage just on their screen, without replicating it to the server. How can i fix?
normally clients don't (or shouldn't) network damage to the server, replication is done from server to client
in this case you should use make sure that variable replicates and just update it on server
and how can i update it on server? i need to get a reference from that pawn and call a custom function that has authority or is there an easier way to do that? i'm sorry for asking such a stupid question but it's my first time doing something multiplayer :\
no questions are stupid, you should see a couple of checkboxes in the variable's details panel
setting the 'Replication' type to Replicated will mean it will replicate to clients automatically when updated
setting it to 'RepNotify' is like setting it to Replicated, and will have the engine automatically create a 'OnRep_VarName' function for you that gets called when it changes
so you can add custom logic whenever clients see a change (I think also the server calls it)
okay and from the function that gets created how am i supposed to call the server and make it decrease AI's HP?
no no, it should be 1. Server sets AI's HP by doing YourReplicatedHealthVariable = NewVaue, then 2. OnRep function gets called (automatically by the engine), clients can update health bar or whatever
the OnRep function is the effect, not the cause
not really, when OnRep gets called, Life Points would already be set to the new value, you don't have to set it
also, the first pic, you're assigning the HP to the AIDamage variable, why?
because OnRep function can't gets inputs
they aren't meant to have those kinds of inputs
and what am i supposed to put inside OnRep?
you may not even need OnRep, OnReps are good for when an event of a newly replicated variable needs to have side effects
if i put "LifePoints" replication as "Replicated" then the variable doesn't get replicated to the server
variables dont replicate to the server
they replicate from the server to the clients
Normally how a player would cause damage is:
- Player Input > RPC to Server indicating they are attempting to damage a specific Actor.
- Server calculates and sets new HP values for Actor (in a replicated variable)
- Clients receive updated replicated variables. If the variable is set to use w/ Notify, then the OnRep function fires, allowing the clients to perform actions with the new values.
@twin juniper are you familiar with the server client model?
just a bit
yeah but how am i supposed to get a reference of the server?
You use an Event, set it to run on server.
you should read more about it, it would clarify a lot and answer all your current questions
Here's a very basic setup for dealing damage to actors.
okay ty i'll take a look
Of course, you'd usually have your server verify things about what you're trying to deal damage to - like checking if it's in range, line of sight, etc... but again... just a basic means of dealing damage to an actor.
i tried something similar like your screenshot but still not working :\
this is bp_projectile
and this is AI's Blueprint
when i play with server controller everything works, but when i use the clients it doesn't get updated
You cant RPC through AI pawns
Only multicast
Your client doesnt own the zombie
And also has no business directly applying the damage
This bit should probably already be happening on the server so doing an RPC there wouldn't help.
Again, the flow should be that your player requests to fire something and that is RPC'd to the server. The server then handles the spawning and everything else relating to replication of the results of that projectile being spawned (it should likely be a replicated actor!) Right now it looks like you're getting the hit results of the projectile and then trying to RPC to the server the damage value (which the server should already know anyway).
Again these examples below show a server authoritative way of doing it. The point being, you're getting the client to tell the server to do something, the server does it and calculates the results, with the end result being that the new health value of the target is being replicated to all clients through a replicated variable.
Input From Player > RPC To Server > Server Spawns Projectile > Server Projectile Hits Something > Server Projectile Attempts to Apply damage > Server Actor receiving damage calculates new health value > Server replicates new health value to clients.
hello
anyone know how can i cast to host player or send data from client to host?
thanks
if you are looking how to "cast to host player" you shouldn't be doing multiplayer... yet
you're not ready
okay how can i be ready?
practice with something simpler
then add multiplayer later
why im telling you this - it really doesn't matter if its the host's player or not, and it never should matter to any of the code
and if you're having difficulties with casts, you'll have much harder time tracking networked execution flow
If I spawn a replicated actor and then call an RPC to a client with the pointer of the spawned actor it appears its null. Is that because the client hasn't loaded the actor at that point?
or can you not use pointers?
you should be able to use pointers if its an actor
yeah it makes sense that the actor isn't immediately loaded on the client
Ah okay. Does beingPlay get called on the clients controller if they've fully loaded do you know?
yeah, begin play is called
Ah okay cool I'll move my stuff in there I was doing rpc calls on PostLogin
for any object that just loaded in, even if it became net relevant on the client but in reality has been there for a while
Whats the easiest way to determine if you own the actor? Is it GetOwner() then check against your player controller or is there a better way?
A more foolproof way is to compare the result of GetNetOwningPlayer() to your LocalPlayer
Since network ownership works in a chain
I often find myself doing stuff like this when I want to support a listen server, and have changes happen OnRep. Is there a better way around this?
OverlayStateStack.Pop();
if (HasAuthority())
{
OnRep_OverlayStateStack();
}
Nah is pretty common, especially when dealing with listen servers
Sometimes it's beneficial to separate the implementation from the OnRep_ though to help make it readable
or easier to debug etc.
Is there a way to know if a replicated property was replicated (changed?) due to coming into relevancy?
I have question about different services which can be used to deploy dedicated servers,
I use gamelift at the moment and it seems little bit slow...
What you guys are using ?
GameLift is "slow" because it has to setup instances of a VM and push the build onto each of them.
GameLift has controls for managing instance count to ensure you always have a free instance ready to serve new players should others become full.
Im curious to know how your using GameLift to think that its deployment being slow is a problem?
It also depends on the size of the Server package your pushing to it as well.
If your game server is GBs in size, its going to take a while
Compared to one thats like MBs
I am not talking about the deployment of the server, I am talking about creating game session and creating player sessions and then joining the server seems slower, I want to create a smooth experience, for people who get disconnected, because I am developing for quest, so sometime people put there devices to sleep and when the join back, they have to go through gamelift logic again, to create a game session and player session, then i get the IP address then I join the IP address.
Right now if the game session has no player sessions in it, we destroy the game session,
then next time if someone want to use the server they again have to create the game session and this process keeps repeating.
am i doing something wrong? can i make it more smoother ?
Sounds like you using it for Mobile?
Why cant you keep the Session alive when the user has their device asleep?
Im unfamiliar with the nuances of Mobile development.
In our application , each user can create lots of room, there is no limit, and each room represents a game session in theory, so if the user goes into 1 room, and leaves and there is no other user in the same room, we kill the game session, so other users can use the Instance, other wise that instance will get stuck with same room id, and last changes that we have done inside the room, like spawned bunch of actors.
so if user wants to go inside room A, then we check if there is a game session available which is dedicated to Room A, join that other wise Create another game session with data regarding room A, and join that.
so each time when all the users left a particular room, we kill the game session, so that we can re use that instance for some other room.
Why cant you keep the user in the room when they put their device asleep?
but server kills the player after connection Time out so i destroy the player session and there is no gurantee when this player going to return, may be he returns next day, because all of these quest users, the dont close the app, the just put there device to sleep while the application is running and then when the pickup the device , they expect it to resume it where they have left last like magic.
so is it possible to tell the server, not kill the player until player tells the server to kill it ?
i'm guessing you could figure a way to prevent the server from timing out (i don't know for sure however) but i think the question is do you want to spend the resources maintaining those connections?
Wouldn't sending some arbitrary packets from the clients side to have the server to respond to work? Dunno if that's an idea i'm new to the engine
Is the problem more that Gamelift is slow in creating a new instance of the fleet? I recall when I was mucking about with GameLift it wasn't slow getting a user connected so long as an instance in the fleet was up, but starting up those instances was fairly slow (sometimes several minutes!) but I think you can also have multiple processes running per instance of the fleet basically allowing you to have multiple copies of the game server running on a single GameLift fleet instance.
i think my problem is more like because of our use case, we dont want to spend for the resources, for longer time , like keep the game session running. if i do that , i can just fix my problem very easily, i think.
I was thinking that if it would be possible to reduce the time for creating game session and player session and then joining the ip address from 10,15 seconds to instantaneous.
eg:- you can back from sleep on quest, and there is no loading no re joining, you just got connected to server, even if you are coming back after 4 hours of sleep.
Hello. I'd like to re-open my question ( and quest :P) to try and fix a problem we've had with our project for a long while and sadly still haven't been able to find a solution for. It's one of the last remaining big bugs for us and would finally like to fix it and move on. So any help regarding this would be extremely helpful to us.
So the problem is, as some will most likely recognize, the automatic deletion of controlled (possessed) pawns when a player disconnects from the game. In our game these pawns are vehicles that can be controlled by players and should thus never be deleted when a player disconnects.
We've already managed to fix part of the issue a long time ago, namely that pawns no longer get auto deleted when a player disconnects CLEANLY.
BUT.. the issue still remains when a player disconnects UNCLEANLY, due to for example a crash, or sudden internet disonnection.
There are several threads to be found regarding this issue and trust me when I say I've scrutinized every single one of them hundreds of times and tried every single solution presented hundreds of times and sadly none of them fix the unclean deletion problem.
So if there is anyone out here who has more info or things that we can try we would love to hear it. 🙂
From what I'm reading, you'd need to override your playercontroller's PawnLeavingGame() in C++.
This is called in the playercontroller when the playercontroller is no longer valid
void APlayerController::Destroyed()
{
if (GetPawn() != NULL)
{
// Handle players leaving the game
if (Player == NULL && GetLocalRole() == ROLE_Authority)
{
PawnLeavingGame();
}
else
{
UnPossess();
}
}
}
And then this is the PawnLeavingGame() function:
void APlayerController::PawnLeavingGame()
{
if (GetPawn() != NULL)
{
GetPawn()->Destroy();
SetPawn(NULL);
}
}
Based on this, you can see that the playercontroller being destroyed will cause their controlled pawn to be destroyed. So you'd have to change PawnLeavingGame in such a way that maybe it only destroys their pawn if it's not a vehicle or something like that (maybe with tags etc.) and only destroys their actual character (if their character is present in the vehicle)
Thanks for the tip! I think we already tried overwriting both these functions and it still causes the pawn to get deleted when a client leaves uncleanly. When he leaves cleanly the adjusted code in these functions seems to work. But the problem is that a vehicle should never ever be removed in our game, because it literally breaks the entire match from that point onward.
Why not just override the vehicle's Destroyed function and just not call Super?
That way nothing in gameplay code can destroy it. That won't affect map loading/tearing down code.
Dump a breakpoint in the destroy function and see where the call to destroy it comes from.
There's multiple places where pawns are destroyed, not just those
I'm just saying though. If Vehicles are literally never meant to be destroyed in a match for any reason, just block the destroy function entirely on them. It's a lot cleaner than overriding other functions that'll tie in with other pawn types.
From my testing the above does appear to work, even through a debug crash - the pawn will remain if you prevent the PawnLeavingGame function from destroying the PlayerController's current pawn. I myself am trying to do some quick testing on this. If you have a pawn created in blueprints, overriding destroyed won't do much yea? Like the destroyed event appears to be the last place to do something with the pawn but it still gets destroyed.
You can't prevent an actor being destroyed anyway
The only virtual part is OnDestroyed() which is called prior to the actor being marked pending kill
So you just need to debug where the call to destroy it is coming from from the network error
I'm not sure why I remembered Destroy() being virtual.
Can see why it wouldn't be though, I don't think you'd ever want to have a truly undestroyable actor
Damn. That would have made it easier. 😄
Fair. Rare use I guess. It wouldn't be that hard to have a wrapper for gameplay calls that is virtual and a normal one that isn't that engine code uses for like world cleanup though.
Does the editor replicate variables slower than in packaged builds?
I changed a bunch of variables in the base and default ini, but i can't seem to make it replicate faster
Unless you're like me and forgot you left on Bad network emulation. 😄
Lol no i checked that
^ yeah or you have emulation on
emulation?
the packet loss/lag simulation
ohh, yea, no thats off
But otherwise, out of editor will pretty much always be slower, since there will be more than a single frame of latency
Because for every 3 updates my server sends the client is only getting 1
Outside of editor that's pretty normal
you're not garaunteed to receive every update
Only the eventual state
Yeah but it's happening in editor :/
server/client running at different framerates?
Possible if it's a dedicated server or not sharing the same process
I'll try a dedicated server
Either that or the editor is struggling to actually pipe the amount of replicated data, i.e. the connection is saturated
you may need to profile it really, see what's actually being sent/received
editor is handling the way too many actors to replicate efficiently much worse then a packaged game would tho
especially if all you have is distance based relevancy
For an inventory system, should I have the items array that holds everything be replicated to the server or just store it on the respective client and use the server to add and spawn items
The array will be holding data assets
So replicated array variable? Is it ok to modify directly from a client or should I call a server function from the client
Sorry if these are dumb questions I’m relatively new to replication and I wanna get it right
You can manipulate it on Client, but it's not wise. If you want it to share state with server, it's best to modify it only on server and replicate it back. There's rarely a good reason for client side prediction of inventory related things. It's easy to mess up. People are willing to live with a quarter second delay. But things being out of sync and messed up is instantly bad reviews.
Gotcha. So for AddItemToInventory(UItem Item) it should go ServerAddItemToInventory being called on the client, which executes on the server and handles the logic and it wouldn’t have to call a Client-side function because the item array is replicated right?
And I wouldn’t need a multicast because other clients don’t need to be updated on another client’s inventory
Probably. When I did mine, I just used the client's own inventory component on their character to do the RPCs to server. Characters had a separate subclass of that that changed replication to owner only. But all other inventory components were a very low replication rate and had forcenetupdate ran a frame after anything was altered. These days I'd probably simplify it considerably by just using the pushmodel system.
I’m putting mine in the player controller
im partial to PlayerState... PS survives a reconnect
I’m pretty proud of my interaction System I’ve built too, it does traces on the local client on a timer then when the player presses the interact button the client passes the focused actor to the server which validates it then runs the logic needed to interact with it
I might move it to playerstate if I encounter problems with it but that’s a while from now
How can you tell if the server bandwidth is saturated?
Well how frequently are you changing the variable? You can't use changes to replicated variables to represent "events", that's not what they're for
How exactly it survives a reconnect? Server holds the playerstate actor for a while when player disconnected?
Does anyone know if its possible to have a character not lag when Üse Controller Rotation YAW is unhcked with this code used for multiplayer
The lag is pretty bad, is there anything that can be done to fix it?
@peak sentinelFive or ten minutes I believe. Probably a setting somewhere to extend/shorten it
Hmm, alright. Thanks
Should you take advantage of PlayFab or have a vps?
@hoary lark I'm using the data in the variable, unless it would be faster to do function replication with parameters
I mean are you changing it like 3 times in one frame? or once every second or so?
in any case if you need each change to always be propagated separately, you must use RPC
How do you not start the game mode for everyone until all players are loaded in? Right now server is getting loaded in first
I would be curious to see a time when the server isn't loaded in first.
But, you can sit on a loading screen until you receive a notification from all connected peers that they are fully loaded. Then when the server receives the right number of notifications, they all start.
Right so I'm asking how to not start for the server on gamemode until everyone is loaded in
should I just keep checking on gamemode begin play and do some logic to check everyone has loaded until I call parent begin play and rest of my logic? or is there a better place to do this
There is an event called StartPlay which "Transitions to call BeginPlay on actors" but this is on GameModeBase and it looks like GameMode overrides without letting us change it
There is also InitGame in GameModeBase being overriden on GameMode
Does anyone know how I would set this for each character? This is in the widget interaction settings
Can I somehow check if I'm currently in a ?listen environment?
Is there some handy getter on the NetDriver or so?
Maybe IsServer
I guess I can use the NetMode?
Standalone vs ListenServer
yeah, the netmode
Does anyone know how to wait until all clients are loaded in before BeginPLay or StartPlay is called by the gamemode?
Yeah I'm asking for details though I am sure this is possible what function can i override, i need an actual place to start
Sure so does this need to be done in a c++ class then or how could you use this in a BP, I was hoping to do it in a BP level but can do c++
Oh does the AGameMode handle this for you? I am using GAmeModeBase
Right I've read their docs on this, I just couldnt find ReadyToStartMatch in a BP overridable function, i know its in a class
most all of GM flow control functions are exposed
Yes but even though they are exposed, how could I actually use it in a BP if BeginPlay is an event that is fired after these
those that aren't have BlueprintImplementableEvents
@hexed thunder we talking seamless travel or login here?
OH I see, i think the big point that would have helped here is that Base DOESNT allow or have a ReadyToStartMatch function
But the nice one Unreal Engine sets up which inherits from Base does
in my experience its best to forget the Base ones even exist for multiplayer
So is the idea to just implement that sort of logic in the ready to start match function? Like get all the player states and see if they're connected then allow match to start?
Thanks @twin juniper tho for helping me understand this, and @winged badger
if your players are logging in directly into the match - you have a problem, you don't know if any more players are coming
if you joined players into a lobby then seamless traveled to a game map - then you just don't let ReadyToStartMatch return true if NumTravellingPlayers is greater then zero
awesome thats exactly my scenario, just curious how does it get updated if a player crashes mid seamless travel
its controller gets destroyed, and num travelling players gets decremented
So is NumPlayers the connected players technically? so I could keep delaying until NumPlayers = NumTravelingPlayers
note that this very basic approach needs a lot of refinement before it can be called production ready
no
NumPlayers doesn't change, unless someone logs in or out
and NumTravellingPlayers is number of players that haven't called ServerNotiffyWorldLoaded yet
Is there a variable that tracks those that have called ServerNotiffyWorldLoaded
which they do after they load the world
that would be NumPlayers - NumTravellingPlayers
OH i see
for those that have called ServerNotifyLoadedWorld
so Like NumPlayers - NumTravellingPLayers = 0
if the server has loaded, HandleStartingNewPlayer gets called immediately
if it hasn't, then it will start all players that have already loaded during AGameMode::PostSeamlessTravel
and NumPlayers - NumTravellingPlayers is 0 only if nobody loaded yet
So like you were saying just dont let ReadyToStartMatch return true until NumTravellingPlayers is 0, if its greater than 0 a player is still travelling
correct
Base is fine for a non match-like game design tho right?
Like a drop in drop out co-op
Hi, I'm using AWS gamelift to host servers for my game, I'm getting this issue where even when the AWS session is set to be 24 players max, it is still limited to 16 players by the engine, I checked the log when I tried to join a server that was at 16 players and it gave this error:
Warning: Network Failure: PendingNetDriver[PendingConnectionFailure]: Server full.
how can I adjust this number to be higher than it's default which seems to be 16
none Base gets better control over the flow at the start of the match
and just Base has no meaningful advantages
how do i replicate SkeletalComp->RecreatePhysicsState();
i have a quick question, so when i join a steam session i need to identify what pawn i am like a example is "I create a session and it spawns the player that player will now be pawn 0 and if someone new connects they would be pawn 1" so would do i get that info onto like a widget
like which pawn they are
I need some guidance, I have NPCs in the world that could be at different positions on seperate clients but always in the same position on the server. What would be the best way to go about collisions on these as the server and other clients would see a client passing through/being blocked by a the collision differently since they are not in the same position
Are you using the basic character/character movement component?
And are these NPCs replicated actors or actors you're spawning on the clients?
They are replicated actors, and yes the character movement component
Are you moving the NPCs on the clients only or moving them on the server?
They're only being moved on clients, but they would be moved separately for each client so they would mostly always be different for everyone
I didn't want to have to go with client auth movement if i didn't need to
You basically would have to. The server would register collisions differently than the client, so if the server doesn't think anything is there, it'll allow the client to continue walking which would cause corrections. Similarly if you walk into an NPC that you can't see on the client, then the server may stop the client from moving through it.
Thats what I was afraid of...
The question is then... Does the NPC need to be present on the server?
Like if only the client can see that specific instance of that NPC?
Yeah, it needs to be on the server. I could probably setup some proxy actors to communicate with but I think I'd still end up in the same situation
Yeah the collisions are the problem if they're on the client but not in the server copy.... I can glitchy-walk through an actor that exists only on the client, but if that actor is spawned on the server, it blocks me from moving forward, so it's the server receiving the client movement and playing it back as it sees the world causing the problem.
Guess I'll go with client auth movement then. Most everything is setup in a way that server does checks so even if a player decided to move themselves somewhere they wouldnt be able to progress. Just didn't want to go the client auth route if I didn't need to
I am trying to set up an aim offset. It correctly replicates from client to server, but not client to client or server to client. Aiming Rotation is a replicated varirable from my character, which just gets set to my control rotation.
.
Hello guys! Can anyone help me with a problem? Thank you in advance!
I have an Inventory which is an ActorComponent, and it has a TArray of UItem (UObject). The replication works almost fine, but there is an error when an item change its inventory.
I don't see any gameplay problems, I can move items from one inventory to another, everything looks fine, and that's probably because it seems that the error is not thrown by the server (I might be wrong) but the Client.
The error I'm getting is: LogNetTraffic: Error: UActorChannel::ReadContentBlockHeader: Sub-object not in parent actor.
I did some debug and I found that the 'OuterPrivate' of the UItem is not changing in the client. The server has the updated OuterPrivate.
When the item changes from one inventory to another, I use the Rename method with the new Outer.
// This is in the Inventory.cpp when adding an item.
Item->Rename(*Item->GetName(), this);
The only solution I found is that instead of changing the outer, I could duplicate the object. That 'seems to work' but I don't like that solution.
UItem* NewItem = DuplicateObject<UItem>(Item, this);
The replicated uobject on client always has actor that rrplicated it as outer
Regardless of what it is server side
id use FFastArraySerializers to replicate inventories
has few benefits, most notable is individual per item callbacks client side for add/remive/change
Entire documentation is in NetSerialization.h header
@icy marlin
@winged badger Thanks for your answer! Oh ok, now I understand why it happens. I will check FFastArraySerializers out! (The bad thing about it is "The downside is that you will need to have game code mark items in the array as dirty, and well as the order of the list is not guaranteed to be identical between client and server in all cases.", but I could add the position within the Item)
On the other hand, how can I fix this problem without duplicating the object? Or that's the correct approach?
yeah, you do add inventory index to the struct
i was never bothered by order of a fastarray
i generally don't have great confidence in the engine not to break doing stuff like rename
also duplicate object will not preserve the netguid
Would there be a reason why child actors get destroyed or not loaded in for the client on a seamless travel? If I play directly in the map its fine for multiplayer but on seamless travel, literally only some specific child actors near the client dont get loaded in. I even added a check in GameState for readytostartmatch and wait numoftravelingplayers to = 0 to start. For instance I am seeing logs on the actors that are failing to load in with following message -> [2021.12.18-16.40.16:619][345]LogNetPackageMap: WroteObject ChildActor1_GEN_VARIABLE_BP_LightCeiling_2_C_CAT_0 NetGUID <733>
[2021.12.18-16.40.16:619][345]LogNetPackageMap: Verbose: GetOrAssignNetGUID: Object is not supported. Object None. It seems like this is happening before the Matchstate has changed from waitingtostart to inprogress. I guess why am I seeing WroteObject (Object) Object is not supported being logged and not seeing it for client when everyone loads into match? IUt's interesting because it seems the ServerPlayerController has loaded in before these log messages, then the client player controller loads in after these log messages
Hi people I have a question :
If I create a multiplayer game and let people the ability to host their own servers so people could join (because I can't host the servers my self because it cost money, and won't use client hosting to prevent cheating and also I need the host to always be live so people could join and leave all the time) and my question is this : If I let people be able to host their own servers through hosting services (like in Battlefield 3), would people on Consoles be able to join those servers by typing the name of the server in the search bar?
Please ping me if any answer 🙂
Why doesn't this change the material on the host / server?
What type of actor is this on (like a character, or ...?) and what is calling these events?
It's just a normal actor. It's a gathering system.