#multiplayer

1 messages ยท Page 332 of 1

native moth
#

yeah

#

thanks man! Guess it should be easy to reference info into my UI then

#

I really should get my head around how event dispatchers work, but so far with replication, having the pass on targets to them always seems to go wrong

sweet spire
#

Player session auth request is a function with local ver and so is player session auth, if i bind like this is should all be instances right?

sweet spire
#

I can confirm

#

This did not work

#

in the slighest

#

LOL

dapper galleon
#

Has anyone run in to the same problem? I'm just trying to set my online subsystem to return my game session implemention.

#

If anyone is interested I'll provide more information.

sweet spire
#

IT WORKS BOIS

#

I DID IT

brittle sinew
#

@dapper galleon I assume FOnlineSubsystemGameSessionStarfirePtr implements IOnlineSession?

dapper galleon
#

Yes, it does.

#

class ONLINESUBSYSTEMSTARFIRE_API FOnlineSubsystemGameSessionStarfire : public IOnlineSession

#

I'm also following what is exactly done in the Steam OSS

#

but for some reason it shows me that error

#

could be nothing, since my compiler actually compiles

brittle sinew
#

Oh

#

Yeah, you're fine

dapper galleon
#

but when I try to get the game session implementation it returns null ๐Ÿ˜ฆ

#

as in:
IOnlineSessionPtr Sessions = OnlineSub->GetSessionInterface();

Sessions.IsValid() -> false

#

I verified that i'm actually using my subsystem

#

It's really hard to say what it is

#

I was about to make a thread

#

heh

sweet spire
#

nvm sorted

polar bridge
#

having an odd issue, not sure if it's working as intended. i have a few maps, starting out with a menu map that can join other maps. i host a game, and have a list of players that i can display. i have another player join, and it all works fine, shows two players in the list. now, when that player who joined disconnects, their name stays in the list. i put some breakpoints in and found out that it's actually destroying the player state, then re-adding it when they join the new map (menu map). but my host who is already in an in-game map has that player state replicated to him, adding his name back up on the list of players. why is it adding a player's state from another map? little confused on that one

hasty adder
#

How's your list generated?

polar bridge
#

i was using begin play and end play on player state which cause some issues. i'm using game state instead now and it seems to work as expected

vital steeple
#

anyone ever had "isvalid" not work properly with playerstate?

#

it treats the playerstate as always being valid even though the later script complains about it being empty

#

it straight up just looks like isvalid doesnt work with playerstate at all

twin juniper
#

quick question, if i have a game which works relatively well on windows PC over the network, will I be able to just port/push that to MAC without changing any networking code? does the engine allow cross platform networking already built in?

hexed rain
#

QUESTION: I'm having trouble using the UDP sockets to communicate with a server on a public IP.

My understanding is that if a PC behind a router sends a UDP packet first to a server on a public IP, the server can answer to the PC by using the port given in the sender information, therefore telling the router that this packet is for this PC in the NAT.

Now what happens to me in practice is that the server does receive the packet all well and good, and seemingly manages to send a packet back, but the client never hears from it. A quick look through Wireshark indicates a very odd behaviour: The client sends an UDP packet, but somehow it receives a TCP packet with an ACK + PSH flag. Given its size, presumably containing the bits that were intended to be sent over UDP ๐Ÿค”

Could this be because, UE4's UDP socket implementation includes an automatic TCP ack (otherwise how could you have the information for "bits sent" in UDP?), and since the server answer happens on the same tick that it received the information, both packets are clumped together in one single answer?

#

(This last sentence is purely speculation, but if someone around here happens to know if that's the case or not, that'd be very much appreciated ;) - Otherwise I just can't explain how I could possibly receive a TCP packet from an UDP sender socket)

sweet spire
brittle sinew
#

Make a macro for it

native moth
#

Need some help here to understand what I am doing wrong.

I have some code in my gamemode that changes the state the game is currently in(waiting for players, counting down, inprogress etc.). That is all run on the Server because its important for gameplay, but I need that information(state) to get down the clients, so what I do is pass into my GameState and then run some Event Dispatchers inside multicast RPCs to notify my clients, however the Event Dispatchers are not executed on clients

#

the event binding never executes on the client

sweet spire
#

just so u know

#

stuff in gamemode

#

only runs in game mode

#

does not exsist in clients

native moth
#

yep, that is why I pass it to my GameState

wet oriole
native moth
#

Afaik GameStates are replicated and created on all clients

sweet spire
#

ah i thought that was your gamemde my bad

#

u tried ticking it as reliable

native moth
#

yeah

sweet spire
#

well im out of idea's

#

start prayin for lethal

#

if ur still stuck in abit il try and help you just in the middle of something ๐Ÿ˜‚

native moth
#

Could it be because going from Run on Server(GameMode) -> Multicast(GameState) doesnt work

#

Might need to do it like this: Run on Server(GameMode) -> Run on Server(GameState) -> Multicast(GameState)

brittle sinew
#

You shouldn't have to do that, no

#

Where is your binding occurring?

native moth
#

the binding is inside a widget on local clients

brittle sinew
#

Yeah but I mean in what event

native moth
#

I have a custom event called Init that I run after the playercontroller has been assigned a Pawn(onRep_Pawn - the one you helped me implement)

#

OnRep_Pawn -> Create widget -> Run Init inside widget

brittle sinew
#

Okay, I would try making sure your GameState is valid at that point

#

I wouldn't use pure casts when you're not absolutely sure it will succeed

#

I think it would error out if it failed, but you said the binding is never occurring so not sure

native moth
#

Is that because the GameState is not replicated in the beginning?

brittle sinew
#

Yeah, it might just not be replicated at that point

native moth
#

Is there any way to create listeners on when stuff is replicated?

#

like a GameState

#

Else I would need to make a timer/tick that checks if the GameState is valid and THEN bind the event and terminate the search

brittle sinew
#

I would just try checking if that's the issue at this point

#

It might get replicated first and I'm unaware of a set order

#

To answer your question though, I know you're not going to like this answer haha, it's simply using OnRep

#

It's not very flexible as you can't extend that into another class or into BP, but that's just pretty much how it works

native moth
#

I would love inside my UI that needs pawn reference and now gamestate references to just create listeners on when the playercontroller is assigned and replicated a pawn

#

instead of having to do variable assignments for the UI inside my playercontroller

#

Anyways, figured out the problem! The event dispatchers actually fired, but since the UI for my client is created AFTER the state has changed - it never hooked onto the dispatcher in time

#

once again, a bit of replication delay that fooled me

#

So I just need to get the curState inside my gamestate upon widget creation

brittle sinew
#

I would also create the binding though, because you're not guaranteed the GameState will get there first AFAIK

native moth
#

yeah, will get the curState and then create the binding because that is neeed later on to display information regarding new round starts etc.

#

Thanks for the help once again Lethal, owe ya a beer

sweet spire
#

alright someone tell me what AFAIK

#

i tend to nod and agree when i hear it

dapper galleon
#

AFAIK it means as far as I know

sweet spire
#

ahh gotcha

#

mfw maybe lobby level & aparently i dont have any controllers when u start on it

#

10/10

#

why this this happen to me all the time

#

I litrally made a blank game mode and controller, set them as game mode and controller in a bank world, > start it up no one has controllers mfw

#

restarted engine
fixed

#

.>

#

Jesus what is going on with my engine

#

Basic add to view port is not even working

#

First 3 work

#

but the umg does not get added

#

i am 100% confused

#

restarts engine again

#

level blueprint begin play not firing

vivid fjord
#

Hi, I'm having a problem with DOREPLIFETIME, I'm trying to call it on a weapon I have it included unrealnetwork.h in my games .h however it's not seeing it, anyone expereince this bug?

brittle sinew
#

I'm going to go out on a limb and say it's probably not a bug :p

#

What error are you getting, and can you share the code? @vivid fjord

vivid fjord
#

so this is in the .cpp

void AWeapon::GetLifetimeReplicatedProps(TArray<FLifetimeProperty>& OutLifeTimeProps) const
{
Super::GetLifetimeReplicatedProps(OutLifeTimeProps);
DOREPLIFETIME(AWeapon, OutLifeTimeProps);

}

#

and the DOREPLIFETIME is not working, VisualStudio doesnt see it

brittle sinew
#

Well I'll stop you right there, the second parameter shouldn't be OutLifeTimeProps, it should be the name of your weapon variable

#

If Intellisense doesn't see it that doesn't mean much, it misses a lot :p

vivid fjord
#

hmm ok one second will test

brittle sinew
#

And wait, I'm confused

#

You're within AWeapon trying to replicate AWeapon?

#

That's not really how it works

vivid fjord
#

yeah, Im following a tutorial, mabe its not a good one

brittle sinew
#

Actually wait, never mind, as long as you're replicating variables that's fine

#

I wasn't thinking, sorry

vivid fjord
#

no worries I appreciate the help I'm stabbing in the dark ๐Ÿ˜ƒ

#

network is alllll new to me

#

with UE4 at least

brittle sinew
#

Yeah, it's a different mindset for sure

#

What variable are you trying to replicate on the weapon?

#

And could you link to the tutorial by chance? I just want to check it out

vivid fjord
#

mmm I can't sorry it's a patreon thing

brittle sinew
#

Ah, okay

#

It tells you to replicate OutLifeTimeProps?

#

That seems really odd

vivid fjord
#

yeah im just following along so /shrug

sweet spire
#

is it worth putting a switch auth node in front of a event dispatcher thats only for HUD? so the server does not waste its time calling it

past pawn
#

hello people :)
I'm having a strange problem, I think... On the client side, when I press the GrabRight button, the string "Pressed Grab Right" gets printed. Moving on, once the "GripState" is changed, the OnRepGripState function is supposedly triggered on the client, but it's not printing "OnRep_GripState started". Does anyone have any ideia why?

brittle sinew
#

Are you sure the RPC is actually making it to the server?

#

@past pawn

#

There could be a multitude of reasons for it if not, but figuring out the actual issue is the first step

past pawn
#

yes, I can see in the log that it does

#

reach the server

wary willow
#

@past pawn is there an actual change to your Grip State?

past pawn
#

yes, it's default value is open, and I only change it when I press that button. weirdly enough, it works when the grip object overlaps something (I change "GripState" there), but not if I press the button

brittle sinew
#

So just to confirm (sorry), you're printing within the server RPC itself and it's being fired?

#

Because with your additional statement it sounds even more like the RPC isn't getting to the server

past pawn
#

apparently it looks like it

brittle sinew
#

I...don't know what that means

past pawn
#

regarding the first question, no.

brittle sinew
#

Okay, so you didn't confirm the RPC is being fired on the server?

past pawn
#

I confirm that the RPC is not firing on the server

#

and the custom event is to run on server

brittle sinew
#

Okay. I was just kind of confused since you said "yes, I can see in the log that it does reach the server"

past pawn
#

i'm sorry, it seamed like it, but then I put a print on the RPC and couldn't see it on the log

brittle sinew
#

You're fine, just politely it's best to confirm things rather than assume when debugging

#

Okay, so now we need to find out why the server RPC isn't working.

#

When you spawn this actor, do you set the owner to your PlayerController?

past pawn
#

like if I possess the actor? I have a pawn that is possessed, and then he spawns this actor

#

it's a vr game, don't know if it matters

brittle sinew
#

Oh, I should've realized this was a pawn, oops.

#

Or is this...is this the pawn itself or an actor that the pawn spawns?

#

Sorry, I just am not sure haha

past pawn
#

the BPMCRH is an actor that the pawn spawns

brittle sinew
#

And we're on the BPMCRH I assume?

wary willow
#

Oh. No

#

But that reference may be null

#

Are you confirming that you are getting a solid reference to that actor @past pawn?

brittle sinew
#

I get it, haha, just confused about the naming

#

Could you show how you're spawning it as well?

wary willow
#

Also. Just for kicks, the actor is replicated right?

brittle sinew
#

I'm fairly sure the issue is they're not setting the owner correctly

#

But just trying to see what issues may come up along the way

past pawn
#

"And we're on the BPMCRH I assume?" yes we are (in picture 2 and 3, picture one is the pawn)
"But that reference may be null" I've tested it, it's a valid one

#

I'll post the spawning

#

and the actor is replicated

brittle sinew
#

Okay. What is going into the owner pin?

past pawn
#

self

brittle sinew
#

Alright, try using "Get Controller" on that rather than the pawn...I'm not 100% sure it will work but it will eliminate that as a potential source of the problem.

#

If this script is on "Begin Play", you'll have to move it to "Possessed" or else it will be called too soon

#

Also, is the RPC marked as reliable?

past pawn
#

i'll try it

#

it is marked as reliable

#

still not working. sorry to take some time, but I'm testing it on VR and I need to build the game every time

brittle sinew
#

Alright, that's fine. So just to confirm we're on the same page: you have confirmed the client is making the call to the server RPC, but you've also confirmed the server RPC is not being received?

#

If we've confirmed it's not an ownership issue, I'm not really sure what it could be

past pawn
#

exactly

#

yep, this was supposed to be a simple thing

wary willow
#

You don't need to build everytime

#

You just need to be smart about what you need to do when doing MP with VR in UE4

#

Especially since all you're doing is debugging an input

#

If I had I build everytime I had to test MP for my VR game...I would have probably just given up

past pawn
#

but running 2 instances of the game on the same pc is not representative, how do you do it then?

wary willow
#

Lol

#

You cheat the system

#

Just like you should

#

You build a "FAKE" VR character

#

That gets spawned when VR HMD is not in use

#

As long as your VR pawn is child of Fake, everything that works in Fake, works on Real

#

Ggwp

#

$99999 for that cheat please

#

But seriously. This will only work for so much, but trust me...saved me countless hours.

past pawn
#

yeah, that's a good trick, but if you really need to check if everything is replicated correctly (which is what I'm doing) that approach wouldn't work. but if you just need to test interaction, sure ๐Ÿ˜ƒ

wary willow
#

?

#

Actually...it works perfectly to check for proper replication

#

As long as you have a decent way to debug

past pawn
#

alright, I'll give it a try then, thank you very much

wary willow
#

:)

sweet spire
#

ready to blow my brains out over json requests, while php script runs fine until echo json_encode and decides to send nothing back from the bind results @_@

brittle sinew
#

ready to blow my brains out over json requests, while php script runs fine until echo jsonencode and decides to send nothing back from the bind results @@

#

Fixed it for you

sweet spire
#

LOL

#

ye

#

echo json_encode(array('status'=>"OK", 'charname'=>$row_username));

#

Returns me

#

no status value

#

but returns char name

#

MAKES NO SENSE

#

works fine in other things

brittle sinew
#

Dunno, the water is warm on the Node side of things ๐Ÿ˜‰

sweet spire
#

screw u lethal

#

omg

brittle sinew
#

JSON is nice in JS because it is JS :p

sweet spire
#

the examples i have to work from are awful

#

sometimes they have spaces in things

#

sometimes they dont

#

sometimes u have two spaces

#

just randomly

#

so annoying

#

WHat if its a bug with the va rast plugin

#

It works fine on every other .php

#

but it wont return any value for status

#

0 sense made

brittle sinew
#

Could you show your BP?

sweet spire
#

it works fine

#

and i can confirm that as im getting it too add data to the table

#

this is the bp section for it too print

#

There must be something wrong with the structure

brittle sinew
#

Can you print the whole response?

#

Never worked with the plugin, I don't know

sweet spire
#

iv been adding sections on and on

#

printing it

#

but the status is not coming through

#

hmm

#

gonna restart my editor

#

Yeah

#

its my structure in the php

#

i got two things to print now

#

echo json_encode(array('status'=>'okay', 'charname'=>$row_username, 'level'=>$row_Level 'exp'=>$row_Exp, 'frame'=>$row_Frame, 'map'=>$row_Map, 'x'=>$row_PosX, 'y'=>$row_PosY, 'z'=>$row_PosZ, 'currency'=>$row_currency, 'equipment'=>$row_Equipment, 'inventory'=>$row_Inventory));

#

looks the same to me though Q_Q

#

gonna re write it

#

incase something weird with notepad+++

brittle sinew
#

You don't know it's the PHP, it could be the plugin doing something weird with a field named status or something like that

sweet spire
#

hmmm true

#

well i got status and name to return

#

after rewriting it in php

brittle sinew
#

Like I said, making assumptions is what kills debugging :p

sweet spire
#

but when i try more its going poof

#

omg

#

true

#

so

#

echo json_encode(array('status'=>'okay', 'charname'=>$row_username)
works fine but
echo json_encode(array('status'=>'okay', 'charname'=>$row_username, 'level'=>$row_Level 'exp'=>$row_Exp, 'frame'=>$row_Frame));
returns nothing

brittle sinew
#

No comma after the level field?

sweet spire
#

oh..

#

LOL

#

must of been while i was replacing all the spaces

#

still not working dammit

#

after rewriting it all

#

it works

#

not even gonna ask

#

@brittle sinew did u see my tag in general?

vital steeple
#

anyone know how to get uobjects to replicate? i assigned an actor component thats replicated to the outer but it doesnt seem to support it. i keep getting fnetguidcache::supportsobject *uobjectname NOT supported

brittle sinew
#

@sweet spire yeah, but I was helping someone and had no idea

sweet spire
#

its fixed after deleted the maps but like wth man

#

Starting any map the first instance of that client was playing the starter content map music

#

lmao

sweet spire
#

is 6 int 32's too much for 1 inventory slot?
Say u have 30 slots, your gonna be sending 840's bytes for it :/

#

when ue4 default is limited to 10,000 a sec right

wary willow
#

@sweet spire where did you get that number from?

sweet spire
#

its default settings isent it

#

10kb/sec

pallid mesa
fossil silo
#

hey guys, if I am on server, and I get all actors of class on the characters that each connected player has, doing stuff to that will replicate out to everyone, correct? since I would be adjusting the server's version of it?

brittle sinew
#

If you're affecting replicated variables, yes

#

Otherwise you'd need to use a multicast

fossil silo
#

gotcha

#

what if im affecting components?

#

im adjusting the camera the players see thru

brittle sinew
#

I'd think it's the same thing, just make sure they're replicated

fossil silo
#

got it

#

ty ๐Ÿ˜ƒ

vital steeple
#

is this exposed to BP?

#

i have an array of uobjects that, if i replicate, i get an fnetguidcahce error

#

google keeps pointing me back to that article

vagrant drum
#

if anyone here is using photon, is it possible to test multiplayer within the editor?

#

(just by changing the number of players)

ripe cypress
#

Does anyone know if the Event Hit runs on server by default or not in the actor blueprint

fossil spoke
trail dragon
#

Is there a function callback for determining when the IsLocallyControlled state changes? I know Pawns don't immediately report false in multiplayer (ie: if checked in BeginPlay) but is there a reliable time to check?

civic belfry
#

Is there some kind of bug or known issue where a blueprint full of child blueprints inserted into the level are 3x bigger larger than they should be if enabling dedicated server?

#

driving me absolutely mad

knotty mango
#

Hi all, does anybody know how to get world composition working in multiplayer without using a dedicated server ?

#

Clients are falling through tiles the server isn't seeing, even thought 'client side loading ' is ticked

fossil spoke
#

@civic belfry Not sure if its been documented but ive absolutely run into that issue. Mainly with Physics Actors. Cant remember how i solved it though it was an long time ago.

#

Pretty ssure i literally manually set their scale back to default OnBeginPlay

civic belfry
#

Hah! Wonderful. It's the weirdest thing. I can watch it go through each child bp and scale it up one at a time until it's done with all of them. Weird bug!

slim holly
#

Im very confused about using playerstarts

#

how do you assign one?

#

or should I make my own Playerstart class?

#

and is that helpful in anyway?

dapper galleon
#

@slim holly There's a method to override in the Game Mode that selects player starts

#

It basically just selects every actor of class "PlayerStart"

#

and do some logic to select the correct spawn

slim holly
#

so no actual benefit from using regular start vs manually determining the start

dapper galleon
#

what kind of benefit?

#

if you need a different behavior from the default start spawn behavior, you could do it

#

you could manually spawn, but I'd recommend staying in the engine flow

slim holly
#

speaking of manually starting

#

should I store player character equipment classes in playerstate or controller?

#

considering I need to pull that information every time I spawn a new character

dapper galleon
#

Well, I'd say the only difference is that the player state is replicated to every client

#

I'd then think if I need every client to know other players equipament

#

If I remember this would be the essential difference between choosing playerstate or controller

#

I'd say PlayerState, since it was made to hold information about the player

undone crane
#

I've got more info (anim blueprint and C++ code) if needed

slim holly
#

other players will know about the equipment since they consist mostly of replicated actors

#

attached to the player

#

@undone crane your delta rotation math is off, not much more to it

undone crane
#

it works server-side, but this is what the client sees when looking at the server player

#

server player animates just fine, and the remote player animates just fine on the server

slim holly
#

control rotation replication issue then

undone crane
#

so where did I go wrong?

#

(btw, thanks for even looking at it this much; I struck out on the IRC and my twitter contacts)

slim holly
#

I honestly have no idea how control rotation even works

#

since I dont use it

#

but It's related to controller, which does not exist on clients

#

apart from their own controller

undone crane
#

I see

#

so how would you do it? get the pawn's forward vector?

#

wait, I already do that

#

control rotation is where the player is aiming

slim holly
#

you need to save the control rotation to the pawn on server end

#

then replicate it

#

and use it to drive the aim offset

undone crane
#

makes sense, thanks so much! I'll give that a try

slim holly
#

hmm, Owner relevancy stops weapons from replicating ๐Ÿค”

#

Controller being the owner

twin juniper
#

hey guys, i have a short lag time every once in a while when the player does something and when it gets added to my database, or changed in database. The strange thing is... its doesnt seem to be the database itself, it seems to be the actual client/server process. I left click, yet the event isnt fired for like 5 sometimes takes 30 seconds.

#

anyone have this b4

undone crane
#

you might be too dependent on a replicated variable when it's something that should be done locally instead

#

oh, 5-30 seconds is way too long regardless

#

try logging it on the server and logging it on the client and see when it gets from A to B

twin juniper
#

its inconsistent though

#

lke

#

it doesnt always lag

#

sometimes the response time is instantanious

undone crane
#

sometimes I get lag in the editor when I don't in a packaged project; are you testing in a packaged project?

twin juniper
#

uh

#

sometimes it happens i both i think

undone crane
#

I'm not sure then, sorry

undone crane
#

@slim holly I'm still seeing the same problem after replicating the control rotation.

slim holly
#

hmm

#

are you sure the aimspace is driven by delta rotator value?

undone crane
slim holly
#

and that delta values are in correct order

undone crane
#

your control rotation replication still makes sense given that the character freaks out differently depending on which way he's facing, but he still freaks out no matter what

#

I shouldn't have to replicate actor rotation on the server too, should I?

#

also, I'm not adding the deltas; I'm setting the absolute pitch and yaw...in spite of the problems I'm having right now, setting the deltas seems like it would be prone to desyncing

slim holly
#

no it's a delta rotation between character and control rotation, which is then clamped to -90 to 90 in pitch and yaw

undone crane
#

I just threw out my code and copied a different tutorial verbatum, translating from blueprints to C++. Hopefully that's enough to get the job done. Changing a non-networked tutorial into a networked one just became a mess.

undone crane
#

ugh, this other tutorial has the problem I had before, where it has flawless replication, but the client is waiting for the server to respond before it updates the pitch/yaw

#

I'll try again after lunch

sweet spire
#

Thoughts on things like 2 floats vs a struct of 2 floats for things like Min & max damage

undone crane
#

@slim holly Got it working. The solution is: pitch and yaw logic in the input sections of the character CPP file. Every tick, update the pitch/yaw on server. Don't update or read from the server while processing the input.

past totem
#

Dont we all love our fans? xD

low sonnet
#

heheh ๐Ÿ˜„ I guess there was a time where we all thought like that, where multiplayer is some sort of module you can just add in to a game. I know I found that out the hard way.

past totem
#

xD

severe widget
#

#define USE_GOOD_NETCODE 1

brittle sinew
#

Wait I don't use C++ can I use that in BP?

past totem
#

lol

twin juniper
#

does level streaming work in multiplayer

wary willow
#

@twin juniper Yes it does

twin juniper
#

@wary willow can i chop up the landscape into separate chunks

#

from what ive seen i havent seen it been used on landscapes

wary willow
#

Umm

twin juniper
#

ive only seen it being used

#

on simple

wary willow
#

I think you'd need world composition for that?

twin juniper
#

static meshes

wary willow
#

I haven't played around with that though

twin juniper
#

world composition is kind of useless

#

its literally

wary willow
#

Haha

twin juniper
#

just...

#

photoshop layers

#

thats it

#

for ur meshes

wary willow
#

Like I said, I haven't played around with it

#

BUt, I think a few people on here were talking about realignment

#

All I know is that level streaming works

#

But it works for everyone as soon as anyone loads it

#

Unless you do a locally controlled check

twin juniper
#

Lol.

wary willow
#

Other than that

twin juniper
#

i havent really seen it be useful on landscapes

wary willow
#

I don't know much, I've rarely used streaming levels in MP

twin juniper
#

like

wary willow
#

(if ever)

twin juniper
#

i dont think it would be

#

what i want to know

#

is what ARK does

#

i know they separate it

wary willow
#

Yes

twin juniper
#

into separate layers

#

using owrld compomsition

wary willow
#

they use world comp I am sure

twin juniper
#

but i dont even think it makes that big of a difference

#

like all it does

#

is make the map load faster

#

it doesnt improve gameplay performance

wary willow
#

but anyway

#

look at this

twin juniper
#

from what i can tell

wary willow
twin juniper
#

yea

#

ive seen that

#

its literally

#

photoshop layers

#

for foliage

#

only way i see it being useful

#

is basically

#

if you level stream certain trees

#

as you enter the zones

#

or something like that

#

but i dont even think it would improve performance much

wary willow
#

wait wtf

#

Ark is UE4.5.1

#

Wonder why I never noticed that

twin juniper
#

ya

#

its

#

rly fucking old

wary willow
#

@twin juniper Anyway

#

Best bet is to just play around with it

#

See what you can use it for

twin juniper
#

i feel like every single ue4 training video is 1 hour or longer because they get paid per hour

#

LOL

civic belfry
#

question - I'm wondering if all of my cubes/pods should be in one main BP or simply arranged in the level - there are hundreds of pods and using a main BP full of child BPs has been pretty buggy... but I also don't want to go about it in an obviously wrong way

#

50-100 players start out in the outer layer compartments of an 8x8x8 cube. The outer compartments will either shed off and detach/float away, or will move around like an elevator - vertically and horizontally.

After the first round, the entire outer layer of cubes will be gone, leaving a 6x6x6 cube of pods that will move and detach/destruct periodically, forcing players to find/fight their way inward to the final 4x4x4 arena at the center of the cube.

#

so would it be advisable to make this beast directly in the level? or to have a main BP that holds hundreds of child BPs? It's really big

gaunt kestrel
#

When i fire a server event from a construction script on my character it makes my 2 players not connect

civic belfry
#

I fixed the issue where crap starts growing to 3x its size by disabling "Component repliactes on static meshes" for anyone keeping up

civic belfry
#

@fossil spoke - see above!!

fossil spoke
#

Interesting. Ty

civic belfry
#

I realized it was something I was doing when I rebuilt the whole thing in the level, eliminating the parent BP and the same madness ensued

fossil spoke
#

Its such an odd issue though. I was going to investigate the source code but i didnt have time and then i just plain forgot about it lol

cursive iris
#

So it's my first time attempting to make a Dedicated Server Build. Assuming it succeeds... what map does the server go into? Will it go into my main menu?

slim holly
#

oh my brain

#

why does network smoothing work with jumping and flying, but forbid if you try to use direct velocity manipulation

slim holly
#

also it doesn't say that OnJumped & OnLanded only run on server

fossil spoke
#

@cursive iris You can define the Server map settings in your Project Settings.

cursive iris
#

Ah... cool. Does packaging the project automatically make a server executable too? or do I have to do it from VS every time?

#

(source build is still building from since the time I asked my first question, so I'm just waiting for the compile)

scenic bronze
#

Hey so at the very start of our game, a player has to log-in and gets sent a bunch of stuff from our server (username, level, friendslist data), is it best to store this stuff in the gameinstance class or is there some sort of OnlinePlayerProfile class I should be extending?

fossil spoke
#

@cursive iris You only have to build the server exe if you change any code.

gaunt kestrel
#

Wow okay the server was spawning in an additional sword

#

Welp ok that problem is fixed, but my AttachToComponent isnt replicating on my client

#

@scenic bronze it can be stored in game mode or the player controller

scenic bronze
#

@gaunt kestrel ill take a look into gamemode, thanks man ๐Ÿ˜ƒ

gaunt kestrel
#

Not sure if you wanted the players to save their data for next time they log in

past pawn
#

@brittle sinew @wary willow remember the problem I had 2 days ago? the one with the client calling the server function but the server never detected that call?
it was really an owner issue. so apparently we needed to send the owner of the client to the server when we spawn the actor in the server (because we need to call a function from this actor, and this function runs on the server), so thank you for all your help! ๐Ÿ˜„

cursive iris
#

@fossil spoke so... if I have multiple maps and multiple game modes on my dedicated server... is there a way to set which one runs via command line parameters?

fossil spoke
#

Sure you can. Check out the Epic documentation on commandline usage. It has all that stuff there and more useful info as well.

cursive iris
#

ah... cool. so this step where I set the default map for the server is optional as long as I know the commands

#

thanks!

cursive iris
#

Finally managed to build. I ran the server with the -log parameter. It can't seem to find my initial map and my game mode. Any ideas?

cursive iris
#

Ah... hmm... I seem to need to type in the whole GameMode.GameMode_C in the command prompt. :\

#

How does UT assign simpler names to their game modes? Don't they just use ?game=CTF or something?

slim holly
#

I think UE4 supports prefixes for loading gamemodes

cursive iris
#

Where do I assign those prefixes?

slim holly
#

I'm no sure, I remember reading about it somewhere

cursive iris
#

anyone know what that's called so it'll be easier to google? haha

chrome bay
#

@cursive iris It's in project setting somewhere

#

Under Maps and Modes probably

wary willow
#

@past pawn cool. I think that was something Lethal mentioned early on

plain flume
#

If i Construct an UObject from class in Blueprints. It Doesn't have a Destroy() function. Is there no way to remove it after i'm done?

#

Example like this

#

or will it be automatically garbace collected?

rare cloud
#

@plain flume, it will be garbage collected

#

but it's look strange to create an object each time to save something to database

#

it will be a better design if you create an instance on your game instance and you get it and make stuff

vital steeple
#

anyone have problems with uobject references not replicating?

chrome bay
#

UObjects don't replicate, there's ya problem

rare cloud
#

@vital steeple, @chrome bay, look at ReplicateSubobject function

#

but yeah if it's RPC you can't from my own knowledge

chrome bay
#

Yeah the UObject needs to be replicated via an Actor I believe, it's not that easy to setup generic UObject replication

#

Actor Component is often the path of least resistance

vital steeple
#

yeah so i have a component on an actor that has an array of uobjects

#

array is replicated

#

if i print the array it pops an error but it does "see" that there are uobjects (the print will grow as i add more uobjects, but the printed content is just blank)

#

so it just looks like the references themselves dont replicate

plain flume
#

@rare cloud problem is that for some reason i cannot create variable from it. Perhaps because it is a UObject created in C

#

It works, but not sure if it starts to cause issues

#

Maybe i can create UObject ref in beginning and cast it later

twin juniper
#

@plain flume literally every time i see people talking about databases on here

#

they are telling u the wrong way

#

setup a VM on vmware, or virtualbox

#

install ubuntu or debian

#

then install postgresql, or mariadb, or mysql

#

then it the database to only allow access from within your local network

#

then call your functions directly

#

to the database

#

why are you going through a Http request?

#

and put all your SQL function calls inside of Server RPCs

#

and put the #if WITH_SERVER_CODE macro

#

inside of your rpc function Implementation

#

so it will cull out all of the code on the client

#

that is the proper workflow

brittle sinew
#

You heard it here folks, that's the right way

twin juniper
#

i mean thats just my opinion

#

lol

#

do you think im wrong?

brittle sinew
#

No, when you say "that is the proper workflow" you're not voicing it as your opinion

#

You're voicing it as fact

twin juniper
#

yeah ik

#

but i do genuinely believe

#

that is the proper workflow

#

but i can see if people may disagree

brittle sinew
#

What if you have multiple servers on different physical machines that need to access a central database?

twin juniper
#

that's not difficult, most dbs will allow you to allow access to specific IPs

#

just make sure its a static ip

brittle sinew
#

That's not scalable at all though, it makes it difficult to interact with new instances

twin juniper
#

i mean both using a REST service, or my method will both work

#

yea

#

u dont even have to limit the IPs though

#

simply putting the #if WITH_SERVER_CODE will cull out any login information

brittle sinew
#

That's a really bad idea though, you can do way more robust authentication via some sort of web API than a simple user+pass in a DB

#

Having a public-facing DB, even with authentication, is just not a very good idea

twin juniper
#

yeah

#

personally i dont use any of those lol

#

im using what conan exiles uses

plain flume
#

What good is local database when im not running it in my house :S?

twin juniper
#

@plain flume you can set it up for migration

#

I honestly think (what i regret not doing) is that everyone should create a schema for all of the tables the db will need to generate in one file

#

then you can create separate version for each diff database software

#

like separate query syntax

#

i regret NOT doing this lol

#

in my next project im totes going to do that

modern dome
#

Do I need to use Sessions for Multiplayer?

brittle sinew
#

No, they just assist in creating matches and things along that line

#

You'd be fine in rolling your own matchmaking and session creation, though not sure how much I can recommend that :p

modern dome
#

I see thanks

#

Another Question:
How exactly do Event Dispatchers work in Multiplayer?

#

If I call an Event Dispatcher, will it affect the Clients?

brittle sinew
#

I don't believe they are replicated, no

#

If you want something to fire on all clients, multicast it on a relevant replicated actor

modern dome
#

I see. Thanks ๐Ÿ˜ƒ

twin juniper
#

whenever i click "generate proxy meshes" on hlod window

#

it just lags the shit out

#

and doesnt do shit

#

it even lags visual studio

jolly siren
#

is there anything special with the OnRep parameter that passes in the previous replicated value of a property? I'm replicating a TArray of ints to COND_OwnerOnly. And the previous value parameter is working properly sometimes but not others. If I keep getting kills/assists by the same players it works fine. In other words Player1 kills Player3. Player2 assists. Then Player1 kills Player3. Player2 assists. So forth it works.

But as soon as I do Player2 kills Player3. Player1 assists my PreviousNumMedals turns to [0,0] for both players. Instead of the actual previous replicated value.

#

I guess I'll dig deeper into the previous value OnRep code

brittle sinew
#

Don't quote me on this, but I think if you declare the OnRep function with a single parameter of the type it gets filled with the previous parameter

jolly siren
#

Right, that's what I'm doing. But it's acting strange

brittle sinew
#

Oh, I didn't really pick up on that reading quickly through it

#

D:

jolly siren
#

yeah my description wasn't the best

#
UPROPERTY(Transient, ReplicatedUsing = OnRep_NumMedals)
TArray<int32> NumMedals;

UFUNCTION()
void OnRep_NumMedals(TArray<int32> PreviousNumMedals);

DOREPLIFETIME_CONDITION(AFPSPlayerState, NumMedals, COND_OwnerOnly);```
#

PreviousNumMedals comes over with [0,0] values sometimes when it shouldn't be

#

took COND_OwnerOnly out of the equation and it still does it; so not that

twin juniper
#

so in multiplayer, if i want to have the player load the map one chunk at a time using level streaming...

#

should i set the visibility to off for all layer levels by default

#

then let the client load them?

#

i just worry what that would mean for the server

plain flume
#

I think level streamimg is always to loaded to everybody, no matter who activate it

modern dome
#

The Values of (Actor) Arrays are replicated when I set the Array to replicated, right?

jolly siren
#

I guess I'll write my own shadow logic for this onrep stuff because the ootb is at least bugged for arrays

buoyant hollow
#

So i have this code in my Character

'''UFUNCTION(reliable, server, WithValidation)
void UseItem();'''

and it basically spawns a particle effect when near a particular item. However, it's only spawning on the actual server itself and not being replicated to the clients. Here is more code implementation.

#

Sorry here's the code

#
UFUNCTION(reliable, server, WithValidation)
void UseItem();

void AShooterCharacter::UseItem_Implementation()
{
    if (Role < ROLE_Authority)
    {
        return;
    }

    UE_LOG(LogOnline, Warning, TEXT("Calling on server!"));

    /***Code removed that grabs the overlapping actors in a loop ***//


        AHiddenFire* const TestPickup = Cast<AHiddenFire>(CollectedActors[iCollected]);
        // If the cast is successful and the pickup is valid and active 
        if (TestPickup && !TestPickup->isActive)
        {

            UE_LOG(LogOnline, Warning, TEXT("STARTED PICKUP!!"));
            // Deactivate the pickup 
            TestPickup->isActive = true;
            TestPickup->UseTheItem();
        }
    

}


void AHiddenFire::UseTheItem()
{
    
        UGameplayStatics::SpawnEmitterAtLocation(this, FireSpawnFX, GetActorLocation(), GetActorRotation());

    }
}```
#

i thought spawning a particle effect on the server would work on the clients?

frank tinsel
#

Question about proper server - client replication methods: what is the best way for me to handle personal variables such as thirst, hunger, stamina, etc.? Right now, those are all handled within my player character, but I'm having a tough time figuring out how to separate them between the server character and the client character.

inner iris
#

@buoyant hollow you have to use a multicast RPC for the other clients to see it. Otherwise only the server will know about it.

#

@frank tinsel it depends- do other clients need to know about these values? If not but they are gameplay important, then simply replicate them and make changes to their values using RPCs or with authority guarded logic.

buoyant hollow
#

So @inner iris I did try that. I set the UseItem to Netmulticast and then removed the if (Role < ROLE_Authority) code from the UseItem_Implementation and it worked on just the client that called it.

#

if I left the if (Role < ROLE_Authority) in there, it was never called at all

#

and spawned on no clients

frank tinsel
#

@inner iris Well, the clients shouldn't need to know about the values unless I decide to show player health? Other than that, I do have a slowdown attached to the stamina if they deplete their stamina fully. That should be okay for replication, yes?

inner iris
#

@buoyant hollow Sorry I'm not very familiar with C++ but try a more isolated example such as pressing a key and spawning the particles- it's seems you have other logic here that makes it harder to pinpoint- if it works with the barebones example then add the other logic after. Maybe someone else with C++ knowledge can help you out but the first example looked like it was only running on server and not being replicated to the other clients as intended.

buoyant hollow
#

Thanks @inner iris

inner iris
#

@frank tinsel The clients would generally only need to know the health of the player perhaps after the player kills them, so they could tell how much damage they dealt but they wouldn't need to know it most of the time (unless you have a specific health UI widget over each player or something). as for the slowdown, if it's purely changing player speed then all you have to do is set the new walk speed on the server and it'll work as intended as the character movement component is replicated.

frank tinsel
#

@inner iris awesome! Thank you

chrome bay
#

@jolly siren you're probably running into an issue I've discovered recently

#

TArray size is replicated separately from it's elements - so sometimes the OnRep will trigger because the size has updated, but the elements haven't come through yet.

#

I've had this problem with replicated arrays containing pointers to replicated objects.

#

if the array comes through first, the OnRep fires and some array items might be nullptr

#

No easy way around it I've found other than to just guard against it

#

late reply ftw

brittle sinew
#

@buoyant hollow when you tried making the RPC multicast, were you calling it from the server or client?

#

Multicast RPCs should only be called from the server...if you call it from a client you get the functionality you described: it only runs locally on that client

wicked otter
#

I'm pretty new to UE4, so I'm sure I'm missing something obvious... But I seem to be running into an issue where characters placed into the world via dragging from the asset tab appear to hover on clients.

#

This is just the 3rd person starter, and I've dragged an extra player into the air above that point. On the server, it falls to the ground correctly, however other clients see it fall but stop short of the ground.

lilac lotus
#

So I started doing Multiplayer today, I kinda get it on a basic level.. I can't find all info though. If I make a Function Execute on Server, does that mean the Variables in that Function are covered? (In the case that I don't reuse them anywhere else)

brittle sinew
#

Do you mean the parameters fed into that function?

lilac lotus
#

Yes

brittle sinew
#

Well, it depends on what you mean by "covered" really

#

You can pass replicated objects as a parameter and it will resolve itself on the other side fine, yes

lilac lotus
#

I've replicated all functions that affects suspension and gravity etc inside my BP but when I try playing with a dedicated server i still have jitter, a very small jitter, but it needs to go

brittle sinew
#

Well, you may have to implement some sort of network smoothing, yeah. Especially if you're both replicating movement and doing stuff locally

#

If you have two movements fighting like that, things might get jittery ๐Ÿ˜„

lilac lotus
#

I understand, it's really hard in the start to decide what needs replicating and what not. Right now I get by because of logic alone heh

#

Right now I'm trying to figure out what the best way to test the Multiplayer would be, without having a second computer that is. Also if it might be better to dive into cpp Replication instead of continuing BP, since I will do such a Transition sooner or later ๐Ÿ˜…

slim holly
#

how would one go about doing dynamic jumpZ force ๐Ÿค”

#

Im running into jittering issue because the force value is different in server and client

twin juniper
#

soo for some reason

#

in multiplayer my map just takes so long to load

#

that the server just times you out

#

LOL

jolly siren
#

@chrome bay I'm calling AddZeroed on the array in the constructor tho and not changing the size anytime after that. But that is good to know for sure.

stark raft
#

im having trouble with my GameServer.Target.cs file I can't get it to build a dedicated server build

#

I can't figure out why Visual Studio won't build the dedicated server

stark raft
#

I keep getting the error "'UnrealBuildTool.UnrealBuildTool' does not contain a definition for 'GetAllServerPlatforms'"

plain flume
#

I think important thing is to let as much as stuff run in client computer as possible so server isnt hanfling too much traffic. Critical variables and events are handled in server ofc.

#

No point to let server handle stuff for "just in case"

glad sedge
#

typically Game State is good for spawn?

rare cloud
#

@glad sedge, what do you mean by spawn ? player spawn ?

#

or any kind of entity ?

glad sedge
#

Yeah

#

PlayerSpawn

#

Right now I'm calling a function from PC to GameState

fossil spoke
#

I get my GameMode to Spawn Players, its Server side only so there is no risk of it accidentally happening on the Client for whatever reason.

glad sedge
#

so on death via the PC, you just call GameMode::SpawnPlayer(AMyPlayerCharacter) or something like that?

fossil spoke
#

Basically. The reason why an SpawnPlayer is being called depends on the gametype. But yes essentially.

glad sedge
#

that makes sense to me

fossil spoke
#

SpawnPlayer handles creating the new Character Actor as well as destroying the old possessed pawn should it still exist

glad sedge
#

Is GameMode just automatically on the server? I'm guessing I'd do a netmulti on the character respawn?

fossil spoke
#

Yes GameMode only exists on the Server.

#

My GameState on the Server gets an Delegate called on it for OnPlayerKilled. This Delegate is multicast to everyone so that anything can subscribe to it and recieve that event regardless of network authority.

glad sedge
#

ok cool.

fossil spoke
#

When you respawn the player you only call it on the server as the server would create the new actor and cause the pc to possess it. This would be automatically replicated to clients

glad sedge
#

possess is automatically replicated?

fossil spoke
#

If called on the server yes.

glad sedge
#

oh naturally.

#

I'm at the point of diminishing returns for UE, so I might get some sleep

fossil spoke
#

It gets like that lol

#

Enjoy

glad sedge
#

Any idea why this wouldn't work ?

#

OnDestroyed.AddDynamic(this, &ACastleKeepersCharacter::OnPlayerDestroyed);

#

UFunction()
void OnPlayerDestroyed();

#

Error    C2664    'void TBaseDynamicMulticastDelegate<FWeakObjectPtr,void,AActor *>::__Internal_AddDynamic<ACastleKeepersCharacter>(UserClass *,void (__cdecl ACastleKeepersCharacter::* )(AActor *),FName)': cannot convert argument 2 from 'void (__cdecl ACastleKeepersCharacter::* )(void)' to 'void (__cdecl ACastleKeepersCharacter::* )(AActor *)'
#

hmm maybe I can't pass 'this'

rare cloud
#

@glad sedge,

UFUNCTION()
void OnPlayerDestroyed(AActor* DestroyedActor);
glad sedge
#

Where'd you find that? I'm checking out the docs and I couldn't find that?

#

also er.. thanks heh

rare cloud
#

@glad sedge, look at the Delegate signature declaration

#
DECLARE_DYNAMIC_MULTICAST_DELEGATE_OneParam(FActorDestroyedSignature, AActor*, DestroyedActor );
#
    /** Event triggered when the actor is destroyed. */
    UPROPERTY(BlueprintAssignable, Category="Game")
    FActorDestroyedSignature OnDestroyed;
glad sedge
#

ah they're at the top.

glad sedge
#

If I want a PC to know when its pawn has been destroyed, would I use a broadcast delegate?

brittle sinew
#

That could work, sure

#

The engine uses an odd blend of delegates and plain old events that get called...I wouldn't really say one is inherently better than another if you're only trying to alert one object

glad sedge
#

what's the right way to approach it?

lilac lotus
#

Why does it react like this: Start multiplayer test= Everything is shaking. I Replicate 2 variables and it stops shaking, then i take away the replication and test playing again and it doesn't shake still.
Anyone possibly know how that is? Makes it real hard for me to understand it.

glad sedge
#

i'm just trying to get my PC to respawn my Char when it gets destroyed.

#

Shaking?

brittle sinew
#

Either could work; a delegate allows more expansion in the future since multiple things can bind to it, but the binding is your extra step

lilac lotus
#

Yeah, shaking like the physics ain't duplicating right ๐Ÿ˜„

glad sedge
#

@lilac lotus Wild guess, but I think the shaking you're seeing is the server's interpretation of what you're sending through. Maybe when you replicate you're replicating those values to your client

#

The client is then updating the values of the server every x ticks?

#

@brittle sinew Thanks, I'll give that a shot.

lilac lotus
#

That may be the case, I'm new with this so I take one step at a time to learn it. Would that mean that it didn't stop shaking because I replicated the variables but because the server only interpret it better?

glad sedge
#

not exactly

lilac lotus
#

I tried take away and add the replication, after the first time i replicated them it never shaked again, that's what got me dizzy

glad sedge
#

So when you're trying multiplayer, you're loading up 2+ people?

#

Are you using dedicated or just a listener-client?

lilac lotus
#

Yeah, I'm doing dedicated server and 2 clients

glad sedge
#

ok cool

#

So what are you doing in the multi game ?

lilac lotus
#

Currently I'm trying to replicate simple movement, using 2 pawn class vehicles (Using force to move them)

#

The 2 variables that made the shaking go away was "Current Steering Axis" and "Current Throttle Axis"

glad sedge
#

And you enabled "replicate" on them both ?

lilac lotus
#

Yes, they are from the same Master Class so it's 2 identical vehicles

glad sedge
#

cool

#

So what's your understanding of what replicate is doing?

lilac lotus
#

At first I thought the replication didn't work because I only had the inputs replicated (i wanna see what reactions i get everytime i add something replicated), since I have created my own movement my 2 most important movement variables was the 2 stated above so I figured replicating them next would make the 2 Clients receive better information about the Vehicle's movement direction and speeds, which they did,
Problem was that I then wanted to undo the replication to see if it truly were those two that solved it but there were no difference between before and after replicating them. (I hope this makes sense)

#

I had the same reaction when I tried my gravity direction ability in replication, first it didn't work then i replicated 2 other variables , direction and rotation, and it worked. Removing the replication didn't change anything back though

#

I came to a conclusion that I had no idea what so ever why it worked that way

glad sedge
#

Well replication is about communicating to the clients what the server has done.

#

Also it sounds like you're potentially testing this from the server? Can you confirm you're not?

lilac lotus
#

Yeah, positive that I'm doing dedicated server and 2 clients ๐Ÿ˜„

#

it might be like a time lag or something, if i wait for an hour or something after after removing the replication the shaking sometimes reappears

glad sedge
#

that sounds really weird.

#

Though physics is a pain in the butt when networked.

lilac lotus
#

Yeah, I'm just going to keep at it until I understand it. That always works sooner or later lol

glad sedge
#

Time, coffee and Google. That's all you need.

lilac lotus
#

Couldn't have said it better myself๐Ÿ™Œ

glad sedge
#

dang

#

ProcesRemoteFunction: No owning connection for actor CastleKeepersGameState_0. Function Server_RespawnPlayer will not be processed.

#

Might have to run stuff via GameMode

brittle sinew
#

If you're trying to use server RPCs, the GameMode will be even less help ๐Ÿ˜„

#

It doesn't exist on clients

#

Here's what you're running into, server RPCs can only be called on owned objects

glad sedge
#

yeah I figured

#

I read that using interfaces is a way to getaround that?

brittle sinew
#

I don't believe so?

#

Your client really shouldn't be the one asking your server to do a respawn anyways :p

#

That logic should be on the server for the most part

glad sedge
#

ohhh

#

wait wait, I should be getting the broadcasts via my gamemode or gamestate?

brittle sinew
#

Well you can still call things onto the GameMode/GameState, that's fine

#

You just have to call it from the server version of your object

glad sedge
#

oh

#

I'm jumping the gun on it.

glad sedge
#

uugh I can't call GameState from Server

brittle sinew
#

What do you mean by that?

#

You shouldn't have any trouble getting the GameState, unless you mean calling to the server

glad sedge
#

under my function inside my PC

#

so my RPC call inside my PC won't call UWorld World etc.

brittle sinew
#

I still don't quite understand what you mean by that

#

If you're doing it on BeginPlay that's too early

glad sedge
#

I'm doing it well after.

brittle sinew
#

Okay, so is it returning a nullptr?

glad sedge
#

not 100% sure as the VAX isn't referencing the header files.

brittle sinew
#

Ohhh, so it's a compile issue?

#

UWorld::GetGameState is the function you're looking for

glad sedge
#

I'm guessing it's because UWorld is only relevant to the client?

brittle sinew
#

No?

#

Could you describe what your actual issue is at this point?

#

I'm not quite understanding

glad sedge
#

Ah.. gimmie a sec,

plain flume
#

You can get gameState no matter if you are client or server

glad sedge
#

yeah this is weird.

#

oh ffs

#

this is why you don't code for 15 hours straight

#

ok I'm done.

#

cheers guys

brittle sinew
#

I mean, if you give code or an error we might be able to help :p

modern dome
#

@brittle sinew or the specific use case
@glad sedge

prisma shadow
#

how can players communicate between each other in multiplayer mode?

modern dome
#

GameState

#

To be more precise: How the way you want. Just make sure everyone communicats through an actor that is replicated to everyone

#

I just named GameState because it is already replicated to everyone

plain flume
#

GamState = There is one GameState in level that is replicated to everyone. Could be usefull to keep track of some specific value that is common to every player. PlayerState = Replicated to everyone, but every player has their own PlayerState. Usefull to keep track specific value to specific Player. Like Player Name, Player personal Score etc

prisma shadow
#

oh yes

#

im using game instance

#

how do i make another player take damage?

twin juniper
#

i feel like

#

i wonder if my cpu being a 3rd generation i5 is whats cuasing lag in my game thread, or if its just poorly optimized

sweet spire
#

step one bDoom with an i5, accepting your death

glad sedge
#

@brittle sinew ha, no I meant I sorted it out. I didn't notice I had a bracket out of place. Really rookie stuff.

wet oriole
#

Hello Guys, I'm trying to read some info from a client GameInstant in my DedicatedServer GameMode but I can't, this is my workflow:
After join to map using Open [ip] i call a function in PostLogin in dedicated server game mode to update some info from the new player controller :
void AMyGameMode::PostLogin(APlayerController* NewPlayer)
{
Super::PostLogin(NewPlayer);
AMy_PlayerController* PC = Cast<AMy_PlayerController>(NewPlayer);
if (PC){
PC->UpdateUserInformation();
UE_LOG(LogTemp, Warning, TEXT("GameMode info : Field -1 %s Field -2 %s"), *PC->Field_1, *PC->Field_2,);
}
}

and in my controller player header that function is :

UFUNCTION(Reliable, Client)
void UpdateUserInformation();
void UpdateUserInformation_Implementation();
UPROPERTY(replicated)
FString Field_1;
UPROPERTY(replicated)
FString Field_2;
in c++ :
void ANYX_PlayerController::UpdateUserInformation_Implementation()
{
UMy_GameInstance* GI = Cast<UMy_GameInstance>(GetGameInstance());
if (GI)
{
FMyInformation TempInfo = GI->GetUserInformation();
UE_LOG(LogTemp, Warning, TEXT("UpdateUserInformation PlayerController : Field -1 %s Field -2 %s"), *TempInfo.Field_1, *TempInfo.Field_2,);
Field_1 = TempInfo.Field_1;
Field_2= TempInfo.Field_2;
}
}

void AMy_PlayerController::GetLifetimeReplicatedProps(TArray< FLifetimeProperty > & OutLifetimeProps) const
{
Super::GetLifetimeReplicatedProps(OutLifetimeProps);
DOREPLIFETIME(ANYX_PlayerController, Field_1);
DOREPLIFETIME(ANYX_PlayerController, Field_2);
}
I've the data in Player Contorller log but i don't have data in GameMode Log, how i can fix this problem?

brittle sinew
#

Triple ticks :p

#

Makes it a lot more readable

#

Also, you can't set replicated variables on the client

#

(and even if you could, in this scenario it would do nothing. The GameMode call doesn't synchronously wait for the RPC to reach the client after the call)

wet oriole
#

so i should ask the server to change set variables ?

brittle sinew
#

Yep, and just use the data within that server RPC right then

wet oriole
#

ok thanks i'll test now

lilac lotus
#

There is probably a very obvious solution to this, but I'm just to dumb to see it so I'm asking here..
https://gyazo.com/b4de821a5d0ca36e4de084e19c6ea77b

How would I go about to Replicate this function?
I've tried replicating scene list variable and steer angle. I also added a Variable at the end between makeRot and SetRot and made it replicated.
I also tried making a customEvent Node in EventGraph and replicated that, to no avail.
All other variables I have related to Steering have been replicated for test.
I really don't understand it. Also wanted to add this is a function that rotates the wheels (Just the visual).

slim holly
#

offtopic, but why not use GetSteering as alpha for the lerp?

#

otherwise, for the replication you could drive it using OnRep of the steering angle variable to update the visuals

#

so technically every client does the wheel visual tranformation on their own when they receive the data

lilac lotus
#

Hey, was grabbing some coffee quick.
I'm not actually the one that did this specific function, all I know is it works perfectly when I'm not in multiplayer at the moment

#

So I actually didn't think about the onRep, sounds very logical when I think about it, I'm going to give it a shot!

tiny coyote
#

Hi! Have someone seen how can client connect to dedicated server which was launched in PIE through lan? I'm passing ip of computer which launches this dedicated server and they got handshaked (I see it in my log), but than client gets reconnected with error - Cannot load map

#

But map that it cant load is the lobby map which is already loaded but not the map that is launched on dedicated server

slim holly
#

I don't think PIE and dedicated go well together

#

did you try standalone?

tiny coyote
#

Nice idea, will try now

#

Doesnt work eather

#

Standalone dedicated works well. But not from editor. The thing is - pie dedicated gots discovered and tries to connect but I get some wierd error. So I'm assuming that this whole setup is possible but I'm doing something wrong

slim holly
#

is it default start map?

tiny coyote
#

I need this because I got tired of rebilding dedicated server every time and my whole team is in one lan

#

No its not

#

I have lobby map and default map

slim holly
#

so all good until joining lobby

tiny coyote
#

I have hardcoded ip for dedicated, lobby is just a gui for selecting dedicated server by ip

#

For connecting I'm using ClientTravel in PlayerController

slim holly
#

hard to say ๐Ÿค”

#

it would probably mention if it was version issue

tiny coyote
#

Versions are equal

twin juniper
#

in a dedi server

#

is the game instance class shared

#

between all clients

#

or does each client have their own

dapper galleon
#

@twin juniper each client have their own. The server also has one.

#

@tiny coyote Have you tried building the dedicated and seeing if it's the same problem?

twin juniper
#

@dapper galleon how do u know that xd

#

so if i store a variable on my game instance

#

then i load into a server

#

will i still have that variable locally?

dapper galleon
#

AFAIK the game instance is like a local backpack hehe

#

I figured this out by doing some research

#

So the answer would be yes, since it is local and kept between levels

vital steeple
#

is it normal for playerstate to take a little bit before you can access it? like a second or so?

#

this is in PIE and running one client as well as dedicated

twin juniper
#

yea

vital steeple
#

ok so we just need to test script with that in mind

plain flume
#

That usually gives lot of headache!

brittle sinew
#

APawn::OnRep_PlayerState if you're in C++

#

If not, you kinda just have to work around it

dapper galleon
#

Has anyone messed with int32 GetPortFromNetDriver(FName InstanceName) to retrieve the listen port?

#

It is failing when It tries to get the world as in:

/** @return the world associated with a named online subsystem instance /
ONLINESUBSYSTEMUTILS_API UWorld
GetWorldForOnline(FName InstanceName);

What would be the associated world for an online subsystem instance?

plain flume
#

Any idea why the "IsValid" node isn't working sometimes? I am checking that if the LeadingCharacter variable valid and if it is, then code should run. In some situations, the function still gives errors like: PIE:Error: Error Blueprint Runtime Error: Accessed None trying to read property LeadingCharacter from function: 'ExecuteUbergraph_BP_EndPost' from node: Branch in graph: EventGraph in object: BP_EndPost with description: Accessed None trying to read property LeadingCharacter

obsidian relic
#

Maybe because it's null ?

plain flume
#

hmm. should't the IsValid check for nulls

obsidian relic
#

Hmmm.. that's for an AI?

brittle sinew
#

Could you show your BP of where this is occurring (EndPost)? Usually IsValid should be fine...there are certain edge cases where it's not completely safe but for the most part it's fine

plain flume
obsidian relic
#

Strange

plain flume
#

Hmm. Might be something to do with server-client sync

jolly siren
#

Anyone have experience with the replay system? When I call DemoRec on the client it isn't recording my particles and sounds. I have HasAuthority() checks around both of those so the server isn't bothered with uneeded stuff. It looks like it is recording the dedicated servers world.

#

@rough iron maybe you have used it^ ?

rough iron
#

I used it in UE3 xD there you had to hand tweak every think you wanted to get recorded, you might be missing something.

timid pendant
#

How can I add code to only appear on the dedicated server and show in that console?

wary willow
#

@timid pendant is dedicated server

obsidian relic
#

Only run on server ?

fossil spoke
#

@timid pendant You could use the preprocessor macro to compile it out of non server builds.

timid pendant
#

I will be using if (isRunningDedicatedServer())

lilac lotus
#

Anyone wanna help me and point out my misstake? I can't find it, been trying to debug and understand this for the last hours..

The Rotation works fine, it's not replicating though, so I'm the only one that can see it. (This is all under a function that is called by Tick)

#

Anyone think it looks like it Should work?

sweet spire
#

If you where on a super tight bandwidth & cpu budget, what are the thoughts on using components for inventories / equipment when it comes too replication, or should you strictly keep it too arrays using index's to data tables

wary willow
#

@eXi#4538 Your C++ Multiplayer blog is dead

#

hmm

#

no longer on server

#

interesting

brittle sinew
wary willow
#

@lilac lotus Did you figure out your issue?

lilac lotus
#

@wary willow I wish, I dropped it for a few hours, went on to the next BP. If you have a suggestion or just a clue what might be wrong I would greatly appreciate it though

twin juniper
#

its under tick right? the replication itself?

#

could the clients version of tick be overriding the notify?

lilac lotus
#

I'm not sure, still learning all this multiplayer replication thing. I need to keep it under Tick though, since it's only a visual function it needs to be constantly updated to look like its the actual thing so to speak.
This is in a Master BP though, the I'm doing the Tick event on a child BP

twin juniper
#

tick is both server & client tho

#

i think you need to separate whats going on in the tick event, with some authority/remote nodes

#

since its ran on all machines

wary willow
#

@lilac lotus So

#

The issue is, that you probably aren't calling that reponotify on server

lilac lotus
#

https://gyazo.com/12bd8fddacab4aac5d9045c87d9dcf7e
This is the strings from my tick event (Yellow is for non replicated and Teal is for replicated), the position and movement spin of the wheels worked flawlessly by themself when I started doing it into multiplayer, the steering not so much, hence why im trying to figure it out ๐Ÿ˜…

twin juniper
#

thats all connected to tick?

#

if so then for sure the client and server are fighting each other in variable accuracy then

#

you know what i mean though? for that object it is tick's at the same time the version on the server does

#

so when the server replicates steering? the client is already setting steering on its own, completely ignoring wats going on because its happening at the same time!

lilac lotus
#

Well, the real steering is not actually done under Tick, that's a separate function ^^

#

This is just the Visual rotation of the wheels

#

@wary willow When I put the variable in its own tick string i can't even see my own steering anymore. Tried it earlier and Im sure that has something to do with it

#

@twin juniper there must be some fundamental understanding of replication I have missed. Only reason I can think of to why it wouldn't work

wary willow
#

@lilac lotus Okay

#

So, like I said before

#

It's not getting called on server

#

Also

#

That Switch Has Authority is limiting

#

who is actually seeing what

#

You are only allowing client to see it

#

Not the server

#

So if you're debuggin with only two players, that is why it's not looking like it's replicating

#

Remove the SwitchHasAuthority and everyone can see it

lilac lotus
#

Yeah It's removed, let me check if this works

lilac lotus
#

So, I removed it and unfortunately it's still the same results. (Im testing with dedicated server and 2players atm)

#

I'm trying out a few logical solutions atm in hope that one of them might be the correct one

wary willow
#

Ah, dedicated server

#

did you mention that before?

lilac lotus
#

Nope, I didn't think about it until you mentioned the server - client windows

#

๐Ÿ˜…

wary willow
#

doesn't matter

#

My logic works with dedicated server

#

Just tested

#

So your logic flow is just off

lilac lotus
#

Yeah, I'm not to suprised since I'm still learning all this about replicating. Your examples are a lot easier to understand than some other stuff I've seen on the web regarding all this today.

#

The multicast - OnServer - OnRep and all other fancy things out will take a while to grasp

fossil spoke
#

Victor learnt from the best ๐Ÿ˜‰ haha

wary willow
#

rahahahah

lilac lotus
#

We all need a Senpai from time to time hehe

fossil spoke
#

We all have our masters ๐Ÿ˜ƒ

lilac lotus
#

Indeed, my current one is named "Stephen R. Davis", c++ for dummies ๐Ÿ˜…

fossil spoke
#

Haha

twin juniper
#

is there any function

#

that is called after BeginPlay() and after PostLogin()

wary willow
#

@twin juniper ah

#

Can you be a bit more specific?

#

I mean, technically, any function you'd want?

#

But are you talking about overwriteable ones?

twin juniper
#

In @cedric's document

#

he says u cant call RPCs on BeginPlay safely

#

but i need to initialize some stuff

#

on the player controller

#

before they possess somethinfg

wary willow
#

@twin juniper so, on post login, call the function you want to happen?

twin juniper
#

can't

#

The data I need is on the client

#

so i need the client to pass it to the server

wary willow
#

what info?

twin juniper
#

uhm

#

its a unique identifier

#

the type data shouldnt matter though

wary willow
#

so, why can't you wait until after PostLogin?

twin juniper
#

so

#

the reason is

#

PostLogin() creates a DefaultPawn

#

but i want to use my unique id to possess a pawn thats already spawned in

#

however, i need to get this id from the client, pass it to the server for possession

#

You see the issue? xD

wary willow
#

No actually ๐Ÿ˜ƒ

#

Going to try something

twin juniper
#

PostLogin() you can't call RPCs

wary willow
#

Needs to be on controller right?

#

Don't you worry about the little details

twin juniper
#

you can only call RPCs AFTER you finish calling PostLogin()

#

and yeah

wary willow
#

There's always a way

#

Just need info to help

twin juniper
#

what else?

fossil spoke
#

Why not just wait a bit and then possess your new pawn?

#

Just because you spawn with an default pawn doesnt mean you need to use it

wary willow
#

@twin juniper Use the playerstate

twin juniper
#

@fossil spoke Yeah but it dfeels like just a workaround, because i would have to delete that other pawn otherwise u have a character just spawned in at 0,0,0 randomly

#

@wary willow isn't playerstate cleared when you ClientTravel()

wary willow
#

CopyProperties

fossil spoke
#

Set the DefaultPawn to None. Pretty sure that makes sure it doesnt spawn any default pawn.

wary willow
#

it will keep it with the player, or should...

twin juniper
#

CopyProperties
(
APlayerState * PlayerState
)

#

@wary willow how is this used lol

wary willow
#

PlayerController->PlayerState->CopyProperties(NewPlayerState);

#

ยฏ_(ใƒ„)_/ยฏ

#

I'm still a newbie when it comes to Replication in C++

sweet spire
#

Thoughts on how to handle things like attributes for HUD's? since u cant setup on rep event for them as far as i know

wary willow
#

?

#

Just pull the data and display it

sweet spire
#

id rather not pull the data every tick

#

when it could be bound too event on attribute change

#

or something

chrome bay
#

I poll for HUD data personally. Widgets tick anyway, so it doesn't cost much

#

And you never want the HUD to be "wrong"

twin juniper
#

reading a float or any variable should always be fast anyway

#

if you have to do something crazy to read some big data then even then you should just read variables set by some larger function during an event

jolly siren
#

@rough iron do I have to play all particles / sfx on server just to get them to record?

jolly siren
#

actually my attack animations aren't being recorded either

#

@dry cloud I noticed you have have gotten demorec working with particles and things. did you have to do anything special for that?

rough iron
#

@jolly siren it might be yes, I used listen servers for it so I had all the effects already

#

but on a dedicated one it would be hard to do so

#

could you record it on a spectator?

jolly siren
#

I'm calling demorec from the client which I thought would work but it is recording what the server sees I guess

#

so I'm not sure a spectator would be any different

#

I thought this card meant that it was going to record what the client sees

#

If not, I'm not sure what the point of the card was. We could have always done a server rpc to call demorec on the server

#

it would be nice if it connected as a new client from the server and recorded what a client sees but saved to the server

wary wyvern
#

Hey guys! How is it possible, that variable simply stops to replicate? I enable myBool for like 0.2 sec, but it successfully replicates and calls OnRep. But at some point this bool just stops to replicate..

raven viper
#

Anyone could help out with an urgent issue please? I need to find the part in the source which checks for client versions before connecting players. Any idea where I could find this? I found the error message part itself, but that doesn't help much :/

plain flume
#

Is this normal, or is there something wrong? I have an Actor that will run a Delegate when person walks past it. It only runs in server and in the end, it will Multicast to function that will find the player that is most right of the Self. For some reason the overlapping character shows differently with different clients. Client 1 thinks it is a Character1 and Client2 thinks it is a Character. Any idea why?

modern dome
#

Where do I start a Melee Combat in regards of animation?
Characters are planned to have a "civil mode" and a "combat mode".
Combat Mode gets activated when enemies are nearby and should automatically draw weapons via a AnimMontage.
When I call playAnimMontage, is it replicated?

hasty adder
#

Wasn't someone working on the multiplayer replay wiki still?

jolly siren
#

if that's what you mean

#

it doesn't really go over if they are recording on server or client

hasty adder
#

Yeah. That's the one..

dapper galleon
#

Does anyone know what are the UniqueId and UniqueNetId and how do I set them in a custom online subsystem?

vital steeple
#

How do you guys handle dealing with player state taking a while to get established? i keep putting delays in here and there but that seems REALLY sloppy. is it just somethign you live with? do you make the players "sit out" for the first few seconds in a load screen and let everythign get established?

#

like is there a way to detect when a playerstate is setup? it seems to take 3-5 seconds in PIE

jolly siren
#

someone already answered that for you yesterday

#

APawn::OnRep_PlayerState()

cursive herald
#

That's pretty good network compensation.

#

to be able to detect that unfair death and reset you.

faint python
#

hello hello

#

I got a quesion on making a single player game with a team of 3 into a multiplayer game

#

here's the thing... something similar to Dragon Age: I got a single player game and I'm thinking of putting everything into the playercontroller for functionality and having a push button to allow player 1 switch to team members 2-3

#

the team members will hold everything for that specific character such as skills, animations, whatever

#

is this a logical way of doing things?

#

then when a new player wants to drop in they hit button and it checks to see if there is a open team member and inserts them into the character control like if they were the first person just switching

#

it possesses, and AI stops running

#

How to go about that? is it a create player thing? or would it be better to always have the player created and just when a button push its possess / unpossess

#

the 2nd player would just be on hold if not possessed?

#

and of course... all for 3rd player too

cursive herald
#

@faint python player controllers don't exist everywhere

#

so if you want to let other players know that other players are on the team

#

etc

#

then put it in the playerstate

#

which is on server and all clients.

#

player controller is on server and only the owning client.

#

the player controller holds a playerstate just fyi