#multiplayer
1 messages · Page 447 of 1
That Epic multiplayer tutorial messed me up pretty badly. Trying to unlearn that and relearn the proper methods
there is no "Proper" ways well there is, but every situation is different
and its learning what you have and if you can achieve what you want in the best way
Yep
Yeah, I've had people tell me that Ticks are fine to use as much as you want also
i hardly use tick, and use tick if there is no other soloution to the problem
you use timers/delays?
well most of my stuff is C++, so i use timers
Yeah makes sense
but i do use tick, but limit to what actually needs to be in tick
Right
company i work for, we disable tick on mostly everything. We even disable AI that is out of range of any player from ticking (we set it to Optimized Idle state)
and only tick what is required
otherwise the game would be crawling 😄
that's interesting
we have patrol AI,
and if no one is near they dont do anything
only thing that ticks is the player controller
i mean AI controller
and checks to see if anyone is in range
even that is no longer in tick and is done on a timer
Would you have any idea how to create bots in mutliplayer that read as normal players with PlayerControllers by any chance?
Requires C++ though
The bWantsPlayerState boolean isn't available on BPs as far as I know
its available in BP ^^
I have a card game and so far i just have a deck that the player draws cards from. In the PlayerController i have a keybind (Enter) that draws a card by calling the event in the GameState. But, it only works on the server, not any of the clients. What am I missing?
Anyone know how I'd spawn an actor on the server and client but only the owning client?
It's basically a new player setup screen
So I don't want it spawning on other clients!
@heavy marlin : Try "Only Relevant to Owner" in the Replication Category of the actor.
Ok thanks
@clear copper Blueprint or C++ ?
@cerulean acorn Blueprint
@clear copper Use a ServerRPC in the PlayerController
And read my compendium (again?) cause you seem to be lacking essentials
It's pinned to the channel
👌👌
Hello everyone, I want to make a network game, I have already created my own dedicated server, but I just can not figure out how and where to create a session for the player. If someone knows how to do this or even has a bully lesson, I will be very grateful for your information.
@thin stratus this compendium looks like it will be really helpful! you made this?
Yop
nice job, it looks like a great place to get started!
Question: the GameState blueprint says that it exists on both server and client and is fully replicated, so why do I still have to set variables to Replicated?
does that just mean the class itself is replicated, not necessarily everything inside of it?
makes sense, appreciate it!
I'm making a ECS and I want to know if it's posible to replicate only some components of my entities to all client. I have an array of object and I want to replicate only some bloc of this array
Someone knows if it's possible ?
Is there any way to test the #if WITH_SERVER_CODE preprocessor flags w/o building and just running from the command line with -server, -clientonly, etc?
Whatever changes I make in VS seem to apply globally whether it’s the client, server, etc
Assuming this because nothing has actually been built
So the flag is the same for everything
There isn't. They're preprocessor commands and only evaluated at compile time
Got it, thanks. Guess I'll just have to do periodic testing with completed server/client builds
You can use the NetMode and suchlike to do stuff if not, like IsNetMode(NM_Client) etc.
Anyone know if SweepMultis are guaranteed to return the OutHits in the same order on Client/Server?
My initial suspicion would be yes.
what mechanism would ensure the order?
Im guessing since its a sweep it would return based on hit order
Last hit would appear last
First hit first
does anyone know what a minimal net rpc world is?
I'm making a fighting game and I'm wondering how to even out lag between clients. If I have a P2P game, I don't want whoever starts off as the client-host to have 0 ms lag and then the other client have normal lag. How can I ensure the same lag experience for both players?
You'll need to add some forward prediction and also rewinding capability, not a basic matter whatsoever
For example, if playerB has 50ms ping and uses a hadouken then the server can tick his hadouken forward .05 seconds on spawn, same with a shoryuken, can offset the start of the animation montage .05 seconds
And it will store the locations/etc (particularly hitboxes) of playerA and playerB and when playerB attacks playerA it will rewind to a past hitbox/etc .05 seconds ago and use that for the hit detection
@twin juniper
Also there is no P2P in UE4, but you can simulate it this way with high latency compensation + listen server
@grand kestrel Thanks for the response! Is that really the only way? It sounds insanely difficult to implement seeing as essentially every game mechanic has to have that implemented (I can just imagine the bugs down the road). There are so many fighting games (SFV, tekken 7, mk11, etc.) made with Unreal that I would think it's a bit more streamlined. Or do they not implement this at all and go with the old fashioned "whoever is closer to the server has an advantage"?
@twin juniper
- It is insanely difficult to implement
- There is a lot of stuff that most games have that barely exists in any adequate form and this is one of them
- There will be bugs and you'll remake the system several times over until eventually you've taken a ton of time and learned enough to make it so that the bugs are easy to locate/fix and are ridiculously familiar with it (talking from experience)
- Do not know what they do but server authoritative with no compensation wont work as it would be too unresponsive, gamers wouldn't play it. Especially not competitively. At best they're client-side for hit detection but that would limit you, for example parrying in street fighter 3 ultra would not have been realistically possible this way.
(I've never made a fighting game nor this system for a fighting game, but I implemented similar solutions for an FPS with shootable regions and server-authority, in the end the methods are similar enough that I know the issue and how to resolve it)
What have I gotten myself into 😫
Are there any functions for "ticking forward" or do I have to implement that differently for every single mechanic (e.g. for a fireball I have to calculate where it should be in .05 sec and then sweep the space in between)? My main issue if I have to do that manually is that for example, if I have an animation and I have to offset the start, I could have something important happen in the first few frames of that animation that is now skipped.
I see what you mean, the last thing I want is inconsistency. Thanks again for your help.
A fireball would be a projectile with a movement component, call tick on the movement component and pass their latency (converted to seconds) for the delta time
Oh I can just call tick multiple times in one frame or something like that?
No, just call it once
I mean, you can, but theres no need
All tick is doing is passing the time between frames
So if you pass it somethign else
It will move forward that amount of time
So if you pass it their latency, it will move forward by that amount
OHHH I get you, I forgot tick had a parameter
Have a look at UT when they fire a projectile they tick it forward
They have forward prediction for their projectiles
So you can see how they do it
They have rewind for hitscan but not projectiles, but its a base to start from
At least you can see how they're storing positions etc
i developing mmo rpg 😫
Good to know, thanks! I'll put the source to download right now.
The biggest issue I can think of at the moment is that there's a decent chunk of gameplay that depends on certain parts of the animations. E.G. you can short jump or long jump depending at what point in a character's jump-squat animation you let go. How could I "speed up" the montage to catch up rather than just cut to the new point in time? if you know ofc 😋
You could just get the running montage from the slot, get the current time, start it again with current time + predicted time, off the top of my head
as i understand, open world need to create master server
There might be a more elegant solution though
@grand kestrel wouldn't that skip the time in-between?
hmm may be
OK so treat it as two actions:
Start squat, server adds predicted time
On release, jump up animation, server adds predicted time
But at this point you need to just start making it
I have no idea if that will work
yeah I get you, this is dependent on every mechanic influenced by animations
@junior jacinth UE4 has no out of the box support (nor capability) for an MMO, you will need to do a lot of research before you start
@twin juniper Sounds like you'd be better off heading to #gameplay-ability-system and learning how to use that plugin, it will do a lot of this for you
The forward prediction part, it has no rewind
Its very complex, but i think it will be worthwhile for you (and its complex because it does stuff that is far more complex than the system itself)
I thought about it but I'm not sure how it would work for a fighting game, it seems very RPG/MOBA focused. For things related to animations like what I mentioned, would it help? Or would it only be for attacks/abilities?
It handles that well
I'm not very experienced with it, but from what I understand it should actually work pretty well
It should take care of the forward prediction, animations, etc
After you have all that setup the only thing left is rewind capability (which is a beast in itself)
by rewind do you mean correction?
No, I mean hit detection in the past
Because PlayerA will not be in the same place that PlayerB attacked him in
This is what will happen
- You'll fire a hadouken (eg)
- It'll tick forward by 50ms (eg)
- The hadouken is now .05 seconds ahead of where it was fired from on the server, and as a result, it is matched to where the instigator was when he fired it, all good
- The target will not be where he was .05 seconds ago
The forward prediction is half the puzzle
The rewind is the other half
Rewind isn't a correction
That hadouken needs to see the player .05 seconds ago
ahhh I see
is there any literature I can read on this? I could definitely use a good book or something 
Probably, you'll have to look though
This is just stuff I found myself
By working on stupidly complex stuff
I see, thank you a lot for your help. I'll look into GameplayAbilities and the UT code.
Last thing if you know, if I end up going with delay-based network instead of rollback, how do I make both players have the same amount of input lag?
Sorry that ones for you to figure out 😃
np, you've helped enough already, thanks
That sounds awful and I have no interest in ever doing it ;P
Everything I make is responsive and secure haha
yeah it's definitely preferable
Hi, when I do a servertravel it seems my HUD stays on the client. This will spawn a lot of errors so I would like to destroy my HUD etc but can't find in the controller or such an event that is a "pre-travel". Should you custom make this or?
But GameMode is server only
so you would need to RPC to all clients to destroy the HUD?
You mean Widgets are staying on the screen?
Cause the HUD class itself is def nothing you want to destroy by hand
Widgets yes
(Also, the PreTravel/ProcessServerTravel isn't available in Blueprints it seems)
I think the PlayerController has some stuff that would be indirectly or directly called after a Travel.
Maybe even Possession or BeginPlay?
I'm not sure if BPs has this, but there's NotifyLoadedWorld() in PlayerController.
And this:
PostSeamlessTravel()
Called after this player controller has transitioned through seamless travel, but before that player is initialized This is called both when a new player controller is created, and when it is maintained
PreClientTravel()
Called when the local player is about to travel to a new map or IP address.
SeamlessTravelFrom() and SeamlessTravelTo(). I'm not sure where these are called, though.
Not available in blueprints, I also think it would be too late because during the transition level you would also have the HUD (and the HUD shows stuff from the playerstate)
The seamless travel events are not available in blueprints (sad :-()
I just checked my project, and I remove all the UI stuff On PreClientTravel.
That's prolly only C++ as well, don't see it in PlayerBlueprints
You could implement the stuff into BPs. I think the lack of server-esque stuff not being BP accessible is why I started to do C++ stuff.
Yeah, I prefer to use the blueprint system so my partners can follow easier but it seems I will need to do it
We are removing UI on preClientTravel too iirc
Multiplayer is sadly really the place where BP only falls apart :P
It will improve over time I think (hope)
Doubt
It's been like that since the start
You can PullRequest changes in if you want, such as the OnCopyProperties and OnOverrideWith stuff in the PlayerState which I exposed
But I don't think Epic will expose a lot more if at all something
They did add ServerTravel to BPs recently, I think.
hello everyone, I'm trying to host a dedicated server without being logged on steam, which works, but it requires me to have the steam process running on the background (even if not logged the server boots up [which is expected]). I'd like to distribute a dedicated server build where I don't depend directly on having steam booted on the background, is this posible? ~
Hm, doesn't steam require you to have their weird console installed?
Where you then download the Server via the AppID of it etc.?
I'm pretty sure you do need Steam in some way
At least if you need your Dedi Server to talk to Steam.
In linux with the .so file it worked. No steam running in the background, just a library creating a mini steam enviro
Yeah but "mini steam enviro" is still "Steam in some way".
In windows, different story, not geting the same results even tho I have the equivalent dll's
yeah, it is still steam, because it needs to communicate with it
but what I mean is like...
oh yeah I tried, however when I tried to download the server with the steamcmd it wouldn't. It doesn't show up in the steam server list webpage, probably I need to fill something on the steam end?
Well you do need your Server Files to be hosted with the Steam system
It works with games that use the SteamPipe content system.
SteamCMD is the thing your players would use to download and install the Server
I'm also half sure I didn't need to have Steam installed for my Servers
But I'm not 100% sure
well in our case we have the dc server tool, which you download from steam
I know you have to place the ThirdParty DLLs of Steam into the BInaries folder of the server
Otherwise you run into issues
so I'll check what the steampipe is
because probably that's what is missing
oh our server works perfectly
it's just the little annoyance that the steam process needs to be running
on the background
I copied and pasted the most recent dll's
Thing is, I'm half sure I did not install Steam on our servers
That would be annoying enough for me to remember
haha
All I did was copy paste the Server Build (or rather the cooked content + server.exe) including teh steamDDLs over to it
right now is just a convenience question, nothing else, if end up not figuring out I'll probably open a ticket or something else, (or just rent linux servers)
right, we have a different depot for the dc server, included as a tool, shows up on the steam server list and so on, but not in that webpage I sent, which maybe is the reason I'm unable to get it from the steamcmd
I did everything you mention
ty cedric, let's see what I can do ^-^
Oki
oh, we show up in the list, god dang it haha, I didn't read the "this is not a complete list" silly me, gonna try a couple more things and I'll update for those in the same situation as me (I was using the wrong appid [silly typo])
and now I see how bad my C++ level is ugh 😛
okay I see now... I need to release publicly for login anonymous to work, I feel a bit dumb xD
Would you guys share how you delete your widgets? For some reason my code doesn't work and sometimes makes my screen just black before the game even starts 😦
I think I am using the FClassFinder wrong
I just did it now with UUserWidget::StaticClass() 😕
@ivory portal - you hav e2 options:
UUSerWidget::RemoveFromParent() - which will require you to have a valid pointer to that widget
http://api.unrealengine.com/INT/API/Runtime/UMG/Blueprint/UUserWidget/RemoveFromParent/index.html
or:
Removes the widget from its parent widget.
UWidgetBlueprintLibrary::GetAllWidgetsOfClass()
https://api.unrealengine.com/INT/API/Runtime/UMG/Blueprint/UWidgetBlueprintLibrary/GetAllWidgetsOfClass/index.html
Find all widgets of a certain class.
guys question - i have a level being streamed into a persistent level - loaded via blueprint::LoadStreamingLevel().
Dedicated Server
This level has a blueprint actor in it - that i'm trying to fire an event inside of it on server - but it appears to not be happening in a replicated fashion - the class is set to bReplicates=true..... and i'm doing a (what i believe to be) proper RPC chain - local function (called from another actor in the world) -> ServerRPC (of the problematic actor). I"m trying to increment a replicated float in the actor, and pass that floats value to a 3dWidget (Component of this replicated actor) for display of like a scoreboard.... however the value is always 0 (in a packaged game - for some reason it works fine in PIE mode....). Why would this work PIE and not Packaged/Launched?
RPC Chain: https://puu.sh/CYoBE/b73c80eb19.png
SetTimerTxt(): https://puu.sh/CYoDa/16afd90445.png
when I call INIT from the external actor - this print string runs fine... however the functionality doesnt happen and i've even debug print stringed inside of the timer function - which appears to never run (on server or in client - its not printstringing)
walldiv, do you use nativization by any chance?
@rotund sapphire - no nativization
in PIE testing - the print strings work fine... with DEDICATED SERVER selected. in a packaged game - when server is run as a seperate process - and the client from its own .exe.... the print strings dont happen at all.
i see it now. i think. srv_init only runs on server, which will run the timer on server only. nothing will update on client.
so let me understand something correctly.....
on a replicated actor - i thought that was all that was needed?
are you saying - i should run this into a Net Multicast RPC?
to run the timer?
(because i've done just that....)
with the same exact output - no change in visibility, no output to the WidgetComponent
since you're already replicating the time float value, just run the timer on client too, and it should display you the data in the widget.
timers are not replicated. and i think you wont need multicast rpcs only to update these widgets on clients that would be a bad design
SwitchHasAuth -> Auth() (as above) ; Client() (run the timer) ??
srv init only runs on server, and that's the only place you setup a timer - so that wont trigger anything on clients with-or without switch has auth.
just put the timer at begin play when on client and it will trigger updates for you on client showing the replicated value
Does anyone know if it's possible to refresh the steam net driver without disconnecting a client from a match?
I'm having a weird desync issue and the only thing that seems to fix it is leaving the match and returning.
destroying the net driver would terminate the connection - which you would expect
Yeah, I figured.
I'm having an issue where when the server runs UWorld::AddToWorld() the client's player controller becomes "local" as if it's a couch co-op situation and client movement breaks.
I tried marking the function that runs AddToWorld() with (Client, Reliable) and (_Implementation()) but it still affects clients.
Client means it runs on the Client, so that's what I would expect?
Oh. damn.
How can I mark it so that when run by the server it doesn't affect clients?
Well if only the Server is calling that function, that's what will happen
Something like if (HasAuthority()) or some-such
Every connection must be making the call to AddToWorld() already locally
So if you only want the server to call AddToWorld(), just wrap it with if (HasAuthority()) or something to that effect
Well, I just don't want it to affect the connected clients. Only the host, if that makes sense.
Well AddToWorld() doesn't do any network behaviour as far as I can tell
It's really weird. I can't figure out why desync is happening when I run that function on the server. When called by the client, everything works as I want it to.
Level visibility is managed between server and client. Server needs to know which actors to replicate to clients based on which levels they have avilable
Making a level visible on the client eventually calls 'ServerUpdateLevelVisibility' - so I assume there's something going on there.
hmm... ok.
@worthy wasp I had that but to search for my custom Widgets I needed to get the class object but that always failed
Hey @chrome bay , so I looked at ServerUpdateLevelVisibility while running on client and server. It doesn't seem to be running in either case. I'm not changing any visibility on the client side. Just on the server side. The thing that has me bamboozled right now is that when I look at the PlayerControllers from the server side, before I run add to world one is local and the other is remote. Then after AddToWorld, the client's player controller becomes local for the host. Any idea, what might be causing that?
Ever seen that before?
Amph, you should loose the dot, and use space instead. Also, running the command from cmd line might only affect the running client, while server won't throttle. The console window i think is a better choice for running this command. Alternatively, just go for the app Clumsy.
https://jagt.github.io/clumsy/ if i may
Guys
is it normal that my Dedicated server.exe will run the client of my game?
Shouldn't it be only the prompt running the server?
Hey, someone know why GameState BeginPlay function is call after Other actors BeginPlay function ?
on clients?
Yes
replication happens in no defined order
you can have a pawn before having a player or game state
because 
have to guard everything
But GameState Actor seems more important
I agree it's annoying, that's just how it is from what I've seen
Ok so I have an other question, I need to store a proceduraly generated map so I can access it everywhere, where do you think I can store it ?
If it's only relevant to the Server, store it on the GameMode
If it's relevant to everyone, store it on the GameState
And use a Seed to not need to replicate all information
Client need to have the map too
Yeah then put the info into the GameState or into a Component on the GameState
And replicate the seed
Let the clients rebuild the map based on that
I'm already storing it in GameState but I have an actor that need to have info about the map but GameState hasnt replicate when I try to access the info
So I can spawn actor on client & server without replicating them ? And with the seed they are going to have the same thing
Zeblote, isn't net priority will force the actor to replicate earlier?
30% chance to spawn a left floor etc.
The problem is that How can I call my actor begin play after my GameState beginPlay has been call ?
If you make sure to drive all these by a seed
Then you can use the seed to recreate the map on the clients
By asking in both directions
Actor BeginPlay checks if GameState BeginPlay has called, if not it waits
And other way round
@thin stratus When I was doing that I had an error saying that the mesh I was walking on as client wasnt replicated
(when I was spawning all map actor on both client & server)
when you say 'if no it wait' I can set up a thing like that within my Actor BeginPlay While (MyGameState->MyVariable == null);
What do you think is the better way, spawn my map with the seed on both client & server (what I am already doing in part) or put this wait condition ?
starkmax in case of static mesh components i found that replicating the comp is important, without that character wont' be able to figure out what it is standing on, regardless if the same stuff exists on both ends. alternatively there is a way to trick the movement component to think all is good, but i get strange stuttering with hacking this, so i'd not recommend going down on this path.
a solution here is probably to use instanced mesh component here, which is more tolerant to this problem, since the comp will be replicated, thus the movement component will be feeling all right
I'm trying to run this function on owning client only when called by the server, but I get compiler errors when I try to compile it this way:
void PlayKillcamReplay(FString ReplayName);```
```void UMyGame_GameInstance::PlayKillcamReplay(FString ReplayName)
{
TArray<FString> Options;
Options.Add("LevelPrefixOverride=1");
Options.Add("ReplayStreamerOverride=InMemoryNetworkReplayStreaming");
PlayReplay(ReplayName, nullptr, Options);
}```
Anyone know why UE4 isn't letting me mark the function this way?
Your Implementation signature isnt correct.
void UMyGame_GameInstance::PlayKillcamReplay_Implementation(FString ReplayName)
can't use rpcs on game instance, missing _implementation, fstring should be passed by const ref
^^ That to
Ok, so is there a better way I should be doing this if I want PlayReplay only to run on the host?
Right now this runs well on client, but when I call it from the host it causes clients to desync.
@fleet raven are you saying that UGameInstance::PlayReplay() won't allow me to call it on owning client only (if server)? Because I've got a bunch of other functions in my custom GameInstance that are running that way.
game instance is not replicated you may want to use replicated actor channels to fire events on clients from server. a playercontroller probably is better suited if you wish to address clients individually.
I really just want to keep calls of this function local.
if that makes sense.
It's for a killcam so I don't want other players affected.
They wont be, you choose the PlayerController to call it on.
Server has all PlayerControllers, you can find the one that needs the Replay and then call the Client RPC on that PC
Ok. I'll give that a try.
Hi everything, I am wondering if it's possible to get rid of building engine from source when trying to build a dedicated server with latest release 4.21?
how do I don't let the anonymous players join the server. I know I can do my authentication in GameModeBase::PreLogin and return the error string. but my authentication function that calls the back end is async
@rose egret You could check what happens if the error string is not empty and do the same in your async callback function
@mild forge Don't think so. You'd need to check the release notes if you want to be sure.
if I fill something to the ErrorString the remote client will get that eeror and server will close the connection. as far as I tested
I meant you to actually check the source code
And see what it does
Then replicate it (no in the multiplayer replication sense)
@mild forge sorry you must use the source version to build dedicated servers. There are dependencies in that which are not available from the standard client needed to build against.
Hey, I want to create a class that I will store in my GameStaten this class will hold my Map. I'll also load my map on client & server from a seed someone knows what type of class I am supposed to create ? (An actor ?)
I can't use an actor cause I can't know when my actor will be replicated to client
Actor is the only class that replicates though
I just end up getting the gamelift server and client sdk working in my project but now the content files cannot be read
Error:constructor game mode cannot find blueprint/character
can anyone understand where the error could possibly be
And of course you can know if the Actor is replicate. When you spawn it on the Server, set it to a RepNotify variable
Or just a normal Replicated one
You can easily check if that's valid @idle flame
I'll do that thx @thin stratus
@thin stratus Do you know if replication can fail ? Cause I have a variable within my GameState Class that's set to UPROPERTY(Replicated) But this value is not replicated in Client GameState Class
If using C++ you need to make sure that you also list the variable in the "GetLifetimeReplicatedProps" function
Then it shouldn't fail
Well I'm printing the value in the Tick function on Client side and it's 0 and on Server side it's an other number
On GameState .h
class MAZELEGENDS_API AMazeLegendsGameStateBase : public AGameStateBase
{
...
FRandomStream RandomStream;
UPROPERTY(Replicated)
int32 RandomSeed;
}
GameState .cpp
void AMazeLegendsGameStateBase::BeginPlay()
{
RandomSeed = 0;
if (HasAuthority()) {
RandomStream.GenerateNewSeed();
RandomSeed = RandomStream.GetCurrentSeed();
UE_LOG(LogTemp, Warning, TEXT("Initial seed on server = %d"), RandomSeed);
...
}
}
int32 AMazeLegendsGameStateBase::GetCurrentSeed() const
{
if (!HasAuthority()) {
UE_LOG(LogTemp, Warning, TEXT("AMazeLegendsGameStateBase seed on Client Replicated ? = %d"), RandomSeed);
}
return RandomSeed;
}
void AMazeLegendsGameStateBase::GetLifetimeReplicatedProps(TArray<FLifetimeProperty> & OutLifetimeProps) const
{
Super::GetLifetimeReplicatedProps(OutLifetimeProps);
...
DOREPLIFETIME(AMazeLegendsGameStateBase, RandomSeed);
}
What I have :
Initial seed on server = 27865
and then I'm printing thousand of time the Log of GetCurrentSeed
AMazeLegendsGameStateBase seed on Client Replicated ? = 0
Where is your Super::BeginPlay
Guys
I compiled my dedicated server, but when i open it, it will open the game client
is it normal?
This is my Projectname.Server.cs
// Fill out your copyright notice in the Description page of Project Settings.
using UnrealBuildTool;
using System.Collections.Generic;
public class VRG01ServerTarget : TargetRules
{
public VRG01ServerTarget(TargetInfo Target) : base(Target)
{
Type = TargetType.Server;
ExtraModuleNames.AddRange( new string[] { "VRG01" } );
}
}
You usually cook the whole content
And compile the DedicatedServer exe
And place the exe in the Binaries folder of the cooked content
Openeing that exe will not open the client version
@timber anchor
Exactly this is what i did, i followed the guide of the documentation.
But i tought the error was inside the cs file but seems not
So i will try to rebuild the dedicated server again
This is probably the problem
1>------ Skipped Build: Project: ShaderCompileWorker, Configuration: Invalid x64 ------
1>Project not selected to build for this solution configuration
2>------ Build started: Project: VRG01, Configuration: Invalid Win32 ------
2>The selected platform/configuration is not valid for this target.
========== Build: 1 succeeded, 0 failed, 2 up-to-date, 1 skipped ==========
I don't understand why ShaderCompileWorker, it should be the bame of the project
Why is your Configuration invalid?
Don't know honestly VS Studio isn't so easy ahah
Make sure it's Development Server at the top
long shot, but has anyone ever had issues with actor replication where a client loads too fast (possibly before the server has finished loading). the actor is in a sublevel
using seamless travel
Has anyone had an issue where the relative location for an actor gets out of sync on the server and client because of AttachToComponent and FAttachmentTransformRules::KeepRelativeTransform?
It looks like my actor is spawning on the server, replicating to the client at location {0,0,0}, and then the client's AttachToComponent call attaches the actor but with an offset from {0,0,0}.
So the actor ends up with large relative offset clientside and shows up really far away from where the socket I am attaching to.
I'm wondering why ShooterGame calls AttachToComponent on the server and client. AttachmentReplication already takes care of the clientside attachment, so that is odd. It looks like I can fix this issue by either only calling AttachToComponent on the server or by using FAttachmentTransformRules::SnapToTargetIncludingScale instead of relative
Guys
I finally did the dedicated server
but when i try to join it from the client
my character won't spawn
and this is the error inside the log of the server
[189]LogScript: Warning: Accessed None trying to read property CallFunc_GetGameServer_ReturnValue
VergaController_C /Game/BASE/Maps/lobby.lobby:PersistentLevel.VergaController_C_1
Function /Game/BASE/VergaController.VergaController_C:ExecuteUbergraph_VergaController:0278
[2019.03.12-23.10.44:477][189]LogScript: Warning: Script call stack:
Function /Game/BASE/VergaController.VergaController_C:BeginAuthProcess_RPC
Function /Game/BASE/VergaController.VergaController_C:ExecuteUbergraph_VergaController
[2019.03.12-23.10.44:478][189]LogScript: Warning: Accessed None trying to read property CallFunc_GetGameServer_ReturnValue
VergaController_C /Game/BASE/Maps/lobby.lobby:PersistentLevel.VergaController_C_1
Function /Game/BASE/VergaController.VergaController_C:ExecuteUbergraph_VergaController:0317
[2019.03.12-23.10.44:478][189]LogScript: Warning: Script call stack:
Function /Game/BASE/VergaController.VergaController_C:BeginAuthProcess_RPC
Function /Game/BASE/VergaController.VergaController_C:ExecuteUbergraph_VergaController
Any help? it would be higly appriciated really guys... ❤
Well, you should really know what an AccessedNone error means
If you don't know that yet, please learn about it. It's very fundamental and you shouldn't have to ask us about them if you want to do a proper Multiplayer game.
That said, it means that the RETURN VALUE of "GetGameServer" is not valid.
Yet you tried to access it.
And that happend in the EventGraph (I assume) of your VergaController
In the BeginAuthProcessRPC I think
But that's your code, so you gotta check that out yourself.
@timber anchor
The problem is that, inside the BP everything it's fine
This is a runtime error
Not a compile error
This will only show up at runtime, even if your code is fine during compilation
Wait
Wait
The same exe file that im using in local, it's used by the server atm.
But inside the VPS it's showing up this error
And locally it isn't.
If 100% the same build does two different things on two different PCs
Infact, locally i can join and play as much as i want
Then it's most likely something that is changed runtime
As said, your "GetGameServer" function doesn't return a valid value
So I assume your VPS makes this fail
And another funny thing is that inside my VergaController there isn't any "GetGameServer" so probably it's something related to a UWorks function
Wait
Is it possible that the VPS since it doesn't have steam installed
The log should show steam issues usually
Will not create the Session and it won't let the server run "Correct"?
If not, try enable verbose logging
(google)
Well, it clearly states that there is a GetGameServer" function being called
Yup saw it
Yes it's UWorks
You want to check if Steam is properly initializing on the VPS
You need to have the Steam DLLs in the Binary folder of DedicatedServers
Don't think you actively need to install Steam
But at least place the dlls into the binaries folder
Ok let me google that
was refered to here to ask this.... in my unreal engine project, when i launch it with 2 players, and one player interacts with door, some stuff happens + matinee plays, however it plays the matinee for both players...how can i prevent that
using matinee in 2019? o_o
was a tutorial i watched on doing screen fade to black
havnt figured out how to do it in sequencer
either way
why not just use a umg widget to block the screen?
perhaps.... but i imagine where im at now it would probably still happen on both players screens 😛
then it won't have any multiplayer stuff built in either
oh.....hmm
I'm still not sure how one should handle local split screen. I know that "Add Player" function but when should we call this? When a secondary controller is detected?
@thin stratus the problem was just a dll from steam missing
So thank you, even if were a bit rude in my opinion. But you told me the solution some how. I made it working
I see, thanks for the info @winter harness @thin stratus
Seems I got this exception while installing dependency for building the engine from source: Checking dependencies (excluding Mac, Android, Linux)...
Updating dependencies: 99% (33911/34200), 5845.1/5847.1 MiB | 0.14 MiB/s...
Failed to download 'http://cdn.unrealengine.com/dependencies/2636758-e606e606851e4693b1729dd35dcef7ae/345f37ad429b27f1360cf26aa535ef037724f7c4': 指定的路径或文件名太长,或者两者都太长。完全限定文件名必须少于 260 个字符,并且目录名必须少于 248 个字符。 (PathTooLongException)
install the engine in a shorter path
Ok I will try to move it to a shorter path
something like C:\UnrealEngine\ works good
So can we assume that all connected players are synced with UTC time? Like if I want to network an event at a specific date
not necessarily
system time can be way off
you might even get players who turn it back on purpose to see the event again
Hmm, when I assign a custom GameState in my GameMode and try to create a sesson, I just get a black screen
Didn't change anything else
But when I remove it from the GameMode it works again. Anyone know what that could be?
@fleet raven so what's the best way to pre-sync events in a multiplayer game
Think for example in Fortnite, in order to save bandwidth I assume the entire circle route is predetermined then sent to clients are start
The timing of the circle needs to be synced for clients, which should be super easy assuming they all have their clocks correct
that doesn't require a specific date, it's just something like "2 minutes in the future"
you can easily set a timer
Right but "2 minutes in the future from a specific date"
Date as in the start time of the game
whether people see the circle with millisecond accuracy isn't that important
Right
you can just send how much time the server thinks there is left and then use that value on the client
But if someone has their time off and joins a match it would screw it up I would assume
Maybe kick players whose time is not synced with UTC?
timers are always just offsets
like 1 minute from whenever you called set timer
whether the system time is correct is irrelevant for that
Hmm but a timer still has to be "started" which would require the server sending 100 RPC calls (in the case of battle royale)
fortnite probably sends thousands of rpcs when the game begins 🤷
sending a few one-off rpcs isn't going to matter
it'd be a problem if you tried that every frame
with more than a few
I know every tick is a no-no
Didn't know you could call thousands tho at the beginning of the match
Then again, maybe they have ridiculously powerful servers
I mean to all users, not thousands * 100 of course
@timber anchor Sorry if it came over rude. Wasn't my intention.
It's ok man, i understood that probably the question sounds a little bit "Newbie" but i was pretty sure that the function wasn't the problem so it was my bad! 😄
@plush wave FDateTime::UtcNow()
This method returns the Coordinated Universal Time (UTC), which does not take the local computer's time zone and daylight savings settings into account. It should be used when comparing dates and times that should be independent of the user's locale.
hey eXi, how goes it? I've adapted my chatroom method to the one you suggested with Maps holding chatroom info with strings (names) as the keys and structs containing PlayerControllers as the value. Having trouble adding PlayerControllers to the struct within the Maps though. If you don't mind taking a gander at this blueprint and letting me know if I'm doing it wrong that would be awesome...
I have a feeling my method is off for adding to the array within the struct
The Maps within the GameState are found just fine by string (name) but I can't seem to get the PlayerControllers to add to the array of the struct inside.
That's an issue with not knowing about value and reference
You are basically getting a copied value with your find node. Everything you add to that won't add to the original entry.
What you should do is save the struct to a local variable after finding it. Then modifying that struct and later calling add on the tmap with the modified struct. That will override the original entry
Ahhh I see
TMaps are useful but not 100% straightforward to use in BPs cause of things like that
But if I call 'Add' on the tmap won't it override the whole thing for each player?
Normal arrays have a Get (Ref) node which will create a reference for you. That way editing the ref will edit the array entry.
In bp that doesn't exist for tmaps..
I see
Well idk what exactly your code does. But it will only override for that chat room
I mean it's a ChatRoomName, Struct relation in your map
Not quite sure how to handle this then. I was calling this from the PlayerController so everytime a player creates a named widget chatroom they would add their controller to the struct array within the map in the GameState
And keys are unique
So would every player need their own key?
No, this is to identify a given chatroom.
By name.
The struct holds all info about the chatroom
What users are in it etc
Right. That's how I have it setup
Yeah so what's the issue then?
String as the name (key) and struct containing player controller arrays
I need to be able to add playercontrollers to the struct's array as they enter
but Add will overwrite the whole struct each time, won't it? Instead of just adding the PC to the array within
The array that you get has already x controllers
Adding one and then overriding the map entry is basically adding one to the map array
Ahhhh of course
You dont reconstruct the array. You get the struct first. Modify that and use that to override. Which results in it being the old array + whatever you changed
So get struct from Find, create local variable out of that, then break struct pin to get array ref, add to array, and Add the new local variable struct to the Map
Worked like a charm, thanks a ton eXi
Hey, maybe I am doing it wrong that's why I want to pickle your guys brain. I have my Lobby map where they choose a team. Team is saved in PlayerState but on changing from Map you lose all info in the PlayerState(?). Should I make my playerstate same over all my levels or put everything in playercontroller and switch with the OnSwapControllers event?
hi guys. I have a question: How can I send information from a player to a session when that player is connecting to the session? I'm using advanced sessions plugin
You can just RPC the server at beginplay of your playercontroller
i dont really understand could you please give me a representation?
PlayerController -> Event BeginPlay -> Custom Event (Replicated: Run on server) do you stuff you want to ask the server
Event BeginPlay calls the Custom event
ok but the thing is that Im trying to get the location of the player before connecting to the server. When the player joins the session with a new map , I want the server to teleport the player somewhere based on his location before connecting. Will what you told me work for that?
So your player is playing offline and when he travels to your server you want him to pass along his coordinates?
yes
orrr i could send the info to the gameinfoinstance and when connecting to the server get that info and pass to the server
will that work?
A game instance does not share any information (Server Game Instance does not sync with Client Game Instances)
You could use it to do the RPC call with it
http://cedric-neukirchen.net/2017/02/14/multiplayer-network-compendium/ You should read through this to have a high-level idea on what shares with what
it worked for me what I said about the gameinfoinstance
thanks for the help and link though
i will look through it
Hey, what's the latest method to get a simple multiplayer dedicated server running? Any changes from around 4.18 where all my searches point?
you just duplicate your Project.Target.cs to make a ProjectServer.Target.cs and change it to be Type = TargetType.Server;
Yeah I think I got it pretty much working but it seems a bit of a hassle
I'm following https://wiki.unrealengine.com/index.php?title=Dedicated_Server_Guide_(Windows_%26_Linux)
This still up to date?
is there any event on dedicated server to tell me that the server connection is listening and ready or failed?
Anyone know why when i join my server with client 1 and set master pose on my equipment then join with client 2 the master pose is not working for client 1 on client 2?
I did this with multicast btw
should I refresh equipment or something?
@maiden vine a multicast will run for connected clients and thats it
clients who join later wont have any of that info
replicated variables will be received by new clients when they join and if theyre set to repnotify, they will run whatever function is associated with it
thank you, so I must refresh for the joining player
use repnotify
awesome i was stuck thinking my function was failing
Got it thank you much on rep I set the master pose it works perfect
how can I specify that an actor, placed in world in editor, be client-only?
if an actor is placed in the editor then its part of the level and everyone loads it
if the actor isnt set to replicate then any changes the server makes wont replicate to clients so they will have their own control over it for changes that only show up locally
right, so there's no way to have an actor only load on clients when it's placed in the editor, correct?
meaning I'd have to spawnactor on each client individually and turn off replication, right?
if replication is off you might be able to destroy it on the server when it loads
but your method is fine
thanks
By default Pawns Blocks each other
And you can't step on other pawns
Getting pushed out of each other is something you can probably somehow setup
disabling the collision between them would be easy, but then you need to be doing this force thing on both the client and server (including when the client is reconciling moves)
hello, i'm having an issue with some crazy ass bullshit that is comfusing the shit out of me on 4.21 involving BoxCollision, Pawns, and Overlap in a networked server/client dedi setup
you see, i have an Actor with BoxCollision on it, this box collision is indeed enabled and replicated and net load on client, same as the rest of the Actor
it is set to generate overlap events with everything, including Pawn, and print a generic piece of text with PrintString to the log when it does begin an Overlap
when ramming my Default UE4 Pawn into it, the Client will print the log, but not the Server
the server will never ever call the overlap event for some godawful reason
i've verified the serverside Pawn exists, I've verified it's at the same X/Y/Z coords as the clientside pawn using the debugger stuff
it just isn't calling it and it's incredibly obnoxious, my project is stalled out right now until I can debug this
this is on 4.21 btw
both the pawn and the box collision are set to overlap with eachother's object types as well
reproduction steps:
- make a blank UE4 project, blueprints
- make actor
- slap Box Collision on that Actor
- tell it to Overlap with Pawns and/or everything just to make damn sure
- make subtype of Default Pawn
- tell it to Overlap with Everything
- set it as the default Player Pawn
- boot that shit up, Dedicated Server Mode, whatever number of players
- fly a Pawn into the BoxCollision
- Watch as the only prints are Clientside according to your output log
- Cry a lot
oh, also check all the Replication shit and check "create overlap events" obviously
i'd throw together a Test Project for you following exactly these steps but I've spent about 3 hours ticking and unticking every possible replication and networking related option to figure out why the events aren't getting called on only the serverside despite both the actor and the pawn definitely 100% existing serverside, and my head is going to explode
if anyon ehas any ideas please let me know
oh and yes i also tried just directly checking the OverlappedActors list on tick
that also doesn't get populated
don't have vs open anymore to check when that is called, but if it uses CalcVelocity during reconcile it's probably fine
you want to make sure the ClientUpdatePositionAfterCorrection (or similar) is using the logic again
it goes through the saved moves and does them again
sure, maybe I can use something similar for my project 🤔
not sure how well it's going to work with the movement being based on the other replicated players positions
100+ is just normal
I have it set up so the editor is always simulating 200ms with some packet loss when using multi-PIE
I think I added something to the game mode that sets the setting on start
err
game state
needs to be set on both sides
I actually have no idea what tick rate a server runs at
seems to work fine with listen servers at different fps than clients
Does a server travel re-initialize the GameInstance on the server or the GameMode?
GameInstance is like the process. It is created when the game is started and it is destroyed when the game is closed. Anything that happens inbetween then the GameInstance does not change.
The GameMode may change on Server Travel though yes.
GameState may as well?
Yes
Thankyou
👍
If I run this in the GameInstance on the server to server travel
And then cast to the GameState to update variables there
Will they persist in the GameState post-server travel or is there a legitimate way to carry this data from GI to GS after the travel?
Dumb question, I can cast to GI from GS on event init and grab the variables
Keep them on the GI when the Servers GS begins play just grab the values from the GI
When is NetDriver initialized?
Always, i guess. Why?
Probably at somepoint in LaunchEngineLoop
I'm trying to get the time elapsed for a multiplayer match.
Was hoping the time variable in NetDriver would provide that
Just make your own?
Hey,
I'm trying to access a fstring store in a struct on the client side but my game is crashing every time I try to access this fstring
Here is where I try to access it : https://www.codepile.net/pile/dELO8qMg
{{ description }}
Is there a list of classes that have locally-owned network connections? (Aka classes that can call RPCs). The obvious example is the PlayerController but what other classes do this?
Any class that has a net owning connection. So that means if an Actor has an owner in its owner hierarchy that comes back to a PlayerController then it can call an RPC
Ok so basically only the PlayerController or any PlayerContoller-owned actor can call an RPC?
I am tweaking with TwinkStick template for multiplayer gameplay, when I started it with 2 players in PIE, no pawn was spawned(Logs show: no game present for joinning session). Currently I dont any PlayerState class or PlayerController class yet with thinking dont need it yet. So now I am wondering what I am missing for it.
What I have done includes: Added HP bar widget with pawn and implemented TakeDamage, ApplyDamage, set some variables to replicate and some functions to be called on server side.
Before I deleted the pawn from the map, the pawn was spawned, I thought if I delete the pawn, and when player join the game the pawn will be spawned automatically, so I missed something i think
I messed up the game modes, and finally the default pawn is spawned for the first player, but not the second player, seems caused by pawn collision at the same location.
Okay after changed the collision handling method, i got my pawns spawned. 
Okay, another question: Is there any way to access current session IP on blueprints? Been trying to put off diving to custom c++ classes/overrides.
Also wondering why all my searches only return stuff from circa 2015-16
At the moment I have some sort of puzzle where two players but stand somewhere before a variable will be set with repnotify which will make something visible. The detection if the player pawn is standing correctly happens on the server side with a switch-auth node. Now, this will set a variable that has repnotify. But it seems this only repnotifies to the server because when I overpass the switch-auth the client also see something come visible. Does repnotify behind a switch-auth only repnotify the server?
Or wait, the repnotify isn't the problem. It seems setting visibility to false doesn't work on my clients (I just tried with an RPC from server->clients to do it. Making it visible works, making it invis not)
Hey, could someone tell me a possible reason that my game won't find the lan session the second player makes when searching?
it doesn't seem to find the lan session at all no matter if it's steam or lan
okay i worked that out but now the sessions is shown 4 times instead of once.
Hey guys! Just need a little pointer on something
RPCs invoked by the client only run on the server if the client owns the object that invokes
What does ownership entail?
@solar stirrup if the client's player controller is set as the Owner of an object
Does the client also own the components of said object?
alright ty ^^
if not just call the rpc on the parent actor
Alright
NetMulticast means the RPC will be executed on the Client and Server version of the component right?
Ownership is an actor-level concept - so yeah they will "own" the components if you like
Component RPC's / Data is actually sent via the actor
yeah as long as the server calls it then it will run on every machine the object exists on as long as it replicates
including server
What if the client calls it?
only that client runs it
I need to replicate moving an item in an inventory
So it also needs to happen on the server
(validation there would also be nice)
You would ask the server to move it
How does one ask the server to move it?
Call a client rpc to the server and have the server call a multicast rpc?
I'm working on it, but how should it be replicated?
Well depends on the system really.
what is it stored in?
It's a TMap<int, FItemSlot>, so the way I was going to make it was have replicated AddItem, MoveItem, RemoveItem functions
TMap's you will struggle with
maps dont replicate
FItemSlot contains the Quantity of an item in that slot and a pointer to the item
What else can I use to replicate then?
TArray is probably best
Hmm then that means I have to store the placement of an item slot in itself
you could use RPCs or an array but do you need multicast like you said earlier?
or does only the owning client need it
if you need all clients to have the info then arrays set to repNotify are your best option
Server and Client need to know it moved
Are pointers replicated? FItemSlot has a pointer to the item
How would it be replicated?
Here's how mine works
InventoryContainer
- Holds a TArray of InventorySlot
InventorySlot
- Holds a single InventoryItem
- Replicates the pointer to InventoryItem
- Player becomes the "Owner" of whatever is in the slot.```
InventoryItem in this case is a replicated actor of some kind.
Moving an item becomes a simple case of asking the server to move the actor from one slot to another
So my inventory slot should have a pointer to the actual Actor of the item?
I mean, you can do it however you like - this is for my weapon inventory, but if I was doing a "minecraft" inventory or something with a fixed number of possible objects, you could just use data
oh okay
I mean I'm converting a project from BPs to C++ and this is what they were doing
E.g, this slot contains 'X' amount of 'ID' item
There's not really any defined way to do inventory since it can be very unique per-project.
I mean if TArray can already be replicated I'm fine with using it
I'll store the item's position on the grid in the slot itself
or I could point the new slot to the item and clear the pointer on the old slot
Yeah, for something simple you can just have a TArray<FInventoryItemData>
And ask the server to move data from one index to another in the case of moving items around
Actually would that work?
- Move item from slot A to B
- If slot B has an item, temporarily save the pointer of slot B
- Point slot B to item from slot A
- Point slot A to temporary pointer
- If slot B had no item, just clear the pointer on slot A
- Update UI
If it's just a struct of arbitrary data, you can just swap the elements.
Same with anything really
the index of the array is your "slot" if you like
struct FItemSlot
{
GENERATED_USTRUCT_BODY()
public:
int32 Quantity;
FItem* Item;
};
That's the item slot
Is there a way to have empty slots then?
What's FItem?
contains all of the data of an item
icon, meshes, details like max stack amount, health etc
You can't have UPROPERTY pointers to structs, so you can't replicate that
It looks like it's being overcomplicated
Here's what I'd do
USTRUCT()
struct FInventoryItem
{
UPROPERTY() int32 NumItems;
UPROPERTY() int32 ItemID;
}
UPROPERTY(ReplicatedUsing = "OnRep_Inventory")
TArray<FInventoryItem> Inventory
void OnRep_Inventory()
{
UpdateUI();
}
the thing is items can have things like durability
so I can't just save them by ID
Right, well in that case you can't replicate pointers to arbitrary data. The pointer has to point to some other replicated object, either an actor or a component etc.
In which case, you need something like this:
USTRUCT()
struct FInventorySlot
{
UPROPERTY() AInventoryItem* SlotItems;
}
UPROPERTY(ReplicatedUsing = "OnRep_Inventory")
TArray<FInventorySlot> Inventory
void OnRep_Inventory()
{
UpdateUI();
}
that or an actor that holds the data itself
oh right actors can hold data too i'm stupid
In my case I have a chain:
AInventoryItem->AEquippableItem->AWeapon... etc
welp guess I'll do that
I usually do mine via ActorComponents
So I can slap that Inventory stuff onto everything that needs it
I don't know how the fuck it worked in Blueprints
One ActorComponent for the Inventory itself
yea
And one for Managing the interaction between two Components
E.g. Move Item from Chest to PlayerInventory
Spend quite some time on a regular inventory, like you'd see it in RPGs.
That's on the Marketplace right now, just in case you want to learn from looking at existing stuff
BP only though
Yeah loads of different ways to do it. In my case I have:
-> Stores a Tarray of: UHardpointSlot::UObject
-> Stores a pointer to ASomeWeapon::AActor```
the more I dive into converting the blueprints, the more complicated it becomes 
Yeah in my case it's a struct that sits in the array
That holds an FName for a dataTable (static information) and then values that are dynamic
@solar stirrup It's more that as you go into C++ you find better ways of doing things 😄
okay looks like there is an actor for items in Blueprints
Don't understand how it works tho
welp time to figure out
tbh I find writing inventory systems kind of theraputic 😄
I'd just like to get away from the overly-OOP style mine uses atm
But UE cried itself to sleep last time I tried to replicate a pointer to an interface
I think I am overseeing something. An actor from the server (not player or anything, just a building or something). When he has variables with OnRep, do these OnRep also execute on non-owning clients?
They do
Because I am now just doing onrep of a bool with just a print but the print only executes on the server 😕
Is the actor spawned by the Server?
Or pre-placed in the level?
Not that it should matter IIRC
pre-placed in the level
So yeah in theory if the bool starts off at "false" and the server changes it to true, the on rep should fire for that actor
If it doesn't, out of interest, what happens when you uncheck Net Load On Client
Well it can set it to anything, but the OnRep won't fire if the client has changed the value locally
OnRep's will only fire if the received value from the server differs from the current local value
So if you're changing the value on Server and Client, you'll potentially get sync issues
In C++, you can tag the variable with REPNOTIFY_Always, in which case the OnRep will fire whenever the server sends the value, not just when it changes from the local one
I'm not sure if BP has that
Haha yeah that'll be it
Yeah it looks like BP doesn't have RepNotify_Always (it would in theory go where RepNotify is)
I only replicated variables and components and was pulling my hair why nothing was working
@chrome bay quick question, since you use actors for items, do you make the invisible when they're in the inventory and then make them visible if you drop them?
I don't really have a concept of dropping in this case, but yeah they are hidden when unequipped
It's up to the item to decide what it does when equip/unequipped though
Guys basically client won't destroy the actors of his body meanwhile the host of course will
basically i need to replicatete destroy function?
@thin stratus can you explain me this table please, because i'm not sure about client-server replication in some cases
It basically shows what happens if an RPCs is invoked from either Client and Server.
And how the Actor Ownership changes the outcome
Can a widget access the GameState properly? It seems to work sometimes which is what makes it confusing because I know widgets aren't replicated and anything in the GameState that exists on the server should not be accessible by the widget itself. But sometimes it is.
E:g. Lower Table shows all RPCs that are issued by a Client
First row means the RPC is issued by a Client on an Actor they own
Like the PlayerController
ServerRPC runs on the Server
Etc.
If the Client calls a ServerRPC a not owned Actor
It's dropped
Rest you can read out of the table
@unique thunder Of course you can access the GameState
GameMODE is what is not available
can you give me example when actor is owned by other client and RPC invoked on Server
?
Hmm .. here's what I've got:
- GameInstance BeginPlay > checks a few variables, sets them, then server travels.
- GameState BeginPlay > casts to GameInstance and retrieves variables.
- Player joins server > creates widget > widget casts to GameState to retrieve variables.
The variables the widget ends up with are the default ones I enter in the editor, not the ones the GameInstance overrides on its beginplay prior to server travel.
Could this be because the GameState retrieves the default variables on BeginPlay but does not re-initialize after the server travel to retrieve the updated ones?
Since a server travel occurs, the GameState beginplay should re-initialize, casting to the GameInstance and retrieving the updated variables.
@thin stratus
so if game Mode spawn pickup that pickup is owned by server?
That depends on what you pass as owner
Server has to spawn Replicated Actors anyway
Doesn't matter where you do that as long as you do it on the Server side
And then you can pass a PlayerController as owner (or anyother client owned actor) if you want
Hello
I've made a cooldown on jump for my character. Its just a simple float, decreasing by deltasec in tick.
CanJumpInternal function overridden, checks if the float is bigger than 0, then it cannot jump. Im setting the float in the "OnJumped" function
However, when playing with 4 players, sometimes, very rarely it happens that the character jumps on client, but not on server, so the character gets snapped back on client side.
I'm thinking that maybe the client is ahead, and it's cooldown is down, but when the server gets the event, it still has a small cd.
I think it's caused by the way unreal replicates the movement (queues up the moves, and executes them in a fixed time rate, so in one tick, it could process several move commands). That causes some desync between the actual move (and the jump), and the character's jump cooldown.
Now I could just go ahead and ignore the CD on the server, and keep it on the client, but that is a bit hackish.
I could use timers too, but I think i would run into the same problem.
Any advices on how to solve this?
Can some one tell me what should I do to get UOnlineBlueprintCallProxyBase::Activate() called?
That should call by default
Just follow the existing callproxy classes
I also made a ue4 stream tutorial about them, exposing the steam friend list
Steamworks SDK v1.44 - New Networking APIs
supposedly gives big latency improvements
sounds similar to the google cloud premium tier stuff: https://cloud.google.com/network-tiers/
Network Service Tiers is the first customizable cloud network optimizing your Google Cloud network for end-to-end network performance or cost savings.
🔥
about bloody time I say!
How bad was the existing one ? NAT punch was working well already wasn't it ?
I don't think it worked at all, I seem to remember UWorks or something had some huge issues with it
I think it was in regards to player hosting servers or something.. players had to forward ports or something
I can't remember now haha
This is the stuff I want to do so you've got me worried here 😛
My understanding was that Steam packed its own NAT punch, UE4 using either that or another library, everything working out of the box
There's a few old threads around saying it didn't work or something.
Ah here we go.. although this is super old
Apparently steam does do the NAT punch before.. maybe it wasn't super reliable?
UWorks dude would know
Yeah I can see the existing tech not being 100% reliable
Anyway I'll learn soon I guess
Steam networking uses libjingle which implements ICE (reliable traversal) and iirc falls back on the steam proxy backend if you're in a situation with symmetric NAT etc, so I don't think "100% reliable" is anything new... @chrome bay
Thanks for the details Xenonic
wait, games using steam networking can use this relay network for reduced latency without extra cost?
am I understanding that correctly?
they're saying it reduces latency by using better routes than the open internet
I'm talking about the post linked above
Ah, the new one then, don't know
"No extra cost" meaning "as part of 30%" then
yes
Still a pretty good thing
something actually useful in return for the 30%
Yes
does this mean for 57% of players, it became worse?
Ah okay.. I wonder what the issue was with UWorks then
Yea zeblote using their custom routes really is only beneficial for long distance connections + bloated routes. Fiber connections within the same country are probably always going to beat their system
can you do both? connect through this and directly and use the one with less latency
they're saying this protects game servers from ddos attacks
so exposing directly is probably a terrible idea
Yea that's one of the biggest benefits of their backend imo
IP masking
If you're hosting dedicated servers though... I would rather implement my own mitigation infrastructure than suffer the latency costs
I'm expecting player hosted servers with usually long distance connections
why does my game run faster in stand alone, built, but when uploaded to steam and hosting it slows down?
theres hitches/stutters
use the profiler
actually it lags on the package build
and i did game, draw output seems fine. I testing in a simple level fps is fine too in standalone and no stuttering
when package even on the simple level the game stutters
profile it
If you're sure it's a performance issue (missed frames)
If it's not performance related (solid framerate but teleporting objects) then your multiplayer code has issues
I think I found the issue it was a fullscreen issue.
created a DefaultGameUserSettings.ini on the config folder
runs like editor now.
inside I added this : [/Script/Engine.GameUserSettings]
bUseVSync=True
WindowPosX=-1
WindowPosY=-1
bUseDesktopResolutionForFullscreen=True
FullscreenMode=0
LastConfirmedFullscreenMode=0
Version=5
[2019.03.15-00.38.08:252][798]LogScript: Warning: Script Msg: Modulo by zero
Anyome knows the origin or this error?
Dedicated server won't spawn my charact
best guess you did a remainder of division by zero somewhere
odds are that it either caused your spawning logic not to execute at all
or caused a NaN in the SpawnTransform
in 2nd case you have a LogSpawn OutputLog entry explaining it
@mild forge i believe ShooterGame template is closest you'll get to defailed "guide"
Okay I will check it, thanks
@winged badger the only calculation i have is a conversion from float to integer
So i don't think this is the problem
Easy enough to test, right? Remove the conversion and test again
I am converting a Pawn to be a Character, so I wont need to handle movement in tick manually, however the bound method was never called when the keys are pressed.
Here's code if someone would like to help: https://github.com/devfans/LandMaster/blob/master/Source/LandMaster/ShipCharacter.cpp
All the resources I can find about doing player hosted sessions either use LAN or Steam. Is there an alternative online subsystem out there? Just want to explore all my options before I settle on steam.
@tranquil steeple just stick to the generic subsystem interfaces as much as possible and you can move between them in the future
epic has some stuff on the way related to it:
Thanks, @fringe dove
Anyone use gamelift? I'm trying to deploy my server to AWS but it's saying the server crashed and I have no idea how to access the log
No way to use Steam's subsystem without giving them that $100 eh?
Yeah
The $100 is more than just the online infrastructure though
GOG has an online subsystem too (good luck getting on GOG)
Creating a new, independent subsystem is a good idea, like Epic themselves did
But it's a lot of work unrelated to your actual game, and you'll need people to use separate accounts just for your game, which will annoy most of your clients
if a game has separate accounts but is sold on steam, ideally it would just auto-register one when they launch it for the first time without taking much time away before it can be played
noob multiplayer question: if I have my player controller invoke Broadcast() on a delegate that's sitting on a component attached to an actor that is not possessed by said controller... will that call get invoked on server, owning client, other clients, none, all?...
the actor being a character that's replicated
The Component uses the Actor
So whatever rules count for the Actor will count for the Component
Given it's marked as replicated
Also "Broadcast" and "Delegates" have nothing to do with networking
The call will get invoked on the side you called Broadcast on
@chilly mason
@thin stratus thanks, so if I'm calling broadcast from a client it'll never reach the server, correct?
As said, Delegates have nothing to do with networking
RPCs are used to move from OwningClient to Server, Server to OwningClient, or Server to All (who have a copy of it)
Does anyone know what is the recommended number of players for listen server, is 10 to much ? Because when i open the same project 3 times and play it doesn't have any problems, but when i open 10 project there are some problems like some player names are not loaded, can't hit ant player until server hit it... etc Don't know if it happens bcs im running 10 projects at once or is it network problems, would it work normal if i test it on 10 computers(need to find 9 people to test it)
Delegates are something totally different
@brave moon Well, technically, given UT can do that, UE4 without any extra stuff should be able to handle like 16-32 players ,depending on the game
Testing 10 games at once on the same PC is def not recommended
You are basically simulating the traffic and hardware resources of 10 games on one PC
That could totally lead to some issues
@thin stratus thanks for the answer
Hey there!
How can I get the region from a session result? I want to display the country's flag of the server location
@thin stratus The 'FireShoot' is the binding name it's working good to trigger fire action., my issue is the movement input is not triggering movement(MoveForward, MoveRight) in my code.
i'm sure this is going to sound familiar to someone. in a server-client (non-dedi server) setup, both players spawn and possess their characters. both can move around and shoot etc. however, the client is not sending back any information on it's position to the server, and while it moves on it's end, the server doesnt see any update. It does see projectiles the client spawns etc. The client sees the server player as per expected. i'm not sure what i've changed, and character and character movement is replicated (checked). any ideas on why the client pawn is not moving on server end?
one weirdness is that this bug does not reproduce in the editor, maybe it only produce when the client joins after game start.
What version are you on?
4.21.2
my spawn BP from gamemode:
@worthy perch thx
and before that, from character and controller, but i think that is not connected because the issue occurs before any respawn/death of character
What is the Player class's Auto Possess setting?
hmmm... where is this option?
Class Defaults in your Character/Pawn class.
"disabled" on character BP
Can you post a picture of your Character's Class Defaults settings? I'm a bit out of guesses of what could be wrong.
And the replication category settings under that?
Hmm... that respawn function in your GM, is that the only place it's called? Can you make it not an RPC -- not Run On Server? It would already be only available on server anyway.
ah ok. yes i think that is the only place it is called but will check
it is called from player controller also
bbut only on death
which is after this bug
but i will test with replication off on respawn and get back to you i guess
<- player ccontroller
Just for the sake of testing, can you not call it in your PlayerController and make it not an RPC?
ok will do and will get back to you.
Also, OnPostLogin, if you right click on that node, select Add Call to Parent Function.
I think the Add Call to Parent Function will fix it.
This is in AGameModeBase::PostLogin, and it does sounds related to your issue.
// Notify Blueprints that a new player has logged in. Calling it here, because this is the first time that the PlayerController can take RPCs
K2_PostLogin(NewPlayer);
ah ok
a semi related question. in the screen above i reference a particular gamemode in player controller. i've done this because a bunch of tutorials had a similar setup. but what if i want to add other gamemodes? do i also need new player contrllers for them?
You could use an interface.
You shouldn't do this, but just for the sake of telling you, you could just do a series of casts and see if any of those succeed.
Did Add Call to Parent Func work?
just uploading on second machine to test
Wait, damn, I misunderstood what OnPostLogin was.
no that did not affect anything. i tested changing the rpc to play unreplicated and also added a call to parent function on the respawn event
oh sorry on the post login event
actually i only tested the call to parent function
my bad
will now test that and also an unreplicated respawn event
ps i am using steam for nat punching, but i am sure this issue exist in normal client connection
negative
thanks for your help. let me know if you or anyone has any ideas. i will test when i get back from walkies
I am out of ideas. But if everything else works fine, then it is probably something on your character class.
gotcha. cheers.
hey, have a question regarding replication/rpc
I have a server which has a moving platform, when a client connects the platform movement initializes and it is out of sync with the server
whats the best way to synchronize them?
right now when I try to jump on the platform on the client I fall through it
@mild forge Wasn't sure if it was a typo. Thought your binding has the same name as the function. :P
You could try to mark the Move function with a UFUNCTION()
Both of them
@safe marsh you need to replicate the position vector of the platform
so when clients join the state of the platform is already set, you can handle this with a onrep call that teleports the platform to the servers position, but there is a few ways you can handle it
I am using an interpTomovement component in bp
to drive the position
I thought that kind of stuff was handled with the actor movement replication flag
doesnt seem to be a way to update the position using this component
the actor and all components are set to replicate, but they dont synchronize
Can a TSoftObjPointer not be passed in an RPC? Basically I just need the FSoftObjectPath it contains, so I got it work by switching the RPC param to that instead
Just curious at this point
well the solution was something like this, freeze the platforms on the client until they loop around a sync with the server and start them all
uses less bandwidth than updating the location of the platform all the time, seems like InterpToMovement doesnt have a function in bp that can initalize the movement of a client platform at a certain % of the loop so they sync up on beginplay
@cedric_eXi#4538 I will try it, thanks
Can a client execute a multicast RPC on the server?
Just thinking this out, it's for a "DestroyItem" RPC that destroys an actor on every client including the server
The client should be able to invoke the RPC if he owns the item
Have the client tell the server to delete that actor. When destroy is called on a replicating actor from the server, the destroy will also propagate to all clients with that actor.
the compendium says something about doing that in the PlayerController
through an interface
I guess that could work
since the client can only destroy things in its own inventory or an inventory it looks like
Anyone here happens to know why there's always a 60% chance that the other player doesn't spawn? https://puu.sh/D0SqX/3e4a5b1769.png
The playerstarts are set to Always spawn, Ignore collisions
The playerstarts are floating above the ground
is there something blocking the player start?
it sounds odd
i can spawn lots of pawns in the same start
Second player is being spawned in through: Same in BP UGameplayStatics::CreatePlayer( (UObject*)GetWorld(), -1, true );
So I have my own variable that stores my playername. I used it to set the playername widget above my head. My issue is that it sets all player's widgets to my name. So if Player 1's name is Whippy then he see's everyones name as Whippy. But Player 2 see's everyone's name as his. So if Player 2's name is MemeKing then he see's everyone's name as MemeKing. I'm not sure what I did wrong in the replication. I stored the playername variable inside playerstate and then retrieve the variable inside my widget
If I want to replicate an FDataRowHandle for an item, can I actually do this?
UPROPERTY(Replicated)
FDataRowHandle Item;
or should I use a unique item id
You should probably use the unique item id. It would save net bandwidth.
alright
I'm struglging with weapon sounds and replication. I have an animNotify for my reload sound but everyone in the game can hear it when a person reloads. What do I need to do to fix it? Does it have something to do with Mono and Stereo?
probably your attenuation settings
@inner hedge there is a LogSpawn entnry in OutputLog for every failed spawn, usually giving you an understandable reason why it failed
warning category
Oh yeah, it just said it failed at the spawn location..
No other actor or anything useful really :(
you said the PlayerStarts are set to AlwaysSpawn, IgnoreCollision, i assume you meant PlayerPawns?
Uh, no, the player start actor :o
mine are preplaced on map
i have overriden the ChoosePlayerStart function in GameMode
to pick one
its just that you are introducing another failure point if you start spawning players before your PlayerStarts are spawned
he said his PlayerStarts are AlwaysSpawn, IgnoreCollision
so i was talking about those
the playerstarts should be pre-placed
So then its something else
i spawn my players from HandleStartingNewPlayer override
i never spawn them at the exact same location tho
because while your PlayerStartActor might be set to AlwaysSpawn, that doesn't extend to your PlayerPawns
It doesn't ? O_o
and depending on your collision and physics settings, in most cases, even if you manage to Spawn several players at same location, chances are one or more will get catapulted into orbit because their colliders will overlap when they spawn in
So the spawn collision setting on the spawn point are to regulate the spawn behavior of the spawner itself? -_-