#multiplayer
1 messages · Page 696 of 1
job stuff?
the subsystem is fine on the client
but the actor proxy is not replicating my array of jobs correctly
is there like a pre-replication function i can put a breakpoint in so i can confirm the server has valid information?
so it turns out the answer is yes there is a pre-replication function called AActor::PreReplication. i can confirm that in this function all the jobs are valid, its just not replicating them. i have the correct number of jobs (34) yet its all null
Are the actors replicated and have you confirmed the actors are received by the client?
You might need to set them to always relevant unless you derived from AInfo
ye so my AJob derives AInfo, and my actor proxy is replicating the clients
And are you observing this array after you know… for sure.. that the client has the actors
i posted an image earlier that showed the OnRep function for my TArray<AJob*> property, which i would assume means the actor is existing and such
Why do you even need a replicated array? Can’t the AJobs just self-register on the client? Is order important?
the whole point is to have the server issue the jobs to the client in case the server has specific jobs disabled, or added ones that the dont ship with the game
i wasnt sure how else to do it
plus i dont need the entire job sent to the client, just the title really
but i need the job type so i can send it back to the server. its a whole thing
Hi. Yeah it was similar, but recently I deep-dived into source code and debugged some of the functions and I almost solved my own issue. From what I can see my issue looks related with something else
Feels like we're cursed 😄
so i think i found out whats wrong with my AJob not replicating correctly but i dont know what its deal is. in my C++ base class, i have bAlwaysRelevant = true; in the constructor, yet in the blueprint it is unchecked??? same with anything regarding tick, which is disabled in C++ yet ticked in the blueprint?
this is probably no longer relevant to this channel though
Okay so im looking for any advice possible. Long story short I have an actor that is acting as a players weapon. This weapon gets spawned in on the server and replicated down to the client so the client gets a proper reference to the weapon actor. The actor also is getting its owner set to the owning players PlayerController. From what I understand these two things being true will allow an actor of Role SimulatedProxy to call a server RPC. Though I'm getting a non fatal exception when I try and call a server RPC from that clients actor. If there is any other information I'm missing or any information that needs elaborated on please let me know.
This image may be helpful as well with the stack and the exception. Whats odd is how far it makes it up the calls after calling the Server RPC which is the "ServerFireProjectile". Previously when i didnt have the actors owner correctly set it wouldnt it into the server RPC function at all.
you wont believe this. i didnt have a current editor build 🤦♂️
probably something wrong with the FTransform (why do you even need to send an FTransform anyway)
also what's this here:
wait, non fatal, so it's probably asserting then
well check()ing
That is the function within the "weapon" actor that calls the server rpc
AModParent is the parent of ADefaultAmmo
Does that provide any extra information in particular?
well what line is it erroring on
maybe look at that
and you didn't answer why you would need to send an FTransform anyway
Because that server RPC spawns a projectile onto the server and that is the Transform I'm using to give to the Spawn Actor method
And this is that line that starts causing the issues. But the actual exception looks to be happening within the machine code at the top of the stack
Rebuilding now to recreate the issue to get the actual line
yep still not sure why you're sending an FTransform
why not just send origin + direction?
Note: this works perfectly on the server so im not sure if it would be anything wrong with the FTransform. Though i could definitely do it that way and see if that changes anything at all since mabe that Transform data is getting messed up somehow
well your call stack was to do with it serialising the FQuat in the transform
and it looks like the reason you're sending it is pretty redundant
in an RPC you usually just send what you need, nothing more
Thats definitely a fair point and something to take note of and change. I'll see if doing that changes anything since your right the error is definitely happening in the FQuad which leads back to the FTransform
Okay so the FTransform was definitely causing that exception and now that I've adjusted that and whatnot it now simply just doesnt call the server RPC even though from what I understand it should be allowed to even though the actor is a simulated proxy
look at the log then
if it has an error mentioning the RPC then the net owner is actually incorrect
I'm unable to clrl find the rpc name in the log file. Some other people in my project or print lots of things unneccesarily so the log file is a bit too cluttered to actually scroll around through
Should be able to just look at the log while playing and trying to execute the rpc
Either in the editor or when starting the game outside with -log
It isnt resulting in anything getting printed to the log at all after the server rpc is called
btw if anyone was wondering how smooth my brain is, i was NewObjecting an AActor which was causing it to not replicate correctly. so all my replication stuff is working now
Thats interesting, cuz NewObject<> actually allows UObject to replicate but not AActor, on my end
For 4.23 tho, not sure if it changed
ye no idea. its working now so im scared to even look at it. i dont recall ever showing this code so i dont expect anyone would have seen it although i appreciate everyone who helped
whats the reason that TMap and TSet are non-replicated?
Hey, nooby here (sorry)! I am a intermediate/beginner programmer coming from Unity. I am trying to learn Unreal because how much better it is for Multiplayer games.
I was told to start off with Blueprints and I found this course on Udemy that actually seems to explain everything. But he is teaching how to set up a Listen Server and from what I understand it's where a player is both a client/server.
I have been told that is is a very bad model for many reasons, but regardless of that would completing this course help me with the fundamentals of networking? Or is it not the best use of my time to learn how to make a Server Authoritative multiplayer system?
The course is called "Unreal Engine 4 - Multiplayer Team Based FPS In Blueprints" by John Galt on Udemy
Thank you for your time!
theres nothing inherently bad about a listen server
Sort of.
really depends on the game right?
What advice is being given if listen servers are a bad model? They can work for low density games
You can make mistakes because the server is also a client, so replication issues can pop up with other clients but not yourself
Yeah but you mostly just sanity check stuff in the editor in dedicated mode anyway
Doesn’t mean that using is bad anyway
@plucky prawn @lost inlet I am trying to eventually learn how to make a small scale (3vs3) competitive top down shooter. I have been told that a Listen Server is bad because people can cheat, steal IP and is very laggy if the host has poor internet. I was told that you should made a server authoritative game to reduce those issues.
Learn how to work with unreal first before worrying about that.
for anything competitive you want an authoritive server
Well you can use the p2p relays that EOS provides to prevent IP leakage
But cheating is a concern if your game is competitive in some form
Also a listen server is still “server authoritative “
Transitioning to a dedicated server is fairly simple if you've followed best practices (don't assume every instance of the game has a player).
But seriously, don't worry about it until you've actually learned the engine. It's not like you'll be throwing away work with a listen server.
A dedicated server just doesn’t have a player on it, thus dedicated
Hopefully you can get your server infrastructure optimal with a low player count per game
@lost inlet Thank you for the correction! I am still very much learning the terminology.
@hollow eagle That makes sense, so what you are saying is as long as I learn how to make a listen server in Unreal, then my skills will translate?
You're thinking of listen servers and dedicated servers as two different things. They aren't.
One just has a player.
The other doesn't.
Also do you guys have recommendation on resources that actually explains and is beginner-ish friendly? And is either up to date or at least relevant still?
It's not that your skills will translate - if written correctly you could literally flip a switch and it would work as dedicated instead of listen.
But again, it doesn't really matter until you've learned the engine.
And if you PIE with one player in the “listen server” mode then it acts the same as single player, so just don’t sanity check network code that way
@hollow eagle Thank you for the explanation!
The network compendium is a good place to start for an overview of unreal's networking (see pins in this channel)
that assumes you have some experience with unreal's game framework though.
Thank you guys! Also I have a burning question that I have been trying to get answered. I used to be very competitive in Super Smash Bros Melee and if you know the scene then you know how technical that game was. Even a couple frames off and things feel off, thats why most play on a CRT.
Anyways, what I am trying to get at is why was their Roll Back system sooooo good for online play? Before they added Roll Back nobody really played online because you had to play with the lag, but with Roll Back it honestly felt like Lan (if your ping was under 80).
So my question is why does their and other fighting games roll back feel sooooooo much better than most competitive games? I used to be pretty serious into overwatch and when I played lan tournaments I felt like I was playing a different game. Because when you play online you played with the lag in mind, but in LAN you can actually time things down to the mili seconds.
What's up with that? How can fighters feel so much more responsive than other competitive titles?
(bumping)
This is still causing issues and was wondering if there were any other things needed to be done to get the actor to call server RPCs besides setting the owner and spawning it on the server?
I have double and triple check the compendium and other docs and I know im setting the actors owner to the correct player controller. So I do believe that since the actors owner is the client player controller that means when the actor queries out to the most outer owner it should run into the player character of Role Autonomous Proxy which should allow the actor to run the server RPC. Are there any other settings to check for? As I most definitely have quadruple checked that the involved actors and whatnot are set to replicate, but is there anything else I might be missing from the compendium I should look at or any other bits of info I'm not taking into consideration?
Have you tried routing the call through the PC itself and passing the actor in question as a paremeter?
And are you calling the function on an actor you think should be able to send a server rpc of from the actor?
(both is also an acceptable answer)
I belive the answer would be from in that context as its calling it from within itself
I have not as i have not worked on our PC much in this project and the person who did make it made it a blueprint only so i havent tried that yet as id probably just make the PC from an inheriting class of the base controller
aka probably just do it the right way
Always good to leave some wiggle room in your class hierarchy when doing that. Create a c++ class to inherit from and then create a bp from that, so you don't have to go rebasing your PC BPs
I'd do that anyway.
If I would have been the one to do it originally I would have most definitly done that from the start since its a c++ project in the first place
Would trying to do call it say from the owning player character have a similar effect?
That should work, too.
hi all
I am facing a problem with creating session
my iphone and other pc can't find it
I just went ahead and did it through the controller since it needed to be done anyway and it worked doing it that way! Thanks!
Np.
I can't find my created session on my local network on other PCs
If you are using Steam, and your PC and your phone are behind the same network, you won't find the session.
However if you are using EOS this will work
what are you using?
If you don't know, then you're not using any subsystem and you won't see the sessions. You kind of have to integrate an online subsystem to use
I am using the default engine subsystem
There are ways around it, but I myself have never managed to get my locally-hosted sessions to show on PC's on the same LAN network even when connecting through the internet.
The best thing you can do is print the steam session ID to the console, then use a console command to join it.
open steam.####### - replacing the #'s with your session ID.
FindSessions should work if it's marked as a LAN session though.
But FindSession for internet sessions only works if the host/client are of different public IP addresses IIRC
I was using 4.24.3 and everything works fine
but with this version this problem appeared
Not sure. I've been on everything from 4.16 to 4.25 with Steam and dedicated servers have never shown in the server browser for me when hosted locally.
Epic did make a few changes to Steam in recent releases though IIRC. Broke a lot of in-editor testing.
so if i host my game in amazon it should work right?
That one bums me out a lot because PIE is a second class citizen, so with no guarantees of functionality working on pie. That means when adding and changing things Epic can freely break stuff for PIE. It just rubs me the wrong way ...
i have a ton of PIE specific code, including being able to start a PIE MP game with procedurally generated network levels, kinda used to having to write code for PIE being able to emulate packaged game
And it's by far the most common way to develop and test the game, outside of automated tests. I just wish that in the future Epic's stance on PIE changes and that hotfixes are removed
Can someone guide me on advanced sessions ( not steam sessions ) just advanced sessions
I want to create a dedicated server session. So when i launch my dedicated server exe , it opens the desired game level and other clients from different networks can join in the level via adding the public ip
Possible right?
Plus i have public ip ( static ip ) installed on my router with ports 7777 added
@thin stratus HI again, as it worked yesterday i hope you can find a moment to help me with this: HI, all and @The Jackal i have a replication Problem. i want when Player overlaps with BP to show a message on the screen, works all but😵💫 it shows only on Server not on client. I need that only the overlapping player sees it
bp overlap
why GetBaseAimRotation return Yaw 0.f for other clients?
casting from a bp in th elevel to the hud
Please don't ping users for new questions. I'm not here to help everyone with their UE questions :P
oh sorry, now i know the rules no german and no ping
will do 😄
Shouldn't it use the Actors Yaw ?
@thin stratus for Character it must be ControllerRotation i think
ControllerRotation must return FRotator(0, 0, 0) for other clients, but GetBaseAimRotation will return only Pitch value, so how i can replicate yaw too?
It assumes that the actors' rotation has the same yaw
Pitch is handled specially via RemoteViewPitch
@chrome bay Is there any way to add Yaw by rewriting replication in c++ ?
Yes indeed. There's no documentation about this obscure bit since it lies a bit outside of ue's domain, but I think it'd be worth writing something about this. Did you have plans to do so?
Mostly looking for things to document/write but if there's something written by someone with more experience than me in the field I prefer to pinpoint to these sources
no one an idea`?
what is the question so i can have an idea?
and how is this multiplayer related?
Uhm, say i have this structure as replicated variable in my class
USTRUCT()
struct FMyStruct
{
UPROPERTY()
int32 PropertyOne;
UPROPERTY()
int32 PropertyTwo;
};
If i change PropertyOne, will it only replicate those 4 bytes or will it replicate 8 bytes ?
I try to cast to the hud and show a Message (Toggle visiblility on and off for a Image. But i cannt get it that it shows oly the Player who is doing it
A check like IsLocallyControlled will likely help
with a branch?
Ofc
i think it sends the entire struct
Oh god, that would be horrible
why not make them independent uprops if you need only the changed one
For the same reason why we use structs generally, to tight related things together >_>
@vague fractal like this in the BP whos triggering it?
Whatever logic should only run on the local client should be in the scope where IsLocallyControlled == true
So im running a server RPC that calls a multicast rpc from within my player controller and when the logic runs on the client everything runs fine and the multicast runs on the server and client, but when i run from the server side the multicast does not run on the client. Any have any points or tips as to why this might be happening?
The server side of whose Player Controller?
Server side of the severs player controller
Ah ha
Clients never have a copy of anybody's Player Controller
except their own
So that Multicast is getting sent nowhere
The GameState is an object which is replicated properly to everyone, try putting the RPC's there
Player State would be a more sensible place to broadcast a player-relevant multicast
I knew that but didnt realize it would cause that issue, is there an alternative way to moving the RPC's? Is there no way to get a multicast rpc to run on the client as well from the player controller?
Jambax is right
No, the clients can never receive Multicast on someone elses controller, the client doesn't even have that object so it can't receive the event.
The proper approach is to move RPC's onto objects that are replicated the way you want.
GameState
PlayerCharacter
PlayerState
These are the primary objects that every client will have, but PlayerState could be best if it is a player specific event.
An RPC is an object sending a message to the replicated copy of itself on someone elses computer. If that object doesn't exist on the remote computer, there is no object to receive the message.
Could someone verify this ?
Cuz if that's really the case i'm feeling like i'd have to completely change the way how i program when it comes to mulitplayer 😅
The owning client will receive the multicast, but nothing else will
Thats actually a very clear explanation and makes a lot of sense. Just to see if you have any further suggestions. The multicast im running is responsible for spawning the vfx for the corresponding players weapon fire. Would you still suggest doing that in the the GameState since im not sure if that counts as a "player specific event"?
If it's weapon fire it should go in the weapon class itself
I had it in there originally but was having issues with not being able to run server RPC's from the actor since it was a simulated proxy and even though i was setting its owner as the owning player controller and spawning the actor on the server as is supposed to be done but still could not call server RPC's
Weapons fire VFX should generally be the responsibility of the PlayerCharacter, which is also replicated in all the right ways (not sure about Pawns). This is because you don't want players receiving that VFX if the character creating it is far away (not relevant)
You could also put it on the weapon, but that sometimes gets conflated with character
I'll trying putting it with the PlayerCharacter first before the GameState since those two comments seem to make the most sense to me
Nah for WeaponVFX I wouldn't do GameState, unless it's a small game and sloppiness is of little concern
It would work
When hosting a listen server to be accessed by clients over the internet, does the engine know your unique game instance to separate it from other developers hosting there listen servers when clients browses for list of servers?
Ultimately weapon logic should belong to the weapon class. Good practice when it comes to data-locality is paramount in Multiplayer.
The weapon should then be owned by the players' pawn, which will allow them to call Server functions on it.
You're already at a massive disadvantage using BP for multiplayer though
This is handled by whatever online backend service you use
You are given a unique id for your specific server instance from the platform's master servers.
I ended up doing everything UObjects for weapons and making weapon actor just a manager of them, because UT and ShooterGame couldnt provide info about how to manage different states and advanced customization for firing logic
I'm kinda anxious about UObject overhead for replication
But I guess its fine 😕
just use components
My weapon "actor" is the shell and any behaviours I want are components, then I just string them together in the BP class
Or use a CPP class if it's something common
How do you add/remove the behaviors? Are you calling a function in beginplay to add components?
I create a BP class, and add components like you normally would to any actor
Ah, gotcha
I don't add or remove at runtime, guess i could if I wanted but no need
shooting component
How do you switch between them though? Do they have some kind of state machine logic?
Not sure what you mean, between different weapons you mean?
Every weapon you carry is it's own actor instance, with it's own components.
That's the only sane way 😄
Since behaviors are 'modular' behaviors coupled to weapon class, I guess there are "Firing" "Reloading" components right?
How weapon switches from Firing state to Reloading state?
I just provide inputs to the weapon "StartFire", "StopFire", "OnReload" etc.
And the weapon BP decides what to do with it
a shooting component that does tracing for hits? interesting
I see. Mine looks like this. Every state object has a SelectNextState function and returns which module we should switch to. If none found, weapon falls back to Idle module
The only UObjects my weapon have are transient ones that are spawned locally to manage state machine stuff
ok a little tough to get where i shoudl place it but its the thing yes, Thanks!
unreal 5 font looks kinda weird
But my use-case is a bit more unique because I share weapons between vehicles + characters
Its "Darker Nodes" plugin, dont mind my weird taste 😄
And there's a common interface for both
I hope I'm not boring you but how do you 'assign' those inputs to components? Do you just link nodes to each other in BP or when you press an input weapon class looks for FiringComponent and triggers it?
It needs some work but my hierarchy looks like this:
-> Weapon_Character
-> Weapon_Seat
WeaponModule (Component)
-> OrdnanceModule
-> ProjectileModule
-> BallisticModule
-> BeamModule
-> HitscanModule
-> AmmoModule
-> LocalAmmo
-> SharedAmmo
-> ReloadController
-> TargetModule
-> LockOnModule
WeaponState (Transient UObject)
-> FiringState
-> FiringState_Burst
-> FiringState_VariableBurst
-> FiringState_Looping
-> ReloadState
-> ReloadState_Clip
-> ReloadState_SingleRound```
etc..
input actions + checking if weapon equipped maybe
Input is routed from the vehicle to it's "Hardpoint Component", which then pushes that to the equipped weapons.
For characters it goes to their "Inventory Component", which pushes it to weapons also. Same kind of idea.
Woah, looks really cool as always
Then with the help of some custom nodes to make it easier to manage the transient state objects, this is what a basic cannon BP then looks like
"OnStartFire" and "OnStopFire", "OnReload" etc are called from the inventory
The other event is a component event.
The only part I don't like currently, is the overhead of using dynamic multicasts in the components - but I'll probably make them native later, and just specify a function name
Thanks for useful infos, Jambax
Haven't actually made a single character weapon yet though 😄
I'm surprised you guys are using replicated(?) components though
Afaik dedicated server owners avoid even minimal overheads usually
Oh no this is just my own project
Hover tank game 😄
Yeah
HLL uses the same setup as shootergame really
Every weapon is basically the same anyway really
legit 😄
are there any limitations to using epics online services or can i use it on devices running on steam on oculus together rather than using their own proprietary service?
if you wish try to dig deep in the engine with break points to see how its done xD
Can't say I recommend it 😄
I didnt start with ShooterGame either
But I'm not developing a competitive shooter game or a first person shooter
well this is an FPS, and it all started with the very simple first person template from the engine
(only if campaign wouldnt cancelled)
Dont mind my inner voice, I like feeding enemy team and dying without even seeing the enemy in Sandstorm 😂
Just had the hope someone knows it already which would safe me from a lot of work :c
It will only replicate what you have changed
So 4 bytes
Hehe, no way their project isn’t a mess
Wish i would feel more secure about it now, but it's kinda hard when one person thinks the whole struct will be replicated and now you who says it wont 😅
why u worried about 4 bytes xD?
It's just generally since i have a lot of structs
they say finish then optimize
There are times you'll die to save 1 bytes
Ehh, depends
@vague fractal it will only replicate the properties that are changed. USTRUCT members are unrolled
Technically it won't be four bytes though, it'll also come with property headers etc.
Which is at least 2 bytes
That's still better than the whole struct which is possibly 500 bytes big or similar 😅
Is property headers always sent btw?
Or do they ignored when declared in a UCLASS directly
always
Needs to identify which specific property the data is for
And that goes all the way up the chain back to the top, if you think structs within structs/arrays etc.
So at minimum it's 2 bytes
Gotcha, thanks
How can I see the server log of my game when it's on AWS?
well the log of a server is put into stdout and there's also the file logging
which is nothing specific to AWS
is AWS an ec2 instance or ?
it.. is specific to your aws setup
if you're using something more managed, a lot of times stdout will be getting sent to an s3 bucket
gamelift
I want to read the debug log to see why it's not connecting to EOS
Hey i have a question
I have a multiplayer door
where i am opening it through an interface call when a hit trace hits that mesh of the door
but in clients the hiot trace isnt actually registering anything on most of the parts evenb after hitting to door
but in the server it is working perfectly
By hit trace not registering anything, i meant that the hit actor is returning null
Do you mean like Steam, Epic or Facebook? Those are the OnlineSubSystemes right? What if you are using a Null Subsystem or don't want to depend on those? Does null work or you have to make your own?
Is it somehow possible to replicate Attribute only when HasAttribute is true inside of GetLifetimeReplicatedProps or would i have to do this somewhere else ?
It doesn't need to behave dynamically, i want to have it either replicated or not for the whole lifetime of the object
COND_Custom and SetCustomIsActiveOverride
Actually.. would this be possible ?
void APlayerCharacter::GetLifetimeReplicatedProps(TArray<FLifetimeProperty> &OutLifetimeProps) const
{
Super::GetLifetimeReplicatedProps(OutLifetimeProps);
if(HasAttribute)
{
DOREPLIFETIME(APlayerCharacter, Attribute);
}
}
do you have child classes that dont need to replicate that property?
It totally depends on whenever HasAttribute was set to true in the BP class or directly in C++. So this information would be already available before this instance would spawn
DOREPLIFETIME_ACTIVE_OVERRIDE on PreReplicate probably
if HasAttribute doesn't change per connection
COND_Custom
same thing being used with actors wheter you want to replicate movement or not
If you wanna connect to a server directly do you use change level? In blueprint I mean
Having 2 options makes it kinda hard to decide 😅
That's what online subsystems are for.
So SetHiddenInGame doesn't seem like it's actually doing anything when it's called in a server-side function call. What are my options here for forcing a mesh to hide itself at certain points that are designated by the server?
Using an RPC?
Yep
I can tell it's definitely running on the server cause everything else is working as expected
Just cannot get it to disappear lol
No, I mean, that's what you'd do if it's not replicating.
Oh I'm following
I'm assuming you're not creating it on the client separately.
You're saying just use an RPC to the client to set hidden in game
Yeah I also thought it was replicated which is why I was so confused. I'll give that a shot though
Pretty much nothing about visual components is replicated
Also SetVisibility is more correct anyway
Hi, I did a OnRep_Something on C++ but its not being called when I update my value on client. Any clue that can be missing me?
well if you're updating a value on client then it won't get called
So, I need to run an event on server with a client reference and the new value? To be updated on the server?
I will try something like that and similar
Yup
I'm not sure if its a "good practice" but it worked somehow
thank you for your help
what?
a replicated value from the server will call the OnRep if it differs from the client's version
only in blueprints
cpp you have to manually call onrep after modifying the value on the server
Yes, that's it
what? why are you devsplaining lol
also what I'm describing is C++ behaviour
if you do any kind of updating the value on server or predicting as client, you have to call the OnRep manually
and you can flag the OnRep so it's always called even if the client and server values match
if that's required
bro i have no idea what is going on in here
I had one OnRep that was not being called, basically
But I run the function on the server to update a variable, and it calls OnRep now
is there an onMatchStart event?
https://gyazo.com/8b2c3b85b4fb13c53c000213340692ed (0ms)
https://gyazo.com/b51b7a5146c8a157c4cd1fc7a7735ce6 (200ms)
https://gyazo.com/49a48e829c5584518d58a019d57114df (1000ms)
(is this bad ??)
does anybody know how I can do a servertravel command trying to travel all players from the client and the server using a combo box
not much u can do
This is the code required in order to tell the server to do it from a combobox. You need to use an "Executes on Server" event in your player controller to be able to pass the level info to the server.
Also keep in mind the append needs a space after servertravel. So it should be "servertravel " not "servertravel"
does anyone here have any experience with replication behaving differently depending on how you connect to the host?
when i use the "start session" blueprint node to start my multiplayer session, everything works great. but when i start an editor instance from the command line useing MyMap?listen?bIsLanMatch=1 and everything else is the exact same, I get this error
"No owning connection for actor"
in the log.
like, i've checked everything over and over again. tried re-writing parts. and it all keeps coming back to this. i'm starting to think this might be a bug in 4.22. btw, tried this on two totally different machines, and two totally different networks
That message is usually an indication that you're trying to run an RPC through an actor that is not owned by a client.
got it. that makes sense. strange that it wouldn't appear in the case where i use the blueprint start session node.
you mean an actor that isn't owned by a player controller?
Yep, or isn't owned by anything that the player controller already owns (eg. playerstate)
hmmmm. i'll triple check that. but it seems like the issue is coming from an actor component. long story very short, i have an actor component that replicates some VR body IK stuff so the limbs of the player mesh move around on server and all clients. i've tested the replication on a prototype project, and in this larger full game. and both work fine when doing "start session". but the body IK actor component (attached to the player character) stops working **when starting host via command line. it's almost like the actor component initializes without an owner for a split second, and then errors out.
Perhaps part of the issue is that the component is trying to send RPCs immediately when spawned on tick as you may be sending movement data? Perhaps start it with tick disabled and on possess of the character enable the components tick then if that's the case.
ooooo that sounds that could be the issue
it's possible there is a single tick firing before the character is possessed?
can begin play fire before a pawn is possessed?
i appreciate this, tho. i have a few new things i can try when i get back to it tomorrow.
Most definitely begin play can fire before a pawn is possessed as pawns can exist in the world without being possessed at all.
Not sure if a single tick could be firing beforehand but it's definitely worthwhile to take a peek at if that is what you're doing.
right. i possess immediately, but i could see the order of operations being slightly different if the server is starting a session from an already loaded map, vs starting a session directly into a map.
can anyone explain how these give different results? This only happens on the host of listenserver
bottom is called from a widget button
It would likely depend on how PrintPlayerIndex is called. The N input can be fed into one player controller, but if you're not calling the event on the same player controller that your host is in, the values can be different.
As I'm already aware of your situation, your issue doesn't lie with this printing two separate numbers - it's a matter of your ghostly player controller and you're likely calling the event on that ghost player controller.
i fixed the ghost problem lol
Ok, then it's a matter of your input is being fed to one controller, and your event is being called on a different player controller.
on the host how many player controllers are there?
so basically i think somehow i'm assigning the index wrong, but i really don't see how as its only called once
ohhhh
wait do hosts call onpostlogin???
Yes, they are the server.
no i mean, does onpostlogin get called when the host starts the server?
Yes
you're 100%?
cause it would make sense that maybe the assign player index doesn't get called or something and thats why the hosts playercontroller is on the default value
The host is the server. So whenever the host starts their instance of being a host, they are the server. Their player controller joins the game just like any others, and OnPostLogin is called for their controller as well.
He would be player 0.
yes but then why on one of the calls does it return default valueeee
sorry if i'm being rude this is just so frustrating lol
Which call? One of these?
and to add to that clients always return the correct value
on both of these
and a consistent value between these
What value are you expecting? You're adding the host to an array and using that as an index. That array won't exist until the game starts, so naturally, the return value would be 0.
So the Player Index of the host's player controller should be 0.
okay so it doesn't run onpostlogin or does it before the hosts playercontroller exists
OnPostLogin runs when the player controller is created for the host. (*roughly. it gets created before this, but lets go with this - the point being, the player controller is created, and OnPostLogin gets called somewhere after the fact of the server existing and the controller "joining" after being created)
You haven't even let me know what value you're actually expecting. Adding the first item to an array would always return 0 as the value. The second one that gets added, 1, etc.
so the N button thing returns the value it should be of 0
but the HUD button, and apparently in my gamestate it is 5
which is the default value
How are you calling PrintPlayerIndex?
this is just onclicked button from a widget
but also that player index doesn't get used anymore
What is the Chess Controller variable set to?
(you can do a print string off of it to get a display name)
Ok, can you show the cast you're doing?
Can you show where this variable is being set in your widget/
Try using Get Owning Player instead of Get Player Controller.
omg okay so that works now...
It's really bad to use indexed get player controller on a listen server.
or any of those indexed gets
Hi people, I'm setting up a multiplayer game and I have some questions. I have the core gameplay of the levels setup to work for dedicated server but my question is, how much difficulty and effort is it to setup a dedicated server myself? I haven't approached this yet. I am happy to have the game work with one player being the host although I would need to change a lot of code - i'm prepared for that.
The problem is I still want an initial game mode where players connect with other players willing to play which would need dedicated server I assume? Once I have my players connected, I would switch to local multiplayer at this point if needed - how feasible is that?
I'm working on my login screen/level select at the moment. I'm not sure how to approach level transitions or how to transition all my players to a level, a lot of my level logic runs on 'onpostlogin' events which I think are not getting called when I attempt to travel (except for the server) and crashing the game.
In the lobby itself I have a few possibilities, I'm not sweating what design choice I make here. My preliminary work has just been on assigning one player randomly as the 'host' (even if I am using dedicated server I can just use a randomly assigned boolean to decide who is 'host', or I can choose the actual host if running local multiplayer), who is able to decide what level people travel to, all of who need to click 'accept' before the travel actually occurs.
You don't have to use a dedicated server for creating a lobby system. You can use #online-subsystems to help create listen server sessions.
Do you mean for searching for people to connect with? That's my main gripe, I absolutely will want a form of full online mode just while people find other players to connect with. Once the players are connected, it doesn't matter THAT much (although I have most of my game set up for dedicated server)
So more like a hangout place while you wait?
The lobby, it really doesn't matter at all (ie the level select, AFTER everyone is connected)
I want an initial login where players search for other players online
Once I found a few players and grouped them, they go to the second lobby where one players chooses the map and the others select/decline
I'm not understanding these bits: "I absolutely will want a form of full online mode just while people find other players to connect with." and "I want an initial login where players search for other players online"
Search for players by actually walking around in some sort of game space and actually see other players walking around too? OR Just hit "I want to join a game" and it'll drop them into a lobby with a bunch of random players when it finds them, or select from a list of rooms waiting?
Nah it would be more like a visual 'searching for players' indicator
By 'lobby' I meant the level select screen
The search would be a search online for other willing players not a physical search
Level select is AFTER everyone has connected
Ok, so yeah, that's what #online-subsystems can help you with. They can help your players matchmake without the client needing to be connected to a server.
thanks I will make a note
Hey I have a pawn why can't the client move it? The server works just fine but clients can't move
APawn?
Ye
Pawns are not able to move client side
You gotta write your own logic
Server is rolling back you to authoritative position
You need to send your location from client to server
wouldn't that mean they can just TP anywhere?
I saw you made a plugin for exactly that :o Why isn't it available anymore?
PayPal is restricted in my country and most of the time people were requesting more than what plugin provides like trying to have 1k of pawns in the scene etc.
It was also kinda difficult to maintain ngl
I see :o I'm gonna try reparenting to ADefaultPawn and see how that goes
Its simple to achieve if you are not going to implement advanced things like movement reconciliation and root motion replication
Just set location, rotation and velocity predictevely on clien and send to server, and let simulated proxies lerp to current location
Nah I just don't like to use a character because it's way too much... I just need a mesh, sphere moving in a 2D space constraining Z
It's simple for you :o But I've never had to do that
Just send transform data to server via RPC, thats the most simple step
I also remember writing down steps in more detail on Bry's server, have you looked at that?
Yea and I barely understood anything about it
roles don't have to do anything with listen or dedicated server
you'd like to use GetNetMode, take a look at the struct definition of the return type
enum ENetMode
{
/** Standalone: a game without networking, with one or more local players. Still considered a server because it has all server functionality. */
NM_Standalone,
/** Dedicated server: server with no local players. */
NM_DedicatedServer,
/** Listen server: a server that also has a local player who is hosting the game, available to other players on the network. */
NM_ListenServer,
/**
* Network client: client connected to a remote server.
* Note that every mode less than this value is a kind of server, so checking NetMode < NM_Client is always some variety of server.
*/
NM_Client,
NM_MAX,
};
if you want to show UI on overlap, IsLocallyControlled is the only check that is required
as for Q2 - no when you get the AIControllers into the mix
Hi guys,
Got an interesting questions.
This is the scenario:
Let's say in multiplayer, people have a widget component attached to their character that is on 'Screen' space (lets call it a chat bubble). When they chat, it appears above their head. A repnotify fires to make it visible, and the chat text appears in the chat bubble. After a certain amount of x time it becomes invisible again.
Now what I want to realize is that only people within a certain distance of this 'chatting player' will get to see the bubble appear above his/her head.
How would I approach that.
So basically, how can I control chat bubbles visibilities of other players based on my location in relation to theirs?
lmk if anyone has pointers
is this a bug or am I missing something very obvious. This is logic in my player controller, first image is run on client on begin play and I create a widget then call an RPC using the newly created widget as input. Second image is the RPC itself. The print string is displaying null?
I think it's cuz sever don't have widgets
Yeah I see that now
Can i have a non replicated event dispatcher in my player controller, that I call from the widget owned by my player controller, and bind a RPC to that event dispatcher?
I'm trying to figure out a workaround
nvm sorted
Back again if anyone is kind enough, I am trying to open a level now, naively just using 'open level' (running on server). all the logic up to this point is working as intended and this event is getting called when I want, but the game just opens 'Minimal Default'. Sometimes I get 'building distance fields' or 'building lighting' messages though. I'm just wondering what I am doing wrong but also how I can troubleshoot this, since I'm getting no error messages sadly, just the wrong level opening.
Everything is totally different in the level to open e.g. game modes, game states are totally different so I'm sure the logic is breaking somewhere.
ok it works only for the server but for some reason not for the client
Are you calling any other commands to travel on the client itself? All that should be needed is the servertravel command on the server, nothing else.
PIE doesn't support it regularly. You need to be running as Standalone game if you haven't set it up to do so.
ok iT works but it only works one time and it doesnt let me change another level after the first one
ok for some reason now it let me changes the level but it does let everyone go to the same level
I think this weird action where the server is being refused for some reason and then changes all late
Not sure what to tell you there. Works fine on my end - I can servertravel between two levels back and forth without issue, clients included in the travel.
how can i do seamless travel do i have to make like a loading screen
wait how can i play music on to the server
That's one hell of a question.
Even so, it's still one hell of a question. You need a lot.
Account Management, Database Management, Chat Systems, Server Instancing/Fleets, Administrative Tools (things like web-based access to manage parts of your game), Game Moderation systems, maintaining a global presence for players online (eg. you're not going to squeeze thousands of players into one server), likely some TCP/UDP socket connections.... It goes on and on...
You shouldn't ask what you need to make an MMO. You should flesh out the idea of your MMO and then say, "what do I need to make this?"
^
The answer is all of them.
and then some. It's not a comprehensive list @_@
I would drop the first M off your project unless you have millions of dollars funding and a large team.
fwiw beginners going into gamedev communities and asking how to make MMOs is a big meme. Regardless of your intentions, expect communities to generally not respond particularly well to that kind of question. If you're going into it purely with the intent to learn how things are made you'll get better responses but don't start with "I want to make an mmo" or anything similar.
And about 5-10 years
It is. It's just a lot of work.
There is still a lot more to the mmorpg, and yeah you need a huge team. I have another guy with me on a small project with a budget of like 500 dollars and were having some troubles,
So you'll need lots of time.
Just the infrastructure alone will cost money.
see you in 10 years
I'm just going to link to this 10 year old post that stays relevant every time the topic comes up: https://www.reddit.com/r/gaming/comments/p1ssv/dear_internet_im_a_26_year_old_lady_whos_been/c3lup2l/
Anyone who's been around a while probably knows what this is from the link alone...
And note that I'm linking to a specific well written comment, not trying to make fun of anyone by referencing the OP.
dude it cost a lot of money getting servers
mmorpg does not mean new world .. it can be minecraft mmo
up and running and maintaining them
you literally gave the most vauge description saying I am trying to make an MMORPG
i remember my first game idea was an MMO. i'm now working on a multiplayer VR wave shooter, and that alone has been enough work for me as a side project, and i've been programming for 12 years.
my small project that i am creating is DND visualizer for players to just jump in and see what they are doing, with like a weather system we have done a lot of progress in like 2 months
That's cool.
Quest all were saying it can be possible its just so hard. Be realistic
Been using UE4 for like level design for like 5 years and barely got into blueprint programming, its really fun and 21 years old hehe
As a solo developer, you're probably better off making a not-massively multiplayer game and letting people host their own small servers, like Rust or something
You say minecraft like that didnt cost tens of millions. . . Theyre trying to get you to lessen your scope or be prepared to fail, since this is a REALLY common mistake that new devs make.
And also factor in modability. It's what makes small games really shine.
Just because it has a lot of players doesn't mean it's an MMORPG
CS isn't a MMOFPS
It's not me that doesn't get it here, mate.
minecraft is actually a pretty good example. i recommend looking up what the first early playable version of minecraft looked like. i think it only had a handful of blocks.
Overcoming Unity's limitations isn't really the issue.
We are just saying first ideas like MMORPG or Big Rpg games are destined to fail with a solo developer espeically without any budget
I had an idea of a big rpg game a story I want to tell but right now I dont have the money or the team to do that
its going to take you 10 years if you are alone
Even a gigantic company with virtually unlimited resources would take 5+ years to make a decent MMO
And Chaos will work properly.
Quest how old are you
Name an mmo created by a solo developer that has any kind of success.
NONE
lol
Project Gorgon (albeit not entirely solo, but it was a wife/husband duo who eventually got another person to help)
I say, if Quest wants to try to make an MMO, let him have at it. an honest effort in doing so will show the limitations in the act alone.
@sinful tree does it fulfil the massively part of the description?
ok
Though I don't use Construct anymore, it is an extremely powerful game engine. I created these MMOs over a course of two years. Follow along my process and feel free to ask any questions below!
┈ Who is Goodgis? ┈
I’m a full time Graphic Designer, Game Dev, & Youtuber. I specialize in making cute, colorful games in Godot and telling my story ...
you can't tell the names because not alot of adds
replication question: is the character falling through the floor ever a sign something is wrong with replication?
does anybody know how to replicate music
Massively in terms of what is normally considered an MMO - a system by which you can encounter players in an open-world style setting. Doesn't necessarily mean you'll see everyone who is connected to the "server" in the same place, as there can be instanced servers.
for friends *
You want to tell each client to play the same song? Just send an rpc broadcast?
sounds like a collision issue to me. An object only existing on the client could also be the cause of this. would help if you show a short video
Maybe an audio actor could work? Not sure how that's all replicated, though.
how its hooked up is through a combo box, so when a player changes a song through the combo box I want everyone thats connected for the song to be changed
The player being a client? Or a listen server?
client
Send an rpc from the client to the server and then send an rpc broadcast to all clients
(from the server)
Click Button > Executes on Server RPC on Player Controller > Executes On All / Multicast on a shared always relevant actor like Gamestate to play the music for everyone.
alternatively, have a RepNotify variable on game state that you set that controls which song is playing. Then it becomes Click Button > Executes on Server RPC on Player Controller > Set Music variable >>> On Rep fires on clients, telling them to play the currently selected audio in the Music variable.
That way if others join in, they can hear the music playing too 😛
is it ok to replicate a timer handle? i have a round timer id like to replicate and am wondering if theres any known issues or if theres a better way to get a timer on a client to sync with the server
no, timer handles aren't going to replicate.
thats unfortunate. is the game time synchronised? i could use that instead
Is there a way to add steam friends with a function? Ideally through the SDK, but through the web api would work as well
are you asking to "add a friend" on steam? or to add "steam friends" functionality. if its the former, im pretty sure advanced steam sessions exposes more of the steam friends api to blueprints
Add a steam friend as if you were adding it through the friends interface on steam
steamworks provides this functionality
I don't see how on here: https://partner.steamgames.com/doc/api/ISteamFriends there is no "addfriend" call
There is something where you can call a function to open up the overlay and do it, but that's not what I'm looking for
There is no way to add a friend directly.
perhaps im mistaken then
Why would they ever let you do that?
ye seems a bit sketch
best way i can see is to open a dialog to let the user confirm
Any interaction with your account must have manual confirmation. They're not going to let your game do whatever it wants to someone's account.
ehh i mean you can use steamworks to send messages to random steamids 🤷
Which I think is also dumb, but that's still less of an issue than adding friends.
and also join random groups and invite people to join groups and chatrooms
ye definitely
Adding friends becomes a privacy issue since it affects who can look at your activity, inventory, etc.
So the best you can do is trigger a prompt.
ah ye i forgot about that
typically you'd have a button to open their steam profile instead
where you can obviously add them
Hi everybody! should the main camera be replicated in a mmorpg or just leave it on the remote?
Hi guys,
I Have persistent level(room) and 2 streaming sub level(actor& light moved)
I want to know how travel/teleport/transition between Sub levels and persistent level.
I tried direct jump on sub level 1 using open level by name it showed actor of sub level not actor & floor persistent.
I just switched from Character to Pawn and I realize non of my movement get's replicated. I've enabled Replicates on everything though nothing
I'm having trouble getting 'server travel' to work and I'm not sure why. Afaik I do NOT want seamless travel because I am changing a whole ton of settings, for example the game mode class when I transition from my main menu level to the level I am travelling to. here is the BP I have (I have also tried all lowercase)
I double checked that my name input matches the level name exactly
I have seamless travel unchecked, this is run in the game mode of my title screen level (different game mode to 'Sonoran_Desert')
When I run on listen server mode, the server travels though (apart from a load of error messages I get since I haven't setup my 'title screen' to run with listen server)
Read a bit in and says I might need to create a session?
Hi guys, ive watched a ton of multiplayer tutorials now and they are always with some kind of join / host based style. I am looking more for a tutorial/way to make multiplayer support via login and world select or something. Anyone can point me towards a good solid tutorial that focusses more on that? I see these tutorials of join/host and its just not the type of multiplayer im trying to realise
Login and world select sounds a lot like MMO style login? If that's what you're after, you're not going to find tutorials on it because it's not an easy weekend project. You require a backend server for logging into for starts. That's not tutorial level things. By the time you are looking at implementing something like this, you know what you need to do to implement this because it's much less gameplay programming and very little Unreal related and very much server architecture which is a whole separate field entirely.
You probably don't even want to connect to a "server" at this point, just use a local map with some socket stuff
hmmm fair points ( I do own webservers, etc and I do understand its not a weekend project) but I thougth there might as well be a good fundamental way to learn how to make mmo based multiplayer (indeed) as thats the kind of multiplayer setup im after for the long haul.
just to make a hub where people can connect, chit chat, etc
I'm not sure on the specific, but I'd imagine you just need to have some form of interface between your Unreal application and the server. Seen some mentions of people doing stuff like a single component that handles that through the PlayerController and such. Random googling seems to suggest that REST web servers are pretty easy to use with UE4.
Yes thats why I wanted to play around with it and seek further, I also got developers available for server side preperation just wanted to find a very good base that teaches exactly what im looking for as all the other multiplayer videos I checked are certainly not
Well I looked into Steam multiplayer tutorials as well but I somehow got the feeling thats also still host / join based
not as much the way I envisioned which was launching 1, 2 or 3 worlds which people can connect to and interact with the players in that world
When I say you want an OSS, it's just so people don't need to sign up to one of your services and then you don't have to handle user management.
You don't need to use the server stuff at all at this point.
You mean there is a way to realise it without a server?
I feel like ARK might interest you in their implementation. All of their connectivity and such is done through Steam. But they do manage their own gameplay world servers as well as allow users to host their own unofficial ones.
Players have their own character name, but all of their data is connected to their Steam ID.
Online Multiplayer Unreal Engine | 02 -2 | Hosting a Steam Session | Tutorial Series
I was watching part 1 and part 2 of this one
it was around the steam ID indeed through a Steam plugin for unreal engine
but then again the join / host part lol
They kind of get around requiring a backend server even for character transfers between servers because it's all handled locally through savegame stuff.
Will it be sufficient for a hangout/chit chat metaverse concept or would I be wasting time going into that direction via steam integration?
Does anyone know how I can transfer save files to connecting clients? They are too big to simply replicate
Guys, how can I turn off an actor so that he does not reply?
Not sure I follow…
Hello, quick question.
When i save an integer in my GameInstance, for example 100 for health and i change the level, that integer should be saved and taken to the other level right?
Yes
Ok, and what if i join a listen server?
Any variable saved in the game instance will still be in the game instance regardless of where you connect.
That being said, the server cannot directly access a client's game instance.
It exists for the length of the game session or however long a server is up for
It does not replicate, you cannot call RPCs through it
It’s commonly used to persist data between map changes but there are other ways to do that too
What i'm doing right know is that i create a varibale that i save inside my gameinstance and "join" a listen. The Listen server does the same.
When the listen Server and the client both are connected. The Client and the listen Server use the variable that the listen server created.
#multiplayer message You got this answer previously. Did none of these work for you?
But the client should use the variable he created from his gameinstance
I've been trying to go down the http route but haven't had any luck actually finding a way to transfer files.
I was going to try and use steam cloud to upload a save and grab the url to download, but I can't find a way to get that url.
I am looking for a solution that does not require port forwarding.
My lack of experience has made this very difficult, lol
I'm basically asking again to find out if anyone has found a better way
It is surely not an uncommon need
Large file transfer for that specific purpose is, for modding not so much since that has a centralised cloud service usually
Blob would help.
Doe's the source code still exist? I'm sure this plugin even if not-supported could be a huge help for people. If not then do you know anywhere I could get more of a guide on how to do this?
I could help you with Paypal Integration not for free thou.
Sample
?
I'm not sure you know what I was asking
I was asking someone else if the Plugin was still on somewhere like Github or if not maybe they could link me a guide to replicate pawn movement
Guys, how can I turn off an actor so that he does not reply?
What do you mean by "not reply"
Disable tick?
I want an actor to ignore sending packets to my server, that's how it is
you're either calling it twice or NewVar0 defaults to 1
which is not really a networking topic
which is still not a networking topic, add a breakpoint to the set node
and it'll probably tell you why
so are you going to test the breakpoint or not?
What is calling the aaaa event?
How is the aaaa event being triggered? What is making it run?
Ok, and you only have 1 thirdpersoncharacter in the world?
So each Character then will end up calling that event. Increasing the value to 2.
Eg.
Character 1 joins the game > Calls aaaa function > NewVar0 = NewVar0 + 1 = 1
Character 2 joins the game > Calls aaaa fucntion > NewVar0 = NewVar0 + 1 = 2
Correct
I'm not really sure what you're trying to accomplish as your variables don't give any indication, so I wouldn't be able to tell you.
What is it that you're trying to keep track of?
Ok, but why is it that you're incrementing by 1. What is the meaning behind that 1?
Doe's anyone have a guide or willing to help me through replicating Pawn Movement? I'm not the best with multiplayer stuff
The only thing I can think of right now is to update a Location Variable whenever the Owning Client Move's and then every event tick set the Actor Location based on that Location Variable on Server
Well, what you have right now is that it's incrementing a value any time a ThirdPersonCharacter begins play. So whenever someone joins into the match with a ThirdPersonCharacter, or any time you may respawn a ThirdPersonCharacter, that counter would increment by 1 and since it is a replicated variable it would be getting sent to all clients when it gets set (so long as it is on a replicated actor, such as gamestate).
With that variable having no context, then you can't really ask "What's the best place to call aaaa event" as it doesn't matter where it is called from but just know that any time it is called, it will increment. Eg. If you called it from Begin Play on game mode or on the level blueprint, it should only ever increment once. If you called it from PlayerState or PlayerController, you'll still get 2 if you have 2 players.
GameState can be thought of a shared, common location for values that both clients and server can access, and there's only 1 of them that exists in the game. So it's a good place to store things like cumulative team scores, time remaining, objective statuses, etc.
are you rolling your own CMC or something?
Well for now I was just using the Floating Movement Component
I have added my own Input's with Movement in the Event Graph
not sure what's up with the superfluous apostrophes but the pawn itself should be able to replicate its position as-is
According to other's Pawn's are unable to
They said it's best to make your own Movement Logic
Just not sure where to start
Listen server is having one of the clients act as the server or "host" for the game and all other clients connect to that host. So if you have 2 players, the main editor window will usually end up being the host/server, and the second window will be a client that connects to it.
Playing as Client means that a separate dedicated server is run in the background, and the active play in editor clients connect to it. So if you have 2 players, both of those players are only clients and connect to the background server process.
Generally speaking, the HUD class.
I am using a player controller, to check
But is there a better way? to check?
other clients only have their own player controller
so that multicast won't reach them
when player A multicasts form the PC, client B doesn't have a player A PC to receive that multicast
you should move that to the Pawn/Character
If I have a lot of events, I will need to connect get player control , in a lot of events until I reach the branch,
Is there a better way?
multicasts from PlayerController will not work
yes I use this code in Character
reference to player A player controller will come as null on every machine except Player A's and server
so yes, don't use a reference that cannot be resolved
and never connect GetPlayerController[0] after any kind of RPC
you branch after 44 will only ever return true if its the player that gave the original input
you also don't need that check to begin with
i am struggling to divine the intent of that piece of code
I run the animation for everyone except for the client who played it
then you want NOT IsLocallyControlled
and you don't need to push any reference through the RPCs
@winged badger My problem is in the red box.
Suppose if I have a lot of events, I'll need to communicate them all, until I get to the branch
So what is the solution?
get rid of all PC referecnes
and just have branch check IsLocallyControlled
and its its NOT, play montage
im off to bed
rid?
delete them you don't need them
Does world composition level streaming work out of the box in multiplayer, or is there additional setup needed?
Could I replicate a const pointer like this?
UPROPERTY(Replicated) AActor * const MyActor;
How can you assign to that if it's const
You can do const AActor* MyActor but you can't have a const pointer (but it can point to a const object)
Come to think of it not sure I've checked if you can mark a const actor as uproperty either @rich sinew
thanks!
how do I properly disable movement component replication for a limited time and then enable it back again?
I've tried MyCharacter->SetReplicateMovement(false); and then setting it to true again but after that the movement does not seem to be replicating correctly
the character moves too fast
too fast on his screen and on other clients it's just stuck at the point where I first disabled the movement replication
If I wanted to replicate the rotation would I need to set these in a variable instead?
Looks like a replicated book
Bool
If clients don’t have another way to infer the change
HELP! 🙂 up is the HUD function to set visibilty to the Icon (Flashlight)
down is in the Player BP (Where the switch happens by Pressing F
Gadget Selected is just an integer.. so i need when player switch to Flashlight that it shows flashlight icon.. works alone but just on serverside, client sees nothing
would be glad to get an advice on that
i just want to see the flashlight icon on server player and on client depends who is using it
any1 know what this error is?
which objects are receiving the input from players?
Quick question this morning:
What's more performant, two separate RepNotify variables or one RepNotify struct with two member variables?
Any advice would be appreciated.
Cheers.
Is this the right way to write repnotify in c++?
if (GetOwner()->HasAuthority())
{
bIsMounted = true;
OnRep_IsMounted();
}
else {
ServerSetIsMounted(true);
}```
Zero measurable difference really
Jambax, my hero.
no
Only reason to care about bunching or not care, is based on what you need the be replicated together. If you set two separate properties you can't promise they'll both be set in an onrep. Bunching them in one struct you can.
perhaps not having it in a struct means a smaller property header.. but I don't think it's worth splitting them if two vars make sense together
you do ```cpp
UPROPERTY(ReplicatedUsing = OnRep_MyProperty) SomeType SomeProp;
UFUNCTION() OnRep_MyProperty() {}
and engine will call it when appropriate
Yes, I found that out. It's a useful trick. Thank you.
I have that in header but how do I call it?
Really - i read about that it's automatic in blueprints not in c++.
So the variable doesn't need to be set using server rpc as well.
then forget the source of that information exists for your further learning
difference between BP and c++ OnRep is that BP will call OnRep on server as well
So all i need to do is this in normal function? bIsMounted = true;
you also need GetLifetimeReplicatedProps entry for that property
in addition to that snippet above
DOREPLIFETIME_CONDITION_NOTIFY(URComponent, bIsMounted, COND_None, REPNOTIFY_Always);
when client receives replicated data, it will use reflection to examine if OnRep function exists, and it there is one it will call it
you have4 one OnRep overload available, too
UFUNCTION() OnRep_MyProperty(SomeType OldPropertyValue);
then you'll have a value before replication available as function parameter
(at the time OnRep is called, the property already has new value assigned to it)
Ok
Is this the right way to do DOREPLIFETIME_CONDITION_NOTIFY
#multiplayer message
yes
ok thanks
always means that it will OnRep even if new value is the same as the old one
So REPNOTIFY_OnChanged is a better choice then
if that was always true, Always wouldn't exist
i c
?
Thank again.
Another question?
So I want to play anim montages. I have server calling multicast function which plays the montage. I read that you can optimize that or improve that by using DOREPLIFETIME_CONDITION
you can OnRep_ActiveMontage
but you probably won't achieve production value with that
it would cause problems like client walks into relevancy range, and all the enemies get up on their feet to replay the dying montage
which leaves you either the RPCs or the Timestamp added to the Montage pointer and synced network clocks
for a learning project though, OnRep alone will do
nice .. Good to know
Another question?
How do you determine when to use server rpc or multicast or both? I'm talking specific to setting the follow: Possess, AttachToComponent, AnimationMode, MovementMode, SetCollision
possess and attachtocomponent will replicate on their own
\movement mode can be dodgy and situations where that desyncs are not pleasant
I mean as an universal solution.... read engine code
By the way, I tried placing on its own and it doesn't work. OnRep_Function doesn't get calledbIsMounted = true;
So when you read the engine code, what do you look for that tells you how to call it
you look at the code at the function that you are calling
and you'll find the properties it mutates, their context
whether they replicate already
it's field work, really.
the component also hass to be replicared \
Are there any docs or tuts on how to read it? For example looking at possess.
source code
I have component replicate enabled in blueprint. How you do that in c++? SetIsReplicated
that's not what Zlo means
what Zlo means is that in order to read engine code
you have to open Visual Studio o whatever ide you use
and read the actual functions in C++ that you are using in your blueprints
or in your C++ code
I replied to his different statement. I am using visual studio to read the possess function.
actor has to be replicated too
I have actors replicating as well. It's that even in standalone the OnRep function won't get called either. I think there're some manual work need to happen unles I'm missing something.
I'm doing all these in a custom component by the way
It's not that difficult to achieve as you think, any programmer who spend time on UE's replication framework can create a basic custom movement component. If you need an example, you can see Krazy karts github repo: https://github.com/UnrealMultiplayer/4_Krazy_Karts
It's implemented in a wrong way but if you understand the idea behind it you can implement it properly and upgrade it
Real difficulty starts when you want to implement rollbacks (reconcile feature), replicated root motion etc
So I was going over the Actor->AttachToComponent() function in the source code, and didn't see any replication code. Is that mean I have run it through server and multicast?
I have a question
My projectile weapon won't hit at same location
"Spawn Transform" is same (replicated correctly) and Projectile Actor "replicates" options are checked, but it won't hit at same location, how to fix??
Ur using only a Server RPC to spawn the projectile?
If I want to do a sprinting system for multiplayer ,should I use multicast or OnRepNotify as if someone joins later he won't be able to see the person sprinting if he started sprinting before the new player joigning ?
Please ping me if any answer
Alright I need some input here... I am having a lot of trouble with SetActorRotation. I am currently executing it inside of a multicast function, but still getting a lot of jitter. The most annoying part is I can see that the function is in fact being executed on server, owning clients, and simulated clients.
Anyone have any suggestions as to what I can check here? I am not using the controller rotation for the pawn, so doing something like set control rotation won't do much here.
for a BP implementation I recommend you doing bSprinting repnotify approach, so you'll solve two problems simultaneously (acquiring a variable that denotes state about sprinting, and late joiners)
(Actually, now that I'm thinking, you might not need the onrep unless you need to propagate the value of maxwalkspeed for whatever reason to your sim proxies)
Multicasts for this isn't really a good idea. I'd strongly recommend ditching that and going with a ServerRPC from owning client, and a Replicated(SkipOwner) rotator or float that you can interpolate to. You'll find it a lot smoother, very similar to traditional 1D aim offsets.
Basic idea is to let the owning client have direct control of their own rotation without server overwriting it, and just let other clients quickly interpolate to the same. Less jitter, no owning client fighting, etc.
For one Client I can move around but for the other client they also control the first Client but play animations on their pawn
Why isn't this variable updating on the server? Calling this from the client as an RPC does update the variable on the client, which means the server must know the value.. except print string to check the boolean returns true on the server
it's not running the RPC
the client gets TRUE
turns its copy to false
and the server doesn't hear about it
err
show the print string
you may be on a different object on server
There are also other gameplay effects based on the variable so can confirm two ways
is this on a character?
And it does run the RPC. I set a breakpoint on the SR version (rpc) and it runs. Yes on a character
So this O press is running on the server's character
not the clients
So he's reading his own IsManifested value
Yes
had to edit it
How so? It starts false, run an event that sets true, it sets true on the server and the client but then setting it back to false doesn't work on the server, only the client. Even though the rpc works
Does the server have a character?
Yes I'm playing as listening server. Also, I did this and manually calling the rpc works but not when called "naturally" 🧐
This part runs at the end of a multicast event maybe that does something?
ok well as I said, the server pressing O would just tell you the server's value on his own character, for more info you'd have to post more pictures, what feeds that switch node
Original call to start the event that ends with ^ screenshot
what does the manifest event do
Set visibility true on the character and some other meshes for a specified time, spawns a sound, then set visibility false again
is SR_Manifest set to reliable?
It wasn't but I tried that and still nothing :/
what is the issue its not replicating?
keep it reliable
Yeah it's replicating back properly when I play as client (pie) but when I play as server it doesn't set to false
I suspect it does and your way of verifying that is flawed
I'm gonna try some other test environments and some more breakpoint debugging. I'll let ya know what I come up with. Thanks for the help!
Doe's anyone know why my character randomly teleport's when I begin the game?
the character should spawn at the player start actor location
As you see my Y for my player start's are around -226 for each
Though the Player almost goe's to the positive version of that number
Idk why but it doesn't
I just tried a new level and I got 2 player's next to each-other but one spawn's sorta rotated for some reason
-226 is the player start y
None of my player start's in this new level are rotated
if you want them to spawn at a start point they shouldn't be already placed in the level i think
They aren't
you said you got 2 player's next to each-other
Yeah?
Like they spawned because of the spawn point
2 Player's
But nvm I got it fixed
how do i pass data to a dedicated server on open level?
like in the case of a character select screen
What actor are you calling it on?
Actually, nix that.... Is this actor nearby to your clients?
you should always use play as client for testing this stuff since the first PIE window will be a bit more misleading
not sure why you're using WithValidation either
but if in doubt, post code
question, is it possible to pass a reference of a skeletal mesh component to the server?
you should pass Actor Reference and find component Inside, this will only work if server has this Actor also @wild patio
I have a player pawn with skel. mesh on the owning client, also on the server. for some reason I can get the anim_bp reference from the mesh on the client, but when the server tries the same, the anim_bp reference is invalid
it seems like when the pawn is created on the client and the server, the client and server skeleton mesh have their own anim_bp
unless i'm mistaken? are there limitations or default behavior here i'm missing?
side note: it's an actor component doing this replication that's attached to a pawn. the server has no trouble getting the anim_bp instance reference in the pawn itself. but the actor component on the server can't get the anim_bp reference. it's so strange.
i'm assuming there's some small thing i'm missing
question about multiplayer, was looking into some documentation about ports on the local router, any way to get around this ? for local multiplayer what if the ports are closed
Use #online-subsystems to get players connected together rather than relying on direct IP addresses and ports.
There's some hole-punching stuff routers normally use. How it actually works, no idea.
What would be the best way to get player character for multiplayer use
Depends on how and where you're trying to access it and what you'll be using it for. For example, if you have reference to the controller, you can do a get controlled pawn and cast to your character.
ok great thank you 🙂
I'm a little stupid but I've seen people using ig a plugin called UPNP and I'm not 100% on what it doe's
Is it a way easier way to open port's without port forwarding?
I seen from it's examples that you can easily add different Internal/External Port Mappings using blueprints
Yes, though the normal way is to use NAT punch, either with Steam or by integrating a library for that
If you're using Steam there is no need for any work on this
Not planning to pay the Steam fee
Well maybe later on I will
Would you recommend doing this or using Steam?
The UPNP plugin is literally half the cost of that fee
And Steam is essentially the PC market
So with Steam can I essentially Host Server's and other's be able to join them without having to port-forward or anything else?
And would that work with any Platform or only PC
0% Of my Community know's how to do anything soooooo
Let's do some basics check here. If you are hosting servers you do NOT need UPNP, Steam, NAT traversal, none of that
That is needed for player hosted games, due to residential routers providing firewalls for their users, which also impedes games' multiplayer capabilities
If you are however planning to make a player hosted game, I recommend EOS: https://dev.epicgames.com/docs/services/en-US/GameServices/Overview/index.html
It's by Epic, and it's completely free. You only want to get one of the marketplace plugins to handle it for you and it's a one-off cost.
Isn't there a lot of limits?
And I'm not really a CPP person
Though assuming Steam isn't cross platform this would be more fitted for my game
Is UPNP good enough or do you recommend a different plug-in
If you host servers yourself, there is zero need for any port, UPNP, NAT punch stuff
This is only required when players host (listen server, player hosted dedi)
Yeah Players can host
So I should use EOS with UPNP
No you want to use EOS with a EOS plugin from the marketplace. The entirety needs some configuring on the Epic backend but it's by far the best solution for developing player-hosted games
Are you hosting your own servers or not
And if you are new to Unreal Engine I would suggest making a Singleplayer game before even attempting a Multiplayer one
No
Multiplayer makes things exponentially more difficult especially if you have zero to little prior experience. Once you have completed a Singleplayer game from start to finish give a Multiplayer game a go from scratch
Alright so players host their own servers, or are you doing listen server ?
Players Can host their own servers
If you're doing a multiplayer game with dedicated servers hosted by players it seems to me that Steam is the easy way
Sorry I meant Host their own Listen Servers
So listen server = one player is playing and acting as host
Yes yes
In this case if you're not familiar with C++ Steam is pretty much the only option
The Plug in I just linked has another plug in that gives it Blueprint Functionality
It costs more than access to Steam which gives a lot more
Though the Cross platform
Yes that's the price point, and I guess we have different frames of references. That's a very fair price.
It's fair just pricey for me
Multiplayer cross platform is just not a thing for indies, if you want my opinion.
Yup I understand, that's a decision you have to make. It's the value of your own time versus someone else doing it for you
I've already paid for Xbox so I ain't giving that up
And do you know the terms for cross platform play on XBox with PC?
Do you know how long your updates take to be published on XBox vs PC ?
(since you need the same game version at once evrywhere)
etc
Personally I think cross-platform as an indie is nightmarish, and it's also pointless for listen servers because you just need like 3-5 players
It's a lot more relevant for dedi based games that have 30 players per instance that need to be found
50 On 1 server
Not on a listen server, no
I'd put 8 as a max depending on the game type
50 is also nonsensical for an indie, 90% of Steam games will never have that many players online
It's not based on how many will play its based on our game
Now please if you'd stop shitting on me honestly
I'm not shitting on you, I'm advising you
Well then if I want 50 I want dedicated?
Yes, absolutely
Well no way to run that without a executable is there
I mean I heard of a BP Plug-in to run batch. I Could just use that and make it run a Server Executable in my game folder
You probably want to be the one hosting the dedicated servers yourself in various areas of the world, as opposed to hoping some players want to run servers for you
But yes, separate game package entirely
Also require engine source build, and yes, ports or UPNP or Steam/EOS
I'll just have it somewhere in my packaged build
It's a separate copy of the game
Yeah?
So you want it to be a separate download, since it's gonna be as big as the game
(Assuming you still want to rely on player hosting with the security, performance and availability problems that will cause)
Yes Player Hosting
I could switch to dedicated and use batch and a plug-in in some way to make the whole process easier for the player
Though that'd kill Console and Mobile Hosting wouldn't it
You can't host on consoles or mobile anyway
Consoles maybe with very small player counts
On mobile the performance and connectivity makes it a non-option
Okay the performance isn't gonna be bad hopefully
I mean for a small pixel 2d based game
Network performance
Phones typically lose connectivity entirely fairly often and when they don't they have high latency, packet loss
My Phone quadrupled my PC Download and Upload
Bandwidth is not the problem
50 players is usually difficult to run on actual servers in datacenters
Really?
50 is absurdly large and hopelessly out of reach of indies
Again, not saying that to shit on you, just fact
Whatever just gonna give up
It's not about shitting on you. He's giving you realistic information and context that you don't have
I'm gonna reiterate my earlier advice: Start with a singleplayer game, work your way from there
You gotta learn to walk first before you can run
There's very literally 2% of all PC games that can support 50 players together, and that's stretching it
How doe's that help.
Me learning single player magically makes thing's easier for multiplayer
It gives your more context that you didn't earlier have
Context and experience are key factors in making the right decision when developing a game
Do make a MP game if you want to, but if you're gonna make a MP game, don't you want it to be a success? I want your game to be a success
Not my game anyways
Just trying to help that, if you don't want help, that's fine with me
I don't even decide on how large server's are
And then when a thing like port-forwarding is a thing
My other Team-Member get's mad saying that ruins the whole point
Then it's also not your problem when it fails and we're all good. Do you still have questions on how to proceed?
What would be a high but playable number for Listen Servers
8 is the maximum number I shared earlier, from my personal opinion
I'd suggest 3
Also needs to be purely cooperative (no pvp)
I only have PVE In Card Battles
Sounds like 8 is fine then
Just keep in mind - if the host loses network for 5s, everyone goes back to the main menu
Unreal is not peer to peer, it's server based and if the server has any issue, everyone will immediately have obvious bugs
I heard you can implement P2P
Doesn't EOS have that?
No
You cannot
(Unless you rewrite multiplayer in Unreal from scratch with sockets)
There's no fullmesh P2P, P2P refers to player hosted games
EOS supports it, but as in "can work with", not as in "provides"
Unreal does not
It's entirely server based
If your game is fine with high latency and has little networking ongoing (you said card game), rewriting multiplayer is in fact not a terrible option
Build your own server stack in Python or something and use HTTP requests
Free cross platform, matchmaking, no ports problems, no player disconnecting the game
Not easy to do but very viable and frees you completely
Eeh High Latency is Fine
It's just a Pixel 2D Game
Nothing much except Card Battles and Movement
If the movement needs to be responsive in real time and synchronized across players you probably want to stick with Unreal stuff
Is what UE4 Use's better then P2P or Not?
It's not better or worse
It's centralized
So single authority over the game rules and single point of failure
P2P games handle the loss of the host gracefully and usually share the authority somewhat
Okay let's go back.
If I want something based on UE4 System that is Cross-Platform and no Port-forwarding is Needed.
I'd want EOS and This Plugin?
Though that still leaves me with small player numbers
Unless I use dedicated which only leaves PC User's to Host
If you want cross-platform + no ports stuff, assuming you manage to handle the cross platform part, you have options:
- hosting your own dedicated servers for players (enables 50 players if you ever see them) + EOS or your own matchmaking
- using listen server + EOS (no 50 players)
- using your own multiplayer system with a simple protocol like HTTPS on regular Web servers
- do matchmaking and NAT punch yourself
Many options really