#multiplayer
1 messages ยท Page 431 of 1
Is there also any significant benefit to using C++ in a networked game instead of blueprints, even if you're nativizing?
4 players, less than 30 ai
I find BP networking very messy
Like if you change repnotify variable in BP, it will call onrep on itself
Ah, so a little extra overhead?
Okay
C++ onrep wont be called on server, BP will
Okay, that makes more sense, I encountered that before and got confused by it
Glad this chat is here. Not surr if my google-fu is weak, but it seems like theres a lot of questions that arent answered there.
And for more complex scenarios, BPs just dont support those
Starting with unable to override isnetrelevantfor
To being stuck with default serialization
Also c++ networking takes far less space
Yeah, thats what I was curious about, if you have to send less data over for the same operations
With BP, replicated array, you have to replicate the entire thing
Anr only client side callback you get is that array has changed
In c++ you can send only the delta, and get callbacks per itel for add/re ove/change
And it doesnt even take alot of work to implement
I will definitely have a look at that.
Read the NetSerialization.h header, it has comments and even an example for that
Just trying to learn this stuff. Im trained as a designer, but Im kinda making a networked fps solo, and running into performance issuds, so turning to C++ here
Ooh, okay
Taking notes btw
Also, making all RPCs reliable doesnt imptove networking
ServerMoveTo functions in CMC are all unreliable
Not 100% sure what you're saying there. Server replicating position of actors?
People tend to mark every RPC reliable when starting with networking
That actually makes things worse
Unreliable means it can get dropped entirely, yes? I do reliable for all necessary operations, like firing your gun and reloading, but not for particle effects and sound
Yes Kyle unreliable RPCs can be dropped, while reliable RPCs are guaranteed (unless a net error occurs) to arrive.
Yeah, thought so
@pallid token What do you mean it doesn't show up on clients? Is the rpc firing off?
Err sorry misread the second half.
Yes, it's firing, because within the same RPC, It spawns a projectile (It's a cannon) that appears on all clients.
Can you show what you're doing?
void AInteractiveCannon::FireCannon_Implementation()
{
if (CannonballClass != NULL)
{
UWorld* const World = GetWorld();
if (World != NULL)
{
const FRotator SpawnRotation = ProjectileSpawn->GetComponentRotation();
// MuzzleOffset is in camera space, so transform it to world space before offsetting from the character location to find the final muzzle position
const FVector SpawnLocation = ProjectileSpawn->GetComponentLocation();
//Set Spawn Collision Handling Override
FActorSpawnParameters ActorSpawnParams;
ActorSpawnParams.SpawnCollisionHandlingOverride = ESpawnActorCollisionHandlingMethod::AdjustIfPossibleButDontSpawnIfColliding;
// spawn the projectile at the muzzle
World->SpawnActor<ACannonballProjectile>(CannonballClass, SpawnLocation, SpawnRotation, ActorSpawnParams);
}
}
if(CannonFlash)
{
FVector ParticleLocation = ProjectileSpawn->GetComponentLocation();
FRotator ParticleRotation = ProjectileSpawn->GetComponentRotation();
UGameplayStatics::SpawnEmitterAtLocation(this, CannonFlash, ParticleLocation, ParticleRotation);
}
The last if block is the effect.
Can you prove that CannonFlash is valid?
It appears on the client that uses the cannon, but not any others.
Is the "client" that fires this an actual client or a listen server?
In my tweaking, I set it to a listen server and forgot, which creates a whole slew of other problems. Now, set with a dedicated sever, none of that works on any clients...
Alright, show your chain of events starting with the button press to what we're looking at now
Ok, let me put it all together in a legible format.
GeoD I think your problem is lack of knowledge in networking in general for what you are saying, as a recommendation you can check out cedri exi multiplayer compendium which is anchored on this channel up there
You will then understand context, simulated proxies, authority and ownership
it is really handy when you are starting out
Also you will understand why something works on a listen server and not on a dedicated server
Ok, I got the projectile to spawn pretty easily. I calling the Implementation rather than the function defined in the .h. Dumb mistake made on too little sleep. The particle effect still does not spawn.
@pallid mesa, I refer back to that very often.
Just ping me when you have the callstack
as a sane practice, when you deal with weapons it is good to have a burstcounter that you update every time you fire, similar to what ShooterGame does. Since the onrep execs on every client you can take profit of that and spawn your weapon muzzles there
the server would handle its own effect separately so think on the onrep as a thing exclusively for clients, since on C++ the onrep doesn't get called on the server ~
if you have ShooterGame by hand check out SimulateWeaponFire() and OnRep_BurstCounter()
ShooterGame had a couple context bugs 2 versions ago but now I would say it's pretty solid networking wise
I will absolutely check that out. I'm about to download ShooterGame, now. Thank you.
you are welcome, here you have further explanations on how ShooterGame works https://docs.unrealengine.com/en-us/Resources/SampleGames/ShooterGame?utm_source=launcher&utm_medium=ue&utm_campaign=uelearn
void AGoldenAgeCharacter::SetupPlayerInputComponent(class UInputComponent* PlayerInputComponent)
{
check(PlayerInputComponent);
PlayerInputComponent->BindAction("Interact", IE_Pressed, this, &AGoldenAgeCharacter::Use);
}
void AGoldenAgeCharacter::Use_Implementation()
{
AInteractiveActor* usable = GetUsableInView();
if (usable)
{
usable->OnUsed(this);
bHasNewFocus = false;
}
}
//InteractiveActor.h I am using this as an interface of sorts. I found the Interface functionality to be a bit awkward and clunky for this.
UFUNCTION(Server, Reliable, WithValidation)
virtual void OnUsed(AGoldenAgeCharacter* FPSChar); //defined in InteractiveActor.cpp, but it's not worth adding to this.
//InteractiveCannon.h
protected:
UFUNCTION(NetMulticast, Reliable, WithValidation)
void FireCannon();
UFUNCTION(NetMulticast, Reliable, WithValidation)
void SetFuseTimer();
public:
virtual void OnUsed_Implementation(AGoldenAgeCharacter* FPSChar) override;
//InteractiveCannon.cpp child of InteractiveActor
void AInteractiveCannon::OnUsed_Implementation(AGoldenAgeCharacter* FPSChar)
{
SetFuseTimer();
}
void AInteractiveCannon::SetFuseTimer_Implementation()
{
GetWorldTimerManager().ClearTimer(FuseToExplosionTimer);
GetWorldTimerManager().SetTimer(FuseToExplosionTimer, this, &AInteractiveCannon::FireCannon, 0.5f, false);
}
void AInteractiveCannon::FireCannon_Implementation()
{
// ...Code that fires projectile posted above. This code works, and the projectile spawns on all clients.
if(CannonFlash)
{
FVector ParticleLocation = ProjectileSpawn->GetComponentLocation();
FRotator ParticleRotation = ProjectileSpawn->GetComponentRotation();
UGameplayStatics::SpawnEmitterAtLocation(this, CannonFlash, ParticleLocation, ParticleRotation);
}
}
@sharp pagoda, my convoluded Callstack. Thanks for your help, so far, by the way.
Yes.
So you're stringing together multicast rpcs, which is going to cause problems
Oh, ok. If the first one in the String is Multicast, will it call them all multicast, or should I find a way to stuff it all in one?
So Use() should be a local call (not an rpc), and then (if you are a client (IsLocallyControlled + !Authority) call a ServerUse() rpc to relay back and then call Use() in the context of the server. Or you could make Use() completely local so you don't suffer overhead from clients spamming their use button, and just let the client run the OnUsed() rpc
Issue with #2 is you have to trust the client to not cheat it to run OnUsed() on an item halfway across the map, but there are other things you can do for that
OnUsed() probably shouldn't be a server rpc because you probably want immediate feedback for the client
For example: If you press "use" on a cannon, you don't want to wait a couple milliseconds to see it do something, you want to have that thing fire as soon as you click it
Ok, I understand, but does that,then call a ServerOnUse() to do the server stuff?
Yea so the big issue in your code is stringing together multicast RPCs. Recall that a multicast RPC runs for every client (if called from the server), so what happens is every client receives the FuseTimer rpc, then every client launches yet another multicast rpc for the actually firing
Can you quote which block of text you're referring to?
Yea it looks like the game breaker is the multicasts, but what block of text are you referring to with "then call a ServerOnUse() to do the server stuff?"
You said that OnUsed() should not be a Server RPC so that the player get's the instant reaction. That's the link between the player and the server, so calling that as a local function would cause the server to not get it, right?
Ah ok, so what I mean there is something like this:
// Called directly from the player input bind
void OnUsed()
{
if (Role < ROLE_Authority)
{
ServerOnUsed(); // this is just a server rpc that does { OnUsed(); }
}
auto item = FindSomeItemInMyView();
item->OnUsed(this);
}
That's what I was thinking. Thank you!
That way OnUsed() gets called locally and on the server
So small question time. I am considering redoing my inventory system from being a standalone actor to a component. Are there any things I should be looking out for replication wise? Is it gonna be as simple as switching the parent class from AActor to UComponent?
In the past I tried implementing it with UObject (when I had next to no experience with ue4) before switching to AActor, which caused some issues, but I'm guessing that components already have some replication built in, right?
Replication is handled for you with an actor component, https://docs.unrealengine.com/en-US/Gameplay/Networking/Actors/Components
ahh sweet
theres nothing I have to do different right?
the same macros and whatnot for marking stuff for replication apply?
"These components may replicate properties and RPCs in the same way an Actor can. Components must implement a ::GetLifetimeReplicatedProps (...) function in the same way Actors do."
Yep
The doc explains it all
aight sweet, might go alot faster than I feared then
So, I have implemented your suggestions, and it still fires the projectile, but it doesn't play the Particle System on the clients.
I am using actor components for a lot of my systems, including inventory, and have noticed that even though the component itself replicates automatically, the variables I set it in it do not unless I check the additional box โcomponent replicatesโ
Just FYI @winter plover
It was here a few days ago talking about cross platform networking. I totally forgot about this article
If you are working on mods for ARK, this is the forum for you! Dino riders welcome!
So does that mean this is easier if you use Xbox live natively?
Because at minimum you get cross-play between PC and Xbox already
Is there a size difference between replicating a TSubclassOf vs. a pointer to the DefaultObject ?
via rpc
Answer: profiled and it's the same
@jolly siren its the NetGUID either way
Thanks Zlo ๐
someone know the minimal requirement for a dedicated server to prototype for only 5-10 players ?
without hard tasks
actually we got an Intel Atom N2800 (2 cores 1,86GHz) with 4Go DDR3 1066 MHz for some web stuff
I don't know if it's enough to run a really simple unreal dedicated server
That should work fine for prototyping
ok thanks ๐
Would PixelStreaming go under multiplayer?
working great on LAN. Very interesting tech. My problems start when configuring SignallingWebServer to hook up to my TURN server.
its the peerConnectionOptions param in config.json that isn't being parsed right in cirrus..? i believe
i would explain more of my situation, but im not sure this is the place.
config.json looks like this
{
"UseFrontend": false,
"UseMatchmaker": false,
"UseHTTPS": false,
"UseAuthentication": false,
"LogToFile": true,
"HomepageFile": "player.htm",
"AdditionalRoutes": {},
"httpPort": 81,
"peerConnectionOptions": "{ 'iceServers': [{'urls': ['turn:TURNserverIP:3478']}] }}"
}
Running SignallingWebServer run.bat gives an "unexpected token ' in JSON, which after googling seems to actually be a js.parse error maybe? im v bad at javascript.
npm WARN cirrus-webserver@0.0.1 No repository field.
npm WARN cirrus-webserver@0.0.1 No license field.
audited 391 packages in 2.605s
found 1 low severity vulnerability
run `npm audit fix` to fix them, or `npm audit` for details
16:32:25.225 Config: {
"UseFrontend": false,
"UseMatchmaker": false,
"UseHTTPS": false,
"UseAuthentication": false,
"LogToFile": true,
"HomepageFile": "player.htm",
"AdditionalRoutes": {},
"httpPort": 81,
"peerConnectionOptions": "{ 'iceServers': [{'urls': ['turn:XXXXXXXX:3478']}] }}"
}
SyntaxError: Unexpected token ' in JSON at position 2
at JSON.parse (<anonymous>)
at Object.<anonymous> (D:\DEV\Proj\packaging\wintyGermsPixelStream\PixelStreaming\WebServers\SignallingWebServer\cirrus.js:121:45)
at Module._compile (internal/modules/cjs/loader.js:688:30)
at Object.Module._extensions..js (internal/modules/cjs/loader.js:699:10)
at Module.load (internal/modules/cjs/loader.js:598:32)
at tryModuleLoad (internal/modules/cjs/loader.js:537:12)
at Function.Module._load (internal/modules/cjs/loader.js:529:3)
at Function.Module.runMain (internal/modules/cjs/loader.js:741:12)
at startup (internal/bootstrap/node.js:285:19)
at bootstrapNodeJSCore (internal/bootstrap/node.js:739:3)
Press any key to continue . . .
Tried a bunch of different formattings of the "peerConnectionOptions" value, which is supposed to be a string even if its json(as specified in pixelsstreaming Reference)
im running out of ideas
clientConfig.peerConnectionOptions = JSON.parse(config.peerConnectionOptions);
thats line 121 in cirrus.js
but i assume the problem is the peerConnectionOptions-value in config.json
So I found a old โtutorialโ regarding beacons
Curious if someone can skim the code to let me know if anything looks massively out of date and not worth trying to follow ๐
Hey everyone,
I noticed that this is covered very little in the official docs and around the web. You can find tidbits here and there, but not a full example that
Hey does anyone have some spare time to help me with setting up a dedicated server? I did it alone and there are no errors or warnings but I cant connect to it.
Any tips on how to make a clients attack go from Client 1 to Server to other Clients?
like, how to I tell the server only to send an event to all clients but the one who initiated the original event
It's a first person shooter and I can't have the player have to wait for the server just to get the feed back of their attack input =d
Or am I doing this the wrong way? <.<
Or should I send the Input with like an ID and so the Original user can identify it and ignore the event? o.O
@digital violet Haha, it's fun to see basically one of my own first questions when working with ue4 pop up :p
UE4 does not provide a multicast that goes to everyone "except owner". They don't want to add one either.
lol, hope you found a good solution ^^
They expect you to keep your own list of clients to send it to, and then send it by Client RPCs to them.
What we did, because we were nubs, was just make the original client ignore the multicast for the attack event that they had already client-side predicted would work.
Today I would maybe invest a bit more time into making it send the RPC only to the affected clients. But doing it with a multicast isn't that bad.
Do you know a good resouce or maybe a good vid turotial showing how to do it? =d
Maybe i can find out how by watching enough RPC vids <.<
Well you'd do something like this:
- ClientA does an attack.
- ClientA calls "ServerDoAttack", and then immediately "DoActualAttack"
- Server gets the "ServerDoAttack" and calls "MulticastDoAttack"
- Server gets "MulticastDoAttack" -> Calls "DoActualAttack"
- ClientB, ClientC, etc. etc. gets "MulticastDoAttack" -> Calls "DoActualAttack"
- ClientA also gets "MulticastDoAttack" -> you confirm that this is running on your locally controlled client (There's a
IsLocallyControlledfunction) and therefore do not call "DoActualAttack", since you already called it when you started the attack.
This should work for all clients, in any ListenServer/DedicatedServer setup.
It will only fail for NPCs if you try to make them use the same callpath.
(which you shouldn't)
And you can join me in my silent plea for wanting an RPC type that goes to everyone except owner. :d
It makes sense for clientside predicted actions like these, but it is technically solveable without it, so I guess they don't want to bloat the RPC types. Which is fair enough.
Would I use the same thing on a projectile actor?
Right now when using a flamethrower the original client gets two projectiles x)
I would like the original player to se the projectile as soon as he/she attacks, but also for the server to say to all players where the projectile ends up
That one is harder to answer. Our game has slow enough projectiles, but still fast enough exit (arrows), that we just spawn them on the server and let them replicate from there. Without spawning a client version.
Fair enough =d
So never looked into syncing a client-side predicted arrow with a server spawned one ๐ You need the server one for authority
Also: So the server sending a Multicast event also sends it to itself? ๐ฎ
yes
Hu, ok nice ๐
how can I send the Portal variable from GameModeBase::Login ?
@rare cloud As far as I can see it's passed via the URL
it's used to choose the PlayerStartActor, and actually I don't know the format to use Portal :/
"?Portal=" maybe
seem strange
Not sure
@thin stratus I can confirm ๐
127.0.0.1?Name=Jackblue#Portal is a valid URL
and the portal string is used inside the FindPlayerStart to determine which PlayerStart have a matching tag with the portal string
if this can help someone
when I enable Steam Advanced Sessions, I can no longer join my dedicated server with a direct IP. But if I disable the plugin and just use regular Advanced Sessions, I can connect with the IP again. Is there a special command to connect when the steam plugin is enabled?
???
How do people normally go about resolving "client connecting with invalid version" ?
@low pond They build the game and the server without making changes between builds.
is voice chat enabled by default over steam?
Can I run my multiplayer game on this server: (its a virtual server) and is there any help how to do that:
https://www.ngz-server.de/vserver/vsmall/server_mieten/
Miet jetzt deinen eigenen Virtual Private Server um deine Webseiten oder Gameserver zu hosten, kleine Preise groรe Leistung.
Hi, I have a problem. I made a multiplayer game supposively should run on either lan or internet. I'm first working on lan. Here my problem: Everything is fine when I try it in the PIE with multiple clients. But when I package the game and open it up on 2 different pc (both different steam account) and connect both to the same network, it doesn't connect. I can create a session, but not join one. Maybe I have a windows firewall problem or my network is set up wrong or something.. Any ideas?
the LAN checkbox doesn't really work well iirc
should be fine as long as its unticked
Does anyone know of an alternative to open 127.0.0.1 for testing disconnection / reconnection in PIE? It used to work, but it doesn't anymore. I logged a bug when they broke it but they never added it to issues :/
ah figured it out ๐
There are disconnect and reconnect console commands
Never knew about those
For whatever reason some console commands don't show the autocomplete
man those make it so much easier to test โค
So I'm wanting to clean up some of my blueprints where I have delay nodes. I have them because I need small delays before updating or displaying HUD info and playername info. But they don't allways work in a networked multiplayer game where stuff could go wrong. So how can I use RepNotifies to fix these and not have delay nodes? Here is one instance where I use a delay when I respawn and Possess my new player character and update his HUD with his new health etc. https://i.gyazo.com/db8006ffd0459294bd3ba60175c58428.png
I thought I could just make a new RepNotify variable and then place my logic above inside the RepNotify function but I can't figure out how to get that "New Controller" inside the RepNotify
hey, im looking for a new network solution. currently im using steam advanced sessions plugin but because epic store will also be there im looking forward to it if i manage to find something nice. you can also suggest marketplace plugins if there is something what does the same.
I guess what I'm basically asking is, "For Multiplayer Games, what do I use instead of delay nodes?"
@cedar finch I swear I talked to you about this a few weeks ago, you want to use rep notifies and RPCs. For example, if you want to run some code as soon as the controller is available (after a respawn event, for example), you would run your code in the rep notify for the controller.
@sharp pagoda Hey man! Yea I got caught up with family and Thanksgiving I just got back to working on this. So I'm a little confused and maybe you can clear this up. Do you not keep your controller the whole time? For some reason I thought you just destroy the controlled pawn then possess a new one and keep the same controller. That's why I'm confused on the possession because I thought it would be inside the pawn. Do i have it all wrong?
"Do you not keep your controller the whole time" It depends on your perspective. If you're from the perspective of the local player, yes you always have a controller. If you look from the perspective of a newly spawned pawn that you're in the process of possessing (in the event of a respawn), no.
In the example of a respawn, you can't assume there's going to be a controller at some point like begin play, even though you are sure that the server called Possess as soon as you spawned the thing.
Instead, you want to use OnRep_Controller() (as a client) so you know exactly when the possession event is completed, where you now have a valid controller.
As for the server, you use OnPossessed() to do the same thing.
In your case you're using blueprints, where an abstraction is provided called Event Possessed
Ok so the OnPossessed() is the same as the blueprint "Event Possessed" ?
No, it's half of it
I can't find the OnRep_Controller to override
OnPossessed == Server
OnRep_Controller == Client
EventPossessed == Server + Client
Yea the first two are hidden from you in blueprint
So if EventPossessed has both why not use it?
Well you have to, in blueprint. In C++ you might want finer tuned control
True, but I havn't got that far yet lol
Err sorry it's not OnPossessed, it's PossessedBy() in cpp.
So I understand how you can run the RepNotify logic but I feel I'm using it wrong. For example In my player controller I run a 'Server' event that sets the players name inside my playerstate. Then inside my PlayernameWidget I retrieve that playerstate name and set it as my name. I got it working but It runs in a loop for clients until it gets their name. I feel like this is probably not how I should do it. https://i.gyazo.com/c0a2094a1b9d71f5af712768e57cc3d0.png https://i.gyazo.com/02b660e2e7bbd4b9309847f015d6ad95.png https://i.gyazo.com/69f4f82bf36540a78365d08b52423f42.png
I used to have a 2 second delay after the "Event Construct" node in order to give the playerstate time to set the names of the players. Without the delay my player names wouldn't show up.
@cedar finch You had the right idea with the OnRep there. All you have to do is GetMyHUD()->UpdateUsername() from there.
Remember that OnRep will execute for all relevant clients (and in the case of BP, the server too).
(It will also execute for non-relevant listeners that become relevant later)
I haven't even used the actual HUD yet I just have widgets that I created for my health and stuff. Is that what you're talking about?
Yes, also 99% of the time have your HUD act as an abstraction and management layer for all of your widgets.
You nearly never want to interface directly with widgets in game code
That introduces heavy UI coupling
(The 1% case is for things like weapons that have their own custom widgets, where you will have the weapon class manage the widget instead of the hud)
So I'm trying to wrap my head around this, where do I call GetMyHUD() and what is the UpdateUsername() do? I mean I can guess it updates the username lol but my name is stored in a custom variable in playerstate
Those were just placeholder names.
Ah gotcha.
The concept is to get your hud, then run a function in your hud that tells your specific username widget to update
Oh so take out the Construct event and just use a custom event that gets called from the Rep inside Playerstate right? Thats what your saying?
Yep, you don't want to try and fetch the username on construct, just null out the text.
yea thats what was happening
Fill the text once your receive the username over the network (aka onrep)
Ok now I understand. ๐ Thanks for explaining and helping.
yw
I'm sure I'll get stuck again but I'm going to see if I can fix up some more of these little issues with delays. I just wish the internet and YouTube didn't have so many bad tutorials and instructions
You really shouldn't have any delays to deal with networking, those are super hacky solutions, if they're even considered solutions. You can do everything with net callbacks and rpcs.
Gotcha. I got one last question that you mentioned earlier. Getting your HUD from your playerstate. How exactly do you do that? Cast to HUD? I've never done it but It will be extremely useful
some call these delays "manual buffers" which is hilarious.
Donโt delay
it isn't even a buffer anyways
No you can't cast your player state into a hud, because those are two totally different and unrelated objects. You want to get the owner of the player state, which is the player controller, then from that player controller call MyHud() (something like that, would have to open docs for exact spelling), then cast that HUD pointer to your specific HUD class.
@cedar finch
Get HUD
Er call a run on client incoming controller event to run on server to set name
Inphidel you missed the entire convo on that haha
Pretty sure he knows what to do networking wise now
it's a bit concerning that some basic concepts such as type casting are not ackwnoledged yet and still tries to do networking, I would worry first to settle knowledge base of 101's in unreal and then dive to the pool of the multiplayer with the wonderful materials we have anchored @ this channel
Also don't forget to check if your pointers are valid before dereferencing them in this case. If you're on a dedi server and try this, you'll crash since there is no player controller @cedar finch
Iโve experienced first hand the fun and still do retrofitting hacks with better solutions
Kinda why I lurk here \o/
Asuming he is on BP's it won't crash but a red will appear, so add the IsValid macro to the code on the blue wire
I think he knows some oop vorixo, since he's using polymorphism in other places and hasn't had a problem so far
I don't know the question about casting hud to PS was a bit scary, still we are here to help ^-^
It's usually pretty obvious when people don't know how to use type casting
Yea haha, I think the response wasn't thought out
It's something common, and that's a concern I've been having all this time, which will prob lead me to write some 101's for Unreal "what to do before starting with the engine"
I find wonderful the amount of people that grabs the engine to create, however some of them usually take the "youtube tutorials" way (there are some that are wonderful like Wadstein ones or Epic official ones, let's not put them all in the same bucket).
Make pong
Anyways too off topic!
Thanks guys. Sorry I had an emergency come up and had to leave quick. I'm back now. I didn't mean it how It sounded with the casting to HUD lol. I see exactly what you guys assumed I meant. No i'm not that much of a noob. I meant what @sharp pagoda said earlier about casting to your HUD when you get it. I was fishing for that GetHud node.
oh okay, glad to hear, hope you understand my concern
Yea I do. I usually put thought into my questions before I type them but I was super rushed and had go get my car out of the shop and only had 10min to get there before they closed. lol
while it's good to think what you write, that isn't the core of the problem xD
I know. The problem is trying to run before you can crawl.
@sharp pagoda How do you get a widget that is added to my Pawn inside the viewport using the GetHUD? I'm not sure how you get from your HUD to your widgets. https://i.gyazo.com/234a99c1acf754292a99da0ede4db859.png https://i.gyazo.com/29c8d7316f2aaf3e317ebb66482a1e80.png
@cedar finch So a widget component is another one of the 1% cases. The widget is specific to the character and can change with different characters, so the individual character manages the widget. The HUD isn't involved here
So there isn't a way to communicate between the PlayerNameWidget and the Playerstate? I was going to remove my Construct event and put in a custom event and then try to call that custom event from the playerstate, but i can't reference that custom event because it's inside the widget
playerstate-->playernamewidget which sets the name
The text inside the widget just needs to be set to the name that's inside playerstate.
Event dispatcher?
Playerstate -> Controller -> Character -> Widget Component -> Widget
You're just missing the last step, which is getting the actual widget from the container (widget component)
And also added safety checks or you'll get errors thrown in dedi servers
There you go
๐
@sharp pagoda It may be because I'm testing inside the engine but sometimes the Clients names are not set and just appear as the Default text. ๐ฆ Server always see's everyones names but Clients just see "Default" Clients fail this first isValid https://i.gyazo.com/ede50adb8c65bbf62dc8f12ab953b277.png
Right, because clients don't have access to other player's clients, so it will be invalid on any non-local player or the server.
So instead what you can do is not have this be a rep notify, and instead have the widget pull directly from the player state.
I'm confused because I thought that's what I had before the repNotify
I pulled the name from playerstate but had a 2 second delay so I make this repnotify
in order to get rid of the delay
Oh ok, so this is a floating text (or similar) that all players can see? I was under the impression that you wanted this for yourself only
It's a floating widget above players heads that I want others to see. I want to hide it from the owner so its not in their face.
Yes it contains text of their name
But sometimes it works and all names are correct.
Again it's like it comes down to a timing issue of, "are you setting the text of the widget before the actual name has been set?" type of dilema
This has been my major issue for everything widget related.
In your case you might want to have the rep notify on the player character, that way you don't have to interface through the player state.
Or have the player listen to an event signaled in the player state rep notify.
Ok so I have 3 widget related issues that I have to use delays for. first is the playernames which is what we've been talking about, second is the players health hud, third is the spectators hud. I want to create all three as soon as the games starts. But I have to have a delay on each in order for the character to get possessed first. I also have to update those widgets when respawning which again is OnPossessed. So do you have an idea on how to use the OnPossessed event or RepNotify to solve all 3 of these issues?
All three work most of the time but sometimes the clients don't load properly such as their player name not showing up correctly or their health not being shown correctly. It's always a timing issue
Is this player's health hud local or a floating bar above their head?
So the playername is the only one that is floating above the players head. The other two are created inside my playercontroller and added to the viewport
Ok, remember what I said earlier about decoupling through the HUD?
Move the spectator widgets and health widgets to the HUD, then when the character Event Possessed, MyHUD->DoSomeStuff
So in my case I have a ThirdPersonHUD. I should move the following from my PlayerController intoHud? https://i.gyazo.com/637094f0f25995d22228eb3ad976ab13.png
Absolutely. The player controller 99% of the time shouldn't even have to know what a widget is
It just talks to the HUD
hmmm So what if for example inside the OnPossessed event I call UpdateHUD which is inside Playercontroller. What difference does it make if that event is inside Playercontroller or HUD? Won't I still have the same issues?
Event Possessed -> is locally controlled? yes -> Hey HUD I now exist -> HUD sets up all the stuff.
You don't need to feed through the PC
You can interact with the HUD directly through the character
So as a PlayerController with no possessed actor HUD doesn't exist?
it exists just fine
but without a possessed pawn you can't give the hud a possessed pawn as a context
and the pawn needs to be possessed to access the HUD "directly"
as that goes through the PC under the hood
HUD has no binding to the character, it is bound to the PC
The point of this Possessed callback is to notify your HUD that it can now start reading the health/etc values of a character
I understand now.
altho Possessed might not be ideal, as it happens only on server, and there is no client HUD there ๐
SetPawn would be my preference, but its not BP exposed
The bp EventPossessed runs locally + on the server?
Cpp version runs server side only
I'm just trying to get the simple stuff working and understand how it works from the moment the game starts to the moment your an actual character. Sorry for all the questions lol. I just like knowing what is happening and how things are being setup.
i can't find the client-side call to ReceivePossessed
Looked at the docs, the bp version does only run on auth/standalone, so you have to use the on rep for bp as well, but there isn't one exposed to bp that I can find
I think AcknowledgePossession is the clientside func?
Haven't gone through to make sure its only client, but it seems to be.
Not seeing anything for that
ideally, its SetPawn override, as its called from Possess and from OnRep_Pawn
Oh that's on the pc
yea
Why would they not have OnRep_Controller exposed to bp ๐ค
prolly cause nobody thought doing it yet
@sharp pagoda Well I'm guess I'm just out of luck. I moved my Hud stuff to my Hud blueprint instead of my player controller. Then create the huds once called inside the OnPossessed event. Only the host see's his and it only works if I add a delay before creating the hud. ๐ฆ The same issue as before.
Yea, you're going to need to expose some cpp through a function library.
So I'll have to fire up the old Visual Studios again. Lol But I was wanting a Blueprint only game
I guess blueprint is not meant for multiplayer games yet is it?
Still blueprint, you're just exposing a helper function
I'm not sure what that means
You can write the code in blueprint, you just need to expose a little bit of missing functionality.
While you're at it you might as well remove the handicap that prevents destroying controllers in bp
I've never exposed stuff before so I'll have to figure that out somehow
I just get so frustrated at how difficult it is to do the most simple bare bones things for multiplayer. Playernames, Health and Hud stuff should be the core of 90% of most games right? Why is it so hard to get this basic stuff working in blueprints? I can make shooting, inventory, ai systems fine but heaven forbid I try to get playernames and HUD stuff in multiplayer. ๐ฆ
@cedar finch what's you problem?
you can store player names in player states or even game state, so every client will have properly replicated variable with it. For HUD it's better not to save anything important for replicatin inside HUD, but to use reference from player character code or some other place with proper replication (that's because HUD does not meant to be replicated)
GAMESPARKS HELP
Desc : I need help accessing my friendsList data
More Info : https://support.gamesparks.net/support/tickets/11649
LogNet: PreLogin failure: incompatible_unique_net_id ideas?
Happens when I try to connect to a server.
ue4 version?
4.21
So throwing UWorks on my project fixed it. lmao what
Same here. That plugin seems to be a technological marvel.
lol
(Jokes aside, I had no idea it would solve that too; I just try to fix everything I can via plugins)
@solar halo Do you have steam auth enabled?
They added it in 4.20 and I'm wondering if it is required now (not talking about UWorks here)
[PacketHandlerComponents]
+Components=OnlineSubsystemSteam.SteamAuthComponentModuleInterface
In DefaultEngine.ini (or WindowsEngine.ini / LinuxEngine.ini / etc. if you have it broken out like shootergame)
I can add that and try. Give me a few.
[2018.12.08-14.24.30:740][144]PacketHandlerLog: Warning: Unable to load HandlerComponent factory: OnlineSubsystemSteam.SteamAuthComponentModuleInterface```
@jolly siren
Am I supposed to do something else?
So it looks like I can join with 1 client. I'll revert to UWorks and see if that works.
As far as I know that is all https://docs.unrealengine.com/en-us/Programming/Online/Steam#steamonlineauthentication
Your dedicated server and clients are both using the steam subsystem?
ShooterGame has this setup and I don't see anything else there
Hmm, so just realized I can't just have a client shoot with a weapon and tell the server to do the same. I need to make sure it's the same Spread ๐
But I can't have the client telling the server the vector of the shooting eather
Should I have the client generate a random seed used in the spread and send to the server? ๐ค
or would it be better to just let the server handle it all, having the players wait for feedback of their shot?
I'm making an FPS and of course I would prefer to have the feedback of the action to be as instant as possible
Maybe just have the client instantly see a muzzle flash and get the sound, and have that as sufficient instant feedback, then wait for the server to say there the shot landed
I don't know how Epic's SteamAuth works, but I have an example for authentication in UW-PlayerController.
I usually recommend people to implement authentication via the ISteamNetworking interface, after their server query is complete, but before actually connecting.
Saves a few disappointments in cases in which authentication is denied (off the top of my head, there are around 10 reasons or so why it would fail)
@digital violet Seed is what you can use yea
make sure to have one set before the client decides to fire a shot
by the server
because otherwise the client could choose a seed that grants a low spread, and use that instead of randomly generating new ones
About sending the aim vector to the server, Im not sure if that is enough control for the client to do anything terribly malicious with it
if you only check the player aim on the server, chances are you might get the intent of the client wrong
purely because of delay
@terse coral the 3rd one now mh
Hey guys I have a really important question: I rented a virtual Server but I dont know how to connect to it
ssh or rdp
Sorry but I dont know what I have to do
To avoid people getting info feel free to pm me.
Anyone know if there's an option with UE4 to go past 4 local multiplayer with controllers? XInput clearly caps out at 4 in their API, but I didn't know if the SteamController API supports taking overflow (trying to figure that out now). The Windows.Gaming.Input API would be the way to implement it, but that's only used in the UWP fork, and, even then, it hard codes a limit of 4 in their implementation (though the API itself supports up to 8). So far from what I've found implementing a UE4 build that uses the Windows.Gaming.Input API seems to be the only way to get more.
Hey guys!
I have a huge problem!
๐ฎ
Animations of clients on listen server are like at 10 fps
...tried this with a simple character that just inherits ACharacter
How do people fix issues with NetCL being different from the binary release when building from github source? I want to avoid everyone having to build their own client (or have a separate client release)
@sterile pebble I have my my hud and playernames working like you said but I can't make them always work due to not being able to use delays in multiplayer. For example when I get my playername from gamestate sometimes It hasn't been set or is in progress of being set. Same with my health HUD. I need a delay of one second before creating the hud in order to possess and get my players health values. If I display the health HUD at the verry beginning sometimes I don't get my health values so my health bar is blank. Weird stuff like that.
@cedar finch yeah, in multiplayer you will often run into trouble with delays at the game start due to the replication delays. Most common case is to setup timers with small delay (1-2s); You can also use On_Rep (rep_notify) events, or do something more complex
@sterile pebble Using delays like that are absolutely not "most common case". You want to avoid that at all costs, always use net callbacks and/or RPCs.
Never use non loopable timers for that. If you want to wait for something to happen and you dont want to do cyclical dispatching (ie PS and HUD at the game start, since there is not a waranteed loading order...). Do it with a proper "listener loop" where your timer would loop until the desired class is loaded (which is by the way not the best solution).
How would I go around making my single player RPG a multiplayer game?
I want to be able to select a character from the start if I don't already have one, then play with that character, and save to server. Upon logging in again, get the info from server and load in the character for that player.
All tutorials I've found so far only make it like a FPS, so you have to re-select each instance, etc etc, which is what I don't want.
Guys anyone can help me with a little problem with json?
@crude zenith Multiplayer support is really something that will creep into every part of your game, so making a single player game multiplayer is a lot like re-creating it
I usually say MP is basically 5x more work
@bitter oriole I don't have an entire single player game set up yet, I've only been working on it for around 3 weeks now
I'm motivated enough to modify the several blueprints and other instances I have to update to multiplayer
@worn nymph Hey I saw your guide https://wiki.unrealengine.com/Dedicated_Server_Guide_(Windows_%26_Linux)#section_6_Contact_the_author I followed your tutorial but I have 2 issues:
- I cant package, because it sais: PackagingResults:Error: Error Unknown Error
- And i rented a Virtual Server so do i need to build a dedicated server anyways or how do I connect to my vServer?
I hope you can help me with that, its really important for me.
http://prntscr.com/lsp4zq why can't I see animation how to fix ? ?
is it a montage?
?
the animation?
for AnimBlueprint to play a animation, the variable it is using has to be replicated, and montaged have to be played on all clients, either multicast or by some other means (repnotify, for example)
hey guys, i seem to have a problem with net cull distance enabling collision. I attach character to vehicle, disable actor collision, disable movement component. when goes out of net cull distance and then re-enters, it seems to auto-enable the character collision, causing the vehicle to fly off into space on the client side and offset the character outside of the vehicle body (but still attached)
this is 4.21
Any ideas, why an GE created with CreateDefaultSubobject<UGameplayEffect>("MyName") is not supported by FNetGUID? (e.g. doesn't have a NetGUID or is not name stable for networking despite being a default subobject)
LogNetPackageMap: Warning: FNetGUIDCache::SupportsObject: GameplayEffect /correct/path:CorrectUPropertyPointer NOT Supported.
@jagged garden it's not replicated, but the client obviously does something when objects re-enter the radius, and it appears in this case it is forcefully enabling collision when it wasn't on exit of the radius
i'll test that later, but it's not a solution for an open world game
for something like vehicles where there aren't too many, it may be a viable option
although i dont know for sure
ya, will take some testing , thanks for the input, would like to find the root cause, probably have to step into code and see what's going on
How do people fix issues with NetCL being different from the binary release when building from github source? I want to avoid everyone having to build their own client (or have a separate client release)
@random hazel Nice assets man! Are they Marketplace or something? Or did you make them yourself?
all marketplace, except ground textures from gametextures.com
when your characters enter a vehicle
are you doing an RPC to set up the "In Vehicle" collision state?
and things like attachment/pose/etc
because if so, that will not work when you leave and reenter the network bubble
since the RPCs will not be sent in that situation
@random hazel ^^
i ran face-first into this behavior implementing vehicles for squad
(yeah, watching your gif, that looks exactly like what I saw)
the solution I came upon is to use a replicated variable to represent whether or not a player is sitting in a vehicle
and then use an OnRep function to set up the no collision/pose/no movement stuff
(I called that SeatingState)
Replicated Variables are guaranteed to be there when an actor comes back into network distance
and OnRep functions are called in that situation
so you have full control over the state of your object on the client when it enters a netcull distance
@gleaming vector thanks dude, you live up to your name! that's the info I was looking for, a way to hook when the netcull returns back in
any time
good luck
I did all this like 2-ish years ago
there are still a good number of challenges
but that should get you mostly working
much obliged
When you want to stop an actor from being replicated and remove entirely from network what function should be called? Tear Off or Set Replicates to false or both?
Thank you Vaei and Roy :). I don't want to undo it anyways so I'll tear it off :).
HEllo, does anyone know if REplciation Graph had support for splitscreen games with 4.21
The doc of 4.20 regarding it says it can't yet but 4.21 put the feature out of early access so idk
Try to take advantage of the quantization functionality that already exists. e.g. FVector_NetQuantize.
is there some resource to read on this? the only thing written in docs on FVector_NetQuantize is
0 decimal place of precision. Up to 20 bits per component. Valid range: 2^20 = +/- 1,048,576
Note: this is the historical UE format for vector net serialization
I'm trying to read a bit about optimizing the network code
also if someone has any "DONTs" that most people miss, that would be great
or general network optimization tips
I have a DONT that a lot of people do. Don't replicate hit results, only replicate what you need
Also, there is a lot of player information already replciated by default in your playerstate & gamestate, so make use of that
Also FVector_NetQuantize is simply a variable type like normal FVector
Replicating the NetQuantized vector sends over less bandwidth than normal FVector
Need to read the source to know what hidden stuff are in the player state and game state I guess
but thanks a lot!
I think it has 0 decimal places
that is what doc says
I have a server object that is noticeably jumpy when it moves. I'm just experimenting with it, right now, so when I scale it up in my project, it may not be as noticeable, but is there a way to increate refresh rate on it? Is that a dumb question?
In your actor you can set how often it updates
@red ledge there are multiple FVector_NetQuantize
A vector in 3-D space composed of components (X, Y, Z) with floating point precision.
@night jay got it, thank you!
Np
Physics object.
yea physics replication can be wonky at times, especially if you have lots of them at once
you geeeenerally wanna avoid it, because they basically trigger replications constantly
it's bad for bandwidth
if possible you want to keep any non-gameplay relevant physics not synced
Is it not possible to just replicate the movement rather than the physics?
that's what it does
but because it moves every tick, it updates every tick (that it moves)
and physics are rather complicated and can take a while to come to a stand still
what are you using physics for?
To propel and steer a ship.
dont use the actual physics for that
you will want to write a specialized movement component for that
which will be easier to replicate and predict
so I never really wrote my own yet either
so I cant really help much in that regard
Meh, I'll figure it out.
but you can peek into the source code of the ones that already exist
basically you will want to simplify the movement you want into just the necessary stuff
so I'd imagine bobbing up and down, and forward movement + steering
And limited rolling from side to side.
yea and that maybe
but the advantage of abstracting it into those few things, you can predict the movement alot better
it's not subject to random pileup of inaccuracies necessarily
Ok, I see.
if it makes it easier, you could just code the logic into the actor directly for now
instead of worrying how to write it as a component
you can always refactor that later if needed
Yeah, that'd probably be easiest.
CharacterMovementComponent.cpp is only 10800 lines... This'll be fun!
So I've been looking into Event OnPossessed and it seems to only run on server. I found people who are in the same situation as me where they need clients to know exactly when they possessed a pawn in order to do some logic here: https://forums.unrealengine.com/development-discussion/blueprint-visual-scripting/91161-why-is-there-no-on-possessed-event-for-client I'm curious if anyone knows how to either override the restart function in APawn, or setup an OnRep boolean called IsPossessed in Blueprint only? I know it can be done in C++ but I want to keep it all Blueprint.
Build powerful visual scripts without code.
Here is how I'm trying to use a RepNotify to make it work. So far it works for clients but not server yet. lol which is opposite of what I had without. https://i.gyazo.com/6601dbdb9e7fd121e13904a9c590851c.png https://i.gyazo.com/a3f1953eb1d3cfc4cb03e8a2db34a243.png https://i.gyazo.com/b4ce88dca753e99a00829df15b3564d4.png
what does replicated in variables means ?
A replicated variable will make sure the value on a client corresponds to the value on the server, provided that replicated variable exists in a replicated actor.
thanks
so before unreal makes it's store it was to make and test an online game you would have to use the steam sup system , but right now i want to make my game available on the Epic Games Store , doesn't that mean I'll have to use some differenet method for that , having i mind that i have been searching Unreal Engine pages , but didn't find anything
minor differences at worst
and if you just asked what a replicated variable means, you're a long long way from distributing a multiplayer game
Before i had to enable steam sub system and add the script to engine file , but now it's all deferent
i suggest checking pinned messages on this channel and reading through Cedric's network compendium
yeah but i need it to test it right @winged badger
@winged badger or anyone else. Can you tell me if my replication logic is off by looking at my screenshots above? I can explain my logic. So "Event Possessed" is Server I belive so I set a RepNotify variable in order to execute the RepNotify logic for both Server and Client. That logic updates the owning player's HUD values. I added the extra "UpdatePlayerHUD" in eventPossessed to try and make the Server players HUD update but it won't update. As of now only Client players HUD updates on Possession. Please let me know if my logic is off.
why are you forcing pushing HUD values into the HUD?
most of the time HUD can just grab them on its own
It can get them I think my naming of my event is what's misleading. It is updating the HUD's Pawn. So when a player dies and I respawn another pawn to possess I have to update the HUD to that new Pawn in order to recieve the new health values
GetOwningPlayerPawn from the context of HUD is always the possessed Pawn
so you don't really need to push it
I never destroy my HUD though. Will that cause errors when I don't have a possessed pawn?
nope
you'll have to handle that
some weirdness unless you handle invalid pawn in between possessions though
but you can just bind visibility to GetOwningPlayerPawn->IsValid
it is always sane to check validity before doing any kind of operation with the owning pawn
if you are not sure of the type you can always use an interface
I use that and do check validity when I create the widget. https://i.gyazo.com/0c0c7112a713dd62e121b7a3f24485d4.png
as long as you connect the Owner pin
GetOwningPlayerPawn is the possessed Pawn from the context of Widget as well
so you don't have to set it, destroy it or recreate it
I'm still not sure what I need to do. I set the owning player as a variable in order to retrieve the health and stamina variables from my ThirdPersonCharacter.
So your saying I don't need to update the HUD's owner if I use the GetOwningPlayerPawn
But I am using it but I guess in the wrong place
Well I'm lost. I understand that the "GetOwningPlayerPawn" is the possessed pawn for the widget but you have to update that or call that event again to re-establish the new OwningPlayerPawn right? Because when the original OwningPlayerPawn is destroyed, the widget will have nothing to reference and stop working. Then you have to re-establish the connection between the new possessed pawn and the widget. Am I just stupid and missing your point? I feel like this is easy and I'm making it harder than it has to be.
@winged badger So if I add a delay of 1 second to my Event Possessed my HUD updates perfect for server and client. But that leads me right back to square one which was getting rid of delays in multiplayer. ๐ฆ
no
when possessed pawn changes GetOwningPlayerPawn will get the new one
its not a variable
its a function
it doesn't need to be updated
I get that
But how does the widget that is using the GetOwningPlayerPawn keep running. When my pawn is destroyed the widget stops ticking
right?
nope
its still valid
its lifetime is managed by the HUD
which doesn't get destroyed until the controller is destroyed
I'm just confused as to how the widget which has nothing but a construct event knows when to update. I know you say it always lives and isn't destroyed but I can't figure out how to make it work.
When a player dies and is a spectator their widget will just run once and be invalid because there is no OwningPlayerPawn right? Then it will just sit empty.
I'm not arguing with you I'm just trying to wrap my head around it all
People like you know the best ways to create these things and I want to learn. The internet is just full of people putting healthbars inside "event tick" and other crap that is not right. I'm trying to learn the more correct and efficient way.
you can use delegates
delegates are sorta "events" that you can tie to a specific function
you can define one on your character (call it "HealthChanged" or something along those lines) and bind it to the widget
then every time you futz with the health in some way you can invoke that delegate, and your update func will run
there's a bunch of different types of delegates, the wiki might be a good place to start looking
and yea checking health for changes every tick is not necessary at all
so good on you for having the foresight to inquire for better solutions
@cedar finch
.
Anyhoo, I have a problem of my own to fix. I am trying to make characters walk on a physics object, and I am having some rubberbanding issues for the player who is doing it, from another observer's POV no issues are noticable.
I suspect there's some oddity going on with the clientside prediction fighting incoming replication updates, but as far as I know this shouldnt be an issue right?
normal movement on static surfaces doesn't rubberband like this, so what's technically different with this?
@cedar finch with that disposition, i would advise you to start looking into c++
while you might make a functional game with BP only, its just not the same
unless you collapse the widget it will update itself, with its own tick
note that using GetOwningPlayerPawn might result in a lot of casting
i say might, because if your first Pawn is destroyed, then you can make a variable of your specific Pawn/Character type
and make a function to Get it
that checks if the variable is valid, if it is, returns it and if its not casts it to your specific Pawn class, stores it into a variable and then returns it
the only downside of that approach is that it can't be BP Pure
@winter plover if that material affects movement in any way, you're in for some fun times
because iirc CMC does not handle that out of the box
Im not sure, it's just something I pulled from the engine content
it's the same with the tables you can see in the background
I just wanted something better for the clip to show
I am aware of the general issues
but this right here doesnt seem to be much of a bandwidth issue
since the 3rd observer sees it just as it should be
but 3rd observer doesn't have a simluation at war with the server
so something about how the movement is processed is different
on server and on owning client
and its outside the tolerance margins
which i imagine is not news
yea I figured so much
although shouldnt client side prediction take care of this?
evidently it seems to be somehow possible to walk on a phys object
provided it has exact same state for the object you're walking on, it should
right
so when exactly does a server revert a client's position?
when it's local position is further away than some tolerance right?
client sends input, server and client both apply it
client remembers its steps
when server sends an update, client takes it and applies steps it took since the time that update was sent
if the positions are close enough, it won't get coerced
client also sends its position to the server somewhere in there (not sure where exactly) and if the server decides its close enough, it will accept the clients position
so could it be that because of some very minor discrepancies in the phys obj's state, the character gets knocked slightly out of tolerance?
or launched into orbit, physics is funny that way
well thats not the case in my current version of things
altho what you are experiencing doesn't look like "slightly out of tolerance"
@winged badger Thanks I think I will start using C++. Blueprint is getting annoying. I was a big part of the Call of Duty Custom Zombies community so it should be kinda similiar. Call of Duty had some kind of C++ "ish" type of language.
but in some cases, even a floating point error can result in a bounce that is 90 degrees off
it might be worth noting
sometimes no rubberbanding will occur for long periods of moving
it's most noticable when starting or stoping to move
dunno if thats relevant
ok, so your acceleration is fucked, probably
mhmm
i personally hate doing network in BP
the idea of RepNotify firing on server, and worse yet - even on clients if they set the variable themselves locally
drives me insane
to be honest, that could be helpful behavior sometimes
sometimes I wish it was that way in C++
when changing a variable requires a bunch of extra work
it might be slightly convenient
but not being able to separate client and server side logic cleanly annoys me far more
doesnt BP have nodes for that?
but yea I generally avoid BP for anything that isnt just light scripts or setting up specific manifestations of c++ classes
I find it generally more efficient than node spaghetti
yea p much as it should be
has there ever been a huge "pure" blueprint game?
I cant imagine that stuff being very maintainable as a codebase grows
victor was pasting something about Contahion VR
besides just missing some powerful stuff
not sure how huge it is though
or ways to handle simple stuff, like structs, in a way that is not insane
what does bp do with them that makes them not sane?
you can't use functions, you need a side of a house worth of space if you want to do anything by ref
you can't set individual members, just the whole struct
plus the other stuff, like no delegates, no specialized types
I think they have delegates
thats what the red square thingies are for
dont work as nicely tho iirc
in BP, they are just variable containers
Could anyone help me with door replication. Doesn't seem to be working https://media.giphy.com/media/ybShfGNAnTaSXzzyOT/giphy.gif
make a variable for a DoorState, or bool bOpen
RepNotify it
and open the door inside OnRep function for it that is autocreated
so instead of wiring all that to E
make a custom event
that has all the logic afterwards wired to it, with boolean input (cleaner that way)
be mindful of collision with doors by the way
and object sitting still infront of it might glitch thru
happened to me a bunch already
make IsClosed replicated with notify
havent really found a great solution yet :/
and from its OnRep_IsClosed
like so?
call that event
yeah, just push the IsClosed as a parameter on it
instead of plugging it directly into the branch
is that really necessary though?
I like to just use events as a "hey something happened" kinda thing
it is cleaner, i think
and let the func figure out the rest
also
sorry bit nooby at this
your client can't open the door
input actions are local only
so they need to be sent via the Servevr RPC
and you can't do that inside the door BP, as your PlayerController is not the door's ultimate owner
so you need to put the input event inside your PlayerController or Pawn
then call a ServerRPC (custom event, runs on server)
and from the ServerRPC you reference the door and open it
you want to already have a server RPC somewhere in your "Use" function
to tell the server that you wanna use a thing
before you invoke anything on the door
because your client is only allowed to invoke RPCs from actors that they own
There are other issues, like Overlaps are running both client and server side ๐
so whatever you connected to it will execute on both
separately
it's more of a thing about how you design your code
there are certain limitations you have to account for
yea, just saying, there isn't exactly an easy tutorial for this
it has to be learnt over time
nor is it important one watches for collisions when trying to wrap one's head around networking ๐
eek i cant do this ๐ฆ
not spending a year on a door lmao
well, good news is - there is only 3 weeks left
which is how long it will take you to get a basic grasp of networking from what i estimate is your current skill level
mhm @winged badger there's another oddity that I can replicate better
that one root motion slide actually has no rubberbanding whatsoever
walking straight forward still rubberbands from time to time
so I dont think it's just the acceleration
I looked up a bunch in the code
and it seems like there are whole other replication routines for "based" movement
ie. when standing on anything
ill try and see if I can find anything there
I imagine that the phys obj itself minorly moving is triggering some updates
How hard is setting up multiplayer for a battle royal?
how much networking experience do you have
0 but I have a friend that is very well versed in it
well with zero I wouldnt shoot for BR yet
BR is probably best if you are 100% at networking
doing BR requires you to be able to absolutely optimize the hell out of your netcode
it's not something you can just tackle as a beginner
actual studios have had trouble with it, because it aint trivial
and i was planning on using this for servers https://aws.amazon.com/gamelift/
or as one person, unless you have a few years full-time to waste
i said i have someone that is very well versed in networking :/
even then it's a gargantuan task
so that someone is the one person in that scenario
gotta start somewhere
doesn't change it will take years
yea but why not start at something that isn't going to utterly frustrate you right away
something to learn the ropes
something managable, in the single digits perhaps
there's still plenty that can go bad there
Maybe other 'players' are just npc enemies or?
the specifics I'll leave up to you
but wanting to make a BR game as a first project is just as silly as trying to tackle an MMO alone
it's not going to end up satisfyingly
yeah but if someone just gave up because of that then we wouldnt have anything
it only took two people to create an airplane lol
im not saying give up, but adjust your goals to be realistic
and those two people had lots of experience
they didn't just make over the weekend
and that's where you should start
run a bike shop first
before trying to build the plane
im saying they had zero experience with making airplanes cause airplanes didnt exist.
they had experience in engineering and physics
which is what made that possible
you have no related knowledge to make a BR game happen currently
Im not saying it'll happen over night but slowly sure
Make it so a few people can connect at a time and work from there
like 2 then 3, etc etc etc
perhaps one day, but if you set your goals to high you will just be disappointed and lose motivation
trust me, you aint the first
I know im not but i can work towards the BR part of the game
Like i said I have the base down for it.
I'll leave you to figure this lesson on your own then
Hi guys.
I new from here
i'm using C++ on a project with online subsystem and I need to do something like this.
any tips?
@fluid axle quick question. What is it you want to get out of a BR, what would make yours stand out to the current BRs? If I'm honest you are gunna have to be either very good at it or make it unique which is near impossible as most has been done.
@forest bolt Simple good search of "Display Ping and Packet Loss" https://answers.unrealengine.com/questions/828796/how-to-display-network-information-to-the-user.html
Thanks @humble zealot !
@humble zealot You'll basically be flying through the air and using spells to fight enemies. You'll be able to combine spells to make them more powerfull.
Hey,
Does anyone have experience in smoothly updating a characterยดs location to leap from one location to another ( without using Launch Character / Impulse ) on a dedicated server.
The goal is to make a leap jump with dynamic jump lenght.
Just updating location on server gives a choppy / laggy result and itยดs the same if I do it on both client and server.
For testing purposes I am doing this on tick - so the update frequence should not be an issue.
Also tried the same approach with a timer set to loop on 0.01s.
as long the destination is in sync
you can temporarily disable the CMC's server updates
i do not remember where exactly, but its usually a go to solution with really high speeds
I will look into that, thanks
@winged badger Seems like turning of Replicate Movement temporarily does the trick judged by quick tests. Thanks.
@winged badger I think I've got the door BP how it should look but I have no clue how to tell the server to open it in the player controller
Also if I want to use lockable doors for the owner of the building how would that work
Owner of the Building should maybe not be handled with the Ownership system of UE4
For that I would really just make a parent class for your building elements that has an additional Owner Variable made by you, as well as an Array of playerControllers that defines who's allowed to open the door.
And to tell the Server to open the door is realtively easy
In your PlayerController or Character, where you do the E press
Or whatever button press
You perform a ServerRPC
I don't know how to do it
And in the ServerRPC you perform the LineTrace to the door
and tell it to open that
Welp I just told you how
the "How to create a ServerRPC" is nothing I will repeat here, as you have my Compendium and a lot of other resources to learn that
I'll have a look on Google again
is it possible to put a blueprint inside of a blueprint?
I'm going to allow the user to build the shack, then build the door then snaps the door onto the shack, that way i can control it better
Hi, does anyone know how to deal with the client spawn delay? My issue is explained better here:
BeginPlay should fire after the actor has been fully initialized
can you post your snippet?
yea should be on the character's beginplay
@broken heart
The character's begin play triggers before it fully spawns as well
shouldn't be
No it doesn't
That's just the ms delay between the replication causing the client version to spawn
You can already spawn the loadout on the server though
GameMode BeginPlay is 100% wrong
You are testing in the Editor and you already try to fight the delay
What do you think happens if someone joins a minute after the Server?
BeginPlay is long gone
Ok, thanks guys
Just tried spawning in begin play of character and it worked
But the camera takes a bit longer to adjust, should be fine though
that might be because you are spawning straight into the character
if you had a "prepare" screen of some sort
with some sort of external camera looking at the level or whatnot
it's gonna be less noticable
@humble zealot did you get a chance to see my answer to your question
This might be my dumbest question yet. When you connect to listen or dedicated server. Are you still able to use gameinstance to hold variable or is this destroyed in that transition? Ie your in main menu and your using it to jump to a host. But can you store something there for the return?
Gameinstance is per executable
Gets created at Launch, Destroyed on Exit
only accesible from Local, not available to other clients
I've been getting a replication error where clients possess the server's pawn when a dedicated server is not run, but when a dedicated server is run my game works fine.
Here's a video of the problem: https://www.dropbox.com/s/ulz2th1v4299xm6/Dedicated Server vs Undedicated.mp4?dl=0
Ok so technically I can have a variable say enum current mainmenu and join a server and when returned to main menu call the same umg then without needing to reload a save as the variable should stick till they exit the game
Mainmenu.level.bp begin play switch on enum to move camera etc getting it from gameinstance
@broken heart You are most likely using GetPlayerController0
what should I use instead?
The controller who should posses it
Possession happens on the server. GetPC0 refers to the Server at that point
It depends on where you call it
Usually you want to pass the controller of the player who wants the pawn along
@hasty adder Technically, yes.
Although Widget Objects might be cleared
So i would keep it at non spawned or created objects
Plain objects might work though
When I set "Auto Possess Player" to Player 0, the server can no longer move or look around, but the other clients now have their own controllable characters
And in standalone mode the first player cannot move either
Make sure they don't have or need a reference to something that is in the world and might be destroyed on transition
Well thatโs what I mean I can call various begin play at mainmenu world and with menu pawn just seeing if itโs valid idea to use game instance to hold the state of where they were before going to another world
Only world stuff is just where the camera should be for a given menu
@broken heart Auto Possess is for splitscteen
So it should be set to disabled?
Your best bet is to either use the DefaultPawnClass in the Gamemode
Or to use something like "InitNewPlayer"
There are some useful functions you can override in the gamemode
I already use my pawn class as the default in the game mode
but when I don't use a dedicated server the pawns doesn;t spawn for my clients
But lots of info about some actors is better located in a savegame of sorts.
Right on, sorry if Iโm not explaining well, 007 at work with chat. I just need a enum saved on game instance to have a saved state to work with that gets set before going to another world and used when returning
Hi guys
anyone knows why i goting a Not replicated component in my UActorComponent, Im setReplicated and put on DOREPLIFEREP
but the error just persist only on steam subsystem
subsystem has nothing to do with engines replication
Quick question - When I do a console command "Open 127.0.0.1" On my dedicated server
I join, as I can see the "Join succeed" log. But I don't spawn as a character?
Is this intended behaviour? Am I supposed to spawn my character somewhere?
Did you place PlayerStart on your map?
yup; 2 even
set up default pawn in your game mode?
yup
I spawn with my custom HUD displayed - so my gamemode is definetely functioning
but no character
hmm
I basically fly around as if I was in the editor doing stuff. just free flight
do you get any logs? if character spawn is attempted, but failed, there should be a log
c++ or bp only?
both kinda
character is c++ but made into a blueprint
and it's the blueprint I set as my default pawn
(the intention was to be able to change meshes dynamically in the editor without having to rebuild)
One common problem i have, is that somewhere in the c++ code, i forget to call parent function when overriding
i'd check BeginPlay on gamemode, gamestate, player
hmm
when u run the game from editor, without dedicated server, just offline, are you using a character placed in the level, with auto possess, or is it placing your character on the playerstart?
placing it on the playerstart
then crap, im out of ideas, sorry :/
and my dedicated server is loaded onto a map called "Main"
My player however starts the game in the "MainMenu"
If I were to be in the editor and in the Main map and I press play; it spawns my character with no problem. But when going from the main menu into -> Join server at IP XX.XX.XX.XX; Then I don't spawn as a character
damn :/ thanks for the attempt anyway.
Hi, is there any way to launch a packed game built with unreal engine headless without build the source code? i don't want it to be optimized, just want to run a dedicated server asap
any kind of flag that i can pass at cmd
dedicted servers only work with source build
anyone run into an issue in a networked game in a char movement component where each component of the Velocity gets truncated to an integer?
ReplicatedMovement.VelocityQuantizationLevel ๐ค
is it normal for the GameState to reinitiliaze itself aftera World->ServerTravel()?
@prime axle since you make a server travel UWorld is recreated
so Game State, Game mode, etc.. are recreated too
you can use UGameInstance to copy data
What would be the way for me to go about doing the following then (in regard to GameMode/GameState/PlayerState/etc...)
I built a dedicated server and got it up and running
I want players to connect to it, and when they do, they find themselves in a lobby map (I currently have this lobby map set as the server default)
And after X amount of time is passed the entire lobby is moved to the MainMap where they actually begin their deathmatch.
Currently I just have a RemainingTime varibale in my GameState and a Timer in my GameMode that if it reaches 0 it simply does a Servertravel(). I also then do GameState->m_RemainingTime = 500;
But obviously that value doesn't stay; it re intiliazes to the constructor value I set in gameState.
Hopefully this makes some sense....
Have a GameMode for the Lobby
and one for the actual game
setup your default values for each properly
There shouldn't be any problems for what you are trying to do
Hey guys!
What is a good way to check if a pawn is controlled
But I have to check it on the client
IsLocallyControlled() if you want to knnow if its controller is local
IsPlayerControlled() works if you want to know just if its controlled by any player
that one works by checking if the Pawn has its own PlayerState, and that PlayerState is not a bot
bool APawn::IsLocallyControlled() const
{
return ( Controller && Controller->IsLocalController() );
}
bool APawn::IsPlayerControlled() const
{
return PlayerState && !PlayerState->bIsABot;
}
don't know off the top of my head
search for references to PlayerState in AController/AAIController, shouldn't be difficult to find
Would a MainMenu and Class Selection stuff be it's own GameMode (talking about Multiplayer game)? I have an issue that my default pawn spawns even though I don't need it at all. So tryna see what the best fix could be
You dont have to define a DefaultPawn on the GameMode, you can leave it as None if you intend to Spawn the Pawns yourself manually.
I have my GameMode set to None in the world details in my MainMenu map, but it still spawns my character,
My guess is that it used the default pawn defined in the Project Settings?
I checked and I can't set Default GameMode in my Project Settings to None... so should I create a new GameMode with just None everywhere? ๐ค
The GameMode in your World Settings GameMode Override for that level will always be used.
The settings inside the WorldSettings will always be used.
The DefaultGameMode is only used if none has been defined in the WorldSettings
But what if I want None to spawn though within a certain map?
Do I need to create a custom GameMode filled with None?
Cause right now my MainMenu Map GameMode override is set to none
so it tries to spawn the default from my Project Settings
Can i see your WorldSettings?
So i can be certain we are talking about the same thing
Ah ok, yes you will need to make a custom game mode
Yep, make a GameMode for your MainMenu and then set it on the WorldSettings
You will then be able to set the Default Classes there directly
For that GameMode
And then I select None for DefaultPawn ye?
Yep
Quickly another question.
I select a class I want to play as in this MainMenu and when I press Join I want to spawn with said class. But since I'm using a custom GameMode with like None Everywhere, how would I replicate my choices best between moving between GameModes? ๐ค
You have a few options.
Im assuming your meaning when you travel to the Gameplay level from the MainMenu how do you recover the choice players selected? Correct?
Exactly