#multiplayer

1 messages Β· Page 481 of 1

ocean geyser
#

@jade gazelle tried what you said without luck. a player loads the game to the main menu, in the game modes BeginPlay, i run a function that sets the character class variable (a UClass*) in my game instance to equal my survivor base class (so its not null if the player doesnt select anything). then the player clicks a host game button which is a simple server travel to my lobby map. then the player would click the start button (keep in mind this is all temporarily so i can figure this character selection deal out). the start button would seamless travel to the game map. the game map game mode runs postlogin which casts the NewPlayer playercontroller to my playercontroller class, then calls a client RPC on that player controller and passed in the casted NewPlayer playercontroller. the client RPC got my game instance, called a function that returns the UClass of the character class variable that was stated above, and sends it along with the playercontroller to the server via a server RPC. the server RPC checked to make sure the UClass and playercontroller were not null, then spawned the UClass actor and possessed it. the problem i keep having is the game crashing when it tries to spawn the UClass. i went ahead and deleted all the code (again) to start from scratch (again) and did a little test, i tried spawning in the UClass while i was in the lobby and it still crashed. for whatever reason i cannot seem to run spawnactor with my UClass. if i do ASurvivorBaseClass::StaticClass() to get the UClass it works, however i will be having several different classes so that wont cut it

somber glade
#

When you multicast does that also run on the server or only clients?

timid moss
#

Server and clients

#

and it must be called on the server

somber glade
#

Yes, I have my gun set up so that it goes from interface->Run on server->Multicast->local copy. This way it displays its effects on all clients, but I realized that for some of the abilities the gun has, it doesn't need to do all of the calculations on all the clients. It only needs to do it on the server. So I was going to toss in a has authority to separate those out

ocean geyser
#

are you spawning an actual projectile or doing a line trace for the bullet?

#

@somber glade

somber glade
#

It's not a bullet actually, it's a different kind of ability. It does do a line trace though. Basically it's line tracing to the target to see if the target has a certain gameplay tag before it goes ahead and calls to an interface to perform that function on the character itself. If that passes, then there would be a visual effect from the gun to the character, but that hasn't been built yet. I figured that not all the clients need to check that tag. Only the server needs to check that tag to see if it exists and then if it does, I could repnotify a bool that would play the particle effect

ocean geyser
#

maybe set it up like this? client clicks to shoot weapon, calls Server RPC to shoot the weapon which is just the line trace. in the Server RPC, call a multicast RPC function to play the effects/animation of the weapon such as muzzle flash and recoil animation. then still on the Server RPC, let it do whatever calculations it needs to do, if the gameplay tag check passes, simply call another multicast RPC function to play whatever the visual effect is?

somber glade
#

okay I'll try that

ocean geyser
#

just seems like a simple solution without having to replicate anything aside from 2 function calls. and if you want to possibly save some server calculations(idk how demanding what your trying to do is going to be), you could perform the line trace on the client, call a server function that call a multicast function to do the shooting animation/effects, then while still in the same client function, check if the client hits something, then have it do the calculation to see if the target has the correct gameplay tag. if it does then call a server rpc to perform the line trace and check if it hit a target with the correct gameplay tag, if it did then have it multicast the visual effect you were talking about. this way the calculation and line trace is only going to be done on the server if the client thinks it hit something, if the client hit something with the right gameplay tag, the server simply checks to make sure it actually did hit the target with the right gameplay tag (to prevent cheating) and then runs the multicast function for the visual effect

weary saffron
#

What does the maximum array size 2048 mean?
Can I send only 2048 variables?

somber glade
#

@ocean geyser Okay The one thing I am still trying to understand is when a call jumps from one actor to another it still runs with the same authority right? So like if I have an event on Actor A that is running "has authority", and it calls to some event on Actor B, I don't need another "has authority" on Actor B right, because that event is only being called from A if it has authority?

ocean geyser
#

@somber glade correct, any code that runs in an if statement that checks for authority will run on the server, even if its calling something on another actor

winged badger
#

@gleaming vector there was a case of that on #cpp couple of weeks ago

#

the Outer did not replicate

gleaming vector
#

well, yeah

#

i'm trying to get around that

winged badger
#

after renaming it on server

#

he did have to set Outer client side OnRep

#

to avoid LogNetTraffic: Error: UActorChannel::ReadContentBlockHeader: Sub-object not in parent actor.

#

that

#

it was Meatman, 29th of June, don't know how to link that tho

#

moving a replicated UObject to another Actor

#

iirc, the Unreal instead of replicating an Outer, just assumes Outer client side is whatever Actor was responsible for the initial replication of the Object

gleaming vector
#

yeah

winged badger
#

you should be fine as long as you have the information to mirror the server-side rename on client

gleaming vector
#

so, just in an OnRep update the outer?

#

is that what he did?

#

hmm

winged badger
#

yeah, just do a Rename client side

gleaming vector
#

yeah

#

biggest issue is that these are in an array

#

i'll experiment with it tomorrow

winged badger
#

FFastArraySerializer πŸ˜„

gleaming vector
#

yeah

#

i may have to do that

winged badger
#

the docs for it are in NetSerialization.h header

gleaming vector
#

i've done it before

pallid mesa
#

Onrep x1000 better than a multicast and yeah go for the FFastArray

#

(2 hours later)

jade patrol
#

Hey guys, do variables created in animation event graph are able to replicate ? The option is there but it does not seam to work as intended

pallid mesa
#

Usually the work flow of the animgraph is to read variables and do things client sided

jade patrol
#

so the good way is to replicate things on the actor bp side not on animation bp

pallid mesa
#

Thats the usual workflow, yes.

jade patrol
#

ok, thanks

pallid mesa
#

@thin stratus you might abort on helping me, got it fixed

#

Thank you for all the help, it was literally the weirdest bug I ever encountered

thin stratus
#

Don#t worry, haven't had time to look into it anyway. But glad you resolved it

pallid mesa
#

I filed a pull request because of it

#

@high current ^

high current
#

0_oo0

#

┬─┬ γƒŽ( γ‚œ-γ‚œγƒŽ)

pallid mesa
#

A dangling PS, two controllers owning the same pawn, owning clients executing code they shouldnt...

#

Ect

#

All because PossessedBy doesnt do SetOwner(NewController);

winged badger
#

@jade patrol the UAnimInstance is not supported for networking by default, and would take a moderate amount of work to... hack it into supporting replication

#

i recommend against it

void nest
#

Can someone help me? I'm a bit confused. I'm looking for the easiest way possible to have a simple and very small backend for my multiplayer game. Basically all I need is an online mysql database which holds a username, level, gold amount and some int which represent unlocked stuff. No login system, no other fancy stuff, just what I summed up nothing more. I've tried setting up a localhost with bitnami which is all great, but that's just local. How would I bring this online? I know that i can get a free webhost which includes a mysql database, bring my php files in and it should work. Except everyone around me tells me that won't work since most webhosts block bot requests (such as requests made from unreal engine clients). So what is then the easiest way to get this up and running for my alpha test community? I also know there is Gamesparks and stuff, but that is either payed and requires c++ knowledge which is kind of lacking atm since I havent programmed in c++ in ages. My game is a blueprint only game for now. Any ideas?

#

sorry for wall of text btw πŸ˜‹

bitter oriole
#

Get yourself a quite VPS for a few bucks a month

void nest
#

I'm very much willing to pay for a server up to 15/month

#

can you recommend the best one for games?

bitter oriole
#

Will your multiplayer game have dedicated servers ?

void nest
#

eventually yes

#

and most likely soon

bitter oriole
#

I mean, if it doesn't, there's no point having your service at all

void nest
#

but not at the moment

#

but how would data be stored of users if I don't use an webserver?

bitter oriole
#

In save data

void nest
#

I've read about SQL data and baking into a build, but wtf is that even? xD

#

sounds like voodoo magic to me haha

bitter oriole
#

How do you think video games store progress ?

void nest
#

All that data is currently saved locally using save data from unreal, but I want players to be able to play the game from anywhere and any pc and I want their data to be somewhat safe. Like if they accidently delete their safe file they lose all their progress

bitter oriole
#

Cloud saves on Steam

#

They're trivial to use

#

Basically a five minute setup

void nest
#

I've also read about that, but cloud save only saves a copy of your save file, doesn't do anything else

#

user can still manually delete their save files and users also have to enable the cloud saving manually

bitter oriole
#

Cloud save on Steam syncs the files between all machines so you have the same file everywhere

#

And it defaults to being activated

#

You don't need to enable it

#

You can always manually delete a file, yes, but is that really an issue ?

void nest
#

It kind of is, as the level system in my game is pretty serious xD

bitter oriole
#

I mean

#

We're talking "user goes to the file and deletes it and then launches the game"

#

Not "user formats the machine"

void nest
#

that sounds great for a singleplayer game and a simple test game, but for a real multiplayer game it seems only logical to me that the data of the players is saved somewhere online and protected?

bitter oriole
#

Yes, but that only works with dedicated servers.

void nest
#

I mean which multiplayer game has local save data?

bitter oriole
#

All MP games that are cooperative, rather than competitive

void nest
#

well, I guess, but the fact is that my game should be rather competitive

bitter oriole
#

The problems of an online server to store the save data are :

  • you'll pay for the server, you'll need to maintain if for as long as you want your game to be playable (so like, 5 years)
  • any breach in security will result in data modified, or lost, which will kill your game if it happens
  • you can't have clients writing the data, because clients cheat, so you need all data modification to happen on servers you physically control
  • you can't let people host their own game servers, so the cost of game servers is higher
  • playing offline isn't possible anymore, which will kill your game if you have like 3 online players like most indies
#

Obviously if you're working for Bungie and you want advice on Destiny 3, then yeah that's what you need to do

#

But are you working on Destiny 3 ?

void nest
#

πŸ˜›

#

I get the point, thanks haha

#

but hmmm I dunno

#

how about gamesparks?

#

would you recommend that?

bitter oriole
#

I'd recommend not doing a competitive MP game as an indie, it's suicide

#

If you're doing that, I don't know, I don't do competitive MP games πŸ˜›

void nest
#

already to late for that we've been working on our current game for over a year and a half and are going to be on Gamescom this year πŸ˜‚

#

it's a very casual multiplayer game though. I mean, we're NOT trying to be the next Overwatch or whatever. Just want players to be able to get a sense of progression and be able to unlock and buy some stuff

bitter oriole
#

Well yeah I'm just saying this stuff costs a lot of dev time, and if it's not perfect your game will die immediately

void nest
#

I understand

#

but in all honesty it doesn't really need to be like insanely protected and all that. In fact we've got our own local server which is already operating a discord bot 24/7. Would be cool if we could just get a database running on that same pc, be able to post and get data from it, nothing more.

#

Once / if our game get's bigger we dcan think about upscaling and more security

#

gotta work around the current requirements of our game, which can potentially scale with more users / popularity

bitter oriole
#

I mean, if you have a flaw in your server and someone connects to it and wipes the progress, your game is dead

void nest
#

I see what you mean

bitter oriole
#

If you don't care about insane protection, just put it in save data

#

It's way simpler and cheaper and safer

#

People will cheat by modifying the save data

void nest
#

can the save data be encrypted?

bitter oriole
#

But as long as it's just unlocking random shit, no one cares

#

It doesn't matter, everything happening on the client's hardware is unsafe

void nest
#

well, the thing is that the game will be a one time purchase, no micro transaction and in-game currency buying and so on. So in fact people kind of pay for the game experience itself, the gold and level you get by playing is just a bonus really

#

so I guess you're right that it's not a big deal if users mess with their own safe file, the only thing they will have is some more fancy clothes than other players

bitter oriole
#

So just put in save data which items you've unlocked and how much ingame money you've earned, and when people change the data (they will) it's fine

void nest
#

the game is already like that

bitter oriole
#

The worst case is much less dramatic than "someone wiped all progression for everyone"

void nest
#

i was just looking to change into an online system

#

but guess I'll leave it like it is then

#

thanks for the insight

bitter oriole
#

As long as you're not playing on dedicated servers that you physically own, with only dedis being allowed to talk to the online service, it's the same

void nest
#

well, we do want people to be able to host their own dedicated servers

#

will that be a problem?

bitter oriole
#

It means an online service will be exactly as safe as your local save data

#

Anyone will be able to hack everything

#

Except maybe not just their own data πŸ˜›

void nest
#

We just want to provide our community with a dedicated executeable which they can run to host their own servers, nothing more. Just to give the game to the people really and let them do with it what they want

bitter oriole
#

That's great

#

Just, that means you can't have trustworthy save data

#

It's a compromise

void nest
#

Yeah, but the save data is not like a crucial aspect of the game, it's an extra to make it a bit more fun and give players a goal. The game is still very much all about the actual gameplay. Kind of like counter strike. Remove the skins from counter strike and it will still be a fun game

#

that's kind of what we want with our own game

bitter oriole
#

Then keep it local in save data

void nest
#

alright

bitter oriole
#

People will hack it, and it's fine

void nest
#

it won't be dramatic πŸ˜›

bitter oriole
#

Just consider that everything happening outside your own hardware is unsafe

#

That's just how it is

#

Once you've registered that it's easy to understand what you can do or not

void nest
#

Thanks a lot for the info. Im going to keep the save game local for now ;)

grizzled stirrup
#

Is is possible to give preorder / special edition bonuses without a master server or separate game build on Steam?

#

It's fine if hackers can get the skin, but just wondering if I can flip a bool in game instance that'd unlock certain rewards for certain people somehow without needing a separate build

#

Alternatively if it isn't possible, is it at all viable to run two builds and just flip that GI bool on one?

west basalt
#

If youre on steam, are you setup for any kind of code redemption? Seems like thats the more common route

grizzled stirrup
#

Wouldn't code redemption require some kind of online check / redemption which would mean your inventory would have to be networked somehow?

#

If steam can handle one time codes then it can probably work actually as long as it syncs with the save data

west basalt
#

Weve use code redemptions pretty commonly, steam for sure has one time codes, but I have not been thru that pipeline myself.

#

For sure youd need a way to talk to steam, in game, about what that user has redeemed so you can decide to push an inventory item on them

#

Also going that route means you can open up taht pre-order bonus for sale or other giveaways in the future alot easier than having to send people a 2nd build

grizzled stirrup
#

Great advice thank you

#

I will look into those codes and see if I can get it to work without any master servers etc.

ocean geyser
#

question. i have a game instance and that game instance sets a variables value when the game is loaded. if the player hosts a server (not dedicated) from the game, does a new game instance get created for that player? or is it still the same one?

lost inlet
#

there's only one game instance per... game instance

#

the only time it's not is with PIE sessions

#

a listen server doesn't behave the same as dedicated server mode in the editor, it behaves more like non-dedicated with multiple players where the hosting player is ROLE_Authority over everything

ocean geyser
#

@lost inlet then i cannot for the life of figure out what my issue is. the code works just fine in the editor, but when i test outside of the editor is crashes everytime i try to spawn my UClass that is saved inside the game instance. can you do me a favor and skim over this and see if you see anything strange?
https://forums.unrealengine.com/development-discussion/c-gameplay-programming/1646781-uclass-spawnactor-crashes-game-when-testing-outside-of-the-editor

lost inlet
#

ok did you actually look at the crash in a debugging session

chrome bay
#

@ocean geyser So you know, there is 'SpawnDefaultPawnFor_Implementation()' in the Game Mode class which is used for exactly this kind of thing

#

It takes a controller, so you can query what pawn the player wants to spawn as from the controller, or player state maybe, and spawn the correct one there

#

Couldn't tell you why the class is/isn't valid though looking at that

ocean geyser
#

negative, im just reading the crash reports

UE4Editor_TheHouse_0073!ATheHousePlayerController::Server_SetupClientCharacter_Implementation() [C:\Users\codyd\Documents\Unreal Projects\TheHouse\Source\TheHouse\Private\Player\TheHousePlayerController.cpp:44]
UE4Editor_TheHouse_0073!ATheHousePlayerController::execServer_SetupClientCharacter() [C:\Users\codyd\Documents\Unreal Projects\TheHouse\Source\TheHouse\Public\Player\TheHousePlayerController.h:16]
#

that i did not know about, ill look that up now

lost inlet
#

well attach a debugger to the process

#

and use that

ocean geyser
#

would i need debugging symbols to do that

chrome bay
#

yeah

lost inlet
#

well if you have PDBs by your game exe, you already have them

#

this is an editor crash anyway, so just press the play button from visual studio

#

also judging by the module name, is this using hotreload?

ocean geyser
#

yes. the crash doesnt crash when testing in the editor, only when testing outside the editor such as right clicking on the project and selecting Launch Game or by packaging and launching it

#

in the editor it works as intended

lost inlet
#

the module name is not from a packaged build

#

given away by UE4Editor_

ocean geyser
#

the log above was taken when i clicked launch game on the project, the same crash happens on the packaged build

lost inlet
#

also you can have a batch file which is start Engine\Binaries\Win64\UE4Editor.exe Project\Project.uproject -game -log -waitfordebugger, and then you can attach the debugger to the game process before any startup logic is run

chrome bay
#

Or you can just launch "Development" straight from visual studio, so long as the assets are cooked

#

Instead of 'Development Editor'

#

I recommend using Debug / DebugGame Editor if you actually want to debug anything though

lost inlet
#

you can debug development builds fairly easily

chrome bay
#

You can but thanks to compiler optimization you'll always run into weird debugger behaviour

lost inlet
#

he said it crashes in standalone game mode too, and that's what the above will do

#

that has been the case maybe a handful of times out of many

#

and this is probably something that's not hard to spot too

chrome bay
#

Maybe, but it's still worth pointing out. Stepping through code in 'Development' is useless a lot of the time

#

The Debug mode exists for a reason

ocean geyser
lost inlet
#

odd, that's not been useless for me

#

Name=Invalid

#

on the class

chrome bay
#

Willing to bet the class hasn't been loaded

#

Probably already loaded in editor though

ocean geyser
#

ive tried as well by setting a timer that waits 3 seconds before setting the UClass in my game instance in the game mode on begin play as well, the log prints as if it succeeds

#

ill try stepping through it to see if its setting the UCLass properly at the start

chrome bay
#

Worth pointing out that if the UClass* is not a type of ACharacterBase, then the code will crash.

#

The template function SpawnActor does a CastChecked<> internally - so the class may be valid, but might be of the wrong type

ocean geyser
#

the UClass is a class thats derrived from ACharacterBase. ive also tried spawning it without using a template and without possessing btw

lost inlet
#

you can always use TSubclassOf<ACharacterBase> for your GI function, which will do type checking in the blueprint editor

#

TSubclassOf is a wrapper around UClass

ocean geyser
#

noted thank you!

#

alrighty heres what ive found out so far. when the game launches, it sets the variable SelectedCharacter to the UClass being passed in and it is setting SelectedCharacter to the correct class. when i call GetSelectedCharacter, its showing SelectedCharacter's name is invalid

chrome bay
#

What type of variable is SelectedCharacter?

ocean geyser
#

UClass

chrome bay
#

Is it a UPROPERTY?

ocean geyser
#

negative

chrome bay
#

In that case, it's almost certainly not loaded

#

Make it a UPROPERTY() TSubclassOf<ACharacterBase>

ocean geyser
#

ok im not gay or anything, but how about a big ol hug sir?

#

thank you

chrome bay
#

haha

#

urgh internet

ocean geyser
#

are your messages not sending as well?

chrome bay
#

Yeah.. maybe it's Discord not my interwebs

#

But virgin media have the worst router ever made so hard to know sometimes

strong blaze
#

Why should i use NetMulticast. What does it do

ocean geyser
#

netmulticast will make a function run on all clients and the server. lets say you have an event that you want to trigger, like a door opening. instead of replicating the doors movement so other players see it open/close, you could simply call a netmulticast function that has the code in it to make the door open/close. just an example

strong blaze
#

Can't do it with Server ?

chrome bay
#

Multicast can be useful for one-shot events that need replicating

#

Anything that determines the games current "state" should really use variable replication though, and that includes the above example re the door

strong blaze
#

So i can do it with Server and replicated variables but NetMulticast is simple to do that?

chrome bay
#

Well it depends, they serve different purposes

strong blaze
#

hmm

chrome bay
#

IMO You should always use replicated variables for game state. Think about late-joiners, actors going in and out of relevancy range etc.

pallid mesa
#

even for doors... you want to use onreps

#

so late joiners get the memo πŸ˜›

chrome bay
#

yeah, exactly what it's for

pallid mesa
#

also good for culling areas!

chrome bay
#

You also can't guarantee a multicast will even arrive, especially if it's unreliable - and in really bad cases when it's reliable too (but you have other problems anyway if it's the latter case)

#

Tl;DR - Variables for State, RPC's for Events

pallid mesa
#

^

chrome bay
#

E.g, notifying everybody in the server that "Player b killed Player A" is a good use-case for a multicast

#

Whether a door is open or not is arguably a state-based thing, and should be done with a var

strong blaze
#

If i decrease health of character with netmulticast it will be decrease all clients health?

#

sorry for english πŸ˜„

chrome bay
#

Yeah definitely don't do that

#

Health should be a replicated var

strong blaze
#

just asking

#

i know

pallid mesa
#

you shouldn't do that. Health should be by default an onrep var

strong blaze
#

my english not good im trying to understand πŸ˜„

pallid mesa
#

so you can trigger effects and things when the HP becomes 0 hehe

#
  • further considerations
#

What I tend to do to ensure a sane networked environment is having everything that is relevant for the game state work with netcull active

#

even if the final decision is make it always relevant

#

so when you'll have people joining the game they'll get their stuff updated properly

#

if your thing is stateless you'll end up with situations where when a player joins a match he won't have the right states on certain objectives, such as an open door.

#

@high current Btw your stuff on heatmaps is SUPER duper interesting

high current
#

oh u read the breakdown

#

😊

pallid mesa
#

NO. WHERE

#

I've seen the twits, and I've been wanting to do something similar

high current
pallid mesa
#

but I get confused where it comes to "visualize the saved data"

high current
#

its actually a thread

#

ignore the medium link

#

just scroll

#

I did an ooopsie with the formatting, Ill move it to a separate medium article at some point

pallid mesa
#

oh so just look at the twitter comments?

#

I'm mostly interested in movement data to ease level design

high current
#

I touch on that, but in essence its the same as the rest of em, just that it runs on a timer on the server

#

And because I name stuff incrementally with time, then when the visualizer reads the values

#

it can start from the beginning of the match and start adding spline points

pallid mesa
#

oh so just retrieve player position by name with a lower tickrate

high current
#

for every recorded location

pallid mesa
#

what do you mean incrementally?

high current
#

So lets say you jump in the game

#

once you spawn

#

it will start recording

#

Vor_M1

#

Vor_M2

#

every 0.5 it will create a new map entry

#

with that as its key

#

and your location as the value

pallid mesa
#

oh nice, so you iterate by the added substring

high current
#

if you die, the next recorded key would be Vor_M145_D

#

thats how the visualzier knows to stop connecting this event to the next one when you spawn again

#

so that there are no huge ass lines across the map from respawns πŸ˜„

#

I forgot to mention this in my post, but I also record the names of every player that joined in a separate array

pallid mesa
#

oh so it's always (FName, FVector)

high current
#

so that I can extract only the data of one player, make it into a new map

pallid mesa
#

?

high current
#

and loop from that

#

yes

#

always

#

If you download Unreal Tournament editor

#

you can actually get the heatmap from the forum post and look at my code

strong blaze
#

So guys i should do pickup fonctions with NetMulticast?

ocean geyser
#

not unless you need an effect to run when picking up or an animation. you can just pick it up and destroy it on the server + whatever else such as adding to inventory

pallid mesa
#

@high current open source squad hehe. Just a little question, for a game like UT, how many entries in your map you got from a normal match?

high current
#

cant tell you exactly how much(i mean i can look if you need and exact number)

#

but a 10 minute match with 6-10 people is between 200-350 KB

#

in size

pallid mesa
#

nah, not exact, just an stimate to see how big could become with 40-64 ppl

high current
#

it really depends on what tick do you record the movement, ill actually boot up UT now to tell you the exact tick,

pallid mesa
#

ah okay. I could record at a lower tickrate I guess

#

you generate the .sav at the end of every match I suppose

high current
#
  • keep in mind, this was 4.15 with blueprints, so if you do c++ i am guessing you have more options when it comes to variable compression?
#

And if you generade a random unique int, for each player

#

then you can scrap the characters in the strings

pallid mesa
#

the problem is joiners-late joiners

high current
#

I am guessing a numerical string is lower on size

pallid mesa
#

I would need to manage that myself and it's lame

#

uint8 could do it, but you need to map it appropiately

high current
#

And yeah, I actually save the thing on Edn Play

#

and I am using Event Login (i think)

#

for the joiners

#

so I really dont care if anyone joined for 30 seconds

#

or 30 minutes

pallid mesa
#

yeah that I know, however if I generate an unique integer I need to map it to their subsystem id

#

so if they leave and re-join

#

they'll be recatched

#

which would be I guess a separated map uint8 - players in game

#

If I really want to compress a lot

high current
#

I would just have a map, with player name as key and then its int as a value

#

event login just adds uniquesto those

pallid mesa
#

yeah no, can't rely on player names

#

they can get repeated

#

at least with our subsystem

high current
#

ah

#

got ya

pallid mesa
high current
#

cant you get local machine name'

pallid mesa
#

nah steam provides me the steam-id

#

so I can use that

high current
#

yup

#

or get their motherboard and cpu combo

#

πŸ˜„

#

read that somewhere today

pallid mesa
#

lol XD

#

well thank you so much for the rundown

#

I think we are getting way too granular with the details hehe

high current
#

and then someone pranks you and breaks your system by managing to switch CPU's and rejoin the same session

pallid mesa
#

πŸ”¨ banned

high current
#

but yeah, np, anytime πŸ˜›

#

there we go, UT loads extremely sloww πŸ˜„

pallid mesa
#

πŸ‘

#

I'll profane a bit your original implementation

#

but the idea is cool as heck!

#

Didn't think about the .sav stuff

normal raven
#

Does anyone know the correct way to get the current server time in a BP? Does the BP need to be replicated to get the server time?

cloud ledge
#

There is a server-synchronized clock in UE4 already

#

One sec, I'll tell you how to access it. It's not very good though, I personally modified the algorithm to use NTP and make smoother corrections blah blah, but it gives you a real time in seconds, synchronized on all clients

normal raven
#

As long as it's within a few seconds it should be fine, the effect I'm using it for is slow and subtle

lost inlet
#

GetServerWorldTimeSeconds on GS

cloud ledge
#

It's a slightly laggy time source, but it's good down to ping msec

#

Yeah, that's the one

#

You get the GameState and call that function on it

lost inlet
#

it updates fairly infrequently, i had to increase the rate at one point

cloud ledge
#

I don't remember if I submitted my NTP PR, but many other people did

#

My problem was that it wasn't smooth enough and did not account for existing value when making the correction

#

So it would go in sync and out of sync at random based on luck during that time when it syncs

lost inlet
#

predicting ahead of the server time was something i would hate though because i want the last syncd time from the server, not a prediction where the server is now

#

smoothing would be good though

cloud ledge
#

@lost inlet check out the NTP protocol

normal raven
#

As long as I can call it once and have it be within a second or two it should be good.

cloud ledge
#

It's just a way to make a better estimate of servers time given more knowledge

normal raven
#

As I just want to call it at the beginning of the game and use it as a time offset for a material

#

in order to keep them synced between clients

cloud ledge
#

It can give you exactly what you want, I just added smoothing myself on top

normal raven
#

awesome

#

I'll give it a whack

#

and report back πŸ˜‰

lost inlet
#

but i don't want an estimate of the server's time

cloud ledge
#

Uh

#

The time you get from that function by default is a very very rough estimate

lost inlet
#

i want the time that was last synchronised to me, which is not an estimate

cloud ledge
#

That's an estimate...

lost inlet
#

not really when it updates, the only bad thing is drift

cloud ledge
#

If you simply send current time from server to client, the resulting value is an estimate with precision of ping mseconds

#

The time you get is only accurate to some multiple of ping reliably

#

In my case I'm syncing physics so I want the clock to be synced to server at least with 10-25 msec precision

#

If not better

#

The only way to get a true non-estimate time from server is to have server sit on the same machine or have it be connected with a high-speed LAN (and even then it's still technically an estimate in both cases, as there are overheads and undefined timings)

lost inlet
#

in my case, it was for telling the server "i saw something on my screen here at this server time" for a CSHD validation system

#

which doesn't need an NTP implementation

#

in the above example, you don't actually want to compensate for the RTT

cloud ledge
#

How do you know at which server time the player sees something? Well, doesn't matter, if it works, it works πŸ˜„

lost inlet
#

for CSHD, the server keeps a ring buffer of player positions at a given timestamp

#

and it verifies it based on the time sent from the client and the supposed position they hit

#

and for that, you need a somewhat accurate timestamp of what the server time was for the last update you received

#

which is kinda what that GS value provides

#

in source it was easy because you had the sync'd-every-frame gpGlobals->curtime

cloud ledge
#

The GS value is fairly inaccurate FYI

#

But if it's accurate enough for that, good. It wasn't accurate enough to sync physics

#

Unless they have fixed it in latest versions and I wasn't paying attention

lost inlet
#

i had to make it a bit more accurate because the default behaviour was not good, including having to call ForceNetUpdate

cerulean escarp
lost inlet
#

i suppose an alternative is working it around movement timestamps

cerulean escarp
#

cmon Tapa you gotta be able to look at the video

#

I know last time you said it was "too large"

#

you shouldn't have to download it to watch

high current
#

btw, I used synced game time from the GS in UT for some stuff, during development, scraped it at the end, but I dint notice it being off sync, + their HUD clock is synced nicely, so it might be worth a look in the source

cloud ledge
#

@lost inlet that's not a bad idea, movement stamps happen to have a better time sync implementation πŸ˜„

#

In CMC at least. But they conceptually don't need to be as precise πŸ˜„

#

Which is terribly amusing

lost inlet
#

ServerMove sends a client timestamp which you could get a server world time from

high current
#

@cerulean escarp yeah, I say it, looks like classic server correction case, maybe try turing on the netcorrection visualizations

#

to confirm

cerulean escarp
#

k I'll try it

#

I have no idea how to enable netcorrection visualizations @high current I looked for it but I couldn't find it

high current
#

p.netshowcorrections 1

#

should be this

cerulean escarp
#

ah so I just put that in the console

high current
#

I am not sure, haven't used it before, might be needed in the binaries, but hey doesn't hurt to try the console during pie

cerulean escarp
#

yep it started working in the console

#

how do I 'read' the outcomes

#

like what's good vs bad

high current
#

I think green is within the margin of prediction and red is when its forcibly resetting the position, but honestly no clue, I have only seen it, not used it myself

cerulean escarp
#

uh oh

#

every time it draws the green or red it has both green and red

#

and then it just doesn't even draw anything when I'm flying the helicopter

#

wow I'm stupid

#

I'm using AddWorldOffset to move the helicopter but I didn't have an RPC set up for it so it was only updating the location on the client

high current
#

welp

cerulean escarp
#

thanks for the help though

#

I can't believe I didn't see that

timid moss
#

Guys how do I avoid variable race conditions?

chrome bay
#

Can't really, just have to code around them

meager spade
#

how are you getting into a race condition?

timid moss
#

I have a replicated TArray for my player inventory and and I am trying to setup an RPC event ClientOnInventoryLoaded() to be called for from the server after the inventory is loaded. So when the server finishes loading the array I want to call the client rpc that way the client can do it's stuff after the server loads the inventory. But my problem is that by the time OnInventoryLoaded(), is called on the client, the client's inventory array hadn't actually gotten replicated yet so if I try to perform actions on it everything is null.

#

Guess I could do a wait delay thing but I'd rather not do it that way as there has to be a better way.

chrome bay
#

What is ClientOnInventoryLoaded doing?

#

Best bet is to use an OnRep callback and use that to do whatever you need once the inventory is received.

#

You'll never get that working reliably otherwise

timid moss
#

Setting the current weapon to the weapon in slot 0 of the inventory array.

chrome bay
#

Surely CurrentWeapon is a replicated var too?

timid moss
#

Yeah it is

#

But I need to call a client exclusive function on current weapon that does the setup for the weapon on the client

chrome bay
#

OnRep functions sound like the way to do it IMO

timid moss
#

I did on rep but then if I do that there is no way to tell if the inventory is finished loading for the first time within the on rep function

chrome bay
#

You just check it in both

#

so if (IsValidIndex(CurrentWeapon) && CurrentWeapon != INDEX_None) { EquipWeapon();} etc.

meager spade
#

my inventory sends a client rpc when the weapon is "Given" to the player, this is handled inside the inventory, so the inventory has to be ready

#

i dont give weapons outside the inventory

#

avoids these issues of "what is going to happen first"

cerulean escarp
#

so I've got a map that runs at a solid 120 FPS in the editor even at fullscreen, but when I run a dedicated server the map runs at a fluctuating 50-70 FPS that is constantly changing. what's the best way of diagnosing and fixing this?

chrome bay
#

Well first thing would be to run with a listen server if you can and see if the issue persists

#

Game is effectively running twice when you have the dedi server in the background, so a bit of performance loss would be expected.

#

Shouldn't be masses of difference though usually

#

Depends on the game

cerulean escarp
#

yeah I ran it on a listen server and the FPS was up to what the editor was at

#

it's only when running a dedicated server

winged badger
#

listen server with a client?

#

connected

cerulean escarp
#

would you say it would be safe to assume that the FPS will be as solid as in the editor if I have only the client running on my pc and the dedicated server running on a different one?

winged badger
#

it hugely depends on your test scenario

#

just having a lot of logs printed will drop your FPS like a brick

#

in this case - if you have tons of replicated Actors, standalone game without dedi doesn't need to evaluate anything for replication

#

as soon as server/client model comes into play, that changes

gleaming vector
#

did you turn off the FPS cap?

sour river
#

Hello, I'm using repNotify on some variables in a blueprint, the variable changes affects other client when sent from the server, but not when sent from a client to other clients?

fossil spoke
#

@sour river Replication is authoritative, only the Server can affect the change of a replicated variable on other Clients.

#

If you want a Client to change something, you need that Client to send an RPC to the Server, for which then the Server can make that change on their behalf.

sour river
#

Ok I see thanks

fossil spoke
#

Replication is only 1 way

#

From Server to Client

sour river
#

Got it thank you!

#

Let's say I have a racing game, the users can turn on the headlights/indicators/braking lights etc..
How would I go with replicating that to all clients?

On press headlight button > send RPC to server > switch variable with repNotify ?

brittle karma
#

@sour river u can have Replicated Variables and whenever user (lest say client) turn the indicators, it should actually call the server to do this job for him instead of client itself, and as i said cuz its replicated variable it will be all over network and every body will see it

sour river
#

But how can I execute a function on other client when that variable changes?

brittle karma
#

void OnIndicator(){
if(Role < ROLE_Authority){
//call server RPC)
}
else{
// its server running the code so its good to do whatever u want here
}
void OnIndicator_Implementation(){
// now its server call the function
OnIndicator();
}

#

what do u mean?

sour river
#

Not sure I understand...
I'm using BP, the replicated variable is a boolean
If the user changes its indicator, if it's set as replicated, all other clients will see it changed correct?
But I want to execute some functions when that variable changes (turning on/off a spotlight)

#

How can I detect on remote clients that the variable has changed?

fossil spoke
#

@sour river Yes use RepNotify

sour river
#

That's what I'm using now, but it's only calling onrep on the server

fossil spoke
#

In the RepNotify function is where you would turn the Headlights on or off depending on the new state.

#

Is your RPC being sent to the Server?

brittle karma
#

let me give some information maybe ull understand it.
when variable is replicated u can use something like OnRep function so whenever the variable is Replicated the OnRep function get calls. and about the question How can u detect on Remote client the variable has changed : look when u do something as client u send what ever the action is to server for handle that, and it Replicates that all overnetwork but the variable will only change for the specific client

sour river
#

Okay I think I get it:
Client calls RPC to server > Server switch the onRep boolean > replicated to all ?

fossil spoke
#

Yes

#

Since the Server is modifying that boolean, it will cause the Replication system to identify that change and then tell all other Clients about it.

sour river
#

That makes sense

ocean geyser
#

magic

sour river
#

Thanks guys

brittle karma
#

@ocean geyser i still dont understand why SetReplicated doesnt work properly for u in the constructor

#

QUESTION:: guys what is my mistake here? i thought UMG has nothing to do with server so its separate for every player,
im printing logs on the screen and it shows the amount of item(consider as bullet) the player has. fyi, whenever player overlaps a bullet item it adds 3 bullet to the overlapping Pawn. now as i said im logging the amount of bullets whenever player overlaps the item, and it works fine, for example , if client overlaps 2 items, 6 is going to be printed on screen, and at the same time other players are updating their own bullet numbers by overlapping and there is no conflict between them, i mean everybody updates correctly, now here comes the problem. im trying to show the bullet number on players screen, when ever server overlaps the item, it updates screen for server correctly and when ever client overlaps the items, nothing happens on client screen, HOWEVER it overrides the server Screen, for example if server was showing 9, now it will override to somthing like 3(if client overlaps the item) and server's bullet number just Overrides by every client, for example if there are 2 client and one server, server will update its screen by each time these clients overlap the item. what's wrong here?

#

i mean everything works pretty much on logs, nothing gets override on screen, every body keep their bullets. but on screen its a deferent story
here is how i send data into screen if its helpful

#

further info : i print the Bullet amount in Player Controller just before sending it on screen, and it works pretty well and flowless. so the only thing i myself am suspicious is Blueprint side(the picture above)

sour river
#

Not sure I understand but shouldn't Player index not be 0 ?

brittle karma
#

@sour river why not 0?

#

it is just updating server's Screen

#

i myself think that GetPlayerController[0] is just returning Server's PlayerController

sour river
#

Are you sure?

#

I'm not an expert, maybe players are not sorted, just my 2 cents to help you out

gleaming vector
#

@winged badger @pallid mesa OnRep doesn't work

#

deserialization of the UObject happens before the OnRep

#

and since the failure is in the ActorChannel deserializing the object, I need to know about the Outer switch before that even happens.

#

i think i just need to duplicate at this point

pallid mesa
#

Duplicate per now, I'll try to setup something similar on my end and experiment a bit with some ideas I have on the top of my head

twin juniper
#

is the only way to change the netfrequency of an actor component just to.... make it an actual actor ? i guess thats owned by the parent and such? im not sure so sure if spawning a replicated actor component for its parent is cheaper then spawning a replicated actor in this situation im not sure if this is normal practice

pallid mesa
#

On a side project I had, the data was stored on an actor, as well as the proxy, that way is extremely easy, now... You might still want to use Objects for this. I'll hold off until I can replicate it

#

@gleaming vector

gleaming vector
#

thanks

#

it's a difficult problem

#

because like

#

object pointers can be passed around

#

but they can't be replicated

pallid mesa
#

Tried the FFastArray approach?

gleaming vector
#

unless they have hte same outer as the actor replicating them

#

that still happens after deserialization

#

the issue is that the ActorChannel complains

#

so, the flow is

#

Object gets renamed to new outer -> Object is serialized and sent to client -> client reads data bunch, deserializes the object -> realizes that the object already exists (because it does), but the outer is different -> fails to resolve the object

#

but, yeah, i'mm switch this to a duplicate rather than a rename

#

may the GC have mercy on me

pallid mesa
#

Bless you xD

#

Be aware and leave room for a future change, just in case

#

As soon as I have some free time I'll try to replicate your scenario and see this non-sense by myself

#

Seems interesting

#

It is similar to a recent Issue I had with ownership and possessions πŸ˜ƒ

high current
#

🀀

granite peak
#

a replicated health variable i have doesn't seem to replicate to clients in a standalone game as opposed to PIE. EventAnyDamage runs on the server, so it should change the replicated health variable, but it doesn't seem to replicate back to the clients for whatever odd reason

winged badger
#

@gleaming vector pretty sure that issue a month ago had the Objects workign just fine

#

it was just complaining

#

and to complain

#

it has to be both resolved

#

and know which Actor it should belong to

high current
#

Someone was interested in the game clock sync thingie

#

realized I have had this in my tabs since like forever

granite peak
#

correction: the replication doesn't happen if i run the game from the main menu, but does happen if i run it directly from the editor

#

*from that level

winged badger
#

@high current the concept is good, but the implementation there is sloppy

#

as in, it has an error

#

it caches the server time, instead of ServerTimeDelta

#

and then just returns the server time

#

which means whenever you call the GetServerTime, you'll get the time on server when you sent the RPC

#

not adjusted for the time that passed since

high current
#

I still haven't read it :D, but thanks for the tldr, I will go trough it (has code snippets so it will take a while)

#

yeah, shouldn't it return server time + RPC travel time

winged badger
#

no, the idea is to cache the difference between ServerTime and your GetWorldTimeSeconds

gleaming vector
#

i mean, it's obviously resolving

#

it's just complaining

winged badger
#

so you just add those 2 up for current ServerTime

gleaming vector
#

because it can't complain without resolving haha

winged badger
#

what do you do when you rename it?

#

i mean, its probably not enough to just change the Outer

#

you make the new Outer (which is an Actor) hold a reference to it as well?

high current
#

yeah, I... idk its 4 in the morning, ofc you can get client world time, duh

#

gnite or good morning i suppose for some

winged badger
#

gn

gleaming vector
#

i store the object in an actor, yes

#

and ReplicateSubobjects it

#

basically, I have an actor that holds items in the world (for pickups and stuff), and I have my pawn who has an inventory

#

the Item itself is a UObject instance

#

I'm trying to pick up the world item, transfer the UObject instance from that actor to my inventory

#

if I don't change the outer of the actor, I can't replicate it down

#

if I do change the outer, when it's recieved by the client it complains

winged badger
#

what if you had a TWeakObjectPtr<AActor> Owner and OnRep_Owner does the Rename?

#

inside the UObject

#

that is, does the rename if Owner != Outer

gleaming vector
#

hmmm

#

that could work

winged badger
#

oh and if Owner != null, just in case

#

Unreal loves to crash when it has Outer null

#

for anything

timid moss
#

is there any way to dynamicly turn off an onrep functin?

#

like at runtime make a variable only replicated, but not replicatedUsing

sour river
#

Vehicle movements in multiplayer are very jittery/laggy... Does anyone have a solution to this?

winged badger
#

@timid moss and what would you gain by it?

#

you can just return from the top of OnRep function if some arbitrary condition is met

timid moss
#

To much to explain lol

winged badger
#

if you need OnRep to run just once

#

if (HasBegunPlay()) { return; }

#

should do it

timid moss
#

yeah but it will still be called from the server

winged badger
#

wait, we're talking about blueprints here?

timid moss
#

no

winged badger
#

c++ OnRep doesn't run on server

#

thats a BP thing

timid moss
#

srry i knew that i just messed up

#

but the server is what calls it

#

it runs on the client but the server initiates it

winged badger
#

not quite

#

the bunch is received, deserialized, and then the NetDriver checks if there is an associated OnRep function, and how many parameters it has

#

then calls it, indirectly

#

server "initiates" it only in the sense that it changed the value of replicated variable, nothing else

timid moss
#

k

winged badger
#

so adding a condition not to execute OnRep would require editing some low level networking code in the engine

#

having the OnRep function just do nothing based on a condition is super easy though

gleaming vector
#

@sour river enable physics substepping for one

sour river
#

@gleaming vector Thanks, unfortunately that didn't fix it.. :/

gleaming vector
#

yeah, vehicles are annoying

#

i recommend lots of smoothing and tolerance

sour river
#

What do you mean by that?

#

Do you think this is a settings issue in my BPs or a modelling issue?

gleaming vector
#

no, you'll have to dive into C++ and override some functions

sour river
#

Trying with the blue vehicle from VehicleAdvanced works

gleaming vector
#

namely int he vehicle movement component and actor

#

to put it lightly, vehicles suck

sour river
#

Okay.. thanks! Will dive in

somber glade
#

can a client player controller making an RPC set something on the game mode directly or do we need to go by way of the instance or game state first? When the 3D widget is pushed that would end the game, it uses the PC of the player who pushed it to make an RPC, so I'm just looking at the best way to get that information to the game mode.

ocean geyser
#

Server RPC, in the server rpc simply access the game mode, cast it(if needed) to do whatever your trying to do on the game mode

somber glade
#

Right, I knew that clients couldn't normally cast to the game mode, but I wasn't sure if they could or not after making the server RPC

ocean geyser
#

anyone know of a way to test for client disconnection for if a player force closes their game/altf4? i tried logout but that didnt appear to run

#

yes, remember, as long as your on the server you can really do anything you want which is good (and bad). just do proper checks, the validate function is there for a reason πŸ˜‰

somber glade
#

If you had a client disconnect, couldn't you just try to run a test event on them? And if it failed to return anything you'd know they were gone?

#

some kind of "run on owning client" that returned a bool.

#

or would that just crash when it tried to call to the client?

ocean geyser
#

im looking for something to trigger when the client force closes their game since it doesnt seem to be triggering anything

#

it would just crash the client i would assume, but the client would already be closed so it wouldnt matter lol

somber glade
#

I just wonder what the server would return in that situation like if you had a function to get a bool, but the client didn't answer. How long will the code wait to resolve that function if there is no answer.

ocean geyser
#

aparently there is something in the game in the game instance

#

i dont think you can receive a variable from a client with a simple function call?

somber glade
#

game state has your player array. Is there someway to monitor the player array for changes? I assume it removes the player if they disconnect.

ocean geyser
#

hmm possibly. i just really thought Logout in the gamemode would of detected it within 10 or so seconds. im guessing its thinking its lag and its just waiting for the client to respond?

#

idk i suck at this crap lol

somber glade
#

Me too, that's why I live in this channel πŸ˜‰

#

I don't know what the UE4 tolerance is for timeouts regarding lag.

ocean geyser
#

lol nice. its probably setable

#

seems like the only way is via a heartbeat kind of way. send a message to the client every X amount of seconds like you said, if it doesnt respond then theres probably an issue. really thought UE4 had something already built in for this

somber glade
#

you could also tick the game state and look for changes. If a player is missing from the array who was there last time and you don't have a logout event for them, you could clean them up. I'm not sure what might be more efficient, each client sending in a heart beat or just checking the array

#

probably not ever frame, maybe every 2-3 seconds is frequent enough to catch disconnects.

ocean geyser
#

if they force closed the game (or pc cut off for that matter) then i dont think they would be missing from the gamestate

somber glade
#

really? Might have to test that to see

ocean geyser
#

maybe, shouldnt be to difficult, i just havent made a gamestate class since i dont need one in my lobby as im testing lol

somber glade
#

Good idea, do you happen to know how a listen level handles max # of connected players? if i set it to 4, and at some point during the match one drops out, would the host keep itself advertised and could someone join automatically?

ocean geyser
#

not entirely sure on that, how do you stop advertising the server now? or is it automatic

somber glade
#

I don't know. I haven't gotten that far yet. I've got advanced sessions tied into the VR expansion plugin I'm using. I was using server travel to start the game, but I've ran into a bug with that that I can't, through days of straight debugging, solve so I simply switched to using the lobby level as the play level until I can figure out what the issue with that. So what happens is when the host makes the game he appears in the little lobby room, and all the players who join also join that little lobby room on the level. When they pick their avatars and start, the game mode just unpossesses their "menu" avatars and puts them in the new ones in a different part of the same map to actually start game play. I'm just wondering if someone drops out of of the game, if the server would show up as say 3/4 players and if someone new could join. If so I need to add some code to handle auto assigning them to a team in that situation.

ocean geyser
#

well i guess you will find out once you test it. hopefully it will as long as the player disconnects properly

#

well nvm Logout is running when i force close the one players game via alt f4

somber glade
#

yeah this week I might be able to get a test in on that.

#

so it is detecting it? Well that's good

ocean geyser
#

well me and you will be working on online sessions at about the same time then lol. si, idk if it will be detecting it when i test via steam on separate networks though

#

or if it just has some form of handling for closing the game via altf4

somber glade
#

You may also need to check what happens if a player crashes..if you can induce a crash

#

maybe put some kind of button event in that would reference a null point to force a crash to see if that works

ocean geyser
#

that will be easy, my code always crashes

somber glade
#

haha

#

thankfully mine doesn't do that as much anymore. It just refuses to do what I want.

ocean geyser
#

thats almost better lol

#

its funny when you look at how many issues you had when you first started in UE4, and then look to where you are now that you atleast have a clue to what your doing

somber glade
#

I had some epic issues the first project i made. I ended up having to replace several files, one by one in my project to solve a crash on editor start up

ocean geyser
#

yikes that sucks

somber glade
#

in blueprint I had a cast to something.. I think it was a projectile. But then the projectile had an assumed cast back to the weapon type, I duplicated the weapon at some point, and somehow.. I don't exactly know how, but the old weapon really didn't like that the projectile or whatever it was was updated to attach to the new weapon. So for about an hour I was trying to figure out why my editor was crashing every single time I started it. I was already using source control, so I went back and forth pulling directories out until I narrowed it down to the directory and then the exact file, and replaced it with an older version to figure out what was going on. I still don't understand why it was giving me a crash on editor start.

ocean geyser
#

yea thats frustrating, especially when it wont even load the editor to view BP classes and change them

somber glade
#

The worst part was that the old gun wasn't even in the scene. That was the real mystery. I get if that BP had an error or whatever, but when the gun wasn't even in the scene, it should still load. I ended up deleting the uasset, starting the editor, then pasting it back in and then editing it and fixing it there.

ocean geyser
#

yikes. sometimes when you move or replace BP classes, ive noticed their still "there" in the level

somber glade
#

Yeah, I've managed to have some real strange errors crop up in what I've made thus far. Ah well, it's always a learning experience.

ocean geyser
#

learning is always a major plus. this has been my biggest project undertaking, all my other stuff has been small little things strictly for the use of making tutorials, but man code piles up fast

#

whats your previous experience before UE4?

somber glade
#

when I was young in the 80s, I taught myself to program out of the back of the msdos manual which had a whole section on GWbasic. did qbasic/visual basic in the 90s in school, then did javascript, python, css, a little c++, and network engineering/sys admin stuff most recently before this. Programming wise, nothing quite as heavy as this.

#

you?

ocean geyser
#

well you have a background that covers quite a wide variety, nice. started school at the local community college for a CS degree (still have not gotten my associates degree), finished all my required CS courses for the degree which got me familiar with java and assembly, got bored while doing the rest of my required courses so i taught myself some reverse engineering skills, C#, and currently am learning UE4

somber glade
#

Nice, being able to teach yourself is always a good skill to have.

ocean geyser
#

yeppers, and a must for programming

brittle karma
#

im getting a weird behavior, i have a function in Player Controller which just returns a Value that i want to show in UMG, im trying this way to expose the value into BP,

#

whenever i play on a dedicated server, this GetLaser function doesnt get called at all.(im printing logs, whenever there is a server as player it prints the log every frame but on a dedicated server it logs nothing at all and after that BP runtime Accessed none error)

#

which it means its filled with default value, so what's going on? i thought PlayerController is a safe class for working around UMGs

pallid mesa
#

use GetOwningPlayer instead of "GetPlayerController"

#

@brittle karma

brittle karma
#

@pallid mesa there is no such a node, i searched, but there is GetOwningPlayerPawn

#

i myself think i made a mistake on that BP, cuz as i said whenever i run it on a dedicated server BP runtime error happens,

#

but whenever server plays there are no BP runtime errors, and of course only Server side gets the Correct UMG

pallid mesa
#

^that one

brittle karma
#

it turns out that get player controller returns player controller of clients too. i tested the recommended one too its the same behavior

pallid mesa
#

why are you checking authority on a widget

#

widgets are owning client only

brittle karma
#

but why it returns a Access none whenever im playing on dedicated server?

pallid mesa
#

using the getowningplayer you are getting a null aswell?

brittle karma
#

yes

pallid mesa
#

that shouldn't be right, unless you are trying to execute this weirdly

#

GetOwningPlayer always returns your owning client version of your controller

#

which would return null if your controller is null

brittle karma
#

the weird thing is that GetLaser function returns a true value for every player in C++

pallid mesa
#

oh get laser is server only as far as I can see

#

meaning that you have to bring the value that getlaser is returning to the client

#

if you use the style guide correctly, it should be server only

brittle karma
#

ah yeah i was checking what happens if i use BlueprintAuthorityOnly

#

let me remove that part

pallid mesa
#

but you gotta ensure first getowningplayer returns your controller right

brittle karma
#

i dont use any Variable for storing of Player Controller so i dont have an issue with filling value to the BP variable,

#

as u mentioned that GetOwningPlayer Should work properly

#

just for clarification can this be the reason im using the sequence node?

#

@pallid mesa ah im getting closer to the result, by removing that BPAuthorityOnly now server doesnt update its value when client overlaps items. now the only thing that remains to fix is this nullptr issue, thanks for efficient help Vor.πŸ™

pallid mesa
#

add the owning player input

brittle karma
#

whats the node?

pallid mesa
#

your controller

brittle karma
#

getowning player?

pallid mesa
#

self

brittle karma
#

still the same null issue remains

#

it cant get the widgete? or player controller is null ?

pallid mesa
#

okay so owning player is receiving now self which is your BP PlayerController and yet GetOwningPlayer is returning you null?

brittle karma
#

yes

pallid mesa
#

are you like... totally sure that is what is happening? Print please the controller value

brittle karma
#

LogBlueprintUserMessages: [LaserHUD_C_0] Client -2: BP_PlayerController_C_0

#

now this is not dedicated, server is playing too
LogBlueprintUserMessages: [LaserHUD_C_0] Client -2: BP_PlayerController_C_0
LogBlueprintUserMessages: [LaserHUD_C_0] Server: BP_PlayerController_C_0

#

i just checked it and i didnt set it to be replicaated

pallid mesa
#

hehe

brittle karma
#

but it was

#

the error remains still.

#

oh again whenever client overlaps server updates the UMG

#

((:

pallid mesa
#

create this widgets only on the LocalController that's for sure step one

#

another big difference is that I use the HUD class

#

to create all the widgets

#

so that might differ

#

try moving your stuff around I gotta go, I'll be here in some hours

brittle karma
#

sure thanks.

pallid mesa
#

^ BP_PlayerController

#

and the widget binding

#

this works out of the box

#

is similar to your problem

brittle karma
#

i moved everything to HUD and its fine now, there are no BP errors anymore

pallid mesa
#

fine, however if you do it that way It'll work aswell

#

however I recommend better to use the HUD class

#

that's the reason of its existence

brittle karma
#

yeah using HUD makes everything much cleaner, thanks

pallid mesa
#

πŸ‘

brittle karma
#

@pallid mesa in the first picture u send uve used IsLocalController inside PlayerController?

pallid mesa
#

aye

thin stratus
#

Main reason you get these errors is cause you blindly use BeginPlay

#

This calls on every instance of the actor. So for a replicated controller it's calling on server and client

#

That's why you need to limit to local playercontrollers

#

And also why HUD doesn't create the issue as it only exists on local players

#

Even your dedicated server was spawning a widget

crystal crag
#

Does anyone here have any advice on the best type to use to identify a player? For example: Player 1 has PlayerId of FString, int32, FText, etc?

#

That property would be stored/retrieved from a database

#

So like a primary key for that player that will always belong to that player, like a steam ID

fleet raven
#

a guid would make sense

crystal crag
#

Ok thanks

indigo robin
#

steam ids are 64bit integers

#

if you arent linking with external services you can use whatever

#

normal 32bit integer autoincrement primarykey is good enough

#

you can have another table that links that your-game-specific playerid to a steamid or other service id

solar stirrup
#

Should I store my player's inventory in the character or PlayerState?

#

I feel like PlayerState is a bit overkill, especially since the inventory would be replicated to every client

winged badger
#

my inventory is transient for a map

#

so i keep it in PS, so i can restore if after player disconnects

solar stirrup
#

aight

#

Can I use replication condition to only replicate the inventory to the owning client?

winged badger
#

easily

solar stirrup
#

alrighty

#
if (bReplicateToOwnerOnly)
{
    DOREPLIFETIME_CONDITION(UInventoryComponent, Inventory, COND_OwnerOnly);
}
else
{
    DOREPLIFETIME(UInventoryComponent, Inventory);
}

Like this right?

#

(inside GetLifetimeReplicatedProps)

ocean geyser
#

@solar stirrup set your inventory array to replicate with the owner only. if your trying to set it up to where you die and all the items are dropped, you can multicast the event and pass in the inventory array to that multicast function, that way you shouldnt be replicating your inventory to all clients when you dont need to

solar stirrup
#

well, that's exactly what the code I sent above does, thanks for confirming ^^ @ocean geyser

#

(bReplicateToOwnerOnly should be false for things like chests etc)

ocean geyser
#

ah i see what you mean. good idea

jolly siren
#

Does anyone know any techniques for hiding lag compensation in spectator?

#

In terms of weapon firing and issues where it looks like you are shooting far off of the enemies when they are really hitting them on their client

pallid mesa
#

^^^^^^^^^^^^^^^^^^ I'm also interested

winged badger
#

You could replicate the target for the spectators

#

Have them aim themselves

#

Approximate accuracy should be good enough there

high current
#

Well, if you are spectating in first person, perhaps about the spectator should get actor position, and forward vectors from the client that they are spectating, instead of the server corrected value, no idea if its possible though

#

I am guessing you are letting users spectate without delay?

#

but like vor, I am interested in hearing proper methodologies for that kind of stuff, so far I havent seen many games tackle this correctly

#

maybe perhaps overwatch, but havent seen esports stuff in a while, might be mistaken

fluid flower
#

What is the issue exactly? I've been dealing with something similar lately but perhaps I'm mis-understanding the problem πŸ˜ƒ

jolly siren
#

When spectating it looks like the player you are spectating is shooting quite a bit away from enemies and are still landing shots

#

Since on the shooters client they are shooting at the enemy

#

But from the spectators point of view they are way off

#

Especially troublesome with moving players

high current
#

I recently had to make my own spectator system for Unreal Tournament, and everything was fine during live play, I have a round based game mode so dead players are constantly spectating team mates. So I would say that Epic managed well in that department, perhaps you can see what they did: https://github.com/EpicGames/UnrealTournament

jolly siren
#

Good point yeah I'll dig into UT

solar stirrup
#

Aight so

#

We're planning on making our own movement, replicated and all.

#

I've been told to either make my own movement component with a Pawn, or reverse engineer the CMC. Which, apparently, probably has 90% of the engine's size (jk)

#

Does anyone have any pointer, blog post, tutorial or anything that would help me on this journey

#

Because Epic really didn't make it easy for us

#

If I have to reverse engineer the CMC, God help me

solar stirrup
#

Welp, looks like reverse engineering the cmc is the way to go

high current
#

what is your movement supposed to do

solar stirrup
#

I just want to have complete control over the movement @high current

#

since we're probably going to add a couple of things like special combat attacks that make you move differently and stuff

#

(and it'll allow me to refine my knowledge of the engine)

high current
#

you can write custom movement modes in the CMC

#

I am guessing the thing you are really after is the movement prediction of the CMC

#

you can write your own movement and copy that from the CMC, you don't have to rewrite the whole thing

#

unless you want to ofc

#

@solar stirrup

solar stirrup
#

yeah I'm not gonna rewrite

#

just override what's needed

high current
#

are you going to utilize physics for your movement?

solar stirrup
#

good question

#

if I had to guess

#

probably not

high current
#

eh, physics or alternative gravity would be the only reasons why I wouldnt just use and modify the CMC to my needs

#

but thats just me, and I am a noob here πŸ˜„

#

or if I need my character to walk above 90 degree surfaces lol

winged badger
#

@gleaming vector did you get it working with the OnRep_Owner?

gleaming vector
#

havent tried yet

winged badger
#

outside of work game project?

gleaming vector
#

well, if you count playing destiny 2 as that

#

then why yes

winged badger
#

πŸ˜„

ebon nimbus
#

I'm working on charging an ability and then releasing it. I have 2 separate functions; one for spawning/charging the ability, and one for shooting it(detaches the actor from the character mesh and activates the projectile movement).

#

When I shoot it, the projectile always moves along the path of where i spawned it

#

instead of where im currently looking

ocean geyser
#

@ebon nimbus what kind of character are you using? are you using the third person character where you can rotate the camera around the character without the character rotating? if so you will want to use your camera forward vector and not the actors

ocean geyser
#

question with the onlinesubsystem, i have a lobby that has a player cap, when the player cap is reached i want no more players to be able to join until a timer has finished counting down, but if a player leaves during this time, the server reopens and people can join again. i have this all setup and when the player cap is reached on the server, i call UpdateSession and set bShouldAdvertise to false, the problem is this does not seem to prevent people from joining the server. i also tried setting NumPublicConnections to 0 and that still didnt prevent people from joining. any ideas? i could do this on the client to prevent them from joining but NumOpenPublicConnections from the results of the found server returns 0 always so i cannot get the correct player count

fossil veldt
#

Hey guys, I'm trying to make a lag compensation system and the way I was going to go about it was to keep a buffer on the server of hitbox transforms at a certain time on the server.

Then when a hit is sent from a client the server finds the time that the client sent the hit and gets the hitbox transforms, Then does a trace to see if it hit.

Would this be the correct method of going about lag compensation or is there a better way?

Also not sure if UE4 syncs up animation states on the servers / clients by default does anybody know?

thin stratus
#

Would also be interested in a discussion about methods of rolling back server state to match client state to give clients a more precise aim feeling

#

@ocean geyser sessions aren't stopping you from joinin afaik. You need to update the MaxPlayers variable in UE4

#

Specify it when opening the server in the OpenLevel options

#

E.g. ?Listen?MaxPlayers=8

#

Then it will auto kick connecting clients if the game already has 8 players

ocean geyser
#

not a bad thought, i having it automatically find/connect to servers and since there will be a "pre lobby" with only friends, i need to get the current player count of the servers that are found to make sure there are enough free slots for the amount of friends connected in the pre lobby

fiery jetty
#

Hey all! I have a question about some profiling stuff. Was wondering what a good Count amount in the Actors tab is for something like 10-20 seconds of profiling? Been cutting down a lot of call with dormancy and all that but don't really have any data saying "X number and Y bandwidth is good for this duration". Obviously it depends on the server but some numbers would be helpful to know what I should be benchmarking for

brittle karma
#

i was practicing and i am stuck at this, why this doesnt work? when this DecreaseHealth function is being called i check if its server and if its not i call RPC function and in that RPC function again i call this DecreaseHealth but this time as a server and i expect server to do the job for client, but result is something else. it only works for server and there is a conflict between client and server, server gets the client data on its screen

void AMultiplayerBallsBall::DecreaseHealth()
{
    if(Role < ROLE_Authority)
    {
        Server_DecreaseHealth();
    }
    else
    {        
        Health -= HealthDecreament;
        if(Health > 0)
        {
            ARollerPlayerController* PC = Cast<ARollerPlayerController>(UGameplayStatics::GetPlayerController(GetWorld(), 0));
            if (PC && PC->IsLocalPlayerController())
            {
                GEngine->AddOnScreenDebugMessage(-1, 5.f, FColor::Red, FString::Printf(TEXT("Health %d "), Health));
                PC->SetHealth(Health);
            }
        }
    }
}

void AMultiplayerBallsBall::Server_DecreaseHealth_Implementation()
{
    DecreaseHealth();
}```
#

clients health(blue bar right above) is always 0,

#

i tried the code without the first if block( where checks if it has authority) and client get the blue bar on its screen too, but i think its a wrong aproach cuz server should do it for client right?

high current
#

The actual var is replicated right?

brittle karma
#

yes Health is a Replicated var

high current
#

'Health'

brittle karma
#

by the way that bar on the server screen show both client and server itself , if u look at the picture there is a different health number printed on screen

#

isnt it a reasonable approach? when that decrease health function is being called i check the authority, only server can decrease the client's health, so i call RPC and it do the job and decrease the health for client. but why this only works for server? I used RPC for Movements or Firing exactly this way, they are working fine

meager spade
#

clients call the server rpc

#

but

#

authority should only be the one adjusting health

#

damage should only be handled on the server

#

no need for RPC's to adjust health

#

server should be authoritive, only server should apply the damage/reduce a players health, cllient should NEVER tell the server to change someones health

brittle karma
#

@meager spade well that's right and in this case client asks server to reduce its health, is it right?

meager spade
#

no

#

client should never ask server to reduce his health

#

overlaps/damage should be handled server only

brittle karma
#

assuming we are client and we want to fire, we should ask server to do this for us right?

#

with RPC

thin stratus
#

Yes, but only the initial "I want to fire."

#

Everything after that should be checked by the Server, e.g. Enough ammo and the actual LineTrace to deal damage.

brittle karma
#

well if i want to reduce Player's health every second, i should ask server?

#

if i dont it will only happens locally

chrome bay
#

No, the server should just do it.

thin stratus
#

The only thing you ever "ASK" the Server to do, is forwarding Player Input

#

Everything else should already happen on the Server anyway

#

So only your "I want to fire the weapon" should be an RPC

#

Everything after that, may it be a bullet spawn, a line trace, a debuff that ticks every second, should just happen on the server

brittle karma
#
void AMultiplayerBallsBall::DecreaseHealth()
{
    if(Role < ROLE_Authority)
    {
        Server_DecreaseHealth();
    }
    else
    {        
        Health -= HealthDecreament;
        if(Health > 0)
        {
            ARollerPlayerController* PC = Cast<ARollerPlayerController>(UGameplayStatics::GetPlayerController(GetWorld(), 0));
            if (PC && PC->IsLocalPlayerController())
            {
                GEngine->AddOnScreenDebugMessage(-1, 5.f, FColor::Red, FString::Printf(TEXT("Health %d "), Health));
                PC->SetHealth(Health);
            }
        }
    }
}

void AMultiplayerBallsBall::Server_DecreaseHealth_Implementation()
{
    DecreaseHealth();
}
#

this code is only happening on server right?

#

client only asks the server and server do the rest

thin stratus
#

This should not have a ServerRPC version

#

We said this already multiple times now

brittle karma
#

i dont get it why

thin stratus
#

Cause it allows cheating lol

#

Client can just call that function on every AMultiplayerBallsBall instances

#

And wins the game

#

Plus the code in the middle:

if (PC && PC->IsLocalPlayerController())
{
    GEngine->AddOnScreenDebugMessage(-1, 5.f, FColor::Red, FString::Printf(TEXT("Health %d "), Health));
    PC->SetHealth(Health);
}

Is only ever called on the Server. Idk why the PC of the Server needs to have Health set

brittle karma
#

i thought every instance has its own PC and everybody will call its own /:

thin stratus
#

You limit that part of your code to AUTHORITY

#

And then you check "IsLocalPlayerController"

#

So that's only true on the Local PlayerController of the Server

#

So basically the ListenServer's PC

brittle karma
#

ok i need to follow more tutorials, im totally confused lol

pallid mesa
#

they somehow modified the "initial bunch for late joiners/net cullers" code in 4.23

#

and the possession issues that existed back in 4.22 doesn't happen anymore

#

so it wasn't exactly a possession issue (which would need a proper revision btw because there are still some flaws in the code)

#

so apparently now is not needed anymore to explicitly set ownerships and call unpossess manually

#

However, do it at your own risk. Just saying.

thin stratus
#

vor: Spends multiple hours and days on fixing a bug.
Epic: Oh, yeah that was fixed in 4.23.

pallid mesa
#

"seems to be fixed"

#

but yeah, the story of my life xD

#

I need to deploy one test for QA with the minimal setup on 4.23 because I am still skeptical

high current
#

Its almost as if they have everything fixed, and just look for pull requests, then release them themselves just to screw with you

#

Btw, I randomly got to thinking about mouse accuracy over network, how the server sees stuff and so on. Would it be at all useful for the server to look at your windows mouse pointer speed, mouse polling and DPI, to determine what's the maximum screen pos that you can move between updates

#

to figure out if you are aimbotting

#

I would imagine that can be fooled by most aimbots which will just interp screenpos,but still. Wondering if its actually viable

pallid mesa
#

Ah... aimboters. The problem with aimbot is that everyday it gets smarter and harder to detect due to the "natural movements" some aimbot aplications make.

#

If you want to invest in technology to review if someone is aimboting or not, it might be needed a human analysi... or a trained a neural network able to take that decision with several data from the "suspicious player".

#

But dropping a player just because he did a 360 shoot or something harder to achieve for a normal player is a no-go

#

You can try to detect these "weird situations". Track them, and then if the "weird situation" count exceeds a ratio, then evaluate the player more concisely.

#

But imho that player would have been reported already by several other users

#

the best effort you can make is to implement a hit leeway system, where you can't manipulate where you spawn your traces/projectiles in the client

high current
#

I am just thinking out loud, I am not in the position to be doing cheat prevention anytime soon πŸ˜›

pallid mesa
#

it's a cool topic tho :)

high current
#

best solution for cheaters I have seen is when Respawn recently introduced cheat based matchmaking

#

if they detect that you are hacking, they just put you in a pool with other hackers to matchmake against

#

without telling you

pallid mesa
#

I loved the GTA dunkey hat

#

XD

gusty monolith
#

Hi there! I'm struggling using steam. I want to show players' profile picture but since sending SteamID over the network is not working I'm struggling with it. Do you know what's the best approach for it?

pallid mesa
#

🀦

maiden vine
#

How I tell all Clients to run Execute console command?

#

Could I use Game mode for this

meager spade
#

server can get the playercontrollers, and send a client rpc

#

to execute the console command

high current
#

@pallid mesa

#

(β•―Β°β–‘Β°οΌ‰β•―οΈ΅ ┻━┻

pallid mesa
#

┬─┬ γƒŽ( γ‚œ-γ‚œγƒŽ)

#

XD

maiden vine
#

thx

ocean geyser
#

@brittle karma an example, if your checking to see if a player was shot via a line trace, you perform the line trace on the client, if it hit something then you call a server rpc to perform the same line trace, if the server hit what the client hit, then you simply call your lower health function. you dont call it from the client like that, you should only check if the player has authority in that function. if a client tries to call that function, it will run on the server as well so the client can call the function as much as he/she likes because it calls to the server right away

brittle karma
#

as i understand we use that authority guard to run the code on the server only and replicate the value to the clients, right?

#

but what i dont understand is when to use RPC and when to use replicated variables.

#

for example in a tutorial the guy used an RPC for pawn movement and said that client should ask server too run the codes for him, now i want client ask the server to decrease his health, but as guys said it is a wrong approach

ocean geyser
#

what do you have that would normally decrease your health? what even? you would want the event to run on the server, and have the server call your take damage if it deems it necessary

brittle karma
#

time

#

i want to decrease the health by passing of time

#

one basic question,
if(Role == ROLE_Authority){ // some codes here}
this only runs on server right?

#

so if it only runs on server so how its gonna change values for client?

#

if we make the variable Replicated it will do this for client? but how it recognize which client's value should be affected?

winged badger
#

why would you send the server a RPC to decrease clients health based on time?

#

server is aware of the rules

#

and the situation in the world

#

doesn't need the client to tell him what to do

#

with exception of user input

brittle karma
#

i thought it might be a good protection, so the client asks the server to decrease its health

winged badger
#

its not a protection at all, its a liability

#

and it consumes bandwidth

brittle karma
#

so what about this scenario? client overlaps the item. should server handle this one?

winged badger
#

server is aware of the overlap

#

this is an example of authority check coming into play

#

as the overlap will run separately on client and on server instances of item/character

brittle karma
#
void AP_Laser::OnOverlapBegin(UPrimitiveComponent* OverlappedComp, AActor* OtherActor, UPrimitiveComponent* OtherComp,int32 OtherBodyIndex, bool bFromSweep, const FHitResult& SweepResult)
{
    if(Role == ROLE_Authority)
    {
        InstegatorPawn = Cast<AMultiplayerBallsBall>(OtherActor);
        InstegatorPawn->UpdateLaserAmo(LaserPower);    
    }
}
#

in this overlap event for example. that authority guard is not necessary?

#

cuz as u said server is aware of this event

winged badger
#

the authority check prevents that code from running on client

#

nothing else

brittle karma
#

but here is my confusion if it doesnt run on client so it will only works for server

winged badger
#

i don't see where the confusion is there

brittle karma
#

what if client overlaps the item? the authority guard will fail

winged badger
#

and?

brittle karma
#

and client wont call that Update function inside if block

winged badger
#

clients pawn overlapped the item at (roughly) the same time on server and on client

#

if you're thinking that server and client share the same instance of your pawn or your overlapped item, they do not

#

they each have a separate instance of every replicated Actor, and every Actor loaded from package'

#

which are assigned a NetGUID so the NetDriver can resolve the object reference over the network for replication and RPCs

brittle karma
#

when i play as a client and i overlap the item, it passes the authority guard, im thinking ok our role in the game is not authority, but why we passed the if(Role == ROLE_Authority)

winged badger
#

because you are misunderstanding the term "play as client" or because you incorrectly assessed that it passed the authority check

#

one or the other

#

option 3 is that you spawned your item locally

ocean geyser
#

heres an example of what im talking about. i created a timer on the server, every X amount of seconds, the players hunger/thirst(in your case, health) gets lowered. the hunger/thirst variable is replicated and being changed on the server, so when the server changes it, the client receives it. make sense?
https://www.youtube.com/watch?v=eo4uwbDLKcI

In this tutorial we will be covering how to make a simple Hunger/Thirst system that decrements a little bit over time. We also encounter our first issue(that...

β–Ά Play video
winged badger
#

so client actually has authority over it, but the item does not exist on server

brittle karma
#

@ocean geyser i have watched it and yeah it makes sense i just am practicing and seeking the terms and new stuff, thanks (:

#

@winged badger please take a look at this short video, if u look at the logs on the screen, client calls the function inside that if(Role == ROLE_Authority) after overlapping the item,

ocean geyser
#

if its regarding overlapping events, the overlapping should occur on the server as well unless you created the overlap box component thing on the client so the server doesnt know about it. in the overlap event like you said, check for authority and you should be fine, only the server will run the code from there

brittle karma
#

so here is what i understand, whenever client overlap the item, that overlapping event automatically runs on server for the client?

ocean geyser
#

should yes. the server knows where each item is(if it was created on the server), so the overlap event should run on the server because the server can see that its overlapping

wheat eagle
#

guys I am having an issue: I am uising interp to constant function to interp a parameter of a material to smoothly make it glowing. In the delta time parameter I put the delta time of the tick and I set a constant value for the interp speed. The problem is that for a client with more FPS, the glowing "animation" will be done much faster than for someone with lower FPS. What should I do so the "animation" takes an equal number of seconds to be done for everyone?

timid moss
#

multiply the speed of the animation by DeltaTime

#

oh wait

#

u already use deltatime?

#

can i see your code?

wheat eagle
high current
#

FInterp nodes / whether constant or not are not the most reliable

wheat eagle
#

i tried multiplying the speed with something that would make it slower for clients with more fps and faster for clients with less fps but it wasn't that great

timid moss
#

im pretty sure you need to plug in a speed to the interp speed paremeter

wheat eagle
#

oh wait it was supposed to be 2

#

for interp speed

#

i forgot to change it

high current
#

Ah yea, well you speed needs to be something other than 0, and on top of that, you need to be setting in the variable after you interp it, so that next interp is closer

#

your current variable should be the one you set last frame

wheat eagle
#

ok ignore that image I just made something up really quick but it didn't prove my point. Here is what my actual situation is:

#

im trying for this one to set the location of a actor

#

for clients with better performance, it goes faster than for the clients with less

#

i need to somehow make the speed dynamic so it is the same for all the clients

#

but i don't know how

high current
#

As I have said, interp functions are a mess, and since you are using BP and not C++, it will be tough to make your own

#

you can try using a fixed delta time, instead of relying on the clients on

#

set it to like 0.16

wheat eagle
#

hm ok

high current
#

run a client at 80+ fps

#

and see if it looks wierd in any way

wheat eagle
#

I mean I tried this before and it looked ok but I am not sure whether it's reliable or not to do so

high current
#

any reason why you are using this instead of a timeline?

wheat eagle
#

hm ok let me try with timeline I guess

ebon nimbus
#

@ocean geyser At this point ive used a first person and 3rd person camera, as well as the player controller, and just made up a random transform. All the same result

timid moss
#

Guys can an actor component have RPCs?

fleet raven
#

yes

timid moss
#

I have a question. So I have an actor component for my character called inventory and this piece of code is in itInventory[0]->ClientCallOnEquip(Character);Character is a reference to the owner of the inventory. (I pass this reference in so that I can get the character's mesh for some later functionality in the OnEquip method). So what this piece of code does is call a Client RPC on the weapon actor that then calls the OnEquip method on the owning client so that I can do some client specific effects when the gun is equipped. So with that being said, my problem is that when I pass in "Character" when calling the Client RPC (like in the code above), it is a good reference, but then for some reason when I call OnEquip(Character) within the client RPC, Character then = NULL. So why is it that once I get on the client on my weapon actor the Character reference is no longer valid? And How can I fix this?

main owl
#

Hi All, trying to find out why some variables are not replicating, I have done something similar on another blueprint which is fine, so not sure what is causing this.

Simplified, setting a variable on event begin play with authority of the server, if a client joins, so has no authority, it should in theory through replication have the variable set by the server, the player joins after the server is created, not at the same time:

frank plover
#

im having a very1 weird issue with my character not replicating attacking any help would be greatly! appreciated

#

this the bluprints for them

high current
#

Is combo 1/2/3 a RepNotify? you arent showing us your full code regarding your issue

grizzled bay
main owl
#

Yea have watched that, was not helping in this situation. Even when using a multicast, the variables are not replicating.

grizzled bay
#

the answer in that was use a multicast with a repnotify