#multiplayer
1 messages ยท Page 423 of 1
Steam for example doesn't implement this
Alrighty, thanks anyways, seems like it'll have to be a custom solution
@thin stratus it's probably something that's iOS specific then haha
Yeah
how do you set a dedicated server name? default is just my PC name and numbers
I feel like packet simulation in editor is not working fine. because my ping is 200 but my properties are replicated every frame :))
@potent prairie In a Session?
You have to set it via one of the Session Keys
That's only possible in C++ or via Plugin
@rose egret Well, technically, if it's steady 200ms, it's normal that you replicate every frame :D
just 200ms later
So the first 200ms should be "no replication"
But I guess you want to make sure to actually enable the packet stuff for clients and server
@thin stratus I mean I get OnRep_MyProperty on client every frame. how is that possible if ping is 200?
200ms delay
That doesn't mean your packages drop
It just means they come later
You are probably receiving old data
Just print the Timestamp for when you set and when you receive
And compare
how properties are replicated? if I change my var on server every tick will it sends several onrep by one packet?
No. Property replication is lossy
You're not guaranteed to get every change to a variable, especially if it changes quickly
ping != packet loss
@chrome bay I know that. but I am receiving on rep every frame on my client .
You will in editor, but you won't in a real world connection
Does anyone understand why there is a !bInRagdoll path in this ShooterGame function? Why would a character's mesh ever not exist? Or why would it already be pending kill when SetRagdollPhysics is called? Seems like there would be a better way to just guarantee that the character goes into ragdoll.
Looks like a safety net to kill the character immediately if the function were called from some unexpected location.
Right, trying to figure out where that unexpected location is. I think I'm running into this very rarely. But I haven't been able to reproduce it yet :/
Well you kinda never know if it's valid or not
Could happen that this is called while the world gets killed/map change or whatever
And suddenly it's pendingkill
And the second one just checks that the mesh exists and has a phy asset
Cause maybe someone does stupid testing without a mesh assigned
Who knows
If you work in a bigger team you kinda expect people to do bad stuff :D
That's why Setter/Getter public/private/projected exists
Yeah that makes sense. I'm just not sure if any of those checks could get hit in normal play. I'm assuming the mesh and phy asset one won't. But not certain about the IsPendingKill check. I'm not sure if there is some scenario where SetRagdollPhysics could get called on the client after pending kill is set.
Hello friends, a small question about multiplayer if I may!
I am making a 2D Fighting Game Template for Unreal 4, so people can make their cute 2d games.
I was wondering one thing. Can I code the netcode according to a dedicated server provider, so if they use that provider's servers, things would be way easier for them? -.O
PS: I have zero exp on how multiplayer works so sorry if it's too silly of a question ^^'
Can I code the netcode according to a dedicated server provider can you clarify?
I think the question is confusing because I have no idea how the netcoding works.
You see, I am planning my Template to have a netcode already provided so people can create their games if they want it to be a Multiplayer.
Alright, the short is don't worry about your server provider, dedicated servers are basically listen servers without a client attached.
But I don't know if I should code differently for different providers.
No
Ah, so in a very basic terms, a server becomes an Unreal 4 server that is open, and sending / storing data of games am I correct?
Uh
Sorry. ^-^''
Hm, for the sake of simplicity we'll assume you're using windows and deploying to windows. When you build your dedicated server you get an executable, just like the game executable, but stripped down to not include any rendering components.
A dedicated server is just a process, just like your game is
Ah, so people just join in and out.
I think you answered my question and I better check more about how dedicated servers work themselves, rather than asking more silly questions ^^
Thanks!
dedicated server is just a headless version of your game
If people want to run their own dedicated servers for my game, how do they set the name of their servers to whatever they want?
how am i able to get the player controller in a game instance?
I'm having a logistics conundrum. Trying to create dynamic locations. A location is an actor with actor components for everything that exists in that location. If I create several locations on a dedicated server, after a certain point, anyone that would join gets kicked out due to a reliable buffer overflow.
Clearly this has to be due to the sheer number of actor components that need to be replicated to everyone that joins. Is there a way to set netculldistance on actor components rather than actors?
how would i set up a Auto Team balance system through blueprints?
Check the number of players on each team, place the newly connecting player on the team with the least players?
ya you should be able to make a function like getSmallestTeam and have it do that logic and return the team with the smallest count
Trying to understand the data in the network profiler a bit better, does this value represent the number of properties being updated at this point in time?
if i have my player teams in Enum how would i get the number of each connected player in that team?
How can I make a widget that I can show to everyone?
@stable arch you would probably want a TMap of the enum and number of players
@swift topaz Well it says PER SECOND above it
an hz is basically how much per second.
219.4 hz means 219.4 Properties per second I assume
No idea what 0.4 properties are though :D
Also for a "Per second" basis, you either have what happened the past second or what happend per second based on the whole time
Think that depends on what data you've selected
Guys I'm going crazy! Everything was working great then one day if I run with a dedicated server in the editor I have stutter every second, strange behavior (like set actor hidden called on the server not replicated on clients), things not spawning on the client correctly. I was so depressed yestedday ๐ฆ and some hours before everything was running great!
Is there a way to limit visiblity of Actors or rather components in Splitscreen?
We have a 3D healthbar that orientates to the player camera.
That works well in Online situations as there is only one camera
But splitscreen has up to 3 cameras looking at one enemy
So it would need 3 WidgetComponents where each orientates to one player
However even with that, one player could see the Widget of another, cause there is no such thing as "OwnerOnly" in this setup
Only thing I can try is adding a widget into the PlayerScreen
tried making the HUD create it and manage it?
it won't work out of the box, but it is close enough, shouldn't be too much work required
Guys I want a little bit of direction. I have created an fps environment with a character and a gun. I just need a little bit of hint to how I should implement multiplayer and have two same characters going against each other. Sorry if I sound ignorant...
@rapid ice start by reading the multiplayer architecture, basically you will have two characters with movement already implemented (if they are a subclass from ACharacter), and you would need to implement stuff like Replicating shooting, replicating health, through Replicated Variables and RPCs
Is there a way to limit the amount of default properties needing to update when an actor is spawned in multiplayer?
Thank you very much @twin vault
Is there a way to get all replicated properties on an actor? I'm looking to modify them in the PreReplication override.
probably over TArray<FLifetimeProperty> @bold heron
its where i start anyways, the one GetLifetimeReplicatedProps uses
@swift topaz only replicated properties will be sent in initial bunch
rest of them will be pulled from CDO from the package
awesome. I was digging through UChannel to see how it did it ๐
219.4 properties for 1 actor spawned in initial bunch seems a bit odd
any non integer number of properties seems a bit off ๐
for 1 Actor
besides, 1 Actor won't send bunches more often then its NetUpdateFrequency
or FPS, whichever is lower
I thought that was the thing as well
The network profiler however, is making me doubt things, or I just don't know how to interpret the results properly
Ran a dedicated server with 1 client via PIE and did a short capture for spawning 1 actor, which gave me that spike of 219.4 properties per second being modified at the exact spawn time
yeah, but 1 frame can throw those off really bad
then your actual number of replicated properties is 219.4 * DeltaTime
so be careful when dealing with intervals of under 1 second
Gotcha
@winged badger I'm looking at FLitetimeProperty and don't see how it converts to a property I can do something to. I can get it's RepIndex but that has to associate with something somewhere.
there is a TMap of RepIndex to something.... somewhere
sorry, haven't dived into that
comments in NetSerialization.h do explain how those work
awesome thanks. I'll look into it more. All I need is a direction and I'll chase the lead.
as a bonus you get a crash course in FFastArraySerialization
Evening guys
Question
Any idea why, when I set up custom spawn point it rotates server but not client? It teleports and everything is ok, but rotstion makes problem
I found that an actors world rotation was not marked as replicated in code.
@dusty halo
relative rotation was though (if I remember corectly)
you could also multicast from the server to the clients to update the rotations
@thin stratus can u send me some code that u used to make a widget show for everyone?
@bold heron i guess I found and issue. Only now need to figure out why. So I have BP that rotates player to camera direction. If I turn it off I can rotate player in a direction I want, but still camera stay at wrong dirrection.
So basicly I need to find a way how to replicate control rotation
Becouse if I play as server, everything is ok
@copper portal I don't have the time to create a code example.
If you are getting all Actors of class and call a ClientRPC on that, then this should work.
It only depends on WHEN are you calling this. And I think you never showed where/when you call this.
good morning lads !
I've got an issue with the new Studio template, "Multi User Viewer", somehow it looks like clients can't see servers and vice versa
this is regarding matchmaking btw, not once a question of "players can't see eachother in the scene" :p
join over ip isn't doing much either
right so it seems like LAN with two exes running on the same computer is working at least
Muticast RPC with const MyStruct& param is empty on client. but valid if I remove the refrence. why? isn't it a bug?
``
USTRUCT()
struct FPathMoveRepPath
{
GENERATED_USTRUCT_BODY()
UPROPERTY()
TArray<FVector> Positions;
UPROPERTY()
int Size;
};
UFUNCTION(NetMulticast, Unreliable)
void CastPathMovePath(FPathMoveRepPath path); //this one works well
UFUNCTION(NetMulticast, Unreliable)
void CastPathMovePath(const FPathMoveRepPath &path); //path is empty on client side
``
Hey guys! Is it possible to add one more client while using PIE?
you just enter the number of players from play menu
@rose egret pointers are not replicated as memory addresses, but as NetGUIDs
structs don't have NetGUIDs
@winged badger I know that but its a const refrence to a structure. UE4 must know that :)
Not using refrence will copy my object which has lots of data in it
as far as i understand it, you actually need to copy something from the stack to send it
anyways, if you are sending it over network isn't the overhead of local copy the least of your concerns?
btw as far as I remember UE4 force u to use & for FString and TArray when used as RPC parameters
@winged badger I need to add player while i'm playing, not before
@winged badger I send nearly 200 byte every second by one muticast rpc
one more thing. its NetSerialize doesn't get called ๐
๐ฆ
that is a little bit odd
i know it goes to UNetDriver::ProcessRemoteFunction()
can't say i've ever read it
heya folks, so I know the controller only exists on client and server (doesn't replicate to other clients)... I'm curious if the server's controller also exists on clients? Or is there only one instance of the server's controller among all machines? I'm trying to create a reference to the server's controller, so I can check "is this the server's controller" before doing things, but not sure I'm conceptualizing it right
@wary wyvern if you launch the game from the project file use join 127.0.0.1 (console command with ~), if it's someone else on another PC, I know they can launch from project file (I think PIE might work for them) and they need to join YOUR+IP, you also might have to find your server PIE window and open MAP-NAME?listen, then use the join commands on your other PIE windows to reconnect
Anybody used the Min Net Update Frequency? Any real life scenario when it has been useful?
anyone have any idea why my pawn collision moves in single player, but not in multiplayer?
the collsion channels and physics are all set correctly.
but the line trace will hit the ship in single player, but in multiplayer, it will ONLY hit the original location of the ship, but not any of the updated positions.
When you first join a multiplayer game as a client, you go through the PostLogin on Hostside which then (at least in the shooter game example) sets up your spectator camera position on your Player Controller.
2 questions about that:
- Does it spawn the game mode spectator pawn? Or does it use something else?
- When ending a game and seamlessly travelling into the "next match" I don't believe the client player goes through the PostLogin function (as they are already logged in from before). So how do we change their pawn/set their spectator location?
@slate veldt
- Yes it uses the same spectator pawn that is defined in the GameMode available on the server.
- If you plan on starting a new game, Epic recommends not using Seamless Travel as it keeps several pieces alive (such as a character), if you rather use Seamless Travel, then you will need to do your own logic to reload a player's relevant state and pawn
Does anyone know if there's a way to figure out when a client has finished acquiring all replicated objects after connecting to a server?
Steam forces you to use Seamless Travel (in case you use it)
- Epic also says Seamless Travel is desired
You can use "OnSwapPlayerControllers"
As well as things like "InitNewPlayer" or whatever the function is called
That's called for both forms of Travel
I was just going off of the documentation I read at https://docs.unrealengine.com/en-us/Gameplay/Networking/Travelling
Since they mention the following there
Didn't know steam forced seamless travel though
Good to know
Hey i try to save my playerdata
In my gamemode on EventEndPlay a loop for each playercontroller and try to get the characters of it but the are already destroyed ?? how could i fix that ?
@swift topaz @thin stratus Thanks and thanks ๐ Seamless travel is preferable where possible, both for a smoother experience + the fact we're a VR game so I would like to avoid absolute as much as possible.
I'm aware there is a VR splash screen, but I want to utilise this as little as possible, it sorta feels like you're pulling them out of the immersion everytime you use it.
I gotcha, use case always counts :p
if the host of the listen sever disconnects how would i go about making it switch to next player as host?
to get the next player you can use the get player array from get game state and get a copy of the first player in the array
I dont know how to switch the player to host
did u use google yet?
for switching hosts?
use google for switching host?
has anyone dealt with this error before? :
Network Failure: GameNetDriver[NetDriverListenFailure]: SteamSockets: binding to port 7777 failed (0)
im trying to create a lobby using the steam subsystem. Ive made 3 diferent projects and I keep getting this error in th log that cuase the lobby to crash
@stable arch I don't think there is any built in support for host failover
@slender yarrow that sounds like something else is bound on the port
run cmd.exe as administrator and type netstat -a -b
and find what is bound on 7777
might be a firewall thing too
@fringe dove i got it. Was some setting i left out in the DefaultEngine.ini regarding the steam subsystem
thanks for the reply
@swift topaz I think "When you want to end and start a new one." Is a bit vague. I read this as disconnecting from a server and connecting to a new one.
Not when moving on the same server from map to map ๐ค
built-in's UE4 can create MMO game?
@covert garden Maybe now that there is access to the Replication Graph.
But def not if you are staying in Blueprints.
Doubt that even 100 Players would work with BPs only.
In multiplayer game, when client crashes, server does not handle it and player state stays there for some time. Does anybody know, where is this timeout for removing player state, or how to check, if player disconnected by crash?
Oh, thanks)
If player quits manually, it sends some sort of request, so player state removes instantly. But in case of crash, there is no requests and player state lives for some time. I also check server crash manually on client side (just in case ๐ ), and i know there is built in checks on server side, just did not know where timeout is.
Is ALT+F4 a crash or a manual disconnect then though :P
Manual
@thin stratus Hm, I'm cannot find this settings.. Is it in gamemode? Because I do not have this one
Yeah it's in the GameMode
What Parent Class do you use
And what engine version
(even though that should be in most of the engine versions)
Parent is AGameMode, 4.20
Hmm, I see it in source files, but it is hidden in editor despite the EditAnywhere UPROPERTY flag
But it is still there in sources
@thin stratus No such option in 4.19 as well..
Okay, I found the problem. My gamemode was AGameModeBase, not AGameMode %)
That's why I asked hehe
Hey all,
Following seamless travel, our clients are sat with a black screen until the next match starts (we switch to inprogress)
Can anyone think why this might occur?
Sounds like no PlayerController?
Ah, you think it might be getting destroyed during seamless travel and then recreated upon game start?
Well usually you have 2 instances
OnSwapPlayerController gives you the old and the new one
Cool I'll investigate
Can I hide a mesh based on ownership in splitscreen?
Seems like OwnerOnlySee also hides it for the actual local player owner :/
Calling "CreatePlayer" and then "RemovePlayer" doesn't let me call "CreatePlayer" again
gg
I mean, it does call, but after that I don't get the splitted screen anymore
probably rendering issue?
I mean, probably a minor oversight on engine side to make sure to create the split screen again if player gets added second time
Probably. I also get an issue when with the camera of spawned ones if they aren't in order
e.g.
CreatePlayer->RemovePlayer->CreatePlayer(doesn't do shit)->CreatePlayer(camera at wrong place and doesn't possess pawn)
So each player can only be spawned once and has to be spawned in order
Even when using -1 as index (so it assigned itself). Weirdly enough another "CreatePlayer" call works then again
But as soon as I remove one player I can't readd
issue with the player array perhaps?
if it inserts the new player instead of adding it, I could expect that kind of behavior
Actually, i just addsUnique
And it also doens't fail any test
Cause I get a PlayerController in the outliner
It's not possessing the pawns again after getting recreated
Handling the Possess myself now
Seems to fix it
Guess AutoPossess is broken
There is still a bug though
It works all fine like this, but if I call the same code for Possessing offset, so first for player 3 then for player 2, player 3 bugs out
So the order of possessing a pawn seems to be important for splitscreen players
Player 2 needs to have a pawn before player 3 o.o
Strange enough it doesn't cause any issues when doing it in the gameplay level
So I'm not sure if I do something wrong
Im trying to use VaRest plugin to send data from ue4 to a database and i've been watching these tutorials: https://www.youtube.com/watch?v=CEQ860h4rKA the only issue is I cant seem to figure out how to send data from ue4 to the database, only how to retrieve it. Anyone know of any documentation or tutorials on how to go about doing this?
This tutorial has been made to show everyone how to make a full online system and game using UE4 Donation Link for the channel : http://tinyurl.com/WazzaFund...
I used VaRest a long time ago and am a bit rusty with it, but the concept behind sending the data should be the same as in a regular http request via the IHTTPRequest. Create a post request and add your post fields to the request then just target your php script and retrieve your data.
Hey guys I got an issue with my HUD Widget. It works until the 'Server' character dies and respawns then none of his health and other variables display on the HUD. Clients can die and respawn and everything works but Server doesn't Here's how I setup my HUD and what It looks like when I respawn: https://i.gyazo.com/a3a53dcd4b018c42354e4d1784d26300.png https://i.gyazo.com/3556f510e53a1e4853df2664fa21b554.png
I set the ThirdPerson Character to the variable 'OwningPlayer' that way I can easily reference the variables for health, stamina, etc for my HUD stuff
@cedar finch Does that mean you fixed it?
Cause otherwise the error is pretty easy to explain
@thin stratus I didn't fix it. I'm open to any suggestions
Well you are creating the Widget once at the start I assume
@cedar finch
So when you Player dies, the "OwningPlayer" is getting cleared
Cause well, you Pawn is destroyed, so it doesn't exist anymore.
The Contruct won't be called again, so the Variable stays empty
What you can/should do is use teh "Possessed" event in the PlayerCharacter
Call a CLIENT RPC on the passed PlayerController
And in that ClientRPC you get your UI again and update the OwningPlayer
I was thinking the same thing but how does everything work for clients when they die and respawn? Server player doesnt work but clients do. It's wierd.
I didn't have this issue until I started using a BASE character with all my variables and code then using a child actor as what players actually play as. That's where my old respawn system stopped working. I think I may need to redo my respawn system
I handle everything in my Thirdperson player controller and gamemode. IDK if child actors use the same player controller or not
@thin stratus @cedar finch AController::SetPawn(APawn *InPawn) is a conventient function to override
its called from both AController::Possess() and AController::OnRep_Pawn() and is virtual
@winged badger I still havent started to learn the code side of things I'm still wrapping my head around blueprints lol. I'm trying to follow cedric_eXi's instructions but can't figure out how to get it working yet. It makes perfect sense I'm just slow
I guess my struggle is where I'm supposed to handle the respawn and the creation of the new HUD. I have my character, my controller, and my gamemode. Inside my character I tell my controller to create the HUD on the owning client. Then when I die I call the respawn event inside my gamemode which should create the HUD the same way as before right? But I can't get it to work for both client and server its always one or the other. ๐
You only need to create the HUD once
Either in your PC (BeginPlay, filter by LocalPlayerController), or in your HUD.
The thing you need to do is keep your PlayerCharacter reference valid
You are setting it once at the Start, which is not enough, as the Player can die.
So you have to update it when the Player gets a new Pawn.
The Client RPC is already a good start
but you want to simply update the HUD instead of creating it again
(specially since you are probably not removing the HUD or?)
I spawn and attach an actor to my vehicle in multiplayer but after driving a bit, clients see the actor disappears but the server continues to see it. No idea what could possibly cause a bug like that, the attached actor isn't simulating physics and it's attached to a non-simulating scene component inside the vehicle. Any ideas? ๐ค
how frequently do reliable channels check for missing ack before a resend? do they use some estimation of half-RTT? anyone know where in the code to look?
@fringe dove I think that's handled in the MessagingRpc module, but not certain.
MESSAGE_RPC_RETRY_INTERVAL is the macro that defines how long to wait before resending it looks like.
@sharp pagoda thanks!
/** The interval at which calls are being re-sent to the server (in seconds). */
#define MESSAGE_RPC_RETRY_INTERVAL 1.0
damn, and it is big
@sharp pagoda ah wait, I might have asked the wrong thing
messaging rpc isn't the same as actor channel rpcs is it?
I think it is...
It's been a while since I've look at the message bus code, but I'm pretty sure RPCs construct net messages.
not completely sure, but I think it is for that message bus thing
oh ok, I thought that was totally separate
hmm
Yea it does use the message bus, but I thought the message bus sent out to the net driver. Would have to go digging for that though
EngineMessage module is for the non-networked message bus I think
yeah I just think actor channel stuff is still separate from the networked message bus too but could be wrong
I've just never ended up in there when stepping through actor rpcs in the debugger
Oh man I have a stack trace I think I saved which has the whole RPC process laid out
The online subsystem util's TickDispatch() is the first place to handle incoming RPCs, so working backwards from that should show if it uses the message bus or not.
ProcessRemoteFunction() is in NetDriver
I think what I'm looking for might be here:
void ReliabilityHandlerComponent::Tick(float DeltaTime)
{
const float CurrentTime = Handler->Time;
if (CurrentTime - LastResendTime < ResendResolutionTime)
{
return;
}
LastResendTime = CurrentTime;
// Resend UNACKED packets
// We resend all packets just to make sure
// This is very inefficient and wastes bandwidth, we will want to implement NAK version at some point
for (int i = 0; i < BufferedPackets.Num(); i++)
{
found from this part of UNetConnection::Tick:
// Tick Handler
if (Handler.IsValid())
{
Handler->Tick(FrameTime);
// Resend any queued up raw packets (these come from the reliability handler)
BufferedPacket* ResendPacket = Handler->GetQueuedRawPacket();
seems to be hardcoded to .1, that seems inefficient for >100ms half-RTT connections
mentions some stuff about naks though and I'm not sure how that plays into it
then again, engine doesn't spam reliable RPCs
there would also be other acks coming that could stand in for the dropped ones
if you are sending a lot of data
so it would only happen on sparse reliable rpcs and they aren't a big bandwidth concern anyway
assuming it is per net connection and not per actor channel
actor channels do not send data directly, only net connections do iirc
they do make FOutBunches
but NetConnection will only send the relevant ones
and reliable ones
regardless of relevancy
I would like the ability to peek at reliable RPCs that arrive out of order or after a drop
cause in some cases I can fill in the gaps using the future one
/**
* Interface for RPC calls.
*
* Every time an RPC call is made, a request message containing the call parameters is
* sent to the remote endpoint. While the remote endpoint is executing the call, it may
* send back progress updates in regular intervals. Once the call is complete, the remote
* endpoint sends a response message containing the result.
*/
class IMessageRpcCall
so now where does MESSAGE_RPC_RETRY_INTERVAL come into play in all of this? ๐ค Is the MessagingRpc module used for sending cross process messages, not network messages?
I think it is for cross process stuff
but can be networked also
mainly used for things like distributed lightmass, but not used in game networking
they used it to make an ipad control a desktop for the mcclaren demo thing
Interesting, sorry for misleading you a bit haha
not sure MessagingModule works without debug build
np, I'm still not 100% sure on that, and I'm going to need to look into the message bus at some point for some other stuff
@fringe dove give the GameplayPrediction.h a read
starts with few hundred lines of comments
might find some hint there without the effort of digging through the source
@winged badger cool, I'll check that out
@thin stratus I am removing it but I guess I can just Hide it by changing it's visibility when a player is dead and spectating. Then I can make it visible when they respawn. I can't figure out how to set my new character reference in my HUD widget though. Once I respawn the player inside my gamemode, how do I set the 'OwningPlayer' variable inside my HUD widget? I can't cast to it can I? So I guess I'll have to use a get all widgets of class and somehow set it inside a foreach loop or something.
Hi everyone. I'm having a problem with actions being performed quickly on newly joined clients. My guess is that everything hasn't fully finished replicated, in this case, Controller via GetController(). The problem is I'm having trouble checking to even see if Controller is valid or not. IsValid or checking against nullptr doesn't seem to work. I'm hoping there is just a mechanism I'm missing for being able to check to see if a variable has in-fact been correctly replicated, or at least not have Controller default to a non-nullptr value. Thanks ๐
what I'm trying to call out of interest is GetController()->IsLocalPlayerController() to determine if the actor (character) is locally controller for some logic, though checking the result of GetController() beforehand using either IsValid or != nullptr. no dice ๐ฆ
@cedar finch Well I kinda already told you how :D
Assuming your Widget is created and stored in the PlayerController:
In your Character, "Event OnPosessesed" -> ClientRPC on passed PlayerController Reference -> In that ClientRPC, get the Widget Reference (as said, assuming it's created and stored in your PC), and pass the "GetControllerPawn" over to the Widget.
And if you really can't figure it out, just poll the "GetPlayerCharacter0" in your binding for now (make sure to check that it's valid).
And only try to improve this if you notice performance issues.
@thin stratus Thanks for your help. I get what your saying and I've narrowed down my issue to my respawn system. It doesnt work right all the time. So sometimes you respawn and sometimes you don't and sometimes the hud works and sometimes it doesn't. Your explanation does work though sometimes when the player respawns correctly. If you know of any guide on server/client respawn systems, maybe with spectator pawns and stuff please let me know. I'm struggling to find proper respawn systems. Everyone cops out and just teleports players and resets their health values or doesn't replicate it for multiplayer.
Well, the main thing people don't realize is, that UE4 has a Respawn System Build in
But I'm not sure how much that is exposed to Blueprints.
But in general, you should be able to call "Respawn" or "Restart"Player either on the PlayerController or the from the GameMode.
And that should respawn the Pawn that you setup in the DefaultPawnClass of your GameMode.
In case you can't use that or it's not exposed, what you usually do is:
When the Pawn dies (that happens ServerSide), you tell the GAMEMODE that the person died.
Here you want to pass the Controller of the Pawn that died.
E.g.: (In the Pawn) OnDied->GetGameMode->OnPlayerDied (passing "GetController" along)
At this point, the Pawn still exists, and is possessed!
Now in the GameMode, to make it easy, you can first get the "ControlledPawn" from the passed controller and Unpossess, as well as Destroy it.
That way you get rid of the old pawn.
After that you can call "SpawnActor" for a new Pawn and call "Possess" on it again, still with the passed controller.
And that's it. That's the most basic respawn system.
@cedar finch
yea
I'm reading through it all. Thanks man.
Ok so Is this what you mean? Because I get the same wierd thing I had in my other respawn system where only one player respawns even though he's not even the one dying. Here's my thirdperson player character's health/death and then my gamemode: https://gyazo.com/1f4a2f21dc836f3045f5e583b390e0fd https://i.gyazo.com/1bbf78b8cf246e245584841e3617b7c1.png
my problem is: Server shoots Client and kills Client. But Server respawns and client is unaffected. Same if I run as dedicated server. Client 1 kills Client 2 and Client 1 respawns. If i do the opposide Client 1 still respawns.
@thin stratus It's 4:20 AM so I'm gonna call it but I'll be working on it tomorrow. I appreciate your help.
One big issue I already see is that you call an RPC on the GameMode
The GameMode doesn't exist on the Client
- you code for dying should already be on the Server
I assume it is on the Server, so with that you don't have to make the Event an RPC
and in addition, you are using "GetPlayerController0"
Remember, you are on the server
this is always the servers controller
you need to call "GetController"
Which gets the controller of that pawn
That's a big difference!
Ahhh I see. whoops.
So you basically always say atm "Someone died, respawn the Server-Player!"
So my player health should be inside gamemode and not inside thirdpersoncharacter?
Noooooo
Leave it in the Character
Just swap out this "GetPlayerController0" with "GetController"
And don't make "OnPlayerDie" an RPC
hahaha ok I knew it didn't go in gamemode, just messin with ya. So I changed it and it works perfect. Thank you so much. I'll sleep better tonight knowing I got the basics done today
Hello guys this about 4.20 Multiplayer Map node. I painted for easily:
Whats wrong ?
Its reading "skill name" but cannot read map directory node...
i mean. working only client 1-2-3 floats from found integers.
But why not work send to server same details?
The architecture is wrong
Server should send values to the client, not client to server
As everywhere and everyone says: never thrust a client ๐
eh true but there no other way ๐ฆ
The client should be just like a renderer, just render the things, play particles and sound effects
The server should do all the logic, physics, collisions, etc.
Should be
other way
i tried other ways but worked only client the GET HUD node ๐ฆ
can u give me some tips?
@bronze arch Can you be specific with your actual issue, instead of some image which is incredibly hard to understand.
err. i doing kovenas ideas, i cant find another way. Anyway thanks.
@thin stratus I changed the code a little but it shows only for server and the widget doesnt disappear. What I have done is in the tick event of my character bp, I cast to gamestate, grabbing 2 different booleans for hiding and showing the widget and I use branches with those booleans to check if they are true. If they are true, it should show the widget. The bools in the gs are set in the gm when I run an event that executes every time a player is killed. At certain points, I set the booleans to a value. It still doesn't show for everyone but it does show for the server except it doesnt hide the widget. Here is my code: https://gyazo.com/ff0a28ae5137e95b610a27b72f174d2e https://gyazo.com/481c8149fa6ebd2aeac52d10492d58da https://gyazo.com/d9e5b39dd08ac4a49fd6db1269dbaa62 https://gyazo.com/24d5be0de5c136fa83eec8eb01a20b01
are you sending a client rpc from the server to the client to show the Widget?
you have a lot of bools and it looks like you are fighting the system
why not?
you made that 5 times more complicated then it had to be
at least
and its not working, apparently
not to mention, every client and server knows when a player died
so you have no need whatsoever to send anything over network to show widgets
3 classes are involved:
PlayerCharacter, which grabs its local GameState when it dies
(on all machines, so OnRep_Dead, or whatever you have to drive the "Death State" does this part)
GameState has an EventDispatcher with PlayerCharacter input on it
when player dies it grabs the GameState and Calls that Dispatcher
your HUD class binds an event that shows the Widget to the GameState's Dispatcher
cuz I dont know what ur talking about
result: when players boolean Dead is set to true
Widgets are shown automatically
as for closing them i do not know what conditions for closing them you had in mind
and we are talking less then 15 nodes for the entire setup here
EventDispatcher is an object
that other classes can... subscribe to
by Binding their Events and/or Functions to it
whenever the EventDispatcher is Called, it will Invoke Every Function and Event subscribed to it
step 1: in your GameState add EventDispatcher (its added similar to variables, below them)
name it and when its selected (like a variable on the left hand side) you will have its Details Panel right
add an input of your PlayerCharacter's Type
step 2: in your PlayerCharacter, i assume you have a boolean Dead which is replicated
set its replication to RepNotify, then edit the automatically created OnRep_Dead function
in it GetGameState->CastToYourGameState->Call<event dispatcher you created>, passing a reference to Self in the additional pin
step 3: in your HUD class, on BeginPlay, GetGameState->CastToYourGameState->BindEventTo<that same dispatcher>
from the red square pin on the node, drag and create CustomEvent
connect the CreateWidget node to it, and save the result as a variable if you even intend to close it later
all done
would someone be willing to spend a few minutes to help me understand how to get the basics of a top down twin stick shooter working for multiplayer? i've managed to get two players to connect through steam and their basic character location is replicated, but i'm using a 'look at rotation' between the player character and player mouse in order to set the rotation of the character mesh. i have a video if that helps
Ohh.. well i found problem i researched this about: https://media.discordapp.net/attachments/221799385611239424/500662355819102208/confused.png
"TMap Variable replication doesn't support". Hell yeah, wasted 10 h.
Yikes! i thought fixed up to 4.20v
YAMETEEEEEEEEEEEEEEEEEEEEEE 
@winged badger thanks for providing steps for me. I will try it now
but I have a isDead variable in my playerstate which is used for respawn system
so should I use player state boolean or create another boolean in character bp and just replace the playerstate's isdead bool with the character's?
Xpost from #blueprint
I have an interesting issue. I have a multiplayer game with no voice setup....When I host, we play through the game, and I seamless travel back to lobby, people can hear me through my microphone. Any idea how thats possible?
@copper portal https://gyazo.com/40d520e9dd2eefc236a050ca65e60e68
using clientrpc works fine for me
https://gyazo.com/cf10dc98de88eac12d7c722a7ae0caa7 < this on PlayerController
https://gyazo.com/e5652f0493d411d7eaff0390ea2c67a9 < this on GameState
https://gyazo.com/3e2e778ce678fd0907f6d8d97e23fb06 <- this for overlap
Ok so I was getting help with this yesterday but couldn't figure it out. So I'm trying to make my player HUD variables work again after respawning. The health and other variables come from my Thirdpersonplayercharacter. And my widget sets the thirdpersoncharacter as its "owningPlayer" variable in order to retrieve all the variables for the HUD. So when a player dies I need to update that Owning player to my new thirdpersoncharacter that I spawned and possesed. I get the logic but I can't get my code to work. Can somebody take a look and help me out? https://i.gyazo.com/0430475366d5b5d5a0c40a4415571a13.png https://i.gyazo.com/1f72fe471f7ce2f900689b683cfd7cb6.png https://i.gyazo.com/6bb767c31953d9c3539785f329b3d983.png
HUDWidgetRefrence is probably invalid
could you not destroy the hud and recreate when re-possessed?
Yea I did that and it works but the HUD is a widget so it never really gets destroyed it just stays in memory and gives me a bunch of errors saying 'pending destroy' or something
also owning player should be a controller should it not?
i thought controllers show own the widget
should(
should* ffs lol
any reason why your changing to the character?
Are you talking about inside my PlayerHUD widget?
yeah or is that your own variable?
I made a variable called OwningPlayer in order to easily access health and other variables inside my widget
i would rename it OwningCharacter cause it sounds too much like the Widgets Owning Player
have you stepped through to see if the function gets called
Hmm so i just did it and It fails
works fine for me
can u call me so I can share screen or something
so then I can show you what I did
and see if you can catch any mistake
It fails at step 1 https://i.gyazo.com/39892a570ab31be95da5ca2699883bda.png
So it won't run with the breakpoint. I've never use it before so maybe I'm soing it wrong.
It passes all 3 steps when the game starts
But stops at step 1 when respawning
@meager spade last night cedrick_exi told me how to do it but I haven't got it working yet. Can you tell If I followed these instructions right? "In your Character, "Event OnPosessesed" -> ClientRPC on passed PlayerController Reference -> In that ClientRPC, get the Widget Reference (as said, assuming it's created and stored in your PC), and pass the "GetControllerPawn" over to the Widget.(edited)
And if you really can't figure it out, just poll the "GetPlayerCharacter0" in your binding for now (make sure to check that it's valid).
And only try to improve this if you notice performance issue"
where is your client rpc?
client rpc means marking the event as Run on Owning client
i dont see that anywhere
Well I changed the 'UpdatePlayerHUD' to rpc but it still does the same
I'm not sure why it won't get past step 1 when respawning
This is basic game stuff why am I struggling to get this crap working. ๐ฆ
did you check to see if the character was null or invalid
like put a break point and see what the value is?
instead of using text logs
I'm watching a video on breakpoints. I've never used them before
fundamentals of blueprint debugging
This is a nice feature.
So when I try to respawn the "get Controlled Pawn" is not working https://i.gyazo.com/f10618e27dd02c2086712b6225910015.png
exactly pawn is null
the bp event is probably called before the controlled pawn variable is set
put a delay of .1
before the cast
see
what happens
@cedar finch ^
@meager spade OMG that made it work! Wow I feel stupid now. But I'm still getting a million errors when a player dies about the PlayerHUDWidget. ???? https://i.gyazo.com/f898c32dd70c347a589ca5a3d5727ee4.png
@cedar finch are you running something in the UMG that references the player?
on tick
Not that i think of. I just get the values from my owning player which is my thirdperson character. https://i.gyazo.com/bea86caee7b7b8028668c9baf0353dfd.png
So I fixed it all and got it working. I had to put an "isValid" node inside every function in my Widget. That fixed all the errors. ๐ Live and Learn. Thanks for all the help guys I love this Discord everyone here is so nice and helpful.
in multiplayer dedicated server "access none try to readproperty hudref"error showing.. when i pickedup the item it will be added to my player inventory and also it shows in inventory widget bt i m still getting this error in client side when i come out of the play mode but in" listen server"server side no error...only in client side i m getting this error but its all working...
Dedicated server 2 client... whenever i pick up an item" error is showing after i come out of the play mode"but it still working adding item to my inventory and widgets
Anybody help...thz in advance
Hudbp "hudref none trying to read property" in bpinventory
Is that necessary to replicate hudref
Hudref is only for client
Why should i replicate that
well where are you setting it
Hey, I am using Steam in ue to get the multiplayer, its working and all, but my problem is that only the host can move, but the other player cant. Can anybody help? Thanks
Hard to help you on that
Umm why?
Presumably, your implementation of movement doesn't work in multiplayer
Nothing to do with Steam btw
Its nit only the movement, when I try to use the mouse (for example, to shoot) it doesnt work either
Well, its using steam servers isnt it?
It only does the matchmaking, and hosting is up to you after that
That's why it's called a host
Well, you tell me
Well that's just embarrassing.. Can I use this multiplayer if I gonna release it on itch? Or it gotta be on steam?
That's why Im getting 242ping๐ค
You can either have your own servers and ensure you have enough for your player base, or not have dedicated servers and let players self-host
Which would only be suitable for non-pvp, < 8 players
Dunno, just saying this is a thing. PVP for a first game is a shit idea anyway
You'll get hackers in hours
you just need to learn a lot more stuff about multiplayer and networking. Like all of us did and most still do^^
You don't care about your game being unplayable ?
I mean, I wanted to do something a lot different, but it seems impossible to me so..
if you prefer the word Cheaters, it applies just as well
Anyway, my 2 cents multiplayer is hard, competitive multiplayer is harder, large-scale multiplayer is not possible for indies
~
Also, MP-only isn't possible for indies because of low sales
^
You're bound to get 5 online players on average
5 will be amazing
Its my first game ever
(not my first, my first to me publicly released)
5 would be a game that sells more than average on Steam, which isn't a high bar, but well. Anyway, just saying, here be dragons ๐
Mp is easier (except for programming the mp haha)
Because you dont need animations to the story
MP is 5x harder to code
You dont really need a story
You dont need voice acting
You dont really need a lot of models
Well, that's your opinion
Yeah
You don't also need a story, VA, lots of models in a SP game
We definitely have none of those
It's not a shooter
With a story..
Unless its sandbox
I did thought about an idea, a sp game that's actually not shooter (lol I barely even PLAY something that isnt shooting)
Anyways, Thanks
I got to go, goodbye :)
hey guys how do i get a car to work on a multiplayer project because im not to sure if its multiplayer related because when i click the key to enter my buggy my character doesn't posses the buggy and i can't use the buggy and my character can't move and when i jump when its glitched or what ever it is i fall through the map
Heya. issue with steam integration. (advanced steam sessions plugin). It all works well when launching as standalone game from editor (eg: overlay, playername, and creating/hosting a session all good), but if I package (dev or shipping, no difference), steam doesn't seem to connect (no overlay, no name, host session button that works otherwise, does nothing). Any ideas?
@gusty lily make sure next to the game.exe you have the appid.txt with your steam app id
Thanks @loud mountain . This looks right, right?
yes
Hmmm. It must be another issue.
hmm is your project a code project or blueprint only?
blueprint only
do u have the steam stuff setup in your DefaultEngine.ini?
i have had issues not being able to open projects after including c++ :/
yes I have, let me paste it in
this is in the project's config folder's defaultengine.ini - it's not present in the packaged game config folders.
[/Script/Engine.GameEngine]
+NetDriverDefinitions=(DefName="GameNetDriver",DriverClassName="OnlineSubsystemSteam.SteamNetDriver",DriverClassNameFallback="OnlineSubsystemUtils.IpNetDriver")
[OnlineSubsystem]
DefaultPlatformService=Steam
[OnlineSubsystemSteam]
bEnabled=true
SteamDevAppId=480
hmm
ps I'm a total noob at this.
mine looks like this: https://i.markusort.com/i/5bc3b922.png
maybe it is the "SteamAppId" without Dev
Right. I did enter that line. Somehow it's not there now. will repackage
no luck there.
is the steam plugin enabled too?
heres my complete DefaultEngine.ini: ```[/Script/Engine.GameEngine]
!NetDriverDefinitions=ClearArray
+NetDriverDefinitions=(DefName="GameNetDriver",DriverClassName="OnlineSubsystemSteam.SteamNetDriver",DriverClassNameFallback="OnlineSubsystemUtils.IpNetDriver")
[OnlineSubsystem]
PollingIntervalInMs=20
DefaultPlatformService=Steam
VoiceNotificationDelta=0.2
[OnlineSubsystemSteam]
bEnabled=true
SteamDevAppId=XXXX
SteamAppId=XXXX
GameServerQueryPort=27015
bRelaunchInSteam=false
GameVersion=1.0.0.0
bVacEnabled=0
bAllowP2PPacketRelay=true
P2PConnectionTimeout=90
[/Script/OnlineSubsystemSteam.SteamNetDriver]
NetConnectionClassName="/Script/OnlineSubsystemSteam.SteamNetConnection"
I seem to have the same settings, but I don't include as much un the subsystemsteam section
i only have [OnlineSubsystemSteam]
bEnabled=true
SteamDevAppId=480
SteamAppId=480
I'll see if it makes a difference
I've never used the plugin there so I don't know if it does its own kind of initialization
Another weird thing that might be connected, is that I can't access console from the packaged builds, while I can from launching standalone
oh wait yes, I can access with a dev build. but no steam still
any logs?
they didnt mention steam. will double check
oh. yes. LogModuleManager: Warning: ModuleManager: Module 'OnlineSubsystemSteam' not found - its StaticallyLinkedModuleInitializers function is null.
u sure the plugin is enabled? (the OnlineSubsystemSteam one)
i'll check that.
I have the advanced sessions plugins in the project folder, enabled, and the online subsystem and steam subsystem plugins are enabled for the engine
ill re-enable and restart and see if that affects
try adding PollingIntervalInMs=20 to your ini under [OnlineSubsystem] if that doesnt help
now i'm getting build errors, after having disabled. re-enabled the steam related plugins and restarted. i think this is related to a previous attempt to install ue4 source. the log noted in the build error includes reference to a folder that isn't there - there is no d:/build/
it's getting hairy
wait you get try to rebuild from source because of the advanced sessions plugin?
at some point i believed i need source to run dedicated servers. now i konw i can do p2p without it, but the fact is i installed it
oh well for dedicated servers yes, but steam in game should be able to run on binary.
I guessI have a new question now. thansk for your help man ๐ it's possible that I've fixed this issue, but won't know until I've resolved the other one.
sometimes things dont makes sense ๐ค
@loud mountain all good! thanks for your help man. i believe re-enabling the plugins fixed the issue we were discussing here... not 100% about anything though :p
I have a quick question. I have a simple Boss zombie that moves to the player's location. But I just realized his running animations only work on clients and not on the Server player if using a Server/Client setup. So on the Server player the Boss just slides across the ground where on the Client the Boss plays his correct running animations. How do I fix this? Here is my events where the Boss 'moves to location' https://i.gyazo.com/5eff262dc5863f41820b4cae9f45ddcf.png
They don't, you need to host your own if you want dedicated servers.
dang
You can always use p2p networking :p
nah
Does anyone have some hints for me to make a Multiplayer-able Foliage system ??
Way too broad of a question, you have to ask about specific features
Like, what would this foliage system need to do?
its simple i need to change the size of each foliage but thats easy with a multicast
i need something that sends the changes to new players but the array will be too big (sometimes maybe) so is there another way ?
@open cape in my bpinventory
Hi because of some network performance I am writing my own structure for transform replication. which is 2D.
which one is better using a structure for x, y, velX, velY, rotation. or separating velocity to another property?
how much property handle replication costs?
Does Splitscreen not use Ownership?
"OwnerOnlySee" and "OwnerNoSee" act like the Pawn isn't owned by the player
Owner prints properly on both pawns
Yet using "OwnerOnlySee" hides it for all players
Hey guys. I'm trying to replicate animation from client to every other client that is connecter to server. What I'm doing can be found in this screenshot:
https://imgur.com/a/8pANr6N
This seems to work, but I found it kinda hacky, is there a better way to force animation to be run on server and therefore displayer on every client?
What this solution achieves is to run on server a piece of code that then multicast replicates to every client
@tawny drum What is "hacky" about this? The two other ways to handle this are in the animation blueprint or through an OnRep, but your solution is fine and gives more control to the caller on whether or not the animation needs to be reliable.
Having to call it like this for every piece of code that I need to replicate seems like I'm trying to break through a door, that is open somewhere else
could you elaborate on the OnRep?
"every piece of code that I need to replicate". You replicate function calls (aka run code on every local machine) by using either a multicast or an OnRep
OnRep is a callback that runs when clients receive a network update for a variable
It's just a callback for replication
Note that it doesn't run on the server
well it doesnt seem like an unusual need to need to execute code from clients on all of the other clients. What seems hacky is that I have to manually tell server to multicast this function on the clients.
Okay, so using OnRep could be really similiar to this solution
If I replicate mesh that has animation blueprint assigned to it, and replicate all variables that are necessary for ABP, I should also achieve this result, right?
mesh component*
@tawny drum Sorry had to bail for a bit. Once you understand the networking model you'll see that what you're doing isn't hacky at all, in fact it's in elegant solution. And yes, replicating the components needed to reconstruct the anim bp on all machines would work too, but is probably not favorable in your situation. I'm not sure what kind of montages you're playing, but for example what you'd pass through that multicast function would be fire-and-forget animations, like a reload animation for you weapon, or an animation of your character putting his weapon away on his back. For the animation blueprint you don't use montages nearly as often, but can end up using them for locomotion modifiers and such.
These are actually attack combo animations, so they kinda are fire and forget (I'm not an animator myself, so I don't really know much about it).
Thanks for the response, Xenonic
So, question on ServerTravel... I have a project with two levels that I'm trying to travel between, both with their own game mode but the same PlayerState (lobby/game world). Both GameModes have bUseSeamlessTravel set and I have the Transition map set in my project settings as well (the transition map even as a game mode with bUseSeamlessTravel). My PlayerState also overrides CopyProperties. For some reason, the PlayerState's values are still reset when I ServerTravel. Am I doing the seamless travel incorrectly? Or is there something I'm missing?
Also, would the absolute flag on ServerTravel effect any of this?
hi, i'm having session ping 9999 with steam subsystem with my friend, any1 know a solution to this common problem ?
isnt that a tcp/ip setting somewhere in steam
that u need set on dsl/cable speed
this is interesting though its for windows https://www.youtube.com/watch?v=Os7B4darDlU
How to fix high ping in Windows 10. Gaming High Ping Latency FIX - Lower your Ping for Online Gaming This tutorial will address concerns you have with game t...
havent tested but u could use hamachi with steam uts not MP but lan based, for MP than u are bound to hosting or private mp server but in most case u need setup portforwarding
some router have it as virtual server
maby am missing something but why would u use steam? if u want run dedicated ut servers ur better of installing a server package and run from batch file with ucc uses less cpu resources if am correct and more easy to configur i think
btw ive got rid of my retail router off the network sinds most consumer routers are lunsecure and have security issues and big leaks but okay thats not UT talk
on UT-Files.com u can find alot UT server stuff
@opaque flicker http://www.aclockworkberry.com/ping-9999-issue-on-unreal-engine-steam-session-results/
i guess thats the best solution for the steam ping problem which DevilsD presents
Hmmmm, I'm running into an error that hasn't been as googlable as I'd like.
I have a data structure I'm trying to pass to the client when they join a dedicated server. This structure contains several TArrays of various other structures such as the player's talent points, their status with other players, and some more basic data such as where they logged out, what they were playing as, and what their stats were.
It's working for the most part, but we've been trying to track down what's come to be known as the "save bug," by our testers. Client-side, rather than receive the information from the server, I'm seeing this:
[2018.10.15-23.46.34:087][188]LogNetPartialBunch: Error: Final partial bunch too large
[2018.10.15-23.46.34:087][188]LogNetTraffic: Error: UChannel::ReceivedRawBunch: Bunch.IsError() after ReceivedNextBunch 1
The data being passed isn't very big, but it is passed as a struct that contains structs, some of which further contain TArrays of structs, so maybe it's just too complex or something?
something is to large and it isnt me
though i would look into typo`s filenames, access folder etc check the basic things first but looked at the error itself i need more info on what u use what kind of mod or serveractor etc
It's a big blueprint struct. It's been working most of the time, but occasionally it'll come up with that error.
I'll show you what it is:
yeah okay if i dont know than maby other will i think
This is what's supposed to be called client-side after the server has found the data for this player's Steam ID. Server finds the data just fine and then tries to call this
And that's when the error comes up. I have a print immediately after this, and it never goes off, so it's getting stuck right here
That's what the ServerData pin contains. Most of these contain TArrays of structs as well. For example:
This is PlayerScoreData
The others are similar, I'm wondering if UE is just getting confused by the complexity of all these nested structs inside TArrays. It works alright for like an entire day of players logging on and playing on our test server, but eventually it seems to hit some tipping point where the players will connect and fail to retrieve their data from the server. I'm assuming this is maybe hitting some critical size where it starts getting too large.
is their no way to set the max download connections per minute or so
I'm not really sure tbh. I'm considering maybe just bumping all this up into C++ and seeing if it works better
the coding part is really a dead road for me am just thinking simple
We've been migrating a lot of our more heavily used, older blueprints up into C++ but the agony of moving these big structs up has been something I have NOT wanted to do.
but it couldnt hurt checking it in C++ i guess
maby u will see something that u would miss in that bluescript
It'd be a couple days worth of refactoring at-least, it's a ton of work to bring those structs up into C++. They're all over our project
have u contacted Steam about it?maby they know something that would save u alot of work
somethign u missed or
am not sure if Steam has a developer option or something
that sometimes opens more posibilities to a developer
I don't think it has anything to do with Steam.
hmm what's that?
unreal editor
Oh no, this is a dedicated server being run on PingPerfect
we've been trying to bug scrub our game prior to release, and this bug's being particularly nasty to track down
I got my Huli game running on 2 phones on a local network (good enough for our demo booth on Saturday), but I've been plagued by a bug. The stack disappears on the client after the first round, only if client goes first. If client goes second, it disappears after the host's turn, on the client's first turn. Here's a video of it: https://www.youtube.com/watch?v=qnSfchoEf6M&feature=youtu.be NOTE sorry for the poor quality - had to record on my junk webcam lol
Here's a sample of the multiplayer within Huli, between iOS and Android.
Does anyone have opinions on using BaaS platforms to handle the networking, matchmaking, inventory, etc for UE games? I have been looking into GameSparks and PlayFab...Leaning towards GameSparks, but still kinda unsure of if its the right choice
It's the right choice if it does what you need and you can pay what they ask for
- you not having another way of doing it that costs less
hehe, well, i guess I should've made my question a little better...you are very right...we were thinking that the amount of time we would save trying to build all of the platform functionality and matchmaking and server management stuff would be well worth the cost (something like .02c per monthly active user after 100,000 monthly active users)
have you used GameSparks?
we're trying to find the easiest and most scalable way to handle matchmaking, certain networking stuff, inventory, in-game currency & marketplace, etc...they even have wagering of in-game currency on matches...which is a super cool feature we've been thinking about
I used GameSparks for Clients, yes. It's basically a backend that allows you to connect known Subsystems to it. E.g. a SteamAccount.
You can save data for users, such as Skill, Customizables and what else you can save as a JSON.
You can also perform purchases through it, I think it forwards it to the specific subsystem
So for crossplatform progress it should be quite nice to use
They have a build in matchmaking system that matchmakes based on the skill or whatever you give it
And you can modify this quite a lot, but it's not a straight forward thing to learn, even with their docs
However the Matchmaking only parses you that players were found
You still need to either tell players to host and join
or have another system that can give you a server that players can join
Which in addition costs money again
Writing your own system takes time and you still need to host it.
- you need to be able to manage and support it
And you don't even know if your game will be a hit, which if not, will result in wasted time
So GameSparks does have its advantage
@fossil silo
I thought I read about gamespark hosting servers
I think that's only if you use their own backend for replication
So not UE4's networking
@fossil silo
Why is this not replicating the array to the clients?
I tried with the array replicated and also repnotify (that I don't know what it means)
Ah, I know now with repnotify does. But it doesn't help here I guess
- Why a ServerRPC on BeginPlay?
- Why not "SwitchHasAuthority?
- Arrays tend to not Replicate through nodes like "Add". Try setting the Array with itself.
@thin stratus Ah, thanks!
well, still not working...
ok, so I want to apply different scales to my players and the scales should be consistent between clients and the server. My best try got me server and clients scaled but the scales were not consistent, they were mixed up. All this with BPs.
It should be enough if you call the set when the loop completes
yep, that worked, sorry I forgot to mention it. Now I'm focused on the different scales for the players
ok, I know what the problem is. I was getting all actors of class "the player class" but that array probably is unconsistently ordered between clients. Does that make sense? So now I need to find a way to get a consisten list of players. Using GameState?
If this is per player data
why are you doing this with an array somewhere?
Just put ONE scale value into the PlayerState, or PlayerCharacter or PlayerController
That way you have it already ordered
Because I'm working in a team and I'm not allowed to touch those files directly. I can however hack them on runtime ๐ Not ideal situation
How is it helpful if a "Team" limits you to properly implement code?
well this is just a prototype and we are close to a release so it's not a good time to modify those files. So I need to work "on the side" for some time.
Hm then I can't help
I understand, but thank you!
UE4 has a Gameframework which should be followed to, even when being close to a release.
Not allowing a coder to touch main Framework files is like driving a car without a steeringwheel.
I know ๐
When a struct inside an actor is set to replicate, are all the structs UPROPERTYs replicated, or only the properties that are also set to replicate?
Same thing with UOBJECT classes where the instance is set to replicate
Is the behavior the same?
How to get a consistent list of players in all the clients? I'm trying Get Game State->Player Array->For each loop-> Get Player name? And I don't know how to get the player pawn/actor from here
thanks @thin stratus , do you have any suggestions for scalable dedicated ue4 server hosts that you like? Also, we aren't against using GameSparks replication stuff if it makes everything easier to have them host servers too..
@glacial lotus You can't get the Pawn from the PlayerState, at least not if you aren't saving it yourself
The PlayerState has a Controller ref in the Owner variable
Only available to local player and server (cause playercontroller doesn't exist on other clients)
PlayerState holds the PlayerName if you need that
if i spawn and attach an actor to my character, is that like a 1 time deal that it gets replicated? or is it constantly replicating that its there o.O not sure the best way to explain what i mean...
like if i use SetMasterPoseComponent, does it replicate each individual mesh separately or does it just know its attached to the Master one and just replicate that?
SetMasterPostComponent is called on the Component, passing the MasterComponent
If you plug 10 Comps into that, it calls it 10 times, once per component
10 times, but once? or 10 times and it replicates each object separately
hmm, so no way to get a consistent list of all the player pawns from the clients directly?
Pawns controlled by players or pawns of some class
Hello guys !
I have a very strange bug !
I've a boxCollider with overlap events. I've implement the event in both BP and C++.
The events are correctly triggered (on server and clients) the first time.
But all the other time, the events are not triggered on server but works correctly on all clients.
Any idea why this happend ?
Thanks in advance for your help !
@sharp pagoda Player pawns controlled by actual players
TActorIterator<YouPlayerPawnClass>, filtered by IsPlayerControlled
or, ugh, GetAllActorsOfClass
cheaper to just have them register somewhere accessible
@drifting plank my guess is that your Server Actor has a non-replicated collision volume, and that it never actually left overlap
Hum I found my mistake ๐ฆ
I've put accidentaly a lifetime to my actor
Thanks in any case ๐
I am trying to test a game on a different pc with a different steam account, the ping is always 9999 and it never connects
it waits for like a min then disconnects
ping 9999 is pretty standard with steam even when it works
read the output log, from opening map with ?listen and onward is the interesting part
don't know what you mean
the game is done fully in BP
in the log it said "falied to bind to the listen board"
so i had something working single player, trying to get it working multiplayer. im spawning an actor, setting it as a variable with RepNotify, using the OnRep function to align the skeletal mesh and SetMasterPoseComponent. it spawns the mesh but it doesnt animate. thinking its a replication problem more than an animation problem because it worked before. any ideas? O.o
If I multicast enable a sound component, will new-joiners also hear it or do I have to enable it via RepNotify?
You'll need repnotify
Is there a way to limit the amount of default data being replicated? Trying to spawn 10000 actors (with nothing in them, just blank actors) takes over 16 seconds on a local dedicated server.
do you guys know any good plugin for TCP communication?
@sharp pagoda What if a repnotify calls an event that calls another event that enables the sound, will it still be heard by new players?
Sorry for nub question
The notify will call just like a normal function for the joining players (assuming their value is different from the server's). So yes it will
@unique thunder
Okay thx a lot
I'm prototyping an RTS resource manager game and i've set everything up as structs so far
Like I have a BP_Item but it just has a FItem struct with all the major properties
Is this a bad foundation?
Structs in BP seem difficult to change
Especially when they have arrays of other structs
Structs are known to break in Blueprints when adjusted often (the actual struct)
sometimes even when just starting the project the next day
We tend to put our structs all in C++, just to avoid them breaking, ccause if they break you'll have to replace them al lby hand
(also use sourcecontrol!)
Hmm, my C++ enums broke when I tried using them in blueprints
Guess it's the other way around for structs
Never had C++ enums break, but yeah
Good sourcecontrol advice, i'm a big proponent myself https://forums.unrealengine.com/community/general-discussion/121068-version-control-git-lfs-vs-perforce-vs-svn
General discussion about the game industry and the Unreal Engine community.
Despite that, you can save the items just as structs too
I'm just curious how you would structure it, would you put them in the BP without a struct?
it kinda depends on what your items can do
You could just put the stuff into the Item directly
at that point the struct is mostly organization
Or having a class hierarchy
Keep in mind that BP structs can't* be inherited
While c++ ones can
So you can't extend the struct in bps
Yea, didn't realize that when i started so now the structs are messy
You think i should abandon the structs and just make everything class variables?
Iirc, my Items are UObjects
And only the Server has them
They have a function that they can override for filling a "FItemInventory" sturct
Which holds data for displaying
cause that's all the client needs
So you made both?
And you just package your UObject into a struct when it goes into an inventory?
Does the UObject have the same class variables as the struct?
This is the workflow to change an array in the struct
My Inventory is an Array of the UObject
The Sturct is just info that the Client needs to display
Actually
I think I did do it with 2 structs, sorry
Lemme double check
USTRUCT()
struct FInventoryItem
{
GENERATED_USTRUCT_BODY()
UPROPERTY(BlueprintReadWrite, EditAnywhere, Category = "Inventory Item")
class USGItem_Base* ItemRef;
UPROPERTY(BlueprintReadWrite, EditAnywhere, Category = "Inventory Item")
EItemType SlotType;
UPROPERTY(BlueprintReadWrite, EditAnywhere, Category = "Inventory Item")
int32 StackSize;
};
So the item is in fact the UObject
the Array is a TArray<FInventoryItem>
So yeah and array of struct
I do also have this struct:
USTRUCT(BlueprintType)
struct FUIItemInfo
{
GENERATED_USTRUCT_BODY()
UPROPERTY(BlueprintReadOnly, VisibleAnywhere, Category = "Item Info")
FString ItemName;
UPROPERTY(BlueprintReadOnly, VisibleAnywhere, Category = "Item Info")
TAssetPtr<UTexture2D> ItemIconID;
UPROPERTY(BlueprintReadOnly, VisibleAnywhere, Category = "Item Info")
int32 StackSize;
FUIItemInfo()
{
ItemName = "None";
ItemIconID = 0;
StackSize = -1;
}
};
And my UObject has this function:
FUIItemInfo USGItem_Base::GetItemInfo()
{
FUIItemInfo ItemInfo;
ItemInfo.ItemIconID = ItemIconID;
ItemInfo.ItemName = ItemName.ToString();
return ItemInfo;
}
(Old code, could be a lot better I guess)
// Create and array of FUIItemInfo of the same size as the inventory
TArray<struct FUIItemInfo> Inventory;
Inventory.SetNum(_InvCom->Inventory.Num());
for (int32 i = 0; i < Inventory.Num(); i++)
{
// If the item is valid, let it fill the struct with the interface function
if (_InvCom->Inventory[i].ItemRef)
{
Inventory[i] = _InvCom->Inventory[i].ItemRef->GetItemInfo();
Inventory[i].StackSize = _InvCom->Inventory[i].StackSize;
}
else
{
Inventory[i] = FUIItemInfo();
}
}
Client_CallbackWholeInventory(_InvCom, Inventory);
So, you store most of the vital info in the UObject?
In the end I have a function (here as an example a ServerRPC) that parses the acutal inventory in the smaller UIItemInfo strcut
And then sends it to the client
Yeah and that only lives on the Server
Cause the client (in my cases) only needs visuals for displaying it
Are UObjects setup for replication by default?
Nope
You'd need an Actor taking care of subreplicating them
I'm also not replicating them
I'm doing this mostly in BPs so I guess i need to stick with AActors
For items
Then store their properties as class variables
I don#t see why you need to replicate the items
It's enough to keep them as object on the server
and send only visual updates to the client
My Marketplace pack works nearly the same iirc
I need to replicate their position and stats
Fair enough
right?
Well you can still send vectors and stuff to the client via a struct
Hmm, it's a week prototype so i was gonna keep things simple
Everything has been structs so far tho and that's caught up
Guess i'm just wondering if that's usually where people store all the stats
Makes it easy to migrate but a pain to change
Well, look at that
Just came back to the project today and the structs are broken
Can someone double check my Replication logic? For some reason only the Server Player can see my custom spinning trap actually spin. https://i.gyazo.com/b20dadab7702fffd9257eb0d1adf0f06.png
do player controller/player state and gamemode get destroyed during seamless travel ?
@cedar finch i don't think you need the multicast, just set the bool on the server, since the variable is replicated, everyone will receive the update anyways
@hybrid ermine Thank you so much I was getting a headache trying to make it work. It works now. https://i.gyazo.com/175cc8934baed64c9484feef26d855fc.png
Well Darn. ๐ฆ Now that I added in my trigger to start the trap it doesn't replicate. ๐ฆ What am I doing wrong? https://i.gyazo.com/89fb659f0d1bbaa3c0ab75c4745d735d.png
in that image, your turn on event doesn't do anything
oh nvm that is a call to turn on
that set call of the can activate trap variable needs to be on the server
Idk I've tried everything. I hate how the most simple things are so complicated for multiplayer. ๐ฆ Right now it only plays for the person who presses it.
I think I'll take a break and think about it. Then come back to it. That usually helps me figure these things out
oh, hey @thin stratus remember like a few weeks ago i was having issue replicating that array of structs?
i figured out what the issue was finally
NetSerializers update in place, so if you are replicating an object you need to clear it manually in the netserialize code if the object is null
I was under the assumption the constructor was called (which would have 0'd out the property), but they are not
does anyone know for an multiplayer FPS with replication. How you would register that a certain player got a kill on the server? I know there is the Apply Damage node that has the instigator option on it. Im just wondering how you reference different player controllers on the server to register that they got a kill. Do you just plug Get Player Controller into the instigator slot on Apply Damage? or is there a better way
write a Die() function
and handle it there
ideally your applydamage function has an instigator
which should be the pawn that is dealing the damage
ie, if you have a weapon, the instigator is the guy holding the weapon
from there you can credit the instigator
yeah i originally thought to register it after the charcters death. guess that was correct after all. Thanks
yeah
what I like to do is pass it to the gamemode
have some OnPlayerDied function
and have the gamemode deal with it
send out notifications and the like
@thin stratus got any ideas for why my stack keeps disappearing on client after the first round?
It's a replicated object, managed by the server (who's also a client), and it shows up on the client for the first round, but not the second round, when it's the clients turn. The stack will always show up on both screens when it's the servers turn.
When it's the clients turn, the stack disappears from both screens.
its a replicated object of what type?
what creates it?
what happens during a turn?
I cannot get the first person template projectile to replicate on the Z axis for clients
It only fires at one vertical angle, but still moves with the player and the horizontal angle that they are looking in
any idea why?
they would not put something only occasionally used to replicate out of the box, by default
@winged badger - sorry got caught up in debugging lol
It's a replicated object of type 'Actor'
The server creates it
during each turn, the server removes any caps in the stack that have been flipped over, then it calls the Build stack Event again. I have switch has authority set to 'Authority' when it builds it
during the BuildStack event, it calls a function called "Build Stack" which creates individual BP_Cap's via SpawnActor node
here's the Stack blueprint when building the stack.
During the round reset, within the Pawn, I'm calling the Build Stack event
thats the only call to build full stack?
except on the initial loading of the level, yes
one thing I did notice is that the print string, contained within the BuildHuliStack event, only prints to the screen during the server's turn. I'd expect it to print every turn...
Here's the replication on the Stack Actor itself:
it can't execute during client's turn
but during clients turn, if the server is controlling the building of the stack, shouldn't the printstring execute on the server's screen no matter what?
right, but the build stack event is "Executes on Server", doesn't that mean the server controls those specific objects even for the client(s)?
No offense, but putting the rebuild stack calls and/or logic inside the Pawn is alsoa terrible idea
Fair enough, still learning my ropes in multiplayer
Pawns are replicated, which is why I put it in there, where else would you suggest I put it?
No offense taken btw
into a GameMode component
that handles turns and stack rebuilds
and nothing else
I have game mode handling turns right now, so it knows who's turn it is
or GameState, depending on the need to replicate
so I can just slide it into that, np
but your client can't call the ServerRPC to rebuild the stack
because its not a server, and you have a branch checking for it
gotcha - thanks for the help. Give me a few and I'll restructure my stack rebuilding and will tell you how it goes.
basically, the change of turn and rebuilding of the stack are atomically linked
you should handle both at the same place
the build huli stack portion in the huli pawn btw, was when I created the game in single player - I learned the hard way that building your project with multiplayer intentions from the beginning I can't cut corners like I can in single player.
first single player game ๐
*multiplayer
yeah, i had the privilege of refactoring a codebase of a SP game to MP
hope i never have to do it again ๐
not fun - but now I know lol
@winged badger - another thing that confused me and why I thought it was ok to have the build stack there is that this problem doesn't occur between PC and Mobile, only Mobile and Mobile
deploying changes you suggested now to both mobile devices...will let you know how it goes
@winged badger you're dope! Thanks, that worked! everything is working as intended now. Huge thanks!
@mighty rover https://puu.sh/BMnlY/6f892a4ecc.png
No idea if that was mentioned (didn't read the convo), but that event at the bottom right doesn't need to be a ServerRPC
You are already on the Server
And I know why it's an RPC
But maybe make a non-RPC for the stack rebuild and create another Event that is an RPC that calls the normal event.
It's better practice in my eyes
Does anyone know why Epic routes the RPC Calls of the CMC through the Character?
So basically "CMC::ServerMove->Character::ServerMove_Implementation->CMC::ServerMove_Implementation"
Where the Character one is the actual RPC and the CMC only has non-rpcs
maybe it's a compatibility thing for different movement components ๐ค
or, something else needs to call it too
and it cannot be sure does that particular component exist
@thin stratus that RPC build event you mentioned already calls a non-RPC function that actually builds the stack. It's only purpose is to call that function. Is that want you were recommending?
under rendering, press arrow to expand the menu
i tried that but it doesnt work
I'm pretty certain it works
set it to screen space and check draw size first
AND make sure the widget set operation logic is compatible with all other clients
I wouldn't know is it correct, I assume your widget is custom size of 100x40
and not fullscreen sized
yup
https://issues.unrealengine.com/issue/UE-48546
seems like this bug is still not fixed
you can hide it manually
BeginPlay->if self IsLocallyControlled-> SetHidden
assuming that is on your character
@red sand
Thanks alot Zlo
hey, i've been following NiceShadow's Advanced Sessions tutorials, and i have encounted a problem. I'm using server travel and understand that this only works in standalone game. But the server travel doesn't seem to work even in standalone. The Server owner will press the start game button and all Player Controllers that are connected with be sent over to the map, but this doesn't seem to happen and they get stuck on the loading screen
I know it's not a lot to go on
but any help would be appreciated
Hey guys! Does anyone have experience in writing an own Online Subsystem and has some tips for me? Or an blog post or even an tutorial how to do it?
My idea for now is to copy the OSS Null and overwrite the whole LAN Broadcast stuff with the HTTP Calls to my own Online REST Service
On begin ovwrlap all clients getting updated
My inventory is created in player controller (pc)
My inventory func all are in pc
New var2 (pc ref)
Anyone suggest me y all my clients getting updated
so if i have a server function that spawns a weapon and attaches it to my player, if i set any variables so my player has a reference to it, the variable has to be replicated?
also, after it initially attaches it, the server doesnt know that the weapon is animating with the player? O.o hmm
Hey guys, i have some room prefabs which is essentially a Main Blueprint with a bunch of child actor components. In PIE everything shows correct. But over LAN or Steam Multiplayer some child actors are only visible to the server... The room itself (the parent actor) is replicating though. I tested every combination of component replicates, turn off replication in the child actor and so on. I don't know what i am doing wrong here.. Is there any "correct" way to properly replicate child actor components?
