#multiplayer
1 messages · Page 654 of 1
Hi all, what's a reasonable way of broadcasting kill messages? Should I have the gamemode iterate across all playerstates to tell their respective controllers to update their HUD? Or is there a way to listen to a multicast event within the HUD blueprint itself?
Hi, can anyone tell me a possible reason why Actors are not replicated and only execute NetMulticasts on the server? I have bReplicates and SetReplicatingMovement() both set to true, and every component has ComponentReplicates set to true.
When a PlayerCharacter walks over them they are supposed to attach themselves to it and detach themselves when the Character dies, this works fine on the server, but they don't do anything on the clients.
I've tried using NetMulticasts to get them to attach & detach, but the NetMulticasts only get executed on the Server. I've made sure that the Server is the one calling the NetMulticasts. Any ideas on this? I'm stumped.
I think I've made some progress on this. Something that I should have added is I'm streaming the Actors in with a Level using ULevelStreamingDynamic::LoadLevelInstance()
And according to this thread: https://forums.unrealengine.com/t/dynamic-level-streaming-with-multiplayer-support/79517/23 there seems to be a problem with replication using dynamic level streaming. the thread is old but since I'm having the same problems I assume it's not fixed. I'll try another way and see if that works I guess.
Yup. For anyone who stumbles upon this having the same problem: using UGameplayStatics::LoadStreamLevel() instead of ULevelStreamingDynamic::LoadLevelInstance() doesnt break replication. The drawback is that I have to add the levels I want to stream as sublevels instead of doing it dynamically but I can work with this.
@blazing socket Is this for like a kill reel?
I haven't heard of that term, but I think so
Like the little pop ups that show someone died, and how in the corner of the screen.
yup!
Depends on your game style. Either the dying pawn can do that locally via GetFirstLocalController->GetHUD->IAmDead
May have issues with relevancy there though.
So the other way is likely to use GameState. Do a Multicast, on the recieving side of it, call a delegate. Bind that Delegate in the local HUD's Beginplay or something from GetGameState. Or even in the Widget itself and cut the HUD out entirely.
Then server death code can eventually run that multicast.
Hi guys I just started with multiplayer and I am noticing BoxTraceMultiForObjects called on Server doesn't tick as fast as in the client resulting in inaccurate hits for my melee system, any idea how collisions should be treated?
Perfect! I will try this, thanks
Would it work using PlayerState instead of GameState?
Possibly. Just depends on how you want to set it up.
Depends on what you do. Server and Client can always be a bit off.
I am tracing a weapon, when I trace on client there are enough traces but on server is less than half, seemed weird
Hm what executes the trace
tick
You can check the delta time of both ticks and see if they are similar. Idk how you test it but if the other player has low fps it would cause this
Might happen cause one window is not foreground maybe?
Either way shouldn't matter much as client should only use it for visual effects and server should be the one dealing damage
It happens when simulating local network too, also the problem is exactly the damage, I actually found out about this because the damage was being applied only some times
I will check the delta time on both ticks, that sounds like a good idea thanks
Are there any good sample projects (that are not ShooterGame) that have examples of scoreboard and tracking stuff like kills/deaths through UI?
you just track that stuff in GameState and PlayerState
very simple really, someone gets killed, server increments the score on the game state (which is replicated)
scoreboard just reads this value
or server increments it on the killers playerstate
your scoreboad just loops through all playerstates (which you can get from GameState->PlayerArray
and read the kill count, death count, etc
UT4 also has this stuff
Hi, does anyone know how I can map a player state to a certain actor/pawn which is replicated? My intend is to create name plates above each player.
I have a player state which contains health and the player name. Inside the Nametag Widget (mounted on the character) I listen to an UpdateHealthEvent to update the current health in the widget. The problem ist that I cant call get player controller -> get player state on the replicated pawns. I know that there exists the Player State Array inside the Game State but how would I know which player state belongs to which replicated pawn?
Edit: In cedric's multiplayer compendium there is an example with a health variable on the pawn. Would be the solution to pass the pawn to each of the widgets ... hmm
Pawns carry the PlayerState of they PlayerController that is possessing them.
You can always access the PlayerState from a Pawn.
It is simply a variable.
private:
/** If Pawn is possessed by a player, points to its Player State. Needed for network play as controllers are not replicated to clients. */
UPROPERTY(replicatedUsing=OnRep_PlayerState, BlueprintReadOnly, Category=Pawn, meta=(AllowPrivateAccess="true"))
APlayerState* PlayerState;
Yes from a pawn which is from my understanding and testing also the replicated pawn but my problem was that I need to access the player state inside the UMG widget to bind my custom event. And I think from what I have seen is that if I put the player state into a variable the player state does not get replicated anymore? (the replication bloons dissapeared) So the solution could be to just pass the pawn reference which contains the player state and I then can bind to the custom event. I should have clarified my question a bit more :S On how I can access the player state on the UMG widget.
And thank you for answering my question 🙂 This makes clear that I need to pass the pawn to the umg widget.
Edit: Yes damn it was just the Pawn reference I needed inside the UMG widget.
Thanks so much!
That’s pretty open ended, what’s the WebSocket for? You could do that a whole lot of different ways
You’re using websockets for that?
I’m not sure if it’s worth reinventing the Unreal networking stack for that
If it’s going to run on a game server exclusively, then yes
Or locally without a connection to an actual game server
Game modes don’t exist on clients
Yes
Well... if you're not using unreal's multiplayer systems at all the usual advice doesn't really apply. Gamemode only exists on clients in a standard unreal client/server setup, but if you only ever run standalone (no server) from the perspective of unreal's networking then you'll still have a gamemode locally.
Still, it might be best to find somewhere else to put it that makes more sense than the gamemode. Other options include the game instance (if it needs to last across level transitions) or subsystems of various types (world subsystem and game instance subsystem are common).
GameInstance exists everywhere
I wouldn't throw all your networking stuff into it though, at least put it in a separate gameinstance subsystem to keep it separated from unrelated code.
Use a GameInstanceSubsystem as has been mentioned before.
Dont use the GameInstance itself.
Sounds good, now convert it into a GameInstanceSubsystem instead.
An overview of programming subsystems in Unreal Engine 4.
Hi, can I play multiplayer within the editor without packaging and create executable file?
I've tested to pop-up multiple client windows by increasing the value of the Number of Players option in play button in UE editor, but it seems to be emulating from within a local PC.
Actually, I wonder if other members can access my game on their PCs and play it together in PIE.
Does assigning the root component to the "Component to Attach to" in the make VoiceSettings for Voip cause issues?
UCLASS(Blueprintable, BlueprintType)
class UNREALBODY_API UIKCharacterAnimInstance : public UAnimInstance
{
GENERATED_BODY()
is it able to use Replicated in UAnimInstance' childClass as same as in ActorComponent's childClass?
Maybe but you usually don't replicate AnimInstances.
i think it's not able to do that in UAnimInstance
By default most certainly not
PIE is only on your pc
You should not connect to each other through pie
If you want that you can start the game as standalone or package it
so weird...i set all var Replicated in
UCLASS(ClassGroup = (Custom), meta = (BlueprintSpawnableComponent))
class UNREALBODY_API UIKBodyComponent : public UActorComponent
like this
UPROPERTY(EditAnywhere, BlueprintReadWrite, Replicated, Category = "IKBody")
USkeletalMeshComponent* Body = nullptr;
UPROPERTY(EditAnywhere, Replicated, Category = "IKBody")
FVector BodyCurrentLocation = FVector();
Can you please format your code snippets
Discord allows one line and block code formatting
```
Code
```
Same goes for one line if you only use one of the ` at the start and end
Also you can't just mark things replicated randomly.
SkeletalMeshComponents probably have nothing in them that replicates and aren't marked to replicate to begin with
You are only setting the variable as replicated. That doesn't mean the Component replicates
[Help] just a random question.. I'm about to add some text chat to my multiplayer game.. is there some special Unreal way of doing this? or do I just Server Function a String or text up to the server and then set a replicated variable on all the player controllers?
Cedric! what upp! you're the document guy!
sheeeeizz
Well you wouldn’t really use a variable for text chat, more a multicast RPC if all players are intended to see it
I feel like a variable would be a good optimization but maybe im wrong.. it just would be transient.. every time it replicates its going to load its value into the chat.. and then forget about itsself
a multicast is my first thought too
i just try to avoid them
...why would you avoid multicasts?
because they're kind of heavy right? like.. replicated variables are a nice way of evening things out.. and since i dont care if the text is RIGHT THERE ON THEIR SCREEN RIGHT NOW
idk
Replicating variables is much worse than sending a single multicast rpc. And by much worse I mean barely relevant because this is premature optimization.
i just go with that
oh alright, well if you say so
i dont know all the metrics of things i just know what i've seen from all the Ue4 optimization streams with wes bun and zach parish and stuff
im mis spelling their names probably
Replicated variables means that the server needs to check every network tick for a change to the variable, which eats up CPU time. Multicast RPCs don't involve that and shouldn't have much (if any) overhead above what you have to send for a replicated variable anyway.
Which is all irrelevant, because unless you know your exact bandwidth and CPU targets this is entirely premature optimization
use the best tool for the job.
yep i guess there's that
so you wouldnt be able to tell me how to properly set my bandwidth values would you?
when I tried to do it i had no idea if it was working
i was going off of old material i think
i know there's stuff in the game.ini and engine.ini?
and then how do you know if its working?
stat.net is pretty overwhelming at first lol
im in 4.26
sorry I should have mentioned that
Thanks!!
#online-subsystems has pins that talk a bit about it
DedicatedServer,
UCLASS(ClassGroup = (Custom), meta = (BlueprintSpawnableComponent))
class UNREALBODY_API UIKBodyComponent : public UActorComponent
{
GENERATED_BODY()
protected:
// Called when the game starts
virtual void BeginPlay() override;
public:
// Called every frame
virtual void TickComponent(float DeltaTime, ELevelTick TickType, FActorComponentTickFunction* ThisTickFunction) override;
BeginPlay & TickComponent is called on both Server & Client ?
Yes, BeginPlay() is called both on the server and the client, you can use 'PostInitializeComponents()' instead if you want to avoid this, about TickComponent I'm not sure
ok. i update BodyCurrentLocation value in TickComponent, and i set these Replicated
UPROPERTY(EditAnywhere, Replicated, Category = "IKBody")
FVector BodyCurrentLocation = FVector();
like this
so i should only do the "BodyCurrentLocation =xx;" on Server, not on Client, right?
then because of Replicated, the value is updated automatically to the client
Tick is called on the client as well. If you want to avoid this, just do if (GetNetMode() < NM_Client)
UActorComponent::TickComponent is called both on DedicatedServer and clients?
so for the Replicated VAR, i should only set the VAR value in the if (GetNetMode() < NM_Client), right?
it's not right to always set its value both on server and clients
Depends. Tick Functions have a bAllowTickOnDedicatedServer property.
By default, it's true IIRC.
You can check whether you can set a variable using GetOwner()->HasAuthority()
if (GetOwner()->HasAuthority()) {set value for Replicated} ?
void UActorComponent::TickComponent(float DeltaTime, enum ELevelTick TickType, FActorComponentTickFunction *ThisTickFunction)
not Tick, but TickComponent
yep
it doesnot have bAllowTickOnDedicatedServer
Im trying to replicate my characters entering a vehicle and possessing it. My current setup only allows server to use a vehicle. any ideas?
@lapis zinc are you running dedicated server ?
do not use get player controller
almost never in a networked game
u already have the player character
use that instead
also no need for multicast
possess should only be called on server client figures out the rest anyways
no just listen server
also for the player controller what should I use for the target?
Player Character > Get controller > cast to playercontroller
dont need to cast if it accepts it as target
also dont multicast
and only check for overlap on server
remove widget removing as well
do it somewhere else
how would I only check the overlap on the server?
custom events and functions for run on server?
Has authority
could you by chance show an example of what blueprint would look like? unless you cant which is okie
thank you!
binding the interaction tho is a bit tricky
other than that it works great!
would it be possible to bind the event as well or use some sort of over method?
I'm trying to get an actor that the client has spawned. Is it possible to do GetAllActors and then destroy the actor the client spawned? Getting all actors and destroying it currently will destroy all of the actors, not only on one client, but all clients. Id like it to only destroy the actor that was spawned by that particular client.
No
Only the Client can destroy that actor
The only way you can do that is to use a ClientRPC that is only used to destroy that one specific actor
how to make this Gun Replicated when MultiPlayer, it's just derived from StaticMeshActor. and already tried to set the Repilicates in details, but not work.
and the BP_PickupCube in the normal example also not Replicated, then how to make it Replicated?
Hey everyone, I think I'm being dense again but there's something basic I seem to have misunderstood about RPCs/Events:
On my Character, if I call a test event to run on the server via e.g. Spacebar, it happily fires on the server. When I run the same event from a Livelink update on the character, it fires only on the client.
Minimal example:
am I missing something completely obvious?
I have a very basic question - how can I send information from the GameMode to the GameState? I'd like to send info such as the time left in a match and when a round begins
i just applied point damage to enemy and it was successful but enemy cant get point damage. anyone know where is the problem?
Hey just saw your replies. I guess for me the problem is updating the actual widget. I tried binding the widget BP to a delegate that listens to playerstate when a player dies. However, I realized the problem with this is that I'd need to iterate through the player list and bind to each player state, which I'm not even sure is possible, if it is even efficient.
The other thing I could which is a lot simpler is binding the widget text to a BP function that iterates through playerstates and gets the kill/death counts. But wouldn't this be pretty performance-heavy? Especially if, like in my case, I want to keep up the scores permanently on the HUD. So each player would be iterating through the playerstates on every tick.
I'm fine with using the latter, but I'm wondering if there's some efficient way of tracking scores and deaths amongst players that I haven't thought of..
Question: Can I get players playing together without actually being in the same world?
Context: I want to do client side level streaming for an open world co-op game. If a player isn't near the other player I don't want to update any net traffic or render anything that's not in the vicinity. I'm thinking, for example, they both share a session but only share information of player transforms and event calls.
The other "player" that the see would be a dummy that moves based on the location of the other player's transform information.
this sounds like a case for standard client server model, but in reality the host pc is doing all the work. I'd more or less like to keep them in sync, but who ever loaded an area first is sort of the host of that area.
Scenario: Player one walks into a room, enemies spawn etc. Player 2 later walks into that room, room spawns, gets a list of instantiated actors from player one, enemies load for player 2 and are synced. Player one walks out of the room and it unloads for them. Player 2 is now "host" of that room. Player one walks back into the room, gets list of instantiated actors from player 2, enemies load in.
Doesn't sound like this works with current client server model so really I think it ends up being something like they share a session ( they have a tunnel to pass info back and forth ) and everything else happens locally, get's current owner of the area for server checks
that gets a bit messy for handling the world state. Someone is always going to need to be server for that wouldn't they hmm
Hey all - I'm having an issue that has cropped up recently in my project. I have an AI controlled pawn that activates it's Behavior Tree on BeginPlay.
Lately I've noticed that in a 2+ player game when I call from the client to the server to spawn this AI pawn, the pawn spawns and I do see them on the client but they just idle in place on the client. On the server they start charging to me and attack me. Only after they start or succeed in their attack do I see them in the correct spot on the client.
I've been debugging this and the most I can see is that the client side version of the pawn just isn't receiving any data from the server but I cannot pinpoint why. Unreal Network Insights isn't showing anything egregious (not that I'm terribly good at knowing what to look for).
I am extremely new to UE4, eventually i would like to add multiplayer, how would i go about doing this in blueprints?
Hi, I'm currently trying to understand how CharacterMovementComponent works.
From my understanding, UCharacterMovementComponent::ClientUpdatePositionAfterServerUpdate is used when client and server moves diverge and a correction issued from the server is necessary. Here's my question: why is it that the character reproduces any moves sent from the server instead of the server simply directly updating the characters position, velocity, acceleration, movement state, etc.? Wouldn't this be a simpler solution or am I misunderstanding something?
Specifically, I'm interested about this part:
// Replay moves that have not yet been acked.
UE_LOG(LogNetPlayerMovement, Verbose, TEXT("ClientUpdatePositionAfterServerUpdate Replaying %d Moves, starting at Timestamp %f"), ClientData->SavedMoves.Num(), ClientData->SavedMoves[0]->TimeStamp);
for (int32 i=0; i<ClientData->SavedMoves.Num(); i++)
{
FSavedMove_Character* const CurrentMove = ClientData->SavedMoves[i].Get();
checkSlow(CurrentMove != nullptr);
CurrentMove->PrepMoveFor(CharacterOwner);
MoveAutonomous(CurrentMove->TimeStamp, CurrentMove->DeltaTime, CurrentMove->GetCompressedFlags(), CurrentMove->Acceleration);
CurrentMove->PostUpdate(CharacterOwner, FSavedMove_Character::PostUpdate_Replay);
}```
YouTube... read... YouTube... read... YouTube
It’s going to take you at minimum a year to make a multiplayer game if you’re brand new
And that’s if you’re extremely dedicated and persistent . Good luck!
ok, thanks : ) good luck in whatever you are doing as well!
On begin play , i make a switch has authority to create the UI widgets only i i am the a client:
but since i do that , there is no UI on the main menu
why?
You don't need a switch. The widgets won't be created on the server anyways
Ok , but it displays red errors on the logs
Also, you need to add the widgets to viewport
Look for the node add to viewport and pass in each of the created widgets
I'm doing that and it works well , but there is logs errors i want to remove
Show the log errors
It seems that at the point when you are trying to set is focusable, the object references are not yet valid
But does it work properly?
yes
Also, pass in owning player
And you shouldn't really use the switch has authority
Also, you can add an is valid node before using the widget references OR use validated get node.
That is normal behaviour. If not valid you'll get the error.
I think it depends on the order of creating and using the widgets
It works with is valid
it was because i used two clients in one instance of the game
for testing network
Oh? Okay.
the first client , try to use the UIwidgets as they are not already crated in the main instance
Ah I see. But is it working now? Also, if it's for a multiplayer setting, I think you have to create the widgets separately for each player. In order words, either in the player controller class or in your character class
Yes its working , For the moment there is a Game manager in my project owning the widgets ( that was a bad idea of someone in the discord ) , i will remove it and use gamestate , playerstate ... only
Okay
What is expected use of non-seamless server travel? I expected that it will travel my server, send some RPC to clients, clients will disconnect, travel and join again to the new map.
But the actual behavior is that only server travels and clients do nothing and get timeout when server is in the new map for some time.
It works if I do 'open 127.0.0.1' manually on the client when server is ready but is not the whole purpose of non-seamless server travel that it should do it for me?
Even docs say When a client executes a non-seamless travel, the client will disconnect from the server and then re-connect to the same server, which will have the new map ready to load.
ah, it seems server needs to run as Standalone Game, not running under single process is not enough. I read that seamless requires it but I did not hear that also the non seamless server travel does not work in PIE.
How to host a new instance of server for match automatically
like you know how it's in multiplayer games
like server automatically hosts instance of game for new match, if none are available.
by writing a system yourself, or by using a service like gamelift or playfab.
Though there are other companies like Zeuz and Multiplay that do game server orchestration too, which is usually a hybrid of bare metal and cloud
Upfront costs can be scary though
can i get some input please?
Component System isn't good to execute server tasks as there is no switch has authority node. is that correct?
any known workaround or should i call everything within gamestate/playercontroller?
Is there a built in way to monitor the server's current tick rate?
Our server is decaying in performance over time, even a 12 hour old server feels really bad. And yet none of the resources it's using seems off. Unsure about servers that have had people in them for that long, but these typically are empty, is the engine trying to be smart with empty servers but failing to wake up properly when someone connects? It really feels like as if it's tick rate drops.
Have tried on multiple hardware and operating systems (Windows and Linux)
Well at least in C++ components have an easily accessible Role variable. The owner of the component is also the actor and the Role can be fetched from there too
yea but without authority check inside the function couldn't it just be maliciously forced to execute with skipping server? (from client directly)
like that?
yes
ic, thx - big help
so after possessing a vehicle my character gets trapped in the car essentially, how would I get the character reference for it?
Save it before you posses?
Hm, yeah, that would be called a stale pointer. Basically pointing to something that is now reassigned
It's not null as far as I can see?
On the server, my player spawns a sword in its BeginPlay() and attaches it to his hand like this:
if (HasAuthority())
{
static FName weaponSocketName(TEXT("WeaponSocket"));
FActorSpawnParameters spawnParams;
spawnParams.Instigator = this;
spawnParams.Owner = this;
Weapon = Cast<AMyWeapon>(UGameplayStatics::BeginDeferredActorSpawnFromClass(this, WeaponClass, FTransform(), ESpawnActorCollisionHandlingMethod::AlwaysSpawn, this));
if (Weapon)
{
Weapon->AttachToComponent(GetMesh(), FAttachmentTransformRules(EAttachmentRule::SnapToTarget, EAttachmentRule::SnapToTarget, EAttachmentRule::SnapToTarget, true), weaponSocketName);
Weapon->SetOwnerCharacter(this);
UGameplayStatics::FinishSpawningActor(Weapon, FTransform());
}
}
Then in my sword's BeginPlay, I pass the sword's pointer to its parent so that the Client can access the sword and do stuff with it:
AActor* pParent = GetAttachParentActor();
if (pParent)
{
SetOwnerPlayer(Cast<AMyPlayer>(pParent));
if (GetOwnerPlayer())
{
GetOwnerPlayer()->SetWeapon(this);
}
}
It seems like this doesn't always work, and sometimes the AttachParentActor is null.
Is there a better setup for what I'm trying to do here?
EDIT: nvm, there was also a sword being spawned to be shown in the UI and that's the one that isn't attached to anything.
how would i go about doing that?
When you possess your veichle, you have a reference to it. Just save it, ie. on your PlayerController
The controller is being saved by not the player character
would I just save it the same way?
i would say yes, since its the player char you want to re-possess
You literally cast to it in your overlap before you possess the car. You can save it in the car
right.. or in the car.. good point @thin stratus
can you show an example cuz im not sure what you mean thru text
Guys, how difficult is it to convert a simple singleplayer game in UE4 to multiplayer?
The game only containing things like combat, experience (level system) and inventory
https://gyazo.com/d994c51049ec2e09b849c93a2b1c1b2d
I was hoping to make a standalone C# server and connect to it with UE4, but not sure if blueprints support that and my c++ skills are non-existent
If you didn't think about multiplayer from the beginning, then it will likely be difficult.
I mean, all I did was done in 2 days
It's really a "how long is a piece of string" kind of question tbh, the answer is "it depends"
You won't know until you try it
Any good tutorials on connecting to external servers through blueprints?
C# server isn't how UE4 multiplayer works anyway, if you want a dedicated server you'll have to use C++ - but a listen server is hosted locally and you can support that "relatively" fine in BP
BP isn't great for MP in general though, it has limited support.
Wait, you can't make UE4 connect to external standalone server?...
Sure you can but "server" has many definitions
I mean an actual server processing and passing out player data
I know very little about game development, I work as a .NET backend dev for military defense systems
So was hoping that the knowledge of developing servers there would come in use here
Not so much unfortunately, there's multiple parts to it. I'd start by reading cedrics Network Compendium (check pins)
Seems to have been buried
This is for a match based multiplayer though, no?
Would it work similarly for an open world game?
The same principles apply on the game-code side
For UE4 you still need an actual game instance running on a server which handles game-level info.
How you would manage something like persistent data etc. is another area
Damn, exciting
Joined the TitanReach open alpha and got the urge to get into game development to make something similar 😅 Big goal and likely quite unrealistic alone, but excited to see where I can get
MP is definitely "indie hard mode", MMORPG probably borderline insanity 😄
I mean, I made MMORPG servers before
its not really difficult
no idea how it would work with UE4 though
@twin juniper If you've made MMORPG servers before, then all you really need to consider is that a UE4 server is a subserver. Your backend server holds all persistent data like where a player is located, a cache of their stats, etc. UE4 server is their current world level. UE4 cannot easilly support more than maybe 40 players without some serious optimization like Fortnite has done. A dungeon in this case might be one UE4 Server. City area might be another server. Both of which run off of data imported from your backend, and report back to the backend to update persistent stats.
But it's worth noting that this is impossible without C++. At a high level, it's an easy concept. but there are a lot of things to tie together and make work and that's before you even start considering basic gameplay elements or the idea of launching/debugging/polishing it. Not to mention it's highly untreaded territory. Most people won't be able to help.
Think I'll just make everything work on singleplayer and then start from scratch on the multiplayer version 😅
... along with redesigning 2/3 of systems as they require special handling in multiplayer
better off starting with simple multiplayer then, even listen server
there was a youtube series "lets make an mmo" i think showcasing world server and UE interaction
but it relies on that person's backend
worth as example but you will have to make own
Hello I seem to be reaching a maximum length FString/Ftext can have as RPC arguemnt
Anyway to change that limit maybe?
no, only by compressing or replacing with something else. what are you sending?
@violet sentinelPretty sure I'm way too bad with ue4 to get stuff like that done xD
Really?? not even with MaxRepArrayMemory or something similar that would exist like MaxRepStringSizeMaybeIdontknow
that is an extreme bummer
are you sending asset paths or something?
No im sending a book that is generated based on data the client doesnt have
(Basically)
So it's like a text that's the book content
you can break it into several rpcs
I'd bascally be re-implementing TCP in RPC right that sounds cumbersome
max array size is 2k, max rpc size is about 64kb
Do you have a working multiplayer?
i do, but not on that scale
since designing arch for mmo is quite difficult topic
are you generating it on server based on some parameters?
yeah for example one of them is the list of achievements that's in a journal with texts and images
the clients doesnt know what achievements it has accomplished and all
can you send their identifiers instead?
achievement id to replace name and description
achievement image will be taken from data table or other thing based on id
achievement progress as two floats (current/needed)
Yeah im going to have to rewrite my UI layer using data instead of content as a parameter, then some kind of template engine so that the client can generate the UI based on the data it received
That's going to be a pain in the ass but hey seems I have no choice 😄
that would also save you on localization later
I suppose you are right on that last point
Yeah seems easy said like this but actually it's a bit more complex than that since I cant usse any data tables or nothing , because It's all going throught the modding SDK
So I have to first create new functionalities in the modding SDK that allow the content to register templates, so the clients can consume them
you can have data assets or uobjects and object library instead of data table
or a manager to manage library
to make it extendable
Yeah yeah i have a manager but it's in another context so it's always a bit tricky to access it
from the UI you cannot actually access it directly
Anyway it's doable just a lot of pain
I guess one of my biggest issue is going to enable the client to generate thumbnail in the passive JS modding Context so I dont have to send base64s
Then create the template engine so I dont have to send the static text around the data
I guess im putting this off for the release: P2 cant open books for now 😄
I have this thrust feature that just adds impulse to the character movement.
But for some reason it only works on the server
It does not replicate, clients cannot thrust.
Any ideas?
MC_Thrust FX has to be called on server, you calling it on owning client
Hey, Acceleration on CharacterMovementComponent does not replicate properly to Non-Owning Clients.
It's normalized (instead of with magnitude as on Owning Client and Server)
And when the player is doing a RM animation, it doesn't replicate Acceleration until the player stops doing the RM for some reason.
Is there something I can do about it, or should I just replicate the real Acceleration value myself?
you might get away with exponential interpolation on CMC
When a client connect, I spawn a pawn for them to control and store a reference to that pawn "OldPawn"...I store the reference because the user can switch between two pawns...I'm having an issue, that every now and then, the reference to the "OldPawn" seems to get lost, or in other words changes.
In the above image, you can see the reference is there...however, after some time, when switching between pawns, this reference seems to get incremented. The ending would be something like _Pawn_C_3.
Almost like the original pawn gets destroyed, and a new one is created. However, i'm not destroying this pawn at all.
I do notice this. Why would my pawn be "pending kill" ? I'm not destroying it anywhere in my code. I do destroy another pawn. Is this somehow trying to destroy this one? Is it a player controller issue since both are using the same player controller?
Hi all, hope you are doing well I am trying to load a new stream level based on a overlap event. Since the new level is completely different than the current one, I am trying to teleport my player there, but when the stream level loads I teleport I have this strange shaky camera and if I try to move I fall through the floor or teleported back where the overlap event started. This is only when I am playing as a client, if I play as a listen server it is all working. Thanks for your help
hi guys, hope ur doing well. I've run into a problem with local multiplayer. How do I setup controls for a game where there are two keyboards and two players?
Any Opinion about the Verification Process? is it even needed? any tips for changes? appreciate any answer - thx in advance
Hi! any guide or info on how to implement a player login on a dedicated server? (want to do something like clash royale) where you can manage your city and explore the world and see other people cities.
Is there a standard way to implement something like this?
yeah, i'm looking tutorials for making a dedicated server and save player information on a database, but there's so litle
varest + firebase // not currently using it but that's my plan to test base functionality of including database directly
but for in engine only (testing functionality) you can just make struct+datatable with basic infos - load it in gamestate when starting - and manipulate those arrays - ofc it will reset to default values after restarting the game - cause it loads everything from datatable
what about sql and something else for the apis?
yea lorash i just mean for basic testing
that's kind of what i'm trying to search. What are the available technologie sto implement something like that and than package it into some host (like aws, steam) and what are the betters.
ofc you wanna host database yourself with multiple copies/backups in best case
i'm gonna give it a try with firebase for the database and varest for the apis as you suggested, only for testing.
this, wich ones would you suggest? D:
aws is so freaking expensive and if posible, i want to have some host on the cloud to test things out from the start
what about steam dedicated servers? i'm looking into a tutorial to setup one of those, any review on that one?
i'm gonna take note and check that thing about hyper-v, thanks
i have no idea, i'm just following a video to get an idea of what it's.
Live tutorial on how to create an Unreal Engine 4 dedicated server with Steam!
If you have any questions, feel free to join my discord server at https://discord.gg/te8UvhZ
oh, i tought it was a hosting service provided by steam
i'm gonna look on the options you guys listed
it doesn't look like it's what i'm looking for
@twin juniper while you're around.. any opinion towards that?
@gaunt umbra by any chance do you know how to integrate firebase with ue4? i'm ok with varest to make the calls, but not sure wich app should i be adding in order to use with ue4
just api call firebase db
oh i was trying to use firebase auth feature integrated with UE4 to handle user logins.
You meant to just use the firebase DB to store info?
Is there a particular reason player state has to always be relevant, or is it alright/possible to actually modify its relevancy through a replication graph? (Is it mainly a historical thing where something like a players score was maintained on the player state and opening a scoreboard had to show you the score of everybody, so player state was always relevant, or will some actual gameplay oriented thing break/be incorrect if relevancy is tampered with)
What could be the cause of this RPC not firing off on and triggering the second breakpoint here?
Hi, is APawn::OnRep_Controller happening on both server and client ? 🤔
Hi, i would like to create X replicated actors when the game begin, so i spawn them in gamemode::beginplay, but sometimes, there is no actors on any clients when i start the game.
Cpp onreps are client only by default
So the first one triggers? Is the actor owned by the client who calls the rpc?
Never or just delayed?
Never i guess
That's indeed strange
Yoy don't happen to call some reliable rpc on tick somewhere or?
In the spawned actors ?
Mhh i have a timer with reliable NetMulticast and i start this timer when the game start
MakeMap(); // spawn actors
GetWorldTimerManager().SetTimer(EventTimer, this, &APGameMode::OnEventTimer, 5.f, true, 5.f);
Something like that
I removed the timer to test and there is still one time the actors didn t spawn
The first one triggers yes. It's an NPC with an AI controller ,which I'm not used to dealing with so I'm not sure how to answer whether the client owns it or not
Then i would suggest you enable some logs and also read through your logs
AIs are usually Server owned. You can't perform an RPC from client side or to client side on those
You need to perform the rpc elsewhere, like your own playercontroller, character or playerstate
Or generally a client owneder actor or component on a client owned actor
The only reason I was trying to do that was because I am trying to execute from an anim notify, which only seems to be kicking off on the client. Am I making a mistake there as well?
I don't see anything special, the functions are called, i have no error (i'm on UE5 btw)
Can i call spawnactor from gamemode::beginplay ?
I would say yes
But you should check if the same happens with a new project and in ue4
UE5 is not ready for production so I would expect everything to be broken
I added bAlwaysRelevant and it seems they are spawned every time (but sometimes they are not visible)
Oh ok, someone told be it was fine to use it :/
I think your server isn't ticking the animations. I know there is something about tick pose and bones on the SkeletalMeshComponent. Try checking if that resolves. Otherwise check google for Dedicated server and ticking anims
That someone is lying
UE5 should not be used until it is released
You are using an early access program that clearly tells you to not use it
Well i will change to UE4 and see then thanks 🙂
Thanks, will look into it
That worked, would have never thought to look at that, thanks.
Cheers
if a physics object is teleporting/rubber banding/jittering around, how would I stop that? I'm making a sports game and the ball will sometimes jitter around
it's mostly accurate but still the slight teleporting can be annoying
I have this code on the character which is supposed to create a hitmarker.
But it only works for the server but not clients.
Any ideas why?
try taking the code you have sticking out from EventAnyDamage, put it into a custom event and run it on server reliable
then run it on EventAnyDamage
When spawning a character, is there a limitation on height? The node on the bottom with Z value at 120 works. It replicates to all clients that the spawn took place. The node above with Z value at 20240 doesn't work. Well it does, it spawns the actor on client, however it does not get registered with server, and none of the clients can see it. Must be something with height?
That worked a treat thanks!
Could you please explain why that works and why mine doesn't?
I'm not exactly sure how EventAnyDamage works, but the code wasn't running on the server which tells me EventAnyDamage doesn't fire on Server it fires on clients, so because of that you needed to make it a custom event that runs on server. it triggers on the client and then it tells the server to run the code, wheras without the custom event, it would just run on the client
@young spoke
Where should i store server only data, can i store them in gamemode ?
I did another basic test, with ThirdPerson template. I basically spawn the pawn at height of 20000. It does not get shows/displayed in WorldOutliner until the actor reaches height of around 13-14K. Is this some sort of world bounds issue? What if one wants to spawn an actor on top of a building, which is at height 20k?
Awesome thanks!
I launch my game in listen mode from the editor, and i see that InitNewPlayer is called before gamemode::beginplay, how could i separate the server code from the hosting client ?
hey guys so i wanted to make a like feedback for the player so when he kills the other player the cross-hair flickers red and its working as long as i call it from the inputs but when i call it from a custom event it just doesn't show the animation or run anything from there any idea why?
Any help here would be really appreciated; it's related to how CMC works:
https://answers.unrealengine.com/questions/1043658/view.html
Is there any way to merge sessions/have all players (including host) from one session join another? I’m using the DestroySession node for each player, but for some reason the host still fails to join the new session. Any help with this would be much appreciated.
Crazy design idea about multiplayer performance:
I wonder if it'd be more performant to put all of an Actor's gameplay logic into ActorComponents and then only create those Components at runtime according to what's relevant to the ROLE. So if I'm a remote client, I won't even be aware of another Client's Input-related or UI-related components because they were only ever spawned locally on their machine as the Actor was being created.
Maybe the only dependency in the Actor would be a TArray<UActorComponent *> where that list is populated with different things depending on who's asking.
To know which Components to spawn, you'd have a Data Table with a column that is a List of ActorComponents, and the Actor is given the appropriate row's FName as one of their required input arguments for spawning.
It sounds like a weird form of Dependency Injection. I just wanted to throw out the idea and get shot down
I remember the AI guy saying that it's always preferable to use Tags whenever possible, yeah
Anyone have any good code for sever validation of weapon fire hits sent from the client?
🙏
So I've two components and 1 parent character class with two children characters
Char 1 has Comp 1 and char 2 has comp 2.
From Comp 1 I set a value to the parent char class. Then I access it in the comp 2. How can I fix its replication?
The parent's value that lives in the Character class should be replicated. If you need to make sure it uses the replicated value, maybe you should use an Event Delegate that gets called in the OnRep method, so that the Component 2 can decide whether to react accordingly.
Ok how do you repnotify in c++
UPROPERTY( ReplicatedUsing = LightTrigger) ???
@summer tide UPROPERTY( ReplicatedUsing = OnRep_LightTrigger)
and create UFUNCTION() OnRep_LightTrigger()
What does this mean? Only happens when I have really fast rate of fire
Ok thanks. I think that means that your are trying use a ref of an actor which is probably got destroyed or pending to be destroyed .
might not be the right channel but is there an implementation of some kind of profanity filter for online text chat?
i just implemented a text chat in my game and i dont wanna release it until i have that kinda
Does anyone have any resource that may help me do the Aim offset for multiplayer animations?
I don't think I've ever before had a good reason to use a child actor component but... now I do. I've heard some horror stories with them in packaged builds and esp. related to multiplayer. Any experiences to share or light to shed?
just skip child actors overall, manually create them and use it that way
Yes maybe but not with blueprints
This is my Animation blueprint https://blueprintue.com/blueprint/ojarhfho/
And character blueprint: https://blueprintue.com/blueprint/k1yoyfd-/
That's what I've always done in the past, I'll just keep doing that then
guys, im trying to make an fps, and wanted to know what I should do to make sure player is on the right viewmodel and that the gun change request reaches them
what's the best logical way
do I just repeatedly tell the player what to equip?
That's been my understanding. Pretty easy to make one actor handle another anyway, I'll just keep doing what I've always done in this scenario
@hollow siloyou're just trying to do a simple replicated aim pitch offset right? Try youtube.. i think i learned how to do that on there
UE4 Aim Offset Tutorial (Replicated)
In this video we are going to create AIM OFFSET. We will only have vertical offset, since I don't need more for my game. BUT, this tutorial gives you all the information you need, in order to create vertical and horizontal aim offset.
Add me on discord: nusun#1898
If you have a request for a tutorial, que...
[Help] anyone know a quick way to get a profanity filter goin for text chat?
I just added text chat to my game and I don't really wanna push the changes to steam until there's a filter
If i want to store server only data, should i use only gamemode or i can use gamestate without replicating those data ?
Probably game state, my understanding is its where you keep all your data for the game mode
Ok thanks
i placed a Sphere into my world, turned on simulate physics, set replicate physics, then i pres play with 2 players and my net mode as client
when i push the ball with one player it moves differently to how the other player sees it
what do i do?
is it possible to have replicated simulated physics?
Yeah, but it's most likely gonna be shit :P
You will need to add some sort of smoothing to it and should probably only really simulate the physics on the server
And player controlled physics (so a physics character you move for example) will be a lost case
Only thing you could do there is ignore authority and do things client authoritive or so
What is a good long term player identification?
An ID of a Database Entry
any tutorials or information on helping me with that?
Might not be considered best practice but I’ve had good results using “replicates movement” for that type of thing
Tutorial: Use unique net ID of the player available via the player state. GetUniqueID is the function.
On Steam, this will give you the 64 bit Steam ID of the player. If you’re dealing with multiple OSSes then you can distinguish further with .GetType() on the unique ID
And in case you’re wondering, this isn’t something readily exposed to BP
Dumb question but is that unique ID fully static? As in, if someone changes their steam account name or whatever, that ID remains the same 100%?
Steam IDs are tied to the account, not the display name
It’s also generally true on other platforms
I build a dedicated server and a normal client build. When i type the command open 127.0.0.1 in the client while the server is running, this is what i get in the server log: . After that i get a popup on the client "fatal error". Any idea what it could be or where i could find more information about it?
oh nvm i see "client connecting with invalid version", weird
the server is build with engine from source and client is not
might that be a problem?
its 4.25 and 4.25 from source
They must be built with the exact same version. I think even if you are using Epic built version of 4.25 and Github source 4.25 the network version number is different. I can't remember where this is set. You might be able to hack it, or if possible use the same version to build server and client.
i'll try to hack it 😄 because building the client with the source version uses 16gb+ ram while i only have 16 and crashes. The non engine version uses only 5
Is it expected that widgets persist the seamless travel and need to be manually removed in the new level?
yes even though this is more of a #umg question, it's also why we ended up having widget management as part of a AHUD subclass
That's what I usually do too. Do you do your own bookkeeping in HUD class or is there a way how let these widgets disappear automatically?
I think I will just remove all widgets in game instance subsystem which listens for FWorldDelegates::OnSeamlessTravelStart
okay, sounds good, thanks!
yo can someone help me with animations
i cant get animations working when pressing a botton like right click to aim in
@white smelt might wanna ask in a different channel.. and that's also a very vague question.. I'm guessing you're talkin about like an Aim down sights mechanic.. I'd just look on youtube for a tutorial on that kind of thing.. it's definitely a popular one
I'm very confused.. all of a sudden I can't test with "play as client" net mode in the editor in 4.26:
it instantly kicks me back to my entry map
I can't think of what I could've changed that would cause this all of a sudden
where does this "server full" error come from?
Any idea why I get diff values? https://gyazo.com/27fcb47f4801036cbaacccd222c9f5bd
@summer tide what are you printing
is RiderAnimType replicated?
That variable is in AnimBP so notneeded but it getting the value from a replicated variable
either way, it's probably being set on the client when maybe you just meant for it to be set on the server and replicated down
well I mean "Riders Mounted Anim Type" :p
I'm have this in the 3rdperson char' component if (Rider) Rider->SetRidersMountedAnimType(3);
there's still not nearly enough context here to see what's going on
which function?
to see if that would work
SetRidersMountedAnimType
In that fn i've this: RidersMountedAnimType = Type;
do you want the variable to be set on the server and replicated to clients?
because clearly at the moment it's not
RidersMountedAnimType is replicated in 3rdpersonchar class
then it must also be being set on the client
so when you set the variable, make sure you're on the server
you can add a "switch has authority" blueprint for example or in C++: "if (HasAuthority())"
even though a variable is marked as being replicated, it will still let you change it on the client and get it out of sync
So this doesn't have to be a server rpc. in this funciton i can have HasAuth() to then use server if remote else use server
SetRidersMountedAnimType
void ARidableBaseCharacter::SetRidersMountedAnimType(int32 Type)
{
if (HasAuthority())
{
MulticastSetRidersMountedAnimType(Type);
}
else
{
ServerSetRidersMountedAnimType(Type);
}
}
void ARidableBaseCharacter::ServerSetRidersMountedAnimType_Implementation(int32 Type)
{
MulticastSetRidersMountedAnimType(Type);
}
bool ARidableBaseCharacter::ServerSetRidersMountedAnimType_Validate(int32 Type)
{
return true;
}
void ARidableBaseCharacter::MulticastSetRidersMountedAnimType_Implementation(int32 Type)
{
RidersMountedAnimType = Type;
}
What do you think?
is this how the code is after changing it? or is this how it was before
I modified it based on what you said. Do you think this will work?
ah, yeah that seems right
assuming those RPCs are set up properly
I'm still not sure why you want the clients to set it, but I guess it depends what this variable is actually doing
if you have RidersMountedAnimType as being replicated to begin with, though, you don't need MulticastSetRidersMountedAnimType
you just need to set it
void ARidableBaseCharacter::SetRidersMountedAnimType(int32 Type)
{
RidersMountedAnimType = Type;
}```
I had this before which doesn't work.
right but you can only set it on the server
wdym -
otherwise they'll get out of sync
That function is in the component of the 3rdpersonchar
From the component of the 3rpersonchar if (Rider) Rider->SetRidersMountedAnimType(3);
just like that
"from the component" doesn't mean too much
it can still be either client or server or both
on tick?
yea
so should I create a server rpc in the comp then call the function in the char's class
if you want both clients and server to be able to set it at any time, then something like:
void ARidableBaseCharacter::SetRidersMountedAnimType(int32 Type)
{
if (HasAuthority())
{
RidersMountedAnimType = Type;
}
else
{
ServerSetRidersMountedAnimType(Type);
}
}
void ARidableBaseCharacter::ServerSetRidersMountedAnimType_Implementation(int32 Type)
{
RidersMountedAnimType = Type;
}
doesn't work
hey, is it possible to run a eqs query synchronously?
@kindred widget regarding that container stuff i talked about, a while ago, i ended up with this solution:
Base: Container
Child: Chest
I've got another question now though. I plan on making a setup where a player can start a game to host it. He and only he should be able to Save the gamestate. Similarly to how games like 7d2d and Valheim does. So my question is. How do i start up a game like that as a server, without having to render and know about each and every actor in the game? I mean, the clients only render whatever is in their relevancy, but the person hosting the game will act as the server, and as far as i can see, when starting the game as a listen server, ALL actors render for him, no matter their relevancy settings. So i guess my question is really how do i start up a game with a "hidden" server, that knows about ALL actors and at the same time show a Client game window where it only knows and renders whatever is relevant for it? Hope i manage to explain my question clearly.
The answer to your question is... it doesn't make sense to do what you're asking. But you didn't really explain why you care about this:
- Are you worried about performance? If so, it isn't rendering all actors, that's what occlusion culling is for. If you're worried about simulating the whole world, you need to look into ways of either "chunking" the world (at regular intervals for procgen like minecraft, or for a premade map by manually defining areas to load/unload) or simply turning off actors that are too far away.
- Are you worried about the person acting as the server cheating? If people are hosting a server on their machine you can forget about any sort of security. I wouldn't even bother thinking about it - people will do what they want on their own machines, and you're not going to be able to stop them. The only reasonable fix is to host servers for players.
@hollow eagle good questions and suggestions... i'll ellaborate later... on the way to work now.
Hi! I'm a designer and I'm learning blueprints. I'm quickly exploring all areas and now I'm learning multiplayer.
I currently have a hint that I can test multiplayer with the Listen server option in PIE and that other team members can access if I open the level using the command open ?listen. But all the resources I found through googling for a week seemed to be about emulating a network environment on a local PC. The server and client windows pop up, but they were actually controlling the two characters by themselves alone.
I wish I could actually learn from a tutorial on setting up the Listen server in PIE and dealing with the contents of the team members' connections. If someone has good resources, can you recommend it to me?
One of the reasons why you may not find anything about this is that PIE should only be tested on one PC.
You can start the game as Standalone (e.g. Rightclick uproject file and hit launch game) or package it.
And then other people can connect to it based on your used #online-subsystems
By default it's NULL which only allows server lists through broadcast ip in your lan.
As well as the direct connection via IP.
Which requires the host to have port 7777 open
@velvet lintel
Oh! Thank you. I got a lot more insights. So, depending on the size of the game, it can take a long time to package, so is it the best way to run the game as standalone mode for iteration for testing and modification?
(I think I misunderstood that the standalone option of the play button is a kind of PIE.)
@thin stratus
The standalone button should do the same. But i usually don't use it
Packaging takes long but should be what you should every bow and then test in
The ue4 project might behave very differently when packaged if you are unlucky
If you set up iterative cooking etc then only the first time should take long
Oh, I see. I think I know. I had previously experienced building a light map, where I was supposed to rebuild all the lights on the map even with very small modifications. I was worried that the packaging would work similarly, but I'm glad it only takes time at first. (Cookies look important.)
Do you need to put all the replicated variables in GetLifetimeReplicatedProps?
Non-replicated actors can't have RPC ?
Correct
Correct
Guys, are variables replicating with an actor all the time, or just when they changed?
I have bunch of replicated variables that affect a cached "computed" variable. When any of them change the computed variable has to be recalculated on demand later.
Currently each replicated variable has an OnRep that calls Invalidate(), is there any more generic way? Would PostRepNotifies or PostNetReceive work as a single point of calling Invalidate()
They replicate with the actor depending on its Net Update Frequency afaik
@wary wyvern They only get sent out when they are changed
But they are checked at the "Net Update Frequency" and sent out at that rate at maximum
The server keeps a record of what clients have what values. That's why you shouldn't change replicated data client-side, since server will not know about it.
So client confirms he received a value, and server stop sending values since it recieves a confirm?
The client 'acks' received packets with the server yeah, so the server knows what values the client has.
And it will only send a property if it's changed from the last-acked/sent property
It would stop sending the value until it's changed again
@chrome bay Thanks!
you can see this for yourself using the network profiler btw
It logs everything that is sent and how often etc.
I have a problem with relevancy. My actor only runs net notify functions to client when the player gets near it even though the actor is set to always relevant
Server can see the changes in variables immediately but on the client the actor waits until the player gets near
Sounds like it's not actually being made always relevant
Not using rep graph or anything?
I tried to use multicast instead of repnotify and but that time it never replicated unless the client is near the actor
With repnotify it updates when player gets near
Yeah it's a relevancy issue then
Sounds like it's just not being made always relevant
Hmm why is Dormancy explicitly set to "Never"?
Are you using replication graph?
im not sure what you mean by replication graph
Ah in which case almost definitely not 😄
What is it
It's a different way of doing replication but you have to opt into it and actually build one for the project
Try unchecking Net Load on Client
Is it an actor that's pre-placed in the map?
Nope it gets spawned on the server and gets replicated to the clients
Ah kk
In which case I'm not sure, I would just double-check to be certain that is the actor you're spawning
Otherwise no reason it shouldn't work
it is
Always relevant is working on the server side but somehow clients are not considering it relevant until they get close
Well relevancy is only determined server-side so it shouldn't matter
The only other thing I can think of, is the actor is being throttled by other actors that are closer and potentially hogging all the available bandwidth
But since they're closer, they're higher priority
Unlikely though
There isn't much of anything that can cause a throttle in the game though
I'll try making it higher priority to test
Didn't work, same thing happens
Yeah not sure then, if it's always relevant it should just replicate without any issue
Does the actor exist on the client? You say it's being spawned - so if you can see the actor on the client then it must be relevant
If it wasn't relevant the client wouldn't even be able to see it
When the client is near the actor it replicates without any problems and is synced with the server
Problem occurs when client is away
But is the actor still visible to the client?
If they are then it's not a relevancy issue, because runtime-spawned actors get destroyed on that client when they are no longer relevant.
the actor doesn't have a primitive component, only a world widget
would that be considered as invisible?
Ah well world widgets are primitive comps so that's fine, so long as the actor has a root component
@dire cradle didnt u override IsNetReleventFor ?
Oh yeah, if you overrode that then it'll use whatever custom logic you set.
how do I override it
oh found it
--
Found the issue
it wasn't about relevancy at all
The value was updating
The world widget that showed the value wasn't
False alarm and a pointless headache lmao
And the reason for that was that although the actor was set to always relevant...
the client ITSELF wasn't
so the client was going irrelevant not the actor
it was about relevancy after all
That was a rollercoaster
Possessing a new pawn while having the debugger attached seems to cause this ensure to hit for me in repgraph:
Should I maybe clean up something when the pawn switches?
UReplicationGraphNode_AlwaysRelevant_ForConnection::GatherActorListsForConnection ends up triggering the ensure when it runs UpdateActor:
For posterity:
In this instance I was also destroying the old pawn when I possessed the new one, which causes this issue. SetLifespan does not have this problem 🙂
Hi, when I try to compile the server in the visual studio, I get this error, what is it and how to defeat it?
No, I said, I start the server through the shortcut with -log and it gives this error, it was compiled in the visual studio and transferred to the notification folder
Did you include the module code in your game uproject code?
So…im kinda new to Unreal, and i’ve been doing only singleplayer games, can i do multiplayer games the same way as singleplayer or is it diffrent?
hey guys I have a problem I want to get data from game mode but it shows null on client side. I even tried getting it from game state
Gamemode only exists on server
thats why its null
if you cant get the data from game state
you might be doing something wrong
are you trying to access gamestate on beginplay ?
begin play as well as on specific times
freaking out as boss is breathing on my neck ☹
I tried get game state get authority game mode. Class returns a value but object is null
I run into this issue as well
try putting a little bit of delay on begin play
sometimes it doesnt get spawned when you try to access it
gamemode is non-existent on clients
try moving your stuff to otherparts if you want to access it directly from client
how do I get data like player id? I am storing an array of pawns and getting them by index from game mode
Game state doe return the class but the object is always null
simple
you dont
or you make a bridge
on gamestate
to request the data from server
Hey guys. I haven't asked a question in here before and I've tried to browse previous posts to see if my answer is anywhere so forgive me if this is a repeat question but here goes:
I'm making a ship in my multiplayer (listen server) game that lets players walk around on the deck and interact with different stations. The interacting client takes ownership of the actor and then input from the client's player character fires server replicated events to make the ship move forward or rotate. I'm using a Rotating Movement component to simply achieve rotation but the problem I'm facing is that the rotation is very choppy in the client player windows but is smooth in the server window. I'm relatively new to network replication so I really have no idea why I'm getting stuttering on rotation. Any insight would be much appreciated!
PlayerID's are stored on the PlayerState's, you can access all player states from a convenient container via AGameStateBase::PlayerArray
so if i want an array element from game mode how do I do that?
Should never really use the GetPawn / GetController by index functions, they're virtually useless for Multiplayer
You can't
GameMode doesn't exist on clients for one thing, but also whatever data you get would have to be replicated somehow anyway.
I have a custom pawn array in game mode I populate overriding on login
You can't get that, but it's a bad way to deal with it anyway
Use the PlayerArray from game state, and use the GetPawn function from the player states within
so I have a VR pickup which can only be picked up by a specific player. If I dont store it in game mode where do I put ir?
That should really be dealt with by the pickup itself
No sense in polluting your gamemode with details/code for another system
Data/code locality matters a lot more in MP, you have to think about architecture more
In SP you can pretty much do whatever
well then store the "specific player"`s playerstate on the object, and check if owner when interacted
Yeah something like that
The object should determine who can pick it up, or the player state should determine what it can pick up (or a mix of both) - none of that is really relevant to the gamemode
More of a design thing really
i am new to mp in ue4 ☹ sadly boss wants mp vr
so if I do get a player from game state, how are they stored? in order of which logged in first?
Yeah order is not maintained IIRC
or should I set some variable in the pawn itself on post login to crosscheck with. Like post login, the pawn has an int assigned unique to it. Like first user is 1 second is 2
you dont need it
I would check out cedrics Network Compendium btw, it covers a lot of this starting out stuff
unreal handles it by it self anyway
you can just go with playerstate = playerstate
they are instanced not just a library
didnt get it. I want say the second user who logged in to be able to grab an object. How would I track that?
another way of thinking. Say a user who joins is auto assigned to a team. How to store that? does that change stuff?
I would just assign each player their own ID that you manage, even if it's just a simple counter
If login order matters that is
yes what I want exactly
Team you would usually assign to a PlayerState yeah
how does one access that? controller?
Controller->PlayerState
Def read that compendium, it'll answer a lot of Q's about the overall framework
you can also access it via pawn too
bingo that could do it way cleaner. Gonna try that tomorrow and hope I dont get another yelling 😅
so post login I could asdign it via game mode?
If your boss doesn't know the challenge of Multiplayer they are in no position to be bossing anyone 😄
long story on that one. Our servers guy told him it will take a month to get a framework but no. Sadly they pay well
🔫
For MP resources look at the compendium + the ShooterGame template project from Epic
So…im kinda new to Unreal, and i’ve been doing only singleplayer games, can i do multiplayer games the same way as singleplayer or is it diffrent?
Ignore anything you find on YouTube because 99% of it is either nonsense or bad practice
Multiplayer tbh can only be e x p e r i e n c e d
oh yes yes,
In theory multiplayer is easy
also, how would I get reference to a player pawn whose Index I set in player state
the problem starts when you need to design it
because its not just replicated or not
3 extra function types
thats all of game dev aint that the truth?
It's honestly quite easy once you get your head around replication but it generally requires more advance planning and more volume of code to get even simple things implemented.
is that reply to mine or?
Once you've learnt the "oopsies" of replication (usually the hard way), it starts to fall into place.
@spring geode Just in general tbh 😄
ok ok
I know but I am not getting the amount of time. I got VR replication working in a week with scarce documentation its been a pain
well is it a special way of programing in multiplayer or id it like the same as singeplayer, like if i did singleplayer games is it going to be almost the same to do multiplayer or?
A lot of MP is all about writing code that safely handles all the obscure race-conditions you wouldn't normally deal with that only surface 1/100 times etc.
sorry if my english is bad
you have to write extra code for server client side plus manage bandwidth
Definitely more volume of code, but Epic's ShooterGame resource is a great one (bit old), their YouTube tutorials not so much.
okayy, so its similar right?
to making singleplayer
well i will try it out soon if i will be stuck i will come back
Shortlist:
* Locality of code and data, general code design matters a lot.
* Code needs to safely handle all kinds of race conditions. (actors not being available when you think, different order of ops etc.)
* Need at least some C++ knowledge, Blueprint MP hits a wall early on.
* State = Replicated Vars
* Events/Calls = RPC's, (but sometimes vars).```
Thanks
But otherwise check the pins, lots of stuff there
Any YT series' pinned there are probably okay. Just be wary of YouTube Gurus who spend more time chasing clout than actually engineering or shipping games. The difference can be stark... TBH that applies to everything though not just Multiplayer 😄
😄
There's a lot of little bad practices there that have shot me in the foot down the road too. Granted, you don't know it's a bad practice until you run into a situation where you realize it is.
There's also several different ways to do one thing. Some better than others depending on the situation
Easier said than done. 😉 Hard to tell which is which until you've watched some of their videos all the way through. And coming from a beginner/novice standpoint, it's hard to tell even after watching since you don't know how to judge it. lol. When I'm learning new stuff I find myself following tutorials and then coming to places like this to learn from real devs how to make my code the way it should have gone in the first place.
Yeah, I think it's why MP is so hard to teach - there's just too much situational stuff you don't really fully understand until you see it in context.
Code needs to safely handle all kinds of race conditions. (actors not being available when you think, different order of ops etc.) is one of the hardest things to get right imo
and you'll end up chasing your tail for days
Yeah for sure, that's one of the more difficult parts to deal with and why it takes 3-4 times as much code volume sometimes to do simple things.
just throw it in tick until it's valid 
🔫
got this from the server dept head. Gonna read it again I guess
that's also in the pins, 2nd one
I reference that document very very often
Yeah it's a good resource, I'd definitely look at ShooterGame too though. It's a pretty vast resource and a bit old, but still worth looking at.
Yeah
it has stuff like a replay system, hit detection, etc
it's quite old
but still holds up alright
Though beware with UT, it definitely has a few "this just works for UT" stuff going on
But the folks that wrote it are the old-school devs from Epic, they know their shiz
i really wanted to make something with UT projectiles. having too many projectiles that may bounce and spawning them locally is a problem for me
but if spawning them on server - by time they appear on client they may be already out of bounds
if spawned locally - can not handle bounce and other effects
@chrome bay I can't remember off the top of my head, but do you recall if it's Shooter Game or UT that does client side hit detection?
I want to say UT
both IIRC
I thought Shooter Game used the rep graph for it
ShooterGame has some limited verification server-side
It's not great though
But will get you by for hitscan
Projectiles are fully server-side in ShooterGame
I wonder how UT aligns the bullets to the muzzle cuz pannini deforms the mesh. I know a little out of place but yeah
In UT I think they do a funky mixture
yeah, doing projectiles are annoying since you need to rely on physics, which while deterministic in unreal, is annoying to get in sync with clients.
would it be fair to spawn a fake visual projectile that does nothing and invisible projectile on server to do actual hit / fly physics etc
tbh all our bullets are projectiles and they're just data
I wouldn't go that route personally.
spawning actors is just way too costly for us at that level
So many ways to do it but it just really depends on what you need
real ballistic vs replication for multiplayer
for HLL and BTW it's a bit rough to spawn actors all the time
as that's a lot of overhead
was thinking on using actor pool like UT does
We use an actor pool for quite a few things and it does help
50-100 proj actors in pool seemed enough
it's more a scaling issue for us, 100 players is a ballache
agreed
So we just did something totally bespoke
true
Works really well for us but has limited application outside of "bullet shooty weapons" I think
We went for a different approach. Our deployable/emplaced weapons are technically single round rifles
with more boom
Does anyone know how to make like “teams”, lets say if i make hide and seek how can i make that one player the seeker and the others hiders, how to make those roles?
so just a dedicated subsystem to handle projectiles and add/remove the projectile data
and ticking subsystem simply batch updates the projectile movement and issue hits / traces?
yeah pretty much exactly
And data assets for projectile properties, and a couple of virtual functions for creating/updating the data
PlayerState is a good place to store a team id.
i'm trying to convince to not use a blueprint for each projectile type and use data assets
but ppl for some reason keep doing that
just mark it as replicated, and set it from gamemode
every variation a separate bp class
oO
haha
That's literally a perfect reason to use data assets
nearly 120 projectile blueprints and 120 data assets, could boil it down to just 1 bp and 120 assets
Most of the game is held together with tape ofc but this is one thing that's worked out really well 😄
and brute force
i once tried to do multiplayer game but the other player couldnt see like bullets or flashlight, what was the problem if you guys maybe know?
sounds like some variables weren't replicated
or if you spawning them on server then most likely by time it gets chance to replicate to client it may be already outside of level
if i was only working with blueprints and i dont know c++, should I even try to do multiplayer game?
relatively simple should be doable
Okay, i want to try to do like hide and seek do you think it will be hard to do?
Oh, well if i will need some help with it or if i get stuck can i ask for help here?
true, but it seems like its hard to learn tho
anything worth doing is difficult.
right…how old are you guys and when did you start doing unreal?
Back from work now. Reason i asked the question, was because i was looking at what Net Cull Distance Squared did, and how it culled out actors on the Client very nicely when the Character went out of the Distance of it. So i thought about how a Server could achieve the same culling.
I mainly thought of this because of performance considerations. And by performance i think of both physics simulation and ticking actors (which i ofc. know should be kept to a minimum)
Im not as such worried about server-cheating.
Anyone know why I might be getting stuttering on a replicated actor's rotation? It translates vertically and horizontally without any stutter and in the server viewport, it rotates smoothly as well. But in client windows (listen-server model) the rotation stutter steps. I'm running the rotation code from the actor itself using a server RPC that just changes the rotation rate on a Rotating Movement component.
A server cannot do that. If the server isn't simulating an actor, then who is?
Rendering is already handled by occlusion culling and has nothing to do with client/server.
The most you could do is put an actor to "sleep" if it's too far away from all players. But you can't just have the server ignore actors that otherwise need to be active.
One question will any custom variable added to player state be replicated?
if marked as replicated
Good point. It is the server simulating physics yes, so if i have a player that plays on the server-machine, but lets say i have a world with 10k physics actors, then i need to put the 9.9k to sleep?
So that has to be done manually? Why if I have to just set it one time from game mode?
any variable you want to replicate has to have either UPROPERTY(Replicated) & added to GetLifetimeReplicatedProperties or checkbox if it is a blueprint variable
So I have a replicated variable that I set from other character component to my player character then use that variable in animbp to select animations to play. But the clients won’t see the anim how to fix?
@summer tide as i understand it, whatever variable you use in an animbp, needs to replicate for it to work.
Got this last week. What I ended up doing was setting the variable in the actor and then sending that value on each change to the anim bp. For some reason animbp variable replication was pretty faulty for me
THis is what I have. So the RiderAnimType variable in my AnimBP also needs to be replicated, is that what you saying? https://gyazo.com/d1e1ddc16fb47e05a8a46fadc808b26f
if this is a animBP, then i belive yes.. try it out
Doesn't work 😦
The other clients don't see the animation
THat's what I'm doing.
I will maybe try to make a hide and seek type of game but i have no experience in mutliplayer, i will watch tutorials ofc but if i will have some issues or problems is this the right place to ask for help?
Within reason.
Most stuff you should be able to solve on your own with some googling
if you get stuck there, we'll give you a nudge in the right direction
Thanks a lot
@hollow eagle Clicking the Host button, I want to start a server on my machine. Is it an option to "spawn" a dedicated server and then connect to it when clicking it? (instead of starting a ListenServer)
ok, so ListenServer is the way i suppose
dedicated server is a thing on its own
only fully functioning LS can be properly ported to dedicated with influx of fresh authority bugs
😄
I don't really see a problem with using a dedicated server. Running it on separate cores than you're gaming on can help.
kk, roger that
Ram is cheap. CPUs aren't. 🤷♂️
RAM isn't the only issue
You're duplicating all kinds of work by running a dedicated server in the background, and you get almost zero benefit.
well, lets say i want to go with a dedicated server, so all players are clients, even the one playing on the same pc which runs the server, does anyone know if there's a guide or example of such a setup?
aside from making a Server target should be same
but adds more troubles, since everything is a client things like lobby have to be thought out
And again, there is zero reason to run both a dedicated server and a client on the same machine.
you will not save resources, you will end up using more.
^
hmm ok i think i understand... will see how it goes with a listen server then
Certain systems need to run regardless of whether you're a server or a client. So now you're running two sets of those systems, loading assets into memory twice (and hitting the disk twice as hard), ticking a world twice as much (because there will be overlap in what happens in a tick between servers and clients). Any predicted actors will hurt performance even more since you're now simulating things on both the server and client.
All this to save on some nebulous rendering cost on a client... that didn't need saving in the first place because unreal doesn't just render all actors naively.
A server needs to know about all (networked) actors, that doesn't mean it has to render every single one if it's a listen server.
oh but wait... just so i understand... lets say, as a listenserver player i stand 5000km from a door, and some client opens that door, if i could see that door from the Server player, it means he would see the door open? regardless of any replication settings?
if there's absolutely nothing blocking the way and your clip plane is set past 5000km, yes. Neither of which seems realistic.
well, but in theory he would see it open then
what clip plane are you talking about btw?
I was talking about the camera frustum. We're talking about on a listen server
network culling doesn't apply there
yes
which shouldn't matter, because something 5k km away is probably too far away to render anyway
this is sounding a lot like premature optimization anyway
make something that actually has this as a problem and then you might have a reason to think about this
5k is a very very long way away
a more realistic example would be someone on the other side of a wall
even in that example they wouldn't render unless their bounds were sticking through the wall
Yeah
you can even see exactly what's being rendered by going into PIE (or standalone), hitting ;, then hitting f
it'll freeze rendering and give you a free-cam to see what's actually being rendered by the engine
r.VisualizeOccludedPrimitives 1 is good to see what's being occluded as well
i may be missing it on that page, but i don't see a place where you can define how far a camera renders
You don't set it in the camera afaik, you set it per actor
There's that, but the camera itself should have a far clip plane. I don't know how (or if) its exposed though.
The point of that page was to point out that the engine already handles only rendering stuff that's visible.
Are you familiar with Levels of Detail (LOD)'s?
nono
just saying, that helps with render performance as well
if you're on UE5 and using static meshes, Nanite handles that for you quite nicely
if you're not, then LOD's are your best friend for reducing tri counts
jup, i've tried UE5 too just for fun
is there a way to access this elements of cameras? or why there is no way to access this? I mean I think that using near and far clipping planes and using some extra things you could do minimaps and things like that real time (I mean, we can use a camera that only renders a cross section of the map isnt?)
which mentions min and max draw distances in advanced rendering details, which was what you meant right @fading birch ?
I was referring to
yeah, i believe that's what they mention too
hmm or actually reading it again, it's something else
again, that only show up for static mesh actors though, so i guess it will have to be set for each static mesh component in ie. a BP actor
How would i replicate destruction of bush actor, if i don't need any accurate replication?
Each client should play animations and effects by themselves, server just should notify every client, that bush actor is destroyed
Project is open world survival game
is the bush actor replicateed ?
you are going to run into problems
trust me
if you have a large world
I had 5 trials about this
replicated or not
too many actors on map
will hurt
a lot
I know, it's hardest part of networking
Im working on it for learning networking, so yes, help would be nice
come to programmer parlor
What's it?
No problems, i can wait! Thanks in advance!
I'm not at home this week tho, having vacations after contracts...
Would using foliage instead and swapping out instances with actors based on distance work? So that actors would get destroyed?
it wont
it works to some extend
but if you have 1M + foliage
try removing an instance
and you will see a very noticable freeze
There are posts about this
you cant make multiple foliage instances
so all instances are bound to one controller
Hmm.. strange is that freeze only happening for multiplayer?
Coz i made an interactable foliage setup a while ago that seemed to work fine with no stutters, but didnt know anything about multiplayer back then, so only worked for standalone
its no difference
depends on how dense you want it to be
we had too much resources
Think i had 900k instances in my test
Yeah
I think atleast.. let me find the video i made
because we tried it out in packaged build as well
Hmm i dont show that many foliages on this video.. but i had a shitload once
In this last WIP video i show the latest addition, smoke from the exploding "grenade", spawning of a decal on the ground and replacing the static foliage with another version of the fern + spawning of a destructible mesh version + exploding it.
Since i don't have so much time right now and need to work on some animations stuff i've been wanting...
Anyway what approach did yo use?
in a nutshell, object pooling
Sounds interresting.. would love to hear more details of that setup
Hi, I wanted to run steam subsystem inside editor. I've found following question in the internet - https://answers.unrealengine.com/questions/433631/using-the-steam-onlinesubsystem-in-the-editor.html, but it's pretty old version. So has something been changed in UE4.26 or in between?
that's still the case. The steam online subsystem does not work in the editor, you'll need to launch via standalone game.
That said, if you're trying to test session functionality, it's fine to just use the null subsystem as it's functionality matches steam in that regard.
Is there a way to create a server without opening a new level? I want to transition from my "host game" screen to my pre-game lobby where players can chat, which are both in the same level right now. Pretty much all examples I see have an OpenLevel node with the "?listen" option but I want to find a way to set the "?listen" option without the open level node. I am using the advanced sessions plugin. If its recommended that I just move the lobby to a new level, I can do it I was just wondering if its possible to connect to a server without changing levels.
can someone help? I am having a weird issue, for some reason, my rotation gets messed up with this code, and it seperates the camera from the body it was working before I dont know why its acting like this