#multiplayer
1 messages ยท Page 685 of 1
however
now for some odd reason
the server doesnt have physics being applied?
it doesnt change material or have physics
yet all clients somehow have correct information
ideas?
anyone
most of that is wrong
first SpawnActor is templated, so if you use template right, cast is redundant
for Impulse, you are substracting a unit vector from world location
thats never going to work properly
impulse is essentially the same with or without this bit - DamageCauser->GetActorLocation()).Rotation()).Vector()
so it doesn't work, unless the dearly departed is standing on 0,0,0
what
?
Instead of storing each individual generated item's stats, you could instead generate a random seed and store that seed which you can then use to recreate the item and its stats when needed. You can then store additional details along with it if you want, like durability, or whether it's bound or not. It also make it a lot easier to transmit as you're not having to replicate or store every individual stat which takes up additional space, you just send the seed along which can be as simple as 4 bytes.
If you want to have every single possible combination of stats available though, then it gets a bit more complicated as you'll have to use a longer series of bytes that your generator can "consume" to generate your item.
GetActorLocation will typically return values like 8000, -13000, 0
yes
and the vector you're substracting from it is of magnitude 1
which means, it doesn't really affect it
so then u could subtract the vecotrs and get a vector pointing from the actor to the other actor
oh
u have to read the brackets
that gets applied after
the subtraction
then it gets converted to unit vector
ah
ye
lol
this is true
i fix that
and GetSafeNormal() is typically used for that
o
ok
ill fix those
but those r optimization stuff
i still need replciation working
showing impulse on server generally won't do much
and network physics is notoriously bad
i do recommend watching this
In this 2011 GDC session, Bungie's David Aldridge discusses the programming that drove Halo: Reach's online networking.
Register for GDC: http://ubm.io/2gk5KTU
Join the GDC mailing list: http://www.gdconf.com/subscribe
Follow GDC on Twitter: https://twitter.com/Official_GDC
GDC talks cover a range of developmental topics including game des...
they do talk about networking the ragdoll after death quite a bit
and its an excellent presentation
alr
ok
after 1 thousand years
i have gotten it to work
ty to every1
this was the code
f (GetLocalRole() == ROLE_Authority) {
FActorSpawnParameters SpawnParams;
SpawnParams.SpawnCollisionHandlingOverride = ESpawnActorCollisionHandlingMethod::AlwaysSpawn;
if (DeathMeshTemplate) {
AActor* DeathMesh = DamageCauser->GetWorld()->SpawnActor<AActor>(DeathMeshTemplate, GetActorLocation() + FVector(0, 0, 10), GetActorRotation(), SpawnParams);
DeathMesh->SetOwner(DamageCauser);
ASDeathMesh* SDeathMesh = Cast<ASDeathMesh>(DeathMesh);
SDeathMesh->Server_Explode((((GetActorLocation() - DamageCauser->GetActorLocation()).Rotation()).Vector()) * DestroyImpulse, GetActorLocation(), SkeletalComp->GetMaterial(0));
//Subtract our location from theirs to get vector that points in kb direction
//optional, but set death material to be our slimes color material
Destroy();
}
}```
```cpp
void ASDeathMesh::Server_Explode_Implementation(FVector Impulse, FVector Location, UMaterialInterface* NewMat)
{
Client_Explode(Impulse, Location, NewMat);
}
void ASDeathMesh::Client_Explode_Implementation(FVector Impulse, FVector Location, UMaterialInterface* NewMat)
{
DestructComp->ApplyDamage(100, Location, Impulse, Impulse.Size());
DestructComp->AddImpulseAtLocation(Impulse, Location);
DestructComp->SetMaterial(0, NewMat);
}
Are widgets just unable to do any rpcs? I know theyre only owned by the client but I should be able to tell the widget function to run on the server right? It never seems to work for me.
You can only RPC on an object that exists both on client(s) and the server. A widget is inherently something that should be client-only.
It makes no sense to RPC on a widget itself. You can, however, have a widget call an RPC on a different object that is replicated.
oh im dumb. I was applying the reasoning that since player characters aren't replicated but work, then widgets should work too. Completely forgot that the player character exists on the owning client and server.
Yeah... player characters absolutely should be replicated.
Player controllers are also replicated, but only between the owning client and server.
yep, but not on other clients, right? Besides the movement, but the actually values themselves arent
for player characters
Unless you've explicitly changed it, player characters should replicate to everyone.
How else would other clients see your character?
Values you specify to be replicated will be replicated.
where you divide things up between a character and player state is up to you
player state is meant to mimic the split between gamemode (which is server only) and gamestate (which replicates to everyone). With player controller somewhat mimicing gamemode (which is owning client and server only).
hm gotcha, i was told here before that i needed to use playerstate to replicate variables
I suggest reading the network compendium if you haven't already, second pin down in this channel.
That is my bible lol. I read it constantly. Must of just never went over the player character part, thanks for your time though!
Why is this event not being sent to the server? I feel like I'm missing something with how UE replicates widgets.
UE doesn't replicate widgets.
let's just link to the discussion we were just having ๐ #multiplayer message
It looks like the object you're calling the RPC on isn't a widget though. So the RPC is on this "player proxy" object - does the local client always own that object?
You can only call RPCs on objects that the client owns.
I'm guessing this is a replicated object that's owned by whatever player it represents. As such, you can't call RPCs on other player's objects.
The way you generally deal with this is you send an RPC with the appropriate parameters to an object you do own - for example, your player controller - and the server-side of things then calls whatever it needs because the server can do whatever it wants.
Let's say I have 3 clients, if I want each to randomly pick a color and make all the simulated proxies and themselves the color they generate (meaning that on client 1 all players would appear red, on 2 all green, etc etc) how could I achieve this generally speaking?
Yes. With the way it's set up, the widget is created by the Player Proxy object. On that Player Proxy object, I am calling a server event which does seem to work, which is why I am so confused as to why the one on the widget isn't working:
I'm confused as to how you've set things up - you have a server RPC on the widget itself?
Because again, that won't work.
Or are you calling a server RPC on another object from the widget?
No the server RPC is set up on the player proxy object
rpcs like that should be a server rpc on the player controller
Ok, and that player proxy object is owned by the local client?
oh, that graph you posted won't work
I assume "check mod status" results in the server calling "receivemodinfo"
Yeah
RPCs don't wait for completion on the other end though
they're fire and forget
that's why you can't get a return value from them either
so what's going to happen is a client is going to call CheckModStatus, then immediately hit the branch even if ReceiveModInfo hasn't been called yet.
Yeah it's a bad experience so I have to press the "scoreboardLeft" button twice c for it to work properly
I will probably end up just attaching the branch to the recieved server event
For that kind of scenario you'd usually just have the "Is Mod" variable be replicated. Why even use RPCs there at all?
Oh I didn't know you could replicate variables
I suggest reading through the network compendium, second pin down in this channel. It goes over that and more.
Alright, I will definitely do that. How would I solve the first issue? (The widget RPC issue), here's the server code on the "PlayerProxy" object
I don't quite understand what the issue even is - if the object is owned by the local client and the function is a server rpc on the object then it shouldn't matter how you call it.
oh weird
Crouch Character function need to be executed on server and client ? ๐ค
i saw most of people only do it on client is there a reason ?
Most built-in character functions interact with CharacterMovementComponent, which handles replicating common actions already.
from what i saw in the code you need to execute Crouch on server so it replicates to simulated clients and on client for your client
It checking server values, if you only execute it on client it only change them.. on client
I have no idea what you're talking about with respect to "server values"
when you call ACharacter::Crouch it sets bWantsToCroush on CMC. Which is a flag that gets replicated as part of CMC's whole saved move system afaik.
yeah ok, but bWantsToCrouch only change on client when you call it FROM client only
so how you want it to be replicated ?
yes... because CMC has other logic to send that to the server.
prediction logic ?
yes
most of the code in CMC is related to prediction
which is part of why it's so complicated...
What function can i override on CMC for crouching that is executed on server and client ?
I would like to use them to give an native action tag to my player on server and client ๐ค
Crouch() and UnCrouch() should do it ?
nvm OnStartCrouch and OnEndCrouch does it fine
this is my multiplayer working, left side if session browser, right side is hosting the session. Without Steam Running, even though I'm using the 480 app id. This works on the local network, even with separate machines.
However, if steam is running too and I try to host, it starts the session and goes to the level for a split second, and then comes back to the main menu?? That session must have broken.
Friends on an external the network can see the session! But when they connect it doesn't work ofc.
This is to do with Advance Steam Sessions.
I'm stuck here. The only way friends on other networks can see my session is if steam is running in the background.
But there's no use if the host session isn't working, such as in the gif.
I've seen a lot of people saying they have this "returns to menu after hitting host" issue. One person says disable Steam plugin in unreal? but that surely defeats the whole point?
TLDR; running steam for 480 network test. results in a hosted session, but immediately crashes and returns to main main
@hollow eagle I fucking love you, this worked. Looked at the network compendium and made this
is there a way to disable an AI controller without disabling replication for a pawn?
disable it without detaching it?
Is there a way to modify this so that I can listen to multiple events like overlapping with several actors and apply effect to all?
I tried to place a loop around this block. Instead of applying effect to multiple targets, the effect gets stacked on the same target.
Ahh this should be moved to gameplay ability channel.
Do playstates get reset/switched when changing the server's map with seamless travel? If so, how can I keep the playerstate? (Trying to allow players to chose a character and have them spawn in as that character when they enter the game)
perfect thanks!
Does the event copy properties get called automatically on seamless travel? The docs are pretty vague, am I supposed to implement this function myself and add which variables i want to copy over?
Oh wait i think i get it, I would run the copy function before travel and then the override after right?
I cant call it from gamemode, feel like im really missing something
Anyone a freelance dev who can help me with multiplayer network UE5 demo. I tried posting in jobs, but msg to Manny said something cryptic.
Can we not do RPC's from UGameInstance? If not, how do I run a function on the server's gamemode from the client outside an actor? My problem is, at beginplay I'm starting in an empty AActor derived class called MyDefaultPawn which is replicated, but not working when I try to call RPC's
(end result I want is for the server to spawn the pawn for my player to possess, so that the server and all clients will see it)
99% precent sure GameInstances are unable to RPC as they're client owned only, the server has no idea of it. In the same vein, the client has no idea of GameMode. I would just handle spawning by the server only. Eg. OnStartingNewPlayer > Spawn Actor > Posses
ok thanks for the quick reply...i think that's why i was scratching my head so much, wasn't sure how to spawn the actor server side and have the client possess it
Np, this is how I would handle it
you can throw more logic in-between like finding player starts and inputting that as your transform
i see, so the event handle starting new player, is that something that's part of GameMode?
Yes, its even in gamemode base
okay awesome
that just gets automatically called when a new player joins by switching map or just joining
oh thankfully i see it in c++ as well
thats good to know
i'm guessing i'll have to bind a function to it, which i'll figure out or go to BP ๐
goodluck :)
anyway thanks again for the info...something so basic was causing me a bit of grief
of course!
lol guess its all handled automatically, i didnt even try it before wasting 30 mins reading forum posts... nothing in unreal "just works" guess i was proven wrong today :/
i'm kind of of the same mind on that though, most of the time things don't just work unless you specifically call or bind it, etc
so unfortunately that function is not virtual, so i can't override it, meaning i'll have to either use BP, or find some other way to call functions from it when it's executed on a player joining server
I have an actor not updating for clients.
I have an AInfo with a dynamic multicast delegate:
UPROPERTY(BlueprintAssignable, Category="DoorManager")
FOnDoorSignature ActivateDoor_OnTrigger;
On the Actor class:
constructor: bReplicates = true;
void ADynamicMazeActor::GetLifetimeReplicatedProps(TArray< FLifetimeProperty >& OutLifetimeProps)
const {
Super::GetLifetimeReplicatedProps(OutLifetimeProps);
DOREPLIFETIME(ADynamicMazeActor, Ownera);
}
Then in editor BP subclass I have checked replicates and replicates movement
Am I missing something still?
Do I need this argument in the constructor?
AActor::AActor( const class FPostConstructInitializeProperties & PCIP ) : Super( PCIP )
don't use that ctor, only default or FObjectInitializer one
are you trying to replicate delegate?
I think I just need to replicate the actor... The delegate is already a multicast wouldn't it not need to be replicated because it already does that?
you misinterpreting words, it has nothing to do with replication
multicast delegate is just array of regular delegates with broadcast function
The broadcast works fine for the host.
- make sure you spawn your actor only on authority (server)
- you would need to add a
UFUNCTION(NetMulticast,Reliable) void NotifyDoorTrigger(); - and inside do
NotifyDoorTrigger_Implementation() { ActivateDoor_OnTrigger.Broadcast(); } - call notify instead of broadcast directly on server (authority) only
this way you will have delegate triggered on all clients & server
Ah. Thanks!
I believe the BP actor which contains the code to do stuff is only running on server side. Could that be an issue? Which would perhaps mean the client-side actors don't even get registered.
(I tried your steps, still no go)
you sure you spawn actor on server or is it placed in level?
all you need is to call it on server, since you set it to be replicating and it inherits AInfo so must work with no other changes
unless you doing it too early before clients connected
recently I started exploring collab viewer template. i am trying to run build for windows 64.i am able to connect with other users on same LAN network but could not connect with users on internet. KINDLY GUIDE
AI controllers are not replicated so they don't exist on client
Neither are player controllers, other than the owning client
Hi,
Is it possible to have ActorBeginOverlap only on clients ?
I know i can use isLocallyControlled nodes but its still executing on all client event if it dosent go far in the script, so it seem bad for bandwidth isn't it ?
My actors need to be replicated as they are "loot drops"
you can just check for authority in handler
Hey guys , i want to make a login system for my little game on listen server . Is it good to store userdata in sql database , or there is better way pf doing it? Cuz i have searched online about integrating db into ue4 , and there is not much of it, i thought may it is not how its done in ue4
you need a separate web service for it and use it , do not try to integrate database with ue as it is meaningless
so it is [game -> rest api] -> [web service- > database]
Okey , thanks for your answer .If you have time , can you please explain it a little more briefly , cuz i am really noob to all this .if possible step by step guide .
you mean adding a has authority switch ? if i select remote it still launch on all clients. What i was wondering is if i can make the actor overlap node not activate at all on any other actors than the instigator.
Hey guys! Question, when setting up your Unreal Dedicated Server, is there a commandline we can use to set the IP and Port we expect it accept connections on? Or does that need to be allconfigured in its Engine.ini ahead of time?
help
I honestly don't know for sure, but you can maybe research what -multihome does? Here is an example from my automated test cmdline -multihome=172.17.36.65 -port=7777
Curious let me take a look cheers mate!
How can I get the server to Get MoveRight, it always reads it as zero.
@median mirage That is an input value. It's local only. Only a Listenserver would have that value and would only relate to that machine's player.
Alright how would I be able to pass that from the client to the server?
Clients have one ability when it comes to networking. ServerRPC. In short you could probably start a local timer in the Controller's beginplay and ServerRPC that value to the server 10-20 times a second. If server needs it, then you can just use it there. If other clients need it, then you have to then set a replicated variable and let other clients use that.
Ill try that, thanks for the help!
UATHelper: Packaging (Windows (64-bit)): C:/UE4 Source/UnrealEngine/Engine/Plugins/Online/OnlineSubsystemSteam/Source/Private/OnlineSessionAsyncServerSteam.cpp(396): error C2039: 'SetHeartbeatInterval': is not a member of 'ISteamGameServer'
UATHelper: Packaging (Windows (64-bit)): C:\UE4 Source\UnrealEngine\Engine\Source\ThirdParty\Steamworks\Steamv151\sdk\public\steam\isteamgameserver.h(18): note: see declaration of 'ISteamGameServer'
UATHelper: Packaging (Windows (64-bit)): C:/UE4 Source/UnrealEngine/Engine/Plugins/Online/OnlineSubsystemSteam/Source/Private/OnlineSessionAsyncServerSteam.cpp(397): error C2039: 'EnableHeartbeats': is not a member of 'ISteamGameServer'
UATHelper: Packaging (Windows (64-bit)): C:\UE4 Source\UnrealEngine\Engine\Source\ThirdParty\Steamworks\Steamv151\sdk\public\steam\isteamgameserver.h(18): note: see declaration of 'ISteamGameServer'
UATHelper: Packaging (Windows (64-bit)): C:/UE4 Source/UnrealEngine/Engine/Plugins/Online/OnlineSubsystemSteam/Source/Private/OnlineSessionAsyncServerSteam.cpp(398): error C2039: 'ForceHeartbeat': is not a member of 'ISteamGameServer'
UATHelper: Packaging (Windows (64-bit)): C:\UE4 Source\UnrealEngine\Engine\Source\ThirdParty\Steamworks\Steamv151\sdk\public\steam\isteamgameserver.h(18): note: see declaration of 'ISteamGameServer'
UATHelper: Packaging (Windows (64-bit)): C:/UE4 Source/UnrealEngine/Engine/Plugins/Online/OnlineSubsystemSteam/Source/Private/OnlineSessionAsyncServerSteam.cpp(586): error C2039: 'EnableHeartbeats': is not a member of 'ISteamGameServer'
UATHelper: Packaging (Windows (64-bit)): C:\UE4 Source\UnrealEngine\Engine\Source\ThirdParty\Steamworks\Steamv151\sdk\public\steam\isteamgameserver.h(18): note: see declaration of 'ISteamGameServer'
Can't find anything online about this issue I am having while trying to build my game
Is there any way to force a ReplicatedUsing function to also run on the server?
I know the server doesn't replicate things to the server so it doesn't make a whole lot of sense but it's a listen server and will run the same logic as clients when the value changes
No, call it yourself when you change the value
Ok, that works well enough
Any clue why I am getting:
Source/UnrealEngine/Engine/Plugins/Online/OnlineSubsystemSteam/Source/Private/OnlineSessionAsyncServerSteam.cpp(396): error C2039: 'SetHeartbeatInterval': is not a member of 'ISteamGameServer'
Hello, I don't quite undestand how persistant actors work, I overrided GetSeamlessTravelActorList to add my actor (an AInfo that store some settings) but it seems it doesn't exist after the travel
Did you update the Steam SDK in the engine or anything like that?
looks like you building against different (older) steam sdk version
Should never happen if you're compiling a release
why? you need different steam sdk version?
then patch up engine if you want newer one
OnlineSubsystemSteamPrivatePCH.h is nowhere to be seen
unless I am in the wrong directory?
C:\UE4 Source\UnrealEngine\Engine\Plugins\Online\OnlineSubsystemSteam\Source\Private
you looking at some ancient doc article which could be since 4.0
use text search
text search?
This is neither required nor useful
Keep a pristine engine and don't change a thing
The doc mentions this in case you need to update, which you don't
Okay, I'm going to start with a clean, fresh version tomorrow and try again
thanks @bitter oriole
Can you not call an RPC from a character class?
you absolutely can. What issue are you running into?
You can if you are the owner of said character class
Hi, can anyone link me to a tutorial on how to make a proper online connection please? I'm using gas and would like to make a simple menu with "host" and "join random game" options
I'm trying to figure out how to persist data from a multiplayer lobby to multiplayer gameplay. My lobby has a distinct player controller and gamemode which has all my info saved on it. When the game launches, the gamemode and player controllers switch to the appropriate gameplay classes but the data I had setup is lost. Is it appropriate to store all the data in the server's gameinstance then re-apply everything once the new classes are loaded? Not sure how it's normally done
@pure vigil are you using seamless travel? You can copy playerstate with Event CopyProperties and Event OverrideWith in BP but there are c++ equivalent ways to do it too.
I personally like the idea of a super simple savegame file for this. Also allows you to easily save preferences to use for next games.
Yeah, seamless travel. Happy to do it in C++
I'm using the copy properties for things like character clothing - player chooses what their character is wearing in the lobby, those details are saved in playerstate, i copy playerstate over to new new level and rebuild their character from playerstate
Interesting, that sounds like a good place to keep that stuff. Are you using two different playerstates? You're making me wonder if the playerstate can persist a seamless travel
im using two different ones
since the lobby playerstate basically just has playername and clothing types but the actual game playerstate will have a lot more in it
Makes sense
Check pages 28+29 in network compendium for what i'm talking about
You know, I think I've actually used this before. Sweet, thanks!
What is a good way to handle multiple gamestates/playerstates inside a PlayerController? I have HUD elements that should be activated depending on GameState/PlayerState - like whether or not the game is in a "warmup" mode before the actual match starts. Some gamemodes will have warmup, some won't. Normally I'd cast to gamestate to access a warmup variable but since the controller can be used for multiple gamestates, the controller isn't aware of which gamestate to cast to. GetGameState node returns the actual gamestate object set in the game mode but i can't pull the GetWarmup variable off that node in the event graph.
Maybe an interface on the gamestate/playerstate class?
@soft dawn You need a MyGameStateBase class. Put whether there's a WarmUp there. Let your other GameState classes change that. Cast to MyGameStateBase class to access that game's current game state's value.
You shouldn't interface things when it can be done through hierarchy.
makes sense, thanks mate!
Out of curiosity, why not? Performance?
Because it's bad design. Interfaces are meant to process similar information from wildly different hierarchies, not information from similar hierarchies.
For example. Bajarno's case, he can simply modify the inherited state with some inheritance. But consider if he had a widget that displayed a timer. You could make a single widget that displays a timer from a value in the GameState. But then what if you needed a similar timer for some other actor that has nothing to do with the game State? You could make another widget to handle that specifically, but this is where you would consider having an interface. Have GameState return a time, and have this other actor unrelated to GameState return a time. Now you can add the same widget class to screen and pass in a non casted UObject pointer and instead of casting to 30 classes, just use an interface to get the timer to display.
You create less classes over all, you keep less things instantiated in memory through casting, you don't repeat your code. It's clean and easily extensible. Those are good designs.
thats exactly what i want to do ๐
Definitely something I've thought about a bit, some people say to avoid casting at all costs which I've always thought was a bit weird
Maybe "at all costs" is a bit of a dramatization
Absolutely not. Casting is perfectly fine. You just have to be aware of how you use it.
I'd love to read an article about that
Yeah it's completely stupid advice
People cry about casting because someone derped and made a reddit post about how they screwed up and casted to half of their game. To really understand why they screwed up, you have to understand how Unreal's assets are handled and why SoftPtrs are important to use.
Consider if you have a character who has equipment slots. These start off empty, nothing equipped. You have Head, Chest, Gloves, Leggings, Boots. That's only five slots. But now you have a datatable for each of these of meshes you can equip. You use a pointer to these datatables to look up meshes to set this character's meshes to. You make 20 items for each slot. You specify these in the datatable as pointers to mesh assets. Now, the moment you use that class of character anywhere, whether it's a pointer to the class, or a property of a pointer of the character type, you will load that character. When you load that character, you load those datatables, and because you have to load those datatables, you now have to load each and every one of those 5x20=100 mesh assets into memory just to load this single character class that doesn't even have anything set yet.
Unless it's a soft pointer .. ?
Changing the datatable to use SoftObjectPtrs to the meshes alone will cause you to still load all of the datatables, but not the meshes. A SoftObjectPtr is mostly a weakptr(doesn't stop garbage collection) and a path to the object on disk. Much less space than the mesh itself.
Interesting. I've attempted to use them in the past half heartedly. Encountered some issues and bailed. I'll have to start taking them more seriously
Still new to networking in UE4, am I doing something wrong by initializing a health variable this way?
Because for some reason in trying to initialize it this way I have the clients saying:
LogOnlineSession: Warning: OSS: No game present to join for session (GameSession)
and
LogNet: Warning: UNetDriver::ProcessRemoteFunction: No owning connection for actor ThirdPersonCharacter_C_2. Function Set Name will not be processed.
Which results in the ui not being set initially on the clients but after another rep notify call it updates properly
Thanks for your quick reply. Sorry I didn't respond sooner. The issue was in my line trace. Everything else was working. I have it working now. Just needed to changed how I was performing the line trace.
Does anyone know how to fix client animations looking choppy from a listen server?
You can reproduce this from a third person template by enabling network emulation with emulation profile set to average and launching a listen server with one client.
I've found multiple search results of this issue that say you can fix this by doing the following:
ACharacter: override PossessedBy() and call Super::PossessedBy() then set Mesh()->bOnlyAllowAutonomousTickPose = false
UCharacterMovementComponent: go to MoveAutonomous() and comment out the call to TickCharacterPose()
But that doesn't work correctly for me on 4.27.2. It speeds up the client animation for the Listen Server and the client, and still looks choppy.
Any ideas are appreciated.
doing a discord search for bOnlyAllowAutonomousTickPose might shed some light
A question about collision detection on the server. I want the server to detect weapon hit collisions, but when I test the event, the server only detects the hit if itโs watching the weapon as a listener server. As a dedicated server it fails most of the time.
I donโt want the client to do RPC for handling the event .
The animation is fast and collision volume is narrow, so I think thatโs why the server fails due to optimization.
doy, thanks mate, I was searching choppy/jitter and getting too many unrelated results. Should have tried that.๐
It was a while since I worked on this but iirc it was working perfectly on me. If you dont want to bother with debugging and want to get something working quickly I guess you can convert AInfo to UObject and store it in the gamestate, that's how I'm doing currently
So I've been struggling with replication on this one weapon I have in game. My MachineGun works just fine, damages both client/server from client/server, etc...
But my Grenade Launcher doesn't really seem to be working out for me. It will only fire from the client if it is set to multicast....where my MachineGun fires with just RunonServer.
But my main issue is I can't get the Clients Grenades to damage...only the server's Grenades damage.
Any ideas or help would be appreciated.
Forgot this one...
Hey ya'll - Open Level node is not working in my packaged build. I've verified that the map name is correct in the node, and that the correct map name is included in the build under 'Packaging'. When I execute, it just restarts the current map. Any ideas what could be causing this?
@meager crowDon't drag pins all over the damn place, that's a good way to get problems where references don't exist etc.
Also I see nowhere in the grenades nodes where you're actually applying damage
The damage is called from the explosion.
I see nowhere in this where you actually call the damage application
The second picture I shared.
Show how that's being called
This whole setup seems spaghet as hell. It should be this simple.
Spawn grenade.
Grenade detonates.
Grenade calls some sort of Apply Damage on its targets
Fairly new to this, doing my best.
One second as I get you a better picture.
Sequence isn't the best way to do this I'm sure.
But again, fairly new to this...so just trying to see if my weapons work etc...then I'll spend time optimizing.
no one face this issue?
Executes On All / Multicasts are only really meant to be called on the server, as it will then call the event on any relevant clients. If you do a multicast from a client, I believe it only executes on itself.
The event on your cannon grenade timer doesn't make sense to execute on server and is possibly where some of your problem comes from. As it is hopefully a replicated actor, any logic should only ever be firing on the server anyway. On the begin play use a Has Authority node connected to "Authority" to set up your timer, and remove the "Executes on Server" on the event hooked up to the timer.
UE4 has some built in nodes for dealing damage, see the screenshot below. Right now it looks like you're doing an overlap check in your character and then applying damage, which can work, but makes it a bit harder to manage as you then have your character needing to check every time there is an overlap and validating what did the damage before applying it. If you use these damage nodes instead, then you can let your thing that is meant to deal the damage check itself if it overlapped (if a single projectile) and deal damage, or in the case of an explosive type damage, use the radial damage nodes which can apply damage to anything around the indicated spot and radius. You then implement the red events in any relevant actors so that they can receive the damage notice. This will save you a lot of headaches later on as you then define the damage in the thing that deals the damage, rather than in the thing receiving the damage - the thing receiving the damage can then do whatever math it needs to in order to increase or reduce damage further say via armor buffs, or invincibility being applied if friendly fire is enabled, before reducing its own health.
So... Your logic should be:
Player presses fire button > "Executes on Server" event that spawns the grenade and moves it as needed.
Begin Play of Grenade > Has Authority > Timer > Timer Event > Detonation (SFX and VFX, probably already done via your spawns) > Apply Damage Node
Event Damage Nodes > receive the damage from the object, and reduce health accordingly (which health should be a replicated variable!)
Thank you!
I'll give it a try in the morning. Laying in bed now.
what stops other players of other games to join my game session? And can you create different game version multiplayer play?
?
I am mind blanked, how do you pass multiple arguments to a URL?
URL = FString::Printf(TEXT("ServerTravel %s?listen?game=%s"), *CachedTravelMapName.ToString(), *CachedGameModeAlias); ?
@meager spade normally ?first&second&third
so maybe ?listen&game=%s? Never used it in UE tho, this is just basic url-style, so I don't know.
Anyway, the reason I came here: My character will be a small non-humanoid drone of sorts, with very few animations, and I need full control of rotation (using quaternions). Should my character derive from ACharacter or APawn? I though APawn would be the obvious choice, but I'm seeing that ACharacter has a lot of replication-functionality that I guess I would need (multiplayer game). Is it easier to implement everything I need in an APawn, or to "fight off" what I don't need in an ACharacter? Or am I misunderstanding something?..
could be &, but i am struggling to see where its parsed :/
APawn has no replicated movement system
so if you went for Pawn, you would need to do the replication your self (smoothing, etc)
handling inputs, etc.
That sounds awful.. Thanks, I guess I'll try with ACharacter first then. It just seems to assume a humanoid figure and general common movement, but I guess I should be able to override whatever I don't like.
damnit
When games have drivable vehicles, are they ACharacter? They'd need movement replication and smoothing etc. too.
depends on how they implemented it
but Chaos vehicles have replication built in
(VehicleMovementComponent)
UChaosWheeledVehicleMovementComponent
I don't know what Chaos is, but I'll look into it ๐
well its the new physics engine for UE
you could try looking into Network Prediction plugin but its very very experimental
?param=value?param2=value2 etc
FString TravelParams;
for (auto& Pair : TravelUrlParams)
{
if (!Pair.Value.IsEmpty())
TravelParams.Append(FString::Printf(TEXT("?%s=%s"), *Pair.Key.ToString(), *Pair.Value));
else
TravelParams.Append(FString::Printf(TEXT("?%s"), *Pair.Key.ToString()));
}
if you passing it to gameplaystatics::openlevel as Options param you need to strip first ? symbol
as it adds own
i call Client/Server travel myself directly (also enforce full map package paths instead of short names)
As a side note to this, despite that you guys aren't really fans of Kismet functions. UGameplayStatics has functions to parse string and integer options from that string already if you don't want to rewrite them. Rather useful.
UGameplayStatics::HasOption
UGameplayStatics::ParseOption
UGameplayStatics::GetIntOption
Hi! quick question.
I'm storing my characters information as STs on my player controller, but i'm having troubles because of the max array size.
Can anyone think of any other way to store Entries of some ST on the player controller?
There can be any number of characters, so it has to be dinamic
Is there generally something wrong with using kismet functions?
95% of the time it's 50 lines of code to call exactly the same thing in the normal C++ API
Oh I see, didn't know that
Also, just bumping this up, just want to make sure this is the standard way of initializing replicated variables (The Health Var in this case). Any help would be greatly apricated :)
I have opened my .sln project and created MyProjectServer.Target.cs
with this code:
// Copyright Epic Games, Inc. All Rights Reserved.
using UnrealBuildTool;
using System.Collections.Generic;
public class GreenPollyServerTarget : TargetRules // Change this line according to the name of your project
{
public GreenPollyServerTarget (TargetInfo Target) : base (Target) // Change this line according to the name of your project
{
Type = TargetType.Server;
DefaultBuildSettings = BuildSettingsVersion.V2;
ExtraModuleNames.Add ("GreenPolly"); // Change this line according to the name of your project
}
}
|| GreenPolly would be the name, don't judge XD ||
But Visual Studio gives this error:
Server targets are not currently supported from this engine distribution.
MSB3073 exit from command "E: \ UE_4.26 \ Engine \ Build \ BatchFiles \ Build.bat GreenPollyServer Win64 Development -Project =" E: \ Coding \ UE-soft \ GreenPolly \ GreenPolly.uproject "-WaitMutex -FromMsBuild" with code 6.
@dense sundial If you're using C++ at all, there is already a way to change the player's associated name in the PlayerState. But in general, don't rely on beginplay for initialization in multiplayer. It's more of a "This actor just became relevant to this client, so set up it's known state incase it's OnReps ran before it was ready." A lot of it is mostly just calling the same update functions your OnReps from state does.
Alright that makes sense, so do you think it'd be better to put the initialization in the constructor or something/somewhere else all together?
Heya yall. Have tons of a unity experience but starting to learn Unreal. Any recommended tutorials for learning multiplayer basics for Unreal? Just trying to have two characters push a ball back and forth and such and got everything selected as replicated in the properties and such but would imagine there is a lot more to it then just that lol. Thanks n sorry for noob questions lel
I would just manually set both variables personally. But if you wanted a function to forcibly set it, I'd say PostInitComponents override.
I wanted to do the opposite XD
lol what do you mean?? like unreal to unity?
exact
Dedicated server requires a source engine build.
@dense sundial Just to note, I meant this for the authority set variables. As for name, I'd recommend going through PlayerState, it has the name system set up already with a SetName function and all.
Yes, I downloaded it via GitHub, downloaded the exact version, did the setup and generated the files
Did you compile the engine yet?
Emh ....? bo
Associate the project to the new engine you built 4h later?
I don't think so, I do random things and see if it works
Having been just trying to learn networking myself I can say to check out the networking content examples from Epic (and if it's your style a YouTube commentary to go with it) then read the 2pin on this channel from cover to cover and take notes lol
When i'm saying you need a source build, you need a source build
aka not using the launcher engine at all anymore
I just generated the files, I'm standing there .. I didn't do anything else
Read the instructions in the readme
You need to actually compile that engine and use that one now
I didn't even see that, thank you!
(For the record, dedicated servers is really not a great idea unless you're a larger team doing a competitive shooter)
Happy to help :)
Oh, why's that if you don't mind my asking?
Quiet, you can ... You just have to work hard, in my opinion ...
The servers, the networks, are a very complicated thing ... The communication between client and server etc ............................. .................. but it is something nice!
- You only need dedicated servers if you have either competitive gameplay (with a client-side anticheat, cheater report service, and round-clock hack stomping) or at least say 100 online players all the time (95% of PC games don't)
- Need a source build
- Need to host the servers ($$)
- Need to host them for much longer than the game sells
- Need to update the servers
Cooperative games with <6 players don't require any of that and are MUCH more reasonable for teams that don't have a publisher
Thanks a ton, I will give that a try. I'm assuming for the override the same advice holds for C++ as well?
Lol on PlayFab you can make a free server up to 100k players for 750h per month divided by each core, or you can implement a solution like Contabo, 5 โฌ per month, 8GB Server, very scarce but to start with it's great! And like me, you can find yourself a team online ...
Everyone tells me that and then disappears forever with their project, but okay
The one only reason for a smaller company to have a dedicated server setup is for persistent worlds that you allow players to host for themselves. But it's also worth considering a listenserver setup for that as well for easy gameplay. It's still a decent amount of extra effort through.
I am not one of those, in my opinion you have to continue, just be friendly and fair ... I made more than 100 โฌ with a Minecraft server on VPS ... Then I closed it because the host wanted 50 โฌ for no reason
Hard to claim you're not one of those before you even get the dedicated server compiling
Anyway, people never listen, I'll be there if you have issues compiling the engine
So let's keep in touch ๐
๐บ ๐
Let's hope my PC doesn't explode
40 minutes is kind. I've seen people complain about engine builds taking hours.
Why does it consume so little? can't I increase CPU RAM and GPU usage?
Wait, why do I have 32Bit discord?
Probably you didn't press the build button yet
Just built the other day and it took several hours between the .bats and the actual build
No no it's filling out
Might be something with your system then, like a strong CPU with a slow SSD
(P.S. running the bat generated a minimized popup window that I didn't see until like an hour had passed ๐ )
Well,
โข Hdd SSd M.2 512GB INTEL 660p Nvme
โข HD 3.5 4TB (4000Gb) Seagate / Toshiba / W.D.
โข Intel Core i7-9700KF 3.6 GHz CPU (12Mb Cache) Turbo Frequency 4.9 GHz
โข GeForce RTX 2070 SUPER 8Gb GPU
As long as the entire engine and software is on the SSD, should be slow but work
Oh, emh ... I'm in the HDD
HAHAHAHAHAAHAHAAH
Yes I know it was supposed to be Windows only ...
I have a 1TB SSD just for Unreal source + current project and it's barely enough
I'm running out of 4TB HDD and had to order another 2TB on Amazon .... How do I download so much stuff with 800kb / s wifi
Sorry, does it finish compiling when the packets hit 4395?
Ok I understand, in a few hours it will be finished .. SEE YOU IN THE FUTURE! BYEEE
(and thanks)
Why so much? i have 4.26 source on 100gb and 3 copies of the project at another 30gb for each. if any it should be your project the one with the big size, the source doesn't take that much
If you've compiled the engine in development + shipping + debug and an additional shipping platform, it's going to be a lot bigger already
Project is at 200Gb without the asset sources
Do a few releases and you're left with 50GB there easily
(Assuming you do your job and keep pdb files, etc)
The asset sources is just 40GB which is surprisingly small lmao
The future should hold a larger SSD for you ๐ Best to jump to that point in time and then compile! ๐
hello guys here are my create and join sessions bp
the problem is that when I create a session and join it from another player
they are not in the same lobby
they appear on the same lobby where the buttons are tho
what am i doing wrong?
You are opening the level on both client and server, which is why they are in 2 different instances
Easiest workflow to remember and adapt is as follows: Have a lobby level that the server opens, where the session is created and the other player joins. Then once you have all players inside, do a travel from server to "Start the game"
will that be easier than this ?
Well "this" isn't working
What you want is a function like this for the server to call. Because unless ServerTravel is specified the server will be alone in the map. With ServerTravel it takes all the clients with it
So once all your players are in the lobby and everyone is ready, when the host clicks the "Start" button ( or whatever logic/workflow you want for starting your game ) that is what you call
but my game doesnt require a lobby system like that where all players join each other and you go to final map
i want each individual player to join/host a session where all other players can join
Then you just need to join the session, don't map travel on the client after joining the session
ok and one doubt, do we need to add open level after joining session ?
I believe the ping is by accident and you wanted to ping someone else?
yes sorry
no worries
No.
Because you probably have movement that is server only, and that was working before because you werent a client, by opening a level you were always the server. Entirely different issue.
i think its not replicated maybe
Whichever it is, you don't need to actually do all of the session stuff, you can just debug this in PIE
In case you didn't know!
Here I am back after completing everything ... Keep giving me the error, I think I'm doing something wrong, for example the last step I don't know how to do it ๐ฎโ๐จ
After compiling finishes, you can load the editor from Visual Studio by setting your startup project to ** UE4 ** and pressing ** F5 ** to debug.
Your main viewport will be the "Server" the popup viewport will be the "Client"
nah it doesnt work my character can jump but not move so its an replication issue
Now how do I replicate movement as my player can only jump and turn in place ๐ญ๐ญ๐ญ๐ฉ๐ฉ๐ฉ
Any example project that you can create will have proper multiplayer enabled movement
Make an example project and check where you deviated from the standard
oof
Places to check would be: Character, CharacterMoveement component
Unless you have done funky logic in the controller related to movement
You're still compiling with the prebuilt engine (and also using the error window, instead of the Output log in VS)
Move your project to the new engine with right click / change engine version
No no I solved it, I only have one problem, when I open the new Unreal Engine, and open the project I had done on the "normal" Unreal Engine, it says I have to convert it, but when it says it needs to be rebuilt it crashes and says I have to do it manually !
Which is literally what I explained how to do
?
Once you've associated, open the project in VS and compile
How do I associate it? Ok then I'm confused!
Reset.
It finished the build, and I opened the engine in Debug! I opened my project and from all those problems ...
Anyone know of any good articles on syncing lag compensated projectiles?
Right now I've got the server bump up the projectile by the "half" ping using PlayerState->ExactPing. When the projectile moves the server queries for nearby enemies and rewinds them by the "half" ping. It's mostly good, but there's some false positives, either hitting on the server and not on the client, or hitting on the client but not the server, and hoping to find some tips on how to solve that.
The reason I'm doing it this way as opposed to the client telling the server when they hit someone, is because it's a top down game with culling on enemy positions passed the camera. So the client can't reliably tell the server when they hit someone off screen, because the client shouldn't know there's an enemy there.
I've also heard mixed opinions on the accuracy of ExactPing and wondering if that's a source of some of the problems
There is also UT's PredictionFudgeFactor which seems like some magic value, not sure if anyone knows the story behind that
Anyone know why I can't change to alternate viewmodes (unlit/lighting only) in standalone game?
I'm trying to use the console command viewmode unlit but nothing happens
Can you modify net culling distance of a character during run-time?
Is Standalone Game the best setting to use for testing in editor? I'm playing with multiple clients and a dedicated server (running in separate process). I'm noticing certain things in my game are just broken when running with PIE and not broken when running as Standalone Game. Is it safe to assume PIE is sort of buggy for multiplayer? I'm ok sticking with Standalone Game but I also don't want to be overlooking something I did wrong causing those issues when using PIE.
I've wasted a lot of time debugging stuff that didn't work in PIE but aren't actual issues (at least from what I can see) when running as Standalone Game
@soft dawn That's a semi complex question. Generally speaking Standalone is a more accurate representation. PIE is faster in some cases and can be used for a lot of things. But you'll still find plenty of errors and issues when you play on an actual build.
ya i understand - i'll describe one issue I saw. ServerTravel from online lobby to gameplay map, first client (New editor window PIE) connects and loads in, second client connects and loads in (separate process). first client doesn't see any of second client's animations related to CMC (it can see second client move but character anims are locked and just slides around). Second client can see first client fine. First client reconnects to server and can see second client fine.
it works fine if both clients are run as Standalone Game
Maybe if I'm testing anything with ServerTravel I should stick to Standalone Game. I know it doesn't work at all in editor if you run server/clients under a single process
Ah. Yeah. PIE cannot ServerTravel. PIE is only really good at testing from a single map.
thanks, confirming that gives me some relief ๐
When I open the new Unreal Engine (the GitHub build), and open the project I had done on the "normal" Unreal Engine, it says I have to convert it, but when it says it needs to be rebuilt it crashes and says I have to do it manually!
You need to build the project in visual studio first
Yes i did it
What does it say needs to be rebuilt? A plugin? I usually get that notification if i've added a plugin but haven't built the project in VS yet
Yes there is a plugin, but I tell it to disable it ... Here are pictures of what happens next
I don't think they the project is built properly. You opened your game project (not the engine project from git) in Visual Studio and built development editor x64 for your project itself?
Probably means you didn't compile the same verison
The project was created with the precedent Unreal Engine
I think I've found another problem
and you did the "Switch unreal project version.." to your source build from git?
Of course not! How you do it?
Miracle, it's filling out!
Something, I don't know what, but I don't care, it will surely bring me forward! ๐
always add your workspaces to AV exceptions
... If you really, really need to have that at all
well most people will have windows defender
and adding exceptions there can speed up file access
I'm creating replicated movement for karts (kart-style racing) modeled after CMC's implementation and have 2 questions. In CMC replication, are "dual moves" only pertaining to root motion replication? and in the context of kart racing, is there any real point of implementing root motion replication for the karts rather than just faking it where it could possibly apply? (like hit with an attack and spinning out type stuff)
If there's no point in supporting root motion for the karts, I could save quite a bit of bandwidth by removing it from the implementation.
Root motion replication isn't used if you aren't using root motion
from what I see in FCharacterNetworkMoveDataContainer, I think "dual move" only refers to root motion being included with an actual new move from this snippet:
// Optional pending data used in "dual moves".
bool bHasPendingMove;
bool bIsDualHybridRootMotionMove;
// Optional "old move" data, for redundant important old moves not yet ack'd.
bool bHasOldMove;
// True if we want to disable a scoped move around both dual moves (optional from bEnableServerDualMoveScopedMovementUpdates), typically set if bForceNoCombine was true which can indicate an important change in moves.
bool bDisableCombinedScopedMove;
Does that sound about right?
there was a few other comments scattered about that seemed to hint at the same conclusion
CMCs implementation is so confusing in places lol
gets hard to follow
yeah regarding root motion itself, I'll probably exclude that since it'd be quite a bit more work to support that for these custom vehicles. Just trying to make sure that "dual moves' only refer to root motion being included before I start gutting things and breaking stuff badly lol
Hi, I need this : A table / struct containing the basics stats for a player like these :
- Speed
- Interaction Reach
- Strength
...
So I need 1 table / struct with all the default values (so I can revert to those values if I changed those stats for some players during the game)
And I need this to work in multiplayer, so I need a table/struct for each person with those datas but I could change those during the game (like more speed for one player,...)
How would I go about that ?
Just make the struct. What's the problem here?
Like how do you make it different for each player, so each player has his own stats
The same way you make an int or a vector different for each player
struct is just a data type
i don't know how to do that
Either each Playerstate or Pawn has a variable MyStats, or you have some central StatsArray or whatever
Then don't start with multiplayer lol. Learn to crawl before you try to run. Start small.
I know you can have variables on the Character, but I don't want to save those on the player but more in a Stat table on the server
You really only do that for persisting between sessions. Reading from a database constantly during runtime is devastating for performance
So what do I use then ?
You should check out "data driven gameplay" in the docs for some ideas.
that may even be overkill
Also I need those stats to be on the same struct or something like that to not go around all my blueprint and fix them if needed. I need all of those datas on one single thing to just open it and fix things I want there without opening each blueprint and look for the variable I need
I don't need those stats to be saved between session, I only need them during the game then it will be reset to the default value in the next game (or if there's an mechanic of resetting those during game)
theres lots of ways you could do it. You could have all your static default values stored in a datatable, a data asset, a config. You load them from wherever into a data structure or variables somewhere for each actor that needs them and from that point on, you read and write to those variables until you need to load the defaults again
here's that data driven page I mentioned: https://docs.unrealengine.com/4.27/en-US/InteractiveExperiences/DataDriven/. Touches on data tables
gah. root motion moves are a type of dual move. Sometimes an extra move is just packed to save bandwidth, also making it a dual move.
Like for instance I'm just tring to print the values of the Struct, but I don't know what to put first
Like how to reference that Struct
Do I have to spawn it or something else ?
You're missing some pretty fundamental concepts. You'll save yourself a lot of hassle and wasted time by following some of the simple "getting started" tutorials before going any further
Guide me to those tutorials
actually, check the pins in #ue4-general . I'm sure they have a plethora of where to get started links
Something I have been struggling with for a while is the gamemode, I have a variable I want to use in an actor but I know the gamemode only exists on the server. So I have been trying to find a way access it but with no luck, why doesnt something like this work cause I try to get the variable and it just gives me the default value of 0 everytime.
it shows the right value if I call from the authority side but remote its always 0
This logic literally never sets that float to anything.
Beginplay->IfClient->CallOtherFunction->IfServer->SetValue.
You can't be on the client and the server at the same time.
damn, I thought thats what I was doing but I guess it was wishful thinking that it would work
As far as GameMode itself. You have the right idea, but you need to move your property to GameState. GameMode is server only It exists to be a Server only actor that can process things without a client ever having even local access to it. GameMode directly uses GameState to set replicated values and Multicast to clients for game related events.
Think of GameState as the networking friend of GameMode.
I had tried moving the stuff to gamestate before and it stopped working but I think I need to just do that, cause I keep running into this issue where I need things from the gamemode
Yep, a lot of times stuff ends up structured so that GameMode does things like ending rounds, deciding winner, etc, and then GameState is used to replicate that data down to everyone else, GameState is always relevant as well
if you throw everything on the Pawns you have to worry about them being unloaded on clients based on distance, but GameState/PlayerStates are around when PlayerController/Pawn might not be
If I set a speed value to a player in the Construction Script inside the Character Blueprint, will people joining later will have the information or I have to create a server event that I call from the construction script and use the rep notify to set the values ?
Probably not great to call rpcs from the construction script. You should probably use BeginPlay.
So I should go for rep anyway with the Event Begin Play too, right ?
Hmm I'm seeing an error on my clients when connecting to a dedicated server LogPlayerController: Error: EnableInput can only be specified on a PlayerController for itself This happens between the construction script completing and begin play. Oddly this isn't affecting gameplay from what I can tell but i'm trying to remove all errors/warnings. Only search result that came up for this was resolved by making a new game mode which didn't help my case. I can reproduce this on a new map/gamemode/etc if i use the same player controller.
Yeah, a server rpc that sets a replicated var on begin play will work if you want clients to control their speed.
It's not safe against cheating tho, if that's something you care about
yeah I care about that
Either verify the value or skip the rpc then
Only set speed from the server
If the client wants to sprint then call a sprint rpc. Letting the clients control their own speed is how you get 500 mph cheaters
Yeah I understand that example for the sprint system, but I'm confused on how to set up a data table for each player joining the game and make sure the next people joigning get the information too for each player
Replicated Variables
When you say data table are you referring to actual data tables or something else?
The engine takes care of it for you
Actual data tables exist for everyone. Just replicating what row name each player is using would be enough
I have 2 structs, 1 called Defaut_Stats and the other Player_Stats, and after each round of gameplay I need to reset those stat to default, and the Player_Stat is there to be able to increase some stats like Speed or Distance of Interaction
Like I need to have all my stats stuff in the same place so I can tweak it more easily
Do you use C++?
nope BP
Tough luck ๐
?
Your problem is easily solvable in C++, but I don't think the functionality is exposed to BP
So. As a workaround. Here is what you can do. All your data should be inside a single struct, your data struct if you wish. Assume this is part of your player BP
you make a member variable somewhere else that's persistent, like gamemode if you do this from the server
At beginplay on your player, you copy the data struct from player to gamemode, and when you want to restore it, you copy it from gamemode back to player
In C++ you could achieve this in a single line of code without needing to store that data somewhere special
@vagrant grail let me know if that's clear
Heyo - I have a multiplayer game working on PC using Steam subsystem. I built a Mac version, but I can't get the Mac and PC to connect. They're both connected to Steam correctly, but the server doesn't show up. Tested and working with two PCs. Is crossplay not supported?
Just make 2 variables of type PlayerStats
This isn't that hard, what's the part you're getting stuck on.
Anyone know how to make a multiplayer garage system that can store cars. Like you walk up to a PED and a prop widget says โput away carโ or pick car to pull outโ.
i'm sure a lot of people know how to do this, but it's a rather open ended question. is there a specific multiplayer problem you're wondering about or do you want a high level overview of how that would work generally?
How to store a pawn. is what i'm trying to figure out.
You store the information required to recreate that actor. Make, model, color, etc. Have a function which can take that information and create the correct Actor type and set the values as appropriate.
Thanks
you could serialize the actor
and on garage load, pull them actors (useful if they have a state (like damaged, etc)
can someone help me with a server RPC? I'm pretty sure that the client's player controller owns the character that owns the gun, but the Server_SpawnBullet event won't be called from client-side... (using blueprints btw)
Does anyone know how to replicate AimOffset?
how can one map be split into separate dedicated servers?
It can't really, each server runs one map and you're connected to one server
The part I'm stuck on is I want to use a struct or a data table to contain all my stats variables so not creating a variable for each stat and have to look around all my BPs each time I want to change 1 stat and also I need to know how to copy values from a whole struct to another as I have 2 structs being the same just one being the Default_Stats so I can copy from it after each new round / game and the other one I need to have 1 Struct of player Stats per player so Stats don't get mixed with other player stats
Hi, im having a problem with disabling input while the players are on a loading screen while they move from the lobby to the game, ive set up the loading screen using the Levels tab creating a persistent level, the loading screen, then the actual map, I've tried disabling input in loads of different places but every time I spawn into the game I have input before the loading screen widget has been removed from the viewport, it just wont disable for some reason, any ideas on how I can get it to disable input while the loading screen is still showing?
Just have all your variables in a single BP for your player, your data structure. Explained in my messages above, check your highlight
Now I have now another problem, I'm trying to use the Rep Notify and in the function OnRep I want to use a timeline to open or close my chest depending on a boolean isChestOpen, but it doesn't let me use a timeline in an OnRep_IsChestOpen function. How to do what I want if I can't use a timeline please ?
Could anyone confirm that i understand the networking system of unreal with those statements please :
-
Server Event : Code executed by the Server
-
Not replicated : Objects not being replicated to other clients (but does the server get the state of the object too or not at all ? )
-
Multicast : Sends a signal to all the other clients at an instant T (so people joining later won't get the signal / infos that something changed)
-
Rep Notify : Variables being replicated over the network so the Server and other clients could detect the value changing and execute code from that. And people joining the session later get all the infos on what object updated and those who didn't update to be synced with the server and synced with everyone.
-
Dispatcher : A way to send message between actors (but I don't know if you can use a Dispatcher to communicate between server and client and vice versa or a dispatch made in server could only be received by other server code, and client dispatcher could be received only by client code). And I'm still confused on when to use the Dispatcher and when to use the Multicast.
Please ping me if any answer ๐
Server Event
Only executed if called on Server or from client owning actor. That means if it's called on Player1 Actor from Player1 Client it will execute on server. If called on Player2 Actor from Player1 Client, nothing happens.
Not replicated
Just like OnServer runs if executed on server, any actor spawned gets the variables it has locally. So if you spawn an actor on server, it will have those variables. Nonreplicated variables for actors spawned on client , just like actors spawned on client, do not magically appear on the server.
Multicast
Yes
Rep Notify
Yes like replicated values, clients will be aware of changes. Also as with all replication, only changes on the server will be replicated to clients. You cant change a value on the client and expect it to be replicated to server & other clients.
Dispatcher
Dispatchers are not networked
Thank you, so my understanding isn't so bad.
Also do you know how to solve my issue ? Like It looks like I can't put timelines in functions, so how could I play the timeline when the rep notify triggers in the rep notify function ?
Hi, I wanted to make a Voice Chat System for my game, could anyone help me please? I'm using Ue5
That's just too broad of a question, do some research and get something working first
Don't multi post please
I have something working already, I didn't seem to find any working things out there for making voice chats
If I have a Server_RPC event, does the actor needs to be owned by player controller from both server and client? (do I need to call SetOwner from both the server and client?)
Just the server.
Is there a delay for the PlayerController becoming valid? I'm trying to spawn a weapon and set the owner to the player character, but SetOwner doesn't seem to work on server? but it works if I re-equip the weapon
Do you have an answer for my question above please ? With being unable to use timeline in the OnRep function (as you can't use the timeline in any function) so how would I go about that ?
Reinitializeing would just be as simple as
MyStats = DefaultStats
Onrep can call an event that can run the timeline
Make an event run the timeline from that and call the event from the OnRep. Alternatively, get the timeline's pointer, I believe you can start and stop it with that as well.
so the Event would be on the Event Graph and it will know that it exists ?
That's the theory but how do you do that in Blueprint
Yes. Honestly you sound like you're in way over your head. Don't even think about multiplayer at this point, learn how the engine works and how to do stuff in BP
You would set MyStats (which is a variable of type PlayerStats) to be equal to DefaultStats (Which is also a variable of type PlayerStats)
Give me the name of the node to use to do that because type "Equal" or "=" or "==" doesnt' show anything after draging from PlayerStats variable
Can't connect the Default Stats to Player Stats, they're considered different even if they have the same amount and variable names in it
I'm gonna connect the execute pin later
it says "Only exactly matching structures are considered compatible". The only differences between those structs are the name of the structs and the values assigned to each variable in it.
That's where you fucked up. You don't need different structs, just 2 instances of PlayerStats
Oh interesting
Just do it like this
In your character have variables
MyPlayerStats(PlayerStats)
DefaultPlayerStats(PlayerStats)
Then to do the reset
MyPlayerStats = DefaultPLayerStats
As has been mentioned above, it looks like you're in way over your head. Make a singleplayer game first, learn Multiplayer later. Separating the concepts will leave you less confused, give you an easier time mastering the different concepts at your pace one at a time.
Already made my first Solo game
Given that you didn't know how to set a variable value and that you can't set two different classes ... I would strongly advise you make another one and focus on learning the basic core principles
Spend more time learning the engine before even touching Multiplayer, those are very basic concepts that you had no clue of
We have this discussion every day, so don't lose too much of your time
Diversity's doing an online competitive cross-platform console MMO and no one will be changing their mind
๐
I know how to set variables, and I know that I can't set 2 different classes, except for structs as I never worked with that and thought it behaves differently.
And Adriel telling me just do this : PlayerStats == DefaultStats confused me alot so I was trying to find the == node so it confused me ๐
๐ตโ๐ซ can someone help me in vc
Classes are basically structs with functions. All general laws for the one hold true for the other.
Yeah you forgot it's a cross universe game, you will be able to play with aliens from another galaxy, and there will be 6 millions people at the same time on the game, and all the objects will be physics to represent the real life ๐ค
Classes and structs in C++ are exactly the same btw
Other than public being implied
Ah, lmao
But I remembered in C there were 2 different things if I'm not mistaken
Thanks ๐
Having a dream is great. The advice here is tailored to get you there more reliably.
Breaking down your problem into multiple more easily achievable subsets is a good general rule of thumb for many different situations. Game development has a lot of areas that you need to learn, especially if you're doing everything yourself. Just trying to achieve your one dream will easily leave you disappointed.
Whereas if you're learning 50 new things, and you only manage to do 30/50 before you stop working on this, then that's actually not too bad - compared to having achieved 0/1 massive MMORPG cross-platfom interdimensional game project.
I'm not doing an MMORPG by the way ๐ I'm just making a multiplayer game at the Among Us scale ๐
With some basic mechanics and stuff like that ๐
There's a pretty real chance of anything having a delay bud, especially in multiplayer where different clients are loading in at different times. If there's important stuff I need to run early involving player controllers, playerstates, etc, I always check to make sure they're valid first, and if they aren't then try again after a small delay
I believe it's even more of a problem in blueprints
Using advanced sessions, trying to test out OnlineSubsystemSteam. I have the DefaultEngine.ini configured (with SteamDevAppId=480) and I know it's working because I can load my steam avatar/nickname in game. But when I host a server and client locally, the client can't see the session. Is this because they're both using the same steam session? Any way to test this without having 2 computers?
You properly, or reliably test steam related things in the editor
The editor doesn't seem to load the SteamSubsystem. If I use a "Has Online Subsystem" (for "Steam") node in the editor, it returns false
If I could do it in the editor, would be fantastic. Currently testing in a packaged game
I dont see that node, what's it called exactly?
I have some variables in the GameInstance that I need to access from the server but when I do playerController:GetGameInstance()->VariableName it returns an empty variable instead of what's in the client. Should I be doing this from a different place?
Has Online Subsystem
What's inside of it, that looks like a custom function
Oh, it's from the Advanced Sessions plugin (didn't realize that)
Looks like it runs
{
return IOnlineSubsystem::DoesInstanceExist(SubSystemName);
}
Im trying to debug a connection timeout issue and some one mentioned a LAN option in a thread but i cant find it, can some one point me in the right direction as to where that may be?
what is maximum player capacity of dedicated server?
i dont think theres one
but i think by default theres a cap
not sure
I'm guilty of going too big too. I've been working on a multiplayer physics based vehicular building and combat game for 7 years. Most of that was spent learning and designing, I could remake what I have in a month.
does anyone have a recomondation on who to watch to learn how to make a multiplayer system? I cant seem to find a good article or video.
Did you add quantum physics vehicles to your game?
Tutorials are terrible for following to make implementations. Anyone worth following won't give you specific implementations because any system has to be altered to fit a designers needs and so the guide will be vague. And anyone who does give you a fully built tutorial for a system will not be able to account for your design needs.
Nah that's gonna be in the sequel.
I just realized something : Any game with vehicles teleporting or out of sync in multiplayer aren't really bugged it's just quantum physics, so we're not ready to understand those. So anyone having those kind of vehicles are just ahead on their time ๐
Anyone that has experience in networking and helping us with servers for our game. I'm hiring! Please let me know, thanks!
I want to see the Steam reviews after this explanation. ๐
If I have an audio component that is playing a longer sound (a few minutes for example, like a speech or something) that starts before a player joins, how do I begin playing that sound at the same time frame for the player who just joined?
Sneaky Kitty Game Dev has a playlist of re making COD: Zombies in UE4 w/ cpp. Idk how good it is but it's a thing
I have a health variable for the player, should I set it to "Replicated" or "RepNotify" ? as I want people joining later having the information too
Does anyone know how to get the Steam subsystem working with Mac? I can't find any documentation anywhere. I've tried setting it up the same as PC and I get the Steam overlay, but cannot find or host servers.
Both will replicate for later. The only difference is that RepNotify calls a function whenever the value arrives on clients, every time it arrives on clients. Useful for calling event dispatchers. In health's case, consider that you could fire off an event dispatcher, and have the health bar/display widget bind to that dispatch and update itself every time that runs, instead of running on tick.
But which one would you go for ?
Usually for things like that, RepNotify. Event Dispatcher updating UI is much cheaper overall than tick. Less widget invalidation.
But wait, I'm not sure about the Event Dispatcher par, like why would I need an Event Dispatcher if I can use the OnRep function to do stuff as it behaves like an event when the value changes ?
It does. That part is more of a UI issue. I follow a very strict ideology that gameplay classes shouldn't touch UI classes. If I can't remove references in my HUD class and delete a UI class without altering other gameplay classes, I've done something wrong. The one exception to this rule is widgets in a WidgetComponent. UI should be interchangeable. Take a healthbar in the bottom left of your screen for you personal character. Instead of having the character create that widget and put it on screen and call updates in it. You can make a simple Widget, add it to anywhere you want without regard to where it goes in whatever hierarchy. That singular widget can globally get the local player's pawn, cast to the one that has the event dispatcher, and bind it. Now when health changes in the player character, their OnRep fires that event dispatcher and the healthbar changes. Now you also want a red deathly affect around the edge of the screen. You can do the identical thing. Create a new widget, add it to screen, bind to the character's health dispatcher, only play the affect when health changes and lowers.
Mean while, you have two completely independent widgets that can be removed and deleted with no regard to your player character. Your player character gameplay logic can remain clean and untouched.
Noticed some weird behavior
- In the Player Character BP, I add the BP Component (BPC_Targeting)
- In the BPC_Targeting, I set a timer with a delay start (to ensure everything is ready)
- I run PIE with one Listen Server and one Client
- Consistently crashes once 10 seconds elapsed, although both Server and Client are ready
Assertion failed: NetGUID.IsDynamic() [File:D:/build/++UE5/Sync/Engine/Source/Runtime/Engine/Private/PackageMapClient.cpp] [Line: 2734]
Works fine if I move the timer from BP component to inside the Player Character BP (as one would expect)
assuming the behavior is in an object that actually exists on both the server and client, yes
Like GameMode exists only on the Server, so Events made there are only called on the Server
But things like OnComponentBeginOverlap or your custom Events will by default get called on both Server and Client
Hey all, quick question:
//In some actors constructor implementation
SetReplicates(true);
//or
bReplicates(true);
Which is better (if there's even a difference which I'd suspect there's not) and why? Thanks in advance :)
@dense sundial If you use the first, you'll get a warning in your logs.
Oh interesting, was studying and came across both and wasn't sure which to use, so then the first is to use if we want to make something replicate programmatically after it has already been spawned?
I believe so. To be honest I've never tested that. Fairly rare that you change that at runtime from my personal experience.
Gotcha, thank you :)
Also on the same note to this, ActorComponents have a similar couple. SetIsReplicatedByDefault() is used in the Contstructor.
Oh interesting, what is the other call for component replication dynamically?
SetIsReplicated I think.
Awesome, thanks again
Another question to understand when "checking authority" vs a Server or Client RPC is the way to go. The example below is from the network compendium (page 23), would getting rid of the switch has authority node and changing the AddScore Event to be a Server RPC result in the same functionality while not being as resource efficient as utilizing Var Rep as it does already?
I read somewhere that there might be some subtle differences using Switch has Authority and someone recommend using Is Server instead
I don't remember what but personally I use IsServer
Interesting, but ideally, A Server RPC, The Switch Node, and is server all fundamentally behave the same (with different pros and cons +- some details), right?
hello everyone i need to serialise data for save (player levels/stats, actors, player made structures, etc) and then load it onto dedicated server does anyone know how i could do it or point me to documentation on it?
need to make a save system similar to ARK or Rust
maybe set it to do it at 0.01 hp or below?
not ideal but it would probably work
Definitely not. A server RPC where you set up the event to "Run On Server" means that the event can be called by a client to execute the code tied to the event.
So if you're keeping score using a server RPC, that means a client could call the RPC, and increase the score whenever they wanted to (ie. you're giving the means for a client to tell the server to do something).
Using an "Is Server" with a branch is checking whether the current instance of the blueprint is running on the server. This is useful to control paths in which only the server should be executing the following code. For example, you could have a "Begin Overlap" event that when the player moves into it, they score a point, however, you probably only want that to happen on the server rather than on the client. So you could hook up the "Is Server" with a branch to ensure that the scoring code only runs on the server, and only when the server is detecting the overlap, not the client.
If you were to do the same but call a "Run On Server" event on the Overlap, that means you'd be letting the client tell the server that they scored, rather than the server deciding that they in fact did.
Has Authority is a bit more complex. For example, if on the client you spawned an actor, the client would have authority of that actor. If you spawned that same actor on the server and had it replicate instead, the server would have authority. This is still just a simplification of it.
I think I understand, do you have an example of when would it be better to use an RPC instead of a has auth check?
Can someone help me with a server RPC? It's not getting called from the owning client...
You use RPCs only when you want to communicate between client to server, or server to client.
or server to many clients (executes on All events)
So like... If you wanted to a fire a gun.... Your button press needs to be RPC'd to the server.
The server can calculate if you can fire by making sure you have ammo, etc. It can spawn a replicated projectile actor, and it can do an "Executes On All" RPC to play the bullet firing sound.
Finally makes sense, thank you!
I think you should check ammo and stuff before RPCing so you don't send unnecessary RPCs
Agreed, good to reduce network traffic as much as possible, but at least I know when to use the different networking tools in the toolbox
As long as you check the ammo on the server too - the server should be the one that decides whether something gameplay related should happen to try and thwart basic cheats.
eg. If I was a malicious agent, I could make it so my client constantly sends the shoot gun RPC, regardless of whether or not I have ammo as I could flip that bit in my client memory that says I don't to I do. If the server doesn't check that I have ammo, and just proceeds to fire my gun because the client said to do so and we're relying on the check on the client side, then there's a problem.
Auth checks clutter the codebase/BP. The fewer auth checks the cleaner your logic flow
What do you mean, auth checks are required and good. You cant determine who is authority and not otherwise?
I mean there's plenty of screenshots of people forking logic in the same place with an authority check macro. For example AI only runs on server, you can do similar things, have the authority as early in the logic as possible, don't mix client and server logic - have a clear separation. It's all part of making the logic more maintainable and bugfree over the long run. Otherwise you eventually run into a lot of BP spaghetti logic
It's a curse of BP rather than logic itself, also checking authority sometimes protects against usage of cheat engine
Unless you're working on the next big esports competitive hit, I'd say don't worry about cheats
If it's not a competitive game, nobody should have to bother
Competitive games has their own problems bigger than Cheat Engine, some indie games could require protection against cheat engine too
Dude's never felt the sting of Steam reviews.
those do hurt
"Hur dur dis game suk, i join randoms an they cheateded, programmer bad"
I mean its not just about cheat engine, its a simple branch, if you dont abuse it it'll work nicely ๐คทโโ๏ธ
Someone didn't read the competitive part of my sentence. If someone cheats in a Coop or SP game, who cares?
to be fair it will actualy ruin player retention
coop games are by the vast majority played with people that you know, so you know the person that's cheating. There's a social element to it
What would I suggest to blueprinters is organizing the event graph, seperating logic to multiple graphs, using more macros and pure functions for getters, and collapsing nodes instead of reducing the usage of auth checks
Those are all good practices, the auth part was mentioned by the person that got the advice so that's what I put in ๐
Further advice would be to learn C++ and to shift to C++ from BP eventually ๐ง ๐
u mean i can make games without spaghetti?
If you do this, yes ๐
Even with this practices you'll end up some sphagetti
Yup, it's inevitable, all the good practices can do is delay the inevitable. The ultimate solution is C++ ๐
Latent and async tasks most things causing sphagetti from my experience
Is there any common problem regarding to overriding replicated blueprint events? My project crashes when it hits to the function call of an overridden server event. It doesn't if I disable the function call or remove the overriding event. Is it my project or the engine that is broken?
Are you only overriding the Implementation function?
Weird thing is I can't find any exception in logs, it looks like it has cleaned up and exit without any issues
I'll take a look into it more when I have time but I'd love to hear your test results as well
im having a server crash where the server logs dont say anything, any tips on how to debug this?
just says fatal error
Run it in the debugger if you can't trace the issue. Check for the crashlogs Project/Saved/Logs/ to see if they yield any leads
how dou run the server in the debugger?
this might be a stupid question but ive never done it before
~logs dont say anything
Dedicated server or hosted (Listen)Server?
dedicated
packaged dedicated server
running a listen server in the editor seems to be working fine
and you're only experiencing the crash issue on packaged dedicated server? What about on a lsiten server?
Try a packaged listen server
You want to determine whether the issue is with packaged content in general or only with dedicated packaged server
im a bit confused here, in order for me to do a listen server i would have to have something like steam sessions no?
@upbeat basin Hmm. Not sure. It seems to work fine.
Right let's backtrace. I assume you haven't had that fatal error for forever, often an easier way is to figure out what might be causing it by what you changed since the last clean run and today
If you dont have any other good information
i havent touched this stuff in a while haha
And depending on the amount of changes/time since your last clean run
Okay ๐ Nevermind then ๐
Thanks for testing it, then it's probably related to my project
Is it possible to launch a 2 player test session in the editor, then press a button to make a third person join the session (without coding the whole session thing) ?
Because I need to check after opening a chest if a player joining later will see the chest open too or not
Editor Preferences. Allow Late Joining or something.
After you press play, it'll have a new button add a new client.
Thank you ๐
There's not a way to call an rpc on a specific client (not owner), is there? E.g. Server spawns cube A, cube A is owned by the server. I want the cube to be spawned in to all clients so all clients have their own cube A. But then I want to rotate cube A only for client A. So the change happens on the client only, but is triggered by an event on the server. The only way I can think of doing that is with a MultiCast and just having a check basically saying if(IamIntendedClient) { do stuff }
The whole everyone having their own cube in the world when it was also spawned on the server ... is a little dubious
Well spawned on the server then replicated to clients is what i meant by that
but only replicated in existence really
Those are two very separate things, that wasn't what you originally described ๐
What's the problem you're trying to solve?
If it's a replicated object, then its rotation exists on all clients and is server authorative
So rather than describing your solution, describing the problem you're trying to solve will be more helpful, gives us more context
Essentially a basis for a loot system where all clients have separate loot, but the same loot. E.g. enemy drops an Iron Sword, all clients see the Iron Sword drop, but its their own drop, so if someone else picks it up, it won't disappear for the others
I was going to handle the actual spawning and picking up of the loot on the server just because that seems like the right way to do it
But I also didn't want an instance of it spawning on the server for each client.
you can spawn a new local object for rotation, VFX, wahtever you do when picking it up
and what you do is you just change the visibility locally
For the server object
so it disappears on clients that have picked up the loot
But more importantly imo, if this actor is never used again from the server side, no other interaction than picking it up. You can forego the server spawning of it and just spawn it locally non-replicated on each client
That's assuming you're not going to have hotjoin with the hotjoin player being able to pick up their own loot
That was my original idea, have the server generate the data for spawning the object, then multicast that data to the clients so they can spawn it themselves, but I was worried that could pose a security/cheating issue later on
Unless you're making a competitive game, I wouldn't bother with cheating
Fair enough
competitive includes a lot of things, if it's gonna be an MMORPG ( the crowd favorite! ) that could be overrun with chinese loot farming bots, then you need to consider it
if you're just making a fun coop game you can play with friends that has loot - don't lose sleep over potential cheating
Goodness no. No MMORPG for me. Just a little co-op hack and slash to familiarize myself with multiplayer and game networking
That's what I figured ๐ You got enough on your hands with Unreal and Multiplayer. Simplify your problem set ๐
Right now i have it so everyone has their own loot pools, but it all exists on the server, and just have clients be the owner for the loot that belongs to them, and replicate the loot to owner only. But I was worried that could end up creating a lot of work for the server if each client has dozens or hundreds of drops ๐
Think that's how I'll go. I appreciate the discussion and insight ๐
The way I'd go about it is spawn the loot non-replicated on each client
on loot pickup -> communicate to server where your persisted inventory management lives, and tell it an item was added
So rather than creating an extra concept of loot management to your game, which you don't need
you just plug it into your inventory management, and the loot lives independently in the world
The more you simplify and breakdown your problem sets, the easier your life will be ๐ You only want a complex setup if it is the simplest way of solving your problem
Or if there's a game design that requires the other and is not negotiable. But that's a topic for another day ๐
Yeah I think I was just overthinking how important server authority was for this specific case. I was handling all the of it server side, 0 trust in the client.
So I have an actor component that has a struct, PlayerStats, tied to the player controllers and this PlayerStats struct contains things like health/kills which I want to display for all players in a widget. I am trying to update a replicated struct variable in playerstate, what is the best way to let clients update their playerstate's variable and make sure it is replicated? Shouldn't the server do the updating of a replicated variable to ensure it replicates?
Not sure why PlayerStats on the actor is tied to the controllers. Unless controllers change their possessed pawns?
Yes the server needs to update the values for them to be replicatd to everyone and for you to then grab that value from the widget logic
yeah if i could go back around i'd put the stats in state, first project so am sure going to make some mistakes. I think got it working. So if you were to have logic like telling the player they got damaged, ideally you would want to update directly in the playerstate? Would the general pattern be something like, let the server actors update the server version of client's player states to be the most ideal? Otherwise you go from client actor to client player state to server player state to all player states
how can i fix this
I have a button which saves the character then when the main level opens it assigns the animation bp according to the character
how are you telling each client to update the pawn to goku and to vegeta? looks like you're simply just passing in wrong logic per client
I save the name of the character as a string
And when the main level opens it sets the skeletal mesh and animation bp according to that string saved in game instance
yeah so the clients are just setting everyone's pawns to that character string, because updating skeletal mesh isnt replicated
you're gonna need to do more research on this topic, put print strings and understand concept of ownership of these actors, why is it when you update the skeletal mesh on one client, it doesnt update on the other. I would have some logic to run on owning client of the pawn and then send a server event in pawn to go back and multicast, in the multicast u can update the mesh
Do you think updating the skeletal mesh before joining the main level can help?
put some print strings Anurag, you're asking the wrong questions and I gave you the solution but I don't think you understand, so put print strings and breakpoints and try to understand client/server versions of actors, take your time learning this or you're gonna keep struggling, I went through something similar several months ago and you really just have to play with it yourself. good luck
Oof ok
multiplayer isn't an easy topic for new developers lol, but its really worth learning
๐
It always depends on the project, the constraints and requirements. Some you have the server updating everything, some you have clients tell the server when to multicast something to everyone else ... it always just depends. Experience with multiplayer work will give you the knowledge you need to make those calls in the future. Everything has pros and cons, there is no universal solution to every problem. But just playing with the engine, making games, making mistakes and learning from others will get you there eventually. The learning never ends, all we can do is get better over time.
Nah man tell me now I dont know how to proceed ๐ฉ
For example -very generally speaking- I tend to package variables into data structures. I have a "SpawnData" struct where various systems that spawn gameplay characters tweak various settings that they want differently. I store character variables in Data structures that I give to the character class for various systems
Different gameplay systems will reuse those data structures that's what they need. So you pass them the data to work with, they dont always need to know more. Keeps things modular. I'm speaking very generally here, because as I mentioned above. Every project is different and every problem you have can be solved in a number of different ways. You need to figure out what works for you and your project
Don't use strings ๐ Have datastructures/classes where you configure the animation/textures/meshes/whatever... to use and then use the data from the class
Oh yes
There are instances where you have to rely on using strings, because you have nothing else exposed to from the engine. Don't add instances of your own where you have to rely on strings ๐
You mean I should create a structure to save my character right?
Yes, i dont know the exact nature of your issue, but assume you want to spawn 2 different characters. You have a configuration class where everthing goes into
And then directly get a copy to save the character
and you spawn them according to the data in that class, rather than based on the string you put in and manually change things based on that
Saving character? Does this involve persistence?
Yes
Don't use strings ๐
You should just be able to save the different characters and load them
Hmm ok let me try
Hey, I'm debugging network lag on my game and am using the network profiler. It's my first time using it, so I don't really know how to spot any red flags. I was wonder if anyone could skin through this data and see if anything is sending enough data to cause problems.
these are my RPC calls ^
my actors ^
also actors ^
these are the settings I'm using to simulate a bad network
when playing with friends, sometimes the game is pretty laggy on the network when I join as a client, but I might just need to increase the bandwidth use in the engine config file
also, what does count mean in the profiler?
How would I do to make my prototype game being played by a friend of mine ? Like do I just have to publish as an exe and send it to him or there's a way to have it being played by him and being able to join me ?
How to do that please ?
Using Advanced Sessions with the Steam subsystem, trying to get everyone's steam avatar. Can the server get everyone's unique net id and use that to get the avatars for everyone then send it to everyone to view? For some reason "Get Steam Friend Avatar" keeps failing when I try to get a client's avatar on the server
@verbal tendon my character is already getting data from the structure and loading it
its just the bp thats set using strings
np
Is this the correct way to do damage in multiplayer ? I use an interface called "Damageable" with a function called OnDamage, but I feel like I do the job twice one by calling the function ApplyDamage and two by calling the interface "OnDamage".
Like should I do the calculation of the new health in the Event On Damage or somewhere else ? as I'm not sure if my Interface would be Server or Client
Overlaps happen on both client and server so you could just skip the server RPC and directly call ApplyDamage after a switch has authority check
For Now I'm using a simple Box Trigger to do the damage just to understand how to use the ApplyDamage function and understanding if it's server or client, but after understanding this I want to make the player being able to punch other people to make them loose health
So I need to understand the proper way to do this
In that case the client would likely do the trace, it would determine what was hit and then the data is sent to the server via an RPC which then verifies if needed and then deals damage
But is the screenshot above good, so I have to use multicast or I did something wrong ?
Also the calculation of the new health could be done in the Event of the OnDamage interface or the interface is client only ?
As I said the overlap happens on both server and client so you'd be dealing damage twice if a client walks into it
Also if you wanted OnDamage to fire on clients you need to replicate it back down with an RPC or OnRep variable
I still don't understand
Can someone help please i dont know what that vibration is
https://youtu.be/DyI5HwNCR8A
How do you start an audio component at the same spot as the server when a new client joins? For longer audio files like speeches or songs, so that the new client hears, at least mostly, what the other clients who were on the server when it started are hearing?
I have a collider that will only trigger overlap events only while moving if im playing with a dedicated server. It runs normally for client and server when playing listen server though ๐ค. It appears that my animation from my GA isn't being played on server in dedicated server.
@sinful marlin Dedicated server by default has no cosmetics. No Animations, Particles, Materials, Sounds, etc.
If memory serves, there was a way to enable animations on a Dedicated though. Not sure of performance implications.
Ahhh, I see. Is it common place to do collision detection for melee based combat client side then?
Really depends. I don't have a ton of experience, just vague knowledge from reading and watching conversations, but from what I can tell, a lot of people rely a lot on client actions telling the server they're doing something, and then server running vague checks to see if it might be somewhat possible. I'm 78%ish sure that Epic does the same thing with Fortnite, as that's one of the major reasons for stuff like EasyAntiCheat for client side cheat prevention.
Noted. Starting to think I don't need to, and probably shouldn't, do everything server-side
I mean. Server can prevent a lot with very simple cheap checks. For instance if client says it hit something with a melee weapon, you can easily test the weapon distance, pad it a slight bit and do a distance check from their pawn to the target. Stops cheaters from "Meleeing" at range. I've seen Jambax talk a little bit about his system on HLL, if I'm not mistaken they do rewinds on server for bullet traces to see if a shot the client said it made could have potentially hit the same target on the server.
replicate spawn emitter at location without rpc? I could spawn a replicated actor with a particle system but i want to use spawn emitter at location.
For what purpose? Is this for something happening on the server or Client authority?
and spawning an actor just for that is going to be way heavier than an RPC
You could have a FVector on whatever is spawning the emitter to hold the spawn location and use an OnRep to spawn it when you change it
Your "Damage Zone" is something that should only ever execute code on the server. RPCs (Your "Executes on Server" event you have inside of it) are meant for the client to send data to the server. Instead, any events like your overlap in your DamageZone, should use the Has Authority node with the path connected through the "Authority" path - you do this to make sure that clients aren't also trying to execute the code that follows.
The "Apply Damage" node itself already acts as an interface. You can use the corresponding event "AnyDamage" in the actors that you want it to deal damage to and the Apply Damage node calls it. So if you want your player character to receive damage, you put the event node below in your player character. When the overlap occurs it will call this event so you can deal the damage as you need.
Yes. Lots of things being assumed here, the general rule of thumb would be you want to do the least amount of things server side as you can get away with
tried that and still doesnt work
theyre getting called btw
its just spawn emitter not working
Traditionally this is done with a Multicast RPC since it just needs to happen for relevant actors at that given point in time and it's cosmetic. Why are you specifically trying to not use an RPC?
because its an actor not owned by any player controller
The actor saying to spawn the emitter?
yea
also the multicast for spawning emitter doesnt work somehow
it works for everything but it
its run on server but it still doesnt replicate to clients
Mutlicast is only server to clients
yes so i would have to do a server rpc then mutlicast
but this actor is not owned
so it would drop
So from the table (Network Compendium Pg. 63) an actor that isn't owned should still be able to multicast if called from the server. I can't tell from what you've sent what exactly is going on
yea
it should work
but for some reason it doesnt
better scr
its being called
but nothing happens
print the location being passed to it
does it do it for the server, or just none of them?
So from the server you can actually see it spawn properly?
hmm, gotcha, that is odd
I see no debug messages. Print stuff. Your cast might be failing?
it doesnt i added a breakpoint and its called
When are you doing the Multicast?
You might be doing the RPC before the actor is properly replicated to the client, in which case the Multicast "won't work" and the RPC will fail silently
wait
so this is in a task
bp
which is getting called from a behavior tree
which is run on a replicated actor
but does behavior tree get replicated or something
so if this is in some AI stuff there's no multicast cos there's nothing to multicast to
The behaviour tree doesn#t exist on clients
and thats it
The AI Pawns exist on clients, but the BT doesn't
yea but if i multicast shouldnt it all work out
They are executed on the actors the event exists on, so if it doesnt exist on client, there's no multicast
o
which is why if the actors arent replicated yet, or dont exist on client - there's no multicast
any way to get around this
Yes. Have your RPCs in actors that exist on client&server
So you want RPCs on your Character/AICharacter class for example
those are pawns and client owned, good place for RPCs to live
correct
Yes RPCs are a little peculiar thing. This won't be the last time you run across them. If you think "Oh wouldn't it be cool if this MyDoorBP just had an RPC on it that would tell everyone it was opened?" -- well then you realize you can't quite do that because your doors wont be client owned and you ๐คฆ
yea i ran into unowned server rpc problems so many times
There's no good solution for this when you're purely using BP. If you ever get around to learning C++ there are things that can be done to make this less painful by doing some custom stuff
{
void ExecuteOnClient_PowerTeleport( AVeilCharacter& Character, FVeilPowerTeleportData Data );
void ExecuteOnServer_PowerTeleport( AVeilCharacter& Character, FVeilPowerTeleportData Data );
}```
So for example I can have those two specific functions - they're related to a teleport power usage by a certain character, alongside with the relevant data for that activation. Let's us keep the code modular, rather than having to stuff everything onto Character. The different RPCs being used can be defined and handled in different places.
And without having to deal with all the boilerplate code that Unreal usually has you write, is a lifesaver for my fragile nerves ๐
ye
Is there an event that is tied to after a session has been joined?
GameMode::PostLogin
So does it get called every time a new connection is successfully made?
Yup
Also is there an upper limit on how many structs I store on the server I have some heavy structs im storing in arrays on the server, is this a problem
If I lower the netUpdateFrequency to say 1 or 2 the game starts missing changes to replicating variables for prolonged periods of time .
why is that?
isn't it supposed to check for changed variables 2 times every second with a update frequency of 2?
Correct me if I'm wrong, but if a client wants to equip an item from his inventory:
1- He checks if conditions are met, then calls a server RPC to request equipping
2- Server re-checks conditions, then spawns equipment actor, attaches it's meshes to proper sockets, sets owner, sets variables that needs to be replicated (like player's current equipment info)
3- Server calls a NetMulticast RPC for cosmetic effects (equip anim montage, play sound, set visibility for FirstPerson/ThirdPerson meshes based on whether you're the owning client, etc)...
@storm stone Heavy is a relative definition. Though in general it really just depends. No one can know until you profile it.
hey there , does anyone knows , how to get pc's ip through code ? I got a listen server . server player hosts and all other players must get server's ip in order to connect, ip gets changed all the time , i want to get that ip address of server on the clients
Can someone tell me if "bAllowTickOnDedicatedServer" also applies on PIE server ?
or only compiled/shipping server
is it possible to override client rpcs in derived classes?
You generally use sessions for that
Alternatively, you need a master server that your server connects to, with a database of known servers, for client to get a list of servers there
In C++ the _Implementation is a virtual method you can override, dunno about BP but I guess
thanks, it worked
what do you mean?
hey , thanks for your reply , i also read that by just using ip address you want able to play with friend online . Ur friend need to make some manual router protocol changes . is there way to do it with code automatically ? So your friend just enters a ip and thats it
server calls RPC to AMyServerCharacter -> AMyClientCharacter : public AMyServerCharacter overrides the RPC implementation
You'd need to implement NAT punch
i do this because my client needs to have two seperate skeletal meshes, and my server only needs one
Does anyone know if there is differences between setting up simple network multiplayer between UE4 and UE5? I just want to host a 5 player demo, on a local server and have a login.
No
No, theres no difference?
Thanks, im learning multiplayer and was just making sure UE4 tutorials are still valid. What chance would i have that a marketplace package for simple login with multiplayer BP would work in UE5?
Yeah ive been seeing that a lot, but im coming over from other engines, Unigine mainly, and want to bypass UE4. I have my simple demo level made in UE5 and now just need to setup the server/client with login, and that will do for this stage of the project. If i get full funding then i will no doubt have to start again with a bigger team backtracking to 4.
I guess i was hoping to not have to learn 4 at all, but im not sure that is going to be viable really from what i hear
Is the Source 5.0 much better than the portal version?
Except that one is broken
I think im just in love with lumen, GI and reflections, sky system, UI. I always disliked the UE4 UI (granted all the tools are there, its just that it always felt like it was made in the 1990s
Are you using UE5 in any serious capacity?
Yeah, I'm using it for production
Oh okay some devs are other than Matrix. Doing indie?
Ive also seen you posted 1000s so i might go have a read through some of your advice.
Lots of people are using UE5, if you can compile from source, fix the bugs yourself and don't need to produce working game packages right now, it's manageable
Epic shipped Fortnite with a branch of UE5 already
It's just not exactly straightforward right now
I read you cant create a multiplayer without source anyway, is that the case?