#multiplayer
1 messages Β· Page 596 of 1
eos is a different beast
eos is a service providing stuff like matchmaking
the document is pre-eos and also covers ingame networking
which starts after eos has finished its job
oh okk thnx
@shadow schooner EOS is your game OSS..
OSS contains code for mostly rest API for game backend. And there is hardly any need to replication and multiplayer networking.
I'm trying to change the walk speed for the third person character by changing the "Max Walk Speed" variable in the character movement component, however whenever I do this on servers it ends up rubber banding as I'm pretty sure the server isn't having the variable changed and is resetting it back down for the clinet
I would imagine it has to be possible to replicate the sprint speed locally for each client and not have the server interfere with it, right?
@woeful sigil It has to be set on both client and server. You can pretty easily do this with an Enum or whatever. Just something like a Reliable RPC on shift down, input the enum for sprinting. Set it locally, and RPC to set it on the server to let it replicate to other clients. On shift up, same thing with a different input. On enum rep, change the movement speed.
Might also be a better way, but I ended up achieving okay results with that.
That's a lot of things that I most definitely don't understand lmao I haven't been doing this for a long time
Whelp, looks like Google shall be my only companion for tonight
Thank you so much for your reply and I'll come back if I have any persisting issues
I can help in a few minutes. Are you doing blueprint of C++?
Blueprint, I have absolutely zero in C++
Wait that's a lie
I have very little experience in C++
Not enough to be using it reliably
@woeful sigil Do you know how to create a ServerRPC event?
In the character, you can do this in the main graph. Once you set the bool to RepNotify, you'll get a function in your functions list to use.
In that function you can set your client's local character movement component up like this. This will also run on the server.
So based on whether that client has pressed shift or released it, their movement speed will be faster or not.
OooOOoOoOOoOOoo
Okay give me a moment here
Uhhhmmmmmm okay that's not supposed to happen
Now my dedicated server is acting up
Okay well, if I play as a Listen Server it at least kind of works? The jogging animation doesn't play but the speed does actually change
It's still jittering about but it doesn't sling me back to where I start sprinting
You might need to change some settings for the corrections at higher speeds like that. Give it a wider correction range.
The animations will just be cosmetic in the animation blueprint based on the speed the character is moving.
The animations do work, I know that they will whenever I play offline, it's just that when I'm online it doesn't seem to want to
And now my server is being incredibly strange
What the hell
Okay it is definitely what I've set up that's not letting me connect to my server
I took away all of the variables and code that I made and it worked
Put it all back and now it won't
This is so strange
OH
Oh I'm so stupid
Nevermind me
@kindred widget Yeah, I've repackaged my server and still the speed change doesn't seem to want to work for me
Oh okay, actually
Now I have a completely different problem
Pressing shift immediately slings me back to the main menu
Haha, that's odd. To be fair I'm not used to working with dedicated servers so that might be something else I'm unaware of. Normally I stick with listenserver setups.
I don't want to change DefaultPlatformService under DefaultEngine.ini for each platform I want to build the project for. Can I do something about it?
I want to write it for each platform once and be done with it. Can I achieve this?
Don't multi-post questions in different channels
I noticed that this is a better channel for that
how do you guys overcome that initial middle of the map camera view for 1 second on load because the player is waiting for server to replicate pawn to client?
It shows the middle of the map for 1 second at 0,0,0. This is before the pawn has spawned and when the player controller has spawned
it looks bad, it would be nice if I could change it to a different camera perspective
Its on dedicated server btw
here's how it looks like for that first second when the player is spawning in the map
Loading screens
We put a camera into the map that has a certain desired viewpoint. The camera manager falls back to that viewpoint if the player has no pawn.
You're talking about the first few seconds before the player even starts? Can this be done in BP? I've tried to do this at begin play for the camera manager but I still see a half second glitch now.
It actually sort of works. It shows the middle of the map for half a second then shows the desired viewport for half a second and then finally switches to pawn, but that first middle of the map shows albeit for a shorter period of time.
This could work
Probably not in BP. It takes a while to receive your pawn, so until then, you'll just have a "default" camera view.
Looks like there is a BlueprintUpdateCamera function in Player Camera Manager, so you might be able to override it there
Hey guys, I'm having trouble with my characters movement replication, I'm using the character movement component and moving my pawn via the AddMovementInput Node. The client lags like crazy and gets its movement corrected very often. My tick time is 5ms and my avg bandwith size per sec is 3KB on the listen server and 5KB on the client not sure if that is much but I only have one rpc in tick and its not reliable. What else could be causing lags in client movement?
Is this happening in PIE or in a packaged build?
rmb-> launch game on .uproject
Hey there people!
Have you ever managed to "replicate" Steam Avatars over the network?
I don't want to replicate the Avatar itself, the Texture2D; Instead, I'm trying to replicate the SteamID with clients and from there retrieve the avatar on their own.
My problem is that I can't replicate the UniqueNetId, and am using Advanced Sessions FWIW.
you can get the replicated unique net id from the player state
There's a wrapped type that allows it to replicate
Hmm...
I guess I must expose it to Blueprints, right?
I guess it's this one
Actual unique id.
Hm...
Do you know if I'll face any trouble by exposing it to blueprints?
Am guessing that b/c it's not exposed by default so..
Well...
public:
UPROPERTY(BlueprintReadOnly)
FUniqueNetIdRepl UniqueId;
π€
Do you know from the top of your head what went wrong here?
If you can break and make UniqueNetId on blueprints maybe that can work
instead of directly connecting
or split structure pin
I guess splitting is not going to be an option too then
I could use some CPP here but well..
They are expecting a uint64 and that's exactly what this dude is.
Hi, i`m at the end of the Main Menu Multiplayertutorial from gamedev.tv and i decide try to add Playernames. So the Player type the name bei Host or Join a game and this names are saved in a array on a actor spawned by the serverpawn. it works for the server (NeoBen) and for the first player that join (RitterPhilipp) but if join more player the names only see by the server and i dont know why. no hints in the Logs or eroors. Befor i Use the Set Owner blueprint, i get a warning, that the actor have no owning Connection, this warning was gone after i add set owner but the result doestn change.
how to use photon multiplayer in unreal engine
eyyy! I haven't checked it out yet, but has anyone seen if they really did update the CharacterMovementComponent in 4.26 with an improved prediction flow?
Hey guys please help me. How do I replicate an animation montage over network?
How to travel to new map if im using seamless travel and connected to steam? (ServerTravel not work and just do nothing)
its accessible
and its also guaranteed to exist on clients before BeginPlay
at least in case of GameState, not sure about Base variation
(the OnRep_MatchState in GS is what dispatches the BeginPlay on client's world)
Wondering what they ment by this in 4.26
not sure about Base
exactly that
simplest way to use it is have say, interactable actors preplaced on the level
and start them as Dormant
then when they are interacted with for the first time, change their dormancy to Awake
@jagged stag
they won't replicate, or waste servers time evaluating them until they need to then
i could swear that was already exposed though
that's cool thanks
waking them up is easy
if you want to flip them back to dormant
or if you want to make a spawned at runtime actor dormant
then you have an issue with relevancy
as dormant actor won't wake so it updates the client that was not relevant when it went dormant
so that client won't see it at all, or will see it in invalid state
you can do it for non startup things, just don't expect that to work out of the box
i find that guarantee that GameState exists on all clients before any Actor calls BeginPlay
too convenient to pass
there are not many guarantees with replication order
so would never use the Base variations
they could had used wrong type of GS
to access
have wrong GS on some level
they might be accessing it via GameMode or some stupid shit like that
that leaves worldcontext being invalid
normally UObjects don't have good GetWorld
to call statics from
but one can untick a context sensitive instead of implementing GetWorld
yeah i know what it does
result of that would be
GetGameState node
that has a WorldContextObject pin
that pin is hidden only if GetWorld is good for providing context
it should work, unless they did something unspeakable
is it vanilla GameState accessor failing?
Hello, with 4.26 released today, I'm not seeing much about replication with Chaos. I know Chaos is still in beta but has there been any news about this?
I know, it's still in beta and last I heard it was projected for default by "early 2021".
Despite being yote, has there been any news about its replication?
what's the difference between "Replicated" and "Repnotify" on variables ?
when do i use "Repnotify" ?
i just watched a guide, saying that "Replicated" will not update players joining late
but "Repnotify" will update that late player
so when should i use each ?
for example i have a boolean for aiming => "IsAiming"
i've set it to "Replicated", it works fine
but somebody told me, i should use "RepNotify"
same thing for my "RifleCombat" variable, they told me use "RepNotify"
so if a player join later than me, it'll update
@whole urchin Is IsAiming is just for third person anim stuff and you don't need it to do anything but change and let the animblueprint poll for it, you don't need a repnotify. What does RifleCombat do?
"RifleCombat" changes states from unarmed to rifle movement blend space
but i used in my character blueprint in branches (a lot)
Picture this. If you undo all of the logic since you began play. Reset the character to it's default state, but kept the same variables and their values, would your character be in the correct state? That's the important thing to consider with replication.
The ONLY difference between Replicated and RepNotify is that Notify calls a function on each machine when the value changes. That's it. The values will both get replicated the same way. So the only reason to use RepNotify is if you require a function to fire to change the state upon new replication.
So if your character would be in the wrong state upon a full rebuild with the same values, you'd want to use a notify function to set it's state correctly.
every variable i use is to change states
After I updated to 4.26 I have now my dedicated server starting every time I do PIE. How do I disable it ?
does someone work with seamless travel and can help me?
you should just ask the question
@kindred widget did you use photon multiplayer with ue4? or you have idea how it works?
First I've ever heard of it. I haven't really touched a lot of third party stuff.
@kindred widget i build dedicated server, i want to test that server over wan(worldwide)
how it possible
@winged badger I have using seamless travel with steam and when i want to travel to new map with the all of the player on the server using ServerTravel so nothing happened and i want to know how to do it
i know, but its not work
Not really a dedicated server person either. My main networking projects have all been Listenserver base.
departing GameMode has to have seamless travel enabled on class default
already make it
and seamless travel doesn't work in PIE at all
so you need a more complicated test
its matter if i write ?Listen or ?listen ?
don't think so
@kindred widget you mean local area?
Listenserver is where one of the clients is also the server, rather than having a dedicated server application.
@winged badger to test i upload the build to steam and test with my both pc's. when the functions called to servertravel like you write its do nothing and i stay in the first map like nothing happened at all
im using a plugin for a steam server "SteamCore"
to open port, should i use tcp or http?
@empty axle when everyone is ready the function run on server to travel into the map
Then I don't know. I would just debug the server travel method and see why it fails
how can i debug it?
in PIE its work just fine but it is because seemless travel not work in PIE
read the logs first
when a client disconnects from the listen server is there a way to log the reason for the disconnect?
the client and server GI will have HandleNetworkError called in BP
with a vague reason
im working on setting up my ability system right now, and i have a basic prediction system set up (including predicting costs of the abilities and rolling those costs back if the abilities fail). The one thing i'm struggling with the most right now is integrating the CMC with this. Currently, my ability is called on the client, the client checks all costs, then performs the "client version" of the ability which is mostly just cosmetic. Then the ability component sends a struct through a Server RPC with any input parameters. The server checks costs again, deducts them, and replicates the results of the event, performing the actual "server version" of the event which can actually inflict damage, apply buffs, etc.
now, with CMC if my ability was something like a blink or a dash, i'd want to put that in a saved move and integrate it with the movement component, but i'd need a way to check if the ability succeeded on the server before applying the movement, and then correct the client if not. I know there's no way to guarantee which would come first between my "Ability Use RPC" and the CMC rpcing the movement from the ability, so i'm not sure how to get this working.
its a start at least, thanks Zlo
With combat and animations what exactly needs to be done to replicate hand to hand combat?
In the net profiler, is the vertical axis the number of outgoing bits?
(the axis whose scale is from 0 to 4000)
I assume that when reading the chart, each horizontal sample refers to a network frame?
Which is why when I look at a measurement over seconds, such as Outgoing Bandwidth Avg/s, it's way higher - because every sample is actually a kind of sum of the neighboring frames in the window of the last 1 second?
@rancid grotto it'll depend on your combat system.
You need to think about what the minimum state of the character is and what could be generated from that State versus what needs to be synced. For a first person shooter, for example, really the only synced state is the player location, and direction, and maybe velocity. Everything else is reconstructed from that.
@dark edge its just hand to hand combat...creatures fighting each other...
Are there any guides for setting it up properly?
Normal animations can be replicated just by making sure the variables that drive the State Machine are replicated too from your Character BP
For example you could have a bCrouching that dictates if your Character needs to be in the crouching animation or not, be sure in this case to set the bCrouching through RPC and not directly, and obviously set it as Replicates
For attacks instead they will most likely be Animation Montages that play on command, same concept, RPC them but they will most likely take place just in your Character BP
@rancid grotto that doesn't exactly narrow it down. On the scale from world of Warcraft to Street fighter to mordhau, what type of system are you talking about.
Hello! I've built my server separately and launched it. Seems all good so far but when I connect with the client, the controls don't work at all.
I think it might have to do with this: [2020.12.04-07.12.16:882][644]LogGameMode: FindPlayerStart: PATHS NOT DEFINED or NO PLAYERSTART with positive rating
but I'm just guessing
Is there anything I have to do additionally to make it work?
I should probably say this is gonna be an RTS-style game and I only use a camera pawn to be controlled
And it works fine when I Play in the editor
@dull lance check the logs. I had similar situation in the past when I exceeded the maximum size of structure that can be send by RPC. That caused clients to disconnect from the server
no
it will kick the player
I have now overriden Find Player Start in my game mode and I don't get that message in my log anymore but the inputs still don't hit.
any help?
I also capture the mouse now but it doesn't seem to change. It seems like the inputs are not forwarded to the player controller
/** Return true if FindPlayerStart should use the StartSpot stored on Player instead of calling ChoosePlayerStart */
virtual bool ShouldSpawnAtStartSpot(AController* Player);
``` i didn't read up what the problem is, but i'd bet on this gem @paper lava
in GameModeBase
makes your PC call FindPlayerStart exactly once, when it loads the map
then use the same start for the rest of the match
and i did read it up right now
ok
the game mode also prefers to have a player start per player
I just checked. FindPlayerStart is being called (I've overridden it in my game mode)
should I access ShouldSpawnAtStartSpot or what can I do to fix this?
ah ok
or if you can't change player start after you load some external info (like player selected team)
then that function will cause troubles
its really terrible
I see
So any idea about what to do here? I really have no idea on where I should start to tackle this
I've tried capturing the mouse, tried different input modes
it just doesn't react as if the game was ignoring my inputs
did any actor call beginplay?
yes, my player controller
it all seems to work well, my player controller is spawned, camera is where I expect it to be, game mode begin play is called, player controller begin play is called but my inputs are ignored
are you in wrong input mode?
I tried different input modes
BP or c++?
bp
and this is only when I run dedicated server / client
in the editor it works well, even when I use play as client
Anyone else getting a fatal error crash with no useful info after their 2nd or 3rd seamless travel in 4.26 (shipping builds only)?
@grizzled stirrup build source engine, copy the project, open it with source engine version and cook it from there
then you can run debuggame from VS with engine symbols available
Thanks doing that now and enabling the shipping logging target.cs option
My inputs don't trigger on the player controller when in dedicated client. Any ideas on how to solve this? Can I maybe trace what happens to the input?
One step further:
LogPlayerController: Error: EnableInput can only be specified on a PlayerController for itself
LogBlueprintUserMessages: [bp_PlayerController_C_0] Client 0: player controller begin play
this happens in editor client and in dedicated client but maybe this is the issue?
I don't even know where EnableInput is called, can't find it
Use the Blueprint Search to search in all your Assets for it
It more or less sounds like you are using GetPlayerController 0 in a bunch of places where you should use the controller relevative to the player
Cause if you use GetPlayerController0, you always the callers controller. DedicatedServer for example could return the first player's controller or maybe even nullptr.
it would return the controller of the first player that logged in
which is never what you want, really
But GetPlayerController 1 is still nothing or?
Because the Index is for Local Controllers or do DedicatedServers return player's controllers?
Never really tried that
One of those things where you never really run into the need of thinking about it if it's setup correctly
I avoided that consciously
I don't even know if Error: EnableInput can only be specified on a PlayerController for itself is actually why it fails but I don't know what else.. Except maybe when it gets packaged, it leaves something necessary out?
because the odd thing is that it only happens in my dedicated client.
@thin stratus it would return null
index is somewhat weird
to find controller's index you need to increment a counter while running FConstPlayerControllerIterator
and matching the controller you're looking for to *It
fairly convoluted, i think
I usually just use the controller iterator
Just weird that GetPlayerController0 doesn't return nullptr on the Dedi
index 3 becomes index 2
Yeah usually I don't require any index
I only used the index in the past for Local Multiplayer
@thin stratus any other ideas on how to solve this? Really don't know what to do from here
Yeah but GetPlayerController0, on ListenServer setups, returns each players Controller
So the same on a DedicatdServer, just logical wise
should sort of return null
Cause the dedi server is no player
Not without spending more time on it, which I don't have atm ):
class APlayerController* UGameplayStatics::GetPlayerController(const UObject* WorldContextObject, int32 PlayerIndex )
{
if (UWorld* World = GEngine->GetWorldFromContextObject(WorldContextObject, EGetWorldErrorMode::LogAndReturnNull))
{
uint32 Index = 0;
for (FConstPlayerControllerIterator Iterator = World->GetPlayerControllerIterator(); Iterator; ++Iterator)
{
APlayerController* PlayerController = Iterator->Get();
if (Index == PlayerIndex)
{
return PlayerController;
}
Index++;
}
}
return nullptr;
}
it won't check if its local
and it doesn't go through ULocalPlayer
which one might do if doing splitscreen
Idk if this is the right channel for this but is it possible to make permissions if yes, how
@opaque sigil https://www.youtube.com/watch?v=abmzWUWxy1U&list=PLZlv_N0_O1gYqSlbGQVKsRg6fpxWndZqZ this tutorial series cover some of the topic you are interested in
In this video we take a look at the finished project and step through each of the features that will be covered in this series. We show our functional Main Menu and its options, a lobby where players can chat with one another and select their characters for the game, some server options such as changing the map or match time as well as the abili...
I'm at a complete loss, does anyone know how to do this step for profiling networking using Unreal Insights?
@dull lance Listenserver will, but it should only be used for local client stuff. Getting the local controller/character, getting HUD, that sort of thing. I use it a lot to get the HUD class since the controller has an easy call for it. Also used it in my inventory component's widget to get the currently controlled character to use their inventory component to RPC. But that's about the extent you should use it for.
In C++?
Blueprint I'd understand, but you can generally use the same calls without the library include in C++.
Is there anyone experienced in open ID (google and facebook) Integration for mobile that could help me out on something
i guys
@dull lance @kindred widget i prefer having a static function that takes world context and returns GameInstance->GetFirstLocalPlayerController()
GetPlayerController[Index] is only good for iterating over all the PCs from BP imo
for (0 to GameMode->GetNumPlayers - 1) GetPlayerController[Index] basically
now that's a good reliable use for it in BP π
This replication issue is becoming a problem for my game now.
What exactly am I doing wrong with this that it wont replicate properly?
The player locations do not synchronize properly. If I the server moves left, I am sliding left on the client's side. This seems to be a client-bound issues more than it is a server one, as I can see the client move prediction working as needed server-side. The client can not seem to predict the server player's movement's properly.
I found the issue to broken player movement and interactions in PIE, after switching the project to 4.25: https://answers.unrealengine.com/questions/979714/addmovementinput-stops-replicating-when-converting.html
@twin juniper simulated proxies aren't supposed to do any prediction, that is only for autonomous
looks like you're replicating position+velocity intermittently
and then client just goes along last velocity vector until it gets corrected
Someone can help me? Im using SteamCore plugin to connect to the steam server and when im attempt to use servertravel so nothing happened and everyone stay in the first map with no changes (Seamless Travel is enabled and im execute command "ServerTravel FeatureMap2?Listen") PLS PM meπ
The config files seemed to 'fix' the lag movement problem in editor and standalone by stablelizing the server movement sliding, making it hardly noticeable and reduce to hickups. I do hope there is a way to eradicate the lag movement entirely if possible but for now, it will suffice for the MP game. What still remains however is the firing. The spawn point is not replicating properly on client, granting too much distance between projectile and weapon.
I have to head to work at the warehouse, but I will return to read any replies far as the replication problems.
Anyone know why the server's outgoing packets seem to be clamped at 8000 bits? Is this some default value? Or is it my ClientMaxRate divided by the number of packets per second?
Oh, what's the setting?
And why is it low? What will happen if I set it to too high?
Aight thanks I'm alook for it
@unkempt tiger https://drive.google.com/file/d/1IF7TpZXYR9n-LrxcLkLkHb8Ko6TbCbDQ/view look at the bottom of that PDF I believe
Huh
Is there no nice place that documents exactly what all these configurations are?
It seems like information is scattered everywhere lol
I've never found a nice place for it, no. Everyone usually just posts their settings here from finding it in forums.
At least that's in PDF form lol
I found this variable in NetDriver.h
I can try and follow it to see what it gets set to
How'd mini map work in multiplayer? So I followed the UE4 tutorial to add minimap to my project. I need to have a BP_MiniMap in the level.
A minimap would be drawn by the client based on whatever data the client has
It's not something that should be directly replicated, unless it should show data which is not relevant to the client, and thus needs to be manually replicated
What I'm saying is. When I place the mini BP in the level. I know it ony happen on client. How can I grab the ref.
to UPROPERTY(Config)
i would imagine
@summer tide it works locally
you only need to prevent it from running on dedicated servers
all actors that need to be displayed on map should register with it locally
no networking involved whatsoever
Yea so I need to use GetActorOfClass of BP_Minimap to get the ref in my char BP
THis is what I did. https://gyazo.com/c66a497471a708d28a1728d7433e3d9f
you do have some kind of "singleton" actor on the level no?
yes
so you can preplace BP_Minimap on the level
set a reference to it on your "singleton"
and access the BP_Minimap via the "singleton"
instead of doing getallactorsof class
Sorry what is singleton. I tried to grab the ref of th eBP_Minicam via the level BP.
Stored in my game-instance.
i do have plenty of data in level BP
i just never do any logic there
for example, all quasi-singleton actors on the level
LevelManager, FOW_Manager, Minimap...
are assigned to LevelBPs variables whenever the level is saved
minimap would actually make a good world subsystem
What's the concept behind saving and loading a steam multiplayer game
Is there any sample BP project outthere?
What do you mean by saving and loading
@vital heron So when you run the game in steam multiplayer and you save the game, it saves on the server only into a file. When you load do they all have to be in the lobby or loading during in-game is fine?
Well for the saving part you will need some sort of data storing thing
I suggest taking a look into a thing called playfab. I used to use it when I was back into Unity and it was great, but I'm not sure if it is compatible for ue4
Also for the loading it honestly depends on what you want to do since you can do both
As for BP sample projects I don't think you will find any but you can definitely find a lot of good tutorials for steam online
im at a loss on where this fails for a local server. Works fine on a dedicated server. I think its because the call gets made on the server player controller, still trying to figure it out. New to UE4 Networking still.
I have a widget make the respawn call, it casts to a clientside on the player controller validating if the player has a pawn or not, if not it does the server event which i think is causing the mixup
I am trying to understand how to use dedicated server in Unreal. So I started form zero https://unreal.fluiddynamics.eu/dedicated-server-for-dummies/ Comments and suggestions are welcome
hi!
I'm requesting to spawn a character from the client to the server. Is there a way to return that character to the client after spawn?
so that I might work on it on the client, and only on the requesting client?
I'm noticing that my input packet contains 2 input buffers rather than 1 (pink) - which is weird because the net update frequency is 60, and only every 1000/60 ms is a new input generated by the client and sent to the server
This is true while some other packets indeed contain just one input buffer:
(which is desirable)
Each input buffer is sent via an RPC, could it be that indeed, RPCs are packed into the same packet rather than being sent in different packets?
I thought the latter was the case up until now..
Thankfully it seems like indeed, keeping the net frequency on 60hz but having the client generate an input at 50hz means some packets have no input in them which makes sense
it'd still be really nice to know if I could ensure a single input buffer per packet, since that jitter can introduce a very unwanted processing delay jitter on the server
client can't send an RPC with input packet between its frames ^^
is there any function that gets called where I can send my RPC?
Some OnNewPacket() function kind of thing?
is there an event when an actor gets replicated from server to client?
the static delegate from FWorldDelegates for new actor will get broadcast
as client has to spawn the replicated Actor
yo=u can try to track a better hook from UPackageMapClient::SerializeNewActor onwards tho
there is also the fact that the new Actor tends to call BeginPlay right after its spawned @paper lava
you can just do
virtual void AThisActor::BeginPlay()
{
Super::BeginPlay();
// optinally add checks if client, for Role, or whatever
if (AMyPC* PC = Cast<AMyPC>(GetGameInstance()->GetFirstLocalPlayerController())
{
PC->RegisterThisActor(this);
}
}
by far the simplest way to do about it, only situation where it doesn't work immediately is if you delay BeginPlay and spawn/replicate the actor before match has started
that abomination of GetPlayerController[0] unfortunately
will that get my local player controller or could I run into issues with other people's player controller when it's MP?
depends how you use it
there are safe ways, and there are ways that break everything
I would prefer to avoid the ways that break everything π
in this particular scenario, from BeginPlay of an actor
it will work as long as you don't try it on dedicated server as well
because dedi doesn't have a local PC
so if dedi instance were to run that, it would affect PC of whichever player logged in first
from listen server and clients, it would work normally
right. Can you think of anything why I don't have that node available? I only have getPlayerControllerClass
which node?
getPlayerController
its static, its available from any Actor or ActorComponent BP
or Widget BP
its just UObject BPs with no GetWorld implementation that can't use it
ok. I was trying to use it in actor but appearently the actor doesn't want me to get the player controller :>
it definitely works from there
ah, there we go. it doesn't work in the constructor
constructors don't have world context
BeginPlay is a good place
as all replicated variables that you changed on server when you spawned the Actor will also be set by the time its called on clients
that's perfect
@winged badger works great, thanks!
Can I manually set which actors should be replicated to which clients?
I want to replicate all actors that anyone on the clients team has vision on.
On the server I would need the actor and the client. Even better If I could presort this so I only have to calc which actors are replicated to the team once
perfect if I could set a list of clients to replicate to on conditions
not with blueprints
ok.. so I was thinking
- take every actor on team a
- get all actors of team b in their vision radius
- check line of sight
- if visible, add to visible characters for team a
- set replication for visible characters for every client in team
- repeat for team b
would this be possible?
@winged badger I guess it's better to do something heavy like this in cpp anyway
overriding AActor::IsNetRelevantFor can do it
as can ReplicationGraph
(mutually exclusive approaches)
replicationgraph sounds like a good place to start
@winged badger would it be possible to tell the clients to remove actors that are not visible anymore?
clients destroy non relevant non-static actors by default
and respawn them when they become relevant again
ok
why dose add instances for instance static mesh not work in multiplayer what so ever it just wont replicate
you cant replicate instance static meshes.
like if i do add instance world space as a multicast it replicates but add instances as multicast dose nothing
basically i cant make the server add multiple instance's at once for the client it can only be done by the client which means the server cant tell the client how many instances to add
hey is there a default place in the CMC to add custom validation for moves on the server? for example if i want to prevent movement while rooted, I could override GetMaxSpeed(), but I'm mostly looking for a generic place to put any restriction code if one exists, that way when the server receives a move I can say "was I trying to move? am i rooted? if yes, don't bother actually moving. was i trying to jump? am i stunned? if yes, don't bother jumping", etc.
Is there any possibility that we can see something like steamworks for mobile? That we can connect people with listen server model, but not from local network?
how to do you make a dynamic foliage in multiplayer
@slim matrix That's a rather vague question. The amount of ways is pretty huge. Depends on how large of a scope you want.
like ive tried using instance static meshes and the foliage actors in UE but i cant get ether to replicate and the only way i can make foliage is with just static mesh actors but that will get very performance intensive when you have a lot of foliage
@slim matrix Do you just want to replicate it being picked up, but still be able to draw it with the foliage tool?
like i want to randomly generate foliage that can be destroyed and saved
I've messed around with a couple of methods. The first was just locations of foliage. It was replicated from the server as vector2D. The clients themselves would do traces from a high Z level to hit the landscape and place the foliage. The second was actually rather nice. It was a single component placed in the level and it would only replicate an array of "picked up" folliage, so clients could remove it on their end based on the replicated location.
Depends on if you want respawning in the same spot or not.
You could replicate an initial location array and keep a second smaller array for common use. First array is the random spawn locations, second is the picked up ones. Destroy/create ISMs at those locations.
To be fair, if you're using C++ and you fast array it, a single array of Vector2Ds won't be that bad just for the locations.
yeah i would probably want to make a chunk system
that way it only handles loading in areas around the player to decrees arrays size
Certainly. I had that thought at one point too. Creating separate actors that handle it based on the level they're in, but that was intended to be a complex method for world composition and very large maps. Suppose it could work for smaller maps too.
Planned on making a painting tool and such for each actor so as to be able to place foliage in the editor around the actor. Was going to compress the vector data from a full vector down into just two uint16s
But yeah, in the end it just comes down to your use case and how you can integrate it easily into your work flow for your exact design. π€·ββοΈ
i was thinking of making a chunk actor that has child foliage actors that of handles and another actor that handles the grid of chunk actors
Hey there! When do you use Reliable RPCs vs Unreliable?
player input that doesn't happen on Tick and Gameplay Critical Stuff thats better late then never vs. everything else
@gloomy tiger Mainly if you need to do something important like spawn an actor or set a variable you want it to be reliable that way it will 100% happen unreliable would be use for something your constantly changing like a player location
It depends on how you go about passing inputs to the server
I would make it reliable
I'm calling a Fire RPC when user presses left mouse button, that's all.
Usually a pretty straight forward approach is to reliably send a packet every time you shoot
For my purposes i have a semi-reliable way of sending and buffering inputs
And processing them with a slight delay during the server's simulation, so the client doesnt send a reliable RPC whenever it wants to shoot the bullet - the server would already process the input in which he fires
etc
you can go about it in numerous ways
I think Im having a problem Iβve had is sprinting with the character controller if theirs any sort of lag then theirs jitter and it seems the only way to fix it is by doing c++ and client prediction
what do you mean doing c++?
Basically for changing the characters speed you need to do some c++ client prediction code for setting the speed to prevent jitter when you set the players speed
if you predict movement (default CMC) and you don't predict sprint speed changes
you get jitter
but usually something as simple as modifying the speed locally when you send ServerSprint
is sufficient
This video explains what my problem Iβm having is and how he fixed it https://youtu.be/RtQRMcupJs0
Many of you have requested a way to leave me a tip so I've created a PayPal and a Patreon.
PayPal: https://paypal.me/reidschannel?locale.x=en_US Patreon: https://www.patreon.com/reidtreharne
Discord: https://discord.gg/PdvudWx
You asked for it so here it is! This is my Networked Character Movement Tutorial complete with a full download to the pr...
When using the console command "open <IP Address Here>"
is there a way to stop that from working if the player changes their mind?
I Have noticed that if the client executes the command before I open the lobby, it puts them in the lobby as soon as it opens.
Can I prevent that from happening? as in give the player a "does not exist" message or "failed to connect" instead of constantly trying in the background until it works.
Thanks in advance!
Yeah, this guy is legend
unfortunately it is a very complex solution an i heard epic may have plans to fix this
I can confirm this is complex, it's why I dedicated a good number of months to come up with my own fix (although that fix is just for players atm)
By fix I mean implementation that allows me to not have to really do a bunch of setup if I want to add more custom movement
Like the sprinting mechanic in that video
All Input Based Movement, atm, has to go through the CMC in the same way.
Everything you do in BP only or in C++ without the CMC, and every tutorial you find that does this, are basically wrong.
Sprinting in BP only with some OnRep and setting it locally too, are of course working, but they are also wrong.
If you enabel the correction debug you'll see that either get corrections when starting and/or stopping to sprint.
iirc ShooterGame also inherits CMC and adds sprint function there
i mean for now i have correction disabled till i figure out how to do the c++ sprinting but also my game isn't a super competitive game that will mainly do local multiplayer so hacking wouldn't be as big of a problem but i would still like to get it to work
Unfortunately with a lot of those tutorials they add other things like wall running but Iβm just adding sprinting so it gets complicated to follow
If you add me friend I can send you the discord of Reid* so you can ask the question to him directly if you are having problems with his tutorials
K
Hey, do you know how to exit from replay mode without reloading level?
I need to replay goals in a multiplayer sports game.
I can record, stop, play but I can't find how to get out after playing the replay π
Not sure the replay feature was for that stuff, but could be wrong
"Improvement: Increased the default NetDriver bandwidth limit to roughly 100 KB/second. This will help alleviate latency users would experience when reaching the old limit. This new limit is still well within the ability of modern internet connections."
Cool little tweak in 4.26! Anyone seen an improvement in their projects? Especially RPC-heavier projects.
you can tweak that with defaultengine.ini config anyhow
they just changed the defaults
I'm having trouble closing out a session (prior to the game starting). I have the players in a waiting lobby, when the host DCs I want to close the lobby for everyone. I'm calling DestroySession() for both the Host and the clients, but it doesn't really seem to do that. The host is still able to call methods on remote player controllers. This also leads to a host/client not being able to join a new session.
@dull lance use fastarrayt
not if you don't rick replicate movement
on actors
they get stuck on initial transform
tick* the checkbox
use fast array in single actor
item should just have
UPROPERTY() TWeakObjectPtr<AActor> Actor;
UPROPERTY() FTranform Transform;
and callbacks do both PostAdd/Change
if (Actor.IsValid())
{
Actor->SetActorTransform(Transform);
}
and instead of replicating it via gazzilion actor channels
you do it over one
thats a struct
so no
it goes into FFastArraySerializer
which is a struct inheriting from said FFastArraySerializer and having an Array of your items
that should, yes, be replicated
you do not want a gazzilion actors being replicated for replication at the same time
quick q. If I wanted to assign automated roles at game start(not post login), should I script this inside of gameState or gameMode?(I am reading the 'Unreal Engine 4' Network Compendium and I am a little confused)
The roles are set for you
By the engine, you don't need to set them
That is, if you're talking about net role
where do you pull the info from which you assign them from?
wdym pull the info
Is there more documentation on the replication graph somewhere?
I can only find this: https://docs.unrealengine.com/en-US/InteractiveExperiences/Networking/ReplicationGraph/index.html
Overview of the Replication Graph feature and Replication Graph Nodes.
ShooterGame has a complete example, but that's all there is AFAIK
Pretty easy to understand once you break it down though
ok, I'll look into that, thank you
Is anyone else getting an engine crash when ticking off "Run Under One Process" in Editor Preferences under Edit>Editor Preferences in 4.26?
random by giving a special id to each player and then choosing x random ids to go to team a and the rest ids to go to team b @winged badger
0x0000000000000000 UnknownFunction []
0x00007ffe56a44399 UE4Editor-OculusHMD.dll!UnknownFunction []
0x00007ffe7e0ba22c UE4Editor-AudioMixer.dll!UnknownFunction []
0x00007ffe63fcd9ac UE4Editor-Engine.dll!UnknownFunction []
0x00007ffe6400351e UE4Editor-Engine.dll!UnknownFunction []
0x00007ffe6401ae13 UE4Editor-Engine.dll!UnknownFunction []
0x00007ffe640416a3 UE4Editor-Engine.dll!UnknownFunction []
0x00007ffe6401ac06 UE4Editor-Engine.dll!UnknownFunction []
0x00007ffe64fbdd77 UE4Editor-Engine.dll!UnknownFunction []
0x00007ffe64fb84a3 UE4Editor-Engine.dll!UnknownFunction []
0x00007ffe64415df9 UE4Editor-Engine.dll!UnknownFunction []
0x00007ff7c7702f55 UE4Editor.exe!UnknownFunction []
0x00007ff7c7720fc2 UE4Editor.exe!UnknownFunction []
0x00007ff7c772121a UE4Editor.exe!UnknownFunction []
0x00007ff7c773527d UE4Editor.exe!UnknownFunction []
0x00007ff7c7737faa UE4Editor.exe!UnknownFunction []
0x00007ffedb257c24 KERNEL32.DLL!UnknownFunction []
0x00007ffedb44d4d1 ntdll.dll!UnknownFunction []
``` More specifically it might be something to do with running in VR mode with 2 players. Seems like a strange crash just want to see if anyone has the same.
works fine for me
Not doing anything VR related though
@unkempt tiger Did you try launching in VR? Or is that not possible as an option without an HMD hooked up?
Shows up for me as an option maybe because I have one connected or because SteamVR is in my plugins list.
Ok, thanks for at least giving it a shot for me!
Do any of you guys have experience with the SmoothSync plug in? My team and I are looking to use it; but we want to know how it can be used for a large scale project
@steel vault grab the engine symbols aswell
will make that callstack more informative.
@meager spade can't believe I forgot to add those when I installed 4.26, now the error is quite clear it's a UE4 bug
with 4.26? im shocked π
I wish there was a quicker way to get bugs fixed like that. Where's ma personal Epic dev π
UE4Editor_OculusHMD!FOculusHMDModule::GetAudioOutputDevice() [D:\Build\++UE4\Sync\Engine\Plugins\Runtime\Oculus\OculusVR\Source\OculusHMD\Private\OculusHMDModule.cpp:227] Who devs for Oculus anyway 
Does anyone have experience with attachment systems for multiplayer? e.g. RPG-style armor slots and weapons. Is having multiple attached actors going to scale to 50+ players in game?
I wonder if there is a more optimized way to manage these attached meshes
@barren patrol Avoid replicating all of that. Just replicate a list of items equipped in each slot via like an ItemID. Let clients themselves spawn the correct mesh to set via the simple replicated data.
Ah, yeah. Network overhead can be optimized that way. What about processing overhead? I guess if the actors don't tick, it should be fine.
Tried that and now instead of crashing just the second instance it closes both without any crash or any error :/. Will just have to wait for a fix and launch out of PIE for now I guess.
Xero can you remind me how to get those? I forgot to get them as well 
@unkempt tiger go to epic launcher, click down arrow on 4.26 next to launch go to options, then check editor symbols
is it just a matter of ticking that Editor symbols-
yes, very good-
is everything then taken care of automatically? No need to do some other symbol config stuff?
@barren patrol Shouldn't change anything for the clients CPU wise except for when the values are replicated. All replicating an attachment does is tells the client to attach the same thing to the same parent on the client. The client would still be the one attaching/updating movements, etc. The difference being that it has one more object on the replication list to deal with rather than the base actor with a simple little list.
Nope, the crashes will be much more verbose after that
Sorry I meant yes it is all automatic
hey guys, im trying to get something to spawn in a procedurally generated multiplayer level
is it better to place the spawning function in game mode or in the level blueprint?
the spawned object in question is not a player
When in doubt, never use the LevelBlueprint
It can be properly accessed from outside in BPs and it's only per level
next map you gotta code the same stuff again
(unless some c++ to have your own class, but even then it doesn't make much sense)
So yeah, use the GameMode
makes sense
thanks
oh right, if an object is spawned by the game mode, is it naturally spawned for other players as well or do I need to replicate/multicast the spawning?
Nothing is "naturally spawned for other players" unless you make that class replicated
Doesn't matter where you spawn it (must be on server though)
Also, GameMode is owned by the server so the clients won't know to spawn it.
If you wanted it to be a non replicated spawn you could include it in something the clients own like GameInstance
I find it best to eliminate the need to replicate wherever possible to cut down on traffic.
However, going back and reading that you are doing it procedurally, it makes sense to do it in GameMode and then replicate those actors to other clients so that everyone has the same positioned things.
ah, ill switch my spawn function to a multicast then and see how that works
its a one-time spawn too, so aside from spawning after the level is generated, it wont eat up traffic anymore
thanks for the help π
Be wary that multi cast won't work for late joiners. If you need a one time spawn then just do it on the server but make sure you somehow replicate the positions of things for late joiners.
coincidentally, i dont plan to allow players to join the session midway, so luckily i wont have to bother thinking of a way to fix that
out of curiosity, does any 1 have any experience with developing MMORPG's with UE4?
i am quite curious how that would look like since the server only holds 100 players max
i believe most MMORPGs break down the world into many different areas and servers
so a single area/region of the world would actually have multiple servers handling it
ive read about people saying that you would need to code a custom server
but i think that would be too much of a task for any smaller group of devs
i've also looked into spatial OS which does what you said i think
most likely yes
i dont think the basic sessions system provided by unreal was designed to cater to MMORPG games as well*
UE4 is more session based but there have been big name MMOs made with UE3
lineage comes to mind
the best advice i can offer you (since i havent really delved in UE4 MMORPGs either) is that there are quite a few tutorials on youtube about making UE4 MMORPGs, so maybe quickly go through them and see if any of them do tackle the player size issue
(assuming you havent already)
oh no, im not going to make an mmo im just curious
i am making a session based FPS at the moment, MMO's are only the next step if this one makes money, a man can dream hehe
In general, especially with UE4, you won't ever complete an MMO with a small team or without any financial backing. A very large team, which requires a lot of money and resources, is your best bet, and even then, that doesn't guarantee you success or that you didn't just waste a lot of time/money. It's usually inadvisable in this discord if you ask around.
im encountering another issue, for some reason, the host of my listen server is running the Event OnPostLogin twice in my game mode
which is overriding the host from spawning in properly with the rest of the clients
is it intended for the listen server to run OnPostLogin twice?
okay wait nvm, just found out it wasnt
apparently the function I had running under OnPostLogin was also being run somewhere in my playercontroller and I totally forgot about it
which was causing it to look like the OnPostLogin was being run twice by the game mode
i feel pretty silly now since i've been trying to solve this issue for a whole day now
where do we get the clang v17 toolchain for building linux dedicated servers on windows?
in engine it only seems to go to v16:
/mnt/c/git/UnrealEngine$ find . -name 'v*_clang-*centos7'
./Engine/Extras/AutoSDK/HostLinux/Linux_x64/v11_clang-5.0.0-centos7
./Engine/Extras/AutoSDK/HostLinux/Linux_x64/v12_clang-6.0.1-centos7
./Engine/Extras/AutoSDK/HostLinux/Linux_x64/v13_clang-7.0.1-centos7
./Engine/Extras/AutoSDK/HostLinux/Linux_x64/v14_clang-8.0.1-centos7
./Engine/Extras/AutoSDK/HostLinux/Linux_x64/v15_clang-8.0.1-centos7
./Engine/Extras/AutoSDK/HostLinux/Linux_x64/v16_clang-9.0.1-centos7
./Engine/Extras/AutoSDK/HostWin64/Linux_x64/v10_clang-5.0.0-centos7
./Engine/Extras/AutoSDK/HostWin64/Linux_x64/v11_clang-5.0.0-centos7
./Engine/Extras/AutoSDK/HostWin64/Linux_x64/v12_clang-6.0.1-centos7
./Engine/Extras/AutoSDK/HostWin64/Linux_x64/v13_clang-7.0.1-centos7
./Engine/Extras/AutoSDK/HostWin64/Linux_x64/v14_clang-8.0.1-centos7
./Engine/Extras/AutoSDK/HostWin64/Linux_x64/v15_clang-8.0.1-centos7
./Engine/Extras/AutoSDK/HostWin64/Linux_x64/v16_clang-9.0.1-centos7
./Engine/Extras/AutoSDK/HostWin64/Linux_x64/v8_clang-3.9.0-centos7
./Engine/Extras/AutoSDK/HostWin64/Linux_x64/v9_clang-4.0.0-centos7
./Engine/Extras/AutoSDK/HostWin64/Linux_x64/vNext_clang-Next-centos7```
I think I've had to download it every release, maybe just because the installer handled the env variable?
opps, I linked to the legacy page
the non-legacy one: https://docs.unrealengine.com/en-US/SharingAndReleasing/Linux/GettingStarted/index.html
Download the Linux cross-compile toolchain.
but the v17 link doesn't work there either
hmm, clicking the link didn't work but copying its url into toolbar did...
must be some weird chrome thing with exes
Im working on multiplayer game logic and I was wandering is there any tutorial how to implement a game rules, I do understand how the replication works, but Im unable to crate Mods for multiplayer, let's say Free-For-All mode. I have functioning (re)spawns, score for kills, but cant figure out how to make game end. For instance, if any player reaches 30kills, I'd like to play animation on score widget and show 'Match End' screen to every one and cancel session, and then start load lobby?
@true spade https://docs.unrealengine.com/en-US/InteractiveExperiences/Framework/GameMode/index.html
Overview of the Game Mode and Game State
GameMode is where you would create a ruleset for the game such as FFA and GameState would handle keeping track of what is happening in the game and would be able to tell if the game is over or not based on PlayerStates
Once the gamestate realizes that one of the players has reached a goal of 30 kills or whatever limit, it can flip a replicated variable bGameEnded = true and in the On_Rep function for all players you can play the animation, show the end screen/do whatever you want. You could probably get away with a multicast here as well.
Everything is basically triggered by that change in GameState.
Thank you for the answer and the clarification, I think I understand now. I'll try to implement it. Thanks
Calling all steam experts: I recently tried to host a Steam Session on a packaged build of my game using the SessionInterface, and it seems to work because on my other packaged build on a different computer, I can search the list of Steam Sessions with app_id 480 and it shows up. When I click it to join, my logs say that it succeeded, but I get no form of server travel at all and the game remains playable, but acts like it's not trying to join. Here is my entire log:
Packaged builds are in 4.26 if that makes any difference.
@steel vault takes logs from both sides to figure something like that out
not being able to RPC or replicate TMap has ruined my codes so bad π© any advise ?
I am sick of writing UStruct for them
Funny enough I often prefer making a struct with an index over making a Map.
hi guys I have no idea why when I host a dedicated server , the first client leave the server will close automatically after the first client leave and the second client join the game ,https://paste.ofcode.org/GafhRpRHLTkeb4Vxbx4Kmg here is the log , thank you very much if you can help
Where is the Dedicated Server check box 4.25.4 source build my options:
Like this from the documentation for Setting up Networked Testing:
Thank you! Much appreciated!
anyone have experience connecting to an unreal editor listen server over WAN?
If i use a game settings on my map and this BP is spawning all of the players in each group so i use as a default pawn "none" and when they travel from the lobby into the game they not spawn as a character and stuck inside the wall without movement but if i set as default pawn a main character so everyone spawn but without any child characters like i want to. there is a way to fix it?
i wanna print string a variable of a character (in network) but only in respective screens
how do i do it ?
@whole urchin I normally just use the Kismet/Blueprint PrintString. It'll say which machine it's printing from.
but it'll show all clients in 1 screen
i wanna print the HP of the owning character in their respective screen
i dunno if it's possible
You could make the local HUD draw text on screen. π€·ββοΈ
ok !! i can do that
I believe you can also do an IsLocallyControlled() check before you print to keep it on the ownerβs screen.
trying to fiigure out how to make code that handles stuff like HP reduction not run on the client
following code does not work
if(GetWorld()->GetNetMode() != NM_Client)
{
does any 1 know whats the line of code that i am looking for?
I have a problem with a destructible mesh, the collision updates on the server and client but the mesh does not fracture on the client. Any ideas what could be causing this?
HasAuthority() or GetlocalRole() == Role_Authority
@limber gyro I'm on my phone so might have messed up the naming but should help you to find it
i am calling this from the player character, doesnt it have authority?
i might be wrong tho
Depends on how it's getting called, but in general nothing automatically runs only on the server (authority)
If it's something that happens as a result of some event that all clients and the server will experience you can filter it by doing if(HasAuthority())
ive tried the has outhority, didnt work
It entirely depends how the hp reduction stuff is getting called, also for the client to receive the hp changes HP needs to be replicated
yes it is
but the character is controled by the controler which has authority localy i think
I'm trying to throw items when a key is pressed.
When the action is pressed, the item is spawned in front of the player, and Add Impulse is called
At the moment, only the server can see that the item is launched.
The client just sees the item drop to the floor with no impulse added
Any ideas?
@limber gyro You should be doing damage checks and such on the server anyhow. Client should only ever have access to ask the server to do them. So checking to not do it on the client isn't the issue so much as why is the client even trying to run that in the first place?
well thats a good question
i basicly have an RPC called "applyDamage" that is called when a palyer suffers damage
in the base character class
but it is being called in both the client and server, i am not sure if that is suposed to be happening
does anyone use photon multiplayer sdk with unreal?
if yes, can you explain how photon actual works with unreal engine, and how unreal engine is sending data to photon server?
not sure if you will have much luck with that here, i have yet to see any 1 talk about photon
@limber gyro How can I break out of being the server, and add the impulse to the spawned object on the clients?
I tried a new owning client event, however no impulse is added
you can use a client function OR you could for example make an add impulse on the begin play of that object
if the object is replicated that add impulse on the begin play function should be called both in the client and server i think
let me give the second option a shot.
It means you don't have movement replication enabled for the item, server replicates movement to the clients when enabled
@signal lance
Replicate movement is turned on on the base item, and not overwritten for any of the item children
Is it possible to trigger an event on a client from a server, without the client beeing owner of the actor?
@limber gyro so created a variable that is exposed at spawn AddImpulse. Begin play checks, and adds impulse if true
Client does not see the impulse however
umm weird
what if you give it a crazy impulse?
wait
i am not sure if it work wit hphysics replication
do the same thing but "get actor location" then add to that value +500 or so
instead of the impulse
yeah higer impuse doesn't do anything.
i think it might be an issue with physics replication
if that set position works then it is the physics
if so then you will probably have to use a client RPC and the position might be differ from the client
no no no
forget the add impulse
Question, cpk.. What settings are you using for splines, that looks insane.
just do a set position
as such? only input is a float
@dense narwhal it's a plugin called Electronic Nodes
you need to do it on the root actor
strange
this ->setActorLocation
sorry i said the wrong function name
Movement replication with physics works fine
does it?
Yes
i was under the impression that unreal didnt do that because of network bottleneck
It's meant for that, it replicates location, rotation, linear and angular velocity
Thanks!
@toxic lion ok i think i know what the issue
very very possible
well well well
if I make the skeletal mesh the parent, then the impulse is replicated to the client
Thank you! I'm going to play around with it a bit to see if I can knock off that extra variable.
I can now just add impulse as I was originally trying to do. Thank you both!
Side question.
I've made the base ItemBP with a skeletal mesh, and all items use that mesh even if they will not have any animations
Is there anything wrong with this? I want to have some items have animations which is why I went with skeletal instead of static
Hey guys, how would client knows that it has disconnected from server ?
Let me just bump this: Is it possible to trigger an event on a client from a server, without the client beeing owner of the actor?
Multicast will run on all clients
I know, but what if I want to target a spec player?
isnt multicast kind of wasting resources, if it's just suppose to happen on one player. Just thinking out loud.
yes, you can do that, all you need is an event, which will do something on the actor you want, so it does not matter that actor is owned or not,
only that actor should be owned which is going to have the event, so you put your event on player controller, which is always owned by the client, make sense ?
and do run on owning client event .
well yeah in that case you can just use the good old Client Rpc but the question was "Is it possible to trigger an event on a client from a server, without the client beeing owner of the actor"
Well.. to be fair.. 'on a client'
nvm, I got my question answered, thanks! :love-heart:
Howdy, I'm struggling to parse and/fetch options I'm setting when calling Open Level from BPs. When my client binary connects to my dedicated server binary I see this log line: Join request: /Game/Maps/MAP?GameCode=OMGHI2U?Name=DESKTOP-OR95V4D-ABF122B7482C674CE28D93806821F03A?SplitscreenCount=1 My expectation was that within my GameMode in the dedicated Server I should be able to read this using Parse Option but it always returns nothing...I am trying to read by attaching to Event OnPostLogin...any ideas what I'm doing wrong?
@tidal crown what are you parsing ?
which option?
GameCode
I am passing it (and observing it in the logs)
but when I try to read it using Parse Option on the server-side it never has a value.
how did you get the options ? is your Options having value ?
I'm wondering if this is a weird client -> dedicated server transition thing when I am doing Open Level to the dedicated server.
I see the code path run in GameMode immediately and never again when I reconnect to the dedicated server.
i do this on Prelogin and it worked fine, i used Options Variable inside game mode and for me that was null, so can you please tell me, what are you using to get the options value ?
The "Options String" variable
This is in GameMode
thats predefined in GameMode
what's weird is this is what I see on the server-side: [2020.12.06-19.18.11:803][501]LogNet: Join request: /Game/Maps/MAP_K_PGameCode=OMGHI2U?Name=DESKTOPE94F98C74C5806A53D982185158ED5F7?SplitscreenCount=1 2020.12.06-19.18.11:807][501]LogBlueprintUserMessages: [BP_KenopsiaGameMode_C_2147482574] SERVER: ?Name=Player
I'm printing Options String and its totally different than what I'm getting in join request.
wait a sec
Options != join request does it.
is that your entire Getlifetimereplicatedprops?
but you have just one replicated member, with onrep?
do the other members replicate?
I am trying bind something to an event to open a door, but it wont work on the client. any idea?
I tried different combinations but the door still wont open for the client
i gotta say, seeing ATank with questions makes me feel like i am not a complete noob in unreal, if even the big boys have questions some times how can i not, haha
i assume yes for the first question, i doubt UHT would allow it to compile otherwise
ofc you are, you always answer peoples questions, i mean, probably not as big as Zlo but still
zlo is the biggest of boys π
you guys know each other irl?
damn you guys are tall af
i dont think they make computers on your size guys
Better get my steam host logs while Zlo is on...
I figured my shit out, I needed to override PreLogin to read the options... the "Options String" isn't the same thing.
@tidal crown yes same thing happened here
I was expecting there to be some sort of BP exposed thing, but I had to expose it myself manually...
no other warnings?
@winged badger how do you know if client is connected with server ?
like if connection is active or not ?
and you're setting the boolean to the ! of what it was before?
from where? @tranquil yoke
on client ?
it will have netmode ENetMode::NM_Client
i have case, where is client is connected with server, but undersome circumstances, client goes to sleep and meanwhile server kicks that client out because of the time limit, for inactive player.
but client does not know right away that it is disconnected from server, does not give a good user experience .
so i need to know, if my client can still talk to server, if not move then re joins the server.
unless server send a close
they won't DC till after timeout
you can configure the timeout lower
aside from that... not sure if there is anything you can do, short of bouncing keepalive RPCs
What's the best way to check that the GameMode is the server role?
in C++
(In my overriden GameModeBase)
you assume that it is
@tidal crown game mode is always server
OK, do I need to unset it on clients? I have the default game mode set and the default server game mode to the same thing
is that a bad practicE?
server is for dedicated server builds
this is dedicated server, sorry
it doesn't matter
OK! good to know
huh?
"unset it on clients" what does this even mean
it's not on the clients except for the gamemode class in the game state, which is not an instance
that would probably be bad
@winged badger i see inside logs, that client do Handshakes and even we can still use the clients , so it seems like code knows, that it is not connected to server, can we tap these events ?
@lost inlet sorry, I mean the config
there's a default game mode option in project settings for both the client and the server.
I have them both set (I 100% realize they are not shared/replicated)
do you even need to set this?
you should probably (re)read the exi's compendium @tidal crown
OK I def understand the relationship, I think I'm just explaining poorly. When the game first loads its not connected to the dedicated server...so it bootsup w/ a local Game Mode for that duration of time.
then, open level -> connect to dedicated server, bam no more game mode locally right?
at that point its owned/controlled by server only and its a totally separate instance unrelated to the client as expected.
@dull lance it has to be
its in a different process memory space π
This
there is one
?
until there isn't
right, what i'm saying is, they don't have any relationship.
one is fully on the client (at load) and the other is fully on the server (at connect)
literally they aren't connected to one another/synced/replicated, as the compendium says.
I'm agreeing
you'll probably have a main menu map, but you typically use a different game mode for this. that runs locally
that default GameMode is running before I open Level on dedicated server tho
yes!
that's what I'm trying to get at poorly π
@tidal crown use IsDedicatedServer node
why would that be bad?
becuase it gives the false appearance that they are somehow related.
i mean you can make a simple separate GM for main menu level
@winged badger yeah, that's what I should do.
but other then that, w/e
yeah that makes sense.
I was doing client auth in there (PlayFab) so I probably need to move all of that to a local-only game mode that is run by the main menu only.
What's the best way of getting someone's ping?
I think its on the Playercontroller or player state?
i need to spawn a bunch of diferent particle effects attached to the player at the same time but i dont want to make multiple particle components cause thats jsut messy, those effects need to be replicated ofc so having a particle component would be ideal, does any 1 have any idea how to achieve this, multiple effects simultaneously with only 1 particle component?
i have a few replicated variables that would manage the effects
the alternative would be to spawn an effect attached i think but that would require a multicast and i would like to avoid that
Are you using Niagara? I would just make a Niagara system and add each effect you want to it.
Also, what's the issue with making separate components for each effect?
I would just create each Particle system component for the actor, attach them, and activate each separately in code anytime you receive the replicated event to play it.
there is no issue i jsut dont like it, too much stuff, too messy
can you just add stuff to a niagara system?
like multiple systems?
Yea that's what it's made for
You can create a bunch of emitters then make a system and put them all in there
Might be able to control each separately in code but I haven't tried that yet as I don't need to. I just create components for each effect and it is compartmentalized/logical. Nothing about it seems messy to me.
but you cant put 2 at the same time can you?
it is messy, if i need to have 100 effects later
simultaneously
am i just gonna add 95 more components?
If you have 100 effects simultaneously you're going to have a mess anyway π
But yea if you want to create a system that plays 100 effects at once you can
You just have each effect in its own emitter, then create a new system that combines them all, hot swap that system out in the component and activate it.
ye but it still only 1 system per component right?
Yes
i have effects that are based on systems so i dont know how that would work
esssencialy i need multiple systems at once
Then you either spawn them at runtime without a component, or you hot swap and activate.
Or you do like I said and have a variable on each emitter that somehow activates it, but I haven't tried that and it sounds overcomplicated and unnecessary
but then they wont play simultaniously no?
Correct.
So you need to fix your systems or have a bunch of components
Or you have a function that spawns and plays them all at once
So not using the component at all
Also, this should probably go in #niagara since this is veering off the path of multiplayer. Apologies for flooding.
ye thats what i was trying ot avoid
indeed
i ws just asking here because i wanted to avoid multicasting
You can, create a state variable with a bunch of enums/tags and switch it on server and when it replcates you play the system
It's really hard to just assume what you're trying to accomplish though, so there are probably better alternatives but I can't suggest them without knowing.
its for status like sleep, poison, stun
for example a character can be poisoned and stunned at the same time
Yea so if you want to avoid a bunch of components attached to your character then I would just create the niagara system at runtime and play it
the thing is i need those systems to last x amount of time, and i dont think fx's can be created with a timer
honestly supper messy
Yea they most definitely can. You can give it a lifetime
Niagara is incredibly powerful
Whatever you think you can do with it, you most likely can
but not in a sense of particle life time
You can create a user defined variable on the system for lifetime and set it on runtime
You can user define variables almost everywhere in the system and change them dynamically
interesting
what is the proper way to have a widget access a variables in the playerstate?
I'm using PlayFab for multiplayer user identity, and they provide a PlayFabPlayerId that'd I'd like to use as the PlayerState UniqueId. It's an FString and I'd need a way to make an FUniqueNetIdRepl...any suggestions on best way to do the conversion?
there's a protected method that can go from string, would the idea be that I need to subclass the FUniqueNetIdRepl type?
OH wait, nvm found this: https://docs.unrealengine.com/en-US/API/Plugins/OnlineSubsystem/FUniqueNetIdString/index.html
Unique net id wrapper for a string
Ok, so I finally got around to retesting my packaged game in 4.26 with steam from two different computers, and I got relevant logs from both the host and joining computer clients for a listen server. I think @winged badger might be gone for today, but if anyone else spots anything out of the ordinary would appreciate some feedback! The host didn't have too much going on it was mainly the joining client that has issues.
I also just found that link which seems to be a similar problem and he disables the plugins for steam, but that just makes me think something is being set up incorrectly.
OK I guess I'm still confused, if I'm triyng to make a custom UniqiueNetIdString, should I be subclassing it to specify a type?
ultimately I'm tripping up on my GameMode base getting mad saying I have an incompatible_unique_net_id
I have the onlinesubsystem set to null
and I just want to set my own custom value here.
the subsystem it reads out is Null by FName, which is correct.
so I just need my UniqueNetId to be of Type Null
Get the type token for this opaque data This is useful for inferring UniqueId subclasses and knowing which OSS it
That's what needs to return Null for my custom type.
omg...there's an explicit constructor for custom Type...
sorry I totally missed this.
its almost too easy thats the problem π
I need some advice about organizing event and data replication:
Let's say I have an array of actor refs, like a list of items picked up by a player, or something like that.
When something is added or removed from that list I want to inform all players about it. I can do that by replicating that list. No problem there.
When I want to also trigger something when the list changes I can use rep notify and it will trigger when the list changes. Again no problem.
However, I would like to pass some additional information, like a reason why the value changed - and I can't do that with rep-notify.
So, I can create a multicast event that passes all the info I need. However, when that event is received I cannot be sure that the updated list has already been relicated.
Client might receive an "update event", but the list still contains old values.
I can pass the whole list as a param in the multicast event. That way I can pass additional info and make sure what everything is synchronized. But that means I have to send the whole array each time. Also in this case Im manually replicating the array so it doesnt have to be replicated automatically (although that is still useful to set the initial state when a new player joins). I can also pass only changes and each client can keep track of the whole array on its own.
This solutions seems a bit weird to me. Am I missing something?
Lets limit it to blueprints for now π
Let's say I mount a house. How can I prevent other players from mounting the same horse?
@summer tide horse has a variable "rider"
if rider is valid, you cant become a new rider
You simply call from the client a server RPC that tells the server to put you on a horse and then put yourself on the horse locally as well.
Yea I forgot to deal with state in order to prevent mounting. Replicated state variable of some kind.
@kindred jungle I do have a rider variable. If I validate this, it will work on other players trying to mount the horse. But then what if the rider trying to dismount. Since I use the same key for both
if (rider == me) dismount else mount
Yea thanks @kindred jungle . I was able to use your logic. Since I already had similar variables in place.
@steel vault I'm already doing that as part of the riding sys.
Argh, can't get this damn steam connection to work and 4.26 breaks my run in separate process so I can't even test multiplayer anymore π¦
what would be the best way to spawn in players in a game that uses level streaming? right now my players keep getting spawned in the areas where we just streamed out of
Hello, I have a trace running that runs off players location, detects another actor in front and pulls up their profile - I am wondering how I would properly do this? I cant figure out how to get the profile to pop up on the client screen, it is only appearing on the servers screen
Any sort of help would be appreciated, Im somewhat of a noob with replication
Hello π Does anyone know if PlayerState.GetPlayerName() will be the same for clients over non-seamless server travel?
It seems so in my test but I'd like to know for sure
@lyric mural why are you doing line traces on the server for a simple profile pop up? I would do all of that client side and just pop it up locally instead of involving the server at all. That doesn't seem like an important server function.
I was trying to do it just client but it wasn't returning the ID
Not sure what I'm missing
is it like impossible to replicate objects or what?
its not impossible
I'm having trouble getting steam to work with 4.26
It seems to use steam 147
but the only download at the steam site is for 150
so should i just make my object into a structure will it work?
UObject replication looked scary the first time I did it without much c++ know-how, but I got it working just fine with a few tutorials and questions here and once youβve done it once itβs easy to do again.
UActorComponent is a replicated UObject
even without a tutorial you can steal everything you need from there
thanks for the info guys i'll see what i can do in c++
@twin juniper what are you trying to do where you need a replicated object without actor?
Like your representation of an inventory item is an object?
I'd make it just data i.e. a struct
i'm not sure if you can use structs for drag drop operatiosn
How would the UI have anything to do with it? You can have whatever sort of UI you want but the end result should be a transaction moving an item.
Spatial inventory isn't really any harder than any other kind, just your "CanItemFit" logic is a bit more complicated.
would you use this function?
That's all just UI, has nothing to do with an actual inventory system.
You'd run some logic on the OnDrop event to actually do the inventory manipulation
yup and the payload is how i get that objects information using that function
None of that needs to be replicated. Your end result should just be a message to server like "I want to move item x to slot y in container z"
its using the item objects data to spawn the object though
anyways its late for me trying again tomorrow
@twin juniper for that you put a struct into UObject thats drag&drop context
if you want to use structs for inventory
do someone know what can i do if the players spawn with "SpawnActor BP" and i set in GM the default pawn as none to let the BP spawn all the player, but there is a problem. when i start the game with only one player as host everything load normally but when there is more then one player the character not spawn and everyone is stuck with no movement. there is any way to fix it? (this is similar to the among us spawn when all the players use servertravel to move from lobby into the game map)