#multiplayer
1 messages Β· Page 473 of 1
try #design-chat @stark echo
oh thx @winged badger
also, post login is not the place to spawn players from
there are better hooks, like HandleStartingNewPlayer
and the thing works pretty well out of the box
for just adjusting spawn location, you override gamemode's ChoosePlayerStart and leave it at that, usually
Im sure its related to the player itself,smt im doing wrong
@winged badger does HandleStartingNewPlayer fire after onPostLogin ?
it does
cool thanks
void AGameMode::HandleStartingNewPlayer_Implementation(APlayerController* NewPlayer)
{
// If players should start as spectators, leave them in the spectator state
if (!bStartPlayersAsSpectators && !MustSpectate(NewPlayer))
{
// If match is in progress, start the player
if (IsMatchInProgress() && PlayerCanRestart(NewPlayer))
{
RestartPlayer(NewPlayer);
}
// Check to see if we should start right away, avoids a one frame lag in single player games
else if (GetMatchState() == MatchState::WaitingToStart)
{
// Check to see if we should start the match
if (ReadyToStartMatch())
{
StartMatch();
}
}
}
}
all it does, by default
I was spawning player onPostLogin and it is working fine so far but I will take your suggestion seriously
and it doesn't do that if you override it in BP and don't call parent
last thing PostLogin does is call HandleStartingNewPlayer
aha
and that happens after the BP event
so spawning from PostLogin tends to have default implementation of HandleStartingNewPlayer restart you right after
Basiclly clients dont work
I really need to start coding in c++ instead of those BPs I do... I just give a little time to learn the framework better
sure yeah
At least you started
a start is a start π
@naive shell go and check your output log for any LogGameMode or LogSpawn entries
after it fails to spawn your client
but I mean doing complicated and advanced BPs in a month compared to previously having no idea how they work is huge progress π
there is a real possibility the term "complicated" applies only because you made them so, even if they didn't need to be π
well BPs look complicated anyway it's in their nature, and this is one of the reasons I wanna code directly.
very hard to debug or change them around if you need
bp is like 90% unnecessary visual noise and 10% code
heh
It find it way easier to use bps
at least reading them feels like that
takes way way way longer to reverse engineer a node graph than it would take to read equivalent code
after you get used to c++, it takes way way longer to make one, too
especially if your mouse does crazy things cause of temperature changes and double clicks
the most infuriating thing when exploring bps is that the navigation does not actually work
if you double click a node to find out what it's doing, surprise, you can't go back now and have to start over
yes that can drive me crazy too
maybe this would be worthy of a PR to fix it
can't put delay in functions and many other things
no delay in functions makes sense as the function must return immediately
@fleet raven what do you use to get the values displayed inline when your breakpoint hits in VS?
entrian inline watch
cheers, and your personal experience with it?
a function must return immediately ? why that
throwing this as XXX.natvis in one of your source folders exposes a few of the core things to inline watch nicely https://pastebin.com/raw/KsKF2dY8
I don't think it can
adding those boxes inline in the code is the only thing it does
and the natvis file is like formatting rules for display in the debugger
it's incredibly useful when debugging math/algorithms
no more painful checking what the new values are
there go my years of practice to quickly decipher Locals π
why?
I blame my pc
takes like 1 minute for it to get fully ready for me, but I only open vs like 1 or 2 times a day so
it mostly just stays open
same here, no need to get VA reparsing all the time
but in any other IDE I run on this computer things are lightning fast
the entrian search is also very useful
i often go days without shutting VS down when working from home
π
I turn my pc off every night because the noise would bother me
sound padding on the casing here, don't even notice it until it runs all cores for a while
no computer shuts down in this house
I got 2 servers running in the other room
24/7
one is also a local DNS
doesn't take too long to turn back on
I know right
for me, starting VS and loading my project (about 1k source files) takes 5-8 seconds, 20ish seconds to start the editor
I need an SSD I think on this desktop
vs might start fast but it still takes a while for it to decide to begin loading the plugins and then for va to eventually start coloring things
that other visual studio code opens way faster why
get a samsung 970 evo plus
but I cannot build server from it or at least I don't know how yet
yes I will get a samsung
it compares prices from all the relevant shops that exist
oh ok, cause I wanna find some good german eshop that sends to EU countries, for my upcomming purchases
so you can put up a wishlist with the parts you need and it'll compute the cheapest way to purchase all of that
ok I bookmark it
been using it for every pc build
I always order from germany
lol
hey no not that bad π
it's jsut that running visual studio or windows makes it feel like older than it really is
va ?
potatos generate their own electricity
oh well ... you know I am one of those that consider assistant tools a visual noise
real dev
that's silly tho especially in unreal with the style being to write 100 letter function names
I know especially when they look like whole sentenses
camelCaseWordOneAfterTheOtherEtc
its slower and more error prone
va also does a lot more than autocomplete
It adds colors lol
Which is the correct way of adding a widget to every player ?
add how
create widget node
do it locally on every client
And where should i do it?
depends the widget really
well in a place that makes sense for the thing you're doing
Its a main menu
main menus are usually not opened in multiplayer
you have a main menu level
More than a main menu its a host / join one
it opens main menu via GameInstance on BeginPlay
and players actually change the level when they start playing together
is how it usually goes
is it possible to make the dedicated server start session automatically using BPs ? or I can do that only from c++ ?
Im done with multiplayer lol
single player is oldschool π
But multiplayer was easier in the old ue4 versions now idk why its harder
that's classic in every framework, but don't call it easier/harder, just call it different
I don't think multiplayer was easier in the older ue4 versions
starting with it was always an exercise in masochism
Gotta keep working on the weapon system
everyone is making an FPS for some reason huh
I never mentioned fps lol jk
π
you got to show the shooting taking place on the client screen first and then tell the server to tell everyone about what happened
your bp logic was a bit weird
Tracking an actor across all clients - in my case, it's a soccer ball - should I store that reference inside GameState? or GameMode?
what do you mean tracking it?
GameMode only exists on the server, so you don't want it in that
hmm
but if the soccer ball is set to replicate, then every client will be able to see it already
what you could do is have the soccer ball register itself with the local game state on begin play, so then you have a globally accessible pointer to it if needed
Yeah, I think my architecture needs a rethink. So in my game, a ball is referenced for a few things. Like 'Get the player closest to the ball'. The ball also gets destroyed and respawned at various times.
is "get the player closed to the ball" to decide who's like hitting it?
Ah right, so every local game has a reference to the ball - and it'd update on the server.
that would be something you'd want to decide on the server, anyway
right
because server is authority
yeah, the starting point is basically the clients are all dumb and the server does everything
and then you layer in some predicted behavior on the client so the game still feels responsive if there's latency
I think I kept telling myself something like
"but how does the server know?"
and that helped a lot of the time with the whole owner / auth thing
@random oxide this totally doesn't look like a fps, hem hem (sarcasm lol)
π you are getting there
Thanks im currently doing some fixes cause it was bad before
never worked on an fps, do you actually replicate bullets ? or you just calculate where the crosshair shoots ?
it always takes time
It was easier than what i thought
you fixed the spawn ?
The multiplayer one?
yes
I leave it for before i have to focus on game mechanics to
I see
I start with the basic mechanics so that later I can enjoy making the visuals on top of a system that works
true
hi anyone i wanna ask
anyone here have created instance manager?
im trying to build this for my mmo since its doesnt have an instance manager yet if i wanna do instance dungeon apartment switch between zone etc
anyone can help me
When a player controller unpossesses pawn A and possess pawn B in a dedicated server environment, the original pawn A raises the following:
ProcessRemoteFunction: No owning connection for actor xxx. Function ServerMoveNoBase will not be processed.
all is good in a listen server environment.
any ideas?
Guys i have a Run on Owning Client event on the player controller that doesnt fire when the server calls it
Here you have an image
But the Remote branch in the SwitchHasAutority node executes properly
(I have just noticed that i have to remove the RunOnServer property of the SocialPlayer component, but thats not the problem)
SOLVED: i just needed to add delay node with 0.2 seconds because of the OnPostLogin event to be executed
I will change beginplay with a custom event to be called from there
Hello. Anyone making MP game with dedicated server and save System?
So my dedicated server is hosted in AWS GameLift, and it's been working for the past year. However, my most recent builds aren't working. When the client connects to it, they aren't spawned and possessed in a pawn.
The server logs show these errors at the very start of the file:
LogWindows: Failed to load 'aqProf.dll' (GetLastError=126)
LogWindows: File 'aqProf.dll' does not exist
LogWindows: Failed to load 'VSPerf140.dll' (GetLastError=126)
LogWindows: File 'VSPerf140.dll' does not exist
LogWindows: Failed to load 'VtuneApi.dll' (GetLastError=126)
LogWindows: File 'VtuneApi.dll' does not exist
LogWindows: Failed to load 'VtuneApi32e.dll' (GetLastError=126)
LogWindows: File 'VtuneApi32e.dll' does not exist
these errors don't matter
how long has the server been running? unreal servers break after ~2 days of uptime and must non-seamless travel or restart to fix it
this is on a new instance
anything interesting in the log on either side when the connect request happens?
i dont remember seeing anything, but I'll spin up another instance this afternoon and take a look
hey guys, i'm having an issue with a Steam game session. I have a game session that has a maximum of 2 players, and when someone joins the session (with the creator of the session already in) and leaves, the session can no longer be found through normal FindSessions. it seems like the number of players isn't updated after the player leaves, and so the session never turns up in search results. is there something i need to do when the player logs out, in order to have the session public again for anyone to join? i'm already destroying the session when it happens
ah here is the right room
any resources to learn turn based multiplayer in UE4? - something like chess
@indigo coyote check pinned resources on this channel
@winged badger where are you from... cz / sk?
just asking because of your nick name
croatia
@fleet raven here is the full error log
there is a fatal error at the bottom, but it's a bit cryptic
it seems to occur when somebody logs in
well put the symbols in place so you see what the issue is
you need the pdb file in the binaries folder for it to dump a useful callstack
ofc you can't spawn if the server crashes
do you know of a good way to upload directly to my aws instance without having to reupload an entire new build?
if you're familiar with gamelift
maybe scp will work
I don't know, never used this service
Does anyone know how to get a smooth first person spectator experience? I've tried a lot of different cmc properties but none of them are helping.
For example NetworkSimulatedSmoothLocationTime
I set the spectators PC's view target to the character to spectate
SetViewTarget(FocusedCharacter.Get());
It might help if you were to add some spring latency to the camera?
To hide it, because otherwise I donβt think itβs going to smooth it
The simulated proxy smoothing actually just smooths the mesh position of the character, the root position doesnβt get smoothed
You can see this by looking at how the capsule and mesh will diverge if you turn on show collision
@copper mango So there is no smoothing for the capsule? That explains why NetworkSimulatedSmoothLocationTime wasn't changing anything
I don't have a separate camera/spring arm or anything for the spectator right now. I just set the view target
By spring latency were you talking about a spring arm?
right
add a spring arm to the spectator camera and give it a bit of latency, and that would hide the fact that the capsule isn't smoothing
okay awesome, I'll give that a go. Thank you for your help π
at least unless I was doing something wrong, I definitely noticed that the capsules just jumps on simulated proxies when a correction occurs, which is quite often
whereas the meshes will smooth over time
so I had a problem where my AI enemy widget component would jump around jarringly because it was attached to the capsule
and I changed it so that it was attached to the mesh and it fixed it
since the meshes were smoothing
right, that makes sense. I don't think I can use a component as a view target
currently trying to access the gamestate from the gamemode class but GetGameState is returning null, is there another way to access the game state from the gamemode class?
are you on the server?
yes
at what point are you trying to get the game state?
AGameState* GameState = Cast<AGameState>(GetWorld()->GetGameState<AGameStateBase>());
is your game state an AGameState or an AGameStateBase?
you don't need to do the cast if you provide a template parameter to the GetGameState, it'll automatically do the cast for you
agamestatebase (the default)
well then you can't cast it to an AGameState
because AGameState is a child class of AGameStateBase
isn't it?
yea
so if you want an AGameState instead of an AGameStateBase, you've got to change your game state class to AGameState
@copper mango How would you go about updating the spring arm to match the view rotation? My current setup doesn't have a separate camera component or spring arm. I'm just using SetViewTarget
wouldn't it use the camera component on the spectator pawn?
or does it use the camera component on the actor that's the view target?
No I think the spectator pawn would only be for free cam
ah
It would use the camera comp of the actor that's the view target. But ootb characters don't really use camera comps unless you create one
so probably then your player character needs the spring arm/camera component on it, maybe you can disable it by default
and then if you spectate it enables it locally?
it wouldn't be replicating components so should work fine
assuming you can disable a camera component like that
sure, good luck
ive stuffed the camera system into the player controller probably a funny idea, but at least i no longer have hundreds of pawns running with cameras on their back for no reasons.
the problem with fast moving projectiles in multiplayer is that it might go straight through something between collision checks right?
I think the collision would do a sweep by default, so that shouldnβt be an issue
hmm i thought it was just in general a bad thing to have fast moving projectiles. im not currently working on one but i was just thinking about it for later. was thinkin maybe a series of line traces and subtracting Z every bit of distance for drop
We have real projectiles that move >100,000cm/s without any issue
its continuous collision detection that does the sweep if enabled
@fleet raven unreal servers break after 2 days and need restart ? omg this is ...
its not just unreal
why do you think every game with persistent world has "daily maintenance"
so the only solution is to write your own backend right
I am not used to restarting processes in general, for no reason so all this sounds very strange to me
only in case of updates
well, i don't know of a game engine that doesn't have that issue
so you can trust that many people got annoyed by this in the past, and none of them solved it
I know right, I've noticed those 6 hours maintenance they do which is rediculous
6 hours is unusual
black desert does that every week
its more like 30 min or less for that sit
something like EVE Online is common, if they don't push an update they are back up in 5 minutes
not sure what they are doing ,... maybe defrag their win server lol
unless ur updating
ok this is not good
I mean for an mmo you really need your own backend otherwise this is not the way to go
you will need a backend that keeps track of
player info
Store transactions
and Server List
those will be important
these are easy
these will be done anyway
with external servers
I am talking about own coordinate system etc
I know that one but I wouldn't use middleware
I mean I can run Kubernates in this case as an alternative on my own machines and it would be free, but I don't like this idea either
its not the same
they are not but the end result may be what you want
Spatial lets you split your... game instance between several dedicated servers
this is exactly waht I have in the TODO list to write
you either have a team of 100 then, or you are immortal π
I think that is not a problem, here we got a huge problem now ... the "restart every 2 days" problem π
omg
its not a huge problem, as all players are very much used to it
for me it is terrible
then you have updates what are u gonna do then?
if you have to do it every 2 days, better to do it daily
5 minutes every week is terrible enough
consistency
your players know you shut down every day at 11am their local time
they are fine with it
I mean I reboot my machines every like 30 to 40 days and takes 60 seconds to be back online, and this is only due to core updates
even make it a part of their strategy, some of them, as that typically respawns all NPCs
no to me all this is wrong
I got to solve it
at least I am not making an mmo soon
Also spatial OS solves alot of networking inside unreal, unreal i wouldnt say built out of the box is meant for a mmo
You need rep graph otherwise
yes, one of the problems I got to solve is how to travel from one region server to the other, I got a plan, maybe unreal has something to help but I will see
but I would not go with spatialOS
if you can write those things why bother with 3rd party services
because they took teams of people
good for them and congratulations but
you know what I mean
Kubernetes is a grate solution for scaling, plus you got containers which you can restart at any moment and none will notice
BUT.... you get locked in a Google software
which this maybe running on your own machines and not google cloud, yo uare still locked inside making containers using docker and run it on Kubernetes
makes you need to run mysql inside there too,... makes all your system go with it
so is this problem affecting coordinats only ? or anything else ?
Why would anyone notice the restart of one Server?
The weekly updates and stuff of MMOs is usually hotfixing and balancing
You can easily start a new Server, move players over and restart the one in question
That's not an issue at all
and with systems like Spatial etc. player's wouldn't even notice
Also if you think you have the time and resource, feel free to code everything yourself, at best even the Engine
But if you are limited in resources and time, use middleware. Don't reinvent the wheel
π
I could easily code a backend like PlayFab or GameSparks, but it's a stupid idea given it would take a lot more time and money than just using what exists
I literally just said that
Also if you think you have the time and resource, feel free to code everything yourself, at best even the Engine
1 solution is not the best for everyone
I mean you already sound like you would not agree with how I want my ssytems to work
Most people coming here, talking about making an MMO don't even know what Database to use.
That's when middleware is your best friend.
which means that my solution would not be the right for you
what most ppl do, I can say alot of things...
well I am not willing to use spatialOS anyway
That's all fine. Just if peeps here read this: It's totally fine to use it if you need to
of course
And for the "Server's break after x hours" I don't quite get the problem.
my choices are not advices
they are choices
why you got this so wrong ?
it is a problem, how can you not see it as one
Cause there are two setups where UE4 DedicatedServers are used:
Matchbased games, like UT, CSGO, Fortnite, etc.
And persistent games, like an MMO.
And Matchbased games, a Server never lives longer than a few hours at max.
Most CSGO Servers are scheduled to restart (if selfhosted) every night.
MMOs seamlessly move players across the Servers anyway. You go from outside into a town? Moves them into a Server or shard with Players for the town.
Even without loading screens. Either way, you can move players from Server to Server without them noticing, easily cleaning a Server and restarting it.
WoW even had a mod/plugin that let you ServerHop (not supported anymore), you didn't even notice you were moved despite creatures reloading
movign players among server is not something I have tried yet, this may be a temporarily solution to the actual problem of needting to actually "restart (stop/start)" a process
but that doesn't make the need to restart a process not be a problem
Floating point issues exist for quite some time. This isn't related to Servers, you'd even need to restart your offline game from time to time.
You could probably just reset every single value that increments over time, but that is nearly the same as just restarting the server
- you make sure you REALLY reset every value
So instead of trying to solve the floating issue, create something that properly refreshes servers
resetting values is not the same as restarting a process
if that is a solution I take it
It's most likely not, cause a lot of things depend on these values
Internally of UE4
Even if it's just the gametime
resetting values is fine
You can try to find all the values that increment over time and modify the engine to reset that
why haven't the others thought about it and they restart the servers every day ?
Pretty sure that's pretty much impossible though
Cause it's just a random idea by me who probably forgets a big point in it
alright I get the idea
I'm sure you know what floating point issues are
Even moving too far away from the world origin shows them
32bit instead of 64
Generally things becoming less precise
thus the 20k map size limit
Yeah and thus the World Origin Shifting UE4 has
That's just one example though
If you are unlucky it's lots of internal modules and plugins that depend on stuff that can't just be reset
Or even accessed (well without modifying large portions of the engine)
that's for the mmo idea
At some point, cleaning a Server and restarting it is just way handier
I paused this project to learn and solve the moving players from one server to the other seemlessly first
Yeah that's usually handled by having something else outside of the Servers maintain additional data
Like Position and State of the Player
hm
If you move to a new Server inside of UE4, you usually have a scenario where you go through the full login process
With then spawning the Player at a Spawnpoint etc.
Like Unreal Tournament (always picture that when asking how UE4 DedicatedServers are intended to work)
So you gotta replace that with something outside
While still maintaining replication between Server and Client
I am not sure if the engine itself using say "streaming volumes" can help on this, but I want to use regional servers... say 1 server each region
but the problem is when you cross this point you got to still be visible to the previous players
The Engine itself is very much focused on "You connect to a Server. You move Maps on the Server. You disconnect from the Server."
Not "You connect to a Backend. You get a Server assigned that you connect to. You stay connected to the Backend while the Server gets pulled away below your butt and replaced with something new."
Which is why a lot of people might even suggest not using UE4's DediServers at all
But that would also remove the whole replication system
hm so it cannot jsut change server, it also needs to load map etc ?
The Seamless Travel of UE4 works like this:
- Move Players to a very small map that loads as fast as possible.
- Unload old map and load new map.
- Once new map is loaded, move Players to new Map.
Which is usually either covered by Loading Screen or using teh Transition (small map) as some sort of Loading Area
That's a Travel on one and the same Server
yeah the idea here is to avoid loading screens
Going from Server A to B is usually a hard connect
I wouldn't know where to start setting this up and I'm basically breathing the multiplayer part of ue4
I would most likely even didge dedi Servers
And look into stuff like SmartFox or well, Spatial (which does maintain replication of ue4 at least) and stuff
But yeah, you can do whatever
3rd party solutions will always work one way or another
I void them when I can
others don't care and just go with them
Yeah I love creating my own solutions too and I would love to not use PlayFab for my client
But no resources available to let me create a backend
Well I wish you good luck with this, I would suggest trying to get information on how SpatialOS works, maybe that pushes you into the right direction on how you can setup your own.
The HardTravel/Login stuff when moving to a Server is def the harder part to change in my eyes. Once you are on the Server and the Server has all information about you, it should just resume normal replication flow
I do have a theory in my head but requires loading the whole world map on to a different server and from there move on
i have created new Player State and set config in game mode to use that player state
player state is empty, only one var
when player open level (go to dedicated server)
i'm getting this error
LogNet: Warning: UActorChannel::ProcessBunch: SerializeNewActor failed to find/spawn actor. Actor: None, Channel: 11
LogNetPackageMap: Error: GetObjectFromNetGUID: Failed to resolve path. FullNetGUIDPath: [73]/Game/Blueprints/Game/PS_PlayerState
LogNetPackageMap: Warning: InternalLoadObject: Unable to resolve object from path. Path: /Game/Blueprints/Game/PS_PlayerState, Outer: NULL, NetGUID: 73
LogNetPackageMap: Error: GetObjectFromNetGUID: Outer is broken. FullNetGUIDPath: [73]/Game/Blueprints/Game/PS_PlayerState.[71]Default__PS_PlayerState_C
LogNetPackageMap: Warning: InternalLoadObject: Unable to resolve object from path. Path: Default__PS_PlayerState_C, Outer: NULL, NetGUID: 71
LogNetPackageMap: Warning: InternalLoadObject: Unable to resolve object. FullNetGUIDPath: [73]/Game/Blueprints/Game/PS_PlayerState.[71]Default__PS_PlayerState_C
LogNetPackageMap: Error: UPackageMapClient::SerializeNewActor. Unresolved Archetype GUID. Path: Default__PS_PlayerState_C, NetGUID: 71.
LogNetPackageMap: Error: UPackageMapClient::SerializeNewActor Unable to read Archetype for NetGUID 4 / 71
and btw. PS_PlayerState doesn't exists anymore, it's deleted and all references, i have new player state
native netserialize structproperty /Script/Engine.Actor:ReplicatedMovement (scriptstruct /Script/engine.RepMovement) failed
Anyone ever had this? Happens when the Character is moved from respawn point to lineup position
Only showed up in the Linux log, but it might also show up elsewhere
@thin stratus never seen this in my linux logs
Yeah we are actively restarting the player and then setting loc and rot. And it doesn't seem to like that
I do respawns but not what you are doing, maybe this is why I never seen it
by the way @thin stratus are you able to build linux dedicated server from a linux OS ? cause it was not working for me so I do it through windows
yeah lol
Don#t even have UE4 on Linux
I do ti works fine but cannot build dedicated server form it, they didn't make it possible
...yet
yes that is actually easier on linux
I mean if your graphic card is well supported by your distro you are good
but if you need a dedicated server build, you need windows to do that ... for now
I think same goes for mac
what you don't get on linux also is the epic launcher
I don't know I don't run macs
Me neither
Currently have just some ubuntu on my Alienware and the GPU isn't really working
But it's only for testing the dedi server
so don't care
for dedicated server setup a headless debian and you are perfect
very stable
I personally always had problems with ubuntu server
It's gonna be Azure Linux Server in the end for this one. Just need some resource tracking and debugging on the laptop
Think they also run Ubuntu but not sure
if you know ubuntu cli then it's the same on debian couse ubuntu is debian based
you will be remote anyway so you got to use cli
debian is no1 on their list I guess
(and centOS)
They are headless instances in the end though
that's what you want
Nothing you want to access
headless
It just runs if needed and shuts down if not
it's server why have desktop environment
Yeah what I mean is, I won't even connect to it via console
It will auto setup and run when needed
h you don't access it via ssh ?
If possible, no
I see
Azure control panel stuff it smells
Not my project
I just follow orders
I wouldn't touch anything with a DediServer requirement for my own stuff
oh I love dedicated servers
Not the point. I know the scope of projects like these.
And being basically the only programmer on the project atm, I'm already annoyed
Not gonna do that to myself for company internal projects
ListenServer or offline it is
Anyway, on another note: What event could I hook into to clean up Widgets before traveling?
APlayerController::PreClientTravel seems to happen at a stage during SeamlessTravel at which the LocalPlayer is invalid
@thin stratus I had the same problem where to cleanup widgets. The solution I'm using is not great but the only one I found which worked in all cases. I use a widget on top of all other widgets during travel. Then after travel in begin play of the controllers I use "get all widgets with interface" to clean up all widgets.
Yeah I would love not working around the issue.
I did filter SeamlessTravel now and will see if that helps
Cause if the LocalPlayer isn't valid, it should also not have any Ui anymore
Cause that lives in it in my project
Thanks though
@thin stratus i hooked on GameInstance's OnNotifyPreClientTravel
never had any problem with it
Are you accessing the LocalPlayer from there?
no, but i did hook from the HUD
so i have everything i have to remove referenced in it
Yeah my Menus and Dialogs are in the LocalPlayer
Ah well, will null guard it now instead of checkf
No idea how to get around that
Cause it literally crashes on a Particle Comp that sits on our pawn
Will try to remove all pawns before traveling tomorrow
Is there any kind of relatively simple way to stress test a dedicated server and simulate a large number of user connections, without actually needing 50+ or however many connections?
Or is it kind of one of those things where you just need to do that testing in a real world scenario
hey guys I don't think I am in the correct section so sorry but I was wondering I was trying to work with a friend to create games in UE4 and I have no idea how I can work on it with us both on different computers anc accounts
and
Isn't SmoothClientPosition_Interpolate for capsule smoothing?
@copper mango said the following yesterday
The simulated proxy smoothing actually just smooths the mesh position of the character, the root position doesnβt get smoothed
I'm trying to get a smooth first person spectator experience. Right now I do
SetViewTarget(FocusedCharacter.Get());
To focus the spectator's PC on the character of the player to be spectated
But none of the smoothing properties on CMC seem to be changing anything. Such as NetworkSimulatedSmoothLocationTime
Hmm but if you look at the client correct function it seems like it only smooths the mesh position
And thatβs what Iβve observed
Not gonna be at a computer so a while so I canβt point out the function I was talking about
Do save games save to the client by default?
if so how do i get the save game to only save to the server
you call whatever function saves the game on the server side?
games don't save by default
Yeah Mesh position is the only thing that gets smoothed, you want to make sure the camera is attached to the mesh
curious as to how do you guys push builds to multiple computers, i find it to be such an elongated process, even using a shared drive
testing mutliplayer in ue4 editor with various windows just isnt the same as well
would be cool if we could push a standalone build to another computer (from the editor)
I think there is a way to do this using the unreal frontend tool?
it can list like multiple computers to launch builds on
If they all have UE4 installed, maybe
I can see the logs live of the other PCs in the office
But it fails when trying to just deploy a build to a different pc for me
"fails" in terms of not possible
I read that there is some small service you have to install on the pc for it to show up there
but never used this feature
ill look into that thanks
@chrome bay okay, I don't have a separate camera component/spring arm setup right now. I just set the view target to the character actor. Since it expects an actor and not a component.
I might be wrong but if the view target has a camera component it'll use that to look through I think
ahh okay, I don't use a camera component for first person. I use the ootb setup with camera manager
But that might be true. I guess I should add one for spectator only
Oh if not, you can override GetActorEyesViewPoint and set CameraStyle to FirstPerson in the cam manager
(APlayerCameraManager::UpdateViewTarget)
So I should return the third person's meshes location inGetActorEyesViewPoint ?
what do i do to make the level open my settings are in the vid when i added multiplayer and tried opening the level it no work
has anyone come across this log message before?
LogNetPackageMap:Warning: UPackageMapClient::InternalLoadObject: Unable to resolve default guid from client: PathName: BP_WoodRamp_C_2554, ObjOuter: /Game/Maps/Level_BattleRoyale_2.Level_BattleRoyale_2:PersistentLevel
i'm not sure what it means, but when too many of these log messages appear the buffer overflows which leads to a server crash
Maybe sending a pointer to an object that doesn't replicate through an RPC?
hmmm
i don't seem to be passing any pointers to any server rpcs
such a vague error π¦
could try throwing a breakpoint in there in a debug server build and explore what the context is
@thin stratus Any special reason why you put your Menus and Dialogs in the Local Player?
so I'm pretty sure my problem is simple but I'm having a weird problem. when i spawn a player anywhere, it spawns in 2 Pawns and i posses 1 of them... I've changed the default pawn to none and I've made a spawn system in the player instance. when a player spawns in it spawns 2 pawns, and u only use 1 so idk what's happening here π¦
@twin minnow any subobjects created at runtime there?
@mossy hearth Found that to be a good place for me
did you try hooking into GI->OnNotifyPreClientTravel directly from LocalPlayer @thin stratus ?
No, I only have PreClientTravel in the PC atm
If the GI calls that the same frame, then the LP is invalid anyway
Ha
The PreClientTravel of the PC calls the GameInstance function
So we can forget about that :P
@winged badger
is the local player invalid, or is the reference from PC to LocalPlayer cleared?
But it's fine. I just removed the checkf and kept the nullguard.
The Menus are being removed and when the LP isn't valid, the ref to the Widgets dies off anyway
i find second scenario more likely
Could be, I can try to hook it up directly via the delegate if I have some time today
Kinda weird that the PC calls the GI function
Specially since it's not guard by IsPrimaryPlayer
is this called 4 times in splitscreen? o.o
What exactly is the TravelType? I have to admit I never had to use it and never questioned it
But SeamlessTravel requires TRAVEL_Relative
Think the other one is TRAVEL_Absolut
The Enum Comments aren't helping much either
TRAVEL_Absolut is the Absolut URL to a (new?) Server.
TRAVEL_Partial keeps the name and resets the server (what?)
TRAVEL_Relative is a Relative URL to an existing Server we are on I assume.
Relative = same server, basically
Partial = no fucking clue
Absolute = full URL
It's basically a clue on how to unformat the URL, AFAIK
As in, if you say absolute with no IP as a remote client, it's probably going to travel to a local game
I think, TRAVEL_Partial keeps the Data that is passed when traveling (Options etc.) but uses them for a new Server or?
It's barely used even in the engine
Really no idea about what partial does
im guessing partial is convenience syntax for hard travel on same server
relative just copies from whatever it was before, instead of replacing port, rotocol, host, etc afaik
partial takes the base options, but doesnt keep the other stuff that relative does
i -think- so, it's kinda confusing
i believe partial will take all the options that were used before, but reset th e connection?
the only thing i know for sure is that seamless requires relative, anything other than relative and it's not seamless
lol
and that absolute is.. absolute, taking full address, and liek a whole new connection period
so i guess partial is like an absolute, but without resetting previous options? blah
Hello, does someone know how to fix multiplayer disconnects like this:
LogNet: UChannel::ReceivedSequencedBunch: Bunch.bClose == true. ChIndex == 0. Calling ConditionalCleanUp.
I can see that UNetConnection::Close() is called from receiving bunches, but why one of them have bClose set to true is unknown to me.
The reason for disconnect in GameEngine is lost connection to host. Maybe you know how to better track this problem?
Dunno where to attach to debug it more precisely. Everything is happening in cooked versions, not in editor and it is happening in between 0 to 30 seconds from client joining.
Also strange is that sometimes like 1 on 30 tries the client won't get disconnected at all.
Does the Client show any errors in log?
You always have Server and Client log that you gotta check
Sometimes the client just crashed or similar
Ok i will check them
So game still crashes on travel cause of this: https://issues.unrealengine.com/issue/UE-72891
I tried to go over all pawns and destroy them on PreClientTravel
But it's not solving it. Even though it's called before the crash happens, it still reports the HoverParticle (probably only spawned and autoActive particle) on a pawn
I assume it's still in the memory
how does one force garbage collection again?
Ah via UWorld
nvm, not even forcing garbage collection fixes this. my goodness
ive an unreliable server rpc and a reliable server rpc... im calling the unreliable rpc first, then the reliable one, but the reliable rpc is still reaching the server first
can i flush the unreliable rpc somehow so its sent before the reliable one?
You can't make sure two RPCs reach in order
At least not afaik
two reliable ones maybe
But even that could be f*cked if the first one drops and has to be resend
i know reliable rpcs are supposed to arrive in order(within some limit)
but i dont really need a guarantee, just something thats true 99% of the time
given no packet loss
Combine them into one RPC
the problem here seems to be that the replication is storing the unreliable rpc for later sending
but immediately sending the reliable one
yeah not really an option as they are both engine rpcs
i could make a reliable wrapper for the unreliable one but... thats ugly, and could actually cause problems
If you are relying on two RPCs coming in in order (based on the engine) you might want to rethink the setup
like i said, there doesnt have to be a guarantee, just that it generally happens...
its essentially about flushing pending moves
before an ability predictively changes some move data
its this or disable move combining/delaying, which would be terrible for bandwidth
so i need to tell the net driver to 'send any rpcs stored now'
@thin stratus you crashing on the travel map?
Idk which map
Doesn't make a big difference as it's engine related
@winged badger
@manic pine ForceNetUpdate maybe?
I use this at least for Rep/RepNotify variables
yeah, i tried forcenetupdate, flushnetdormancy, connection->flushnet
alas no joy...
maybe its actually happening server side, with the server processing reliable packets first
@winged badger yes I do use spawnactor in server rpcs occassionally
@fleet raven for some reason I can't recreate the issue locally
actually locally i was able to recreate my mistake
but now the log message is longer locally as opposed to when I ran the game on gamelift
:884][469]LogNetPackageMap: Warning: UPackageMapClient::InternalLoadObject: Unable to resolve default guid from client: PathName: BP_WoodFloor_C_278, ObjOuter: /Game/Maps/UEDPIE_1_Level_BattleRoyale_2.Level_BattleRoyale_2:PersistentLevel
[2019.07.02-11.52.16:908][469]LogNetPlayerMovement: Warning: ClientAdjustPosition_Implementation could not resolve the new relative movement base actor, ignoring server correction!
oh
now we know what caused it at least
didn't you say that first message printed on the server
because that second one is a client sided error
yes
are you creating and destroying instances of this BP_WoodFloor at runtime? or are those all static
i am creating and destroying instances
so it could just be that it was referencing an instance that has been destroyed
theoretically that should be harmless and not crash your server
hmmm
so far i haven't been able to crash my server with small games (3-4 players) but I remember when playing with more players the game would occasionally crash and I thought maybe this would be a possible pinpoint
so i will test with more people tonight and let u know, I could just be overreacting
thank u though
testing multiplayer is both interesting and mysterious
it's very difficult to test how a server handles many players because how am I supposed to run like 50 clients
...ones that do more than connect and then idle
I wonder if they finished insights for 4.23
that should make profiling the server much nicer
I don't know what their plans with it are but from what I understand it's a new profiling backend and frontend and will replace that thing in the session frontend
@thin stratus
void APrometheonTeamState::AddPlayerToTeam(AController* Player)
{
APrometheonPlayerState* PrometheonPlayerState = Cast<APrometheonPlayerState>(Player->PlayerState);
if (PrometheonPlayerState)
{
if (PrometheonPlayerState->GetTeamState())
{
// In case the PlayerState still has a team assigned
PrometheonPlayerState->GetTeamState()->RemovePlayerFromTeam(Player);
}
PrometheonPlayerState->SetTeamState(this);
TeamPlayers.Add(Player);
TeamPlayerStates.Add(PrometheonPlayerState);
// Filter bots so we can get them easily later
if (PrometheonPlayerState->bIsABot)
{
TeamBotPlayers.Add(Player);
}
}
}
Last time when you explained me this stuff
I forgot to ask, once the player is added to team, how do I differentiate players and their teams
Since there is only 1 array
I don't quite get the question
I mean, they are added to array when you call AddPlayerToTeam function on Post Login
But which team is the player in, how do I know that?
PrometheonPlayerState->SetTeamState(this);
?
a team should have a TeamNum
uint8
where 255 is FFA
And 0, 1, 2 etc. are teams
Then you simply add a TeamInterface to all actors that should return a team number
And in your GameState you can make a simple function like this:
bool AHLGameState::OnSameTeam(const AActor* First, const AActor* Second) const
{
const IHLTeamInterface* TeamInterface1 = Cast<IHLTeamInterface>(First);
const IHLTeamInterface* TeamInterface2 = Cast<IHLTeamInterface>(Second);
if (TeamInterface1 == nullptr || TeamInterface2 == nullptr)
{
return false;
}
else if (TeamInterface1->IsFriendlyToAllTeams() || TeamInterface2->IsFriendlyToAllTeams())
{
return true;
}
else
{
uint8 TeamIndex1 = TeamInterface1->Execute_GetTeamNum(First);
uint8 TeamIndex2 = TeamInterface2->Execute_GetTeamNum(Second);
if (TeamIndex1 == 255 || TeamIndex2 == 255)
{
return false;
}
else
{
return TeamIndex1 == TeamIndex2;
}
}
return false;
}
@red sand
Might want to use "Implements" though instead of the cast
Cause that cast fails for BP classes iirc
Or at least something like that
you should really just be querying playerstate for all player<>player stuff, regardless if its server asking
how to reset FBlueprintSessionResult?
playing around with advanced sessions, seems like Session.IsValid is not reliable test because you can't reset the structure
What is "Session" here? (type)
FBlueprintSessionResult
Didn't know that had an IsValid function
It's just a brainless wrapper for the FOnlineSessionSearchResult struct
looking further looks like FOnlineSession has no way to reinit as well
No, you either try joining or refresh
my man I went too far deep from this noob shit π
trying to get up to date data from found session without beacons
like player list and so
SessionResults don't have any connection to the Server in the first place
They are just collected data from the MasterServer
Refreshing them is generally not a thing afaik
but you can update list, find one with saved ID and get updated data
You might be able to use the SessionOwner data to query that specific session again from the MasterSErver
But idk if that's a thing with the AdvSessionPlugin
what is master server?
Whatever gives you the Session Results
hm I wonder how it works in null
In null it literally spams the whole LAN with
"HEY I WANT A SERVER"
And if someone is hosting they answer
But again, it only gives you the current state. Most people just refresh the serverList to get uptodate data
yeah that's what I do at the moment
I do know, with a given backend (e.g. Steam) you can query a session based on the UniqueNetId
e.g. your friends session
Or any other as long as you have that id
so you can refresh a single session i guess
But no idea if that works with LAN
could be a thing in any OSS
And no idea if that works with AdvancedSessionPlugin
As long as they implement it, yes
If the OSS doesn't support querying a single id, then no
- sometimes the Interface is so crappy that you have to use the SDK directly
Had to do that for Oculus
Also I doubt it's really worth the trouble, cause you can do the same with just refreshing the whole list
for sure unless we move to the multiple servers state I'm ok with mega updates
what's that?
lol true π
Cause you literally don't care what is on page 2 until you click it :D
well there is a FOnlineSessionSettings.BuildUniqueId after all
my guess it allows you to filter everything out even for 480 steam
Wow everyone said multiplayer sprinting was super hard to do in unreal and you need crazy c++ mods to the player controller... But I just did it in blueprints and it wasn't hard at all . There isn't even any jerkiness. Literally just change the walk speed on the client at the same time you send the packet to the server that will change your wakspeed on the server and it's smooth as silk. (Client side prediction)
Smooth with 700ms roundtrip lag using Clumsy simulator
I think it's because it uses accumulated error to determine when to snap back and there is minimal accum error since both cli and Serv are sprinting for the exact same amount of time, just with a phase offset
\o/
hey... i need to make a multiplayer game from the puzzle template but i cant find any tutorials on this
i have read a document about multiplayer pinned here but i am new to unreal and new to multiplayer
can anyone help me with the 1st steps, please ?
a multiplayer chess game
in C++
I'd say check out the multiplayer game example, it's included w ue4 . It's like a cowboy shooter
I'd also recommend that you build in blueprints first then convert some classes to c as needed
But that's just me
C++ is a terrible way to learn UE4
Most multiplayer games uses dedicated servers, check out the Dedicated Server Guide on the unreal wiki .. Google for that
^ not really
@bitter oriole i have no problems with c++
You'll end up booting up a dedicated server and then using 'open 127.0.0.1' on a client to join
Then use OnPostLogin to spawn a possessed pawn for the client
That's not the point @twin juniper - you still need to learn UE4 and C++ is a terriblr way of doing it
There's no doc on C++
Learn with Blueprints, move on to C++ when you need it
If you want to do it in total c++ nobody can help you tbh lol
You'll have to be an unreal wizard
As to dedicated servers they're only useful for real-time competitive games @ebon bramble - for a chess game it's completely pointless
Well then will you have listen servers?
For a listen server I think all you gotta do is run the command: open levelname?listen
On the first client (listen server)
Then on the other: open 127.0.0.1
... Yes ?
It's not THAT much harder lol
this is so small game so i want to learn it
It will take another 50 hours to really do dedicated servers .. probably
thats fine
But that includes packaging and throwing on a cloud server too so
It isn't horrible
It's pointless, expensive, painful and time-consuming
great π
But hey, whatever makes you happy
its for the knowledge ... i want that in future
anyway
in the puzzle template i cant find a player controller
so im confused about the multiplayer
isnt it like input stuff?
No ?
It's about netcode
Multiplayer basically means every feature of your game needs a server version, a client version and lots of code to smooth it out
I usually suggest it results in 3x more code
Input is unrelated to multiplayer
im talking about the puzzle template
@ebon bramble yea what you use will work for low latency, but its def. not a proper way to do sprinting/other movement and the server will correct the client whenever the difference become too big. Especially for jumping it will be really bad and you will def. notice it.
@frank portal yeah but I tested with 700ms round trip and it's fine π same w jumping. There is no rubber banding. I bet I can improve it too by delaying the client side prediction of the walkspeed in Ms by the client ping. So if the ping is 300ms, delay the client side predictive movespeed change by 300ms so the client and server simulations are both changing movespeed at very very close to the same time (as if the client side prediction has that same latency) . Hacky but works great . And in blueprints
I'm sure it won't be AAA quality tho for some weird circumstances
you probably dont change the walkspeed a lot for sprinting, but yea its a really hacky solution which also shootergame uses and the server will def. correct you at some point ... yea you can delay it, but then you will press sprint and dont get a instant respond (ofc for a indie game its fine or for prototyping, but it isnt that hard to add sprinting in cpp)
@frank portal how can I learn about adding sprinting w c++
Oh NVM there are YouTube tutorials up the wazoo
Good ol YouTube
yea there should also be a good forum somewhere, but cant remember if it handles sprinting (but it will help you to understand the fsavedmoves etc ^^)
I'm getting this log warning when I'm trying to join a LAN session on the local IP address. However, I am able to join using the loopback address. It doesn't join the session, just goes black. Warning: OSS: Session (My Session Game) already exists, can't join twice
Hey All, I'm trying to set up voice chat with a dedicated server on gamelift. I used to have things set up for steam and my voice chat worked. When I switched over to GameLift, I started connecting to an IP rather than using create/join session nodes. I've now read on answerhub that Voice Chat only works if I'm using the session interface. my questions are:
Is there no "Session" when I connect via IP with gamelift? Doesn't there need to be an online session for players to connect to?
Anyone dealt with this sort of thing before?
Anyone successfully implement Voice Chat using OnlineSubsystemNull?
Is there a way to keep a clientβs pawn, controller, etc. temporarily alive after the client disconnects? Iβm trying to synchronize some data to my database when a client disconnects but by the time game mode -> logout is called the pawn has already been destroyed
Additionally I kind of want a way to keep them in game w/o a controller for 15-30 seconds as a way to avoid disconnecting as a means of not dying.
you can probably hijack the inactive player state
add a hard ref to the pawn, and override whatever function is destroying it
same goes for the controller
Will take a look at that, thanks
you will still have to manually swap controllers on reconnect
look at HandleSeamlessTravelPlayer for inspiration
Well the way it is set up right now is that the server will reject any players that are already deemed βonlineβ by the database. Itβs fine for my purposes to just delete the existing controller once 15 seconds or whatever have elapsed and then have them use a new one when they reconnect
All relevant and necessary data is queried from the database anytime a connection is made so I donβt need to worry about transferring data from old controller to new one
How do I get the location that the ootb "no camera" system uses when I do SetViewTarget? I'm trying to set my real camera component to that location
Without hardcoding the value
i.e. I'm trying to get the eye/camera location of a simulated proxy character
maybe GetPlayerViewPoint
its replicated to some extent, on the PC
not sure if that includes SImulated Proxies
never actually used it myself
there are functions that grab the POV from the eyes as well, i think?
yeah that's what I've been trying to use GetPlayerViewPoint. I'm just trying to get the z value so I can set my camera there
Or, just put a socket on your mesh and call it a camera socket
So I was wondering if you can now access access session info and get a custom server name using blueprint? About a year ago I was told it wasn't possible in blueprint alone. Has their been any improvements? Right now I have it where the host of the server can enter a custom server name and everyone can see the name once in the game but I wish I could allow players to access that name before joining the session. I know I can use the "Advanced Session Plugin" but I was trying to made a game with no c++ and no plug-ins.
I'm not currently join on the Deckate server. Can you tell me why? I'm working on a project with examples of shooter games.
Hello, maybe do you have problems with this:
UPackageMapClient::SerializeNewActor Unable to read Archetype for NetGUID ? After that my client is getting disconnected from the server, any idea?
Hey guys, I have a quick question about listen servers and ue4. Afaik the process for starting a listen server in UE4 is to use the command open *map*?listen However this forces a hard reload of the map. So this got me wondering if there's a way that UE4 can start a listen server without reloading the map?
IIRC no
theoretically yes (you could manually spawn a net driver and fix all the actors who did things assuming standalone) but that's not a normal thing to do
Well my problem is that I would like to use a listen server for my game but when the host disconnects I have to do a host migration and this usually causes a hitch in the gamestate for a few seconds
So I was planning to have a "co-host" start running a dormant listen server that keeps a track of the gamestate
so if the client DCs then it can just move the clients to the new server
host migration is much more involved than that, what about all the data that wasn't replicated or actors that were out of scope for the client supposed to take over?
Well I guess you would have the RTT in packets lost but apart from that wouldn't my solution work?
What else would you have to do to combat that issue other than what I said?
you're planning to have clients rejoin to the new host right? as in, they'll reload the map and join that new instance of the game
No, I was hoping to somewhat be able to drop the current host and just start receiving packets from a new listen server
So I guess you would still have to wait for a handshake and there may be some discrepancies between the client and server gamestate
doing it completely live would be... hard... because the new server won't have your replication state and the netguids won't match
it'd replicate a second copy of the players and player states and everything else to you
yeah that's what I meant
So the whole gamestate would be sent to the co-host
like quake does almost
so that they have the entire copy of the gamestate from before the RTT
no I mean, your client will become extremely confused with multiple copies of game objects existing when you try to change which server it is connected to without reloading the map
Ahhh I understand
I would go as far as saying unreals networking was not designed for host migration and you're better off not trying to make some haxx
having the new server and the clients reload the map would be one way of ensuring it is at least working
Yeah, I could get a host migration to work like that quite easily I think but then people join and leave games all the time and I think if hosts are consistently leaving and having to migrate it might get a bit annoying
Am wondering how Call of Duty tackled this as host migration seemed rare
: when you start a match it starts a dedicated server on your machine behind the scenes and when you exit the match it keeps running
Oh shit lol
Is that actually how they do it?
That's an amazing idea
why didn't I think of that
Ahhhh that's such a good idea
And then it just runs in background until the match finishes I guess
and then the game can do a reload
and switch to a new host
@fleet raven Can you not put like a "Kappa" or so behind the text? :D
I mean
usually implies it is nonsense
that said this could actually work π€
Yeah and could actually put you into the situation where people are really not happy
I mean I figured the only downside would be client performance and latency
- if the PC shuts down the server is off anyway
Dude, if you play a game
And you want to stop
Yeah if you do an alt f4 then it would have to do a hard migration

Imagine someone with limited internet :D
Oh I was thinking of it as in if somebody leaves without closing the game
Not to actually keep it going in the background of the PC if the games closed
If the game closes then you would do a hard migration
nah it's an extremely stupid idea anyway
imagine someone with a slow pc doing that and then it lags their client
Yeah but that person would have been the host of the game anyway?
Tomorrows News: "UE4 used as a bot net to host DedicatedServers on Client PCs."
not if it keeps running after they leave
:br_big_brain: Find out what clients have static ips and highest uptime. Use these to host DedicatedServer for other players to save hosting costs.
Who needs Amazon Servers 
this actually works if the clients like the game and are aware of the option
people make player hosted dedicated servers on vpses and stuff all the time
that's true
hmmm
Well what would you say the best real solution to this problem is then?
Just not use UE4 networking and go with something like Raknet P2P instead?
If you really need Host Migration, yeah you might need to go with something else than UE4's networking
But that is easier said than done
I would just build a game that doesn't require host migration
I'm leaning towards doing Zeblotes big brain idea right now
please don't actually do that
but it's a good ideaaaaaaaaaaa
It's not :<
Ima look into manually spawning a net driver as a backup host, Ty for the help and advice guys π
Hey, i'm trying to replicate a Countdown timer for my shooting game, I have the timer working, but it cannot get it to replicate on all machines. I currently have it set up as so;
The Event 'StartDownDownTimer' is called from the playercharacter currently for testing purposes
Is that in a GameMode?
Yep
GameModes can't have RPCs
...
Please don't tell me you watched the Lobby Tutorial from Epic Games Youtube channel
probs not
Either way, it's not supported cause the GameMode doesn't exist on clients
You can't call a ServerRPC in it
And what is "MainScoreBoard"?
Okay, so in which class shall i store the variables and events for the countdown?
The usual approachis to have the Timer run in the GameState
on the Server only
Or to have a timer on everyone in the GameState and the Server replicates the timeRemaining every 10 seconds via OnRep to keep things in sync
Okay, so i tried creating a new gamestate and setting it in the Gamemode, and when i click play, no player or ui spawns
That's something you gotta figure out. I have 0 idea what you are doing in general
Also if the naming isn't wrong, "MainScoreboard" is a widget or?
Yep,
ahh okay, thats why i was getting an error ealier
The base idea is:
In GameState on BeginPlay: Start a Timer for everyone locally (including Server) that loops every second.
Have a "RemainingTime" variable that gets reduced by 1 every time that timer calls, until it's 0.
Have a "ReplicatedRemainingTime" variable that is set to RepNotify.
In the RepNotify function, set the RemainingTime with the ReplicatedRemainingTime value (that's for keeping stuff in sync).
The Server (check with SwitchHasAuthority) in addition to reducing the RemainingTime Variable in the Looping Timer Function, sets the ReplicatedRemainingTime Variable every time this here is true:
"RemainingTime % 10 == 9"
That makes sure that every time the Timer hits something with a 9 in it (29, 19, 9) it sets the Replicated variable on the Server, which causes it to call the OnRep function and keeps clients in sync
In the UI, your scoreboard, you get the GameState, get the RemainingTime and use that to display stuff
Both RemainingTime variables can be an integer