#multiplayer
1 messages · Page 553 of 1
You may need to do it manually
I've had to do that to override 'private' properties in the actor class a couple of times
TF for reflection
I also noticed OnRep_Controller doesn't always call
@thin stratus That'd explain a weird bug I've been facing where player input never gets enabled, as I enable it on the OnRep_Controller. Fckkk
But it happens quite rarely
@chrome bay Yeah it's not booting up with just the double register
Guess I have to somehow do it manually.
Yeah there is a way
Btw, what I did to get around this sort of issue (when I rewrote the initialization process) I used a transition map to the ingame and spawned any actors I considered to be core for my game there, and waited for clients to send an I'm Ready signal meaning that they have everything they need (based on BeginPlay and/or OnRep calls from this core actors). Once all clients have sent their signal, TransistionGameMode calls the seamless travel to the ingame
DISABLE_REPLICATED_PROPERTY(AYourCharacter, Controller);
DOREPLIFETIME_CONDITION_NOTIFY(AYourCharacter, Controller, COND_None, REPNOTIFY_Always);
That works, I guess
They allow registering disabled variables
But not registering something that is not disabled
Sooo yeah
Do you know how can I disable the 60 second timeout that UE4 has built-in ?
or at least increase that timeout threshold?
I cannot switch gamemodes between levels in the packaged version of my game, and it only works in PIE, how can I fix this?
I am using Game Mode Class Aliases
Anyone know if the grid spatialisation feature of the replication graph factors height into the equation?
Like, is it mostly x,y or does it also factor in z?
Hi all - In editor (not with Clumsy) what's the best way to simulate lag. It doesn't appear that the command Net PktLag=200 works anymore
I've found reference to network emulator profiles in the c++ for the engine, complete with Editor Widget for selecting said profiles, but cannot find the actual menu in editor 😂
Typical - manage to find it straight away after I ask!
I want to change those values by setting them on DefaultGame.ini . How do I achieve that?
Basically, how do I point to the NetDriver file in [Section]?
[Section]
Key=Value
Based on this https://docs.unrealengine.com/en-US/Programming/Basics/ConfigurationFiles/index.html
Text files containing property settings for configuring gameplay or engine behavior.
NetConnectionClassName=OnlineSubsystemSteam.SteamNetConnection
bNeverApplyNetworkEmulationSettings=true```
somethingl ike this
is there any documentation on AGameNetworkManager? I'm trying to disable client movement checks
also i keep trying to check these two off but they keep unchecking
NetConnectionClassName=OnlineSubsystemSteam.SteamNetConnection bNeverApplyNetworkEmulationSettings=true```
@meager spade I'm using the built in NetDriver, I've not specified anything on it so far. I'm running the game on a cooked build. Any idea how to point at the default NetDriver?
I'm starting the server with a command line execution like:
UE4Editor.exe "%CD%\..\Immortal.uproject" /Game/Immortal/Maps/PreGameLobby?GameModeConfig=FourPlayerMode?MapName=Frontiers -server -nosteam -log LOG=ServerLog.txt
And clients with:
UE4Editor.exe "%CD%\..\Immortal.uproject" 123.456.789.1 -game -log -Secret="1234" -ResX=1280 -ResY=720 -WINDOWED
With 4.25 I can't seem to get a dedicated server process to be launched so I can see the server output when running PIE
Am I missing something?
I would think that would launch a separate dedicate server window so I could see the server output...
OMG, where can I find any information on what a NetDriver is, how to properly use it, how to modify it, or at least some light on how the hell am I supposed to deal with it. It's been over a day making almost no progress. The lack of either official documentation or community resources is serious...
a net driver manages incoming connections and replication for a multiplayer server
why do you need to modify it?
I want to increase the timeout threshold because we're running a completely unoptimized build and having clients drop out during game initialization
I want to change those values by setting them on DefaultGame.ini . How do I achieve that?
@fleet raven https://discordapp.com/channels/187217643009212416/221799385611239424/728645607048085525
But anyways, I'm curious as to why this is exposed for me as a programmer. What can I get out of it?
[/Script/OnlineSubsystemUtils.IpNetDriver]
ConnectionTimeout=30.0
Thanks a lot !!!!
How do you know that IpNetDriver is the right one though?
Where's that specified as the default one
that's the default unless you're using steam sockets or something similar
I'm running with the -nosteam flag, so I bet I'm not using any steam related driver
Also, how do I know that the right module is OnlineSubsystemUtils? What tells me that?
this is set up as the default in BaseEngine.ini NetDriverDefinitions=(DefName="GameNetDriver",DriverClassName="/Script/OnlineSubsystemUtils.IpNetDriver",DriverClassNameFallback="/Script/OnlineSubsystemUtils.IpNetDriver")
Is that tribal knowledge or can I learn it from looking at an specific place in the engine source
Isn't what I highlighted the module?
Now that I think about it I've read somewhere that things like ENGINE_API are module declarations
that also tells you the module
but not all classes have this
that macro is used to export the class and its methods outside of its module
Ok, that goes a bit outside of my knowledge... Is that useful so that if I compile the entire module as a DLL, things marked with say ONLINESUBSYSTEMUTILS_API will be the ones publicly exposed?
yes
trying to use a function that is not defined in the header and not marked with MODULE_API from another module will give you a linker error
Interesting... Feels good to understand some of the dark magic MACROs
marking a class as MODULE_API has the effect of marking all of its functions
Thanks again! After reading this, most of my classes have the GAMENAME_API for no reason... as I'm not building any other module
Does that incur in any performance impact during builds?
Oh ok, that's what I wanted to know
Last question, Why do I always start with /Script/ when specifying these classes ([/Script/OnlineSubsystemUtils.IpNetDriver])
Will all my config files start with /Script/ModuleName.ClassName or could that change based on something?
As I'm thinking of exposing some of my custom classes to this sort of configuration in .ini files
how to replicate Ultra Dynamic Sky?😩
it would be /Script/YourGameModule.ClassName
like /Script/Kaos.MyPlayerController
dropping the Prefixing letter (A/U)
and what config file it uses is based on the uclass Config specifier, for DefaultGame.ini you would use Config = Game in your UCLASS
/Script/ModuleName is the package that your class will be exposed in (automatically generated by UHT, never something else)
I think you can somehow specify that the config section should use a custom name instead of the path to the class, but this is very rarely used
Thanks again to both. I was already able to tweak the config values from IpNetDriver 🥳
Can someone help me figure out why this is working when I have one player, but not when I have more than one?
That event is in my GameMode blueprint and gets called when the host presses the start button, seen here
If I'm the only one in the lobby, it works totally fine, but if I add another player, then we both get stuck in the loading screen forever and the servertravel doesn't work
It's an exact copy of the steam multiplayer demo
Nevermind, its because i wasn't launching the game as stand alone
is ForceNetUpdate relevant to RPCs?
Alright, thanks
Wondering if someone is able to help me out here? Currently trying to make a transform on both server and on client (exact same nodes). However, for some reason on the client end the rotation is completely off compared to the server and I have no idea why. I can post a screenshot if that will help.
do you have smooth sync plugin? Without seeing anything, that would probably get you what you want with minimal effort
When I use mouse left it doesn't work, I think is a simple problem, does anyone see an error here??
What bp is that in? Actor, Level or what
Widget
Didn't even know that plugin existed, ill most likely look at getting it would make things 1000 times easier, thanks for that.
yeah it was free a month or two ago. it works instantly with barely any setup
@rigid summit did you try add some print strings to debug?
When I press with my Controller or Enter it works, but with my Mouse click it doesnt
add a print string to see if it is registering every time
try on pressed instead of clicked and see if there is a difference
OMG thanks
Will a multicast from gamemode play on all clients regardless of relevancy / distance / etc
Any RPC on the GameMode will never be called on Clients.
Client do not have a GameMode
Only the Server has a GameMode
use gamestate instead perhaps?
does AWS work fine on html5?
Hey, I'm having an issue with replication.
The clients keep shooting their projectile to the Location XYZ 000 instead the clicked actors location.
Does anyone know how to solve this ?
If SetLifeSpan is set on the server, does it also need to be set on the client for an Actor to be destroyed clientside?
destroyuing an actor does replicate
As far as I know, you dont have to
and setlifespan is just destroy ona timer
The server will call the logic to destroy the actor on given clients
Thank you!
@weary badge and how do you imagine the RMBTargetLocation gets to the server?
That's basically my issue.
I tried setting it on replicate
and tried hooking it to a custom event that is run on server
You aren't actually sending that vector though
You are using the Server's version of that vector
Which is 0,0,0
You'd have to pass the vector as in input to the RPC
replicating only works server => client
in order to send any data to the server, it has to be as a payload on the server RPC
Zlo, in general should SetLifespan only be called on the server?
Or does it not matter if both client and server run the same "Disable" function
That sets lifespan
I can gate with an authority check but not sure if it just doesn't really matter
Say for example a projectile that has exploded
There might be a second or two before it should be destroyed to fully play out FX
I think best practice might be if the actor is still replicating and not torn off, set the lifespan / destroy on server only
If it is torn off then destroy on both client and server
i tend to hide the actor/disabl;e collisions
on each machine separately, when its done
and leave it hanging for a few seconds
Yeah I do all the visual stuff on each machine too, do you tear it off there too and destroy manually on each client?
Or just destroy on server after a short delay
@winged badger @grizzled stirrup Thanks
Took me a bit of time, but the solution was fairly simple
Basically I had to have an input on the event that holds the value that I want to pass on to the server
@grizzled stirrup we don't tear off
we just hide, then have server repl the removal
Thanks!
I guess tearing off is only really useful if you have an actor that will be around for at least a few seconds but is completely network irrelevant like a ragdoll that doesn't instantly disappear right?
Has anyone successfully tested steam "advanced session plugins" for multiplayer? Does it only work locally? Any tried and tested methods for online multiplayer?
@trim gale Yes, it works locally and online multiplayer, and surprisingly painlessly
its very easy to get up and running
heres an awesome tutorial series to get started with if you need it https://www.youtube.com/watch?v=d4gQSXALyHU
Hey there DevSquad, today we setup our project to work with steam multiplayer, setting up visual studio, the advanced sessions plugin along with integrating the steam API into our Unreal Engine 4 project.
At the end of this video we'll be ready to start working on some multip...
hey @jovial stream, thanks for the link, I tried setting it up using: https://www.youtube.com/watch?v=ke3kmK6bvT0&t=760s, seems it's out-dated.
Hey all,
today we are gonna work on the integration of the Advanced Steam Session Plugin
[/Script/Engine.Gam...
I tried the exact same video and it didnt work for me either lol
Oh damn 👍😅
guys, I wana ask you all about something that's been really bothering me and planting seeds of doubt in my design: do you feel that if you do 'what the engine wants you to do', the results are often less performant than your own re-invention of the wheel? I found this was the case when implementing replication for physical props (server simulates, and props should smoothly interpolate between their states on the client)
for example in this^ case, I'd expect what the engine would 'like me to do' is have each physical object take care of its own, by sending out a multicast of position/rotation data, receive it on the other side, and interpolate through a snapshot history, which resulted in: https://gfycat.com/EnragedThoughtfulFlyinglemur
a specialized solution will always outperform a generic one
instead batching them and passing their data through a manager actor results in this: https://gfycat.com/WeeValuableHoatzin
Yes @fleet raven this does make sense
you just have to decide if the better, specialized solution is worth the time it takes to create and maintain it
But then the question is raised, why is there even something the engine 'expects you to do'?
where do you see the engine expecting you to do that?
like, the documentations / code comments / UE4 projects' source codes all suggest that each actor takes care of its own
the expected solution would be to tick "replicated movement" and use the physics replication system
(I didnt know there was a physics replication system :V)
how does it perform? does it have jitters / any specific artifacts?
I've not experimented enough with it to say
I have an issue where I have a variable in my playercontroller called Investigator. It's just a string. When I change it as the host, everyone can see it change in the UI. But when I change it as the client, the server doesn't see it. As the host, I have an array of connected player controllers, but when the client updates theirs, these changes aren't sent back to the server. I've made sure the variable is replicated. Any suggestions?
Are you sending it to a game mode? PCs can't talk to the game mode directly so you need to send the information through a game state
Or maybe a player state one of those two
Ah thats it
Yeah I just tried to get the game mode from my client's PC
and it says cast failed so
looks like that's it
the client can talk to the GameState?
The way it's setup now is, on EventPostLogin in the GameMode, it takes that player controller and adds it to an array ConnectedPlayerControllers. In the Lobby, when a player changes their Investigator name, I save it to the investigator variable in their PlayerController, then tell the GameMode to loop through every PC in the ConnectedPlayerControllers and update the names for each player. I guess the issue is that when the client changes their name and that variable gets set to the new value, their PC in the GameMode's ConnectedPlayerControllers array doesn't reflect that new value. Should I move this stuff to GameState?
Yeah take a look at the network compendium for a better description
issue is tutorials don't really go into game states and player states so the only way to get a grip on this is a 111 page document which is pretty easy to forget
lol yeah the epic tutorial does all online stuff just with game mode
One day I will read past the first 10 pages 😄
So every player's PlayerState is visible to every player?
Well, I'll just read the doc and figure it out
thanks
That's what the pie chart says
Very Helpful
Hi, I keep seeing people in here talk about Steam and Unreal integration. What exactly does Steam provide if I may ask that’s useful in Unreal?
As in for networking :)
those are networking besides achievements
but it also gives you more lobby functionality
inviting friends from your friends list etc
but as far as actual netcode
nothing that I know of
Just more tools on the front end
Here's the page on the subsystem
An overview of Online Subsystem Steam, including how to set up your project for distribution on Valve's Steam platform.
Thank you, going to read that 👍
I see this being mentioned in there.
Lobbies are essentially chat rooms that exist as peer-to-peer instances on Steam's backend service.
Does that mean listen servers can send data to clients through Steam, thus functioning as relay, or did I understand this wrong?
Also, what is the ‘shared cloud’, is that the Steam workshop?
shared cloud uses ISteamUGC in the Steam OSS, so yes
also that does not imply anything about relays, but steam networking relays are supported through the Steam OSS
Sooooo
physics code enters the network prediction plugin. not look at the changes yet, but is very interesting
https://github.com/EpicGames/UnrealEngine/tree/master/Engine/Plugins/Runtime/NetworkPrediction
hey all. Got an replicated PvE set up I am working on. In my player I wrote some stuff to calculate damage after defences. It ran without issue. I then realised the enemies in the environment would need to make the same check. Since they share the same base class, I just moved the calculations over to the parent class. Now, when the enemy attacks it works fine (for the enemy), when the player attacks, it skips over the calculation. Could use some help seeing where I made my mistake.
just ran it in listen server mode - and found 2 issues. The client has the same issue as the client in the dedicated. The second issue is the player who is server does double damage
@chrome bay 😮 that's sexy
@novel siren without seeing the code we are just rubber duckies
It's currently BP for prototyping, I worked out what is causing the listen server issue (so we can ignore the cause). Screening it now
I flagged my stupid mistake on the listen server - and we can ignore the false branch on the hit. I cut out the calculations for the collision areas and the drawing the debug sphere (all of those work properly and are not the issue). The node in the red box towards the end is what is not running - it just returns 0, with a break point it goes right over it.
On the server, for the NPC there nearly the same set up (a few minor differences because the enemy calculates base damage differently) but it calls the same defense check and it works there
you calculate defenses if your target is NOT dead and can NOT take damage
aside from that how do you get EquippedAttackPower and AttackType?
it is where any network issues might occur
and whats the end result?
again prior to making the function in the red box, the code in there was directly in the chain and it worked
the value 70 goes in, I expect 64 coming out.
if I hit frame skip or step into, it does NOT enter the function it goes past it
which means that function might not be the problem
the branch immediately preceding that is very suspect
it shouldn't, not if the functionality is what the function names imply
ah the name is slightly off, that should say cannot take damage
actually what it should say is 'bIsPlayerInvincible'
and attack type is also valid?
yes
I expect regular and get regular
and the target is valid
Interesting now it is actually going into
(I unhooked the pins and rehooked them and it began to 'work' again)
However now the calculations are fouling up. 70 + 0 some how = 1
been hot reloading by any chance?
About to try that (got distracted by doggo needing to go out)
okay so it is now actually running the function, yet the math is still off
hey guys so im just aware that breplicates is deprecated ..what else can i use that similiar to this
and now it is not calling it reliably again...
SetReplicates()
thanks you is it SetReplicates(); and i dont have to do = true?
its SetReplicates(true) or SetReplicates(false)
Interesting.... found the issue I think.... it is coming from something unrelated, seeing if I can get a better fix in
@winged badger thanks man it worked
well @winged badger your question earlier was right - it wasn't setting the variables correctly (I updated how they were set and it wasn't passing the weapon damage correctly). Fixed that. Now there is a new error though; it calls the damage event twice (something it wasn't doing before)
never mind that new error - that was me forgetting to change something from when trying to resolve the original error
when your bugs start cascading, its usually good idea to take a break 🙂
eh the bug was me being stupid - I thought the initial bug was due to an event not being the right RPC type so I tried a fix using another type, it didn't work. So I called both events. Then I forgot to delete the 'fix'
so I am back to functioning at where I was before with the correct attacks being set. Joys of refactoring and getting an unexpected error
how do I build cook and package my project from commandline ? for WindowsServer and WindowsClient
I have a UMG property bound to a variable in the GameState. It works fine but the issue is that the GameState loads a little bit after the PlayerController has connected and displayed their menu. So my Output Log says "Error: Accessed NONE for UMG Node" like 10 times because it's waiting for the GameState to load. After the GameState loads it's totally fine. Ultimately it doesn't impact gameplay at all but it's really annoying to get an error spammed every time. What's the best way to like, pause until all of the modes and states have loaded?
This only happens to Clients joining the lobby, the Host does not get this issue. I think it'sbecause EventOnPostLogin triggers before the PC has even began to create its objects on the client
just have a timer
which checks if GameState is available
or have a init function when the gamestate is replicated (if you use C++)
if GameState not available, start timer for .1 second, check its there if not, start another timer
Makes sense
thanks
Also, I'm running into an issue now. When I start a game in a new editor window and I create my lobby. No problems. When I start a game in 2 new editor windows and create my lobby, I get these errors:
LogNet: Error: UEngine::BroadcastNetworkFailure: FailureType = ConnectionLost, ErrorString = Your connection to the host has been lost., Driver = GameNetDriver IpNetDriver_88```
Anyone know why my actor isnt being destroyed
void AMOWPickup::OnPickedUp()
{
Destroy();
}```
```cpp
void AMOWPlayerCharacter::ServerPickUp_Implementation(class AMOWPickup* Item)
{
Item->OnPickedUp();
}```
Hi,
I am trying to get ragdolling to work in multiplayer but no matter how I set it up it only happens on server.
is there any tutorial for doing this in c++ ?
Also, I'm running into an issue now. When I start a game in a new editor window and I create my lobby. No problems. When I start a game in 2 new editor windows and create my lobby, I get these errors:
LogNet: Error: UEngine::BroadcastNetworkFailure: FailureType = ConnectionLost, ErrorString = Your connection to the host has been lost., Driver = GameNetDriver IpNetDriver_88```
This seems to have 0 impact because the host and the clients can still join and everything seems to be working in my lobby, but I'm worried about these errors later on.
I am sending UDP data to my Unreal program using this plugin (https://github.com/getnamo/udp-ue4). I'm receiving the bytes from UDP in Unreal. but when I 'Print String' from the bytes it's a bunch of jumbled nonsense. I'm trying to organize the data from UDP within Unreal as a structure of values but I am lost on how to do that using blueprints. The datagram structure being sent externally by UDP is:
//
// x,y,z position in centimetres, yaw, pitch and roll in degrees...
//
#pragma pack(push, 2)
struct THeadPoseData {
double x, y, z, yaw, pitch, roll;
long frame_number;
};
#pragma pack(pop)
Any guidance would be greatly appreciated. Thanks!
question regarding replicated variables. lets say i have a replicated variable called number with a value of 5. then on the client i set that value to 6, then later on i set the replicated variable to 6 on the server. will it perform the replication event using bandwidth on the clients where the value is already 6 on the clients? or will it only run on the clients where the value is still 5?
Hey, I set up a very basic multiplayer. And with my build I can connect to it locally with 127.0.0.1
But I can't seem to connect to it remotely from another computer on another network even though I've port forwarded it
Shouldn't i just be able to use the command "Open ipadres:<port>"
@ocean geyser the server will still check every client
to the server, every client will have5
it doesn't know one specific client has changed it to 6
so it will send that property to all clients
roger, thank you
Am I right to understand that RPC is the only way to replicate from client to server, but also that it's recommended not to use too many RPC? If so, if replicating client VR tracking to the server before the server multicasts it back out to all the other clients, do we just kinda deal with that? It would be per-tick essentially, or perhaps there is some sort of NetworkTick() type of deal that only calls 20x a second or whatever the replication rate is?
RPC's have no throttling, you have to throttle send rate yourself - but yes they are the only way to send data from Client->Server
The client must also be the "owner" of the actor calling the RPC
Also suggest avoiding multicasting to clients, use replicated variables instead.
@safe spade you could use a timer for the RPC's. for example have a replicated variable of a FRotator (or whatever type). then on the client you use the timer to RPC the data to the server every X milliseconds or however fast you want and then the server updates that variable and it gets replicated down to the clients to prevent doing a multicast
Hmm, timer makes sense I guess.
by multicast I just meant rpc owned local pawn -> server, then server -> all clients via replication, not more rpcs
how is the camera manager defined in a multiplayer setting? do all PCs create their own and it is invisible to the server?
I am using the Advanced locomotion system for MP and the default map doesn't seem to have any issues however if i load my own map and player join one at a time, for some odd reason the camera manager from the server side jumps to the new player's pawn as a client. But the clients' cameras do not jump...
@green delta The PlayerCameraManager follows the same rules as the PlayerController, it is spawned by the PlayerController on the Server (for each Player) and on the Players machine (local only).
The PlayerCameraManager is not the Camera itself, the Viewport will render from whatever is the current ViewTarget, which can be a Camera, typically if no Camera is explicitly being used, the PlayerController itself will be the ViewTarget.
The PlayerCameraManager simply manages the active ViewTarget and allows you to handle Camera specific operations.
I see @fossil spoke thank you. so my issue is that my camera manager is triggered by something specific to the server side to re-assign its follow pawn... what a headache
wait does the server possess the pawns of the clients? is this what authoritative servers do???
PlayerControllers possess Pawns. The PlayerController exists on the Server and Local Client, possession of a Pawn happens on the Server side for the PlayerController and Pawn, the Client for which that PlayerController is owned (locally), will be told to also possess that Pawn.
well then i am now lost :/
In this camera manager, the PC tells it what pawn is controlled
server, for some reason, calls this when a client joins and nabs his pawn for the camera manager
however it makes no sense, I even called the controlled pawn of whatever owning player controller of the camera manager is and i am still getting this behaviour
hence why i asked if the server possesses the clients' pawns...
Animation Blueprints should already have access to the Pawn.
Assuming that the Anim Instance is being run on a SkeletalMesh attached to that Pawn.
Nothing in that code says to me your using the PlayerCameraManager though?
So thats a bit confusing.
Also keep in mind that the ControlledPawn is Replicated, meaning that it may not be available immediately after a call to Possess it from the PlayerController.
It will take a little bit of time to get populated on the Client.
Is OnPossess called on the Server side or Client side?
Also how/when is it being called?
How do you implement multiplayer in a way that the dedicated server is not called until you enter a specific map? My current implementation only works if I start from a specific map, and doesn't work if I run it from splash screen/main menu.
@fossil spoke So this BP is in a custom camera manager that is called by the custom Player controller. The anim instance in question is for the camera manager.On possess is called by the respective controllers that created this camera manager. I believe it is called by whoever the PC is. My confusion is that the server calls it when a client joins. In the PC, this is just done as you possess your pawn.
The On possess from the PC is called in the begin play
Sorry for the delayed responses, got a baby on my hands ^^"
That seems like a very silly design, im assuming its not your code?
nope, it is the Advanced locomotion code
Yeah well thats silly to assume that the Pawn is possessed immediately.
Your probably better off talking to the Author of the Plugin and asking him what his intentions was, so that you can work with that or adjust it to your needs.
i wish
he made it free and ran away
lol
I disconnected that node to test and it did not matter.... the client had no camera and my server still stole his pawn...
so something else is afoot
thanks @fossil spoke
I get these errors when I host a lobby in standalone, but not if I host in the editor
LogNet: Error: UEngine::BroadcastNetworkFailure: FailureType = ConnectionLost, ErrorString = Your connection to the host has been lost., Driver = GameNetDriver IpNetDriver_88```
They don't seem to affect anything though, am I missing something?
@green delta Just so your aware, the PlayerController has overridable functions for when a Pawn is possessed/unpossessed.
Correct me if I'm wrong but this says all client's can see all player states correct?
I'm trying to create a widget on every client that has the information about all players in the game. I thought I could just pass each widget a PlayerState and I would be able to pull data from there. On the host, it works perfectly. But on the clients, they all say returned none when trying to access PlayerState. They couldn't even access their own.
Sort of at a crossroads here, can't figure out the correct implementation. My GameMode functionality is working when I launch the game from my multiplayer map, but when I launch the game from the splash screen/main menu maps it simply doesn't function.
I believe this is because the dedicated server is running on the main menu/splash screen maps. I don't want it to run, I want it to only run on the specified multiplayer map.
@clear copper it's correct. You might access it wrong or too early.
@rapid barn Then change the default server map in your project settings under maps and modes
Hey everyone, Im following a tutorial for chatting and im having an issue for all the clients where it will only update the messages if press on the channel tab everytime and im not sure why its doing that
This is the part of the code that spawns the widget and binds to on channel changed and on send message
This is supposed to push the messages to the client... which isnt happening unless i press on the channel tab
If anyone could help me or at least point me in a direction to know what is wrong or how i can find out which part of my code isnt working properly that would be great... Thanks
Looks like you only actually retrieve them if the channel is changed
This gets them if you change the channel
This here is sending the message from client to server.
What happens afterwards? Somewhere after that it has to tell the clients what the message is
@tacit pecan
What i understand from the tutorial is that this is sending the channel to watch for messages from ... then at the end of that line of code its supposed to be getting the messages and pushing it to the client... right?
Then this communicates with the widget to add the message to the text box... however its returning none for the chatbox on the client side maybe thats why its not updating?
@thin stratus
That looks more like it's the code that reacts to you pressing a different tab
It just says "WatchChannel"
When you change the Channel you are watching by clicking a tab, it retrieves all the messages from that channel
@tacit pecan
but on the server it updates the messages normally so im guessing the code is there but the implementation for the client is off right? Can you tell what is missing from which part? @thin stratus Ive been at this for 2 days and im just not getting it
I already asked you what the "SendChatMessage" does
Oh sorry didnt see that
It calls this interface event in the game state
Which executes this function
@thin stratus
And what does NotifyChannelUpdated do?
Yeah that's where you should receive your messages
So I would suggest putting some print strings in and checking if this actually calls and how the Messages array looks like
it doesnt call on the client
i tried adding a print string in that final screenshot and i got the first message in the array and printed it... it says
Server : Hello
thats it, it doesnt register anything for the client
@thin stratus
What is that code in?
PlayerController
Could you change that event from being a Multicast to being a ClientRPC?
Because a Multicast in a PlayerController makes no sense
Yes this last part is in the player controller
@thin stratus Client RPC meaning on owning player right?
I did that but its the same i have to press on the tab clientside to get the new messages
it's still a good change
Put more print strings into the chain. See where it fails
Is the Clients PlayerController even in that Array etc.
You will have todo some debugging. I can tell you already that I don't know why it fails from just this.
Ok when you say "fails" that means that only the server is calling the print string right? @thin stratus
The player controllers array has both of my players
What's the best way to test multiplayer with a friend?
@near bison setup a quick and easy direct ip connection menu
can't I do that from the console?\
open ip:port
And also does my game have to be packaged?
How can I differentiate between server/client in subsystems?
GIsServer/Client globals dont seem to be working
@near bison No, but you have to at least use Standalone. You can't connect from Editor to Editor.
Since you are testing Steam, you should already be aware of that
On that note: Steam will block your direct IP connection iirc. So if you want to do that, go back to subsystemNULL for now.
Since you are testing Steam, you should already be aware of that
@thin stratus It works when I package with steam
Yeah but you don't have to package, as long as you and your friend have the project on the same changelist
Then you can just launch standalone
hello! i need to add the GameLift-specific code to my project gamemode.cpp! but when i open the solution of my project i have (myprojectGamemodeBase.cpp) and not (myprojectGamemode.cpp)...i have something wrong with my project?
@unkempt tiger depends on the subsystem
WorldSubsystem can easily figure it out, as can LocalPlayer, GI and such
as long as you can get World, you can tell
Hi
Does UE support functional testing in multiplayer? My logic requires few clients connected to server. Can I use Session Frontend to mock these clients somehow?
You can test multiplayer in editor just by increasing the number of clients.
But you should test outside of editor often too, as things rarely behave the same way. Editor is just for testing the basics.
@clear copper it's correct. You might access it wrong or too early.
@thin stratus So in my GameMode on EventOnPostLogin, I am adding the PlayerState to an array in the GameState. Then I am adding a widget for each PlayerState to all PlayerControllers and passing each widget a PlayerState. Works fine for the host, doesn't work for any client. Should that work in theory? Basically I just want a widget for each player on each client so that when hitpoints change for client 1 (stored in the playerstate), all the widgets update accordingly because they have that playerstate
@clear copper Be aware - an array of player states is already available in the game state
And it's automatically managed at both ends
Look at GameStateBase::PlayerArray
"The PlayerArray is not directly replicated"
It's managed automatically at each end
So that just means it's being managed separately not replicated to server then client?
yeah, player states add themselves as they are created/removed
ah ok cool
So the array won't have the same indices on each connection, but it won't matter - it's just a handy place to get to them all
the indices do matter for me though, I need to know who is player 1, 2, 3 etc
I guess I could just add a variable in the playerstate to track that though
and set it on post login
Well, player states have their name and a unique id integer too
Should a lobby server be a dedicated server
Then in game probably player hosted
Is that the simplest way to go about doing multiplayer?
for the gamelift object need to be in the main menu level bp or the gameplay level bp?because my lobby map is inside my gameplaymap; the lobby is one tile sublevel inside my gameplay tiled maps so i have main menu map+ transition map+gameplay map
I would honestly create that in the GameInstance if you work in BPs
Otherwise it gets recreated everytime you swap maps
inside my gameinstance i have the old pb : create session..etc the standard unreal session! i not need them now after i create aws gamelift server and gamelift client plugin's?
this old bp about the game session (create and join)inside my gameinstance...so i need delete those and create new sessions events logic with aws gamelift?
WorldSubsystem can easily figure it out, as can LocalPlayer, GI and such
@winged badger How can a world sub system figure it out?
When a player hosts a game server how do other lobbies running on separate networks know where to look to find thta game server?
Should there be a lobby server which receives a notification from the player hosting
That they are hosting a server
so the lobby can then send that list to other players connected to the lobby server
Or is it possible without a lobby server
Yes, but how would I be able to tell if it's server or client?
Oh
Perhaps with the IsClient()/IsServer() functions :D
Thanks 😅
Oh
Perfect, thank you :3
i create gameliftserversdk and gameliftclientsdk plugin's for my unreal 4 game project and i have some questions about the setup of the gamelift object event
@chrome bay I'm having the same issue. My client's player controller returns NONE when trying to pull the GameState Player Array
the host has no problem
They won't be available immediately
ah
Actors replicate independently and in random non-deterministic orders - there's no garauntee an actor will be valid at the time you look for it
should I put a pause while they load then?
For UI, I personally just tick stuff 90% of the time. For other stuff, it's best to have global events that fire when objects become available.
what do you mean tick stuff?
Using tick to update the state based on other objects
Still not quite sure what that means in this context. Could I not do something like this?
that still doesn't guarantee all player states will have replicated between two queries
Ah that's true
blueprint only?
well, playerarray itself is not replicated
PlayerStates register with GameState on BeginPlay and end there
without c++ you can't override the registration to do a little extra
but
Yeah that's what I was having trouble with initially
you can register them with your local HUD at BeginPlay
the have the HUD forward that to the widget
resulting in the widget getting the playerstate references as they replicate and become available
Hmm, so instead of having the GameMode tell each PlayerController to create their UI and passing the PlayerStates, I just have the client's HUD create it on BeginPlay ?
not quite, having PlayerStates on BeginPlay find the HUD and say "hello, im here now"
HUD calls AddPlayerState event on the widget that needs the PlayerStates when it receives the hello
and widget adjusts accodringly
shame BP can't override OnRep_PlayerState in the Pawn
cause you could have used that
for this, overriding the registration of PS with GS would be better ^
as its not just the local PS thats involved here, i suspect
Yeah, Id like all players to see the states of all players in their UI. So when player 1 takes damage and their HP changes, player 2 and 3's HUD updates because each widget is connected to a playerstate
well OnRep_PlayerState will fire for all the characters tho, not just the local from APawn, but yeah GS would be ok
if that makes sense
Hi guys, I am trying the collab viewer template from a couple of days.
I have just built the sample scene without any modifications.
But the problem is once I host the session others cant join as the servers are not detected(We are not on the same network)
Tried putting the IP address manually, no luck! Any help is really appreciated...
it will, but so will BeginPlay in PS
yeah
no point in cluttering Pawn with PS registration for UI in this case
and the solution is more generic - as in, will not cause problems if you decide to possess some other pawn at some point
PS BeginPlay -> GetHUD() -> RegisterPlayerState(this) or w/e would work. How you identify Player 1, etc, should be in your GameMode, and assigned to each player's playerstate (iirc you needed to know if its player 1, 2, 3 or 4), tho in our game, we just care for name. Doesn't matter if they are 1, 2, 3, 4
you can't get PC indices client side anyhow
well you cant access PC from anything but local or auth anyway
but playerstate could hold a int with player number
based on connection order
engine code to find PC index is basically using FPlayerControllerIterator, incrementing the integer inside the loop and returning if current *It matches the PC you're interested in
so, better not use those for any gameplay logic, as they will also change if someone logs out
The way i did it is just add a variable for Player Number in the PS and OnPostLogin I just assign it there. That's the integer I use to know where in my grid to spawn the widget
well anyway have PlayerState beginplay, get the local players hud, and register itself
seems the easiest way
we generally don't care if they widgets are not in same order on different clients
thats true
doesn't matter in my case either
So by BeginPlay in the PlayerState
the client should have access to all of the PlayerStates in the GameState's Player Array?
or does it just make sure it has access to it's own by that point
Not all of them - only that one
Player States are all individual actors themselves, replicating individually.
and each calls BeginPlay on each machine
ah
after it has replicated, obviously
isn't multiplayer fun 😄
It's killing me lol
the timing of it all is tough to wrap my head around, but i think im getting it bit by bit
To be honest if you're working solely with blueprint, I think the quickest approach will be to tick the object that needs those player states - and just check that array each frame.
It feels very gross and it's far from the most performant method certainly, but it's the most straightforward.
that approach gets expensive fast if it becomes a habit
that sounds very intensive no? constantly checking?
When a game client is packaged does it have a default ip it connects to or does the client have to specify and where is it specified is it just from the terminal?
yeah
UMG binding functions are ridiculously expensive
Oh yeah avoid bindings like the plague for sure
ugh
lol
well
if that's the case
i could go back to what i was doing before
which is whenever something for a player changed
that widget was just reset with new values
i thought binding was actually better
If you want to avoid tick, put an event in your game instance class or something, which each player state broadcasts during it's "begin play"
And have widgets grab and bind to it
That's probably the closest you can get to some kind of global event system in blueprint alone
Makes sense
can be done directly via HUD for BP UI
yeah
HUD will grow... large, but no avoiding that really
yeah that's fair
back to UMG for a sec, do you mean avoid bind functions or is binding to a variable equally expensive? Like if i have Text that displays player's current score, should I be directly setting that text value or can i bind it to the score integer variable?
😮
Ticking is honestly better than those
they're so easy and literally every tutorial for epic uses bind like its their job
lol
They're not so bad when you only have a few
ofc it does
but if you go crazy and your project is full of them, RIP
their programmers have better things to do then making tutorials
so they are made by community managers and such
Id say at any given time, there's probably only going to be 16 bindings on screen. 4 players max and they have Name, Health, Score, Resources.
generally, if you have just few pieces of UI on screen, and its not a "play" scene
then it deosn't matter if they are expensive or not
since you'll still manage 200 frames a second
but for stuff like ingame HUD? avoid bindings at all costs
just to put things in perspecitive
a UI adequate for a MOBA game done completely by function bindings will take around 7ms game time
meaning that if you had nothing but the UI, you're already capped at 144 or so FPS
add a game to it and suddenly you're capped at 30
they are the work of the devil 😄
why is binding so expensive? Is it jsut constantly hitting its function/variable?
so tempting, yet so evil
yeah i've been using them all the time, but at least they are easy enough to avoid
To be honest if you have the bindings as functions already - it's very little work to hook them all up to your tick function and update the widgets directly.
luckily im making a card game so the UI isn't that intense and neither is what's going on in game
its crazy to me that ticking a function to update the UI is somehow better than the UI's binding system
I can't believe it doesn't update on tick or on change or something
Well the good thing about tick is, it only runs once
everything is better then UMG binding system 😄
what do you mean only runs once? I thought Event Tick constantly triggers
once per frame
if its anything like transform updates on a skeletal mesh? 5-6
honestly, no idea tho
damn
The bindings are also their own separate UObjects, with all the overhead that comes with.
why on earth D:
(not much, but not nothing)
lol
well, this is been insanely informative so thanks a ton
I guess Ill try a couple ways to get these UIs working
for stuff like main menu, it generally deosn't hurt to do bindings
since you won't have enough elements on screen to cause real damage, and there is nothign else going on
Yeah that's what ill stick with but ill measure performance when iget to the actual game
and it will be the first thing to change
if I get stuck, is there any way i could pay for some of your time to maybe screen share and run through it this week?
i have deadlines to meet, so unlikely
Ah, well thanks for the help
asking on discord is always a good option, quite a few people do procrastinate around here
Yeah it's been a great resource
I've gotten better and taking general ideas and applying them to my situation
but i've only been on unreal as a hobby for a couple months so still a ways to go
always learning something new though
quite a few people do procrastinate around here
@winged badger I feel personally attacked
especially considering I just made this
But ye - UE4 Discord community is great (Y)
😄
doesnt work on clients
It does when OnPostLogin is what tells the PC to create their menus
delayed start is best hacndled overriding GameMode functions in c++
i really gotta get better at c++ D:
even better if its after seamless travel from lobby
as then you can wait until all players have loaded to start a timer, that starts the match
yeah i saw that part
unfortunately this is people connected to the lobby
also, does the GameState's PlayerArray always only have 1 PS per client? because my client's array has 3 items in it despite only having host and client in the lobby
Here's what the host created
vs the client
Client has a 3rd, blank space next to the two Agnes portraits
that box is populated by looping through the array
thats why register PSs directly
Does unreal use udp hole punching for player listen servers?
or do the players have to port forward?
you do have a LastIndex node
@twin juniper i have a feeling you're trying to invent hot water there
most games tend to use a service that handles all that for them
like, Steam
Steam sockets can poke a hole through the NAT
When OnPostLogin triggers, does the host have the joining client's PlayerController and PlayerState? Or is there a loading time issue there as well?
and 20 years ago you could count on average gamer knowing how to forward their ports
not so much today
it does, as the PS is instantiated from PC's PostInitializeComponents
@twin juniper i have a feeling you're trying to invent hot water there
@winged badger I see
you would probably not want to hardcode the IP to connect to into the game either
as that would necessitate a game patch each time you want to change a provider
That's what domain names are for really
most games have a master server, which holds IP's to all game servers
spools up/finds an instance, sends back IP and port
(generic terms of course)
Ok now I'm thoroughly confused. I am passing player states to the widget to reflect the player's info. Works great on creation. When the host update's their score, every client sees the update and their widgets update accordingly. However, when a client updates their score, only they see the change. Even though the score is a replicated variable inside their player state that every client should be able to see. Am i missing something obvious?
replicated variables are only server to client
the client needs to tellt he server to update
tho server should be handling all scores
client should never tell server how much score he got
client can do something then the server calcs what score they got
ofc it is
if I use repnotify would it fix it ?
RPC's are sent normally next frame or so
Actors only replicate when they need to based on there replication priority and update frequency
what I have is a struct with many data
isnt it heavy to use repnotify
does
rep notify gets called on server or client ?
yeah I am asking because I need the execution after client side gets changed
Its in cpp
im using replicatedusing
then have the client RPC back once he gets it?
or have the server do a client RPC with the data ?
i mean i don't know what you are doing
but there is many ways to handle such conditions
client can do something then the server calcs what score they got
@meager spade yeah but im testing because the user gets to select their character and name in the lobby. Just easier to use a temp score variable since its a simple integer
I'm having an issue where the host of a listen server can't find their own player controller. Does anyone know how I can fix that?
why can't the host find his own player controller?
GetWorld()->GetFirstPlayerController() will be the listen servers player controller?
i have never ever heard of that before
well in the begin play I'm casting the player controller and saving it as a variable and throughout the rest of the code it feels like it's not finding that variable
it might not be a case of can't find it's player controller it's more can't find save the variable at the start.
huh actually I've just realised I'm only pulling that variable in twice both times it doesn't work. So that might actually be the issue
beginplay of what?
Of the player pawn
Ah good to know!
PossessedBy and OnRep_Controller
are the places you want to cache a pointer
to the controller
OnRep_Controller for client side
That is really good to know, thank you.
is there anything else I should try and avoid doing on the begin play?
also yeah that totally fix my issue
hello guys. Why my client is lagging when i sprint? I think is a replication problem but i don't know how fix
you need to make sure the move speed is the same on client and server
that is not lag
that is error correction
cause server sees you at a different location than the client says it is
Should I let a client update their own player state? Like when they pick a character? Or should they pick a character, and tell the server and it updates their player state?
Right now I have a UMG with characters, when the client selects one, it gets their PlayerState and sets the Character variable.
@meager spade thx for the reply. How can set correctly the speed for client and server? Run on server and after run on owning client?
How can I check if my actor is owned by the client running my code?
Is there some kind of HasOwnership() function, similar to HasAuthority()?
can you GetOwningPlayer maybe?
Yes
GetOwner() on a normal Actor
But how do I compare it to the local player?
Like if (GetOwner() == <what do I put here?>) {}
If GetOwner = GetPlayerController?
Ah
if (GetOwner() == GetWorld()->GetFirstPlayerController()->GetPawn())
if its owned by the pawn
of cause
FirstPlayerController is always the player controller of the player on the local machine
splitscreen is a different beast
if its listen server, then that players controller
else nothing cause dedicated server doesn't have a player controller
If the client changes a replicated variable in their PlayerState, do only them and the server see it? Or would other clients be able to see the new value in that PlayerState?
no only they see it
server and other clients wont see it
replication only works Server -> clients
Ah ok that's what was getting me
changing the variable on the client is only on that client
So after changing on the client, i have to tell the server I changed it and then everyone will see that new value
not only that, but depending on variable and update frequency
it can cause all kinds of jitter, bugs, etc...
in my project when a player clicks I want a arrow to spawn where the player has clicked. If the server clicks the arrow shows for everyone, is there a way to make it not show for everyone?
don't replicate it?
my apologies, the actor was set to replicate. I'm dumb. thank you
i success to build my project solution with (gameliftserversdk+gameliftclientsdk) the build success but i can see Atomic.h like error! and if is error how the build successed?
Hello, I'm kind of new here 🙂
I was wondering if anyone could help me to figure out why I'm getting a jittery ThirdPerson character rotation out-of-the-box in UE4
I have "Use Controller Rotation Yaw" enabled on the TP character.
Basically this character is "Ue4ASP_Character" from Epic's Animation Starter Pack and I have no changes on it.
If I play with 2 or 3 clients and move any direction (except forward), character actor rotation starts to jitter.
It is much more visible when I simulate on 100ms latency with no loss network conditions.
If I uncheck and do not use Controller Rotation, it's perfectly fine which brings me to question: so why applying Controller Rotation is jittery?
I'm not sure if I explained the problem clearly, I could also record a short demo video if that'd help more.
Thanks for any thoughts and suggestions in advance! 🙂
@meager spade for the sprint problem of my character is correct if is remote run on server and after run on owner client for fix my correction problem? 🙂
RepNotify variable (float). When you press your sprint key, set it on the Client to your new value and do a ServerRPC.
In the ServerRPC you also set it to the same new value. In the OnRep function you then use the float variable to set the actual WalkSpeed of the CharacterMovementComponent.
I do want to note here though, that this is still wrong, and the only proper solution is to use C++ and extend the MovementComponent.
You theoretically need to start sprinting on the same timestamp as the Server. Otherwise you will ALWAYS notice a small correction at the Start or End of your sprint.
Can you join other sessions using the Steam OSS and the Dev app ID? I've been following along with the ShooterGame example to implement sessions, gotten creation and searching working, now the only thing left is that it falls over when attempting to join.
Could also be it doesn't like joining a session running on the same PC using the OSS?
- You can join with the DevAppID.
- You need two PCs (or Virtual Machine) to do so. The second instance of your game won't have Steam init properly.
Thanks, I thought it might be something like that. Just wanted a sane voice in my ear before I stole my partner's PC 😛
@thin stratus thx for explanation. So with c++ the correction is near to 0, you can explain the different to c++ and bp in termine to performance? 🙂
No I can't. This has nothing to do with performance.
The CMC, in C++, properly handles SavedMoves and sending the Server what exactly is happening on the Client, so the Server can do the exact same thing at the exact same time.
If you change MovementSpeed in BPs via some OnRep or RPC, it's not guaranteed to be changed in the same timestamp.
The Client would change it in Timestamp X and the Server in Timestamp Y.
Everything between these two Timestamps would be moves that will be corrected. The bigger the lag, the bigger the correction window.
Many thx for explanation. 🙂
I fixed my character rotation jittering problem — so I wanted to share.
Turns out, CharacterMovementComponent's bOrientRotationToMovement is fighting against Pawn's bUseControllerRotationYaw.
Apparently it's already called out in CMC header:
Leaving Pawn's bUseControllerRotationYaw enabled and disabling CharacterMovementComponent's bOrientRotationToMovement literally fixed it entirely! 🎉
That's correct thought. Just make sure you set the Boolean on the Client too
Prediction
Otherwise they have to wait for the RPC and the Variable to both replicate
@thin stratus this is my base third person character. I have 2 child character, one for team red and one for team Blu. Can be this the problem?
My client character continue to lag (correction error) when I sprinting
@buoyant wedge : you have issue with the sprint replication or the animation settings itself
@crude coral I'm not sure. I have clear the animation blueprint of my character and the issue come when I sprinting. So I think the problem is with my character movement component and the replication. I'm go to work. This evening I investigate better 😊
you don't have walking animation?
I have 2 walk animation. 1 for the player, so the arms and weapon and 1 a third person character for see the position of the player to other player.
@buoyant wedge ok !
@winged badger @chrome bay thanks for all your help yesterday guys, I managed to figure it out. It's probably not perfect but it's definitely working and doesn't take much overhead!
Rpc is a rep notify event? 🤔
negative
rep notify is a function that gets called when a client receives a variable update from the Server
I have an issues I can't solve, been trying for a few days now. I have a full grasp of Replication in UE4 but I have started using InstancedStaticMeshComponents and I can not seem to get the mesh to be visible on Clients. They are instantiated and instances are added to the array but nothing visible. Does anyone have any resources they could share on how I might solves this problem?
@chrome bay thx. So rpc is run on server, run on owning client and run multicast?
yeah
@open terrace the component doesn't replicate the array of transforms. Components will only replicate properties that are marked to do so
Thats the part I cant figure how to mark the transforms as a replicated property. Not sure of the right workflow to get them to replicated. Probably something simple.
You can't without changing engine source code
What you would need to do is make your own array which copies the transforms, and you replicate that array instead.
Then use a rep-notify to update the ISM transforms when it replicates.
But, replicating an array of transforms is very not-cheap - so really it would be better if no network traffic was required at all.
@chrome bay Thanks. I do keep hearing this but then I think, well landscapes and foliage in UE4 replicates all the time and very well. So there must be an easy way.
Landscape and foliage doesn't replicate anything
That information is saved into the map
Hello, could anyone help me with my problem please? I have dedicated server hosted on AWS and in "Stand alone game play" it's working totaly fine, it connects to server, grabs a map and load it. But when I package the game and run it, it stops in my entry level and thats it. No error I can see, no obvious issue.
well I will try and get your idea of On_Rep an Array of Transforms. See how slow it is.
It depends how many transforms you want to replicate - but replicating large arrays is very not advisable.
Is there any reason you have to replicate them? Can't players just generate them locally?
In my server browser, I keep getting random servers that have properties that are impossible, like the map "greedybread" in this case or a 100 player server, my game isn't even published anywhere, so nobody has access to it, does anyone know what this is?
Im using the Steam online subsystem
@jovial stream what AppId [i think that is whats its called] are you using to tell Steam what app you are? Did you set up your own identifier or are you using one provided in a tutorial? This is just a guess.
Ive never had that issue, but perhaps that is it?
idk im guessing that could be the problem
i'll get one or two servers everytime I open the browser
@chrome bay, my game will allow the instances to be modifed at runtime so it will need to update the server whenever the player interacts with an instance of the mesh.
@jovial stream it's normal with the steam app id 480. I had same issue and I write on the user name on steam. You can see random room of random ppl.
I have know a other dev with this issue 😂
480 is used by everyone. Steam doesn't know your game is unique.
If you want to remove that problem, get your own AppID
Yeah I figured that was it
@buoyant wedge One time I got really confused and kinda creeped out when I first saw one of the servers and it was named "THE SHARD", and had an impossible number of players in it
quick question. shouldnt playerstate persist across seamless server travel? (at first glance it looks like my client side playerstate gets nulled during travel)
@waxen socket i wouldn't ping someone to ask for a screen share, nor would i ping someone when that question could just be answered in here by competent people.
and a lot of us work with UE4 for a living, so i doubt many would have time for a screenshare to fix someone's code, most need to relax 😄
Hey, Kaos. Thanks for the advice. I'll delete the message.
Hi ! Someone who already worked on multiplayer games ? I need someone to take a look on our project to find a bug blocking us since months...
that would be incredibly expensive
Seriously, I'm starting to be that crazy that I can even paid for a fix T.T
I'm investigating some alternatives to using Steam as the OSS, can anyone offer some suggestions? So far I've only found UETOPIA
Thanks @wicked brook , was looking at their pricing
Anyone used Photon and have opinions?
as far as i know photon is only p2p no dedicated. Could be wrong though
also spatialOS is another one. but they kinda expensive
make sure you set up linux servers when you choose one cause its way cheaper
@thin stratus this is my better result whith BP and rep notify. I think for better result i need to make a custom character movement on c++ 😦
Hell, II am having a problem with replicating a third persons gun projectile, basically it gets set to the guns location and control rotation, it looks fine and all until I look at it from a clients point of view, then the location does not get replicated correctly but the rotation does
As you can see in the beginning (while looking from a client) the projectile does not get put at the muzzle but when the server see's a client the projectile gets placed corectly
I would really appreciate some help
Any reason that this wouldn't run on a client?
(the event hold fire is called from a button on a widget)
So I'm just digging around for info on a dedicated server.
I just read that you NEED an engine source build in order to do so. But I haven't seen any reason why.
I think the person writing the guide is confusing engine source with project source. Like you can't have a code project unless you use an engine source build..
@terse prawn That looks fine to me, maybe slap in some prints and see where it falls over?
@limber yacht when a client executes it, it runs past to the remote end of the switch has authority and wont go any further
100% its the owning client?
Does anyone know where in the ShooterGame example the joining client actually loads the map active on the host server? I'm going through the example and can't seem to find that. Rebuilding/copy/pasting it for figuring out what the bits do, and so far I'm able to join the hosted session but it doesn't load the map active on the server.
Hey guys, if i have a level which is local to a player, like a character selection, then Character selects the info, Where should i save the data, and how would i open the Hosted Level
and how would i pass the data to the player controllers so it can build its pawn , on that data ?
And is it possible to do a server travel via blueprint ?
For your first and second questions, I've done that by using the savegame system. In the menu there's a character creation, it saves the info to a savegame file, then when you load into the level it loads that info back from the savegame and does whatever with it.
@limber yacht I see, thats a way to do it.
look thats should help you
this is similar to your situation
Overview of how to save and load your game
@rustic spruce Thanks, save game is covered, thats easy
oh
Just needed to know , how would people do it for server travels, what is the right approach, you know.
I dunno if its the best way to do it, but it was the most straightforward. Just remember it'll be very trustful of the client's savegame data unless you throw in verifications
if you have a lobby map and a play map
and you do seamless travel between them (options to do so in gamemode, google knows how, and its possible in BP)
your PlayerCOntrollers persist into next level, as do PlayerStates
even if your play map has different PC/PS classes
you can override CopyProperties on PS (also in BP) and transfer any data you want from old PS to new PS as new one is instantiated
that data transfer will work only on server, but it has the data from all PlayerStates for all players
then when you do a HandleStartingNewPlayer override, you have the new PC and new PS (or the old ones if you didn't change the classes between levels)
(that being a GameMode function)
and there you just spawn whatever you need to for player pawns
default implementation just calls RestartPlayer() which spawns the default Pawn, so you might opt not to call parent when overriding it
i would personally recommend using separate classes for Lobby and Game Controller/PS
as it makes it easier to handle different functionality and avoid clutter
I understand, this is what i needed.
I am spawning different characters per player, so using a custom character spawn on post login.
Is this okay?
when connecting to server
PreLogin->Login->PostLogin->GenericPlayerInitialization->HandleStartingNewPlayer
when doing seamless travel
(from local PC) ServerNotifyLoadedWorld->HandleSeamlessTravelPlayer->GeneraicPlayerInitialization->HandleStartingNewPlayer
since GenericPlayerInitialization is native only, HandleStartingNewPlayer is your common entry point for both types of connecting/traveling
you should move your spawn logic there
i did read the source code for the GameFramework... few times
HandleSeamlessTravelPlayer is the function that swaps the PC/PS if the change of class is required, and also calls CopyProperties
CopyProperties is basically a function where you have valid pointers to OldPlayerState and NewPlayerState at the same time
so you can copy/transform/rearrange the data however you like
and ofc, in HandleStartingNewPlayer override, you access the PS via the PC pointer, it will be valid, always
One last thing.
Seamless travel via blueprints?
How should i do this?
ExecuteConsoleCommand(ServerTravel <params>) ... don't recall params off the top of my head, google will know
and you check boolean for SeamlessTravel in the departing GameMode
@winged badger Thanks, what you have told me now is gold for me. Appreciate it.
Taking Screenshots
the parameters can also take a GameMode class
so you can open a new level with a GameMode of your choice, you're not restricted to one that is set in WorldSettings of that level
I have a problem where an enemy spawner In my game has a random enemy hovering above the spawner after about 5 seconds of gameplay clientside (Left window) but isnt there for the server (Right window).
This is the script for the spawner
@heady python Try putting a Switch Has Authority in there and only running the code on the server. At a guess, the one floating above the spawn is spawned on the client, only exists on the client and so does nothing, but the one that moves is spawned on the server and replicated to the client.
@limber yacht that worked thank you! Ive been trying to fix this all day and it just took 1 node.
No problem.
In general you want to only run code that affects the world on the server (in your case spawning enemies, and projectiles if you're worried about hacking/lagswitching/etc.)
gotcha
a multicast cant pass an array of actor references?
Bump.
the client gets to try and execute "Server Hold Fire" but wont go any further.
am i going insane or is there a way to fix this? loll
@frigid solar you definitely need source build. Launcher build will not build the server target
Does anyone know where in the ShooterGame example the joining client actually loads the map active on the host server? I'm going through the example and can't seem to find that. Rebuilding/copy/pasting it for figuring out what the bits do, and so far I'm able to get a client to join the hosted session, but the client doesn't load the map active on the server.
@terse prawn fairly certain you need to set Holding Fire only on the server since only the server can change replicated variables
@placid sparrow thank you for that I didnt realise how redundant that was but at the same time clients wanted to change that variable as well.
my issues has been resolved. I was calling the hold fire from a widget. if I have the widget tell the controller to fire the event then it works.
does this look okay? on 4 player PIE dedicated
how does epic manage supporting 100 players like this
@twin juniper whats that tool called
thank you!
@terse prawn Whatever you are calling this on is not owned by the client that calls the rpc.
You can't perform ServerRPC with every client on every actor.
If it's something standing in the world, then you have to move the ServerRPC back into the character or playercontroller.
Just saw you did already sort of figure that out..... Sorry :P Didn't check all history on phone discord.
a multicast cant pass an array of actor references?
@terse prawn If these actors are replicated, then yeah you can send them over. Just keep in mind that they must have replicated to the client already
how does epic manage supporting 100 players like this
@twin juniper They don't. They use the Replication Graph and tons of changes and improvements that you might not have access to. UE4, by default, can't manage 100 Players.
@twin juniper They don't. They use the Replication Graph and tons of changes and improvements that you might not have access to. UE4, by default, can't manage 100 Players.
@thin stratus
Is replication graph not enabled by default?
Don't think so. It's not suuuper stable last time i read about it
@wicked brook But there are options in the editor to run a dedicated server
Set up the Unreal Editor for testing multiplayer games.
yeah but thats just for testing. If you dont believe me then try to package a server target in launcher editor and you will see the errors
it will say you need source version
to actually package and build the server you have to have source
Ok thats fine. Makes sense.
I still find some of the info on this page a bit odd though
https://www.ue4community.wiki/Dedicated_Server_Guide_(Windows)
Just flicking through now. I read it late last night. Might be why my brain is addled.
I honestly have no idea to be fair.
I have created a world in 4.25, set the number of players to 2. But the players cant see each other
Derrp. Needed to say play as listen server
listen server will mean one of the clients is also the server
Yeah I understand that
if you want to test for dedicated server you need to pick play as client and have dedicated server checked
you have to go into advanced settings
that is my game from editor (UE4). with windows powershell for the locally testing of Agones SDK server...that the log when i play in UE4 editor with the dedicated game server option checked so i thought each 5 second receive logs... and if the dedicated game server option of UE4 editor not checked i not recieve logs messages with powershell... i am in the good way?
If nothing is actively stopping that plugin from working in IE, then yeah, that's expected
That's better suited for the Agones Forums (if they have any)
suppose the dedicated game server detect clients and the client from main menu start for open session then other client come too and from the main menu click for check if is there any gamesession waiting for players the second player will travel to the same gamesession of the first player? or will open new one? (my game session need 50 players for start)
Is replication graph not enabled by default?
@twin juniper nope - you have to make your own implementation that's game-specific. It's pretty stable now, been using it on two projects for a while. Best resource for an example implementation is ShooterGame.
the local testing of Agones SDK server work too with Linux inside my windows system..i use ubuntu shell..and as expected i recieve logs just if dedicated game server option of unreal checked
Also note that replication graph does nothing for bandwidth - it just reduces the servers' processing time for large numbers of actors/players
Hi guys, I´m trying to set up a multiplayer project for Oculus Quest where you can see the person who are you playing with (phisically), while you´re playing with them in the game. Is that hard to set up?
Anyone know of any guides to setting up multiplayer player controllers?
What do you mean by setting them up?
So say I have "Add Controller Yaw Input" in a player controller. Doesnt it need to verify which character it is referring to?
So you do Get player Character. And the index is 0
No, controllers only exist on the server and the client only knows about local controllers
Input is only processed by the person who actually owns the controller
So you don't need to do anything, they just work
Yeah, that is odd. When I run the game in coop, both players are able to move, look and jump.
But the error log shows accessed none trying to read Add Controller Pitch Input
So long as you are adding input from an input event, it should work fine
(show the code to make it easier)
Oh wait hang on
So you do Get player Character. And the index is 0 This is the problem
Show the code, this doesn't make much sense to me
Sorry haha
So. I know I am doing it wrong as I set it up for single player
In the player controller, OnBeginPlay, I get a ref to the player character
Then I reference that later
Yeah don't do that - just call 'Get Pawn' to get the pawn that controller is actually possessing, and cast it to the character.
It likely won't be valid at BeginPlay.
You probably want to be processing character input in the character blueprint not the controller blueprint
But isnt that what the player controller class is for?
not at all
Pawns have their own input components so you can setup bindings specifically for them
Otherwise controllers would have to implement all of the input code for any pawn in the game
I've seen it done that way though.
It works, but it's not the correct way to do it
And in multiplayer this stuff matters a lot more
if you implement input in controller, and change pawns you'll regret it
Yeah. caching the pawn at begin play won't work for long either. If you ever respawn or change pawns, RIP
What the hell is the controller for then?
It just exists as a representation of a human (or ai) player
uh, mine has 2000 lines of c++ 😄
Which can then "possess" pawns
mostly math figuring out what player is actually trying to do and trying to help
Think of it like Controller = Soul, Pawn = Avatar... or something like that
So... say I have a base character class. With all the health vars n jazz, as well as input stuff.
I would still derive from that class for player character and AI character classes?
Yeah for sure
Damn. I have some shizz to change
The input events will only be processed for the human player possessing it.