#multiplayer
1 messages ยท Page 556 of 1
so...in pawns there's an event OnRep_Controller() ?
why it's not exposed by default?
i mean, it's super useful
super
yes it is
one of the many reason i recommend constraining network code to c++ only
there is also SetPawn function in controller
which is the common point all server and client logic eventually passes through
very good place to go and (un)bind delegates and such
SetPawn...i'll take a look
i'm new to network, and our game is coop...so many new things to learn
@winged badger what happens if this pawn possessed by AI controller on server?
cast fails, but the function being called?
unless you go around the default settings to manually replicate the AIController
nothing
as they don't replicate
ok, was not aware of that
and you don't have to have APlayerController* in BPImplementable
you can go for just plain AController*
then cast in BP if required
thats your preference there
one more question, where i can read about AI then, if ai is not replicated how does it work?
replicating is just tweaking the replication settings tho
i chose to replicate my AIControllers
reasons?
got an AIController between the PC and the Pawn
PC actually possesses ObserverPawn, not the Hero
seemed like a more convenient way to tie everything up without using any delays or such abominations
its only replicated for heroes and hero bots, not for monsters
that would get pricey when evaluating actors for replication
i guess it's your game specific then?
is that some king of moba?
as you control many characters at once
you control one, its a tactical co-op real time shooter
I have one more question to the pile, how to handle "unpossess" on client? Should i make new implementable event in case if onrep will pass no controller?
just be warned that if its not possessed immediately
you'll get one OnRep with nullptr at start
so, this
ClientPossessed(Cast<AController>(GetController()));
will be called with nullptr as controller?
when actor is spawned on client
all of its replicated variables are sent with their current value in the bunch with instructions to spawn the Actor
even if they are default values
Actor is spawned, replicated variables are set, OnReps are called, and only after that goes BeginPlay
note that Actor is not queued for replication the moment its spawned
so spawning it, then possessing it results in Actor having being possessed before it replicated
there is an ack, but thats deep in the engine
okay, if not, what's the best practice? wait?
you don't need to do manually what engine does by default
ack is there so packet gets resent if it was lost
no, i mean, possession
depending on your network load, number of replicated actors net priority, net update frequencies and relevancy
it might take a while for actor to replicate
Any good guides for noobs in c++?
Ok there must be something i'm missing with SeamlessTravel. Literally everyone just says click the box in the game mode and it will work. But it never does. My GameMode has seamlesstravel checked. My console command is ServerTravel. When i launch the game, it kicks all of my clients out and only moves the host. If i uncheck seamless travel, it works completely fine to move everyone to the new level. I can't find a single video or tutorial on using Seamless Travel and it's driving me insane.
I'm aware i'm doing something wrong but my point is that there aren't any resources on it. Every resource just says tick it in the GameMode which I've done.
My gamemode has it ticked
this is my command
when seamless is ticked, it kciks all clients. when it's not ticked, everyone goes there just fine
am i missing something?
that event is in my GameMode btw
i did a packaged build
It has to be some issue with some setting somewhere. I'll try making an empty project just for servertravel from scratch and see if i get the same issues.
i thought seamless could only be done with open level node?
i never used openlevel for seamless
Maybe no transition map set?
UKismetSystemLibrary::ExecuteConsoleCommand(PC, URL, PC);```
this is all we do
MapName is not the full path
just the name
so our map is /Game/Maps/SomeMap
we just pass in SomeMap
need to ensure SomeMap is also in your cook list, and you MUST have a transition map
Yeah it always works for me too idk
@winged badger I remember you were helping me out earlier.
The reason I was getting the wrong IP was due to VMware IP virtual networking.
Now
SessionInterface->GetResolvedConnectString(SessionName, Address)
gives me the correct IP but 0 for the port
I could use a find and replace on 0$ but that would seem sloppy.
Do you know a better way so I could find its port dynamically?
nope
said it works for him but only during one case it doesn't, mine doesn't work even when I do right-click launch ๐ฆ
I ended up just doing
Address = Address.Replace(L":0", L":7777"); and I am able to connect to the host after that
I don't have a controller but I think that is a different issue
An overview of Online Subsystem Steam, including how to set up your project for distribution on Valve's Steam platform.
#define STEAM_SDK_VER TEXT("Steam[Current Version]")
how do they want current version
v149 or 149 or 1.49 or v1.49
I would guess probably the first (like the folder) or keep it simple like the 2nd
but want to know for sure.
I hate it when people write documentation without examples
Does anyone know why my AI aims like shit on a dedicated server, but just fine on a Listen server?
https://streamable.com/8zyh8x
Its like it has this weird eye offset that is making no sense to me
There is some boolean on skeletalMeshes for updating bone transforms on dedicated servers. Could that be related?
I think it was on the skeletalMeshComponent at least
@fallen pawn
ill check it out right now
Its in the skeletal mesh asset itself..? or in the Skeletal Mesh component in an actor
I cant find one like that
this is enabled by default @thin stratus
i dont think its related
O
Should be in the same menu as what you just showed
(Enable Physics being the second option in that image)
Image is from AnswerHub though
I don't think this bug is skeletal mesh related though, its an issue with Any AI controlled character on dedicated servers onlyt
listen works fine
There shouldn't be a diff between Listen and DS in terms of AIController
So let's at least try this, because I know it caused issues in the past
the second i posses the same pawn as a player the problem is gone, even on dedicated
yeah sure
Yeah, which brings me to the idea that this setting is set to only update when rendered
Which a DS doesn't do
Search for
VisibilityBasedAnimTickOption
Does that show up?
(What a terrible name)
Alright. Was worth a shot
damn, its really mind boggling, the only other person i found with the same issue on the answer hub edited his post and said "nvm fixed"
Then I'm not sure atm. I would start stepping through the aim code.
Are you using aimOffsets for this (animation)?
๐
Yeah i am, but even if I fire the bullet from a scene component
it fires directly down at its feet
which leads me to believe its a quirk with how AI looks around on dedicated
I would double check what the Aim Direction, Start and Endpoint are.
Sucks that draw sphere debug doesnt work out of the bag on dedicated
you gotta multicast it or something to see it
its like shooting from where it WOULD be shooting from if it was aiming directly down
but the pawn is following the direction just fine
https://streamable.com/qybbp0
and here is the same thing on Listen server
i suspect its something to do with this
like camera rotation is not network synced or something
i tried it firing from a literal cube floating above its head, and it still shoots from the actor origin
I think its an engine level bug seriously
I've tried just about everything, and made sure things are hooked up
even if I give it a point in the world to shoot from, it still aims in a random direction on dedicated
its the forward vector it cannot do
it has something to do with the pawn's eyes, or viewpoint
its like never attached to the player, its at world position 0,0,0 maybe
i got it to aim again by removing the anim bp
so i was wrong, its animation related
is there a way to force render bones on dedicated server?
@thin stratus it did end up being this:
i thought i had it selected, but i had the wrong "always"
thanks again, life saver!
Hi everyone, I want to run a VERY basic .js file in a blueprint, what options is there?
Probably need to find a third-party JS plugin
ok thanks
@gloomy wind Check VARest. It has some JSON features for UE4. It can be used directly in BPs
For those using Steam for MP and having taken a look at the logs, do all MP matche sessions have the type Lobby? I am having some issues with hosting a game, leaving, then trying to search and join other people's sessions. The logs are a little confusing while I'm trying to figure this out
This was basically hosting, leaving, then trying to join another player's session
Unreal documentation for Seamless Travel says I can add other actors to persists through seamless travel. How do I add the GameState to this list?
The GameMode actor (server only)
Any actors further added via AGameModeBase::GetSeamlessTravelActorList
Any actors further added via AGameModeBase::GetSeamlessTravelActorList
Override that function and add it. But I would suggest not adding the GameState. There is probably alot of stuff in there that should not persist
Anyone used Playfab here? I have a small issue I need help with but cant find enough documentation on it
also bear in mind that seamless travel actors are still destroyed. Player States/Controllers just copy properties accross.
@thin stratus ty probably smart. Should I just use the GameInstance to carry over the 4 variables i need from my lobby to my game? For example the host selects a game mode and a difficulty so I'm trying to find a way to tell the game mode what difficulty to use when the players move to the new level and it starts.
i've packaged dedicated server for linux and when i'm launching it i'm getting some errors related to Steam API. is there a way to disable Steam Subsystem on server only? i still need to have it on client.
Is the Ready to Start Match constantly checked? If I override it with this, will this wait until everyone has connected?
How does playfab authorize a client to let him in the server? I get the matchmaking ip and port fine, but when trying to connect to the ip I timeout
Can someone explain how client side prediction works for the unreal game ability system (GAS) plugin? I mean, I get it for movement, it's built in the movement component and there is lag compensation built in.
However, I keep hearing folks touting how amazing GAS is because of that but how in the world is this relevant?
I can activate an ability and then what? How would client side prediction work at all? Until I commit the ability, the server/client cannot do any prediction and when I tested it, it lagged as much as it should, I did not see any form of compensation. So what does it compensate with??
it doesn't, it just allows clients to start the effects locally without having to wait for server confirmation, and provides mechanisms to roll the predictive actions back
and by clients i mean owning clients
Also prediction != lag compensation
ah that's true
And then grab them in the gamemode by getting the OptionString and parsing it
Just make sure you don't specify ?game=gamemodeshortcode
Because that actively triggers ue4 to start the map with that GameMode
Unless you want that
yeah that's probably best given how few i need
i just really need ?difficulty=standard?numplayers=4
something like that
Some of this you actively need to do
?NumPlayers=4
Is actively used by ue4
It will kick the 5th person when connecting etc
So it's probably good using the options
Yeah i was going to use the MaxNumPlayers option like in the networking document
but i also saw the traveling players
is it possible to use levels made with world composition in multiplayer without dedicated server (we use listen servers only)
got bunch of new quite large maps to integrate to project and now players load in empty areas
only difference between listen and dedicated servers there is not being able to guarantee someone won't try to host with a potato
as far as that goes
also, listen servers can't run all optimizations dedicated servers do
like not rendering anything, it has to tick at least some bones and animations...
so possible, yes, easy, no
Hey um... I've been kind of working on this brainchild of hooking phones up to my game so you can have several phones hooked up as controllers at once.. I'm currently running with like... each phone has it's own build of the app and it connects via matchmaking on the local network... Is there a better way to do this or am I barking up the correct bunch of trees?
Because it's working right now, I'm just wondering if it's efficient
I migrated the vehicle template into my project. Everything works beside the Play As Client mode. This is what I see. Did I miss any settings?
https://gyazo.com/cf54178eb7afbdcb374158b61ff67278
try figuring out if its a posses/spawn issue or a camera issue by manualy possesing/ moving the camera
thats the only thing that comes to mind
It only doesn't work in a C++ project.
I just migrated the default vehicle template into a blank C++ project in UE4.25
maybe the car is not being spawned in the client? we need a bit more info
What info do you need? So in my blank C++ Project, I switched to the vehicle game mode which uses the vehicle BP.
I haven't touched anything in its code
I C
WOuld it help if I place player start?
I think I need to make them spawn in diff locations. In the vehicle template the vehicle spawn in diff locations
I'm missing that
I guess all I have to do is to place a bunch of player starts
Thanks guys it was helpful . I assume there's a better way of spawning instead of placing player starts.
you can override chooseplayerstart in gamemode
to do whatever you like
just note that gamemode will by default stash the first startspot assigned to it (doesn't have to be playerstart) in the PC
and will use it for all respawns later on
Using Advanced Sessions plugin, I can't call CreateAdvancedSession in C++ because the wrapper class is set to MinimalAPI. Do I need to write my own session handler?
in my project I have players able to create more than one character. how would i go about storing this in the server? would I use a game save or is there a better way?
I can only see game saves being used and then I also dont know how I'd really store it.
Hey does anyone have 10 mins anytime for a quick call? Ive developed a prototype for a multiplayer game and i need to understand how servers and online subsystems work ( APIs too if that isnt an included topic in that).. anyway i just need a general guidelines to know what to search for. Id really appreciate it guys, thanks
deploy the dedicated game server (Linux) for UE4 ...AMI (Amazon container image) with docker approach.. success!
Good afternoon. Is it common when replicating on button presses to call a RunOnServer event that then sets a RepNotify variable in order to perform an action on every client?
Where should i put logic that sets cvars tar are related to GameMode? (GM only exist on server so i cant plug it to GM)
@waxen socket not sure if it's common, but it's the only way that i think is consistent in result
Press key -> run RPC
RPC sets some OnRep Notify enabled variable on server
Thanks for replying. Yeah, it's the only alternative to MultiCast that I can think of.
this is only if you need some state changing event
multicast -> event, happens once
onrep -> happens even if player will join later, or will enter relevancy range after the event
i.e. multicast is good for explosion effect
onrep is good for replicating the destruction that was caused by this effect
as destruction stays, but explosion should not happen later in time
I'm working on barrel glowing at the moment. So by using RepNotifys, a player joining midgame will see the glowing barrels of those who have fired recently. Does that make sense?
And run the related OnRep_ function, right?
OnRep runs automatically on client when server thinks "this player has variable different than me"
not sure how server decides this tho
https://www.youtube.com/watch?v=16BvKb-OPOg this is good series on topic, still was not super simple to grasp
๐ฎ Unreal Engine Replication Series - Part 1: What is Replication?
๐ Welcome to the Replication Series! This beginner tutorial series dives deep into how Unreal Engine handles Replication. Understand more than just the "how" and explore the "why" behind important concepts tha...
I've watched those, yeah. He keeps it entertaining. ๐
part 4 is about repnotify (OnRep in c++)
Thanks. I don't suppose you know what the "Replicated" checkbox in Timelines does?
Is it expensive?
if you can avoid it
Setting up components for replication across the network
the issue here it replicates "position"
And does that take up a lot of bandwidth?
well, epic made it for some reason, so it may be optimized, but i wouldn't bet on it
maybe someone more knowledgeable can tell
Thanks for your time. I hope you find the answers you're looking for.
In between replication updates, the client does extrapolate play position.
i guess it's good for some cases when direction may be changed unexpectedly
direction of play
Hi, I'm trying to make a simple inventory system but idk how to replicate it. If anyone can help that would be amazing
its more of a one weapon and 2 ability system
i definitely can't...we implemented simple inventory replication, and it was a pain in the butt...still is
I'm having some really weird issues here and I genuinely am at a loss as to what to do. I am attempting to update the control rotation for a character. If I set it on the client, the server's idea of what the control rotation obviously never changes. However, even if I do set it on the server the value never updates in the eyes of the server. I've monitored the value and it literally will not change after calling SetControlRotation. Does anyone know if there's some sort of restriction for calling SetControlRotation in a server RPC?
Hey Method. I just worked through a bunch of issues with replicating rotation. Maybe I can help.
Have you set any of the UseControllerRotationPitch/Yaw/Roll properties on your pawn?
No I have not, mostly because of the movement style we're using.
I believe only Yaw is true by default.
Hello all!
I have more of a conceptual question:
How would you approach throwing objects that have to persist in a multiplayer game - for instance a cube that you later need to jump on?
As I have read, physics syncing is quite complex topic.
I guess it would be easier to handle temporary physics objects such as bullets and grenades.
Any ideas?
Any idea what I may be doing wrong here?
PlayerController->ClientTravel(Address, ETravelType::TRAVEL_Absolute);
and the logs show the correct ip and port 192.168.86.94:7777
this part doesn't look quite right but not sure if it is important Created socket for bind address: 0.0.0.0 on port 0
open ip:port won't work if there is a router in the way and its ports aren't forwarded
(server)
Hi, I need some help figuring out how to set the character reference in my actor component that stores all of my weapon and ability variables. When I do get player character it only gets the server on the listen server.
Try GetOwner()
okay, ty
that fixed everything, thank you so much. I've haven't used actor components many times
you'd do well to avoid GetPlayerCharacter/GetPlayerController until you understand what they do exactly
also, not using them gets you to understand the relationships between game objects sooner
Question, first game I'm making in UE4:
- Setup with dedicated server
In my BP_Player (which is a Character class) I have the events for the inputactions, such as lookup, lookright, jump etc. They set the values through the "set controller input" functions. The pitch and stuff in the animation blueprints reference the character - there's a cast to BP_Player in the ABP and that fetches the control rotation and velocity and such.
This does not work. Other clients do not see the pitch updated for other characters. Now my question;
Am I correct if I say the following:
- The YAW does work, because the checkbox "get yaw from controller" is checked, thus its updating its yaw value from the controller, and that value is replicated through the Character, thus showing correctly on all clients
- The ABP on other clients is not working because the "control values" are not replicated (e.g. the controller only exists on owning client and server, but no controllers for other clients) - every client only has 1 controller, its own
- I need to move the input logic away from the character, and stuff it in the controller (makes no sense to have all that code for every character instance? )
- I need that input logic from the controller to update values in its attached (or posessed is the right term I think) character
- Since the character is replicated, and the ABP would then use values from the character, the ABP would work on all clients? (if the right BP_Player values are replicated)
- Obviously replace the "get control rotation" with a "get <rotation_variable_in_bp_player>" because there is no controller attached
@inland hedge pull where your camera is looking at with PlayerController->GetPlayerViewPoint
its updated on server under the hood via PC's ServerUpdateCamera RPC
then replicate those, skipping owner
note: you cannot get a roll value from that, as you'll get a direction vector camera is looking at, and its position
but you can get pitch and yaw
and they have to be replicated via character, or something owned by it
as controller won't work
I'm not sure if I'm following ๐ค what part are you referring to? Do I need to run getplayerviewpoint in the controller and put that value in the character?
like I have the feeling that my inputaxis events in the character are not in the right place, but they should be in the controller
you need its direction vector, basically, as LookDirection
if all characters have the same control scheme, sure
i would
Yay. Network guru is here!
i had/have a question
Where should i put logic that sets cvars that are related to GameMode? (GM only exist on server so i cant plug it to GM)
the movement input is under that
I'm now moving all the input handling away from the character BP and into my PlayerController BP
this was my movement in the character
this is it now, in PC
Hello :)
For Listen servers, without doing anything custom, is there a way to recognize who is the Host? Like, hosting PController
from where?
the goal is to have UI only shown to the Host, so pretty much each client so they can properly check
IsServer check to see if you show it or not then, on listen servers
๐ Thanks Zlo
Btw @winged badger I am having some trouble with clients/host leaving sessions and then after hosting the next game, I can't join another server as it returns Warning: OSS: Session (GameSession) already exists, can't join twice
I had DestroySession before the OpenLevel to the main menu, then I thought I would try it as a server RPC but still no luck. Should there by a delay between the DestroySession call and leaving the level?
Sorry for the ping ๐ This is the last step for me to fix to have a fully working demo
Is it possible to change my controller number in UE4 while previewing?
I just want to see if I can control player 2 (and others) from within UE4
I will post this message here again, because I think #blueprint was the wrong Channel
Hello, I have a problem with the Playerstate. When I try to cast to the pawn's Playerstate on a client On BeginPlay, it is invalid, but it is valid on the server. Is there a way that the Playerstate can be replicated faster because I don't want to use a Delay or take the Payerstate from the Playercontroller?
When testing my game in multiplayer in the editor, I'm getting some hitches when the game loads up. I think that it is the server replicating all the actors to clients, has anyone else noticed this?
Just did some testing by making an empty level with just a player and vehicle and the enterVehicle multicast function fires straight away, but on the test scene with 100s of replicated actors it takes around 4-5 second before player can enter after the game starts.
you can't replicate it faster, OnRep_PlayerState is the earliest you can have it
@twin juniper And where I can find this? In the Pawn Override Functions?
Hello, design question... I've spawned some pawns on the server side....It looks like I need to wait for the pawns to be loaded on the client before posessing...
What's the best way to do this? I'm currently calling a custom function on the level blueprint, which will send a RPC to the server that possess the pawn...
Is this how it should be done?
๐thanks
@winged badger , you mean I need port 7777 forwarded on my router to host the PuzzelPlatforms game?
everything seems to be pushing to steam correctly
but it's seeming to not be listing on the server browser
@lavish cypress Did you get yours working yet?
@gleaming vector check the Lan tab if it's not in the Internet tab
yeah mine is doing the same
im spinning up a free azure vm to rule out networking issues
Let me know if it works
Have you guys setup your presence settings (or whatever they are called) correctly?
Yep
SessionSettings->NumPublicConnections = 100;
SessionSettings->NumPrivateConnections = 0;
SessionSettings->bShouldAdvertise = true; // Required
SessionSettings->bAllowJoinInProgress = true;
SessionSettings->bIsLANMatch = false;
SessionSettings->bIsDedicated = true; // Required
SessionSettings->bUsesStats = false;
SessionSettings->bAllowInvites = true;
SessionSettings->bUsesPresence = false; // Required
SessionSettings->bAllowJoinViaPresence = false;
SessionSettings->bAllowJoinViaPresenceFriendsOnly = false;
SessionSettings->bAntiCheatProtected = false;
have any of you done the PuzzelPlatforms from gamedev.tv?
Do I need to have port-forwarding for it to work?
it doesn't matter what type of game it is for port forwarding
I don't want my controlled pawn to be visible to anyone but the controller. None of it is set to replicated, but the clients can still see the server's pawn but the server can't see the clients pawn. What am I missing?
if you're brute forcing connection with open ip port and your server is behind a NAT
router will receive a packet from client requesting connection, say "i don't expect any packets from that IP address" and just ignore them
unless they are port forwarded to server's local IP behind the NAT, then it will skip the checks
@clear copper set visibility based on ownership, or IsLocallyControlled
ah gotcha ty
@winged badger I actually just saw there's an Only Owner Sees option in Advanced Visibility for Pawns
How do i setup p2p without using steam... Can i host the in-between server myself somehow?
Sry, not p2p. Server/client.
The server that does magic between the server and clients so that port forwarding is not needed.
@winged badger
services usually handle that for you, like steam
I get that... but if i want to publish to other stores as well, i need some sort of shared service
but yes, it wouldn't be too difficult to put up a server just to do NAT punchtrough
i don't see the point, but it is possible
Don't i need to setup my own service if i want to publish to both steam and some other store, like epic or whatever?..
epic online services support pretty much everything, or are planning to
But there are no unreal engine integrations yet, right?
@gleaming vector linux specifically or is it affecting windows too?
we're investigating linux after 4.25, but for us it seems to be an old steamclient.so we were distributing
4.25 upgraded the steamworks SDK to 1.49 so if you had any hackarounds for previous engine version's shortcomings, it could be that
4.25 did not pgrade the sdk tro 149
it's 147
and i upgraded it manually and that helped
yeah but there was still an upgrade, our perforce diffs show 1.42 to 1.47
we did skip 4.23 -> 4.25 though
Are dedicated servers able to use savegames?
I for some reason cant get the steam subsystem on my level. "Online Steam Subsystem", "Steam Advanced Sessions" and "Advanced Sessions" are all enabled and I copy pasted the script from unreals steam documentation to my default engine.ini. Does anyone know what else I could be missing?
Maybe you're trying in editor
Can i use steam multiplayer when i publish on other stores.
Depends on the store but generally no
Epic Store? Or just a custom one, like download from website?
If you're on the EGS you would use the EOS multiplayer services
And on Steam you'd use Steam
If you want cross-platform multiplayer, EOS offers it, though AFAIK Steam users will need to create an EOS account which will infuriate them
But are there any implementation of EOS in unreal yet?
Non official.
It it possible to tell if there will there be one and when?
When Epic has accepted your game on their platform, I guess you can ask them for the integration they likely already have
It's not like you can choose to publish on EGS
Right now it also comes with exclusivity (no Steam) for new games
So how would i future proof myself? Can i just use the online subsystem and make EOS as a subsystem?
Subsystem implementation would help, yeah
But you also don't need a subsystem until relatively late in the process
Consider the chance that your game could release on EGS, and the experience that Steam players would have with EOS (additional account / login)
Right now you can simply target Steam alone, and if EGS happens for your game, you can target EOS alone for the EGS build
Right... Thx ๐
@bitter oriole im testing it in standalone with steam open in the background. I just cant seem to get it working
APawn and AController both have it
@twin juniper But this is not available in BPs right?
I've an interesting issue; a player pawn spawns (on the server) a "tool" that is used by the pawn (like a gun) and it's attached to the pawn - when the player leaves I had thought the player controller and pawn are destroyed.. However when the player rejoins the same server (much later) the tool is there, attached to the pawn.. How is the tool reattached to the joining pawn? I had thought the pawn destroyed (and attachment deleted), etc.. (I can fix the issue, but just wondering how this happens)..
How can I use steam on dedicated server without launching the steam app? Is possible using the test app id (480) or I've to register the game with steam?
not directly but you can subclass it and expose a blueprint event yourself
@twin juniper Yes I had done this by using the code from eXi, but it only fires on the client and not on the Server which is also a client
I think I know when I am getting session issues, it is when the Host closes the session, other clients act as if their session didn't get properly destroyed.
Is that a case I need to manually handle? DestroySession on Logout?
Good morning. Is it significantly more expensive to add a parameter to an RPC?
For instance, would it be wise to have have separate "Start" and "Stop" RPCs or to have a "Toggle" that takes in a boolean?
someone here good in C# i have a doubt related with sockets and begininvoke
When is it appropriate to attach a weapon actor to a character in a multiplayer game?
so you have a character, they do an action to say "assign this weapon to my character's primary weapon slot" - forgetting all of the details inbetween, when do I attach that weapon I spawned in to the owning character?
auto MyTransform = GetTransform();
auto EquippableItem = UGameplayStatics::BeginDeferredActorSpawnFromClass(this, WeaponItemDef->WeaponClass.Get(), MyTransform, ESpawnActorCollisionHandlingMethod::AdjustIfPossibleButAlwaysSpawn, this);
//auto EquippableItem = UGameplayStatics::BeginSpawningActorFromClass(this, WeaponItemDef->WeaponClass.Get(), MyTransform, false, this);
UGameplayStatics::FinishSpawningActor(EquippableItem, MyTransform);
// DO I ATTACH THE WEAPON ACTOR HERE? THIS SO FAR HAS NOT WORKED OUT
PrimaryWeapon = Cast<ARaevinItemWeapon>(EquippableItem);
if (PrimaryWeapon == nullptr) return;
PrimaryWeapon->SetMyOwningCharacter(this);
@humble socket I am good with C# but I haven't had to really work with the raw socket class
I am willing to try to help you though
I was trying to help. Without the whole project it is kind of hard knowing what they are up against. Basically the service works and then about a day later the listener stops processing connection attempts
Someone else on here might be able to help them better. To me it sounds like something is not being properly disposed of so it is building up until it hangs.
either socket exhaustion or something of that nature
Steam is open but the overlay does not open, why could this be happening?
hm
anyone ever take a look at what ports the ue4 dedicated server is actually listening on?
log says LogNet: Display: SteamNetDriver_2147482557 bound to port 7777
but doing netstat doesn't show it listening on 7777
Packaged, editor, devel, shipping, etc
@bitter oriole It's a shipping build.
Does anyone know where the actual Texture data is inside FRHITexture or FRHITexture2D ?? Because digging into the source I can't find any FColor arrays or FLinearColor arrays to indicate data that would represent the actual "Texture". I found "Format" the texture is in but not the meat of it.
but doing netstat doesn't show it listening on 7777
@gleaming vector physically it'd use 27015 but the port number 7777 is probably virtual only in steam network
hm
I have noticed that clients seem to disappear to other clients when playing in multiplayer.
Is there some way I can increase the players relevant view distance for online play?
the default is 15K units
so bump it up (NetCullDistanceSquared)
625,000,000 is 25,000 units
27015 is the steam server list discovery port
7777 is the game server listen port
Quick question about client-server architecture. Is it possible to run something on the host and have it only affect the target actor on the host's client? Right now, if I SetVisibility to false for an actor on the host in a net multicast function, then the visibility is also set to false on all the other clients.
SetVisibility is replicated
so setting it on host, will affect others
no way to fix without engine changes (or possibly is by overriding PreReplication and disable replication of the visibility property)
but SetHiddenInGame is not replicated
Darn... I'm trying to hide a widget component above each client's player. I tried using SetOwnerNoSee but that won't work for some reason.
Hmmm I'll check that out! Thank you @meager spade!
and we use that for the same thing you want
That fixed my issue! Thank you so much ๐
i believe i have found the source of my issues maybe
im using my dedicated server appid in steam appid.txt
rather than the client one
and steam does not map dedicated server app ids to client appids
functions are not replicated but if they are tied to a replicated event, are they passed on? :x
replicated event calls a function on an instance of your object on another machine that has the same NetGUID
anything connected to a RPC is called locally on machine that receives the RPC
@lavish cypress Same issue as you possibly?
basically
@winged badger ok, so it would work based on that logic
the steam_appid.txt needs to be the client appid
not the server appid
the server appid is not relevant anywhere in the process
so you had to package the servers with client APPID but upload them to server APPID?
yes
so
what i've done
Updated Steamworks to 1.49
made a small modification to OnlineSubsystemSteam so the default servername is "Empires Dedicated Server" (optional)
made a modification to look up a SteamServerDevAppid in defaultengine.ini in the code where it outputs steam_appid.txt
when its running a dedicated server
then, in Steam, I set the dedicated server stuff on the client app
in defaultengine.ini, set the version to 1.0.0.0
and then forward port 27015 (the only port that needs to be exposed)
FYI Once the session is created you can retrieve it by name and update details, like the OwningUserName. A little bit easier than an engine modification.
FNamedOnlineSession* CurrentSession = Sessions->GetNamedSession(InSessionName);
CurrentSession->OwningUserName = TEXT("Custom Server Name");
Sessions->UpdateSession(InSessionName, CurrentSession->SessionSettings);
The server that works is running on the cloud, right?
I am running the server locally with forwarded ports, but it appears in LAN only. Because it isn't packaged yet, the steam appid.txt isn't created. Also, there's nowhere I have defined the server's appid, it's all using the client's
i was wondering why port forwarding ๐
From what you've written, I don't see a reason why launching my server from the uproject with .uproject" -server -log should not appear in the Internet list
Unless I need to actually create a steam_appid.txt in the project folder somewhere, or I just HAVE to package the server
I'll try packaging next I guess
My ISP is also not blocking my ports, I also run a publicly available webserver from inside my network so I disabled their blocking and reimplemented their block list in my own firewall rules
You should try creating the steamappid first
Root folder, right?
given that the uproject is launching via the engine, I might need it in the engine binaries folder instead
hard to say
I'll try both
Just write a bat file to put it in every folder ๐
lol
i have a built server
i've never gotten online subsystem steam working in editor
anyway, everything is working now
localhost, my personal server, and the azure vm
[2020.07.20-02.39.58:960][ 0]LogOnline: Error: STEAM: Failed to create file: D:/UE4//Engine/Binaries/Win64/steam_appid.txt
[2020.07.20-02.39.58:961][ 0]LogOnline: Warning: STEAM: Could not create/update the steam_appid.txt file! Make sure the directory is writable and there isn't another instance using this file
[2020.07.20-02.39.58:961][ 0]LogOnline: Warning: STEAM: Could not set up the steam environment! Falling back to another OSS.
[2020.07.20-02.39.58:962][ 0]LogOnline: Warning: STEAM: Steam API failed to initialize!
[2020.07.20-02.39.58:962][ 0]LogOnline: Display: STEAM: OnlineSubsystemSteam::Shutdown()
Project didn't work, engine binaries it complains because it tries to create one itself
so fair enough, it handles that itself
looking inside the auto created one, it's correct
I'll try packaging next
but, yeah, last time i got servers onto steam was like 4.8 and it required very significant engine modifications. they've done quite a bit of work since then to make it easy
but apparently not too easy lmao
Steam OSS leaves alot to be desired thats for sure.
Bump
If SaveGame s are saved locally will a dedicated server being ran also save to slots using the savegame asset making a file?
is there any kind of "steam is ready" event? On my game instance if I try to get the player's steam ID on init, steam hasn't finished being integrated into the game and it reports a "bad ID'. if I set a delay of a couple seconds, long enough for the steam overlay to pop up, it'll print the player's steam ID. Just wondering if there is any kind of event/query that can be done that confirms if the game is finished connecting to steam.
Idk. I might just loop if bad steam id. Complete on a good one and go on with the rest
I havent used steam api stuff yet
What's up guys, how's it going? How can I make a player resurgence system on blueprints?
@empty matrix you mean something like teammate revive that most battle royal have ?
Yes
I made this easily
I have a replicated enum for state of my the character (Normal, Knockdown, Dead)
when player loses heath he goes to knockdown state.
based on that enum animation blueprint switches to different state machine as well
it is not that. I mean, when an ally dies, take a card or banner and take it to some point to revive your teammate
@rose egret
I got it. you mean respawning teammate.
I just spawn a new pawn an then call the posses function
its very complicated and depends on your game.
@nocturne iron Shipping packaged builds require to be started from Steam to have Steam features, unless you add an appid file.
I got it. you mean respawning teammate.
I just spawn a new pawn an then call the posses function
@rose egret Thanks you very so much!
A little doubt ... In the video there are some animations (in the case of the knocked down), where did you find these animations? If you know, could you send me the link?
@rose egret
@empty matrix I bought them from marketplace.
https://www.unrealengine.com/marketplace/en-US/product/injured-and-revive-animation-pack/questions
Jeez... it's paid .... Could you send me the manifest file?
You know the people who make these assets for a living are here, right ?
Oh... Sorry
Hello everyone,
I noticed that in some cases, MP clients don't get a pawn created for them when joining the server. It happens occasionaly here and there.
Is there a way to have certainty in pawn spawning?
The PlayerStarts don't overlap anything, so it isn't collision based
see the log
Good morning. I've been learning a lot about Multicast vs RepNotify lately so let me know if this sounds right: A pawn death in a space shooter that consists of a sound and a particle effect should be a multicast event. This is because it is an event that does not change state. Players joining after the death which takes two seconds to play out don't need to see and hear the death effect.
Does that sound right?
I'll have a look
@waxen socket handling "death" of objects in general can be more finicky with the rules, generally speaking what I would suggest is if all you want to do is play a particle and a sound, see if clients can handle that themselves locally.
Strictly speaking an object becoming "dead" is a state-change on the object itself
But if for example you are already replicating a "health" value, do you need to notify clients of the death at all, or can they process it locally?
I see what you mean about it being stateful. I'm a little confused though, because if I want the clients to handle it locally, I still need to set it off somehow, right?
So I can do that through a RepNotify property or a Multicast. Are you saying that RepNotifys are just a cheaper way of notifying the client it needs to do something?
In my case, I have an integer called Lives that I could replicate. Each ship has two or three lives to begin with and when it loses its last one, it dies.
So then is it really better to run my death functions off of OnRep_Lives than using a multicast event?
Too many Flynn's on here can't tag you.. but yeah it's kind of up to you. If the clients already have some info they can use to play death FX, I would just piggyback off of that.
But it's really situational so there's not really a right answer
Lemme find my thread
Sorry. ๐
If the clients already have some info ...
By that, you mean, if there's a RepNotify property involved.
It's not specific to the discussion of property vs multicast, but me personally, I tend to replicate a property, tear the actor off, then let the client handle death - but it all depends.
Yeah either via RepNotify of if you're already checking elsewhere. Rep Notifies have no networking cost, aside from the cost of the variable itself
Thanks for the thread. ๐
yeah it's a different situation, I think object death can be a reasonable use-case for multicasting over property rep sometimes
Tearing off gives you a bit of a buffer though, the client can handle destroying the actor itself, so you never get a case where a death effect starts, then the object is destroyed halfway through or something.
I'm sorry, what do you mean by "tearing off"?
Tearing off basically means removing the actor from the networked actor list, but not destroying it
So it's like saying to clients "game is done with this actor now, do what you want with it"
Once torn off, the client becomes the authority, and the client can cleanup in it's own time
Oh! You can do that? Like... stop replicating an actor midgame?
Yeah, just call "TearOff()" on the Server
There's one caveat - once torn off, any changes made after that replication frame won't be sent.
And it could be lossy, i.e. you might not receive the final state before tear-off, but that may not be an issue
I will need to be able to bring the pawn back to life though if his friends pick up a respawn power.
Ah so yeah that changes thing - in that case, I would definitely use property over a multicast.
If it's the same pawn, and it can "die" and live again multiple times, it's definitely a state
Yeah, just I just cheekily move it offscreen and disable its input rather than going through the process of actually respawning later.
You'd definitely use a property eh...
For that approach yeah definitely
And that's because... Just to save one Event call by piggybacking off of OnRep_Lives instead?
It's more about maintaining sync between clients
If the multicast is dropped (if unreliable), or if a client joins while one player is "dead", they wouldn't neccesarily have the correct state of the game
Or, for a player who is already in the game, but was out of relevancy range when the actor died etc.
Okay, I understand. You really don't like multicast, do you? ๐
No ๐
For reals, I've only found like one or two legit cases where it made sense over property replication
Okay, I have a tangentially related question.
If you have any more patience for me.
Do you think burst counters are worthwhile for semi-automatic weapons that can fire a maximum rate of 1/0.2s?
Cause right now I'm using multicasts for that and it works but I'm aware of burst counters and you seem to be the expert on them.
It seems like so much work... ๐ฉ But I trust you.
It's not as bad as it seems .. one sec
need to update the page but some code and thoughts here: http://jambax.co.uk/better-burst-counters/
out of curiosity, do you need to use burst counters if you're using GAS?
I think Kaos would be best person to ask, but I think gameplay cues is the answer is GAS
epic! Sorry to butt in, just saw the conversation pop up
Thanks for the article. I thought it was there that I read that burst counters might not be appropriate for semi-automatic weapons but I guess not.
Yeah so that's a problem with the default implementation from shootergame, where you can miss those "single shots" because it resets
But the approach we used fixes that issue, and also the issue with things coming back into relevancy etc. too
You've been so helpful to me. Thank you. I'm a professional 3D games artist. If there's ever a small
asset that you need for a prototype or something, maybe I could repay your time.
Does seamless travel persist all player controller properties without manually copying them after traveling or only the controllers themselves?
depends on what you did exactly
breakpoint HandleSeamlessTravelPlayer
in GameMode
check that the PCs aren't reinstantiated
They definitely don't get BeginPlay or PostLogin called on them
if they are, you do have both old and new PC valid at the same time during that function
After the first travel
no, because they BeganPlay on previous level
and PostLogin doesn't get called during seamless travel
Right so are the properties associated with that controller also brought over?
Since begin play has already been called
Having a look at the code now
the system can be quirky, depending on if the PC class is the same on departing/travel/arriving map
Yes it is in this case
But since this is just caching challenges that have been completed after each travel I may just store them in the GI as it makes more sense there
if it does, you'll have to manually copy stuff
I'm assuming in this case it doesn't as begin play doesn't get called
But I'll double check and debug
and if BeginPlay wasn't called... yes
Thanks for the help!
Also explains why any UI pointers that weren't marked as UPROPERTY caused crashes for me months ago
Old stale pointers from the previous level
PreClientTravel override is a very good place to nuke the UI
Yep I nuke any possible things that cause seamless travel crashes there
Like audio components etc too
@waxen socket Thanks :D, and np's!
is it expected that adding an element to an array in blueprints it won't cause replication? specifically repl-notify notification? If I set the whole array then it fires, but just calling add on it doesn't
adding/removing elements will cause it to rep
changing an element won't
so if you remove, then add something, the count doesnt change, and it wont rep (if done before the rep)
@meager spade strange. I don't know what I'm doing wrong then. Setting it clearly says "set and notify" or whatever. add doesn't say that. but I just went to sending the individual elements back via rpc
anim instances don't exist on the server, right? How do anim montages and animation notifies work in that case? Can you still use them on the server?
animinstance does run server side
Everywhere i read says that the ABP/anim instance is client only
If both the ABP/anim instance run on server and client, does that mean that the animations are running on the server also?
if the visibility rules are Always refresh and update bones
then server will run anims just like clients
even montages
if its not, then montages will fire notifies but server won't update skeleton
there is a lot of other small details but that is it in a gist
so if its set to the default "Always Tick Pose," it will still fire the notify events, but will not move the bones on the dedicated server? Is that correct?
I suppose that as an optimization, if needed, I could conditionally enable the always tick and update bones for anyone in combat, then disable afterwards?
sure
Do i need to open a level for other players to find my session?
Good morning. Is it common to loop through the player controllers in the game state in order to set properties on each one of them?
no
if any class should ever loop through player controllers, it should be gamemode
Oh really... well then. I've made some mistakes. ๐
I was looping through to display the game over screens.
unlike gamestate, its actually easy as well
GetNumPlayers -> For (0 to NumPlayers-1) -> GetPlayerController[Index]
and that is one of the good uses of GetPlayerController[Index] function
Okay, thanks. But then why does the game state keep an array of all the player states?
Sometimes when reading about it, it seems like I'm not supposed to put any functionality in the game state.
PlayerState != PlayerController
So then is it common to loop through the player states in the game state in order to set certain properties?
So say I have a co-op game where when one player picks up a weapon, all the players are equipped with that weapon. Would I have the pickup class fire a RunOnServer event in the game mode that would loop through all the player controllers and set the related properties?
PLayerController generally shouldn't concern itself with stuff like what weapon is equipped
But could I loop through the player controllers and access their pawns and set the properties there? Is game mode the place to do operations like that?
generally, making a god class that handles everything is really bad
i realize gamemode and gamestate are easy to access, but
just cluttering them with all logic you dind't make a dedicated object to handle results in an unmaintainable mess
every strong dependency you add makes your code more and more inflexible
and more and more likely you'll just end up deleting everything and starting over
Thanks for your time. How might you handle my example about setting a weapon on each client in response to a pickup?
@winged badger you should see my previous character class. whole the game was there thousands of lines ๐
more then that
(would be a basic approach)
gamestate doesn't equip weapons on characters
yeah, wouldn't involve the gamestate at all
say you put an actor component on a gamestate
PickupComponent
you can access it easy enough (GetGameState->GetComponentByClass)
it is replicated, and has a replicated variable to whatever the pickup was, with OnRep
it also has an event dispatcher, with input of the same type
If it's just a pickup you can walkover, I would even just have the collision done server side.
(tis what I do atm)
OnRep_Pickup just calls the dispatcher providing Pickup as argument
all Characters at BeginPlay just find GameState PickupComponent and Bind their Event to that dispatcher
and then as soon as you set Pickup Variable on the PickupComponent
it replicated, calls OnReps on both server and clients, all instances of all Characters on all machines have their HandlePickupChanged or w/e you call it event called
and are provided the reference or data about that Pickup in the process
and then they can equip themselves
or if you want to tone down on simulation, you don't set the Pickup there as replicated, and then it runs server only and replicates through Characters themselves
doesn't really matter, the event dispatcher is what you should use
I see, okay. I'm just reading this over carefully... ๐
@rose egret i saw something similar few years ago, a main Character class that had 19 BeginPlay pin Sequence and 22 Tick pin Sequence
you do not want to have logic for equipping a character in your gamestate
because it doesn't belong there
I see. I want to do it right.
yeah data/function locality is more important in MP
in SP you can get away with... lunacy
when you have 2000 classes/blueprints around, and network ontop
and you can't logically assume where some part of the code lives
you will spend a week hunting down a bug that would be obvious if it was structured/encapsulated correctly
note that godclass still manages to somehow, be even worse then poor encapsulation
thats the fix 1 bug, make 10 new ones in the process scenario
So, when you say to add the pickup to the game state as a component, you mean as a literal component?
btw, its fine if you put your event dispatcher directly in a gamestate
for now
that is easy to refactor and move to component later if the situation calls for it
like less then 5 minutes work
@winged badger
regarding a big character class I came up with the idea of making several inheritance. currently I have ACharacterBase > ACharacterAlpha > ACharacterFinal > BP_Version
movement and input in base, heath and damage in alpha, marking and ping system in final.
not a good design but least helped me a little
its not
inheritances purpose is not to chop functionality in smaller pieces
we have a CharacterBase, from which we derive HeroCharacter, Civilians, Monsters
CharacterBase has a common functionality shared between all of them
thank god at least I didn't name them by numeric suffix.
ACharacter1 > ACharacter2 > ACharacter3
๐
btw UE itself doesn't follow these rules just look at Actor class everything is there
๐ค
So Zlo, does this look right?
**
Pickup Actor**
Inherits from Actor
Set to replicate
Has RepNotify property โname Typeโ
OnOverlap, accesses Type through game state, and sets it to be respective type causing OnRep_Type to call Pickup dispatcher.
Game State
Has property โname WeaponTypeโ
Has event dispatcher with input of Name
Character
On BeginPlay, binds to Pickup dispatcher in game state
Has function bound to dispatcher that changes weapon to incoming type
too many calls
first overlap triggers both server and client side
so without restrictions, it will broadcast the delegate on both
if gamestate doesn't have a replicated variable for pickup, its fine
the event dispatcher input should be the same type as replicated property in pickup
possible errors if you destroy the pickup on overlap
might cause desync
as destroying an actor after server's overlap could replicate before client overlap happens
and you do not have server auth
better to limit the overlap to server
access the GS on server
broadcast the delegate
have Characters handle the event by setting their replicated, repnotify variable for the weapon
and then handing equip on clients onrep
that way no errors, server auth and you do have consistent states with late joiners or someone entering relevancy
That sounds logical. The only thing I'm not understanding is the component part.
ignore it for now
How may I "limit the overlap to server"?
I believe Zlo is referring to to the "switch has authority"
Okay, Zlo. How does this look?
Pickup Actor
Inherits from Actor
Has property โname WeaponTypeโ
OnOverlap, accesses game state on server and calls Pickup dispatcher
Game State
Has event dispatcher, โSetWeaponโ with input of โname WeaponTypeโ
Character
Has RepNotify property, โname WeaponTypeโ
On BeginPlay, binds to SetWeapon dispatcher in game state
Has event bound to dispatcher that sets weapon to incoming type
OnRep_WeaponType sets weapon components on each character on each client
What would be the best way to determine if an actor is owned by another client (or the host)? I'm using SetOwner when I spawn these actors in (server RPC) based on which client initiates the spawn. But I'm having trouble with getting the owner to replicate to the other clients to be able to do something like IsLocalPlayerController().
@waxen socket still feels a bit jumpy
why does the gamestate need to despatch that a weapon has been picked up?
I figure because the weapon is equipped to all four players so therefore it's "stateful"?
@waxen socket i see what you're getting at, however there are a lot of things in the game that have state. each actor has it's own Transform state for instance. Try thinking of it from the perspective of "who owns this data" or "who is responsible for this action"
IRL metaphors often help me figure that out
Thanks, Alomax.
The weapon will be equipped to all four players for five seconds before being unequipped. So that's why I see it as a state of the game.
A generalized effect like that does make a good case for a centralized "owner" rather than each individual player. The caution you're hearing from others is that its really easy to accidently end up with a ton of stuff in an easily accessible global class like GameState and curse your past self
I see, I'll try to respect that advice.
Additionally, is using a dispatcher always a better way to access every player at once rather than looping through an array of pawns?
dispatchers allow for loose coupling, both the sender and receiver don't need to necessarily care what kind of class is on the other end. looping the array of pawns makes the class doing the loop tightly coupled to the pawn type. this is not inherently bad, especially if you need to do something very specific/unique to the pawns
Thanks for your time. I think I understand.
Having a problem with the steam subsystem, help would be VEEERY appreciated!
https://youtu.be/GK_CXR9Rq6o
I'm getting lots of double replication stuff happening and I think it's "listen server" vs "dedicated server" stuff.. can you support both with one code path or do they have to be completely separate?
@echo socket I'd say the code is largely the same, one thing we often do is having to emulate OnRep calls for ListenServer or Standalone
bit hacky but it tends to look like this
if (GetNetMode() == ENetMode::NM_ListenServer || GetNetMode() == ENetMode::NM_Standalone)
{
fromInv->OnRep_SlotData();
}
does UClass* replicates?
@silent valley thank you
turns out my problems were related to my sloppy programming of things I actually understood instead of multiplayer things I didn't. Which is sort of good and bad... ๐
@heady python steam functionality is disabled in the editor
it'll work in standalone game mode but not in editor
Hey guys, I have an issue with grass not spawning on all my levels for clients on a dedicated server and map using world comp. Grass only works on some levels near coord 0,0. Levels beyond that are bare
However it works fine if I run the game locally. Also foliage and LODs seem to be working fine. Am I missing something with grass in a server environment?
@lost inlet I played it in standalone in the video
are steam auth tokens handled internally in Sessions now, or is there still extra work needed
@lavish cypress You have to enable Authentication but yeah it works.
See ShooterGame for an example implementation
Ok
client waiting for the dedicated server (AWS amazon)loading the sublevels maps of world composition presistent levelcan wait between 5 minutes to 10 for the maps loading!....hello! i make a dedicated server under Linux and i upload it to AWS (AMI) i test it with client so all working as expected and the client can connect to the dedicated server but when i'm loading the maps (after connection to the server) the maps show empty in visibilty but the ground is clearly there and the client wait long time for the sublevels maps loading...is there solution for this issue? (my server map i make it with world composition) my dedicated server need some GPU for async the loading of sublevels quickly?
is it possible to connect to dedicated server with Steam OSS? Server is located on Google cloud and I connect via IP not session
- If I set server -nosteam, I've got
incompatible_unique_net_iderror - If I keep Steam enabled on server, client couldn't connect at all. Nothing happens on both client and server
I just need SteamUniqueID ๐ maybe there is a way to not use steam OSS at all but still get it?
Having a problem with the steam subsystem, help would be VEEERY appreciated!
https://youtu.be/GK_CXR9Rq6o
@crimson fiber I believe you need to have steam on the server and on the client, but you can't simply connect to the IP that you know the server is in and join, you'll have to ping the query port using https://partner.steamgames.com/doc/api/ISteamMatchmakingServers#PingServer and that will return a steam ID that you can then use with the command "open steam.SteamIDThatYouReceived::yourGamePort"
This is probably not the best way to do it, but I have made it work with this in the past
I got this info from @twin juniper here: https://forums.unrealengine.com/development-discussion/c-gameplay-programming/1483622-connect-to-steam-dedicated-server-via-raw-ip
Hello there,
I am using Steam for multiplayer, so I can easily browse and connect to my dedicated servers using the Steam server browser or my in-game
yeah I found that topic, gotta add whole c++ for this...
maybe session will work, trying them rn
I'm working with OnlineSubsystemNull and trying to connect a MacOS client to an iOS server/host (or vice versa) and I keep getting aninvalid net id error when I try to connect. Connecting iOS <-> iOS builds works, but cross platform does not. Is there something I need to enable / disable? This seems to work out of the box with the Collaborative Viewer example provided by Epic
I've tried setting the cvars for net.IgnorePackageMismatch=1 for iOS and MacOS Device profiles, but it doesn't seem to change the behavior
your versions are not the same
could it be because I'm trying to connect via PIE?
you can't connect a same source engine packaged build with one packaged with vanilla launcher either
iirc you need to explicitly provide a version ID (defaultengine.ini) for unreal not to generate one automatically
that sounds like it might be the culprit, let me try that
what I'm trying to do is run a packaged build on iOS and also run PIE in UE4 so I can do some debugging
I'm using a vanilla launcher UE4 version right now, but I could move over to a source compiled version if that's necessary
I guess I'm confused how the Collaborative Viewer example works with a vanilla launcher version of the engine and is cross platform out of the box, but let me try explicitly setting version numbers. I noticed Xcode does increment it everytime I package, and somewhat randomly
Hey :)
Is there a way to call a RPC on a server owned actor that is sent to a specific client or will I need to add a RPC on the player controller for that purpose?
with the event logout does the controller reference have a valid reference to the controlled pawn? or does it immidiatly destroy the controlled pawn upon logout?
Since the pawn is referenced by a UPROPERTY, you can be sure your pointer is valid or null
okay, because I have the server save info on the variables stored in the character and I want to save the variables when someone disconnects before the character is destroyed
Maybe better save stuff for your player on the controller or the player state? Since then you don't need to worry about your character^^
I'd like to refrain from storing stuff on the player state with such things like inventory items, if im not mistaken player states can be seen by other players and i dont want others being able to access other's inventorys by that
I have some other functionality that kind of banks on accessing the inventory from the player character so controller might be a slight issue with that.
well then the playercontroller is better
since the player character is also replicated
wait. couldnt I bind an event on destroyed? and just only run the event on the server?
or would the variables be nul because it was destroyed
sure, but what if you want to destroy your char for gameplay?
only instance that the player's character would be destroyed would be upon death or some sort of respawn.
but I have some other things handling spawning the new character and updating it's vars with the previous character's vars to then destroy the others.
and if the player were to die. it still remains present. the controller possess a newly spawned character. with the old character staying there it offers other players to come over and access the inventory of the dead character
And what happens if your player dies and disconnects?
@marble gazelle that actors owner will need to be the player
if the owner is player, then server/client rpc's can be called
yeah, but in this case this is not really possible ๐ฆ
then will have to be done through the PC/PS or player pawn
I have a Chest that can be looted per player and I wanted to send the open event per player ๐
yeah
you can do that tho
controller sends server rpc, server sends client rpc back via the controller
but ye have to be done on the controller
yeah, I'm currently doing it over my interactable system which uses a component on the PC to replicate and my unlocks to set the open state^^
(i do all my interaction stuff via controller)
nah i don't use a component
i have a base player controller, which handles generic stuff
and then a Game player Controller
which handles game specific stuff which doesn't fit in the base
so i can kinda keep them clean
but no components
Well, I use components^^
ye, extra calls i like to avoid lol
Well but if I put everything in my code, its not really data driven or customizable
Having a problem with the steam subsystem, help would be VEEERY appreciated!
https://youtu.be/GK_CXR9Rq6o
@heady python did you add DynamicallyLoadedModuleNames.Add("OnlineSubsystemSteam") ? there should be log entry in output indicating subsystem load
A week ago I switch from UE 4.21 to 4.24, but now I have problems with the replication. First of all the Replication is very slow in 4.24. But the biggest problem is, that my Clients teleporting back, if they move. I had never this problem before. How can I fix that? ๐
@wanton tulip I'm not sure and I hope I don't suggest something bad, but what about doing smaller jump. 4.21 to 4.22 to 4.23 then 4.24
should not be a problem usually, but I know that the more big the jump is, the more problem can occurs
IDK, I read often that there is an problem with the CharacterMovement in 4.24. There are many Question about this in the UE4 Forum, but no question is answered.
Hi everyone! I'm trying to create a GameInstance that derives from UAdvancedFriendsGameInstance, but when I created it, it's unabled to open AdvancedFriendsGameInstance.h. Do I need to add a Public Dependency Module Name or something like that to be able to include this file? Thanks!
do you need github open source to make an online game?
hi if anyone in the multiplayer networking community can help me it is urgent so the issue I'm having with is that on the client side and the server side is fine but when i try and get my character to interact with a vechicle it is all messed up the player can not move the car at all I really need some help it is urgent
the player gets in ok
everything is replicated
I'm setting my character mesh rotation on tick in order to match the rotation of the landscape. How should I replicate this so that everyone will see the rotation? I know I have to do this correctly since it's using event tick or my network bandwidth will be destroyed.
that stuff should just be done locally
all my visual stuff like TIP, ik, etc anything like alignment is all local
This is on an AI crocodile so how do I do it where everyone can see it?
I do my linetrace inside my AI crocodile animBP and then set the world rotation of the mesh.
How do I prevent the server from running the RepNotify method? I was pretty sure they were not supposed to run on server.
Setup: I have a replicated property (an array) with a RepNotify method, all in blueprints.
Expected: I set the array on the server, RepNotify only runs on clients when the modified property is received.
Problem: RepNotify also runs on the server
@meager spade It is because I'm using an RInterp to node to set the rotation of the mesh. If I set the rotation directly it works but makes the mesh look 'snappy' or "pop" into place. How can I smoothly rotate it if the RInterp to doesn't want to work for clients?
@floral crow in BP RepNotify is called on server
in C++ OnRep is NOT called on server
so just gate it behind switch auth
if its an issue
also, setting a repnotify variable locally on clients will trigger onrep on that client
still struggling with getting past the version mismatch when trying to connect to my deployed iOS build from PIE on a Mac. Do I need to build from source to explicitly set the build version number?
when a player joins the pawn has a post prosses on. the player respawns in a new character that doesn't have a post process. when another character joins they are in the pawn with the post process. this post process on the pawn the new player is in effects the other players. it shouldn't do that and how could I fix that?
so the new player spawns and then all the other players get a post process effect at the same time?
yes
@proud pier Take a look at FNetworkVersion::GetLocalNetworkVersionOverride
There is also IsNetworkCompatibleOverride.
Thanks @meager spade @winged badger . It was the discrepancy between C++ and BP what caught me off guard!
I am curious as to how the flow of players are. My players, would load up as offline. but if they hosted a local server, they would be then become the local server? and if anyone joined any server listen/dedicated they become a client?
If a player hosts a local server, it can either be a listen server or a dedicated server.
If a player joins a server, they will then be a client
and when the game instance originally starts up, it is just referenced as "play offline" in the play tab?
I usually refer to that as stand alone
alright okay that clears it up thanks
Any of you had the issue where you only get port 0 for your session port instead of 7777 for UE4?
I checked my work against Sam's from GDTV and it still isn't working.
I think it is a project setting instead of something from C++.
Any ideas would be great
SessionInterface->GetResolvedConnectString(SessionName, Address)
SessionName = FString
Address = FString&
and Address gets returned as XXX.XXX.XXX.XXX:0 instead of XXX.XXX.XXX.XXX:7777
I tested SAM's version and his works and I can't find any logical difference between my code and his
We both get the correct IP, I just get 0 as a port.
A solution to this may be to do a diff on all the unreal-editor project settings
Is there a way to do that?
I'm assuming you can replicate bitflags?
If not, cast them int, replicate int, cast back.
Or write a custom NetSerializer, but I would assume yes ๐
uint8 would be better
@plush wave FHitResult has excellent example of custom net serialization, you should take a look
yes
for example it serializes bImpactPointEqualsLocation in one bit
if its true, it doesn't serialize ImpactPoint Vector when saving
and when loading it just does ImpactPoint = Location;
it's actually very easy to connect Steam client to Dedicated with just openIP... Just don't use SteamNetDriver
Should I install Steam or smth on Linux machine to be able to launch Steam-compatible server?
inherited variables can't be replicated? o,o
if I change a replicated inherited variable on the server to true its false on client, if I change a variable thats from the actor itself it gets replicated..
Inherited variables do get replicated AFAIK, at least in C++
so its a blueprint bug? oh no
It's very likely not a bug
Explain what you did in detail and what does and does not work
Where do you change the bool, how, when, what is replicated, did you add logs to confirm the behavior..
okay I have a character baseclass with a bool, of that character baseclass I made a child and now in the child I call a function on the server that sets the bool.. doesnt work
baseclass replicates and the child too.. now with always relevant
If I do that with another bool it works
Is the bool set to replicated on both parent and child ?
I checked everywhere else it isn't set anywhere else
wait a minute..
okay thats strange ๐
seems it was set without pressing the key
intended was stopping direct control and after something finished it would have been set back to true
ah, maybe its the case that server and client don't have the same knowledge
and rather not replicate it then?
Variable replication cannot go from client to server.
It always goes from server to client.
oh I know why
server never knew it was false so why replicate?
thought the act of setting a variable will replicate it
If you do so on the server, it should replicate to the client depending on the replication flags
Can I do multicast RPC which sets value to variable X, and variable X is replicatable.
Does it makes sense to do?
doesn't make sense if its already replicated
but if you want to call a function or play animations in the same multicast I think you can do that in one multicast
@warped fjord thanks even I thought the same
I think I will set the values on server and listen for onReplicate at client side
replication caused me so much pain in the past.. better be sure ๐
Yeah replication is really confusing
And I should only use multicast RPC for requirements like events from server to all clients
How many AI actors can a default dedicated-server handle with default settings before things start to go wrong?
@meager spade Hey, Could I ask one short question about the navigation prediction you did? How do you do move requests? Do you still keep your AIController server only and on the client you communicate directly between nav system and path following comp?
Od did you also implement client-side AIController
Client side ai controller
We just replicate it to owner just like player controller
I see, that makes sense, thank you!
Guys, how can I do to change the parent class of a character, without opening it?
I'm crying here .... I've been developing this game for two years, and I just lost all the things I did in the character .....
@empty matrix see if this helps you: https://forums.unrealengine.com/unreal-engine/feedback-for-epic/86666-reparent-a-blueprint-before-trying-to-load-it
Tell us how to improve Unreal Engine 4!
@empty matrix also look at source cntrol
anyone used socket.io for UE4 the default readme is having an issue where it claims that one of the functions isnt' defined
UE_LOG(LogTemp, Log, TEXT("Received: %s"), *USIOJConvert::ToJsonString(Message));
});```
it claims unresolved external symbol "__declspec(dllimport) public: static class FString __cdecl USIOJConvert::ToJsonString(class TSharedPtr<class FJsonValue,0> const &)"
but i can open the header and it's right there
Need to link against whichever module has the cpp file for USIOJConvert::ToJsonString, in build.cs
my b
ok so it compiles and runs but the server can't seem to get the connection
for multiplayer android the ue4 create session failure always and i thought that because when enable google play support the [OnlineSubsystem] DefaultPlatformService=Null unloaded and load Google Play Subsystem....anyone have idea how fix this issue and be able to create UE4 session with android platform ? when i test with my PC i can create session and get access to the dedicated server on AWS but with android can't create session so can't access to the dedicated server on AWS!
Hello, I have a problem again. If I try to call SetViewTargetWithBlend directly behind the Unposses nothing happens. This only works if I use a delay between the two. Maybe there is another option because I don't want to use delays. This error only occurs on the server.
Hey, I just loaded up the FPS blueprint in ue4, is it automatically in singleplayer or do i need to set it to singleplayer? I wanted to make sure my game isn't multiplayer or anything like that
it doesnt matter if its single player or multiplayer
UE4 doesn't have different "modes"
for the project per say (well it does but not that you should be concerened about)
so yes it will be single player unless you want to do multiplayer.
okay, thank you!! I'm really sorry if that was a stupid question ^^
Is if (SteamAPI_IsSteamRunning()) the right check to run before calling any Steam API functions that could crash the game if Steam isn't running?
Or is there a better check around?
I'm looking for a sanity check on replicating actors on the game state. I have an int set to use ReplicatedUsing and that event gets fired. But my actor that I'm creating on the server in BeginPlay doesn't hit its OnRep call. What am I missing? I've replicated actors many times and never run into this.
Let's say I have an Actor, and this actor has a widget component on it. I have a widget C++ class which handles the logic. Part of the widget is a Dynamic Material Instance so that I can change how it looks at runtime. How can I go about making sure that material looks the same on both the server and the client if UUserWidgets cannot replicate?
you wouldn't replicated a dynamic material instance
you'd network whatever the relevant parameters are for that material
client cannot create or join session for open the AWS amazon IP of the dedicated server in android if google play is enabled... but i need google play enabled because the game for android..anyone have solution for this issue? when i test it with pc client all working us expected but with android client failed to create a session so can't get access to the dedicated server IP adresse of the AMI AWS ec2 amazon...
does the client log say anything? does the server log say anything?
i haven't worked with mobile or google play but at least that might give you some clue
it's important to note if the server is actually receiving the connection and it's just failing for some other reason like auth
it also looks like the OSS plugin is android only with no server support so i would also make sure that the server isn't trying to use it as the default OSS
@lost inlet the Android client log say 'error to create session' this message from the print string i use it for debug but the pc client can create session and open the IP adresse and teleport the character to the dedicated server map hosted on AWS AMI amazon
This code is failing to set the owner of ClientSimulationClock correctly, because I'm trying to call an RPC on the object and it's saying No owning connection for actor ClientSimulationClock_0. Why is that?
Shouldn't the Player controller itself be THE OWNING connection?
The RPC I'm trying to call
The call that's getting rejected comes from this Looping timer
HI guys, Can anyone tell me why my listen server won't spawn as spectator even if I checked "Start Player as spectators" in the game mode ? turnin on/off "Delayed Start" won't work either. Launching in dedicated server mode will work but can't manage to make it work for listen server configuration.
@floral crow That should work, as far as I can see. The AClientSimulationClock actor is also replicated right?
Though unless you need an actor for a specific reason, this might be a good use case for an actor component instead.
@floral crow that RPC works better if the client sends its own Timestamp to the server, and server RPCes the client's original TImestamp and its own Timestamp back
Hello, I have a problem again. If I try to call SetViewTargetWithBlend directly behind the Unposses nothing happens. This only works if I use a delay between the two. Maybe there is another option because I don't want to use delays. This error only occurs on the server.
Anyone an idea? ๐ฃ
@wanton tulip Why doing it after unpossess. Im pretty sure thats your issue. If you unpossess then you have no camera technically to set viewtarget with
@winged badger While that doesn't actually fix the issue of not being able to send an RPC because of no owner, why is that way better?
because when you receive the return Client RPC
you have the timestamp you sent the request to server
so you just substract that from current timestamp for round trip time
No point sending that to the server, you can just save it on the client
calling SetOwner on that Actor Server side with PC as Owner
solves the other thing
code is more cohesive with timestamp sent and returned via RPC
there are no breaking points, there are for caching it
where does the default Steam session ID come from?
@wanton tulip Why doing it after unpossess. Im pretty sure thats your issue. If you unpossess then you have no camera technically to set viewtarget with
@wicked brook Yes, but why its working 1 second after the Unposses?
@wanton tulip not sure. Is it a separate pawn or what? whats the setup?
The Pawn get killed -> Unposses -> SetViewTarget to the Killer
is there any way to get non-local players on client other than checking all actors and looking for the specific class? ๐ค
*player pawns
@wanton tulip you shouldnt need to unposess at all maybe. I think you can possibly do set view target only