#multiplayer

1 messages ยท Page 532 of 1

rotund sapphire
#

what is in the repnotify can explain the issue

shy kelp
#

the repnotify has only a destroy actor for now

rotund sapphire
#

you dont need to destroy actors on client side if your pawns spawned by the server

shy kelp
#

and the switch has auth doesnt really matter cuz this function is inside the event any damage

#

the actor isnt spawned in

rotund sapphire
#

yes i realized that by now, however reading your text i assumed it is onrep event, hence my confusion above

shy kelp
#

yh sorry abt that

rotund sapphire
#

in a multiplayer game i think spawning a player character is generally a good idea as you can properly understand the life cycle of that fella

shy kelp
#

im still trying to learn lmao

#

but yes, i understand

rotund sapphire
#

put print() nodes or breakpoints and see whats happening with the onrep event

shy kelp
#

kk

rotund sapphire
#

i think its possible your pawn could not destroy because some other actor may hold references to it

shy kelp
#

the client can damage it

#

when the thing "dies" it gives the client xp and everything

#

just doesnt destroy the actor

rotund sapphire
#

I dont remember exactly but perhaps placed actors cannot be destroyed.

shy kelp
#

also i havent considered anyone joining the late until now..... i have to do something abt that as well now lmao

rotund sapphire
#

props with onrep much better than multicast rpc for this reason too, they can give an inital state of pawn

#

eg you can make them look dead upon showing up on screen

#

because property has inital state of isdead=true you can do that in beginplay

shy kelp
#

k

#

i still havent found out how to destroy the actor yet but this was still helpful

rotund sapphire
#

I think it may because he is a placed actor, but not sure.

shy kelp
#

kk, so spawn using level blueprint or???

#

@rotund sapphire

rotund sapphire
#

gamemode will take care of spawning the default selected pawn type for any player joining in

#

you just put down some playerstarts which the GM will use

shy kelp
#

use gamemode for spawning, oh i usually level blueprint, thx for help again

rotund sapphire
#

level blueprint is not quite for this purpose

summer tide
#

@tawny parcel I got part of it fixed. It seems the animation appear faster as well.

#

Only in dedicated and in one of the clients dedicated unchecked.

cedar finch
#

So in order for my bullet impact effects and decals to show up exactly for every clients I have to make these events reliable. Is this efficient? Or is there a better way?

rotund sapphire
#

multicast rpcs are not comes cheap, a replicated struct may be better. also it's a funny concept your client seems authorative in telling the server what he just hit. usually its the server makes the same bullet path and figure out whether the client was true or lying about a shot. then server will tell everybody about a bullet hole by multicasting or replicating a struct with onrep.

#

reliable can be a problem tho, it may stack up rpcs since i think reliable actually needs confirmation from clients they received it

cedar finch
#

@rotund sapphire I run the bullet trace on server then just send the location and rotation to these events in order to spawn the correct emitter at said location and rotation. I thought that multicasts were supposed to be used in one-off events and that onrep's are used for important things like states or things etc.

rotund sapphire
#

ServerPlayImpactFX is accept calls from player to execute the event. If you only run this event on server, then remove the replication rule.

shy kelp
#

@rotund sapphire im sorry again, but when you told me abt ppl joining later, it kinda thrw me and a spiral lmao. this is suppose to be a equip sword system, where it destroys the old one in the destroy on equipped notify( the blueprint says it isnt, but it is), the notify contains a destroy actor. it works with all the clients currently in the game but if a new one joins it stops working https://blueprintue.com/blueprint/tyrnbvow/

rotund sapphire
#

You can use multicast rpcs, but answering your question you can optimize by using onreps instead.

#

BIVZe its going to spawn sword on client, however in networked game you want to only spawn stuff on server then set replicate true, so it will replicate to everybody. there you can attach it once the new actor will arrive.

cedar finch
#

@rotund sapphire Ok I lied lol I just looked and I run the bullet trace and hit events on the players and then just replicate the impactFX. I guess you're not supposed to do that because of cheaters? But my game is just a simple coop game so if they cheat it don't matter really.

rotund sapphire
#

i think its about respecting authority. the server is hosting the game so anything happens should come from server telling what to show. client can make a shot and show some local effects, but server will tell everybody else about his opinion of what exactly just happened.

cedar finch
#

I get what your saying. I think I was afraid that the listen server would get bombarded with too many bullet traces from all the clients that it would lag everyone.

rotund sapphire
#

i dont think that will be an issue

cedar finch
#

Ok I'll redo it for server and then use onRep if you say it's better than multicast. I just know there will be a lot of impact FX so I wanted it to be as optimized for the network as possible

rotund sapphire
#

Like i said you can continue use multicast rpcs, but perhaps a struct will replicate with less effort.

#

you can remove reliable tho, that's potentially an issue, can be blocking i think

shy kelp
#

@rotund sapphire i did a massive dum-dum

cerulean escarp
#

that's a big oof

peak star
#

Hey why would my game be able to find LAN sessions in a non-shipping build, but not able to find them in a shipping build? (When i was still using nonShipping build I set the ini file's Online subsystem to NULL)

summer tide
#

Any idea why only multicast plays anim montage but not when I use Run On Server?

river hazel
#

unless you are replicating the motnage play another way

#

the server will play the montage but the clients wont

thin stratus
#

Also depends on what you are even doing. Not enough info to help.

twin juniper
#

Could anyone direct me to some form of tutorial that explains how server-side saving works?

summer tide
#

@river hazel @thin stratus So I have a horse. I mount the horse by attaching the player to the horse's socket. The player has the controller. Once mounted I send player's MoveForward and MOveRight info to the horse' BP by using interfaces. In the horse BP, I update a variable called movement. Previously I used to use that variable in horse's animBP to play root motion animations. Now I'm switching to PlayAnimMontage and placing them in the horse's BP for network purposes.

solar stirrup
#

What's the best way to (de)serialize data from an archive into another archive? found a viable solution

solar stirrup
#

Just need to make sure, does NetSerialize get called on FFastArraySerializerItem structs?

chrome bay
#

yeah

#

Just not on something that has NetDeltaSerialize instead

#

Look at FFastArraySerializer::FastArrayDeltaSerialize in NetSerialization.h to see where it calls NetSerialize on the items

rain coral
#

Is there a special point in implementing FSavedMove_Character::Clear() and resetting all the custom values to the default, in the saved move, in CMC? Won't they have a default value through the header declaration e.g float SavedSomeFloatValue = 0.0f;?

solar stirrup
#

๐Ÿ‘Œ thanks Jam

rough iron
#

i am trying to use render custom depth but it only works on the server not on the clients, any ideas?
i have a multicast event

woeful ferry
#

Would this be the best way to add things to a players inventory when they pick something up? The interface is ran on server.

rain coral
#

@woeful ferry Is everyone on the server supposed to know that they have this item in their inventory? Or is it just a private matter between the server and the client that picks it up?

woeful ferry
#

@rain coral Well, when they get killed other players should be able to loot their friend's inventory.

#

That's where I think it would be relevant

rain coral
#

@woeful ferry The problem arises when a client joins the server after the client picked it up. The multicast only ran on the clients that were present at the time. If you want new clients to know that this player has this item, a replicated variable is more appropriate. All the replicated info is handed to new players, so it won't matter that they missed a multicast event

woeful ferry
#

That is true! So once the player dies or disconnects, you tell the server what's in my inventory?

rain coral
#

Well, the client shouldn't specify to the server what is in their inventory, the server already knows what's there.
The clients might not need to know whether someone else has a certain item in their inventory until they're dead/disconnected, at which point the server can update a replicated variable which exposes their inventory items to other clients.

#

But the main takeaway is that as long as the server updates a replicated variable with the inventory info, all current players and new players will be notified

woeful ferry
#

Thank you for the clarification. Trying to come up with a way to do this ๐Ÿ˜„

rain coral
#

^^ ๐Ÿ‘

woeful ferry
rain coral
#

@woeful ferry So in this screenshot, all the server is doing is calling a client function, so it gets added to the client's inventory, for that client alone.
Instead the inventory component itself should set Component Replicates to true, if I'm thinking about this correctly.

Then, I imagine the inventory component has an array of SlotStructures? In that case, the array should be marked with Replicated, or RepNotify. Replicated just means that all clients will get this variable when it changes. RepNotify is the same, but makes a function for you so you can do additional things (print a message etc) when the variable is replicated.

#

I don't know exactly how you've implemented your inventory though. But replication makes some stuff like this pretty simple. Whenever a replicated variable changes on the server, every client gets it

woeful ferry
#

I can show you, hold on!

rain coral
#

(but if the client makes a change to a replicated variable, nobody else knows)

woeful ferry
#

This is what it looks like when I add an item

#

My first go at a inventory system, so please be kind ๐Ÿ˜„

rain coral
#

It's probably fine ๐Ÿ˜„ So in this case, whenever Inventory (which is replicated) gets stuff added into it or removed from it, Inventory changes, and it will automatically replicate to other clients. Given that this happens on the server, of course, otherwise it won't be replicated to others

#

If you make it RepNotify, and make a print node in the RepNotify function, you can verify that it works as expected

woeful ferry
#

Thank you man ๐Ÿ˜„

peak star
#

Do i need to explicitly add android permissions or something in a shipping build.for android to be able to find LAN sessions? Does it use a.different ini file?

#

Versus the other build types used during development I mean

rain coral
#

@woeful ferry Wooo

woeful ferry
peak star
#

I mean what is the difference in shipping build that could cause that?

#

Mayne it has nothing to do with android. I am not sure where to look

rain coral
#

@woeful ferry You can use the RepNotify to update the UI with the correct info

#

Looks good btw!

woeful ferry
#

Damn that works wonders, now the UI updates too ๐Ÿ˜„

#

Slight delay, but it works

#

Probably doing thousands of network calls atm ๐Ÿ˜› Have to check out the network debugger

#

@rain coral RepNotify only works in multiplayer right?

rain coral
#

@woeful ferry If you change the replicated variable on the server, it runs the RepNotify on itself too, so it happens regardless of any clients being connected or not

woeful ferry
#

Yes, but my game is both singleplayer and multiplayer. Like if I play in editor without simulating as a listen server it won't fire.

#

Okay it works if I do a setter, then it fires in singleplayer.

rain coral
#

Ahaa. With singleplayer, do you mean if you just run it in viewport without any additional clients? I thought the editor always ran as if it was a listen server ๐Ÿค”

woeful ferry
#

Yes, with only 1 player it won't fire

#

Can you see the image?

#

It just loads for me

rain coral
#

Ah okay, so I guess it was on the server, but you had to explicitly set it. Yeah just loads for me too, but I clicked it and could see it then

woeful ferry
#

Yes, I have to set it in singleplayer if I want a notify to fire.

#

In multiplayer it works without it

#

But now I guess it will fire twice then?

rain coral
#

I see, good to know!

woeful ferry
#

In multiplayer that is

rain coral
#

Hmm, the clients will only get one, since they get it only if it changes from its last value. But I'm not sure if it will fire twice on the server, or if Set w/notify is the only way to get it to fire on the server

woeful ferry
#

Yes, if I add a set it'll fire once on server and once on client.

#

But in singleplayer it doesn't fire unless I set it

#

Interesting

woeful ferry
#

@rain coral Thank you for the help by the way, really helped me wrap my head around solving problems in the future with replication ๐Ÿ˜„

rain coral
#

@woeful ferry Anytime ๐Ÿ˜„ I ask a lot of questions here and get a lot of help too, only glad I'm able to give some back

woeful ferry
#

It'll be out on Steam in january ๐Ÿ˜„

#

So expect that I'll be here a lot too ^^

rain coral
#

In November 2017 I said my game will be in early access in march 2018 ๐Ÿ˜„ so I'll be ready for your game in January 2022!

woeful ferry
#

@rain coral Would love to see what you're working on, if you don't mind sharing in like PM.

rain coral
#

@woeful ferry I don't mind sharing here, but feel free to PM if you fear it will be too offtopic =)
http://gunandbuckler.com/ (hope this link works? Yesterday someone said it didn't)

woeful ferry
#

Nope it doesn't work ๐Ÿ˜ฆ

rain coral
woeful ferry
#

Oh shidd, it's this game! Seen this on the subreddit ๐Ÿ˜„

rain coral
#

Aah, right, yeah I post on reddit too! Cool that you've seen it ;D

woeful ferry
rain coral
#

Haven't seen it before, but looks gorgeous!

woeful ferry
#

Thank you! ๐Ÿ˜„

#

I wanna play your game with my friends and beers

#

Seems like a laugh fest

rain coral
#

Soooon ยฉ๏ธ

twin juniper
#

cant seem to understand what is the problem here

#

modifyItems function is inside c++

#

is it because its being called inside widget ?

#

yeah I guess it was the reason

queen flower
#

can someone link me to a youtube series that they have used for setting up multiplayer? There isnt one in the pinned messages which is surprising with this being a multiplayer help channel.

shy kelp
#

im trying to set up projectile but they do dmg to the owner as well as others, is there a way to check if the player is the owner of the projectile and and then do dmg

queen flower
#

dang. so bummed i missed when this went live

#

pin this? lol it happpened just after I hit the wall of setting this up and took a break.

cobalt whale
#

can someone explain me why i cant connect to my gamelift server if im using steam?

meager spade
#

how do we know?

#

we cant see your game nor your code nor anything..

#

we are not mind readers

shy kelp
#

lmao

cobalt whale
#

anyone never used gamelift?

shy kelp
#

im trying to set up projectile but they do dmg to the owner as well as others, is there a way to check if the player is the owner of the projectile and and then do dmg

#

i used gamelift b4

shy kelp
#

it went pretty smoothly for me

cobalt whale
#

if i just join without steam i can join. but with steam no

shy kelp
#

i nvr tried it with steam so idk

cobalt whale
#

fk my life

rose egret
#

when we spawn a replicated actor on server, properties that are equal with default value won't be replicated as initial bunch am I right ?

#

but they still take CPU performance ?

#

so how to disable them completely. (things like Instigator,bCanBeDamaged,..) AActor has lots of replicated properties which I don't need at all

fleet raven
#

there are some macros that you can use to change the conditions or disable replication of inherited properties

#

check the header where DOREPLIFETIME comes from

rose egret
#

can I ignore them by writing my own stuff instead of calling super in GetLifeTimeReplicatedProps?

fleet raven
#

that also works but then you have to make sure you copy paste the macros for the properties you do want

#

(and check if it needs updating on every engine upgrade)

rose egret
#

I want to spawn 10000 of actors which they are not replicating any movement and ... just need their actor ๐Ÿ™‚

#

hope that they are not private ๐Ÿ˜

copper grove
#

Edit*~~ ue4 online subsystem cross platform compatibility is still non-existent?... ~~ found a link on how to do it

rose egret
#

I have a technical question. ๐Ÿ™‚ why UE4 checks the replicated UProperties for change every time ?
couldn't they just use a boolean variable as state of a property ?

#

plus some Setter Getter functions maybe

rain coral
#

@rose egret If I understand you correctly, you could set an actor to be dormant, so that it never checks for a change, until you call ForceNetUpdate manually, at which point it will replicate in that frame, and then stay dormant.

fleet raven
#

it's because replication was originally made in a very dumb way, in 4.25 they are adding push model which finally makes it make sense (using explicit dirty lists rather than checking every property all the time for no reason)

rose egret
#

@fleet raven huumm

#

๐Ÿ‘

brazen sluice
#

So any final guide on how to reliably increase bandwith per player on server?
Seen a lot of things on the internet saying different stuff

analog rover
#

@fleet raven do you know where I can find more information about the upcoming push model?

fleet raven
#

find a header called push model in 4.25 branch

analog rover
#

Thanks

#

Do you if it's planned to be a full release, or just experimental as of 4.25?

solar stirrup
#

Is there an event fired when an actor/component loses net relevancy?

brazen sluice
#

Wait is it normal the editor inline server has a bandwith of only 3 - 4 kb/s ?

summer tide
#

If I setup my project to use Steam multiplayer, is it equivalent to testing in UE4 dedicated server check box on?

cedar finch
#

So I have a dismemberment system I created that hides the bones you shoot with your weapon. It works but I'm trying to not use Multicast and instead use OnRep to hopefully improve performance. How should I approach this? If I use OnRep would I have to promote the bone info I'm passing along to a variable so the OnRep function could retrieve it? https://i.gyazo.com/0ba834f91a1de9dd8a50ea5e9c83ee3b.png

ocean geyser
#

@cedar finch maybe a onrep replicated array of hidden bone names? in onrep loop through array and check if bone is already hidden, if not then hide it and play effect

cedar finch
#

It seems to work in-game. You think that's optimized?

ocean geyser
#

@cedar finch I think thats a solid route, good work

cedar finch
#

Now I'm stuck trying to make my shotgun bullet impact FX play OnRep. I have one linetrace function that I execute 8 times, one for each pellet of the shotgun. I just can't seem to get the impact FX to show up for all clients. Clients only see 1 bullet impact FX instead of 8.

ocean geyser
#

make an onrep for the effects when fired. store the impact points of the hits among other information that the client needs to know

cedar finch
#

It's like it happens so fast that it doesn't have time to set the impact variables and call the OnRep for clients that fast

ocean geyser
#

make a struct that contains the impact locations/rotations as an array along with the impact material for the effect?

meager spade
#

FX should be multicast

hoary lark
#

you can't use replicated variables to indicate the occurrence of events, you can only use them to carry and transfer important data about "current state". the fact that you can run code when they change does not make them suitable to use to represent the occurrence of events. the server will never send every little quick change to the variable (in your case it is obviously just sending the final change, the last pellet).

#

@cedar finch

#

super mega-simple example, if a player gets shot by 3 different bullets that all hit him on the exact same frame, the server will set their health 100 >> 75 >> 50 >> 30 all on the same frame as the bullets hit ... the server had previously replicated the health variable as 100, now it's changed and will be replicated as 30

spring ingot
#

@fleet raven This push model seems kind of awesome.

meager spade
#

would be once they work out the kinks with it ๐Ÿ˜„

cedar finch
#

@hoary lark I get what your saying thanks. I previously used a multicast but it only displayed the impact FX when I had it set to 'reliable' but I was told yesterday that could be an issue for the network. I'm not sure what to do. I just want it to be optimized for the network and display for everyone

split nova
#

@meager spade Sorry for the late reply, is it possible to do it in the AnimBP in any way? I've spent a long time setting up all my animations through the AnimBP.

meager spade
#

not networked root motion no

split nova
#

Damn.. Do you know much about montages? I have actually heard quite a lot about montages when searching up how to do networked root motion. I can't seem to find anything explaining the functionality of a montage and how I make it work similar to blendspaces and stuff though.

meager spade
#

montages are just animations played in game code

#

not for locomotion that kinda stuff

#

for things like sword swings, grenade throwing, etc

split nova
#

Yeah, I've heard some examples, like partial reloading for shotguns

#

I'm not sure how I'd make character movement in any way other than in the Anim BP.

hoary lark
#

@cedar finch shouldn't be any issues using an unreliable RPC for broadcasting "unimportant" events like a hit impact (that's definitely a preferred sort of use for them) :\

meager spade
#

don't use root motion

#

like most multiplayer games

split nova
#

Really? There isn't any way at all to use it? I don't mind any input lag as my setup can be played at 10 fps and feel smooth with a lot of input lag. (That's if there is a way that it can be done but it has input lag)

meager spade
#

why are you using root motion?

#

you can achieve the same without it

split nova
#

I like that the character has to put a foot down before stopping. Since my character is a Wolf. It feels a lot like controlling the Wolf, rather than you actually being the wolf. Makes it feel more realistic.

meager spade
#

you can do that with normal animations

#

using stopping animations

hoary lark
#

removing clientside prediction is never a solution. never. monkaS

split nova
#

I don't mind cheating. My game is a campaign game that will hopefully have up to 4 people (Invited by host) play. So if they cheat, that's on the host.
I think that's what clientside prediction does? Stop cheating?

#

Wait, were you talking to me @hoary lark? I'm confused.

hoary lark
#

yes ๐Ÿ˜„

split nova
#

ah

hoary lark
#

no that's not what clientside prediction does, it prevents input lag heh

split nova
#

Ah, well, eitherway. I don't mind cheating, so if that brings up any possibilities?

I got really close to having it work actually. The only issue was that the animations played at a separate speed for the viewer and controller.

#

I guess I'll have to get to making the same feel with IP animations.

spring ingot
#

@split nova It's possible to extract the root motion track from an animation and use it to move the character, which would probably replicate fine

#

But it's not straightforward when you start talking about blendspaces and complex pose processing

split nova
#

Ye. I'm pretty sure it'd be harder and much further out of my league when it comes to knowledge to do that, than to just make it feel kinda the same using the supported motion for multiplayer.
Though, given the right information as to how I could do that. I'd go down that path, I don't think the feel for the walking animation I have would be the same without root motion. The character slows down when the legs aren't really pushing forward, but when they're on the floor and pushing, the character speeds up a tiny bit.

cedar finch
meager spade
#

not really

#

how about if another player comes relevant never seen that zombie before

#

he will see the death animation again

#

or ragdoll start animating

#

then hear the zombies death sound

peak star
#

... (Continuing) does cross platform not work in shipping builds with NULL online subsystem for LAN?

cedar finch
#

@meager spade Oh yea. You taught me that a long time ago. Hmmmm this is where I get confused. I want everyone to see the zombie ragdoll when it dies, but I don't want to do it wrong where it's trying to replicate the ragdoll movement on the ground. That would be bad right?

#

i'm using the "Event AnyDamage" so it's on the server correct? How should I activate the ragdoll so everyone can see it?

peak star
#

I guess I could just ship my game using a non-shipping build if that is the case

#

But i would really like to know what makes Android unable to see LAN sessions hosted by PC on the same Wifi when it is a shipping build

#

So that I can still have a shipping build that is cross platform

meager spade
#

ragdoll should be multicast

#

actual being dead (final state after ragdoll, should be set via the rep notify dead bool

cedar finch
#

So in my case I simply check if health <= 0, if true then simulate physics, disable movement, delay 10sec, then destroy actor.

peak star
#

Since it was working in non shipping build

peak star
#

Well, I ly if I start the game, then turn the android's Wi-Fi off and back on again. Then it works. But this workaround doesn't work for shipping build. Any ideas why?

#

Using 4.23

#

Is advancedsessions plugin something that can solve this problem or is that only for Steam?

shy kelp
#

Is using a SaveGame BP unreliable for a multiplayer game

solid echo
#

Is using a SaveGame BP unreliable for a multiplayer game
@shy kelp Depends on the type of multiplayer game, but in general yes.

shy kelp
#

@solid echo what would u personally do

solid echo
#

@solid echo what would u personally do
@shy kelp Again, depends on the type of multiplayer game. Is is something like Conan Exiles where player inventories and stats need to be saved? Or is it just a FPS with static waypoints like Doom/Quake?

shy kelp
#

Conan Exile

#

I was thinking of using a SQL database or something but idk

solid echo
#

I wouldn't use SaveGame at all. SQLite would be your best bet since there's a really good plugin already out for it that's free.

shy kelp
#

thx

cedar finch
#

A chest or door and other actors shouldn't have 159 checks.

solid echo
#

Use RepNotify for chests.

#

If it's not going to be moving and is something static like a door or a chest, use RepNotify for those, otherwise it's constantly going to be sent over the wire.

#

Basically use a RepNotify bool if the door is open or closed, the client can handle the animation and everything else.

cedar finch
#

@solid echo Yea I know. I just watched this video and he said mentioned what I said above and it made me thing: https://youtu.be/KsORRtBOJYc?t=1751

BRY

๐ŸŽฎ Unreal Engine Replication Series - Part 4: Multicast & RepNotify

Part 4 of our replication series unlocks limitless potential with Mutlicast and RepNotify! In this video, we dive deeper about how Actor Replication really works as well as introduce ourselves to a variable re...

โ–ถ Play video
#

I timestamped it

solid echo
#

Yea, basically that.

#

And if you want to get fancy you can look into Replication Graphs

twin juniper
#

Should I be setting persistent variables that I want to save on a database so player stats stay when they log off, and get retrieved on game join, in playerstate?

solid echo
#

Multicast will send it out to all clients, a RepNotify is essentially the same thing with a callback function when it's replicated.

#

Should I be setting persistent variables that I want to save on a database so player stats stay when they log off, and get retrieved on game join, in playerstate?
@twin juniper It's one way of doing it. I usually stick things like that in an array and shove it in a DB (I currently use VARest with a php backend but that's because my game requires it due to using multiple nodes as one world.)

#

You can use their SteamID as their base unique ID in the DB.

sly arch
#

Is there away for multiplayer configuration? Meaning, a player would be able to host their own dedicated server and change settings through a config?

solid echo
#

Is there away for multiplayer configuration? Meaning, a player would be able to host their own dedicated server and change settings through a config?
@sly arch Short answer? Yes.

sly arch
#

How would that be handled?

solid echo
#

How would that be handled?
@sly arch Carefully.

#

lol

sly arch
#

lol

solid echo
#

You can read and write to the engine configs if you wanted to keep it easy

#

Or use something like a YAML file (i think there's a plugin for it)

sly arch
#

Yes! How would they host their own dedicated server though? Since all the players connecting would have to be saved per server.

solid echo
#

You give them the dedicated server binary and let them have at it? Everything should be self contained in it.

twin juniper
#

@solid echo so I have been doing it wrong lol had put loads of vars in my character not playerstate, time to fix everything, though essentially, I could just make a copy of the vars in playerstate, and hook them up to me spawning my character? Or I should port relevant code that is saved to playerstate?

sly arch
#

But how would they save every player data?

solid echo
#

To answer both of your questions, Just use SQLite (or MSSQL if you're feeling daring enough) and save players stats, states, items, etc in that.

#

and @twin juniper yea, basically you would spawn the character on the server and replicate all relevant saved info to the client when they load in.

#

The reason why I suggest SQLite over the internal save system is just ease of portability and management.

sly arch
#

Can SQLite be used to create advanced sessions?

solid echo
#

SQLite is just a storage mechanism, nothing more.

sly arch
#

But each server would have its own yaml file with every player data

#

and each server's data might be different than another

solid echo
#

You could use a master server

sly arch
#

That's sorta what i was thinking as well

solid echo
#

Or like I'm doing, I have a central DB that all of my nodes connect to store and pull player data when the player travels between nodes.

sly arch
#

That makes a sense.

solid echo
#

It used VARest to communicate with it, so it's an extra layer of security. You give the person a token, they set it in their config files, and they're allowed to communicate with y our servers through that API

sly arch
#

I'm assuming you're using AWS?

solid echo
#

You could also throw a salt in the dedicated binary itself.

#

Nah, I'm all self hosted for now. My lab is uh... bigger than most.

sly arch
#

Well I was thinking on making a config file in the binary and they would have the players info in that.

sly arch
#

Lol geesh

solid echo
#

I'm a senior linux engineer as a dayjob lol, so it's used a ton.

twin juniper
#

Insane

sly arch
#

Thats awesome! I'm / was before the conrovirus a intern at our local city in software development. Thats neat.

solid echo
#

But as for the salt, you'll want to throw that into the binary so you don't have someone trying to hack playerdata with just that token.

sly arch
#

True

solid echo
#

It's not 100% hackproof, but it makes it pretty hard.

sly arch
#

I guess im just confused on how to communicate to each server since each server would essentially have its own database

solid echo
#

You store only the the transient data on the master server.

#

so player stats, inventory, etc.

sly arch
#

Right, in that case I'll prob just use steam

#

How do you connect varest to each server though?

solid echo
#

The dedicated servers keep a local copy of that and then whatever gameplay data that's relevant to that server

#

varest is just a REST api.

coarse meadow
#

Is it possible to run a dedicated server + the game on the playerโ€™s machine, essentially having them host the game? Anyone see any big problems doing this?

solid echo
sly arch
#

Right, I've set that up before locally

solid echo
#

Is it possible to run a dedicated server + the game on the playerโ€™s machine, essentially having them host the game? Anyone see any big problems doing this?
@coarse meadow Depends on their machine, you could let them locally host instead.

sly arch
#

Or even if its not varest, how would I connect it to the databases of the people whom are hosting

solid echo
#

They connect to you, not the otherway around.

sly arch
#

A good example would be like Minecraft essentially.

#

Well, yeah

solid echo
#

Their dedicated servers would handle that bridge using an API.

#

NEVER let them connect directly to the DB, you'll need to store DB credentials in the binary and that's a huge nono

#

The master DB that is

sly arch
#

Which API would I use?

solid echo
#

Custom made

#

Welcome to Gamedev

#

lol

coarse meadow
#

@coarse meadow Depends on their machine, you could let them locally host instead.
@solid echo Do you mean a listen server? Seems when I do that level streaming replicates from host->client, something I canโ€™t have, and itโ€™s apparently hard coded into the engine

sly arch
#

mmm lol

solid echo
#

You can set it where the client handles the level streaming in world settings.

sly arch
#

Will steam API not work with that?

solid echo
#

I've never really used Steam API so I'd have to look around.

#

But you could use Steam API to get the playerd SteamID and use that as your global save ID for that player in your DB

sly arch
#

Yeah I've done that

solid echo
#

Essentially you'll have a Master DB and a Slave DB.
Dedicated server uses API to connect to Master DB when player connects to it, checks to see if player data is there, if not initialized data on both.

#

It uses a web or socket API to do that.

#

The easiest way would be VARest mostly because you can use Python/PHP/Javascript to make your custom API for your master server.

#

Or you can go the Java route and use websockets.

sly arch
#

Mmm, Makes sense

solid echo
#

But again, NEVER let players have direct access to the master DB.

sly arch
#

Well, yeah of course not lol

solid echo
#

Always have an API seperating it.

#

Youd be surprised how many people do that.

#

MY DB GOT HACKED.
Did you give them direct access and store the credentials somewhere in the game files?
Well... uhhh.... yea....
And did you give your DB * access?
Uh... yea...

sly arch
#

I'm sure. During my internship I've worked with the different databases but not creating my own API, but i'm open to learning so that'll be neat

solid echo
#

There's a lot of PHP examples, you can use the login script examples

sly arch
#

I've created that. I had a whole website created using php and html

solid echo
#

you can use MySQL for the masterDB and SQLITE on the dedicated servers, the SQL is interchangeable for the most part.

sly arch
#

That's the primary thing I did

solid echo
#

Well then yea, it'll be ezmode.

sly arch
#

Yeah, that's prob what I'll do

coarse meadow
#

You can set it where the client handles the level streaming in world settings.
@solid echo Just gave it a quick go. It seems the client's level streaming doesn't replicate (as intended). However, when the listen server player steps on a streaming volume, it replicates to the client still

solid echo
#

Well yea, it needs to.

#

Otherwise how is it going to know where the client is? ๐Ÿ˜›

coarse meadow
#

I'm trying to have each player only stream what is around them, while keeping things like players, AI, etc. on the persistent level

solid echo
#

You would probably need to use Replication Graphs then.

coarse meadow
#

I've only been able to manage it with a dedicated server. Does a dedicate server have much more overhead then a listen server?

solid echo
#

It doesn't load any graphics so it's not terrible.

#

But again, it depends on how performant your game is and the persons machine they're running on.

#

There's people out there that still use Core 2 duos and Athlon 64's lol

coarse meadow
#

Makes sense

solid echo
#

But yea I also forgot that that listen servers are basically all multicast

#

So that's why it's being replicated across.

coarse meadow
#

I need to read up on Replication Graphs. Can they be used in listen server mode?

solid echo
#

Not that I'm aware of. Rep Graphs basically split up the level kinda like level streaming does, think of each level as a replication server.

#

Or rather chunks.

coarse meadow
#

Cheers, watching it now. Btw, know if there's any security implication for running a dedicated server vs a listen server on a user's machine?

solid echo
#

Listen servers are more easily hackable on the listen side of things since everything is all in one.

#

It's basically the authority.

#

Also when it comes to lag, the listen side will always have the advantage since they're the authority as well.

#

Since, you know, they're basically at <1ms latency lol

coarse meadow
#

lol right

#

Many thanks for all the advice btw

solid echo
#

for competitive type games, you'll want a dedicated server. If it's something like minecraft or something that won't suffer from hacking much, a listen server is fine.

#

no prob

#

Dedicated servers don't discriminate, they hate everyone equally.

coarse meadow
#

Ha

#

The project I'm working on is online co-op in a relatively open world, so while competitive advantage due to latency or cheating isn't the main worry, it really helps to wrap my head around it all. The main headache has been getting replication and level streaming to play nice in listen server mode

solid echo
#

yea co-ops listen servers are perfect, as for level streaming and it not multicast across on listen server, I'm not sure, I don't use listen servers much.

coarse meadow
#

I'll probably have to take the performance hit of running a dedicated server on whoever is hosting, just adjust my target specs accordingly

solid echo
#

You could ask in the BP/C++ channels, they may know a trick or two

coarse meadow
#

True, I'll give it a go (during better hours). Tried the blueprint forums but didn't get any responses unfortunately

solid echo
#

Yea, multiplayer help is sorta limited in this discord lol

#

Something else you could implement (which is sorta hacky) is that since it's a co-op game, whenever someone wants to load into the streaming level you could do a "Player wants to go to x location, join them?" and if they say no then the level doesn't get streamed.

#

Since it's a co-op game, the players should be together anyways.

#

relatively at least.

coarse meadow
#

Interesting. Would that require somehow intercepting the listen server telling the client to stream the level, and stopping it from happening?

solid echo
#

Just trigger volumes on the edge of the levels and blocking the player.

#

Then just just check distance between the players when they hit the trigger volume

#

You could do something like FFXIV does with the blue dots in between zones.

coarse meadow
#

The way I've been envisioning and testing this is that each of the max 4 players can go anywhere in the world, and my main concern is that they each must only load the static meshes around themselves to keep things performant. If I understand your suggestion correctly, I would partition the world like FFXIV to get around this?

solid echo
#

Basically, the listen client needs to know where the players are at all times, the sad part is that since it's a player itself, everything gets multicasted

#

It doesn't know how to separate the players into there own replication bubbles basically.

coarse meadow
#

Makes sense. I think the FFXIV idea may be an interesting alternative as long as I keep the levels big enough

solid echo
#

Or, if you want to just do away with it all, just have a hook on the co-op menu that just spins up a dedicated server and call it a day lol

coarse meadow
#

lol leaning towards that yes

#

Just not used to working with dedicated servers. I know with a listen server the same codebase will work when playing in single player or multiplayer. I wonder if coding for a dedicated server splits the codebase

solid echo
#

sorta yes, you can use macros in C++ to separate the code so it doesn't compile, but as for blueprints and general design, it's not much different.

#

Call an RPC on the Server, Server Multicasts it to clients (or the client that called it), that's about it really.

#

Then your normal Rep/Repnotify variables and what not.

#

Keep in mind replicated variables only get replicated Server->Client

#

So if you change a replicated variable on a client, it WILL NOT update on the server unless you call an RPC to change it.

#

That was the biggest stickler for me when I first got into UE4 dedicated servers and replication.

coarse meadow
#

Ah I see

#

This is all fantastic info, much appreciated ๐Ÿ‘

solid echo
#

You can also set priority as well if it's supposed to be reliable or not.

sly arch
#

Oh neat. I'm reading it now. Thank you

chrome ruin
#

Hey, guys.
I want to make sure that I am using GameState and GameMode the correct way. I am trying to make an event that triggers when player interacts with certain object in game and when the player interacts with all objects of that kind to trigger another event that opens a door in the level.
So my question is where am I supposed to implement those events. Should I use GameMode or GameState?

winged badger
#

if the game is multiplayer, there is no game mode on clients

#

which kidna makes it awkward

#

but

#

unless its a very small game you should really use neither of those

#

as using a GameState to dump all logic of that kind in soon turns into a cluttered nightmare

#

but if you do insist on GM or GS, use the GS

#

as it will save you replicating the state of your trigger in each of the affected objects individually - as they can bind to a GS event dispatcher client side (as well as server side) on BeginPlay and react to single replication in GS

pliant ember
#

Hello, so Iโ€™m working on a game with multiplayer but want players to be able to host there own servers which I have. But I want the player data to save on there servers that player creates anyway?

#

So every server is different

bitter oriole
#

You want to host the save data on your own servers and have players host the game servers, correct ?

pliant ember
#

Yes

#

So if someone wants to download the server download anyone that joins will save into the server file

#

On that server only

#

@bitter oriole

bitter oriole
#

There is a big issue with this : how do you ensure a particular server isn't destroying saves, or cheating ?

pliant ember
#

A good example is Minecraft how they do there servers.

#

Player runs a .bat command and it starts

#

Each server will be disconnected from Mine itโ€™s like a completely different itโ€™s up to the owner

#

Of the server

#

If that makes sense

bitter oriole
#

So you want the save data to be tied to the hosted server, or not ?

pliant ember
#

Yes

#

Letโ€™s say if someone kills someone the stars will only stay on that server

#

Has a file

#

Stats*

bitter oriole
#

Then just save on the server when it quits and load a player's data when he connects

pliant ember
#

Doesnโ€™t make sense

#

Lol

#

I want it to save the information in the server files

bitter oriole
#

Player quits -> Save his data
Player connects -> Load his data

#

On the server

pliant ember
#

Yes so how would u do this

bitter oriole
#

Well... write a save system

#

There are a few tutorials on this

pliant ember
#

Or trying to convert unreal into java language then I know how

#

Use to do it all the time in java

#

Ok

kindred widget
#

You should consider starting with reading up on Unreals server type and how it's intended to work. That would help you understand where you should be considering implementing certain systems, like saving data.

pliant ember
#

I guess Iโ€™ll try that

#

Ok thanks guys

kindred widget
pliant ember
#

Iโ€™m also confused on something else

#

Cause I want to be able to build but others canโ€™t see it

#

Doesnโ€™t it need to send to the server first?

kindred widget
#

@pliant ember You mean that you want to spawn buildings, but when you do this, other clients can't see the spawned building?

pliant ember
#

Ya

#

Trying to find videos havenโ€™t find any good ones

kindred widget
#

@pliant ember In general, what you need to do is spawn the buildings on the server. It sounds like you're spawning them on the client. Things spawned on client only ever exist in the client.

meager spade
#

Replication only works Server -> Client

#

So a replicated actor spawned on client, will only be on client, Replicated actor spawned on server will be replicated to everyone.

pliant ember
#

Like for example how did fortnite do it they place it down

#

And I thereโ€™s dan see if too

#

It

kindred widget
#

You really should read that compendium. Taken an hour an and just read it. It will help put a lot of that stuff in perspective.

mint jolt
#

maybe an obvious question, but what is the networking layer using under the hood? UDP? TCP? I can't find anything in the docs that's concrete about it.

#

there's the option for unreliable RPC, so I assume UDP?

chrome bay
#

All of it is UDP

#

UE4 has it's own system for tracking delivery of "reliable" RPC's

woeful ferry
upbeat basin
#

Is it okay to ask questions about FSocket for C++ here or should I go to #cpp ?

#

@woeful ferry As far as I know you should call replicated events on Actors that exists on both Server and Client. So calling a Server replicated function on a Widget (correct me if that's not on a widget) doesn't fired since UI only exists on Client

woeful ferry
#

@upbeat basin Yea, I just had a discussion with my coworker and we decided that we should move the logic to the inventory component.

#

Not have it inside the widget

woeful ferry
#

I'm back, so if the owner (which is a storage box) exists on both ends, why will this not work to run on the server?

tawdry pond
#

How do make an object replicate on the user that spawns it ? so that no one can see expect the player that spawns it( c++)

meager spade
#

no @woeful ferry

chrome ruin
#

Hey guys, I'm struggling with passing object ref array from server to client.
I am trying to make a lobby and when a client is connected to update his nickname to a text render.
The issue is when I call the update when someone connects only the server updates his text render but not the client. Furthermore, when any other action is made (like choosing a character) everything works like a charm, but the first time the client connects doesn update anything in the text. And I get an error from the client that NONE was accessed trying to read the name from the object that I have passed from the server to the client.
Any idea?

meager spade
#

Server RPC can only be called on actor that is owned by an actor which has a Owning Connection (a way to a PlayerController)

#

regardless if the actor is on client and server, its Owner HAS to be a an actor with a route to Player Controller.

woeful ferry
#

I need to call that event from the playercontroller instead?

meager spade
#

@chrome ruin then your accessing it before its replicated

#

@woeful ferry ideally, yes, that is how i handle all my pickups

#

the controller handles Adding it to inventory, etc

woeful ferry
#

@meager spade Thanks, I'll look into it and come back with the news ๐Ÿ˜„

meager spade
#

try a slight delay @chrome ruin or use a rep notify/onrep and update it

#

if thats possible

#

with a property

chrome ruin
#

isn't that replicated when I call the RPC?

#

the event is called, but nothing is coming from the Spawned Characters Slots

meager spade
#

then the server has empty slots

#

where does the server call that

#

and what is Slots?

#

an actor?

chrome ruin
#

yes

meager spade
#

replicated right?

chrome ruin
#

yes

meager spade
#

then the client hasnt recieved the actor yet

#

when the rpc is called.

#

so it doesnt know about that actor.

#

it cant resolve what it doesn't know

#

so why not make SpawnedCharacterSlots on the server a replicated property

#

and in the OnRep function, do your logic

#

might be safer, but then again its a race condition

#

you can't guarentee the Spawned Characters Slots actors are going to be on the client when you try to access them

chrome ruin
#

so, basically I have to use RepNotify, and add the "Update Names" event to be called (or just put the logic there) ?

#

Holy .... You are the best!!!! It worked!!! Thank you man !

meager spade
#

๐Ÿ˜„

woeful ferry
meager spade
#

you cant do that

#

you have to call the RPC function ON the controller

#

oh wait

#

hmm

#

that should work..

woeful ferry
#

It fires the event on the client

meager spade
#

it shouldn't not via the PlayerController

woeful ferry
#

Never mind, it does fire on the server.. I need a break ๐Ÿคฃ

meager spade
#

๐Ÿ˜›

woeful ferry
#

Thank ya! ๐Ÿ˜„

hexed merlin
#

Hey guys, how do I differentiate between an actor being destroyed due to going out of relevancy versus being explicitly destroyed by the server?

meager spade
#

not easy

hexed merlin
#

Yeah I've noticed that.. lol

bitter oriole
#

Actually, there is a Destroyed() method or something

#

That takes a reason as a parameter

#

Check that

hexed merlin
#

Yeah i have, the EEndPlayReason only has Destroyed and some irrelevant ones

bitter oriole
#

Ah, that's too bad

hexed merlin
#

There is AActor::PreDestroyFromReplication but I vaguely recall trying that and having it trigger for both cases as well. Might try again just in case I messed something up.

jolly siren
chrome bay
#

That doesn't make sense to me

#

What the OP said that is

peak star
#

Test: can anyone see my messages?

chrome bay
#

yep

bitter oriole
#

no, we can't see them

jolly siren
#

yeah I didn't check for validity, just thought it was an interesting thread

chrome bay
#

Oh hang on, I see what OP is saying now

peak star
#

Ok. No response to previous messages then probably means nobody really has an answer for the questions I posted. I'll try my luck on answerhub. Worst case scenario I can just release the game using dev build instead of shipping build

jolly siren
#

They are saying there is room for supporting larger floats without increasing the data size (not higher precision)

chrome bay
#

I think the issue is that doing so would possibly decrease the precision for more commonly used values.

twin juniper
#

Hey! Anyone knows how I can perform movement on a character without possession?
I found the boolean "bRunPhysicsWithNoController" but that's not sufficient, my pawn is not autonomous proxy so it doesn't replicate movement to the server.
I tried to call SetAutonomousProxy(true) on the server but it didn't do the job cause client still "Simulated proxy"

chrome bay
#

If it's not autonomous then it gets the transform replicated from the Server.

twin juniper
#

I know but I want to set my client autonomous (without possessing the character)

#

The fact is I push Input into the InputStack of my controller to control my vehicle.

chrome bay
#

Not using character movement for vehicles are you?

twin juniper
#

I'm using it ๐Ÿ˜ฆ

chrome bay
#

I doubt it'll work

#

Autonomous by design means it's "controlled" by a client.

#

Either way you can only set the role on the Server, you can try it I guess

twin juniper
#

I'll try

chrome bay
#

I'm pretty sure a lot of character movement relies on having a controller though.

twin juniper
#

But the fact is I know that in some game, you don't need to possess to control vehicle

#

Ok

chrome bay
#

Yeah but I doubt most games are using characters for vehicles

twin juniper
#

Yeah ๐Ÿ˜ญ

chrome bay
#

You might be lucky, so long as the Owner is properly set along with the Role you might be ok

#

But it sounds like a nasty workaround to me

twin juniper
#

I didn't want to use VehicleWheel either and I didn't find good documentation about multiplayer ready movement component so I chose to use the CharacterMovementComponent

chrome bay
#

Well they all work in multiplayer technically, they just don't have automatic prediction and reconcile like character movement

#

But tbh, most games just don't care

#

Even fortnite uses client-auth vehicles.

twin juniper
#

Oh

chrome bay
#

We use server-auth in HLL because our vehicles aren't pawns and have multiple occupants, but we have input lag because of it. Thankfully the vehicles are so slow you don't really notice...

twin juniper
#

That's your game or Fortnite?

#

Oh HLL

chrome bay
#

Not FN, project I work on

twin juniper
#

Ok

chrome bay
#

I do what fortnite does in my own game, just client-auth but with basic anti-cheat detection.

#

e.g, make sure players don't insta-teleport 500 meters etc..

twin juniper
#

Sure, ok

#

Couldn't you unpossess the character and switch it over to the vehicle? (if driver?) then if they are just passengers dont possess and just set camera to follow the vehicle?

#

In any case, I attach pawn to the different seats

#

What you describe is my first implementation BUT I needed to be able to call RPC from the two entities (That sounds like multiple possess?)

#

no I mean branch check if driver/passenger, driver possesses put pawn in seat and move camera, passenger just dont possess car but still set the pawn in a seat and move camera

#

Yes sorry that's what I did

chrome bay
#

What I do is possess the vehicle but set the owner of the character to the player still, so they can still call RPC's on the character

twin juniper
#

Yes I tried that and it worked. But now I use the InputStack and I don't even needed to set the owner to send RPC strangly.

#

@chrome bay Sounds to be the best solution in my case

#

Except that a third party plugin that I use is not handling it properly ๐Ÿ˜ญ

#

Thanks for your answers in any case ๐Ÿ˜‰

#

I created most of the main code in the player character (including interacting with widgets), but a majority of the things are the same, but they are not the same between teams, some things like abilities are, though they have some team specific abilities, and this was decided in that code instead of player state. So things won't exactly get too out of control, can I just ask playerstate what is necessary i.e. attributes and replicate it to player character and do similar things on spawn? Does it make sense to not move lots of logic to playerstate this since there are just 2 teams, and many shared attributes/abilities? Instead of moving lots of logic into playerstate such as if it were a MOBA where there things like abilities are character specific where things would spiral out of control much quicker? Am I understanding this correctly?

twin juniper
#

You want to make an asymetrical game right?
Why did you not spawn different pawn depending the team?

#

Characters could have a lot of common components but the different abilities should be described as data (DataAsset or DataTable, for instance for each character, the list of GameplayAbility which can ben used)

#

PlayerState should store any data relevant to show for all players (Team chosen, character chosen if the pawn despawn cause it's too far for instance, Number of kill, ...)

#

Common attributes like health and resource count should be on the player itself on some components. So any replicated data should be available to a client if it is relevant to him (within its netDistance or any custom condition).

#

PlayerState should store any data relevant to show for all players
@twin juniper even though some are not all relevant, but thinking of where to put such variables, playercontroller doesnt work since its just controller I know that it shouldnt be used for this, the character doesnt work because it resets to defaults when destroyed, so that leaves player state or is there something else?

#

We use PlayerController in our game to replicate data for the owning client (like missions or any personal data not useful for others)

#

Oh but what did you want to persist?

frigid bluff
#

I have a server RPC that I am calling from my PlayerController, however inside of the function the RPC calls the remote role is always Simulated Proxy and not Authority. What would cause this? The client should have ownership over their player controller, which was the only thing I could think of that might cause the problem.

twin juniper
#

The fact is PlayerState are always relevant (if I'm not wrong)

#

persist the player stats, into player state, which sends it to GM when spawning player character/switching teams, and when playercharacter does something, it changes values on playerstate even though its not relevent to other people. Since its not relevent to them what would I use then?

#

Use database?

#

Player stats means Kill/score for a session?

#

oh I meant like booleans of what the player has access to in player characters abilities for example has access to something (T) not (F), or how many levels a player has

#

@frigid bluff You mean that your player controller has not the AutonomousProxy role on the owning client?

frigid bluff
#

Yeah, I call a server RPC on my Controller from the Character. I use a UE_LOG() to display what the remote role is inside of the function that the RPC calls, and it's always 1 (Simulated Proxy) even though I called the RPC from the controller which the client should own.

twin juniper
#

You call the RPC from the server then?

#

@twin juniper If we think about MOBAs, level and items are displayed to everyone (and refresh each time, the team has visibility over the enemy character).

frigid bluff
#

I have a check before I call the RPC to see if it's the local controller. So it should be the client calling the RPC.

twin juniper
#

So it seems to be stored in something like PlayerState. But maybe you could have a specific Actor to do that per client.

#

@twin juniper so dont bother with playerstate? example I have level here, pressing key adds a level and level point, are you saying that just save all the character variables in a datatable and update it on the DB when certain vars are changed such as when level gained, update on DB? Then when I spawn said character as well, just use the datatable from the DB to give playercharacter said stats?

#

@twin juniper You could use PlayerState if info should be available continously to everyone

#

But If you want to hide data sometimes, you should create a similar actor which is relevant with custom condition.

#

wouldnt i just be able to hook up said shown value from character into something like a scoreboard?

#

Player state is "Always relevant" and is never destroyed while the player is connected

#

PlayerState are used as scoreboard basicaly

#

I mean, what if there is a character specific var shown on scoreboard, but not in playerstate instead of the var being in playerstate

#

I see, let me think about that

frigid bluff
#

So from some further testing, it looks like the code that is calling the RPC is only on the server

#

but it should still run on server even if it was called from the server

twin juniper
#

If you said it logged "Simulated Proxy" it seems that it's executed

#

Except if this log is printed before

#

You said that it was inside, so that's called

frigid bluff
#

The code the RPC is calling is on an actor that has no ownership, it's just placed in the level. Which is why I was doing the RPC on the player controller. Should I still SetOwner even if the RPC is being called from the controller?

#

Also, how would I handle multiple people interacting with the same object if I was setting the owner?

twin juniper
#

You have to do a component on your actor which permit to call an RPC on your client to interact on the server with this specific object

#

Something like an InteractorComponent and the Object should have an InteractableOne or an interface as you want

frigid bluff
#

I use an interface to determine if an actor is interactable, is that what you mean?

twin juniper
#

Yes but you need an actor component on your pawn to use RPC Call from your owning client.

#

This way you can have multiple interactors cause they have all the interactor components

frigid bluff
#

So I wouldn't have to set the owner of the interactable actor then. I would just have a InteractionComponent on my character for example that would call a server RPC , then that RPC calls the interact function on the object? And since every player would have their own component, multiple people could interact with the same object and call the same interact function?

twin juniper
#

@twin juniper You want something like the final scoreboard of overwatch with stat per role/character? Maybe the simple solution is to store every stats but display only the relevant (or highest ones)

frigid bluff
#

Trying to understand this, new to multiplayer so I'm still trying to wrap my head around all of this

twin juniper
#

On the page 67, it explains with an example : A door which is not own by any clients

#

We use a Class/Actor, that the Client actually owns. And this is where the PlayerController starts to shine

frigid bluff
#

Alright, thanks

twin juniper
#

You're welcome

edgy dagger
#

Fortnite has crossplay
@meager spade fixed the issue, had to change some file settings in IOS config and the project, cross play on our dedicated servers works like a charm ๐Ÿ˜„

twin juniper
#

I guess I think I will just keep the stats and everything in the character but replicate certain relevant ones to others, and the stats/vars get retrieved from a datatable when character is spawned which also get updated in the table when they are changed. But that begs the question how would these stats persist between levels without player state? When the player switch levels, the stats are the same since they were already updated?

#

DataTable are read only data

#

oh then what would I use instead that has ability to modify values?

#

PlayerState data can be transfered between maps if that's what you want

#

yes that is, but how would I modify the values?

#

is there a variation of a datatable that I can modify from the game that updates some player tables in DB?

#

and all the playerstate data is also still relevant, which not all of it needs to be

#

Store data into a replicated structure per PlayerState

#

For the one that you want to keep

#

What is the point of these data?

#

Persist until server is closed?

#

to initialize player stats/what player has access to / replicate certain ones and persist until player leaves

#

So we don't talk about database data?

#

For the inititialization at least

#

but data would be coming from DB?

#

Yeah I think, use PlayerState to keep trace of data which persist between map.
And just store into an actor (AInfo) non persisting data per player into a TMap<Id, Struct>

#

Don't sure how to have struct inheritance or if we should use UObject to replicate them. I know that you can replicate UObject but that need a specific setup

#

Player joins, player requests spawn, GM determines team they picked, server retrieves player specific struct data for that team from DB, returns it into related spawn node with said data.

Player requests variable in struct to be changed, server changes it, makes change on database.

If level changes, it should be okay since those variables are now the player characters default variables?

Something like that?

#

Once the player has a team, the server should just create an UObject with a specific structure for this team and store it inside an AInfo to replicate it in the current map.
For any data that persist more than one map, you need to have another structure stored in the PlayerState.

If you need real persistance. Use a database is way simpler than that.

#

You just have to load the data once the character is connected. (or when he travels to another map) And save data of this character with a regular interval

#

You just have to load the data once the character is connected. And save data of this character with a regular interval
so this would not need player state to persist between levels?

#

Yes

#

But it means having a real database server (or at least small local one)

#

It depends if your game need persistence or not

#

If that just session based with reset each time, you can try my first solution

#

so playerstate is more like for singleplayer persistence, in tandem with saving the game progression

#

No you can using it when player is reconnecting cause he just crashed or when he travels to another map

#

Cause saving progression in multiplayer is using a database

#

I meant local progression

#

like save file

#

No you can using it when player is reconnecting cause he just crashed or when he travels to another map
but would not be necessary because data would already be retrieved from DB?

#

Not really cause PlayerState is not saving anything. If you logout and you come back two days later, every progression will be lost cause the server could have clean the object or restart totally

#

Yes not necessary

#

If you have a DB

thin stratus
#

Given UE4 Servers have to be restarted frequently, that is very much the case

twin juniper
#

In most case, PlayerState is more used for session based (Think about a DeathMatch or a BattleRoyale or a moba)

#

Given UE4 Servers have to be restarted frequently, that is very much the case
also wouldnt matter if it was a dedicated server?

#

okay that makes sense

thin stratus
#

Well, it counts for UE4

#

But Player usually don't play 24h+ straight

twin juniper
#

For instance, you could chain multiple games in a row and persist your kills and deaths count between maps until you disconnect

thin stratus
#

So yeah, mostly for Dedi Servers

twin juniper
#

@twin juniper Yes Uptime of UE4 is generally not more than 2/3 days without having lot of lag issues. Don't know exactly why

thin stratus
#

Because of float numbers that can't increase for ever

twin juniper
#

Oh yeah like the timeSinceStartup ok

thin stratus
#

Yeah

twin juniper
#

In most case, PlayerState is more used for session based (Think about a DeathMatch or a BattleRoyale or a moba)
so if player state is not used between levels, when loaded on new map, everything is reset to its default value?

#

For instance, you could chain multiple games in a row and persist your kills and deaths count between maps until you disconnect or server shutdown and restart
It's used between levels but not between server restart

thin stratus
#

It's actually pretty straight forward. Despite SaveGames, and such things, nothing presists a ServerRestart.

#

Or rather a GameRestart

#

There are a few exceptions, like graphic settings and such things

#

But they are mostly ini files so more or less a save

twin juniper
#

I mean just why arent the values persisting without the use of playerstate?

thin stratus
#

That's actually kinda not true

#

You can use the PlayerState to persist player related data on the Server, between map changes and also for things like disconnecting and reconnecting (think about traditional disconnect cause of internet etc.)

#

There are more classes you can utilize

#

PlayerController

#

And your own classes if you use C++

#

But that's only during SeamlessTravel

#

Any HardTravel kills that. So basically everything despite ServerTravel.

#

The Disconnect/Reconnect thing is more or less time-based. The Server keeps the PlayerState inactive for a bit, but ultimately also deletes that if the player doesn't come back.

#

Also I'm pretty sure that only works if you use a subsystem that uniquely identifies the player, like Steam.

twin juniper
#

You can use the PlayerState to persist player related data on the Server
So if playerstate isnt used, it just uses default values?

#

The Disconnect/Reconnect thing is more or less time-based. The Server keeps the PlayerState inactive for a bit, but ultimately also deletes that if the player doesn't come back.
Makes sense for things like CSGO reconnecting to comp match

thin stratus
#

So if playerstate isnt used, it just uses default values?
You use PlayerState either way. it's a Framework Class that you should always utilize. The PlayerState simply offers you to move data between old and new playerState in a seamless travel.

#

Makes sense for things like CSGO reconnecting to comp match
Yes

twin juniper
#

Yes, that's definitely not used to persist longterm data like player progression

thin stratus
#

And yes, if you don't actively make use of moving the data to the new playerstate (functions for that are OnCopyProperties and OnOverrideWith), then even with SeamlessTravel, your data will be reset to default.

#

And that all only counts for the time the server is up and running with the player connected.

twin juniper
#

okay that makes sense

thin stratus
#

These servers are meant for games like Unreal Tournament

twin juniper
#

thanks

thin stratus
#

You connect, kill a few peeps, go to the next map, kill a few more peeps, disconnect, go to bed

twin juniper
#

session based?

thin stratus
#

Well Session is a whole nother story

twin juniper
#

Yup, I use it for an MMO but we've lot of stuff around

thin stratus
#

Sessions are only info to register a match and be able to find and join it.
Like via Server Lists.

#

You can play without sessions if you connect directly via IP for example

twin juniper
#

I used the term session based to mean "short game" (Not the class of Unreal ahah )

thin stratus
#

Sessions also need a MasterServer, so there is a general place to register the session and to ask for a list of them

#

better to write "game based on short matches" or so

twin juniper
#

Ok ^^

thin stratus
#

Either way, any form of overall persisting data, such as player progression or the shitty Battle Pass crap that exists, should be handled in a backup, far away from UE4.

#

Same as data about characters, .e.g WoW.

#

(though, MMORPGs shouldn't use DedicatedServers of UE4 anyway)

twin juniper
#

๐Ÿ˜จ

thin stratus
#

Anyway, good luck, gotta eat some dinner

twin juniper
#

Thanks ! Have a good night !

pliant ember
#

Has anyone use unreal.js plugin before?

livid holly
#

how do you properly use PreLogin (in AGameModeBase) to prevent players from joining the server? Do you have to call Super, or just set the error message to a non-empty string?

#

`void AMyGameMode::PreLogin(const FString& Options, const FString& Address, const FUniqueNetIdRepl& UniqueID, FString& ErrorMessage)
{
if (bHasStartedMatch)
{
ErrorMessage = FString("Match already started!");
}

Super::PreLogin(Options, Address, UniqueID, ErrorMessage);

}`

#

is that correct?

twin juniper
#

just set the error message to a non-empty string?
I think that's enough. I'll check

livid holly
#

actually I think the Super will possibly set the error message so this implementation would not work

pliant ember
#

I need java to Communicate with unreal engine and back

bitter oriole
#

Java, or Javascript ?

twin juniper
#

Yes it can override it in your case

pliant ember
#

JavaScript

livid holly
#

oh just saw how ShooterGame implements, it actually just calls Super on else

#

if (bHasStartedMatch) { ErrorMessage = FString("Match already started!"); } else { Super::PreLogin(Options, Address, UniqueID, ErrorMessage); }

pliant ember
#

Because I need unreal to find a file

median elbow
#

quick question about replication

#

is it a better practice to say, open a door using repnotify on an "IsOpen" variable, or to use a multicast event?

thin stratus
#

@median elbow Lemme ask you a question and see if you learn something from it:
Would you say a person who comes to the door some time later (or even joins later) should see it open/close?

median elbow
#

ok yeah, that did cross my mind

thin stratus
#

It's basically both though

#

You need to divide it into "What happens right now?" and "What state should it keep afterwards?"

median elbow
#

the thing is that the variable is there in both cases

#

actually, if you would mind baring with me for a moment, if i back up to why i had this question in the first place, its because of the replication hierarchy

#

i have a whole room which is an actor, and a wall as an actor, and the wall has a door which is an actor

#

i don't understand, but it seems that replication wont' work if i don't replicate ALL of that, and from my understanding, you ideally only want to replicate the higher level objects?

thin stratus
#

Each Actor needs to replicate on its own

median elbow
#

so i've got the "self" in an actor, and the default scene root, and then the component

#

but if an actor is a child of another actor, doesn't the parent actor need to replicate in order for the child to?

thin stratus
#

No

#

ChildActor Components only spawn the Actor

#

There is no other magic going on

median elbow
#

oh man, thats going to make my life easier then, this whole time i thought i had to replicate all the way down to the bottom actor if something needed to be replicated there

thin stratus
#

No, only the Actor that needs to replicate... needs to replicate

#

And for your door issue

#

You need to basically Multicast the action of it opening

#

But the state of it being open should be a repNotify

#

Set AFTER the door opened

#

And in the OnRep you probably want to check if the Client is already opening the door, and then let it open and if not, then fully open the door instantly

median elbow
#

interesting, so basically your saying to multicast the event of opening the door, then set the opened variable immediate after that, which has repnotify, and in the repnotify check if the door is already opening/open and if so leave it along, otherwise do the animation of opening the door?

#

sorry that came out a little wierd

#

could i just do repnotify only and make it reliable?

#

its not something that happens constantly in the game, but its important for the people currently in the game to see the door open

thin stratus
#

Don't do the anim

median elbow
#

also, nobody new can join

thin stratus
#

The OnRep should instantly open/close

median elbow
#

where should the animation go? just in the multicast event?

thin stratus
#

Unless it's in the process of opening

median elbow
#

oooh, i see

#

maybe i'll use an int, 0 is shut, 1 is opening/closing, and 2 is open or something

thin stratus
#

Na,

median elbow
#

alright, so i guess the important thing is that a good approach is to multicast the event, which runs the animation, and right after i send that event, i set the isopened variable with repnotify, and repnotify simply opens/closes the door if its not currently in the process of animating?

thin stratus
#

non-replicated boolean: IsOpening
non-replicated boolean: IsClosing

These are set to true when the Multicast makes Players in range open or close the door.
And set to false when that is finished.

And then a replicated boolean: IsOpened

When in the OnRep you check if IsOpening or IsClosing is true, let them finish or instantly fully open/close the door

#

Something like that

median elbow
#

ok perfect, that makes sense, thanks!

#

alright not to keep going though, but how about the replication hierarchy in this case?

#

i'm pretty sure i know the answer

#

but if i have a wall, who has a child actor the door, i don't have to replicate the wall right?

thin stratus
#

Correct

median elbow
#

because there's nothing changing in that actor itself

thin stratus
#

Unless the wall* also does some rpc/replicated stuff

median elbow
#

ok perfect! man i dont' knwo why but i thought there was this whole hierarchy thing i had to make sure was connected

#

ok, that makes perfect sense

#

and also makes things a lot easier

#

alright, what about in actors, you have the (selft), the default scene root

#

is there ever a reason to replicate teh default scene root?

thin stratus
#

That's Component based then

#

There can be components you want to replicate

#

And there can be none

#

Depends on the situation

median elbow
#

ok

thin stratus
#

Components don't replicate when the actor replicates. They have to be marked as replicate too

median elbow
#

but if i just want to replicate variables in the actor, i don't have to replicate the scene root then?

thin stratus
#

Correct

median elbow
#

ok, and about components replicating, are you just talking about their own propreties replicating?

#

or is there some other kind of thing you would want replicated with components? like themselves or something

thin stratus
#

Yes, only their own

median elbow
#

so this doesn't have to do with adding new components to the scene root or anythign, or does it?

thin stratus
#

Not really

median elbow
#

like if you add a component in bluepritns or c++ during runtime

thin stratus
#

Well that is something else

median elbow
#

oh ok

#

so i would need to replicate the scene root if i add a component during runtime to it?

thin stratus
#

No

#

:D You have a very weird understanding of replication

median elbow
#

ok so replication is literally just variable replication?

#

yeah, i'm sorry

thin stratus
#

And RPCs, yeah

median elbow
#

i'm still trying to figure out how far replication goes

thin stratus
#

Read my Doc pls

#

Pinned to the channel

median elbow
#

i promise, i actually read it a while ago

#

i might need to refresh though

#

i'll do it

#

these last couple questiosn were mostly just out of curiosity for now

#

alright so last question then, haha, RPC's include events or only repnotify's?

#

haha, i know that probably sounds like a dumb question at this point

thin stratus
#

You could just read the doc :P

median elbow
#

alright, haha, i'll do that

#

thanks for the help btw

#

and the doc of course too

floral loom
#

I'm new to replication.
Trying to make projectile replication.
I'm wonder if anyone has a sample i can learn from?

My problem is:
Atm either i get a duplicate projectile on client side from checking replication box on the projectile.
Or
Sound and emitters (explosion) won't work inside the projectile blueprint.

gleaming vector
#

gods, i hate name stability for networking

#

i have discovered something that has broken my understanding of what it means to have a name stable for networking

#

Custom spawned actors apparently don't have a stable name... so how do they replicate?

#
{
    return IsNetStartupActor() || HasAnyFlags( RF_ClassDefaultObject | RF_ArchetypeObject );
}```
#

if you use like SpawnActor() to create an actor, then it's definitely not a NetStartupActor, and it's not a CDO or Archetype

#

so this would return false

#

thus the name isn't stable so how do they replicate????

analog rover
#

Quick question: what would be the best way for setting a replicated variable on the client owned character differently from the server version?

#

Essentially my character has a replicated property and I want to be able to set the property on the client and use that value, before it is sent to the server and replicated back

#

Right now the character calls a server RPC that updates the variable on the server which gets replicated out from there

forest kettle
#

Guys,
What's the difference between PostLogin and HandleStratingNewPlayer in GameMode?
I tried to print a simple string to get an idea when are they called and to my surprise they're both called on server and on client. Not quit sure when to use what?

#

@analog rover Run on Client event maybe?

analog rover
#

@forest kettle I was thinking of that, but I was wondering if it would be a bad idea to try to set the value for the replicated property from the client as well

#

As in, in the client side only code set the value of the property

forest kettle
#

Not sure what you mean by that! Do you want to set the same variable on the client and on the server but with two different values?

analog rover
#

I guess I should be more specific about what I'm trying to do

forest kettle
#

please

analog rover
#

I'm working on making a simple system to allow the player to equip a different tool/weapon

#

Right now I'm storing the type of weapon/tool as a replicated property in the character

#

And whenever the local character equips a weapon, they run a server RPC which then updates the weapon/tool type on the server

#

Which then is replicated back to the client and the local character runs some code to switch the view model, etc.

#

But I was thinking that there could be some significant delay when equipping an item because the character has to wait for a server response

#

So I wanted to set the equipped item on the client first and run the equip logic before hearing back from the server

forest kettle
#

I see...
I'm not a great Multiplayer programmer (I'm still learning from the pros here) but in my couple of years learning curve I noticed that there's no real reason to worry about delay between server and client IF your code doesn't have bad stacks or consumes heavy traffic.
That said, I would always wait to get a confirmation from the server that I'm indeed allowed to equip that item before I do anything in client

#

With all that said. What you could do is run on client the HUD, camera view logic and whatnot while waiting for server

#

Event EQUIP (RunOnClient): run your local code then-> Set isEquip -> Call Function RequestEquip (RunOnServer)

#

Or you can Call Function RequestEquip (RunOnServer), and drag from the pin after you called that function and run your local code

analog rover
#

@forest kettle thanks! I appreciate the input!

scarlet cypress
#

Hey People, im pretty new to multiplayer and just finished my first experimental game using the steam online subsystem. However i was wondering what online subsystem id have to use if i want to put my game on the epic games store for example. What alternatives are there to the steam online system? I wasnโ€™t able to find a single one on YouTube what really confused me. Thanks for any help!

rotund sapphire
#

They are two completely different companies, i dont think you should mix. Put your game on steam, also get a unique steam app id by running thru their system. The demo api id is not meant to be used in released games, but for tests only.

hazy siren
#

Epic has their own thing but I don't think it's been released to the public yet

#

you can look at services like playfab

rotund sapphire
#

steam has one particular advantage for multiplayer games it suppots p2p online

meager spade
#

@gleaming vector i am sure somewhere else it does a check for the NetGuid of the actor

#

and ignores that call

gleaming vector
#

it has to, but i wonder where

meager spade
#

been a while since i looked

#

two secs ill do a deep search

fading birch
#

UE4 supports P2P natively. When you use the Steam version of a session, you get access to everything in the Steam SDK. As for EOS, which is the Epic Online Services, it's public, but it's not fully fleshed out yet. There is some functionality that you'd have to create yourself that makes using the Steam or EOS SDK more attractive, as it's far less development time to use what they have, than to create everything yourself.

meager spade
#

its not P2P

#

its Listen Server

hazy siren
#

p2p and listen servers are not mutually exclusive

rotund sapphire
#

It technically is p2p for the listen server model, however for online p2p you need services like steam

gleaming vector
#

thats not p2p

rotund sapphire
#

pretty sure is. please explain why not :)

gleaming vector
#

p2p networking for video games implies that all connections are peers

#

there is no authority

#

in a listen server environment, someone is the authority

meager spade
#

^

gleaming vector
#

you are confusing it with network peers, which technically everyone is a peer

rotund sapphire
#

they are, and authority is a common issue in p2p games you need to implement a logic to figure out who owns what

hazy siren
#

that's absolutely not what at least half the people talking about p2p means

rotund sapphire
#

in listen server model you get the server to be the authority, thus no confusion

gleaming vector
#

it's still a client/server model

hazy siren
#

because when THEY say p2p what they mean is nat and hole punching

gleaming vector
#

you are confusing multiple meanings

#

context is important

rotund sapphire
#

Roy the issue with listen server model is same as p2p client-client games, which does not differentiate them in this sense

hazy siren
#

I'm not confusing anything

meager spade
#

UE4 is server-client model

#

just the context of server is different, either Listen Server or Dedicated Server

hazy siren
#

so lets just slow down

gleaming vector
#

p2p at the transport level is what you are thinking of

#

unreal is still client/server at the application level

rotund sapphire
#

this quickly escalated into an argument of schemantics. sorry about bringing this up.

hazy siren
#

someone asked about alternatives to steam networking, and p2p as an advantage of steam was mentioned

#

then you guys decided to make this about listen server vs authority less models

gleaming vector
#

you can have a client/server application running over p2p style networking

#

because network layers are a thing

hazy siren
#

but the context was what steam is talking about when they say p2p networking, which is hole punching and nat traversal

rotund sapphire
#

kaylen yes steam has this pretty cool advantage which is why i mentioned

#

and listen server (as a peer) can utilize it pretty well

meager spade
#

yes but its not UE4 supports it

#

you have to use a third party solution

gleaming vector
#

also you shouldn't be using steam p2p sockets, they are deprecated

rotund sapphire
#

via steam sockets which i believe is hooked on any network transmission while dealing with steam listen server games.

gleaming vector
#

steam net sockets are the replacement

#

and 4.24 supports them

rotund sapphire
#

guess its the same old sockets but fancy refactor

gleaming vector
#

it's not

rotund sapphire
#

hehe

gleaming vector
#

i was contracted by valve to do the UE4 implementation because Epic originally said they weren't going to do it... and then epic went and did it without telling anyone (we found out when it got committed to the UE4 repo)

#

so that was fun

#

but, anyway, that socket lib is a misnomer anyway

#

there is nothing p2p really about them

meager spade
#

epic make me laugh, i made a pull request to expose a function to BP (already in the engine), and they marked it as New Feature FFS

gleaming vector
#

they are just a wrapper around udp sockets

rotund sapphire
#

i was thinking of webrtc for similar purposes

meager spade
#

now its sat in a cue..

hazy siren
#

the p2p part is that it facilitates making connection between peers on the internet which is harder than you might think

gleaming vector
#

not that it really matters because 'p2p' has no meaning at the transport layer

#

everything is a peer at that layer

hazy siren
#

eh

#

I mean yes that is technically true

rotund sapphire
#

the issue is the connectivity indeed

hazy siren
#

but only because by saying "at that layer" you are excluding all the ways in which they are not peers

gleaming vector
#

correct, because the idea of peer to peer exists at the application layer

hazy siren
#

OSI model is not super useful for a practical understanding of how things actually work on the real internet

gleaming vector
#

like, yes, those sockets do nat punchthrough for you

hazy siren
#

otherwise we wouldn't need things like steam networking

gleaming vector
#

that doesn't make it inherently peer to peer.

#

you still need nat punchthrough for client/server

#

or, ignore nat and directly map the IP/port to the application socket

#

either way, that has nothing to do with a peer to peer application model for a video game

hazy siren
#

peer to peer from a position of authority and peer to peer from a position of networking are unrelated

gleaming vector
#

that is what i'm saying. peer to peer is meaningless at a networking level because at a networking level everything is a peer

hazy siren
#

in any network connection one party initiates the connection and is technically the client no matter what you do afterward

gleaming vector
#

when you get disconnected, the error message is "connection reset by peer" for a reason

hazy siren
#

anyway yes semantics

rotund sapphire
#

my guilt bringing this up sorry

hazy siren
#

does steam networking handle stuff like setting up the windows firewall exclusions?

#

or does it just do the networking and not the OS environment

rotund sapphire
#

some basic software firewall might actually support steam by default but for the rest i think it's managed by the user

gleaming vector
#

i mean, the semantics matter here, because if you say "ue support p2p by default" the naรฏve understanding is that means you can set a value on a client and it's replicated to other clients, which is not true

rotund sapphire
#

for comodo i had to press allow when install steam

gleaming vector
#

and, no

#

firewall exclusions are a butt

#

because windows firewall is a butt

hazy siren
#

it's gotten much better

gleaming vector
#

it still asks to open ports every time you launch a game for the first time

hazy siren
#

there's a relatively simple way you can register your apps connectivity now

gleaming vector
#

i dont think that's something done at the steam level

#

you would have to do it yourself at engine startup

#

which epic doesn't do because cross platform stuff

hazy siren
#

I haven't seen a windows firewall popup for a steam launched game in a long time thats why i was wondering

rotund sapphire
#

not much use for a firewall any software can bypass silently

gleaming vector
#

^^

hazy siren
#

firewalls that promise to protect you against processes on your machine are lying anyway

rotund sapphire
#

having some conspiracy theories on this night?

hazy siren
#

anyway this would be something that's done by the installer, not by the game itself at startup

#

oh steam installer scripts do have easy to use firewall exception setup

#

so that'd explain it

nocturne roost
#

Where exactly do you put dedicated server code? Such as connecting to the database (So it goes Client -> Dedicated Server -> Database). Would you put it in the GameMode? Anywhere you want with the #if WITH_SERVER_CODE tag?

ocean geyser
#

id think it would depend on what you are trying to get/store in the database. like persistency id do in the game mode so you can check everything on the post login function, retrieve what you need and give it to the player.

nocturne roost
#

So if I were to update the players inventories with their data according to the database, I would put that code in the GameMode?

#

And wrap it with the WITH_SERVER_CODE tag or is the GameMode server only in the first place. My goal is to make it so players don't connect to the database to prevent cheating in that kind

ocean geyser
#

the gamemode runs on the server. it still would be smart to make an API to interact with the database though to act as an interface so that the dedicated server is not interacting directly with the database incase someone manages to get their hands on whatever they need to access it

nocturne roost
#

How about this then Client -> Dedicated Server -> Master Server (Webserver?) -> Database

ocean geyser
#

thats how id do it

gleaming vector
#

@nocturne roost I would put it in the GameSession

#

or a GameInstanceSubsystem that is disabled and compiled out if !UE_SERVER

ocean geyser
#

didnt know you could do that, thank you

shy kelp
#

for health and stuff, should i be using the player state or is using the player character pawn fine?

ocean geyser
#

alot of people seem to use the player state for stats that you want visible to other players such as kills/deaths and such, personally i make actorcomponents for things like health/stamina and such to keep clutter out of the character. you can override TakeDamage though which is on the character so you may want to keep health on the character or just access the component from inside the TakeDamage function

shy kelp
#

@ocean geyser is there any problem with putting it in the player tho, cant you just put everything you put in the controller and state in the player character, unfortunately thats what i have been doing lmao

ocean geyser
#

just think how you want stuff replicated. controller is replicated between only you and the server, character variables can be replicated in any way you want. you can put everything in there if you want to

shy kelp
#

so there isnt a problem?

#

like performance issues or something

#

if thats it, i will keep it in mind.

ocean geyser
#

no, just replicate only where you need to. such as stamina doesnt need to be replicated to everyone, just between the server and controlling client. things like health you may want to replicate to all and such. depends on your goal

nocturne roost
#

@gleaming vector So is GameSession and GameInstanceSubsystem both not compiled in client side code? And I'm looking at the docs for AGameSession, are both of these restricted to the server compilation?

gleaming vector
#

they are, but if you use #if !UE_SERVER around your server-only code, it'll be compiled out

#

ie

nocturne roost
#

So the only thing the clients would see is the fact that they exist?

gleaming vector
#
void UFoo::Bar()
{
SomeCode();
#if UE_SERVER
   ServerOnlyCode();
#endif
}```
nocturne roost
#

I'm confused, I thought "!" was for "not" so would that be if it isn't a UE_SERVER?

gleaming vector
#

oops

ocean geyser
#

since their compiled out would it be a safe bet that it can access the database directly from that point? for example if someone reverses the game would any of the compiled out code be left in there or does UE literally just not compile it (if not doing a server build)

gleaming vector
#

i blame the fact my cat was sitting on my arm but it totally wasn't that haha

#

correct cody

#

if it's compiled out, then nobody can find your SQL queries

#

or connection info

#

they would need your server binaries

#

so protect those

nocturne roost
#

Ah lol. So in reality you don't necessarily need a master server if it isn't compiled in the code in the first place?

#

Or is it just common practice to have dedicated servers attached to a master server which accesses the database instead of having ~20 servers all trying to go into the database at a given time

gleaming vector
#

if you plan on distributing your server bins, I recommend having some API-type server that recieves data from servers and validates it

#

and just make a http call to that api server

#

i would recommend the web api path anyway

#

honestly

#

having a sql server exposed to the internet that dedicated servers can talk to is a recipe for disaster

#

it gets discovered and you are fucked

nocturne roost
#

I don't plan on having users be able to download their own, my plan is session based with roughly ~25-32 players a server

#

But there are inventories and items so I want to avoid being able to hack in items at all costs

#

So you're saying the best route would be Client -> Dedicated Server -> Web Server (HTTPS calls) -> Database

#

And it would just return what the database says with the http call?

ocean geyser
#

its what i did but it was unrelated to games so i wasnt sure how well it applied. it was fairly easy to actually write the web server portion once it was setup to work with the DB and calling procedures