#multiplayer
1 messages ยท Page 561 of 1
not sure, ive never used the NPS
interesting
the normal one is fine for what ive done in multiplayer
ok deleted the player starts and added 1. both players spawned at the same point but client is still not moving.
server player does move.
can you screenshot how your pawn handles input
oh thats way different that what I thought
sorry I've never used the top down templatw
is that last shot from in your pawn or your character controller
controller
and when you're testing, you have a menu level that you load into first, right?
yea
yeah thats all I can think of right now
I'll mention you if I can think of anything else though
I'd just go for classic debugging techniques like testing to see if the pawn is even recieving input, and how far it gets in the BP without messing anything up
maybe test to see if it gets past the branch?
also when you click it says the client is printing out stuff right?
should be like "client: default moving"
oh
yeah
the default is to run as server
you need to connect a second dude for a client to exist
whoever hosts the game is also the server, unless you're using a dedicated server
still doesnt specify...
this is why i wanted to see if the index for the controller was changing
weird, maybe that only specifies in the pawn?
I don't think it would, but you could always print the controller index to debug
I'm not on my pc rn but I'd say somewhere in the controller the should be a "get index" node or something of the sorts
yea the TopDownCharacter
and on the second screen, does it not show a player index of 1 in the ui?
on the clients window
let me add the client
testing on 2 different machines so have to submit through perforce each time
lol you dont need to do that hahah
open the dropdown menu next to the play button, and slide the number of players to 2
that will just open two windows on your main machine
prob cause its standalone
i would make 2 players, no dedicated server, and new editor window
thats my defaults
isnt stand alone needed to test multiplayer/steam stuff?
not to my knowledge
have you tested your game on 2 different networks?
had a friend join your game from a different home or city?
Set up the Unreal Editor for testing multiplayer games.
"By default, the server type is set to a Listen Server when playing in the editor or standalone game."
still a listen server either way
but no i haven't so you may be right
yea maybe play modes need to be different depending on what youre testing
the steam popup doesnt come up unless in stand alone
actually i just remembered that i have had a friend connect from another network
it was a packaged game though so i dont know if that affects it
i usually just join by hosting a lobby and not through steam
lol yea that isnt somehting ive done before.
im pretty sure that joining thru steam just bypasses the step of finding the lobby, and just joins your friends
havent packaged a game and then tested multiplayer joining
nope
you still have to use the lobby if you set that up
hmmm
this testing.. in standalone/steam popup just allows other unreal editors to join your game.
i've always just used the defaults i recommended above and didnt worry about steam, but when the game was packaged my friends were able to join
it was an awful attempt at a game but the point is there
yea ill use your ways for testing locally
just worried that itll change replication
shouldn't, i still have to deal with it all the time
ue4 still treats client viewports as dedicated clients, whether you run on a different machine or not
cross network testing should really only affect the "use lan" setting when finding/making sessions
the two viewports are still separate entities from ue4's view
that also rules out anything that might have gone wrong when transferring through perforce and anything like that
alright
when you join the host's session, the UI should say player controller 1 (the number doesnt really matter, as long as it's different than the host's) and auth: client
or auth: remote, i dont remember which
is there a good resource for information on implementing lag compensation in UE4?
FPS lag compensation
Hi, what does 'Replicate Movement' exactly do? will it do client side prediction? Im just moving a actor on server with setActorLocation, but the client is very laggy
No it does not enable prediction, it simply replicates changes to Location and Rotation of the given Actor to Clients.
The CMC is the only movement component that handles Client side prediction.
So why is Replicate Movement so laggy? is that expected?
ReplicateMovement works differently based on wheter or not the root component of an actor simulate physics
if it isn't, it snaps to the last value received from the server
Hello?
Its not physics @oak hill , just moving actors
@gusty raptor "Replicate movement" simply teleports the actor every time a server update is received.
So maybe once a second when the network bandwidth is low
Yeah, it's replicated at the frequency setted in NetUpdateFrequency
If you look in ACharacter it overrides the function PostNetReceiveLocationAndRotation, where it applies the smoothing
It's replicated at the maximum frequency in NetUpdateFrequency
Will commonly be much lower
Definitely yes. In fact, I don't understand why the default value is so high
I'm trying to copy properties in the player State, but it doesn't seem to work, the variable change back to it's original state, I have read that variables that are not mark as "ReadOnly" doesn't get copied, but that have no sense, how can I transfer the variables of a player state trought levels then?
we use copy properties fine
only works with seamless travel, and seamless travel does not work in PIE
Yes, I have seamless travel activated and I pack the project to test
But the thing is that only happen in the clients, in the server the variables are copied fine
that doesn't sound right
Other thing is that I'm doing this to select the Skin of each characters in the function "GetDefaultPawnClass", maybe the problem is that the player state don't have the data copied jet in that moment?
our game would break if that happened
Good morning. I'm trying to determine when a yet-unpossessed pawn's BeginPlay is running on the listen server in Blueprints. I've determined the following information about role:
Server
Server: Authority / SimulatedProxy
Client1: Authority / SimulatedProxy
Client2: Authority / SimulatedProxyClient1
Server: SimulatedProxy / Authority
Client1: AutonomousProxy / Authority
Client2: SimulatedProxy / Authority
Unfortunately for me, it looks like all pawns have the same local and remote authority during their BeginPlay on the server.
Does anyone know how I might single out the listen server's own pawn running BeginPlay on the server?
islocallycontrolled
actually not in beginplay
because it's not posessed yet
beginplay happens after it's been spawned, but before it's been possessed.
Thanks. For those who find this helpful. Here's the solution I came up with that works for me.
Pourquoi?
what is the "Actor" here?
A pawn that has not yet been possessed.
Because I want to run a function on only the client or listen server that is going to control that pawn.
right, but clients won't have a controller, nor is it reliable to check ROLE_AutonomousProxy before possession
and this will return Local for Simulated pawns also
ah nvm
cast failed goes to remote pin
but even so
Sorry about the bubble. ๐
So why is it a bad idea to get local role on an actor? It's worked so far for me although I haven't tested it too hard.
i mean if it works it works, but ROLE_Autonomous is not reliable before possession
and casting to a controller on begin play
which may or may not exist
So I should keep my eyes on that role check for the day it screws up?
quick quesiton guys, what is the proper way to "kill" an actor on a client? Currently I have server calling Destroy() on replicated actor, but to avoid lag rep issues I am hiding the actor on client side at same time. Anything else I should do? Such as mark actor on client side as "pendingKill" or something?
For use case example, this is a projectile I'm killing on overlap
Mjolnir, that's how I handle it.
@waxen socket ๐
i just hide the visible stuff
with a bindable event
it deletes on it's own
or returns to pool, if it's a pooled thing
for non-predicted projectiles, i just do the hide part only, cuz it will be destroyed once the server says so (i delay the destroy on server side with a lifespan, so it gives the replicated thing time to do stuff)
like spawn client-side effects, etc.
if a client calls a Server RPC, and this RPC then calls a normal c++ function. that would get called on the server aswell right?
Just wondering, does anyone here know how to search for dedicated servers using the SteamOnlineSubsystem?
I haven't been able to get any results with the regular IOnlineSession::FindSessions(). I have also been completely unable to find anything online about it
Seems like most people have a problem with hosting a dedicated server but not a single question on how to actually find em. In order to test some UI stuff I just wanted to return all dedicated servers found for appID:346110 (I have set this appID in the Engine configs cause I figured that FindSessions pulls the appID from there in order to know where to look for servers)
@twilit oak Yeah, your execution flow won't switch machines without you telling it to do so.
yep, makes sence. i got paranoid becouse of some bugs. ty
Ok folks, I'm super stumped. Has anyone else ever implemented a custom UNetDriver/UNetConnection?
I have it 99% working, packets and everything are being sent between clients, but for some reason when clients connect the server just keeps replicating their player controller and pawn to the clients.
Over and over and over again, and it makes weird flickering, and I can not for the life of me figure out why UE keeps replicating the player controller over.
(and by replicating it over I mean, the client thinks it's not net relevant, and every time it spawns a new one it increments)
Has anyone seen this kind of behaviour?
I've been digging through the net driver, net connection, replication code to find anything that might indicate why this is happening
I've compared my implementation with the Steam sockets net driver/net connection and it all does the same thing
The closest I've been able to get to is whenever the server goes and runs UNetDriver::ServerReplicateActors_ProcessPrioritizedActors, it doesn't seem to have a channel for the actors
so it goes and creates a new channel
but as to why it's not keeping track of channels I have no idea
especially since my net driver/net connection don't do anything with them
if a client calls a Server RPC, and this RPC then calls a normal c++ function. that would get called on the server aswell right?
@twilit oak if a client calls a sever rpc, only the server runs it.
The entire execution path starting from your (Server) _Implementation function will be executed only on the server. This includes all function calls and variable edits regardless of if they are replicated or whatever
FYI folks the answer was config
I needed to add the following config to DefaultEngine.ini:
[/Script/OnlineSubsystemEOS.EOSNetDriver]
NetConnectionClassName="/Script/OnlineSubsystemEOS.EOSNetConnection"
ConnectionTimeout=80.0
InitialConnectTimeout=120.0
NetServerMaxTickRate=30
MaxNetTickRate=120
KeepAliveTime=0.2
MaxClientRate=15000
MaxInternetClientRate=10000
RelevantTimeout=5.0
SpawnPrioritySeconds=1.0
ServerTravelPause=4.0
if you don't set that RelevantTimeout is 0.0, which means actors and other things become irrelevant instantly
coding in C++ here, does AttachToComponent() replicate? I think I'm missing something somewhere since it attaches on server but not on client
I'm 90% the answer is yes, so I'm still digging around to figure out what I'm missing that would cause this behavior, brb folks
Sup all, me again with the same null pointer issue. I describe the issue in much greater detail in the linked issue. If anyone has experience with the ALS C++ library or/and the Advanced Jigsaw Inventory I would greatly appreciate it if you took a look. ๐ https://github.com/dyanikoglu/ALSV4_CPP/issues/42
@lilac bear I believe that to replicate the component, there should be a bool way to set that (i do BP so idk the ue4 implementation for cpp), but if you are spawning and then attaching, make sure each client is calling the spawn, or the server is calling it for each client. In other words, make sure that it isn't something just happening on the server
@dull flame that does seem to be the case here as I am only calling the attachtocomponent() via a server function, but wasnโt sure if it was proper to call this same function on client if it is already a replicated function
Guys, I'm trying to move object on client by navmesh. But nav mesh seems to be available on server-side only. Is it possible to make FindPath() work on client as well?
@lilac bear if youre calling it on the server then it will only execute on the server, and no clients. if you want to condense it a bit and leave the logic on your server, you could call it as a multicast function, which calls it on the server and on the client. Again, idk how to in cpp tho
@dull flame No worries, if you have to do it in BP then Iโm sure cpp will be the same. Iโll give it a shot ๐
Attachment replicated
replicates*
calling on the server will replicate that attachment to all clients automatically, as long as both replicate
@meager spade that is what I thought I read, but it doesn't seem to be behaving that way despite both actors (in the child BP class) being set to replicate. Can you direct me to how to verify this sort of thing myself in the base UE4 engine? I'm starting to wonder if I'm overriding some replication value like a doofus
How do i do the the launcher for my game? (is not a completed game, want to try the multiplayer)
@meager spade thanks yet again! (3 times now)
struct FRepAttachment AttachmentReplication;```
i mean this has to be done on the actor that IS attached
so that has to replicated, and replicate to everyone
@sand tusk are you looking to package the build (so you can run from an exe out of the editor)? Do you have a menu built in or looking to just use a console command outside the editor to do the basic multiplayer test? There are some good tutorials covering some of that out there that I could point you to ๐
@sand tusk are you looking to package the build (so you can run from an exe out of the editor)? Do you have a menu built in or looking to just use a console command outside the editor to do the basic multiplayer test? There are some good tutorials covering some of that out there that I could point you to ๐
@lilac bear Just basic multiplayer test
tbh tried to look on yt
but idk how to search, looked for "unreal engine 4 create launcher for game" but nothing showed up
when you package, it will create all the files
@meager spade yep, in this case it is a pawn "spaceship" who has an 'inventory' actorcomponent that is 'equipping' an actor 'item', both item and spaceship are replicated
you just run the resulting exe
@lilac bear i have no idea then, cause i have yet to see my weapons never get attached
@meager spade yep, I think I goofed something and just have to track it down ๐
i just set the attachment on local client and server
(cause all weapon swaps are client lead, for responsiveness)
this is it? the launcher
I believe it is this:
- click dropdown next to launch
- select what device you want to build for (my windows pc in my case)
- click launch
Edit: (this is just for building to test in a separate window/process, not for sharing with someone else)
been loooong time since I've done it but hopefully my memory is still good
then i can send it to someone?
file -> package project -> <platform>
ah thanks omega >_<
also works, as long as you don't need any custom build behaviour
full disclosure here, last time I was messing (as a hobby) with UE4 it was during the 4.9 days ๐
Figured I would ask again! Anyone know how to actually find steam dedicated servers of a given appID using FindSession?
After i package the project if someone come online, and i'm online too, we'll see eachother?
that depends on your subsystem setup
would not be like that by default
you need sessions, a OSS (null is fine for LAN), like Steam or EOS
@rich cradle in the search, don't search presense.
dedicated servers aren't presence.
that reminds me, i need to figure out a way to search both.
@gleaming niche
SessionSearch->bIsLanQuery = false;
SessionSearch->MaxSearchResults = 100;
SessionSearch->TimeoutInSeconds = 5.f;
SessionInterface->FindSessions(0, SessionSearch.ToSharedRef());
You mean at another line like this?
SessionSearch->QuerySettings.Set(SEARCH_PRESENCE, false, EOnlineComparisonOp::Equals);
because I have tried that and it makes no difference
I dont even understand what sessionsearch is searching for. Is it using the APPID set in the EngineConfig.ini file?
I tried launching the game in standalone with steam to get the subsysetm attached, then attaching the debugger and stepping through the FindSession function but I couldnt find anything useful
GameSession->FindSessions(PlayerOwner->GetPreferredUniqueNetId().GetUniqueNetId(), NAME_GameSession, bLANMatch, !bSearchDedicated);
* Find an online session
*
* @param UserId user that initiated the request
* @param SessionName name of session this search will generate
* @param bIsLAN are we searching LAN matches
* @param bIsPresence are we searching presence sessions
*/
void FindSessions(TSharedPtr<const FUniqueNetId> UserId, FName SessionName, bool bIsLAN, bool bSearchCustom);```
i think i renamed it in mine, but
CurrentSessionParams.bIsPresence = bSearchCustom;
so when searching for DS, bIsPresence should be false
as DS should never create a presense session (and will usually crash at startup if it does)
in the staem plugin
well thats for if you host a session
I am just trying to get FindSession to return all dedicated server for a given appID
I am trying to get the same results you can see when you go into steam and just open the global server browser
you want to search different appid?
Well what appID is findSession searching for?
I assume the one set in EngineConfig.ini?
the one your game is using
and either steam_appid.txt or whatever is passed when launching from steam
oh thats new
anyway, what i said was the case. witht he defaulkt OSS plugin the only way I could see both DS, and listen servers, was to just make two lists
one searches presense, the other doesn't
the ds's show up in the non-presense list, and listenservers are in the presense list.
so you would call FindSession twice with different parameters?
for now, i eventually would like to figure out how to search both
and then filter myself
yeah, well i do it with tabbed window
Where did you read about the steam_appID.txt?
the tabs on the top switch the list, and then teh serach happens independently
uhm, documentation + steam
huh, doc mentions that the file is created on program start and deleted on program shutdown
so no wonder i have never seen it
there's the option for restartin steam or whatever it's called, so if it's launched outside it will relaunch
i believe that's the one that will create it
when actually launched from steam, it sets an environment ariable too
I have just been starting from within the editor using the "Standalone" option
ah i guess editor is craeting it
i never do it that way. i probably should.
i always just run my build script and auto-publish to beta branch, so i can test with two machines lol
hmm running ultrasearch there doesnt seem to be a steam_appid.txt created when running from the editor
i have a vehicle actor and a weapon actor. The vehicle spawns the weapon during roleAuth post initializeComponents.
the weapon is designed in a way where it looks for sockets on its mesh named Barrel to shoot from. This way FireWeapon() can fire 4 projectiles (4 sockets) with just one actor. If there is no weapon mesh then it finds Barrel sockets on its owner.
there lies the problem. sometimes for client weapon is replicated BEFORE vehicle. now weapon cant find barrel socket on owner, cause owner does not exist yet!
what can i do ?
yet the steamonlinesubsystem works anyways
a looooooong time ago, i used to do it from editor
and i had to make a steam_appid.txt and put it in project folder somewhere
to make steam work there, but then i stopped doing that entirely once i established my build scripts
well ultrasearch found a bunch of those steamappid txt files in all the folders where I have steam games installed
so I am pretty sure thats just something steam itself needs when distributing builds
when something is not launched from steam
it needs steam_appid.txt for SteamAPIInit
right
The Steam client couldn't determine the App ID of game. If you're running your application from the executable or debugger directly then you must have a steam_appid.txt in your game directory next to the executable, with your app ID in it and nothing else. Steam will look for this file in the current working directory. If you are running your executable from a different directory you may need to relocate the steam_appid.txt file.```
jop, but my issue is on the unreal site
unreal is using steamapi, and linking with it. therefore, it applies
infact, my actual dedicated server, running from steamcmd, also needs teh steam_appid.txt so the DS can even create a session
wel, it creates it.
but it doesn't work without it.
I was using UWorks before (bp steam api wrapper) and its find server function would take an APPID and then just return all servers it finds
yeah, so you can actually do that too
if you want to work with teh steamapi directly
just add SteamShared to build.cs
and then you can do the thirdparty includes, and run steam functions directly
I feel as though going down that route would be disastrous because then I would have to probably make my own implementation and ue's session stuff work together
well as i said, I use teh OSS as is
and for me, my only way to See DS, is to jsut set bPresense to false.
and then they always show up.
you mean when creating a server
no.
finding.
well yeah wehn creating too, you don't use presense.
if (GameSession->HostDedicatedSession(MapName)) //my function:
bool ACSGameSession::HostDedicatedSession(const FString& MapName)
{
IOnlineSubsystem* const OnlineSub = IOnlineSubsystem::Get();
if (OnlineSub)
{
IOnlineSessionPtr Sessions = OnlineSub->GetSessionInterface();
if (Sessions.IsValid())
{
HostSettings = MakeShareable(new FCSOnlineSessionSettings(false, false, MaxPlayers));
HostSettings->bAllowJoinViaPresence = false;
HostSettings->bIsDedicated = true;
HostSettings->bShouldAdvertise = true;
HostSettings->bAllowJoinInProgress = true;
OnCreateSessionCompleteDelegateHandle = Sessions->AddOnCreateSessionCompleteDelegate_Handle(OnCreateSessionCompleteDelegate);
Sessions->CreateSession(0, CurrentSessionParams.SessionName, *HostSettings);
return true;
}
}
return false;
}```
and then the search, to find DS is just
CurrentSessionParams.bIsLan = bIsLan;
CurrentSessionParams.bIsPresence = bSearchCustom; //if true, find listenservbers, false, find ds
CurrentSessionParams.UserId = UserId;
IOnlineSessionPtr Sessions = OnlineSub->GetSessionInterface();
if (Sessions.IsValid() && CurrentSessionParams.UserId.IsValid())
{
SearchSettings = MakeShareable(new FCSOnlineSearchSettings(bIsLan, bSearchCustom));
if (bSearchCustom)
SearchSettings->QuerySettings.Set(SEARCH_KEYWORDS, CustomMatchKeyword, EOnlineComparisonOp::Equals);
TSharedRef<FOnlineSessionSearch> SearchSettingsRef = SearchSettings.ToSharedRef();
OnFindSessionsCompleteDelegateHandle = Sessions->AddOnFindSessionsCompleteDelegate_Handle(OnFindSessionsCompleteDelegate);
Sessions->FindSessions(*CurrentSessionParams.UserId, SearchSettingsRef);
}```
what type is CurrentSessionparams?
FCSGameSessionParams CurrentSessionParams;
{
FName SessionName;
bool bIsLan;
bool bIsPresence;
//Id of the player creating the lobby
TSharedPtr<const FUniqueNetId> UserId;
int32 BestSessionIdx;
FCSGameSessionParams() : SessionName(NAME_None),
bIsLan(false),
bIsPresence(false),
BestSessionIdx(0)
{
}
};
actually you don't even need that.
SearchSettings = MakeShareable(new FCSOnlineSearchSettings(bIsLan, bSearchCustom));
that struct
which
is a child of FOnlineSessionSearch
Ah okay
don't really even need it, i used to have custom crap in it.
I just use the base FOnlineSessionSearch
strange if you just use the base one
it should find dedicated automatically
it shouldn't even search presense.
and the base one has this in its constructor
FOnlineSessionSearch()
: SearchState(EOnlineAsyncTaskState::NotStarted)
, MaxSearchResults(1)
, bIsLanQuery(false)
, PingBucketSize(0)
, PlatformHash(0)
, TimeoutInSeconds(0.0f)
{
QuerySettings.Set(SETTING_MAPNAME, FString(), EOnlineComparisonOp::Equals);
QuerySettings.Set(SEARCH_DEDICATED_ONLY, false, EOnlineComparisonOp::Equals);
QuerySettings.Set(SEARCH_EMPTY_SERVERS_ONLY, false, EOnlineComparisonOp::Equals);
QuerySettings.Set(SEARCH_SECURE_SERVERS_ONLY, false, EOnlineComparisonOp::Equals);
}```
yeah that's what im saying
it should find dedicated
because you need QuerySettings.Set(SEARCH_PRESENCE, true, EOnlineComparisonOp::Equals); to search for the listen/presence ones
yeah and I dont have that
SessionSearch->QuerySettings.Set(SEARCH_PRESENCE, false, EOnlineComparisonOp::Equals); I also added this line just incase
is the dedicated server ACTUALLY connecting?
and creating it's session, for reals?
I am not creating sessions
then you won't see it.
it won't show up
since it won't register with the steam master server.
unless it creates a session, witht he steam serverapi
I am literally just trying to have FindSession return the thing as the regular steam server browser
if you want that, then you need to use steamapi directly
so if I were to change my appID to whatever appID "Squad" used for example I would want FindSession to return me eaxctly this information
there's two types of servers.
OSS creates steam lobbies.
and then there's the old school stuff that steam is based on
like goldsrc/source
and quake, with the master server
OSS only finds sessions (steam lobbies in the case of steam)
if that other app, is not creating lobbies, even if you use it's appid, you won't find anything
with OSS.
oof
random useless info: lobbies/matchframework was originally created for l4d
I really dont want or need automatching for my game. I would like a simple server browser that lists all dedicated servers the master server knows about and then join those directly
if you're using OSS, then you need to make the DS create a session
the normal way, is to implement that stuff that i pasted
and just place is in:
AYourGameSession::RegisterServer()
dedicated server will automatically call that
from GameModeBase
well, I havent gotten to any other steam part yet
I have literally just enabled OSS and my first step was to have my server browser be populated with some popular game to see if it works
Right, except that I dont even want lobbies so I suppose I now have to do the steam stuff myself
you can use lobbies without actually "using lobbies"
just use the sessions
which creates the lobby in the backend, and then people can just join
they just "join the session" in "unreal language"
Well I tried Ark and Squad (both ue4 games) and I couldnt get anything from either so I just assumed it didnt work at all
the other benefit is that you also have steam networking
if they are showing up in the server browser in steam
they aren't using lobbies.
so OSS won't find them
cuz as i said, OSS does sessions
so those g ames must not be using OSS
well then I wont be using OSS either, as painful as thats going to be
out of curiousity what is your aversion to it?
you just want people to be able to use the external server browser only? instead of just finding ingame?
Nah, I just like things simple, even if its more complicated
well i would say using sessions that is already built in is the most simple, since it works haha
True. I dunno, I just deeply despise over complicated things.
I like things that are just stupid and as straightforward as possible
yeah, and that's what im saying, the OSS way is "stupid and straightforward" if you want to dig into the steam api itself, it's way more complicated, totally doable, but a lot more complicated.
Dedicated server informs master server that it exists. Client pings master server and gets all servers. <- That to me seems like the most straightforward simple implementation of the entire thing
you can for the most part just copy and paste from spacewar
so you have to implement everything
like the steam tokens
and your own method of restarting the engine when launched outside, etc.
oh god...I vaguely remember steam token stuff...fuuuuck
steam sockets?
yeah teh steam networking stuff, that does NAT punch, or relay
and p2p for listen servers
ahh..well my game is dedicated servers only so I guess that wouldnt be relevant. But the fact that I didnt know about does not bode well if I were to implement the steam stuff myself
so I guess...fuck it
session it is
even if it aint EXCATLY what I want
take a look at shootergame, it's the simplest to follow
hell you can copy and paste all the session stuff from shootergame, and just rename it and change the _API
and it will work instantly
that's what i originally did 3 years ago
alright, I can take a look at that at some point. Thanks for the info
Anyone who can help me :)?
ask away
I want to understand how i can use FURL to connect to servers using FBlueprintSessionResult
I see that FURL has port.address is that the right one to use?
yeah.
theres plenty of tutorials for that ou there, ive never used sessions so i cant help
hmm yeah. I've seen alot.
What i am trying to do is get players to connect to a server from a searchresult
cant u just link that result to a connect to session node?
and connect that way?
or join session, i dont remember the name of the node
In blueprints yeah.
but i want to do this in c++
FBlueprintSessionResult& SearchResult
is the one i used to get my results for async node.
if you want to do it in C++ you aren't using FBlueprintSessionResult
{
bool bResult = false;
IOnlineSubsystem* OnlineSub = IOnlineSubsystem::Get();
if (OnlineSub)
{
IOnlineSessionPtr Sessions = OnlineSub->GetSessionInterface();
if (Sessions.IsValid() && UserId.IsValid())
{
OnJoinSessionCompleteDelegateHandle = Sessions->AddOnJoinSessionCompleteDelegate_Handle(OnJoinSessionCompleteDelegate);
bResult = Sessions->JoinSession(*UserId, InSessionName, SearchResult);
}
}
return bResult;
}
well that makes sense...
that above probably helps haha
Thank you.
with a session?
say for example i want to connect to a server and join blue team and not red
no sessions
im trying to figure out team sorting with matchmaking
currently im just doing "open ip:port
just add the option to the url
i've never used open. but i think it's just like open ip:port?option=whatever
and in gamemode ::Login()
you can parse the paramaters
APlayerController* ACSGameModeBase::Login(UPlayer* NewPlayer, ENetRole InRemoteRole, const FString& Portal, const FString& Options, const FUniqueNetIdRepl& UniqueId, FString& ErrorMessage)
{
APlayerController* NewPC = Super::Login(NewPlayer, InRemoteRole, Portal, Options, UniqueId, ErrorMessage);
UE_LOG(LogCSGame, Log, TEXT("ACSGameModeBase::Login: Options: %s"), *Options);
return NewPC;
}```
well now that i think about it i could pass the parameter to the game instance and just use it inside the server?
that would only work for the host
- gamemode only exists on the server
- every instance of the engine has one gameinstance
- server won't know other clients gameinstance
so the join params are handled in "login"?
some of them yes. depends on which onlinesystem is used
like there is a "hello" that happens elsewhere
i just want some thing simply like , a bool that specifies if the player is in team A or B
again, i dunno about using "open" as i never have, but
something like
APlayerController* PC = UGameplayStatics::GetPlayerController(GetWorld(), ControllerId);
if (PC)
{
FString URL = FString::Printf(TEXT("%s:%i?Team=%i", *IP, port, teamid);
PC->ClientTravel(URL, TRAVEL_Absolute);
return true;
}```
the "options" in gamemode::Login(
Okay so i need a bit of c++ logic explained to me.
will have "?Team=x"
and then you can use int32 requestedteam = UGameplayStatics::ParseIntOption(Options, TEXT("Team"));
and then make the new playercontroller join it
in the joinsessioncallbackproxy.cpp you have two functions activate() and oncompleted. within activate() there is a commment "oncompleted will get called nothing more to do now" but i am missing when it is called within activate. So how does it get called?
how are url parameters specified? i can just write whatever and they will accept it?
the server''
i know, because i just made it up
as an example
it's just a string
there's only specific options that are "built in"
but dont u need to declare it anywhere? will the server just take "team" the same way it would take "auhduadhau" for example?
like ?Game=gamemodewhatever
uhm that's what the GetIntOption / ParseOption functions are for
to just read the string
looking for the option format.
you can make anything an option, and just use those fucntions to look for it.
ok, it makes sense now
kinda like commandline switches, where you just check if they exist
do u happen to know the syntax for multiple options?
?Game=game?Team=1?Potato=Chips?NoParamaterOption?NoOtherOption
if it's something that you aren't passing a value
you can just use HasOption(TEXT("NoParameterOption"))
or something like that
let me look haha
yeah
static bool HasOption( FString Options, const FString& InKey );
look at gameplaystatics.h (UGameplayStatics)
thanks mate
will get on this as soon as i finish matchmaking with playfab
other thing, all those custom options are parsed in the login right?
by you.
you have to parse for them
the different subsystems will parse for different things, some things are automatically added
like the steam one, which actually adds to the string differently
it does like steamid: xxxxx steamsomethingiforget: xxxxx
//sever side
[2020.08.13-10.52.34:090][509]LogNet: Login request: ?Name=omega userId: Steam:omega [0x2F6E02DF500] platform: Steam
[2020.08.13-10.52.34:394][524]LogCSGame: ACSGameModeBase::Login: Options: ?Name=omega?SplitscreenCount=1```
im not using steam for servers so i shouldnt have to worry about that i think
fromt he log, the steam stuff is stripped off before it gets to gamemode
so that's fine either way
the extra stuff rather.
only the ?xxx options remain
but as you said, you're not using it, so it doesn't matter either way
@twin juniper
Well its binding the delegate so that it gets called when the async comes through.
Is there a way to spawn actors server and client side and have them "link up" or should I just spawn like 1200 tile actors set as replicated and let them replicate out?
I suppose I could just replicate the abstract tile representation instead and run the same logic both sides on OnRep
override IsNameStableForNetworking to return true and give them the exact same names on server and client
there may be more minor things you need to do to make it work
of course if you can do without them being replicated at all then it's even better (but that means you can not call rpcs or send references to them)
@dark edge we did a lot of trickery
but we have clients and server produce the same map from seed
then we only replicate stuff (like lockers, doors, etc) via a fast array and a network manager for that zone
as they have states which can be handled via a fast array
@meager spade We'll be having a static tile map with dynamic actors on it, maybe just spawn map on either side and replicate dynamic actors will work
that will work, but we generated an entire level from a empty level
so we couldn't just use replicated actors
ya same here, I'm guessing 1-2k static actors and maybe 200 dynamic ones
yeah we are close to 30K static, and around 3-4k replicated
we have a observer pawn in the sky
which is on a spring arm
seperated from the plaayer
we interp it to the players position to keep it smooth
but also gives it a non-stuck feel
@dark edge so basically i have this mod for a MP game that makes it so when you go up high a space sphere fades in and it looks like you went out to space
but problem is when one player does it players on the ground also see the sphere spawn in
that's what im trying to fix
@rough jolt Just don't replicate the variable that controls the fade
On each machine, the sphere should fade based on the height of the local player only
i, sadly and having picked up this program 4 days ago, do not know how to do that, this is my code (fade is the selected block, although there's also visibility that would also need to be individual to each player) could you guide me on how to do this?
Check if Other Actor is equal to Get Player Character
I'm assuming it's the Player Character that's triggering the fade
yeah
Also why are you enabling input?
players are what triggers the fade, problem comes in MP, from what i've checked leaving a vehicle floating and going down doesnt trigger the space
also what imput?
the tutorial i did for that fade told me to, it sounds dumb but thats the truth
like i said- still learning, as you can probably tell i barely know what im doing
It is dumb unless you intend to have player keypresses do things on the spacebox directly
You'll also get a lot less spaghet by just dragging in a node for your variables each time you use them instead of linking them all to the same node
you can just copy paste that tatooine reference for example
yeah, that's good advice although i'm afraid to touch it right now, but i'll do that for future codes!
so any idea of how i could fix my multiplayer problem?
It's a lot more readable like this
I already told you, on the overlap check if other actor = player character
like that
That's assuming get player character references your actual pawn, should unless you're doing something a bit wacky
There's also "Get Player Pawn" which is more generic
sorry for another question but how's that equal called exactly?
there's many
nvm found it
i'll test and see how it goes
@dark edge It doesnt work, the sky doesnt fade in at all now, this is my current code
i tried both with character and with pawn
is there any way i can just make every player have one of these actors assigned to them? if i could do that there'd be no need for this
its the only idea i can come up with
@rough jolt print other actor on overlap and see what it is
also print player pawn at the same time and show what they are
would that work in-game @dark edge ? because the player actor is only in-game, i dont have access to those objects from UE4, this is a mod
idk if i can print a string in-game
like the only way i have of testing the overlap with the actual actors is cooking, putting it in the game and testing there
would print show something in-game?
This should be the most robust way to get whatever the player is controlling, try it.
i shall try it in a sec, testing an alternate method, shouldnt take long
you didnt answer what i asked tho @dark edge is it possible to print in-game? even if the game doesnt have a console? i assume no
I dunno, just try it. Never made a mod.
ya im on it, getting people to test with is hard since nobody seems to be able to "copy this folder here", i dont know how but they keep getting it wrong and i'm dying a little
didnt work
space box didnt show up
i have a sneaking suspicion the player actor might be set to not cause overlap events @dark edge
any good alternatives to an overlap again to know if the specific player is in the space area? like a z coordinate or something?
You can try to get the character and check it's position on a timer or even tick if you want.
you gotta be careful tho if the character gets destroyed/recreated like when it dies or whatever
also question, wouldnt there be a way to avoid all this by spawning this actor individually for each client but having only that client see it?
like the skybox is an actor
couldnt each client just have one? thats what i wanted to do originally but i couldnt find how to by googling
How is it being spawned? Each client only has one already
it's just that its fading whenever anything triggers the overlap, even other players
so what exactly is triggering the overlap if not the character then?
something is, i have the space trigger set so any overlap can trigger it... which might not be the best anyway. but there isnt supposed to be anything up there unless you purposefully fly up so i get away with it
quick and dirty implementation would be to get the pawn on a timer and check it's location, try that
so something like on tick if (player code from before) is above this z coordinate > rest of space code?
sounds like it could work
tick would be overkill but it'd work if the get is working
just change the tick interval to like 0.1 or something
i actually have other functions on tick and somehow the game performs constant 60fps, idk what code the game has to not die, but hey if it works
i realized an issue tho aah
if it checks for the player's position every moment, and if its true the sky fades in, wouldnt it be constantly fading in- nvm i can actually change it from play from start to just "play"
so this is what i have (to the right its connected to the previous code)
@rough jolt You can remove the timeline and just map player elevation to sky fade
map range float
good idea but i dont want there to be a middle ground between space and ground since there's also a planet and a semi-transparent planet would be weird
What is the best data structure to network a lot of data through unreal ? TArray<uint8> ?
I'm asking because I have inherited structs that I need to network without knowing the type, so changing them to raw data would make that possible without loosing anything.
That would start fade in at 1,000 and be fully visible at 1500
change to whatever numbers you would want
@dark edge after extensive testing and lots of confusion it turns out it... only works for the host? somehow? like we'd spawn right next to each other and i'd have space and not him, its weird
and with that i have to go to bed but if you have any ideas i could try leave them here and i'll see them tomorrow
Folks if anyone needs to implement their own UNetDriver/UNetConnection or sockets (i.e. if you want use some kind of P2P transport library), I wrote up a guide on all the "gotchas" you will run into https://gitlab.com/redpointgames/custom-unetdriver-docs
Not sure how useful it is to people here since it's a pretty niche thing to need to do, but hopefully it helps someone so they don't have to spend the 3 days of "things silently don't work right" that I've just gone through
Hi, so is it common that replicate movement on a simple actors laggs on the client? (while CMC not)
Yop
I read that as yes:), so any idea where to start of replicating myself?
i suppose i need to do client side prediction and interpolate?
Yeah, learn what you are actually dealing with and what common solutions are. Then implement them.
Yes
And no
It depends on what you are doing.
i was not really able to find any good examples when google
If it's just a replicated actor, then Interpolation would be enough I guess.
Prediction is only needed if the Actor is moved via Player Input
basically im just setting a actor location on server, client needs to replicate it
right, okay
Yeah, by default that also happens
But it just sets the Location to the new one
If there is a longer time (higher ping) or even a lost package, then it becomes very choppy
So you have to learn how to interpolate based on distance, ping, etc.
Also nothing i would really tackle in Blueprints
Misclicked
Etc.
Live Demo that shows your problems in 2D and what each of the functionalities actually resolve https://www.gabrielgambetta.com/client-side-prediction-live-demo.html
nice, thanks
Good morning. Is it common when implementing slow-moving projectiles in multiplayer to spawn the projectile separately on each client and only check for overlaps on the server?
Does the options string of a game persist through seamless travel?
Say map 1 is traveled to with an options string, then all players travel to map 2 later, will the same options string be available when map 2 opens?
I guess the game mode and all of its properties persists through seamless travel?
Hi guys, I've tried steam advancedsessions multiple times and it hasn't worked, even though I followed the instructions to a tee. Are there any other ways I could go about incorporating multiplayer into my game?
Networking noob here. What is the method/practice I should be using for replicated function calls that require a set order/sequence to be called in? For example, function A must be called before B, and B before C, etc. Not sure what the proper word/term is for this sort of networking practice (to avoid lag/state issues between server and client).
@waxen socket I would suspect you'd still want to keep things looking responsive by performing some form of visual feedback to the client on overlap (which would require some form of tracking on clients still). But probably depends on your use case as to how necessary this is. But in general, I'm probably too inexperienced to answer your question as to how common that would be. :S
When it overlaps, couldn't I use the position of the overlap on the server to spawn the effects?
yep, but the worse lag gets the more disconnect you will have in that effect with the clients
I see. Hm...
Do you think the approach is preferable to actually replicating the projectile?
it is more work to do, but as for the long-term approach for performance/code-maintenance/etc I can't say how necessary ๐
@lilac bear Any reason that you cant call function B from the end of A?
so my thought here is if I have a chain of calls, can I be sure that UE4 will execute those replications in the same order? And another example would be if I have a player who picks up an object then drops it quickly (two player triggered actions) and I get some sort of weird lag spike just as the pickup occurs, can I be sure the pickup will happen before the drop?
it may be too soon in my networking journey to worry about these situations but I'm trying to pickup good practices from the start
Replication != RPC
Replication is server to client, does not maintain any order or guarantee anything except the eventual replication of a value
Reliable RPCs guarantee order
Unreliable RPCs do not
Oh, here comes Stranger to set us all straight. ๐ฟ
whoop whoop, I like being set straight, thanks Stranger ๐
so obviously making everything reliable isn't a great practice either, sounds like I just need to be very congnizent of what i'm doing in my RPCs. I'll keep this in mind as I continue to work
most non crucial stuff should be Unreliable
(like effects, etc)
reliable things are like telling the server you are interacting
all client movement is unreliable RPC's
makes sense ๐
you really don't want to fill that reliable buffer up
most things a client directly caused should be reliable to himself
imagine the confusion if you interact and the effect doesn't play on your side
i am on about things like explosions, etc, unless they cause massive gameplay changes, they can be unreliable
yeah but hey, ๐
mostly all my effects are done via Gameplay Cues
which are Unreliable Multicasts
it's less of an issue if you have client prediction that will play the effect regardless
hmm... @meager spade "Gameplay Cues"? Is this a term/practice or a system/functionality in UE4 I'm unaware of or haven't tapped?
its part of Gameplay Ability System in UE4
hmm, don't remember that, perhaps post UE4 4.9
its been about before then
not sure if it was released th
but it has at least been in the engine since 2015
ah probably too new for it to come across my radar, I let you pros figure stuff out and document well before diving in lol ๐
on the topic of the reliable buffer, I'm still needing a good link to network debugging/monitoring in UE4. But it's not high on my priority list yet since I'm not seeing any slowdown/lag just yet. However, I do suspect that my usage of creating/destroying actors is probably excessive
#gameplay-ability-system there is a pinned doc on it ๐
Hi, so i was trying to solve my simple actor replication, as suggest trying to implement interpolation to solve the jitter on client
but well, it wont solve the jitter, atleast
you'd need to interpolate in tick
so it happens every frame and smooths out the sparse updates
yep, so note i call this function in tick
the Location input is the actor location from the server
its a multicast function
what
like that:)
that makes no sense
you want to be interpolating it locally
there's some plugin "smooth sync" on the marketplace that claims it does this properly for you
you should space out the rpc's, then interping from current to new position, then possibly keep interping till you get the next update (a bit of prediction)
I've never used it myself, but it was free at some point
that RPC should only be a vector
so if you have that maybe look at it
@meager spade how to interp without delta time?
locally in tick
@fleet raven i dont have it, but i saw it somewhere today
@meager spade u mean i should not use a multicast at all? and write it in the tick?
you need to multicast, but just the new position
store in a property, then tick can interp to it
Right, yeah!
i see
so that is a fix for sure heh ๐
@fleet raven kinda like to implement it my own before checking out the plugin though
but thanks for mention for sure ๐
@meager spade I was wondering if you could provide some insight to a question you helped answer last sunday about sending player input through the CMC. I set up a Server RPC through my Character class but not surprisingly ig its laggy and clearly very wrong lol. The player input vector I'm sending which is used in my physfunction needs to be saved into savedmove right? Do I need to override ReplicateMoveToServer() and ServerMove() to send and unpack the data as well?
Anyone know how to fix this error from the Server Log?
[2020.08.16-12.07.14:340][ 0]LogLinker: Warning: Unable to load package (../../../../UE_8-7-20/Engine/Content/Animation/DefaultAnimCurveCompressionSettings.uasset). Package contains EditorOnly data which is not supported by the current build.
This asset is referenced by every animation as a curve compression setting. I tried duplicating it and referencing the duplicate but I got the same error.
The error is [2020.08.16-12.08.14:343][ 0]LogWindows: Error: Assertion failed: !GEventDrivenLoaderEnabled || LoadPhase > ELoadPhase::WaitingForHeader [File:D:/UE_8-7-20/Engine/Source/Runtime/CoreUObject/Private/Serialization/AsyncLoading.cpp] [Line: 7284]
So, ive tried @meager spade 's suggestion to lerp in tick, still its jittering
thats the multi cast function
and the call inside tick
the tick is run for authority only
eh
your supposed to interp the clients
not SetActorLocation on the multicast
{
Super::Tick(DeltaTime);
if (HasAuthority())
{
InterpVector = SomeVector;
MulticastReplicateMovement(InterpVector);
}
SetActorLocation(FMath::VInterpTo(GetActorLocation(), InterpVector, DeltaTime, 5.f));
}
void AKaosPawn::MulticastReplicateMovement_Implementation(const FVector& Location)
{
if (!HasAuthority())
{
InterpVector = Location;
}
}```
๐คท
the second image is within the tick, btw
Ace code @meager spade
thanks ๐
so, i really need to blog some stuff, i mean, first off i cant find shit on google, second the unreal docs are offline
@meager spade so why did epic not implemented interpolation to replicate movement btw?
they did in CMC
but ReplicateMovement tick box literally just replicates the position
you need to handle smoothing yourself
its just the way they did it i suppose
yeah, i dont really mind that much though, but might be a cool addition
the CMC is pretty much a cool example though, but cant use it for my ai
why?
need to be able to do pathfinding for like 500 to 3000 AI ๐
actually just using the NavigationSystem and get a path in c++, then i use it on my cheapy actors
but its not really multiplayer related though
i have around 140 ai
and just moving them locally (SetActorLocation), costs about 1.8-2ms
actually i just calculate the ai positions, and only update them in range
need to do a lot of smoke and mirrors
lol
Something that is described as smoke and mirrors is intended to make you believe that something is being done or is true, when it is not
so actually, yeah so u say like, a 'moving' actor is (way) more expensive than a not moving actor right?
yeah
2000 ticking ai, will eat time aswell
yep
i dont call them 'ai' but just actors
since im not using a full ai like blackboards an all
you would probably want a manager to handle groups of "AI Actors"
ive been testing with like 2k of moving actors (with a skeletal mesh) and it was pretty good (like 70 fps instead of 90)
but yeah, it eats
we have 30K actors
and 150 AI pawn (max allowed)
and we run around 12-13ms game time
(on listen server)
hhm cool
normal client around 9ms
ive actually read some article that they have like 40k of replicating actors in Fortnite
u actually do culling on that 30k actors?
fortnite also uses the replication graph too, which is a bit different
that only saves replication calculation costs
we have Network managers in zones, which handles our interactable stuff (like lockers, doors, windows, etc)
and lockers, doors, windows don't replicate on there own
our considered actors is around 300ish for networking, which is nothing
fortnite has 50K replicated actors
so u mention the 30k of Skeletal Mesh actors @meager spade ?
ah, k
in my situation i actually have the "HumanActor" as a custom SkeletalMeshActor that just have a somehow cheap character mesh
i found, that not using a CMC and the regular AI stuff saved it from like 100 ai ๐ค
i mean, its not possible to create more than 100 AI like a zombie game
however i still need to really see how to improve the SkeletalMesh for sure, like having much on a screen
i kinda think its somehow a unreal limitation that the skeletal mesh is not very cheap
anyone have easy to implement code that allows someone to host a server but instead of getting the LAN or IP Address, it stores said info and allows the host to name their server and password protect it? Sorry if thats confusing ๐ I'm new to multiplayer hosting and unreal in general ๐ ๐
@prisma vortex u just mean how to password protect the server?
yeah and to host without needing to list the IP Address or LAN, my teacher said I could use the cloud but doing that I'd have to pay for space and I'm too broke to do that ๐ฌ
if u develop for windows, u could checkout advanced sessions for steam
https://forums.unrealengine.com/community/community-content-tools-and-tutorials/41043-advanced-sessions-plugin
Advanced Sessions Plugin
Updated 05/05/2020
Plugin now has two modules, one is AdvancedSessions and one is AdvancedSteamSessions, this will allow me to tie more Steam specific functions in without forcing the steam subsystem to be packaged out with projects that don't wan...
u could host your games using steam, and test it with friends ๐
I'll look into it ๐ค I'm hoping to develop my own way to host at some point ๐ doubt my games will go far but itll be fun ๐
u could just create a game in unreal and host it using sessions and steam. how it helps. Good luck!
Thanks!
Does anyone know how to increase the network bandwidth limits? I've added
[/Script/OnlineSubsystemUtils.IpNetDriver]
MaxClientRate=1000000
MaxInternetClientRate=1000000
[/Script/Engine.Player]
ConfiguredInternetSpeed=1000000
ConfiguredLanSpeed=1000000
to my defaultengine.ini but it hasn't seemed to change the limits
my out rate is always fairly low at 4000bytes
my game has a lot of actors but theyre all static, literally just with meshes. dunno if this is causing it
my client takes ages to load in all of these actors, with a lot bitrate too
@gusty raptor 2k moving actors
reduced your frame rate by around 23%
that's actually
terrible
you are far more constarined on server
is there a simple diagram for each replication option, that summarizes like this:
"Use Multicast to make sure all clients and server see an object spawn"
"Use Run on Server to store number of objects spawned"
"Use Run on Client.. to show ..."
"Use Not Replicated for multiplayer games to show..."
can somebody help me resolve something real quick?
Designating function replication across the network
there is tables that explain it in the docs.
I intentionally seamless travel with a level sequence actor, over the last engine version or two, my level sequencer now breaks apart after travel. (play time starts going negative)
I'm at a bit of a loss as to what breaks, as all my references are valid.
I'll try a master sequence
nevermind, its not a real thing. Its just another level sequence
hey guys, how should my UI widgets be added to players when doing muliplayer
doing it on begin play causes duplicates when a new player joins
(please tag me if you respond, thanks)
Completely ignorant question...but anyone know how to apply network Smoothing to listen servers?
I have a blueprint project and when I play online with a friend, and I host a game using Steam backend, I get a LOT of lag and stutter for non host players.
They describe as jitter and stutter of movement and actions, with long delays.
I have read about the SmoothSync tool, but was wondering, is there such an interpolation built into Unreal by default?
@twin sable no guarantee but in an old project I also had this in DefaultGame.ini
TotalNetBandwidth=600000
MaxDynamicBandwidth=80000
MinDynamicBandwidth=4000```
@humble plaza the idea is not letting the server force non-predicted corrections on owning client
and keeping stuff like MaxWalkSpeed in sync
also, if you're spamming reliable RPCs, then CMC's unreliable ones won't get through
one more thing that can cause jitter on clients is letting things like skeletal mesh replicate
Anyone have some good tutorials or resources/links to utilizing epic online services? Having a pain with it haha
(Feel free to ping me if you know ๐ )
@charred ivy one channel down
I fixed my issue, it appears the Sequencers do not survive seamless travel unscathed. It destroys the audio component it uses, I just created a new sequence player after travel and overrode my references to the original with it. This is technically a memory leak as I am throwing away sequence players everytime I change maps, but since I am only using this for an "in-game trailer" this is fine. xD
meh GC will clean up anyway.
is there a good resource on implementing lag compensation in UE4?
Theoreticlaly, the only real resource is the CMC, UT4 and maybe the ShooterGame (not sure they do something like that).
"Good" is a different story.
Fun question for everyone. Say you have a multiplayer game, and you want to create non-replicated pawns as well (that do not increase load on the server or other clients). What would you use for this.
how do make blueprintimplementable event that have parameter similiar to blueprint custom event with run on server and run on owning client parameter and its reliable?
๐ค
I've ran into an issue with replicating large numbers of actors. It seems each actor uses a channel and there are only 2048 available. Does anyone know if replicated actor components require their own channel, or use their parent actors channel? Cant find anything on the internet about it and i'd hate to refactor everything just to find out it was for nothing
It seems very unfortunate to me that OnRep functions run before BeginPlay. ๐
@waxen socket Story of my past few weeks
๐
What we is at the start of the OnRep, check if the "ActorHasBegunPlay"
And then in BeginPlay we call the OnRep, or whatever the OnRep is supposed to call, manually. However this only really works if you can makr out based on your variable if the OnRep has to call
E.g. if it's a pointer variable of something you know needs to be valid, you can call it when the pointer is already valid on BeginPlay.
But it's very depending on the OnRep variable of course
I see. That's good advice. It appears the only HasBegunPlay in Blueprints is from GameState. So my options may be more limited than in C++.
HasActorBegunPlay also doesn't exist?
I can tell you ,you want to learn cpp if you deal with multiplayer. Too much stuff is locked away from bps
I'm searching without context sensitivity and all that comes up is HasBegunPlay from GameState.
I did work in C++ for a couple years. I will use it when the time comes that I must.
Thanks for your advice, eXi.
Hi everyone, just wanna know do you guys use Gameplay Ability system for your game?
#gameplay-ability-system
@meager spade thank you
what is the best way to show widget on multiplayer? in game instance or game mode or player controller?
@wheat magnet It depends on the context. I usually do mine through the player controller
@wheat magnet don't ask the same question in multiple channels, #old-rules
swear you have been warned before
@wheat magnet I've infracted you for posting the same questions in multiple channels. Please adhere to the #old-rules in the future. Thank you
what is the best way to show widget on multiplayer? in game instance or game mode or player controller?
@wheat magnet You can also do it per character if you think different characters will have different UI's. Just clear the old ones first
what is best way to share global variable to all players in multipalyer
gamestate
i tried game state it only increament for once, then if other player try to increament then it still show 2 instead of 3
Guys I m looking to find a way to update my minimap as players or minions move.
What I can think of at the moment is to on every tick of umg query all actors and get their position and draw on map.
What I want to do is to get callback from actor class when their movement updates by networking and replication and then it sends broadcast and then I update the map. Is this possible to do.
@wheat magnet you need to make them replicatable. UPROPERTY(Replicate) float MyScore;
And override the LifetimeProps function and add this variable
can i do in blueprint?
when i add widget in my character blueprint, it add to all clients, but i want to show widget only on client
Hi guys, is it possible to use multiplayer replication to make a 2-player game where the spawn positions and character pawn are randomized between the 2 players each round?
projectiles seem to be spawning further forward on dedicated server vs. listen server. this is causing a problem where, if i'm right up against a wall, the projectile from my gun tries to spawn inside of the wall
any idea why this would happen?
Latency and Replication is why.
When your a Client, there is a delay between when the Server spawns the Projectile on its side and when your Client creates the Projectile after Actor Replication.
The Projectile will have moved on the Server side by the time this occurs.
When your a Listen Server and the Host, you have no Latency
So its a perfect world for you.
so how do I reliably make projectiles spawn where they should?
Well maybe a hybrid approach would help you solve edge cases like this. If your to close to a Wall for example, maybe use a Linetrace to represent the Projectile instead. Since the visuals of the Projectile wont be relevant as its most likely to explode/hit the wall straight away and disappear.
i considered that, i thought maybe there's a better way
If your 1 meter away from a collider, spawn the Projectile.
Since the Projectile would have room to move and be visually present in that space.
there must be a better way to do this
Make sure the initial position your spawning the Projectile is inside your Players collision capsule.
it is
do like shootergame. fire a trace from the start location (ie: view center) and adjust the spawn location
on if it hits a wall or not, instead of always spawning out at the front
how do i check if it has tried to spawn inside of a wall
by tracing from the view location forward.. if you hit a wall.. instead of nothing
wut
since view location is not going to be in a wall
or even the center of the capsule of the character firing
so you trace from the character, if you hit a wall, adjust the spawn location of the projectile instead of just spawning at the end of the gun.
it already spawns from inside the player's collision capsule
or rather, it should
the spawn location is inside of the player's collision
but the projectile has velocity
and when it's above a certain velocity it tries to spawn the projectile outside of the collision capsule
then you have two options
turn on CCD
on the collision comp
of the projectile, or do a trace to see if you're gonna hit a wall
and then just make the thing hit the wall
the problem with the trace idea is it's gonna vary based on ping'
or just do the impact effect of the projectile on the wall
the start location should always be the same though
are you predicting the projectile on the client or something?
ccd on collision component of the projectile didn't help
i'm doing a "run on a server", it does a line trace to see where the camera is pointed, subtracts that by the spawn location of the projectile to find a vector for the projectile (so that the projectile goes where you're aiming inside of just using the same rotation as the camera and keeping an offset)
it spawns the projectile inside of the player collision
it's calculating the position of the projectile before it even spawns it, is the problem
i tried to set the velocity to 0 and then increase the velocity on beginplay but that doesn't help
try adding some logging, print the camera location, and the projectile spawn location
if it really is spawning inside of the character, it shouldn't be spawning in the wall
unless it's a collision issue, and it's doing the spawn adjustment
like taht your projectile is colliding with the owner, so the spawnactor call is adjusting the position
and pushing it somewhere it's not supposed to be
this is printed on beginplay for the projectile
the server and client don't agree probably because of what devilsd said
so it'sc reating projectiles on both server AND client?
the client print isn't necessarily at the exact spawn position either, if it's just happening from replication
since that would be the position that it's at, at the time the client actor is created
after postnet
tbh i'm not 100% sure as i've never encountered this proble
my "spawn actor" comes from an event that is "run on server"
i'm not actually sure why i can even see the projectile clientside tbh
was wondering that
i'm brand new to networking in ue4
the projectile actor itself must be set to replicate then.
i don't use blueprint, so the way you implement this stuff is a bit different
oh yeah it is
ie: i don't use an rpc to spawn my projectiles, they are created from the server automatically, for the replicated type anyway.
i just RPC the button presses.
ah
start/stop
runs locally too for prediction though, but projeectiles only spawn on authority, so the server side part of the state update
at any rate, it seems fishy if it's just not spawning in the correct location, only on DS, while.. standing still
i could see, maybe some latency issue if you were say, running towards the wall, and then you fire
but even in that case, it should still be delayed, or .. behind
rather that infront
assuming you actually have significant latency
btw, could it be because your gun is in the wrong place?
if you are spawning from the muzzle
i'm not spawning it from the muzzle anymore
cause dedicated server doesn't actually update the bones by default
why not?
that is where the projectile should come from
because i'm trying to troubleshoot this problem
i moved the spawn further inside the collision just to make sure
i spawn my projectile from the muzzle and not had any issues
it's also putting the emitter and sound for the impact at 0, 0, 0 in world space
idk if that tells us anything
(it's doing that when i'm too close to a wall with too high a projectile velocity)
uuh it seems to be the "destroy actor" node causing the issue somehow
after it does all of the logic for the projectile, it destroys actor. i guess the server is destroying the actor before the client has time to be informed properly on whatever happened, if i add a slight delay it doesn't have an issue anymore
It seems something is wrong with the java source code for Android to work on WiFi LAN.
Can someone point me to an easy fix so my game can work on Android over LAN?
hello guys everything great, I was wondering how do I create the server packages for people to create their own dedicated servers, I went after creating the windowsserver packs but when I look at the pack it has some mb since in the windowsnoeditor version the pack is almost 5gb of power someone help me
@weak wind windows no editor is basically your game client and it is supposed to be huge in size.
@rich ridge ok, my problem this being my server package compile it but it has come well smaller want to make a version for people to mount their dedicated
Dedicated servers are very small in size
It's smaller due to the fact, the server doesn't need all resources, like texuters, which can be realy huge^^
thanks guys but just one more doubt in the case if a person set up windows server he will manage to create his own dedicated
because most of the dedicated I saw was by binarios on win64 already in a pack for public server have not seen a tutorial
I don't really know if that is a question oO What do you want to know
@weak wind I think you are confused between UE4 dedicated server VS actual server which most of the people heard before landing into UE4 domain.
UE4 dedicated server is like a game only which doesn't have a window to render , it's black console that's it. And if you run this game client which has black console at servers then they are called dedicated servers.
ready the people uses the right cmd console, what I'm looking for is to create a package that she can manage her own server in my game
for example I created up to a .bat to run my server
Hello. Does anyone know how I can make steam work when using "standalone" play in editor? My co-worker does this to test steam and it works perfect. But on my PC when I start standalone with Steam running in the background, Steam doesn't work.
Hi guys, how is Fortnite and other BR handling lobby and game instance from server-side point of view? I can only guess Lobby server is a separate program that forwards all connected clients to random available game server. That means, two completely separate server builds, but I can't find any way to create two server target.cs files. Any ideas?
hey, is it possible to shove a development build on Steam for testing or does it need to be a shipping configuration?
@polar wing It can be development build
thanks!
should make a beta depot too, and then you can even auto-publish with build scripts
epic
*branch not depot