#multiplayer
1 messages ยท Page 331 of 1
Yeah its just an really lightweight version of FVector
You get an slight overhead for the Serialisation/Deserialisation though
But not super significant
Understanding this was the exact same issue I had with JS callbacks. I just couldn't wrap my head around them until one day something clicked and it was the easiest concept in the world.
Yep once it clicks it makes so much more sense
Unfortunately its only the surface for networking though haha
ugh
I'm wondering if I should just scratch everything and restart
I came into this like I was coding a single experience, not multi
Yeah Multiplayer is not something that can be easily 'tacked' on as an afterthought
If I'm thinking of this correctly, it'll completely alter how I structure the code
Which is very lost on most gamers when they all complain about not having it on an particular game ahha
I think that's what is making it difficult - I'm trying to fit the concepts into what I already know.
I read that thing on net and physics
Alters how you plan all your code
Before I was like "Eh Rocketleague - I could do that, it's so simple'
now I'm like 'how the fuck did they do that?'
As an Singleplayer experience, sure it wouldnt be to difficult
Multiplayer just adds an entirely new dimension
How do you structure multi
I build MP code as if im an Dedicated Server
go on
This forces you to think outside the box when it comes to cosmetic or more importantly actual player interactions
If your writing as if your the dedi server start to think, how am i going to know if the player just picked up an weapon
How will i know if im to do an Airstrike in an position when an player just pressed on their map
Those sorts of questions force you to think about the relationship that the Client has to the Server
Especially an dedicated server
Since dedicated servers dont know about the Clients HUDs for example
It forces you to think, "hey if my client presses on their MiniMap somewhere, how am i to know where they pressed, oh i know i need the client to send that info to me"
that's a really good point actually
Really all clients should be doing is performing cosmetic actions based on events from the Server
Play Reload animation, start particle effect here, play sound over there etc etc, all those things could be caused by the server being told that another player somewhere has fired an weapon or something like that
ok
The Server does all the hard work like performing the line traces to make sure that yes that is indeed an player you just shot, we should apply damage to them now as well, lets tell all players to start an blood splatter particle effect
you've convinced me to restart lol
SinglePlayer vs Multiplayer should literally be the SECOND question you ask after the first which is what game do you want to make haha
Just as a side note, if I'm calling a function on the server like GetHitResultUnderCursor
Only the server will see that, correct? As in, the server is getting the HitResultUnderCursor trace ?
The Server (if its dedicated) might not even be able to call that properly
Anything that is UI or HUD related when called in the context of the Server will most likely not return what you expected
Simply because the Server may not own an HUD or the UI element
that's tricky.
Exactly
If I'm moving my object and it's based off the client's cursorlocation, then I need to think about it a different way I guess.
Yep
I suppose I could update a transform variable.
and when the client updates their position, it also updates the variable.
(on the server)
Well like we discussed earlier, you need to tell the Server somehow what the new position of the Box is based on the Clients perspective so that the Server can move the Box there
okay so psuedo code-wise
Assume your Client has the box picked up, Client sends an RPC to the Server version of the Box with the HitResult from the GetHitResultUnderCursor and basically the Box updates its own position
You would probably limit to only sending the RPC when the Client has moved the Box enough that it snaps to an new grid square
Client: OnTick()
GetHitCursor
Update Replicated Var HeldActorLocation
Rep_Notify UpdateHeldActorLocation()
UpdateHeldActorLocation()
HeldActor.location = HeldActorLocation
Client can only communicate with the Server via RPC, the Client cant RepNotify variables
So UpdateReplicatedVar would need to be an RPC to the Server from the Client
Id pass along the HitResult as well
That's probably easier
That way the Server has all the information it needs to do all the work itself and then all Clients just pickup the changes via normal var reps
and that way I can check validity on the server a bit more, I guess
Id also abstract the majority of the movement code to the box actor itself via an Interface call
ICursorMovable or something
MoveActor(HitResult)
Are interfaces the only way to pass through ownership ?
Interfaces dont pass ownership
I mean being able to access the ownership of non-owner
Its just an better way to segregate your code to the object that is being manipulated
oh so there's nothing particularly unique about interfaces in a networking context?
No
Id just do it as an general best practices thing
The Character or Controller does the GetHitResultUnderCursor and then RPCs to the Servers version of the Box Actor so that the Box Actor is managing itself
If that makes sense
that does
However, once the server updates the movement of the box, the clients will also be updated due to Movement Replicates, right?
Yes
Yeah Server is really the main workhorse
And the clients are just passing through inputs?
Yep
Clients pass input and try to simulate as best they can what is happening on the Server
And all the sugar stuff can just be ignored by the server since it doesn't matter - like particle effects
Yes as long as its an Dedi Server
If its an LocalHost then you need to make sure to also call any Cosmetic stuff for it as well
lol
nah, dedicated servers for life
I reckon
So to recap, Clients perform inputs and send those to the Server, the Server performs any manipulations and Clients recieve any changes through Var Replication or RPCs
I'm surprised the question "But in what ways can I pass info from Server to Client" hasn't come up yet.
Replication or RPCs ๐
but how
Magic
Just another tool with the added benefit of being automatically replicated to all clients
Every client has every other clients PS
The hard part for most is understanding the fundamental classes and how they interact in an networked environment
HUD, GM, GS, PS, PC all behave differently
PS?
Sorry, had to step away for a bit
But in what ways can I pass info from Server to Client ?
actually serious question. If I pass a function to a server and I get the controller's Pawn, I'd be getting the server's pawn wouldn't I?
so i have a global event system in GameState, and "damage" events are broadcasted through it to generate like a combat log. my HUD needs to listen to these events, but since its only server side, how can i get this to execute on the client side?
So would i have to pass a reference to the PC I'm doing the server-related action on?
@twin juniper Just multicast an Delegate call
Then anything can subscribe to it to recieve an damage event notification
"multicast a delegate call" - what does that mean exactly?l
like when i broadcast the event?
EventSystem->OnEffectDamage.Broadcast <-- make that multicast ?
i have my delegate defined as multicast DECLARE_DYNAMIC_MULTICAST_DELEGATE_FourParams(FAbilityEventDelegate_OnEffectDamage, float, DamageAmount, ADungeonRunnersCharacter*, Source, ADungeonRunnersCharacter*, Target, bool, Crit);
He means as an rpc multicast
so what im doing now is having my gamestate listen for that event, bind a delegate to it. when it's received, multicast to the clients
does that sound about right?
hmm i got a stack overflow ๐
or do you mean wrap my "Event.Broadcast" even inside of a multicast function?
ok i got it thanks! ๐
hey @fossil spoke I got it to replicate successfully! Thanks so much!
There's quite a bit of jitter. From what I've read, I should create a local client version of what I'm getting the server to do to make it seem like it's smooth?
So the Client should be running the movement updates at the same time so that it has an smooth change and then all the server is doing for the client is making sure that their boxes position ends up at the same position the server calculated.
yeah I figured
Since I'm not doing that, I guess I'm just seeing the raw server stuff
Your seeing the updates at the rate the server can send them
no it doesn't. everything I ever know I know now
Havent even touched on any prediction concepts lol
Roll their own what?
Like how the server stuff works
Still not following?
ah it's not important
Syncing client inputs to match the actions of other clients on the server is an deep deep subject.
Ill send you some links later on with some good information on the concepts.
please do
But stick to what you have learned today and get used to the way it works.
If you need real world code to look at. Try and see if you can make sense of the movement replication on the CharacterMovementComponent.
Its pretty complex but takes you right down the rabbit hole hahah
haha okay
Practice makes perfect so keep working with it
Do you separate your functions into client and server?
since I have very similar yet fundementally different functions for what happens with the server and what happens with the local.
Depends on what needs to be done. Sometimes i do.
I suppose if I'm smart about it I should be able to cut down on any redundancy
The authority roles help seperate code
Make good use of IsDediServer etc etc
Checking for locallycontrolled where you can
Lots of different flow controls to help
Yep its pretty important
The documentation has some helpful guides and tips on managing network roles and what they all mean.
Tell you what - whipping out visio isn't a bad idea
Is it reliable to use a replicated variable in a Multicast when the replicated variable is set just before the multicast call?
if (Role < ROLE_Authority) is relative to the owner, isn't it ?
@modern dome no, you have no guarantees of the replication order
If you need it in the function, pass it as a parameter
Even if you pass it as a parameter, you need to give it time to replicate to the client as well
If you just spawned it
Also, I would be careful using get player controller index on a multicast
That would work on clients, but on the server you're not guaranteed the local PC is index 0
whats the best practice for the replication issue?
You could make use of a RepNotify if you're just waiting for it to be replicated
@modern dome you aren't checking for authority on the server call anyway
Why not just pass it directly into the multi
And then you should be able to pass the variable "Cast to execute" through that function
You're making two RPC calls. Might as well drop it down to one.
But I already Trier using the Parameter in the multicast and it was none
Yeah...where do you actually set it?
Like that "set" is null right now
You don't have anything setting to it
Cant right now because i am not at home. Can i mention you tonight?
You don't have to mention anyone, just repost your issue
Someone will help. All this @pinging certain people is silly. Anyone can help.
The setup is AS follows: Controller calls event run in Server, which spawns an actor. This actor is send AS a paremeter to the event above. The actor is forwarded to the multicast
Like I was saying, the actor probably just hasn't replicated down to the client yet, you have no real way around that besides using a RepNotify
Assuming x seconds will get the replication there is dangerous
You know the player state, its replicated to everyone right? is it every players player state is sent too each other? or just there own to them
also if its replicated, does it automatically replicate any veriables in it?
@brittle sinew but what should i do if the spawned actor is relevant for the gameflow?
Would it make sense to wrap the set node into a multicast rpc?
Since the order is the same when using reliable rpcs
No, because the clients still wouldn't know about the actor
And it would resolve to null on the clients
Is this function always called right after the actor is spawned?
Like, it's called no matter what after it's spawned?
yeah
So why not just use the RepNotify?
and what If I later decide to change exactly that?
imo Repnotify shouldn't call gameflow relevant events
This is my current setup btw
But I guess you are right about the actor not replicated yet
Maybe I should wrap the Spawn itself into a Multicast
Well, you need to make somewhat of a decision here. Is the "gameflow relevant event" happening right when you call it more important than the cast being required to run the event or is the cast being there the most important part?
No, if it's replicated you don't want to be spawning stuff on clients
At a certain point in networking you have to be okay with comprimises and make stuff work even when not everything is provided to you over the networkโit's just not reliable
Hm, I guess Multicast Spawn is the best thing. All I do is only visual. The Damage calculation is still done on the server
Guys quick question, anybody ever have trouble sending a 'const TSubclassof<>` via an RPC?
Not compiling, but the error is really odd
I've never tried, but shoot the error I guess?
Well the error is happening in the 'generated' header for the entire plugin, which is wierd - so it's not pointing me to anywhere directly
Are you getting ```Severity Code Description Project File Line Suppression State
Error C2678 binary '=': no operator found which takes a left-hand operand of type 'const TSubclassOf<AActor>' (or there is no acceptable conversion) SourceTest416 D:\Unreal Projects\SourceTest416\Intermediate\Build\Win64\SourceTest416\Inc\SourceTest416\SourceTest416.generated.cpp 50
Tried it out myself, weird
I see one answerhub post commenting on it, but nothing really definitive
Looking at the output log it seems it can't decide which operator to use
Yeah that was the one, I guess UHT doesn't generate the generated.h file properly for RPC's that have const TSubclassOf Items. Just had to make it non-const. Not end of the world though!
Oh, I didn't even try it non-const, cool you could still get most of the functionality ๐
Anyone know how I can fix jittery movement when using listen server? (movement done by calling AddMovementInput on client) The movement is jittery for clients only when connected to listen server, like only the listen server is sending bad corrections.
Setting p.NetEnableListenServerSmoothing 0 fixed it, for now anyway
For a PlayerController, if I just set the values on the client are they replicated to the server (because they are the owner)
Or do I have to call a function on the Server to set the server side copy manually
Replicated variables are never replicated from client to server.
Cool, suspected that but thought I'd check in the case of PlayerController since they do own it. Thanks!
Ownership is irrelevant, the server is Authority and is the only way for variable replication to occur.
If I want to send client-only data (ie: vr hmd position/rotation) would it make sense to override APlayerController::PlayerTick then? It is only called for locally controlled PlayerControllers, so the server copy wouldn't try to retrieve a value from the server HMD I guess.
Sure give it a go.
Oof. SpawnDefaultPawnAtTransform seems to be run before the first PlayerTick, so it has no copy of the values
Well so much for that idea!
I can probably fix it by spawning everyone as a Spectator and then after a moment's delay spawning them as a real pawn.
You can force spawn players as spectators when they join in the GameMode
is there a reason why sometimes when an object initially spawns, it doesn't call repnotifies for certain properties? (clientside, mostly during replication.. like joining a game in progress. but never when ingame to witness the server spawning the object for everyone)
i have DOREPLIFETIME_CONDITION_NOTIFY(x, x, COND_None, REPNOTIFY_Always); which made it more reliable but it still happens... im ganna write this off as an editor glitch? cant get packaging to work to confirm... idk
@twin juniper it does not call repnotify if new value is equal to old one
You could manually call the repnotify events during beginplay?
Should I replicate the movement of an actor, say a box movement, back to all clients to get the most smooth response?
probably not the smoothest, but most accurate
meanwhile, is it possible to store authorative actor reference to remote?
I know that sounds super dumb
how do I smooth it out? Right now I'm NetMulticasting my hit result back to the clients and letting them update the position
ah actually, I think it's just because I'm running a dedicated server on a single instance with 2 other players
my FPS is like 10 heh
heh
I think that'
sure if it's a simple pre-determined movement you could just sync it using rpc without actually replicating the movement
I think that is the way to do it though. Otherwise all the other clients will see is the server and that'll be really chuggy (accurate though)
nah it's a little more random. It's an update of a client's mouse movements.
my char's can pick up and move boxes
oh so you want to show mouse cursor location to other players?
well pass through that info. I'm replicating FHitResult
to the server, then the server passes the movement back to the PC's via a NetMulti
that's a lot of data tho
Yeah I think I can refine it to just be the FVector, TBH
let server do the heavy lifting
Keep it lean
Is NetMulti really the only way to keep all clients up to date with what the other clients are doing? Aside from UProp Rep
if it has to be instantaneous
dumb q - if I'm netmulticasting back to the clients to update them, does that remove the need to run something on the local?
hmm
it's still a little.. chuggy
Actually, no it's just me being a dummy
and running two players inside PIE again
Package the game and get 2 clients to connect to an local server. Testing MP in PIE can only go so far.
yeah, I'll try that in a bit
Something I find odd, or at least one of those things I don't quite get.
I have 2 clients. If one picks up a box, it stores the actor on the server, tells updates the client's cursor etc.
So when I do a net multicast, I pass through the vectors for the store actor's location and updates it.
Actually I just answered my own question so I'll shut up
Can somebody explain me little about the _Validate() method that comes with the Server functions. What can i for example do within the Validate?
@plain flume To validiate before it gets run
Or like most people, no one uses it for anything.
Pretty sure eXi's comp had that in there
Page 64
Looking for 2 peoples for a new project that all in the project owns together, currently amount of peoples in it "2" and ideas and plans are set and ready to upgrade at anytime, please message for more info ๐
try #career-chat
Hello Guys, I'm created a simple multiplayer test project, with DefaultPlatformService=Null and using Create Session in LAN mode and Find Session in Lan mode ,
The problem is i've to search at least ten times to find a session on my lan , I've one PC and Laptop connected to an ADSL Router , Why this happens ? After find that session everything works and i can join and see my both character , I'm using 3rd person template
heh
Other than LAN is broken?
@wet oriole Doesn't shootergame have the LAN settings?
I didn't test shooter game but in the ShooterGame config online subsystem is steam...
@wary willow
Hi I found a relevant warning on ShooterGame related to #multiplayer check it out and let's see if we can have epic fixing it for all the community to grab the update! Thanks :D https://forums.unrealengine.com/showthread.php?149590-Relevant-warning-on-ShooterGame
@pallid mesa I had this error in one of my projects too...
Quick silly question, what information is it that carries between map jumps?
i cant remember ๐
@sweet spire You mean the game instance?
see ur on a ball today matheus, is there away in bp to set the ip for find session node?
You'd like to filter the find sessions by the ip?
AFAIK It is not possible in BP
I think the Advanced Sessions Plugin has some filtering capabilities
else you'd have to go with C++
no i mean
find session
searches across the default sub system right?
cant u point the default sub system to a certian ip? or range
or list of ips
No, you have a base implementation from UE4
they basically exposes what it's in C++ to BP
yeah and it searches for sessions from default sub system right?
yes
I know there is a lan option for it,
are u not able to point it to an IP adress?
as if u where searching lan
Not sure, the point of find sessions is to find more than one session in the subsystem
if you have the IP just try joining it... idk ๐
I see, but using find sessions without filtering with the IP would return it anyway
If you really need to set an IP you could take a look at the plugin, but I never really used it
the plugin would just take every session and filter by the ip you give, if it even does that
I'm not sure if there's a way of giving an IP to the underlying subsystem so it would do the filtering
Has anyone written anything to check which properties in a struct changed per OnRep? We have the previous value of the struct if you use the OnRep parameter. So it should be possible, just wondering before I write it.
just compare them? ๐
yeah I'll just write it
Two questions as im pretty chatty today
What event gets called when client attempts to join a server on the server side
there is PostLogin
Theres some stuff before it
and i cant find the wiki page for it D:
wth
where has the ue4 network flow gone
wtf its actually gone off the wiki D:<
Whats the deal with advance session plugin? try to create a session with default settings or default + lan
and it fails every time
I'm guessing it has nothing to do with the plugin, it's just a wrapper for engine functions for the most part
LogScriptCore:Warning: Script Msg: CreateSession - Invalid or uninitialized OnlineSubsystem
LogScriptCore:Warning: Script Msg: CreateSession - Cannot map local player to unique net ID
no documentation anywhere arhh D:<
ohh
god dammit lethal
i always google things before i ask
Well
at least it works now
LOL
god dammit why is it returning 0 sessions D:
its not my day today
nvm sorted
jesus
DenverCoder9, pls, @sweet spire
Can someone help me understand how to retrieve and store user data online
Huh?
No no, DenverCoder9
TL;DR: Don't post about a problem then just say that you fixed it. Post your solution, so others can use it if they come across it.
Slightly less relevant in Discord, but someone might learn something from your fix that they'll remember if/when they run in to the same problem.
Hi Everyone! :)
Im using the multiplayer blueprints tutorial project made by Epic and I found an interesting issue. Some of the players can only Host, but not Join a session, for others it works both ways. I couldn't find any reference to this so far, is there a thread which addresses this issue?
https://www.youtube.com/playlist?list=PLZlv_N0_O1gYqSlbGQVKsRg6fpxWndZqZ
hello people! :D
when checking certain conditions, like if an object implements an interface or if a certain boolean is set to true, should that check be performed locally or in the server? just mainly to prevent cheating
Depends on what its for, thats an pretty context sensitive question. If its an cosmetic check then it would be reasonably safe to be performing it on the client. If its gameplay critical then the server should be doing it.
@past pawn Do you have any specific issues or concepts in relation to that with which you need help to understand further?
thank you for your response :)
I just need to check the value of a variable and depending on the value change other stuff, but I wanted to make sure I'm doing it right
so if I'm checking something important for the gameplay, that should ALWAYS be on the server, only cosmetic related stuff goes to the client, right?
in general you should play everything on client as in usuall game
but, after every critical event (movement, general action, interactio or something like this) you should sent rpc to server with that information and server checks everything on his side. If client could do this (in the past, because server will get information after client action) then we okay and we do nothing (maybe sent information to other clients if this is needed). If server side see some displacement -> override and sent new information to client
this is cause why you sometimes get hit by enemy player in action games after you hide behind wall, and so on
anyway, can someone explain to me - how I can make custom replication of movement for NPC characters? Like, the one, who owned by server? I feel it is pretty bad to multicast several params across network ๐ฆ
Hey guys my little listen server ui isn't working, I can setup/host a match, however when joining one, the game crashes and reveals this message:
What does it mean?
you mean this right?
mmm why u using console command
Dunno, I followed a tutorial because I'm still learning this stuff.
now it cant host a game
then ur settings are wrong
no question mark?
I don't think so
yeah, no question mark didnt work either, anything wrong here?
I never used it me.
its prefix for the url param if i remember
ur level name is wrong then
wait
u want that one
to host right?
Yeah
This click just open a level..
I got the combo box displaying "TestMap". The map is called "TestMap".
print it iout on screen
okay it seems to be working now. dont know why, probably a bp bug or somethin
but the join game still crashes
show output log error
Btw does anyone have the image that shows in what order things get created for multiplayer? gamemode, playerstate etc i cant find it on the wiki
Info Play in editor start time for /Game/FirstPersonBP/Maps/Main_Menu 1.289
Warning TravelFailure: InvalidURL, Reason for Failure: 'Invalid URL: /Game/FirstPersonBP/Maps/Main_Menu'. Shutting down PIE.
Warning TravelFailure: ClientTravelFailure, Reason for Failure: 'Invalid URL: /Game/FirstPersonBP/Maps/Main_Menu'. Shutting down PIE.
with a cap?
oh right, in that case I already have it as that.
hmmm
maybe it's the join command.
Does the map not load?
at what point does it stop
Loading the client up as listen server
or another client trying to join
it doesnt seems to load the map at all, just crashes.
anything wrong with my join script?
Oh, what's wrong with it?
try something like
Join map
with
sorry i mean
open map
set the map name to
127.0.0.1:7777
That might be wrong, thats just off the top of my head
id use the open map
instead of command lines
saves u messing about having to append strings and stuff
How so?
the fuq
this is so weird man
If i possess a pawn
through OnPostLogin
It causing it to loop like fucking mad
omg nvm
found the issue
im stupid afl mao
lmao
Also dude do u know where the information off the wiki went that shown u in what order what gets constructed?
Anyone know what the size difference is between an int and a byte?
Need to replicate a value but I dunno which I should use
In BP, int is 4 bytes
A byte is, well, a byte :p
A byte runs -128โ127, an int is 2 million something
Billion* oops
So I can't have a byte with a value of say 200?
Or is the 128 limit the amount of characters?
I'm actually not 100% sure about byte
I know BP doesn't have unsigned values, but a byte is a little bit different
If it is unsigned, it's 0โ255
So I'm reading
I basically want to store a single number
That number could be 1
but also 5024
And I want it to be as small as possible due to me having to network ALOT of those
Well BP doesn't have access to int16, so I guess you have to make a decision there
I wouldn't really worry about 1 byte vs 4 a ton though
I have to though
Because else I might not reach my bandwidth goal
Game I'm making can't rely on dedicated servers and such so we have to minimize the packet sizes
Goal is 32 player game and we're already hitting high numbers with just half of that amount
What is your exact use case?
does basic UPawnMovementComponent replicates AddInputVector by default?
I want to keep track of score and such
Kills but alot of other values
Can't remember how many Players this was
Unless you do some trickery to only send the delta via a byte and keep track of the values on each client, you're pretty much stuck with int
Ignore the spikes those should be resolved already
But without spikes we're at like 150KB/s with less than half the Players in a game
(that's the host)
I mean, it gets to a point where you have to think about if running a 32 player game is even feasible on p2p
Even for half of that what we have there is overkill
Each extra client adds more bandwidth sent out to every other client, so it's compounding in a way
Exponential mostly
O(N^2) IIRC
But if you look at numbers from a 16 player game like Halo Reach
And those values are in bits
What do you mean
It says their minimum tickrate is 10hz
Well how often network communication happens
Some servers yeah, the majority are 64
What does UE4 use default
I know there's ServerTickRate or something in C++ but have not found much regarding it yet
Also do you have some kind of source where it says Halo & COD have their tickrates mentioned?
Well for Halo I just used the picture you linked, haha
For COD I just used general knowledge from around the internet to be honest, apparently in the upcoming game they're bumping it to 60 on dedicated servers so it was news
Apparently the remaster game runs at 10hz constant, that's bad
Hhmm
With Halo that was the minimum
I'm assuming it would go higher if it had the ability to do so
Also UE4's server tickrate
How does it corrolate with an actor's net update rate
silly question, but thoughts on away to send veriable from the client too the server's gamemode
since u cant call an rpc because i cant target the gamemode
oh i think i got it lmao
Hmm Squad and PUBG ahve to rely on dedicated servers so it seems
Yeah because it would totally hammer a listen server
alot going on
well aparently the owner of a controller is not the owner because a rpc to owner client is not firing ๐
wait is a controller not an actor?
anyone knows - does ue4 ping value measured through in-game replication channel or through system network ping command?
Ready to throw my self off a bridge, is there anything i can RPC to call on client from the gamemode OnPostLogin
Yes you can as stated by UE 4 itself
virtual void PostLogin(APlayerController* NewPlayer);```
You make an event in your player controller that fires on client
And call it on postlogin
yeah but u cant RPC to client on a controller
the controller is not owned
well not an owned actor
wha..? seriously, isn't it impossible because PostLogin called after successful login, and each controller determine each connected client
No, you definitely can @sweet spire
I'm not sure why they would say that, calling an RPC on PostLogin is fine @stone lintel
so far i haven't experienced any trouble calling RPC on PostLogin but maybe that's not the case for someone else ๐
Yeah, I have a tiny feeling a small failure got extrapolated to the whole thing with some misconceptions :p
Yeah but
Try and RPC fron client controller to server
It wont fire
iv tried
I think its because its not an owned actor?
I believe you that you couldn't get it to work, it happens to everyone.
But saying you can't call RPCs on a controller in general is just indefensibly false
It goes against the whole design system of ownership
i said u cant call an rpc to client on controller
well it wont fire
u mean like running on server or running on client?
Just because you couldn't get it to work doesn't mean you can't do it.
Then there's something wrong in how you're doing it
hmm
acording to the network compodium rpc to client only fire on owned actors right?
but controller is not an actor is it?
AController
hmm
Look at the prefix
no idea then
yup
event post login, new player controller
Call Custom event run on client
does not fire
Does event posses fire on client?
I believe so, can you show your post login BP
Looking further back
maybe its an issue with something else
gonna set breakpoint
Try printing before the switch as well
is that function inside the game mode?
NVM
btw, not sure in BP but in C++ Possess runs on server
as stated in here
* Handles attaching this controller to the specified pawn.
* Only runs on the network authority (where HasAuthority() returns true).
* @param InPawn The Pawn to be possessed.
* @see HasAuthority()
*/
UFUNCTION(BlueprintCallable, BlueprintAuthorityOnly, Category="Pawn", meta=(Keywords="set controller"))
virtual void Possess(APawn* InPawn); ```
Yeah, I don't even know why we're on the pawn here
fixed one issue
Thought we were on the controller
not letting go of the default pawn
Event posses appears to be running on the server but not client
let me check again
yup not running on client
Okay, I might've been wrong there yeah
We were talking about a controller RPC though?
same with the execute on owning client
This is in my papwn
it aint even going off in the actor**
not pawn
The pawn makes sense, it's probably not replicated to the client yet
Running the RPC on the controller should give you no problems though.
@sweet spire LOL you're BP screenshot is event Possessed from APawn meanwhile my snapshot is Possess from AController ๐
okey good luck
Cast to the custom controller from Player controller
to call an event replicated to owning client to print to screen
Nothing happened
No failed cast
does BP have a node something like ClientMessage? In c++ it's good for testing ClientRPC
Put the print before the RPC.
APlayerController::ClientMessage()
Put the print before the switch, that's what I meant
You're making the assumption that the switch is working exactly how you intend
When you're really just worrying about the RPC
didnt fire at all
Running on AChar fires on the server only, running on controller fires nothing.
Could you show your PC event one more time?
Check your logs to make sure of that
The event might be firing before your viewport is in-game, I'm not exactly sure how the flow runs
I have a client RPC to the controller working on PostLogin on my own project, though.
Not firing
Are you calling the parent PostLogin function before running the rest of your code?
Well there's my answer to that
Try calling the parent function as your first node
Not doing that can screw a lot of things up
Not sure what u mean by that
Right click on postlogin
Click add call to parent function
Call that first
Before anything else
like so?
Correct
Nothing in controller is firing
Okay, well I'm not really sure what to tell you at this point besides play around with it some more
I can assure you though: you can definitely call client RPCs on a PlayerController
That's not the issue here.
Well according to me in my project I can.
Try making it reliable
There is 3 controllers
in the debug object
In the clients debug drop down list for the controller there is 3.
and my client shouldnt be seeing the listen servers controller right?
Correct
how the heck is there 3 controllers D:
My default pawn class is spectator
hmmm
ima skip giving the pawn and possesing
see what happens if u just start as that pawn
same thing wth
3 controllers
Sounds like you might have bigger issues than just the RPC not firing
Client 1 two controllers
Yeah
Wait
When i join another level
or session
do i need to unload the map before?
It said it was in the pervious login map
Im using Join session
Can someone confirm if this is a bug or not, when i join the session with client, aparently the controller for the client is inside the pervious level they where at
Fixed
using delay node -.-
throws self off bridge
^^ been there all to often
Someone like to explain to me why if you just run a event normally, it runs on the client, but if u try and replicate it via run on client with a switch has authority, and run on remote(so that it just calls on the client) it wont run
I must have wrong understanding on run on client
If you're on the PlayerController, even on the client you're authority
So your RPC is working fine?
Iv got to the point now where there is so much stuff going on idk lmao
im gonna grab some water
then go through everything again
I was shoving it switch has auth, because it says when you RPC to run on owning client, it runs on the server too
It shouldn't be doing that, are you sure you're understanding your logging?
Client RPCs don't run on the server.
Multicasts run on all clients and the server, if that's maybe your misunderstanding
Lethal im having to use a delay you know after posses to make this work, do u think it be better if it ran off a blind event once the controller has possesed?
To save any future issues
To make what work?
Foe the rpc and bind to go off proper in mmogamemode, i had too put in a delay of 5 seconds
could prob be less
wondering if this could cause issues in future
That doesn't sound right, I have the RPC working fine with no delay
without the delay, it does not fire off
Maybe its binding the event but its avaliable?
testing
hmmm
i wonder if i have delay somewhere messing with it
you're running that after OnPossess?
It's hard, if adding a delay makes it work it was probably initializing something, not sure.
gonna go through all my char bp
It often happens while stuff is still replicating
Making sure some resource replicated correctly so you can go on is something I didn't quite figure out
not sure if it's your case, though
Hmm
why is it when i start up my game
My pawn gets possesed twice
i have print out that tells me when pawn is possesed
and it always fires twice
nvm fixed that bit
What was it?
no idea, just deleted it
OnPostLogin only gets called once
gonna assume that when the actor is spawned, it has a default controller
then the possess takes over it
Hum, could be it
the unpossess even happens when you close the game ๐
so it both might run when you don't expect
hmmm
needs at least 1 second i think
do u recon i should just do an event bind
When its possed
call the rest of the chain?
oh wait i wouldnt be able to bind the event lmao just realised
Any ideas?
might be able to do a check for is possessed and if it is see if the player controller that is incoming is the same as the "get owning controller"
If not then allow the new incoming controller to possess this pawn and do all the rest of the logic
I tried it with them just spawning in with the default pawn u are normally given
still same issue
Fixed
Jusy bound an event for on posses
just*
once its possesed then it binds and requests session key
Hopefully this should work now
ah ok so your haveing it called by the game mode settings. Usually I do a spawn system to have the character I want the player controller to have get created/ spawend in the level. Have the controller do a check to see if it already possess a pawn and if so destory that pawn and then possess the one that was just createc
created*
oh u can spawn controllers?
sorry for late reply, at work on my end
Hello Guys, I need help for join to another computer session over internet via IP, i try to open my friend computer using console command open "His IP" but not working ... I tried creating session with both LAN true on false but not works
Your ports open?
not spawnd controllers but they are added with an event on post login I think in the game mode
how i can check ? i set a rule for 7777 in windows firewall @sweet spire
dont have a project open in from of me to check
you need to have this route ports forward incoming traffic on 7777 to 127.0.0.1
@eager otter yeah it was game mode
@sweet spire I don't understand how i can do this, can you please describe or send any tutorial link..
How can I retrieve all local Player Controllers?
@wet oriole do you have access to your router?
I've an ADSL router
I mean, your friends router
u need to go google how to port foward
If he's the one hosting
Your friend should use port forwarding in its router for port 7777 into its internal IP
Then you'll join using its external ip
I'm searching to find how i can do the port forward...
it should be on both side or on host only ?
wth even with bind event waiting for it too be possesed same issue
ok, i'll try @dapper galleon
i can bind to the AChar right away
But if i bind straight away to the controller when it posses
its a no no
lmao
what are you binding?
just an event
Tell call back saying
"okay we are possesed"
oh u mean the otherone
A event too the controller
wait i think i might know what the issue is
okay the bind is fine
its when i call the request event to the client
It must be me calling it too fast
got a good idea how to fix this now ^^
okay nvm no i dont lmao
lol
CE request client session key is the issue
it calls an event on the client that calls the bind event on the server
Basically the server requests the client to send the information, and it calls an RPC to the server with the info that triggers the bind
Hum ok
Try without the bind, see if it works...
But you RPC back to the server, no?
oh shi ye
good point lmao
testing
nope
no difference
nope
its not even firing
Couldn't say what it is, just print every step and see where it is dying
yup ce request client session key
appears to be going off too fast
its not getting through too the client
Yeah its not getting called
even tho server is sending it
i set the event
to reliable
now its going off?
jfc
:p
So, what have we learned today
Don't make large-scale claims going against all documentation when presented with a single problem due to user error
:p

accurate picture of me rn
Anything that needs to happen in a flow needs to be reliable
gotcha
Otherwise they get overridden by other reliable events or variable replication or things like that
oops i forgot to send the player controller to the server with the session key ๐
@sweet spire @dapper galleon Thank you guys, I did port forward and now I can connect over internet and everything works, I want to know is it possible to do this process automatic i'm working on a project that only two player can join in a session
i cant answer that, i dont know enough about that type of stuff
I guess you would know beforehand what ports each system uses
Look at NAT punchthrough, if you use something like Steam it handles it for you automatically
That's how I'd say most P2P games do it
puts PC in DMZ
I can't pretend like I haven't done that before, hahaha
Bad idea though
thank you guys, i don't have enough information about multiplayer sessions and port handling , so if i use steam everything happened in background right ? (I didn't use steam before)
I believe Steam facilitates P2P connections even with firewalls, yes
I haven't used it personally either though
ok thanks
You'd still have to port forward, afaik.
I don't think so? You don't have to port forward to play most P2P games
That's what NAT punchthrough accomplishes
Oh, sorry, I'm just used to the server-client
You're fine haha, it's not something you usually do when just testing
In production though, that's usually what your game will be doing to connect with others without having the user do anything manually
actually I've another database that I'm trying to matchmaking base on player skills,and i've a question about this : what details (information) i should store in my database after a player create a session using steam?
I'd say that if you will be doing matchmaking on your own, implementing sessions is pretty easy
In a way that you shouldn't be worrying about Steam, idk
And I guess that it would be even easier
But you could also extend the Steam OSS? Not sure.
my worry now is the port forwarding problem, otherwise i could use player's ip to join them together , but now i've to use steam i think for joining sessions
I didn't check how Steam OnlineSubsystem works yet
is it possible to change 7777 to another open port by default in windows ? I think this solution can solve the port forwarding problem
Windows most likely isn't your issue, you also need to get past your router
hey guys, is there an easy way to reconnect to the session you are currently on?
@brittle sinew so i think i should use steam for joining sessions, and have a copy of session details in my database for matchmaking based on skills in my side , right ?
question: Are playerstates owned by remote clients or the server?
or what would be the best way to pass information/events from my GameMode/State to local clients widgets(atm stored in my playercontroller)
Ownership doesn't lie in a "client" or a "server", ownership is simply an actor
I believe the PlayerController owns the PlayerState.
Lethal all knowing let me query you
Lets say i have a Varest request object ver inside the Gamemode
thats used to send requests
is that dangerous?
What happens if two players trigger requests at the same time
I've never used the plugin myself, not really sure of the issue
Okay better question
If i have a ver inside my gamemode, and players when they login trigger it to carry some data
two players going in that the same time
could mix it up right?
A "ver"?
doesnt the Varest create a new variable for each request?
veriable
Variable
yes one of them
:p
Cant remember exactly the varest pplugins method of doing it, but my guess is that you could wrap into a function with local variables, that means each time you run the request, the saved variables are local and will be destroyed once the function stops executing
Well, dont think you have anything to fear
because the events will be parsing different requests
I just feel like if its not a local ver can two players write in too it at the same time?
But I would pass a reference to a playercontroller inside that event, so you know what playercontroller is associated
hmm, might be
I tried implementing it myself and I actually did that
The bind only fires
lo
if the server replies
I dont think blueprints are very good to make asynchronous responses to multiple requests
but Halcyon, any reason it should be in a gamemode?
i handle the client login and stuff like this, in the player state
because i want the server to compare the clients auth session key to the servers
Hmmm
playercontroller*
Well, run-on-server events will not notify your client
fuck rly
You'd need to use C++ and use UE_SERVER
fuq is the point in packaging dedicated servers then
might as well just have a command to run something dedicated
well
off to the player controller it goes lmao
unless..
I think your best bet is C++, especially if using credentials
dw im gonna end up rewrite most of this in future
If you wrap the relevant code in #if UE_SERVER it won't be packaged in normal builds
just gotta get the crappy wheels moving and understand it before i pop over to c++ fully
oh ๐ฎ
btw @brittle sinew, I am once again divin head first into C++! Need to extend the PlayerState to allow me to set the PlayerName... which for somereason is not available in BP
so i built it in a function, to bind to another function, got no idea if this is gonna work LOL