#multiplayer
1 messages Β· Page 354 of 1
so first option is place them into the scene and set auto possess by player?
what happens when there is a player start already in the scene
and I select 2 players..
It will use that for every player and try to spawn them there
And it might be that the second one fails
idk how the spawn settings for defualt pawns are
There is usually a spawn setting for "What happens if I'm blocked by something?"
You can also set the default class to NONE and get the "OnPostLogin" event
That calls for each player and gives you their playercontroller
There you can call "SpawnActor"
where you spawn your pawn/character
okay,,
and possess it with the passed controller
BeginPlay is not suited for this
It calls only once and probably by that time only for the server
oh,..okay
Well
Of course only once for the server, it's Server only class
Check OnPostLogin
Not exactly
"GetPawn" is a local thing
It would get the pawn of the server
(Makes even less sense if you use dedicated servers)
Such code always needs to be relative to a player
Ah wait a second
You are in the PlayerController
I thought you are still in the GameMode
yup
EEEEEhm lemme see
- You need to limit this to the Server. Only he is allowed to spawn and possess!
- Use Possess on that spawned Pawn
- No need for a deffered spawning here
So the commented version is the one that should work
oh..okay
given you limit it to the server
oh.. okay
thanks for the help man!π
I will look up the rest of the stuff you told me to..
also, I checked out the third person template.. I see that when we add more players there, it spawns at different locations. How do they do that?
I haven't looked into that template for the past 2 years or so :D
So someone ever worked with advanced session plugin for steam online subsystem. On packaging i get an onknown error, trying to build the enginge source works but trying to rebuild by project in VS i get a lot of errors, do i need to implement the plugin into the VS project somehow?
Did you add the plugin to the Build.cs?
no, so far only build the unreal engine source and my project after adding the plugin i couldnt get my project to build anymore, where would i need to do that? And what would that do? I mean when i build my project it is building the advanced session isn't it cause that screen is from the output of the build process
the plugin folder doenst even show in VS is that a problem?
Kinda
Did you regenerate project files after adding the plugin?
Otherwise it won't register the source files for it
So you technically never build it
yea im kind of understanding it now, i regenerated the Engine files now and the plugin showed up, will rebuild everything now and see if it works now, thanks needed that little thinking notch π
someone already try to replicate an instanced static mesh component ?
But do i need to add any code to the build.cs of my prject itself?
Might be needed for later packaging
And if you use c++ code of that plugin in your own code
i do not for now, but if its needed it would go in there "PublicDependencyModuleNames.AddRange(new string[] { "Core", "CoreUObject", "Engine", "InputCore"});" right?
anybody knows why steam subsystem would not return any sessions after upgrade to 4.18?
it returns with search success, yet empty
using the spacewars app ID, subsystem starts and hosts the server successfully
Maybe just too crowded?
Too many results that got thrown away cause from other games?
unsure about it, put query maximum results to insane values, still no results
@thin stratus i get the same comiler errors now when i build the engine x.x even though the plugin now showed up in the solution
it seems for some reason the plugin wont even let it self build
The errors you posted were from packagin though
on building the engine
well just realised that the german error texts arent really helping arent they? xD
Yeah it makes no sense to build your plugin with the engine
It's totally enough to build it via a project
You can always move the sucessfully build plugin to engine level
And then no need to rebuild
nah it throws the same errors everywhere, put the plugin now under the project folder and regenerated the project files, the plugin showed ub in VS under the project itself but it wont build giving all the same errors everytime x.x
it seems to me like the plugins just broken but that doesnt sound right...
i mean it even shows up in the error list liklle some syntax error -.-
Don't use the output log
Ehj
Don't use the errorlist
use the output log
What ever they are called >.>
it can't be version mismatch can it? I mean 4.18 and 4.18.1
Na
Can you show the code it brings you to
if you double click the first error
@shy nymph
Sure gimme a sec
dude.... im literally flipping my table right now... it just worked... i did NOTHING else then re created the plugins folder added the plugin recreated the project files and rebuild the project in VS... like the same shit i have done since early in the morning today... i have absolutly no freaking idea what happened...
Unreal voodoo
does anyone have any information on how to use net dormancy? i can't seem to find any documentation on how its supposed to be used
@thin stratus well thanks anyhow mate really appreciated your help
when the value changes
Hey guys, i know. IDK with another problem :D. well it stems off of my last issue and im pretty sure i know why its not working, was just wondering if any1 knew a quick way i could do it. so my scroll bar for chat works on clients, but not on the host, which im assuming is because some sort of layering issue due to how things are spawned in, i was just wondering if any1 knew a quick way to bring the chat window to the front? π
@cerulean rapids what do you have blocking it
the only thing it could really be is kind of itself
the chat is embedded in the lobby UI
and it spawns chat text widgets inside of it
Hello guys, I just started doing multiplayer (For my uni project) and I wanted to replicated the animation of the characters over the network. It works for the server but no for the client.
// .h File
public:
UPROPERTY(VisibleAnywhere, BlueprintReadOnly, Replicated, Category = Movement)
float MovingLeftRight;
UPROPERTY(VisibleAnywhere, BlueprintReadOnly, Replicated, Category = Movement)
float MovingForwBack;
UPROPERTY(VisibleAnywhere, Replicated, Category = Movement)
bool isRunning;
UPROPERTY(VisibleAnywhere, Replicated, Category = Movement)
bool isJogging;
protected:
/** Marks the properties we wish to replicate */
virtual void GetLifetimeReplicatedProps(TArray<FLifetimeProperty>& OutLifetimeProps) const override;
// .cpp file
//This is just one method to show you how I update the value
void ARPGProjectCharacter::MoveRight(float Value)
{
if (Value != 0.0f)
{
// add movement in that direction
AddMovementInput(GetActorRightVector(), Value);
}
MovingLeftRight = Value;
}
void ARPGProjectCharacter::GetLifetimeReplicatedProps(TArray<FLifetimeProperty>& OutLifetimeProps) const
{
Super::GetLifetimeReplicatedProps(OutLifetimeProps);
//Tell the engine to call the OnRep_Health and OnRep_BombCount each time
//a variable changes
DOREPLIFETIME(ARPGProjectCharacter, MovingForwBack);
DOREPLIFETIME(ARPGProjectCharacter, MovingLeftRight);
DOREPLIFETIME(ARPGProjectCharacter, isJogging);
DOREPLIFETIME(ARPGProjectCharacter, isRunning);
}
Any ideas why that is?
in SP and on the server the animations work fine and the clients can see the servers animation but the values don't updated on the client.
For example in MoveRight I have -> MovingLeftRight = Value;
That is a value that is being replicated
Also I am using the First Person Template so I think the character is being replicated.
Oh ok
Is that by using UFUNCTION(Client) -> called on the server, but executed on the client,
I think its the other one, called on the client but executed on the server
Also by this "And only if you are on a client" you mean check for ROLE_Authority?
Yop
So would it be like this?
// .h File
protected:
UFUNCTION(Server, Reliable, WithValidation)
void Walk(float value);
void Walk_Implementation(float value);
bool Walk_Validate(float value);
// .cpp file
void ARPGProjectCharacter::Walking(float Value)
{
if (Value != 0.0f)
{
// add movement in that direction
if (isJogging == false && isRunning == false)
{
if(Role == ROLE_Authority)
Walk(Value);
if (charMovement != nullptr)
charMovement->MaxWalkSpeed = 120;
MovementState = EMovementState::MV_WALK;
}
AddMovementInput(GetActorForwardVector(), Value);
}
else
{
if (Role == ROLE_Authority)
Walk(0);
}
}
void ARPGProjectCharacter::Walk_Implementation(float value)
{
MovingForwBack = value;
}
bool ARPGProjectCharacter::Walk_Validate(float value)
{
return true;
}
anyone run into issue with OnRep with dedicated server setup? It looks like for some reason they dont work when I enable dedicated server, but works fine if I'm playing from listen server...
and yes, I'm checking it from client view π
Is this still valid? https://wiki.unrealengine.com/Networking/Replication
Cause is says there I don't need to declare the _Implementation and _Validate methods yet in my project I get an error.
I am using 4.18.1
Let me check again
Says that <ProjectName> has no member of "Walk_Validate"
same for _Implementation
what s the difference between bOnlyRelevantToOwner (in actor) and COND_OwnerOnly (in GetLifetimeReplicatedProps) ?
Relevancy depend of the distance between an actor and the player (owner) but you can set it to only relevant for some case, COND_OwnerOnly mean if the actor is relevant to you and you are the owner replicate this property to you @elder sable
isn t bOnlyRelevantToOwner the same ?
no
Relevancy depend of your distance view with this actor in the world
COND_OwnerOnly will be true if you are relevant to this actor and you are the owner
@hidden thorn could you show your header, your attempted implementation, and the errors thrown? The implementations must have the exact signature needed; you don't have any wiggle room
AFAIK, that information is still valid.
if you set bOnlyRelevantToOwner to true and you have a property with COND_OwnerOnly, even if you are really far of this actor the property will be replicated
@elder sable
@brittle sinew I managed to get it to work, but VS still kept saying it's an error
ah ok thx @rare cloud
i don't understand ReplicatedUsing. when is called the function abd by who ?
the engine do it for you using the UHT (Unreal Header Tool) generate some magic code on generted.h and link the passed function to the network stuff
I don't know exactly how it work, simply the general idea
in examples, they call the function
so i dont understand what s the point using it
oh ok
if you change weapon for example, you have a WeaponID
you declare your RepNotify
and it's fired when the player change weapon you can spawn fx or whatever
it's called client side ?
yup
it can be call server side if you call it explicitely
also IIRC you can add a parameter to your RepNotify function to get the previous value
if you need to make some check or diff
and if not, it's called client side when the value change ?
yeah and only if the value is different than the previous
you can declare a COND_REPNOTIFY
ahhh ok, maybe that s why i didn t see anything
or something like this to force to always be call
DOREPLIFETIME_CONDITION_NOTIFY(UMyObject, MyObject, COND_None, REPNOTIFY_Always);
inside the GetLifetimeReplicatedProps
mhh my function is called server side only
I tried this
void server_connected()
{
if (!IsRunningDedicatedServer()) return;
connected = true;
on_connect();
}
UFUNCTION()
void on_connect()
{
UE_LOG(LogTemp, Warning, TEXT("on_connect "));
}
UPROPERTY(ReplicatedUsing = on_connect)
bool connected = false;
ah it works
thanks π
np
im changing the static mesh of an actor in a server rpc, and the actor is replicated, but the clients do not see the new static mesh
Yo, I'm using blueprints to start a server with "open mapname?listen"
it works in the editor but does nothing in the packaged game. what am I doing wrong?
do I have to, like, include the level in the package, somehow?
yes
make sure the map is in the package
there is an option for additional items to include in the project settings
just search for "packaging"
will do, thanks!
no problem
argh... this still isn't replicating
ok so is there a way to make sure that something is replicating
because I have a Static Mesh the refuses to replicate and it makes me question if evn the parent is replicating
Is the actor set to replicate @tacit hazel
how can i use open level so all players in session open that map and still remain in session
when i try open level normally from authority client quits session
and when i try multicasting it same
@twin juniper Is your GameMode set to Seamless Travel?
Call UWorld->ServerTravel() ?
Yo, quick question
Let's say I wish to implement teams for my multiplayer game.
Should I implement that in the Controller for each player?
I know I shouldn't code teams in the pawns because they can get destroyed and I can't use the gamemode either because that only exists in the server
Hey, uh, I'm running into some replication problems with this actor I need accurately on both sides. BUttery smooth on the host, really jittery movement on the client. Any ways of getting around that?
You changing MovementSpeed and didn't do that on everyone?
Cause that doesn't replicate
@cursive oasis I have Teams in 3 places
PlayerController, as the main, persistent class, that the Server can push the team on and use for spawning etc.
PlayerCharacter, for several graphic things, like team color, text, maybe even gameplay related things, like hitting and enemy or overlapping something
PlayerState, for other clients to see and display the player information relative to the team, scoreboard for example
That makes sense.
PlayerController and PlayerState are set when the Player joins.
Only on the Server and set to Replicate
PlayerState could have RepNotify depending on your use
PlayerCharacter gets it in the "Possessed" event
It is server only, gets called when the PlayerController possess the character and passes teh controller
Easy way to grab the team FROM the controller and set it on the Character
Was the movementspeed thing at me?
Well, I'm not using a character or anything like that, so no
Physics?
So, if I wish to make a widget to pick the teams, i take it should go in the playercontroller in order to assign the PlayerController's team and pass it along to other classes, right?
Basically, yes
Widget -> ServerRPC on PlayerController -> SetTeam (-> SetTeam on PlayerState too)
My own pathfinding stuff. The main thing is that I'm just crap at networking. I need the host to have complete authority, and for the meshes to just be visible on the client
That's really about it
Hm, is replicate movement ticked then? Or what exactly are you modifying there?
Are you just setting location ?
I'm just setting location every frame
Is the Actor set to replicate movement then?
It sounds like the Client is fighting the movement replication
You also might want to, instead of Setting movement, maybe replicating a Location Vector
And letting the Cient Interp from old to new location
Makes it smoother
Well, I'm pretty sure that I'm just missing Replication 101
Hard to tell atm
What I'm currently doing is having the actor be spawned on the client, and just not running any logic
(Before all the logic I threw in an "if server" thing)
BTW, what's the difference between PlayerController and PlayerState? aren't they the same thing?
an invisible abstraction of the player itself, disconnected from the pawn that it is currently possessing?
oh my god my internet is dying on me.
@Mr4Goosey#8437 Spawning the actor on the client?
Replicated Actors should be spawned on the Server
Right, no, I'm being an idiot
Poor wording, not used to this
I'm spawning it on the host, and then I'm replicating it
But since I don't know crap about replication, I don't know what that specifically means, which probably means it's doing lots of things I don't know about
@cursive oasis No, PlayerController is the actual "Player" if you want to say so.
A PlayerController is only known to the Local Client and the Server.
A local client CAN'T access other players PlayerControllers (Only the server has all of them).
Furthermore, the PlayerController is used to control the Pawns and process Input @cursive oasis
Ah, I think I get it now
The PlayerState is just what its name says, the state of the player
It's replicated to all users and can be retrieved from the PlayerArray in the GameState (For everyone)
things that other players might want to see
It's like the client thing is conflicting with the host, but I don't get what the client would be doing to cause conflicts
Or from PlayerCharacter (if Possessed), PlayerController on Local Player and Server @cursive oasis
Now it makes sense!
@Mr4Goosey#8437 OwnerRelevancy, why?
Thanks for the explanation, Cedric. It has helped me understand how UE handles things.
@cursive oasis Might want to read my compendium
Cause I'm basically repeating what I already wrote down
oh, really?
Isn't it lovely to help noobs~
Shit, i'd love to have a manual about this stuff!
That's what I do for the past 3 years. ANd it's beginners, not noobs
Noobs are the guys failing in CS for the past 12 years
Check the channels pinned messages
Guess you're already a step ahead if you're failing out of CS?
Yeah, divine noob upgrade
I'll go read that as well, when I have time
omg a 100 page pdf about multiplayer.
It doesn't tackle that kind of issue though @Mr4Goosey#8437 but maybe it's something fundamental
ohhhh shit this is like a god damn multiplayer bible. i love you already.
What I've got at this point is an actor that jumps around every .1 seconds or so, instead of smoothly moving
i just wish my crappy internet connection would let me download this.
:P another believer born
Which is, I think, different from what I had before
What does the owner relevancy stuff actually do?
It basically lets the owner decide if the actor is relevant or not
Yeah, so it seems like the client isn't conflicting anymore, it's just being really slow
So then that interpolation you talked about would probably be useful, but, ya know... π
Don't know where to start with that
bool AActor::IsNetRelevantFor(const AActor* RealViewer, const AActor* ViewTarget, const FVector& SrcLocation) const
{
if (bAlwaysRelevant || IsOwnedBy(ViewTarget) || IsOwnedBy(RealViewer) || this == ViewTarget || ViewTarget == Instigator)
{
return true;
}
else if ( bNetUseOwnerRelevancy && Owner)
{
return Owner->IsNetRelevantFor(RealViewer, ViewTarget, SrcLocation);
}
else if ( bOnlyRelevantToOwner )
{
return false;
}
else if ( RootComponent && RootComponent->GetAttachParent() && RootComponent->GetAttachParent()->GetOwner() && (Cast<USkeletalMeshComponent>(RootComponent->GetAttachParent()) || (RootComponent->GetAttachParent()->GetOwner() == Owner)) )
{
return RootComponent->GetAttachParent()->GetOwner()->IsNetRelevantFor(RealViewer, ViewTarget, SrcLocation);
}
else if( bHidden && (!RootComponent || !RootComponent->IsCollisionEnabled()) )
{
return false;
}
if (!RootComponent)
{
UE_LOG(LogNet, Warning, TEXT("Actor %s / %s has no root component in AActor::IsNetRelevantFor. (Make bAlwaysRelevant=true?)"), *GetClass()->GetName(), *GetName() );
return false;
}
return !GetDefault<AGameNetworkManager>()->bUseDistanceBasedRelevancy ||
IsWithinNetRelevancyDistance(SrcLocation);
}
NetRelevant means "Should this be replicated for the viewer?"
oh my god ue4 has built in client side prediction for the base character.
Is that possible in BP or is it one of those lovely CPP only things?
The stuff I posted?
Yeah
You can only override that in C++.
However I simply wanted to show you what the booleans do
Ah
else if ( bNetUseOwnerRelevancy && Owner)
{
return Owner->IsNetRelevantFor(RealViewer, ViewTarget, SrcLocation);
}
That's the one in questions
It lets the owner decide
Yup, I see
BTW Cedric, quick question: is it possible to make a simple multiplayer football game with blueprints alone or am I going to run into some kind of issue?
You can do a lot in BP alone
However there are things you will run into at some point that might need c++
I've done custom pathfinding in BP alone, so I'm pretty sure you can
I see
THings can be easier with C++ at times, and yeah, stuff like steam... π
But most, if not all, of the gameplay stuff can be done in BP
I guess I'll just make my game with BPs and worry about C++ later on when I actually need it
That's also my mindset with it x3
awesome.
Only thing I would advice you to is learning how to make structs in c++
Simply header file and putting your structs in there
Had too many projects break from corrupted BP structs
Certainly is if you have an RPG or so that has tons of them
Layered
ANd they break
ouch.
You have to recreate them all and swap them by hand
Not gonna touch BP structs anymore
;-;
It's way too easy to just havea simple header file with them
Even beginners can copy paste the wiki code
Anyway, I'm off. I'd really appreciate it if someone could explain how I can get the server data to be interpolated on the client β€
(Will read chatlog when I can)
later!
@thin stratus what you make one header that contains all your structs ?
Or you include each structure as needed in the individual classes?
yo, quick question
From the game state, I can get an array with all of the player states.
how do I, the server, know I'm getting the right player state for a specific playercontroller?
oh wait, PlayerController has a PlayerState node.
lol
@worn nymph structs that are used in all classes are in a special header. And for simple blueprint exposure it's also enough to put them into a header
so far, so good! PlayerController and PlayerState both have the team set accordingly, replicated too
now, do I spawn the pawn in the GameMode or in the PlayerController (as the server)?
Usually gamemode
does it matter where I spawn it, as long as I do it as the server?
No
Aight. I'll do it on the gamemode because it makes more sense
But game mode has OnPostLogin
OnPostLogin? But my game doesn't use any sort of... login
it does? :0
It's ue4 native
oooh.
Not with password etc
I see.
More like a network login
Can also call it OnPostJoin if you want
In cpp you can use prelogin and login to deny the player
Yeah, but I need my players to pick their teams first through my widget
For xy reasons
so I can't spawn the pawns there
Fair enough
But that may come in handy
Then just a simple event that spawns depend ing on team
And widget - > server rpc on playercontroller and then getting gamemode and respawning
yep!
(it's basically respawning)
wait, respawning?
i mean
oh wait nvm i think i got it
Let's see
Okay, it works. Now I need to set spawnpoints for each team, how do I grab a reference to objects in my level through my gamemode?
am I supposed to make a separate blueprint responsible for the spawnpoints and get a static reference to that instead?
For example
Here it's totally fine to just use GetAllActors once
To gether your spawnpoints
And then looping over the array, filtering by team
hmmm, but isn't that bad?
Yes and no. You only do it once on begin play of the gamemode
Doesn't hurt that much
You could also have them get rhe gamemode on beginplay and add themselves to an array
(the spawnpoints beginplay)
I see. That will do the trick, but what if I want to grab a reference to my designated spawnpoints anyway, without having to iterate through all actors currently in the level?
is there an easier way that doesn't involve creating a separate blueprint for that?
i'm curious
Making sure you filter the beginplay with a switch
As said, spawnpoints themselves can register themselves on beginplay at the gamemode
That's one way
You need your own spawnpoint class anyway cause of teams
oooh, of course!
lmao sleep deprivation is messing my head up. I could just make simple actors for spawnpoints and have them inform the gamemode that they exist
thanks! that cleared things up
@thin stratus ah thought so and can you forward declare structs?
is there any shortcut to quickly open a blueprint class?
@worn nymph Nope you can't
That's the main reason why I put the structs that are used a lot in different classes in a simple header file
Isntead of putting them into a class head of some other class
Cause I don't want to include a class header into some other class header
@cursive oasis ?
Let's say I want to quickly open another blueprint
is there a shortcut to quickly search for another blueprint?
WEll the content browser has a searchbar
BTW, is the Possessed Event called on all machines or only on the server & owning client?
mmk. so if I want to change my pawn's color according to its playercontroller's team, i'm going to need to add a replicated var to the pawn (int TeamIndex) and feed that value from the server, right after spawning the pawn.
is that correct?
I was thinking about getting the value straight from the pawn's playerstate, without having to add another var
Variable in Pawn is better
You can't be sure if the Variable in teh PlayerState is already replicated
makes sense
- you can make the variable in the pawn OnRep
Which gives you a function that calls if the value is replicated
so that it calls a method whenever it rep-
(In BP that calls on Server too)
awesome. i think im getting the hang of this!
huh, I can't seem to drag my var's OnRep node to the blueprint graph.
says here that this function was not marked as blueprint callable.
oh lol.
I followed this guide: https://wiki.unrealengine.com/Dedicated_Server_Guide_(Windows_%26_Linux)#Section_2_setting_up_a_dedicated_server_on_windows
to set up a dedicated server. I did all of the steps. When i start the server in the packaged folder I receive a few errors that I do not know how to tackle. They hinder the server from successfully launching.
The errors in the above pic happen only once
The errors in the below pic "loop"
Did you package your project and put the server exe into the binaries folder?
Yes
Did you make sure that your Lobby Map is properly packaged?
How do I make sure of that?
I had no maps added to be packed for that build. I am atm making another build, with the used maps added
It also seems like you are traveling to the lobby map?
Even though you are already on that map
That shouldn't be there
The Server starts on the map you specify in the Maps and Nodes settings or via command line argument
I am sure I set the server to start on that map in the Maps and Nodes
Atm trying to verify
Yes, I have set the Lobby as server starting map
The Level BP beginPlay node is set to "Open Level" on my real internet IP. There is no map name set as "Level Name", it is my IP
What would the intended use of that function be by the tutorial guy? He simply said "put it there"
I have 0 idea
@indigo nacelle I wrote the guide
it would connect to the IP
The first error is a engine bug you need to go into settings and turn off event loading
I assume it's not for the lobby map but for the mainmenu
Ok I will turn it off to see if it works, building my project takes quite a long time though so I will not see results within the hour :/
Also you need to add your maps to the packaged maps array in the packaging settings
And finally the begin play open level was because in the setup I was using was for a lobby and traveling to a map.
So you start out in the lobby map then it loads and calls begin play to travel to the server map
Ah, I see.
So if I want to connect to the server, I use the "openLevel" function?
Like I could go:
Main Menu -> press join game -> Calls Open Level (myIP) -> and then I am connected to the server, and am on the servers map?
Yes if you use local ip it would be as if you were on a lan match if you use real ip it will be live over Internet but you will have to forward ports and most likely setup a static ip address or external networks won't be able to connect
Hmm... I am using the Steam subsystem though, is it compatible with this method? π
Nope did you not read he very first line of text on the disclaimer lol
Not for steam right at the top lol
Yeah
Steam with listen servers is OK. Steam with dedicated servers is hard work . Best scenario right now is to use u works plugin or advanced sessions plugin
I will check it out, but since I have come this far I might as well get one of these non-steam servers working ^^
Thank you immensely @worn nymph for writing your tutorial and this advice! It was very easy to read as you understand that good pictures tell more than words. Also thank you @thin stratus for the bullet-fast responses π
No worries . I wrote it months ago and had planned to expand on it more and tidy it up but I got sidetracked into other things lol.
If you need any more help feel free to pm me . If you can't get it working I can always upload a working version for you to play around with
I really appreciate it!
No ideas on smoothing out my actor movement? 3:
for some reason my static mesh does not change, so for my server it does change, bbut for my clients it does not https://hastebin.com/uqugezosuw.pas
what do i need to spawn an actor from server on all clients ? my actor has bReplicates = true; and i spawn it in game mode but can't see anything client side
That should be all
@tacit hazel Meshes aren't replicated
If you want them to change on all players, you have to RPC or RepNotify
so just with GetWorld()->SpawnActor<Astation>(FVector(100, 100, 100)); it should spawn on clients ?
I need to make a NetMulticast RPC? @thin stratus
Why wouldn't you just make a Blueprint of 'AItem' and spawn that instead?
@elder sable If the actor is replicated, then yeah, clients will spawn their local copy too
mhh
is it better to destroy a dormant actor or set a flag on it indicating that its destroyed
it seems like destroying the actor notifies all connected clients of the destruction even though it's not relevant to them
It notifies them as it gets removed on them too
I idd make a blueprint of it and spawn it
If you don't do it every frame, you can easily just destroy them
I just had to chagne the static mesh
otherwise do pooling ,yes
but I had to spawn a default Item because it just wasn't spawning at all when I tried to dynamically load the correct Item
I tried to just LoadObject and then spawn it for the correct Item, but now I have a subclass of AItem in my .h thats just a defuault Item and thne I setup its propertys like the static mesh
@stark dome
ok im gonna try to do what my original plan was and load in the blueprint of the Item that needs to spawn, but I cant even get it to compile
How would I go about getting the blueprint in code? I can staticLoad it, but I don't know what type it is, so how do I store it?
when we replicate an actor, data are sent on network just when server spawn it ?
Guys u know how to save The Data of a player on server ?
like health so i can leave and join with the same amount ?
You technically can't
At least not in the basic version of UE4
It would need you to either have a persistent, unique ID
Like SteamID
or a Database in the background
The other way would be betting on the "OnOverideWith" and "OnCopyProperties" or what ever the playerState functions are called
That are responsible for players reconnecting
However that's more for someone having a short disconnect
and if i have the steam id ?
does anyone know how fortnite deals with replicating destruction of a wall on a house
i assume that the wall is an actor with its dormancy set to DORM_Initial and an hp value that's replicated
i'm curious as to whether or not they actually destroy the actor when its hp reaches 0 or if they just destroy it on relevant clients
destroying the actor on the server seems to destroy it everywhere regardless of relevancy
@thin stratus i tried nearly Everything with the SteamID How would u do it ?
When the Player Disconnects, you get his SteamID his Health and save it in a TMap or Struct Array (depending on your engine version)
When he reconnects you check array or tmap for the steamID and set their health with that
And if the server goes offline like for a restart ?
you would need some sort of database to store that info in that case
can i create one in the project or do i need to create on something else?
That's outside UE4
Has technically nothing to do with UE4
There are probably tons of tutorials on how to do that
And probably free plugins to communicate with the database
okay thanks ill try that
if i create A struct for that can i just save the struct ?
in the database ?
yo, where's the best place to hook my HUD widget to?
the Pawn? the Player Controller?
better yet, is there a client-side callback in the player controller for when I possess a pawn?
something like "yo, here's your brand new pawn. go nuts."
In my Project my multiplayer works fine but if i package it in shipping the map won't load if i create a session..
what could it be ?
Is there any way, with BP, to have different spawn points for each player?
No 2 players should spawn at the same point, but other than that, the specific spawn point isn't too important.
@muted sigil maybe if you add a collision for that spawn point, and if anyone is overlapping it then set boolean "is taken" so other players would only use the free slots
on end overlap the spawn point becomes "free"
I see, I'll try that, thanks
@muted sigil just set a boolean on the spawn point if it's taken
And check that when spawning
@cursive oasis no, but a simple client rpc on possessed would do it
Any reason why the MovingForwBack is not set inside Jogging but it is inside Walking?
void ARPGProjectCharacter::Walking(float Value)
{
if (Value != 0.0f)
{
if (isJogging == false && isRunning == false)
Walk(Value);
}
else
Walk(0);
}
void ARPGProjectCharacter::Walk_Implementation(float Value)
{
MovingForwBack = Value;
}
bool ARPGProjectCharacter::Walk_Validate(float Value)
{
return true;
}
void ARPGProjectCharacter::Jogging()
{
if (MovingForwBack != -1)
{
Jog(!isJogging);
if (isJogging)
Walk(2);
else
Walk(1);
}
}
I added some DebugMessages and it seems like the value should change but it doesn't for some reason.
isJogging is set to true (I double checked) so the Walk inside Walking shouldn't be called.
Well the value doesn't change on the server or I think it does but it goes back to 1 in an instant
Could it be this
PlayerInputComponent->BindAction("Jogging", EInputEvent::IE_Pressed, this, &ARPGProjectCharacter::Jogging);
PlayerInputComponent->BindAction("Running", EInputEvent::IE_Pressed, this, &ARPGProjectCharacter::Running);
PlayerInputComponent->BindAction("Running", EInputEvent::IE_Released, this, &ARPGProjectCharacter::Running);
// Bind movement events
PlayerInputComponent->BindAxis("Walking", this, &ARPGProjectCharacter::Walking);
From what I know it is, not 100% sure
"Going along with the previous tip, don't replicate objects that don't need to be. Explosions, sounds, ragdolls, and particle effects don't need to be marked as replicated"
I understand, however replicating a ragdoll is somewhat important in my game. The pawn can be knocked down (ragdolled) and the player's movement component must move to the pawn's position
Well based on what they are saying is that you can replicate it but they suggest not to
Actually, I got a better idea
is there a way to "drag" my ragdoll by a bone?
can I do something like
pseudocode
Ragdoll.GrabBone(Pelvis).SetPosition(myNewPosition);
?
Maybe there's a way to setup a physics constraint with bones/sockets?
No prob.
@cursive oasis did this for a game last year that heavily revolved around ragdolls. As were using CMC, from memory, I basically swapped the root capsule for the mesh during a ragdoll and swapped it back after the ragdoll had finished (was a little bit more complicated then that, but thats the gist of it).
Benefit was it used CMC prediction and replays but we still had physics based ragdolls.
yep, did for us anyway
uhm help, one of my .cpp's wont open now
even when I ricght clcik open with vs2015, it opens in notepad as blank
idk what happened
hmm.. well I guess good thing I have a backup
When you start reading and the user removes his post
(β―Β°β‘Β°οΌβ―οΈ΅ β»ββ»
Oh sorry xD I just found that I might be able to find the solution myself
Apparently it is pretty much a must to use an external hosting service to get your public IP address
Your computer itself does not know anything about it. And since Epic does not have a hosting service, they do not have functions to get your IP
HTTP Request to some outside host to get the IP
Well you could technically host your own little script somewhere
if you are afraid the one you contact gets shutdown someday
I think I will try Ramas approach, it uses an outside host:
https://forums.unrealengine.com/showthread.php?3851-(39)-Rama-s-Extra-Blueprint-Nodes-for-You-as-a-Plugin-No-C-Required!&p=191189&viewfull=1#post191189
It is a http request
I am intrigued by your "little script somewhere" idΓ©a
What would that entail? Me hosting a website?
It's the same idea
HTTP Request to your Server
Just that you are not relying on some other host
And that Server replies with the IP
Had to spawn my player starts at run time, because child actor components cause all manner of horrible problems due to being buggy as feck
New problem: Actor begin play is happening on the client after the character is spawned
(β―Β°β‘Β°οΌβ―οΈ΅ β»ββ»
Fundamental problem with UE4's login logic, I think
actor replicated properties for actors that already exist in the game world should be replicated before the client is allowed to spawn their character
this is important, because replicated properties could be critically important with regard to the game state
but because the character / pawn is spawned before the world state has been replicated anything could happen
Anyone ever seen this error? Getting it in 4.18 everytime I try and test in editor with two players (in VR) single process.
Crashes EVERY time the possess runs. Works just fine in 4.17
Assertion failed: Component != nullptr [File:D:\Build++UE4+Release-4.18+Compile\Sync\Engine\Source\Runtime\HeadMountedDisplay\Private\LateUpdateManager.cpp] [Line: 75]
@past bear To be fair, you have full control over when and how you spawn the pawn of your Character
@dusty sleet That's just the generic report of an assert failed. We would need the call stack
if the game is in progress, the player is just spawned in immediately
gonna have to prod someone on the native side to possibly make changes to that - I don't have control over it
'cos the problem is that the spawn point is chosen during the login process - before the client has recieved the replicated events for the actual spawn points
@thin stratus this stuff? theres nothing else in the latest log that indicates a crash at all -> https://pastebin.com/9Ayu7sK1
It's trying to get a Component for LateUpdatePrimitives
Or you doing anything special with your VR components?
not really anything special yet. its a fresh BP project. was testing some stuff before deciding whether to switch to 4.18. i just made a basic character with two motion controllers and camera with the "hmd lock to" checked.
I am spawning an actor on server
It's breplicated is set to true
Still I cant see it in editor
Any idea why this thing happening?
Can be a lot of reasons
I once had it because someone was calling an RPC on Tick and marked it reliable
Which caused the Spawn event never to reach the client
When i join my session my secound player spawn in spectator or something like that how can i fix that ?
@thin stratus - do you know if the client or server is authorative with respect to spawning a pawn?
it seems to me like the client is responsible for spawning the pawn
Always the Server
Server has to spawn Replicated Actors and Possess is also a Server-only function
that's what I'd expect
How do i spawn a Actor in multiplayer? like all others can see it too ?
Hey guys, so i have a really strange bug going on. During game play when a player finishes we spawn an AI controller to possess the player's pawn and take over control, now, the host sets the pawn's role's correctly, everyone else see's the role change correctly except the local player who was controlling the pawn previously, their role seems to stay stuck on Role_Autonomous and as a result doesn't recieve updates correctly that are behind role checks.
The stranger thing is that I can't actually find in the engine where clients would even handle switching role & remote role around if they get changed during runtime since they're just replicated values from the host that don't have an OnRep function
anyone else had anything similar to this or have any suggestions on places to start looking?
the only places i can see where it calls ExchangeNetRoles for clients is on PostLoad
Sorry, PostSpawnInitialize
and this only happens in shipping builds too
@next falcon No, you just have to Spawn it. Setting owner is another story
but if i do that my client can't see it..
it has to be marked as replicated during its construction
@wise depot Hard to tell what the issue is
You simply call posses with the AI on the Pawn?
yes, but we override the Posses function on the controller as the default AI controller doesn't call OnPossessed on the pawn which is what sets its role
no i guess not.. do i need it?
before we did that no clients got told the role changed, once we implemented that they all get told the role changes, and this works just fine playing from the editor in standalone too, however as soon as we use a shipping build it never seems to update the role for the local client but works fine as intended for everybody else connected, the host lets the AI take over, everyone else sees the AI doing its job except for the player who was previously controlling that pawn
at this point i'm starting to think this may just be an issue with UE4.14, as its really odd that the ai controller itself doesn't call the functions to update the pawn's role on possesed
player controller does but the base AIController class doesn't, atleast not until we overrode it
at this point i'm almost tempted to just put in a really hacky fix along the lines of
if(Pawn->Controller == nullptr && Role = Role_AutonomousProxy) Role = Role_SimulatedProxy;
because the controller does become a null reference on the pawn, as you would expect
also, @next falcon if an actor isn't marked to be replicated then it won't be replicated to all connected clients when it is spawned at runtime
and if it replicated but still doesn't spawn for all ?
and if you have a lot of things you need to set up BEFORE sending the new actor to all clients then look into deferred spawning (i can't remember the function name)
then i'm not sure, we use deferred spawning for pretty much all of our runtime spawnables, and they all work as intended over a network game
wait i need to set it to replicated before i spawn that actor ?
the actor should jsut be set to replicate in its blueprint really, or on its construct
Any reason why both DebugMessages are being displayed on the client but MovingForwBack isn't being changed.
void ARPGProjectCharacter::Walking(float Value)
{
if (HasAuthority())
{
GEngine->AddOnScreenDebugMessage(-1, 2.0f, FColor::Red, TEXT("All Good"));
Walk(1);
}
}
void ARPGProjectCharacter::Walk_Implementation(float Value)
{
GEngine->AddOnScreenDebugMessage(-1, 2.0f, FColor::Red, TEXT("WALK"));
MovingForwBack = Value;
}
It works just fine if I remove HasAuthority()
I tried it with the server and 2 clients and everything looked ok.
No I just click play and ue spawns it for me
But isn't HasAuthority used to check if we are the server?
Or is it used to check if we own the object/pawn?
IsLocallyControlled() checks if it owns the object/pawn, Role == ROLE_Authority checks if it's server, it's a bit odd to handle movement via RPCs, thats what AddMovementInput is for, movement doesn't work well if replicated, it needs to be predicted, AddMovementInput modifies Acceleration which is predicted out of the box
@hidden thorn
Also you're checking if it's the server then calling a server RPC
You want the client to call the server RPC right?
Not the server to call a server RPC, that's entirely redundant
When i join a session i start at the player start but without a character and can fly around ? what went wrong ?
what should i change ?
@next falcon Did you set your GameMode to spawn players as Spectators?
no but i find out that only the controller spawns but without character
@fossil spoke how can i fix that ?
@next falcon had the same problem with my old project, i managed to fix it this way. http://prntscr.com/heh670 might not be ideal for you, but an idea on what to do. strangely enough it was working fine before, but something happened and i had to add this
So recoil in multiplayer shooters, mine works great currently, but the concern I'm having is that while the shooting is fully server authoratitive I think the recoil might be easily hackable because it's only applied client-side and I'm not sure how to apply it in a way that the server can enforce it
Spread is a lot easier because the projectile is spawned by the server and then replicated to clients
But because recoil is pushing the camera around and doesn't affect the actual round being fired, I'm not sure how to approach a solution
@grand kestrel Atleast now I know not to use ROLE_Authority, also I am not replicating the movement. What I am doing I am simply setting MovingForwBack from -1 up to 3 which is used inside the BlendSpace to display the correct animation.
The movement it self is still using AddMovementInput() the only other thing that I am doing I am using ServerRPC call to change the MaxSpeedWalk cpp void ARPGProjectCharacter::SetSpeed_Implementation(float Value) { charMovement->MaxWalkSpeed = Value; }
@hidden thorn charactermovementcomponent has a virtual method GetMaxSpeed that you can override. The proper way to do it
Is there a follow up as in what is the proper way to do it or is GetMaxSpeed the proper way to do it?
@hidden thorn you are only setting maxwalkspeed on the server?
Well from my understanding what I am doing is I am asking the server to set the maxwalkspeed on the client
Maxwalkspeed is not replicated
Huh
Well yeah, you have to set it on everyone
Otherwise only your server runs at different speed and your local client will jitter
Idk if that has anything todo with the conversation, but wanted to add that as i saw your rpc
So ServerRPC are used to call a method from the client on the server telling the server to do something which will then updated on all the clients?
Because when I am setting MaxWalkSpeed using SetSpeed it works just fine and I spawned 2 net clients and it works on both
The speed changing can be seen on both of them
Is there a way I can find out on client pawn if it is possessed/owned by a network PlayerController or the localPlayerController ?. I only want to send RPC's from it if my local PC possesses it
would fetching GetNetOwner() and comparing it with local player controller work in this case ?
Maybe this would help IsLocallyControlled() checks if it owns the object/pawn
@thin stratus To set MaxWalkSpeed to Replicated those that mean I need to get the source? As the file is locked.
You rpc the change
No need to modify the source
@hidden thorn Well as far as I know, and i've been around for a while, the MaxWalkSpeed is not replicated.
A ServerRPC doesn't mean it's updated on all clients. It just means that it executes on the Server.
If what ever you change is not marked replicated, it won't update
I see also I just checked the definition of MaxWalkSpeed and it isn't Replicated.
95% of the time someone asks "Why is my client jittery", it's because they only set the walkspeed on the server
So I still believe it does not update
Means, either you Multicast from the Server RPC
However, only good if you have no late joiners
If you have late joiners, make sure to use your own Speed variable that is marked RepNotify
and in the RepNotify function, you set the walkspeed
(+ on the server RPC, as RepNotify doesn't call on Server in c++)
@grand kestrel couldnβt the recoil also be called from server? If thatβs the only thing that is clientside, it wonβt work great in a situation with latency unless you are accounting for it in some other way.
It would likely feel horrible, but it might be the only viable solution @inner iris
Maybe sub 50ms it'll be OK, gotta test
Iβd recommend have the recoil, gunshot start fx and clientside projectile spawn instantly clientside and then do the same on server / compare. I donβt think any recent game has fully serverside shooting atm- it just is too slow other than for one off projectiles like rockets that you can mask the latency with an animation
You can even have a spread value different on the client than the server but count the servers one- the clientside shot can just be an approximation
I sync the random seed between server/client for that
Ah yeah since there is travel time you can do that
It actually feels fine to spawn the projectile on the server, the way I do it is that the FX play immediately but the server spawns and replicates the projectile and it's movement, at 50ms you barely notice it, even 80ms is fine
Do a 200ms test with someone running back and forth horizontally
Like you shoot 5x, you'll play the FX, but the bullets appear moments later (almost unnoticeable depending on latency)
Youβll have to shoot ahead of him depending on the latency
Results in a very inconsistent experience
Ok if you have prediction then itβs probably fine
Can't share a lot more info though
Do try that out though because consistent hit feedback is really important
And most games Iβve seen favour the clientside shot and verify it on server by comparing timestamps
Of course there are pros and cons to both, but I think in the end, responsiveness wins
Ah it's been tested
It's just recoil that I'm stuck on
Ours is a bit more like OWs
I guess
Well yeah in that case just add the pitch / yaw inputs in sync with the server fire bullet Iβd say?
The downside is that it can change depending on latency so players might find it hard to time their shots
Might just leave it client-side and hope the hackers don't notice π jk
Guess I have to play with it π¦
I wonder if you use a random float in range to add the recoil clientside- is it possible for the hackers to counter that value on the same frame?
Wouldn't know really
Our recoil isn't jump from A->B
It interpolates smoothly, then returns smoothly
But we do use randomization for it
Similar to spread when calculating it really
On an entirely off-topic note, my god I really hate coding in Python
Making a hair strand generator
I recently made an UActorComponent to attach to my game state to replicate data
but strangely my RPC isn't call
here how I create it inside the CDO of my gamestate:
NetworkComponent = CreateDefaultSubobject<UNetworkComponent>(TEXT("NetworkComponent"));
NetworkComponent->SetIsReplicated(true);
and how my RPC function are declared:
UFUNCTION(Reliable, Server, WithValidation)
void ServerCheckRegion(const FVector& RegionCoordinates, const FDateTime& LastUpdate);
UFUNCTION(Reliable, Client)
void ClientSendRegion(const FVector& RegionCoordinates, const TArray<uint8>& Data);
did I miss something ?
my .cpp has ServerCheckRegion_Implementation / _Validate and ClientSendRegion_Implementation
Simple fact that you can't call serverRPCs in a ServerOwned Actor
As well as Client, as that doesn't reach any client
@rare cloud
oh ok
what actor can send server RPC ?
Character ?
Controller
Ok thanks ! I will change my design π
I was thinking since GameState is replicated with all no problem can happen
I was wrong
Hello! Is there any information (lessons, docs) about these nodes? (turn based)
On answerhub people say to avoid this, is it useless?
ok here's where i'm confused on UE4's networking structure:
I have an RPC chain setup -
1: Client raytrace to hit target
2: Server Raytrace (Passed args for start/end locs) (VERIFICATION + application of damage on successful hit)
Now... i need to interject into the Server raytrace - but I need to run a multicast function on the HIT ACTOR..... Due ot the fact that i'm in ServerAuth at this point - this wont bappen because of ownership issues.... my FIRING actor (the player) doesnt own the HitActor (enemy).... how can I get back to a CLIENT local funciton level on the HitActor (enemy) from a server function (the verified raytrace)?
Do I have to RPC back to Client on my firing actor (the player) ?
@austere lintel - https://docs.unrealengine.com/latest/INT/BlueprintAPI/Online/TurnBased/
Turn Based
If you're on the server, you have authority over all replicated objects, even those that aren't owned by the server's PlayerController.
You can only call multicasts from the server, as a matter of fact π
(multicasts don't work from the client, even with an owning connection)
Sure, but I thought you were already on the server in the explanation?
it'll error out in the OUtputLog
Maybe I misread
ok lemme try make this clearer (sorry)
My Characte rfires
it hits the enemy
(raytrace)
my character then runs a server RPC to do the same thing
raytrace verifrication
now
at this point - i'm in RoleAuthority on my player
i need to run a function on the HIT ENEMY
ultimately (as stated) a NetMulticast
but i'll have Ownership isseues....
wont I?
So we're already on the server in this example?
maybe i should also state
thi sis a Peer 2 Peer networkign model
NOT dedicated
to my knowledge - YES we would be on server (via RPC) ?
Uhh, do you mean listen server?
That's still the same network model as dedicated π
It's just somebody hosts the server; inside of the game everything is the same
But yeah, if you're on the server ownership really isn't an issue.
The server has authority over all replicated objects.
ok - i guess i'm just jumping the gun sorry
i should have coded this - seen if i had errors - and then try ti diagnose
does anyone have information on net dormancy?
@stark dome - anything this might help with?
https://answers.unrealengine.com/questions/395125/net-dormancy-and-net-relevancy.html
@worthy wasp thanks for the link, already read it though. wish there was some more info
replication send data only when the replicated value change ?
@elder sable, yes
ok thanks
Another networkign oddity i dont understand..... ListenServer -> BeginPlay and Tick are supposed to run as both RoleAuthority & Role_AutonomousProxy..... but yet when I do a If(HasAuthority()) branch on BeginPlay - my CLIENTS dont runt his code..... telling me i need to RPC it i guess?
What exactly are you asking there? Yes, those events run on both server and client, but if you add an authority check to one of them, it's obviously only going to run on the authority (server for replicated objects)
maybe i'm not fully undesrtanding listen server
the SERVER role is assigned to 1 client right?
does that client play as JUST SERVER?
or is he Server and Client?
or - is the SERVER ROLE - an instanced role that is running on his machine - but he plays as a client ?
It's mostly just a server, but things get a little more complicated than that, because you also have things like the HUD on a listen server which are usually only for clients
so then how do I AUTHENTICATE ont his guy?
in this model - (LISTEN SERVER) - the SERVER client could hack/cheat all day long?
if he were to write script - no?
ok
so i do undestand it correctly then
thats how i was developing this in mind
so then
all CLIENTS - never have authority - even in BeginPlay or Tick - correct? @brittle sinew
On replicated objects, no.
If a client spawns a non-replicated actor on that client only, however, they have authority on that object Technically it wouldn't be authority, it's just that they have the ability to make changes on it since it's a non-replicated actor
oy vey lol ok
so if i have a subobject/component/variable - replicated.... then they have no authority to it
understood
and that would require RPC to make changes to the component/variables of tha treplicated object
And well, actually, it would probably return as being not replicated π€¦
Yeah, ownership and authority are somewhat related but different concepts
Heey! Anyone can help a tiny bit? We got a "slight" issue.
Been working on a game for a while, and all of a sudden, after the players log in, they get automatically disconnected
Like
Event Post Login -> Cast to Controller -> Spawn Pawn -> Possess with said controller
Worked all good. Now We start the game, the character spawns, a print string runs after the possess, saying that it has possessed the pawn, then 2-3 seconds later the player just vanishes, gets back to the level it was on before, and the server prints the "Event On Logout" text that we have added.
Okay, finally got log, I don1t know why it did not show up before
@raven viper Maybe perform a Multicast on the PlayerController that is reliable?
Can technically be all sorts of things
The log would be help ful (from both sides)
Sorry, the problem was simply the fact that there were too many reliable events, so instead of dropping the requests, it just basically disconnects the player.
Question related: I cannot find anywhere, where to set the maximum number of reliable event calls.
Yo, quick question
I'm using UE's standard character controller.
let's say I want to, upon left click, fire my pawn's gun.
do I need to use a custom replicated event for that?
Client tells Server he wants to shoot his gun
Server multicasts gun shooting function
is that it?
That would work, yeah.
If you want to make it feel better, you might want to look at client-side prediction for events like that, but that might be outside the scope of what you're trying to do
are there good multiplayer guides/references for ue4 that you guys can recommend?
hwow do i fix this RPC failing for the following reason
[2017.11.25-07.49.31:724][234]LogNet: Warning: UIpNetDriver::ProcesRemoteFunction: No owning connection for actor MyMixamoChar1_C_0. Function ServerShowCharacterSelection will not be processed.
i did some custom player character spawning and possession with ai controller prior to this
please mention me if you have an answer, i gotta go
Is it true that you have to make a new copy of a map for each different GameMode?
So you canβt have one map and play different game modes on it?
@inner iris you can pass the game mode in with the options when loading a map
Ok cool was just looking at a tutorial that specified a new copy of the map was needed for each GM which would be a nightmare to maintain
Thanks!
guys, I have some issues with replication
Basically, I'm using a function to aim and a function to fire
*event
This is how I aim
This is how I fire
The problem is that while the server spawns the projectiles fine, and the client sees them fine
when the client shoots, it shoots straight forward
it doesn't take into account "Weapon Left" and "Weapon Right" rotation
is AimWeapons event a replicated event at all?
It's not, if I replicate it, for some reason I have to click + drag to aim
Not sure what you mean by that.. but you dont necessarily need to repliacte the AimWeapons event.. but maybe try creating a new event called SetAimRot_server and run that on server... then have that run another even called SetAimRot_mc. make inputs on both and after doing the set world rotation locally.. pipe the new rotation into the inputs on the new events and then do a set world rotation in the mc event as well
mc being multicast
cuz right now youre only doing the rotation on the one machine. the others dont know it ever happened. so their copies of the actor never rotated from their point of view
yeah, that makes sense
Sometimes you're in so deep in something, a fresh pair of eyes really helps
π
yep. its hard to tell from just the snippet but hopefully that works
@twin juniper to call a server RPC on an object, that object needs to be either directly or indirectly (somewhere in the chain) owned by the local PlayerController.
That's what an owning connection is referring to
ok, wait a sec
let's discuss this
this is what i've done
it seems that possessing removes the ownership
how do i regain it?
@brittle sinew
Set Owner
and the owner would be player controller?
The PlayerController of the client whom you want to be able to call a server RPC on the actor, yes
Theoretically yeah, or you could just feed it in on the SpawnActor node itself
@brittle sinew i'm not getting the message any more but the RPC is still not executed
π¦
Hmm, are you sure the RPC isn't executing, and that you're just not getting the expected result from it?
maybe i'm not referencing a correct character
how would i reference it from client?
currently i'm replicating the reference to the character through a controller variable
maybe that's not the correct way
but if i try to use get controlled pawn, null, is returned on the client
hmmm, perhaps a timing issue?
trying to get controlled pawn before set owner is propagated to the client
Possession and ownership aren't the same thing.
i understand that
Your pawn is controlled/possessed by the AIController, but owned by your PlayerController
Well, you said that you're trying to get the controlled pawn before set owner is propagated
Those are effectively unrelated in this situation
Just to think about it though: does it make sense that an AI is owned by one of the clients?
i'm trying to make a player character that can use ai move to
I should've talked about this earlier, but it seems a little weird that an AI is specifically owned by one client, and not others
like i said, i need ai move to functionality on my player character
And?
because simple move to doesn't fit my eneds
Oh, I see what you're going for, sorry
i've been trying to set this up for days, but it seems i'm running into obstacles all the time
now with this RPC π¦
this thread claims it is possible
Okay, so how are you currently trying to call it? I know you said you were possibly having issues getting the character, but I'm not really sure exactly how you're doing it
I'm replicating a variable on the controller, which is a reference of the character
Okay, so it definitely is very possible that it's a timing issue
Have you checked to see if that variable is valid?
(and/or the one you actually want?)
yes, i understand what you mean, trying to figure that out atm
but i was wondering, do i need to replicate the variable? shouldn't "get controlled pawn" return what i want
ah, ok! is there some way to get the reference of the pawn the controller is owning.... something opposite of "get owner"
Nope, as any actor can own a (theoretically) infinite amount of actors
If you don't want to do things within the character itself on the client, it's probably the easiest
this is the server side, where is setup the character reference
client part where i call the RPC, everything seems pretty straight forward
And you don't get any errors from null accesses or anything?
Is the RPC reliable?
nope, should it be?
If you want the event to always get sent over the network, definitely.
Non-reliable RPCs basically say "you can drop this if the network is busy, I don't mind"
i'm going to set it to be reliable, but i don't think it'll change anything
is there some thing i can do to debug this
Networked debugging is a little tough, but you still might be able to use breakpoints if you're keen about what windows they're being executed on and things like that
it just doesn't get sent π¦ how would i debug it π¦
You set it to reliable?
yes
And you're definitely sure the RPC isn't coming in on the other end?
Have you tried print stringing/breakpointing it?
seems to me that you are not the owner of the rpc target or it is just not valid on the server
how would i fix that?
it returns a replicated refrence to character
and it is set on server in this script
this script spawns a charcters, sets a refrence on the player controller, gets the character possesed by an ai controller, and then returns ownership to player controller
ok, guys, i need to go, thanks for your help. if you get any idea how to fix it, please mention me
can we use "run dedicated server" in editor without using any online subsystem ? My map is not loading and i have a "invalid userId"
this message is spammed when I spawn an actor client and server without replication:
could not resolve the new relative movement base actor, ignoring server correction!
There is a way to avoid this message for procedural collision ?
i have a weird bug where i cant use my WASD camera after i use my Middle Click Camera :|
the print string says it should be working... but it isnt.
any thoughts?
it starts working AFTER i alt tab though
@hexed rose - i maybe wrong - but if your movement is = 0 .... the bool will be false - which will lock you out of being able to use your middle mouse button to pan around
middle button still works <.<
i dont know how - your branch would be false from movement all the time while you are standing still
the idea is... when the player is still then can pan the camera with middle... but then if they are using WASD the camera movement enables (the WASD is where the bugg happens)
sorry - i'm durptarded ... the OR logic would pickup the middle mouse being clicked..... which makes the movement logic kind of backwards though
errr
i'm gonna si tthis one out - i just stuck my foot in mouth
lol
you'd WANT the move logic to be NOT - because if you're moving you want to have yaw/pitch input from controller..... my bad
was overhtinking this
now question
i assuem server works fine for htis - but clients dont?
it looks as though the MouseAllowsCamRot isnt replicated
<. <
is that the case?
no idea
ok well one thing i DONT understand is the alt-tab thing
whats that have to do with anything?
It's all local
So I doubt it's actually a problem with Multiplayer?
@hexed rose Do I get it right that you only want the MMB to work if they nearly stand still?
Sorry for repeating that question, but both your discussion made it vague for me
i only want the Middle mouse button to Work when standing still... then latter add it in for the click movement
then latter add it in for the click movement that part I don't understand
Alright, so what you code currently does is this:
Pressing MMB will enabled the Boolean at the bottom right, making it true
Which will enable the Turn and LoopUp on the bottom left
No matter if you stand still or not
which it does
Code on the top right is checking if either of the two AxisValues is nearly 0.
If it is, the node returns true, which gets "NOT" into a false and then checked on an OR
Which, if standing still, will def set "MoveAllowsCamRot" to false
Which is the opposite of what you asked for, or?
<.< i think so