#multiplayer

1 messages Β· Page 296 of 1

calm hound
#

General Rule: Start with multiplayer or don't do multiplayer at all

#

It's not a matter of just using some fancy replication functions or variables. It's an entirely different wy of thinking of how to program

#

You have 3 possibilities. Server, Owning Client, All Other Clients. And you have to keep all three of those in mind while you program otherwise things are happening or not happening in all sort of crazy ways you'll never expect when you start "converting" and you'll end up with a spaghetti mess before ya know it

sterile obsidian
#

tbh my game is already a spaghetti mess

#

but I'll probably leave multiplayer for a later date

#

/game

turbid stratus
#

hehe.. that's another thing I learned on this project (besides "multiplayer makes things harder") - keep the spaghetti under control (else even for a really small scope project it makes things hard to deal with near the end). I had used quite a lot of shared functions and macros which helped a lot, but on the new project I'm using collapsed nodes all the time as well, so you can just read event graphs at a glance, and commenting better.

versed socket
#

My personal opinion is that single player is just a listen server... so it's best to just make the multiplayer way of doing things the norm. I am retarded though so ymmv

thin stratus
#

This is actually correct, but only if you have a listenserver setup. If multiplayer is handled with a dedicated one it's not working anymore. Also you may want to still keep singleplayer and multiplayer separated. Less bugs to deal with i guess.

turbid stratus
#

is there anything special we are meant to do, to make the -nosteam launch option work?

#

if I stick that switch in, it still uses Steam like a boss

#

for now I'm just editing my config file manually to use SubsystemNull, but it'd be more convenient if that -nosteam option worked

stiff wasp
#

I always avoid having single player just being a listen server. It can cause a lot of problems

#

Better to use a new gamemode and have it be void of networking. Unless you want co-op

#

then

#

that is a totally different story

#

one I plan on covering in my guide

sterile obsidian
#

I'm just planning on implementing coop

#

But eh

#

if it becomes too hard then I might just not bother. I'll investigate it at a later date once I've made singleplayer somewhat better

wintry flower
#

really basic question about multiplayer and replication. say i make a simple function to increase character speed, and there's no acceleration. as soon as you increase by X amount your character moves at that speed. in a single player game this would be smooth obviously. but in a multiplayer game, if you have the server increase the speed, would you notice the delay from pressing the button to seeing the speed increase?

#

and how do you mitigate that? do you just set it as the player first and then immediately set it as the server so if you go over the limit by the server, it auto corrects?

surreal prism
#

@Minimpoun#3100 problem with root motions? Why? I'm using it, working fine

neon bluff
#

Helps a lot.

#

(And it's basically what UE4 does, behind the scenes).

#

So, in essence, you usually apply the speed increase at the client, and replicate it to the server.

#

The server processes the speed increase itself and compares the result to what the client sent, if it's within tolerance, there's no correction.

magic gazelle
#

guys I can't find anywhere information about sessions... Are they Lan only? Can I host a session from home, and another friend from a city join it? Also if he can join it, do I have to keep track of hosted sessions somewhere to make my friend connect to that data source and pull all hosted sessions?

thorn merlin
#

+kyojin are you using steam?

#

@magic gazelle i assume if you are using steam it provides this functionality, for my android game i maintain my own server list with a web service

#

@magic gazelle fyi there are a few different solutions to this problem on the unreal marketplace

eternal anchor
#

Back to yesterday conversation I have doubtful pleasure of converting single player game to multiplayer (not on unreal), and it is the worst thing one can do

#

coding even simple multiplayer is like coding async applications,, and that's for simple multiplayer games,

#

so you either do MP from day one or don't do at all. In single threaded single player game, you can assume that things act in some order and exist

#

in MP you must assume, that things will not happen in any particular order, and entities in world, must be as self contained as possible (in ideal world at least), and not depend on state of another entity

#

and that's what makes converting sp to mp so hard, at least in my experience

granite jolt
#

we need a "make multiplayer" button.

shrewd oxide
#

sounds like you should work for Hello Games

#

put it right after Make Universe

thorn merlin
#

i was going to chime in yesterday about this topic, i converted my single playaer game to multiplayer about 3 months in, and i had done multiplayer in unreal before hand

#

you can re-use a lot of your stuff but really you need to pull it all apart and the complexity of a lot of things go up (depending on what your game does)

#

you can't trust your client so you really need to build the game around that

#

so i +1 the statement "start MP or don't mp at all"

granite jolt
#

heh make universe. they should have released the game as a blueprint on the marketplace :p

shrewd oxide
#

hahaha yes

neon bluff
#

@thorn merlin I did a similar conversion and it really is a major PITA.

#

As in, "you should think about it from the start".

granite jolt
#

We are considering a multiplayer version of our VR game so both VR users that are online and not surfing porn can play together.

thorn merlin
#

its not impossible

granite jolt
#

Our game is simple enough to rebuild as multiplayer but even with a simple game like ours, I really really dont want to try convert

thorn merlin
#

but it'll be painful

shrewd oxide
#

I like your name

granite jolt
#

thanks it's my real name too !

shrewd oxide
#

πŸ˜‰

thin stratus
#

@wintry flower Yes,you would change the number on the calling client directly. So he won't notice.

stiff wasp
#

@wintry flower always handle movement on the client.

#

@surreal prism There is not really a "problem" with root motion and multiplayer. (Not sure if this changed, as I never use root motion and I don't follow the updates on it) Root motion used to be handled by AnimMontages. The animation would get replicated across the server, but the montage didn't. Root motion is now handled by the ABP. So, yeah you can use root motion in multiplayer, but it is more work. (At least, it used to be more work.) I always just use in place animations. There is honestly no need to use root motion. If you are making a very large multiplayer game like an MMO root motion animations would cause a lot of problems.

eternal anchor
#

To be honest nobody sane is using root motion in unreal to get basic locomotion working

#

engine is simply not made for it

#

I personally don't see any benefits of it

#

especially when the stuff from Paragon will be mainlained into engine

stiff wasp
#

^

#

Only time root motion could be kind of nice is when doing ledge climbing systems or any type of advanced locomotion. Even then, I still would rather just do it in code and not put all my trust into an animation.

compact gulch
#

@chrome bay hey... did you manage to get network replay to work with vehicle movement component?

#

i saw your post in 2015 talking a bit about replication for vehicles

#

right now.... the replay is very jerky for the vehicles

chrome bay
#

Yeah but I ended up writing my completely own component

#

I.e. not physics

compact gulch
#

with your prediction etc?

#

wow sounds like a lot of work

chrome bay
#

Bloody was haha, it's basically character movement, but I rewrote from scratch and had to make it diverse enough to work with vehicles. Can't even explain the pain I hast been through.

#

*different vehicles I meant

compact gulch
#

oh well

#

i'm using an extension of unreal's vehicle movement component

chrome bay
#

Literally gave up on PhysX vehicles.. utter nightmare

compact gulch
#

not sure if there's a solution to the jerkiness

#

what's your main issue with it?

#

you're using floating ones anyway right

chrome bay
#

The problem was syncing frames / moves / timestamp etc basically, and 'replaying' PhysX is a minefield

chrome bay
#

(back in ten)

thin stratus
#

9

stiff wasp
#

8

chrome bay
#

For UT3 etc, they just use client-authoritative physics and do a cheeky check to see if it gets 'too far' out of sync with the server, at which point they send a correction. It;s not great though

#

minutes :p

thin stratus
#

Oh, my bad ;)

#

I really want your projects source, james

#

:D

stiff wasp
#

hahaha, who wouldn't

thin stratus
#

Need to learn

chrome bay
#

Haha πŸ˜„ I cri erytim :p

#

I do need to write more tutorials tho.. just finding the time 🚢

thin stratus
#

Fock, still need to extend the Steam thing. But September is booked..

chrome bay
#

Haha IKR.. feels

#

ok actually need to go now back in ten mins :p

thin stratus
#

At least it's uploaded already hΓΆhΓΆ

#

Bye bye

compact gulch
#

@chrome bay that UT3 thing.. isn't that the same thing that is being done with char prediction?

#

oh wait nvm. char aren't physics

#

so UE4 vehicle doesn't have that 'check' to deal with vehicles over network?

chrome bay
#

Am bachhh

#

And nah, Character properly calculates movement on client and server, and server has final say. UE4 vehicles are basically identical to UT3 ones

#

In UE4 / UT3, client tells server where it is and server accepts it, and server sends replicated movement back. Problem is, that stops working as soon as you introduce almost any lag at all

#

Didn't matter so much for UT3 since they didn't really care I guess. I'm hoping UT4 will have a better system but no idea when they'll get on to vehicles 😦

#

I'd love to make my hovertank project open sauceeee but I gots big plans for it

granite jolt
#

i've seen horrible things happen in Paragon when there is a slight bit of lag. Attack ships on fire off the shores of Orion and everything.

thorn merlin
#

lol

fierce birch
#

@stiff wasp the video you linked is literally just bunch of physx constraints, not really related to the networking issues on vehicles

#

@chrome bay I should return to my components as well, would need to implement the networking on it (and tweak the collisions)

chrome bay
#

@fierce birch If you ever manage to complete / finish that it'll be awesome

fierce birch
#

it's just., mine is really specific thing for the collision parts, I have plans on having custom responses on specific colliders

#

it'll not be a generic solution

#

physics itself feel awesome though, like really stable compared to physx

#

I think you could get physx to do that on fixed timesteps though, but haven't bothered redoing that on later engine versions

#

one issue I'm debating myself with that is how it should be structured

#

I started doing it as physics movement component, but then I needed another class to manage the new time stepping for that

#

so atm I just have another one off class that does that and manages all custom physics components in the world

#

but it still runs once per tick, so if I wanted my custom simulation to interact, say ue4's destruction for visuals, I'd still need to sync that stuff up

#

it's not a huge concern though

#

I'll most likely also separate the network prediction code into separate class, because how ue4 does it is just silly

#

but would need to figure some smart way of doing that

#

just putting it down in the inheritance chain would be easiest, but that's not a very clean design

stiff wasp
#

@fierce birch I know it was. What is your point?

fierce birch
#

I thought you linked because people were talking about ue4 vehicles networking

#

I must have misunderstood you then, but why did you link it?

#

basically asking, what was your point?

stiff wasp
#

Linked it in the wrong channel

#

was meant for a PM @fierce birch

#

didn't delete cause I thought someone might think its cool

#

Β―_(ツ)_/Β―

wintry flower
#

So I have a few questions about multiplayer. Say you're making a simple game in the third person tempalte which is just people running around, and they can press a button to increase their speed (increase max walk speed in character movement component under third person character). I want to have a hud that would show each players current speed, which means I'll need access to all player characters to get that variable. However, where is the best place to store it? I know you can get an array of all player states, but you shouldn't store the speed there should you?

dusk granite
#

there are many places, for example you could store them in the gameinstance if you want to also store them between sessions

turbid stratus
#

I try not to answer networking questions because I'm noob myself.. but the PlayerState would be my first thought for anything related to the player that you need to access on all machines.

proud wren
#

hey @stiff wasp So I have been following your help with my spawn points. I have run into a probelm though. So, when I hit spawn I spawn all right.... but it spawns on every spawn point in the level

#

no idea why

#

any ideas @stiff wasp

#

okay, so I think the problem is in the gamemode @stiff wasp

#

@stiff wasp so if i try to tell it to only spawn once, it crashes

stiff wasp
#

mother fucker, it only takes one tag to get my attention. Not four and a PM

proud wren
#

i knew you were there πŸ˜›

stiff wasp
#

ogod

#

dude

#

I already told you

#

how to do it. I even gave you like ten screenshots of what to do

proud wren
#

but it does not work 😦

stiff wasp
#

that is because you suck

#

send me a screen shot of the code

#

dude, what the fuck is this? This is not even close to what I told you to do

proud wren
#

I was trying to combine it with what generic shooter did

stiff wasp
#

sweet jesus help me

#

delete this shit

#

and do it the way I told you to

proud wren
#

lol okay

#

do i have to delete it or can i just put it to the side? πŸ˜„ Cause, i spent a lot of time on it

stiff wasp
#

delete it

proud wren
#

😦

#

so @stiff wasp

#

it... welll

#

it may have worked doing it the way you said πŸ˜›

#

so thanks

stiff wasp
#

well no shit it worked

thorn merlin
#

@wintry flower you could make a replicated variable on your characters, then just iterate the characters locally

wintry flower
#

players as in player characters? How do you iterate through all player characters?

thorn merlin
#

get all actors of class

wintry flower
#

i was going to store it in player state and then iterate through players array

thorn merlin
#

the reason why id do it on the character

#

is because you have to set that data anyway

#

or else your client and server move speeds will be different and you'll get weird glitching

wintry flower
#

can't use get all actors of class. i want the values to displayed on the hud and updated quite a bit

#

and the engine specifically warns you to not to use it often

thorn merlin
#

you dont have to get it every frame, that said, using the state might be better, because if you used the characters, they would all have to be relevant for the data to show up

neon bluff
#

Several ways to do this, you can always make the characters register their instances with the HUD on BeginPlay.

#

Or you can add the Character reference to the player state and make that replicate as well.

#

(Also, PawnIterator isn't that bad, right?)

amber plume
#

Since PlayerStates are replicated to all clients, that'd be a place you can put some kind of speed. I'd do that instead of iterating through characters.

wintry flower
#

this is a really noob question but if you have a variable in player state, you still have to set it to replicate as well even though playerstate itself is replicated, right?

amber plume
#

Yes

wintry flower
#

ty all

eternal anchor
#

Isn't PlayerState replicated only to owning player ?

#

and GameState is what is replicated to all players

surreal prism
#

How to handle clients with different version on server? Can i get game version on PreLogin?

chrome bay
#

@surreal prism it'll just outright reject them anyway, they won't be able to play together. File hashes will be different

#

But, AGameSession handles player rejection etc.

#

Also since you guise were talking about it... Player State is replicated to all players. Gamestate too.

surreal prism
#

@chrome bay Thank you πŸ‘

chrome bay
#

Np's

neon bluff
#

@eternal anchor PlayerStates are replicated to all clients, and contain network game relevant information about the player, such as playername, score, etc.

#

Which I take it to mean that they're replicated to all clients, independent of ownership (and that's actually the case).

thorn merlin
amber plume
#

POSIX is a standard for operating systems, mainly followed by unix systems. ICMP is an internet protocol. It appears that they added a branch saying if the platform is Android then the platform supports ICMP and it's POSIX compliant

#

also they might have a typo in "PLATFORM_USES_POSIX_IMCP" lol

jolly siren
#

lol

thorn merlin
#

i guess im wondering if its worth it to hotfix that change into my 4.12.5 build, i do get some weird disconnect issues from android clients

#

im assuming that might be related but i really don't know much about icmp

wary cedar
#

Hi guys!
What is the best way to make exec commands that affect server?
For example I think about making some command that change player's team. It will be good for testing until I don't have any GUI for changing teams, it also will be easiest way to implement the GUI in future (just call the exec commands). May be this is a bad idea, but now it looks as a good one.

But as I can find there are only few classes that support exec commands: Pawn, PlayerController, CheatManager, GameMode, PlayerInput & HUD.
Some of them exists only on client, some only on server.

If I will put my commands to my PlayerInput class (for example) I will have to make some replicated function in class that exists on both sides (PlayerState for example) and only from it I can call GameMode for changing a team on the server side.

Is there are some better solutions?

calm hound
#

You'd want to put it inside PlayerController

wary cedar
#

I tried but it worrks only on server =(

calm hound
#

You just need to do a back and forth. It's how most all replication works

#

You'd have a function called ChangeTeams() right? Check for authority so if(HasAuthority() == false) it's a client, so from that expression you'd call a replicated SERVER function ServerFunction_RequestChangeTeam() or something. Which then just calls ChangeTeam() again, but now it's doing it on the SERVER so HasAuthority() would be true, so inside your ChangeTeams() function you then do whatever you need to, to change the team for the controller, let's pretend it's a variable bRedTeam (false = blue team). You set that variable to replicated, and then you use an OnRep function assigned to that variable OnRep_ChangeTeams() which then holds information for changing the team AGAIN, but this time for the client

#

or you could have ChangeTeams() function under the HasAuthority == true section, that calls a Client function Client_ChangeTeam() that does the client version of changing teams

wary cedar
#

Is it means that a PlayerController has copies on each client? I thought they exists only on server..

#

So thank you for help I will try this solution

calm hound
#

ALL PlayerControllers exist on the Server. For CLIENTS there is only ONE PlayerController

#

and that is THEIR own

#

if you want to replicate their Team to EVERYONE on the server

#

Then you would use PlayerState class instead, as that's exactly what it's meant for. Because clients have EVERYONES PlayerState

#

so you can setup the team as a variable in Playerstate, set it to replicated, use ChangeTeam() and ServerRequest_ChangeTeam() on the player controller like I said before. But instead just change the variable inside PlayerState which will automatically replicate to everyone

neon bluff
#

IIRC, PlayerControllers can be destroyed and stuff, and PlayerState is more persistent.

#

(BTW).

wary cedar
#

Wow, I didn't know. I want it only from one client to server so PlayerController solution looks more suitable.

#

Can PlayerController be destroyed during the play? I know Pawn will be destroyed when it dead.

neon bluff
#

As, I said, I'm kind of remembering, but I think that if you disconnect, the player controller can get destroyed, while the playerstate survives when you reconnect?

#

Don't quote me on this, though.

#

You can easily check it out yourself, though.

wary cedar
#

I think PlayerController must exist when player is connected.

calm hound
#

Player Controller is only during a single connection, it doesn't get destroyed during gameplay, and I think it transitions between levels

neon bluff
#

That's not true.

#

(As in, for sure it doesn't transition).

calm hound
#

okay, wasn't sure on that one.

#

But for team changing, you don't need it to stick around after reconnecting or level transition typically

neon bluff
#

From the Answerhub: Sorry for the delay. What you might be seeing is when you call LoadMap, it will destroy the old map, and any actors in it. It will then re-create PlayerController's for any local player still in the game.

If you are using seamless travel, this shouldn't happen though, and the player controllers will transfer over. There are some details I might be leaving out, but this could be what is happening if you are not using seamless travel.

#

So we both were right and wrong at the same time, I guess.

#

Though I'm pretty sure that if the maps use different gamemodes (with different player controller classes) they will be destroyed.

calm hound
#

that sounds about right

high lotus
#

i'm quietly reading this channel in hopes that some day I too will do networked stuff!

turbid stratus
#

is there a way to test Internet / non-LAN games by myself, aside from setting up a remote desktop PC at my mum's place and running the game there?

#

some way to route traffic between two machines here so that data is pretending to come from outside the network

#

(I want to test Steam multiplayer stuff, but I'm in the unique position where my Steam LAN games don't work, but Steam Internet games work fine)

wintry flower
#

For the player array in game state, the order of the array just depends on the order players join the game right? So the listen server will always be index 0?

neon bluff
#

@turbid stratus well, you can mess around with the system routing tables, no?

#

@wintry flower I wouldn't count on that.

thorn merlin
#

@turbid stratus 1) you could setup a VM 2) you could rent a super cheap t1.micro t1.small instance from amazon ec2

eternal anchor
#

^ you can just host game in cloud

#

for testing purposes it will be cheapest option I think

granite jolt
#

there are apps. There was one for old Lan games to make them work over the internet. Gimme a sec ill try google

dusk granite
#

tunngle, hamachi the sorts?

granite jolt
#

Hamachi was the one I was thinking of

thin stratus
#

doesn't he want to test internet sessions?

#

Hamachi emulates LAN, so that's not helping him. Problem with Steam is, that it only allows one copy of the game using steam at the same time

#

Even dedicated servers will need an extra account

#

I'm using an old laptop to test steam. Even though it's the same network, internet sessions can still be tested

#

VM might work too, but i doubt a VM gives enough resources to start the game at all

granite jolt
#

ahh my bad

thin stratus
#

Otherwise, having a server is the best solution, if you have a dedicated setup

#

If not, yeah, second PC or a good friend you can send the game to

dusk granite
#

@thin stratus not always, with steamcmd you can login anonymously and download some ids, killing floor 2 server doesn't need an account for example

thin stratus
#

True, but that would need you to have the server already registered as an app at steam, right?

#

So for testing, this doesn't work, or?

wary willow
#

Is there a way to access Steam Chat Client API?

#

Not voice

thin stratus
#

Chat client api?

#

You want to access the actual chat that you can use in the steam client?

wary willow
#

Aye @thin stratus

#

Trying to see if it was possible to bring up that chat client in game

#

Instead of using the overlay/alt tabbing to it

#

So, pretty much an embedded steamchat client

#

This is just for friends and what not obviously. Unrelated to game MP chat client

#

Haven't been able to find anything on it, so it is probably not possible atm

dusk granite
#

you can't access the steam chat via API

wary willow
#

But figured I would ask

#

Even via web api?

#

But anyway, that is probably the answer. Nope

dusk granite
#

that would count as botting according to the ssa

wary willow
#

Hmmm, really?

#

I think it would be very convenient for players

dusk granite
#

you are basically ordering a programm to write stuff for you and impersonate a user, even if it's just passing your stuff to the api

proud wren
#

@wary willow i am still pretty new to multiplayer, but mini has been teaching me a lot. From what i understand you can;t do that with ue4

jolly siren
#

so does PostLogin get called before the local player controller is created?

nocturne token
#

Unraid vms + lazyploy... the only sane way to single man steam test

jolly siren
#

man the simplest shit sometimes 😦

#

how hard can it be to send a message to everyone's huds on join

stiff wasp
#

@proud wren please, stop.

jolly siren
#

anyone know the correct way to disconnect a player in multiplayer? Right now I'm just using Quit but that doesn't seem to cause GameMode to hit LogOut

#

I tried calling LogOut before Quit but that didn't help

stiff wasp
#

destroy the session.

jolly siren
#

ahh okay, interesting. I'll try that out.

#

thank you

stiff wasp
#

you are going to have to create the main menu

#

but, you probably knew that

jolly siren
#

yeah I figured it would boot me back out to the main menu

#

and is there somewhere post login that I'm guaranteed to have a player state, hud, and local player controller? I'm trying to add join messages. I'm testing PostLogin right now but I don't think it's going to work

stiff wasp
#

it won't just "boot to the main menu". You'll have to set that up yourself

jolly siren
#

I have to tell it to go to the main menu?

#

lol

stiff wasp
#

... yeah

jolly siren
#

Okay then. I can mess around with that. Thanks

#

Any idea on the login thing?

stiff wasp
#

what do you mean login? Like steam, or custom login via a launcher? Also, are you doing this in BP or C++?

jolly siren
#

by login I just mean join a match. And yeah this is steam in c++

stiff wasp
#

very good

#

I was hoping you were doing this in C++. Alright, so you have a lot more options than just join/host a session. Have you taken a look through the Docs yet? They will give some basic stuff. I am going to be away for a week, but when I get back I can run you through everything networking. In the mean time though, look through the docs and also check out http://cedric.bnslv.de/sessions-in-cpp/ and http://cedric.bnslv.de/unreal-engine-4-network-compendium-released/

jolly siren
#

mhm yeah I have my network stuff all in place and working. I was just trying to find an event for logging in where I would have the hud and things ready at.

stiff wasp
#

I see

#

well good, less I have to explain then.

#

but anyways, I need to head out. I will help you when I get home if you've not already solved all your problems.

jolly siren
#

ahh PostLogin is working for other players. so you can get a message when other players join. you just don't get one when you join yourself because your local playercontroller isn't setup yet. Build finally completed so I could test.

stiff wasp
#

correct

#

there are ways around that though

#

but, I need to leave before I get sucked into coding talk.

jolly siren
#

okay, well let me know of any ways around it when you have time.

#

thank you

molten prism
#

DOES any one test this?

#
brittle slate
#

Hey all, does anyone know how i would collect a list of choices from in UE4 and have it emailed to an email address like and order form type of thing.

#

yeah i have that

wintry flower
#

What's the best way to update a hud for a replicated variable? I have it working with repnotify but it's delayed on the client and updates way too slow 😦

thin stratus
#

@brittle slate probably with some VaRest stuff and a PHP script?

#

@wintry flower repnotify is called when the value gets updated. How much lag do you have?

brittle slate
#

Ah crap haha thanks πŸ˜ƒ

thin stratus
#

@brittle slate so there is no easy thing build in the engine :P

#

If that's whaz you wanted

brittle slate
#

Really? I haven't noticed xD (sarcasm) :p

compact gulch
#

hie veyrone.. a question

#

Hi everyone.. a question ( sorry typo )

#

i have a replicated array in GameState

#

is there ANY reason at all they could lose synchornisation?

#

it seems that randomly they will.. at this point.. i'm not too sure why.. if i get both client and server to list their array

#

after some time they will lose the info

compact gulch
#

i just found out the cause

#

sigh.... someone tel lme if this is new.. coz i'm surely unaware of it.

apparenlty when a unit's Relevancy becomes false... the pointer gets removed from client's array and hence lose sync... it seems even when it become relevant once again

thin stratus
#

Could be, yeah. If client doesn't need the actor, it won't be replicated, though the gamestate should always be relevant

#

Didn't know that pointers of unrelevant actors get removed from relevant actors

#

But makes sense

compact gulch
#

@thin stratus it's weird though , because some data get lost permanently. shouldn't some states be stored locally even though they're not update. or at least when it gets reupdated , it should sync.since relevancy is about network optimisation. not local performance optimisation

thin stratus
#

If it's relevant again, it should get the lastest version of the server

compact gulch
#

it doesn't

#

that's the problem

#

after it comes relevant again , the array is still blank

#

so i have an array that stores unit on each team

#

once they become not releavnt the array index is lost forever

#

it becomes a null array

#

even after the units come back

thin stratus
#

Hm, is it important to set them to not always be relevant?

#

Like, would they have a big network heavy impact

#

Also, I'm not at my pc atm, so what other replication settings does an actor have again?

hybrid igloo
#

Do UPROPERTYs default to Replicated?

#

because it really seems like they do on my end for some reason, unless the details panel is a liar

hybrid igloo
#

or, oh, wait

#

duh

#

Question: is there any hooks on an actor to know when said actor got replicated?

#

aha

#

I can use ReplicatedUsing

hybrid igloo
#

so uh

#

I can't seem to get replicating a struct via C++ to work

prime horizon
#

Are the struct properties UPROPERTY()'s?

hybrid igloo
#

yes

#

(it's an FVector by the way)

#
void AGridManager::GetLifetimeReplicatedProps(TArray<FLifetimeProperty>& OutLifetimeProps) const
{
    Super::GetLifetimeReplicatedProps(OutLifetimeProps);
    DOREPLIFETIME(FVector, CellSize);
}
chrome bay
#

The Syntax is wrong

#

needs to be this

#

DOREPLIFETIME(AGridManager, CellSize);

hybrid igloo
#

ah

chrome bay
#

First param is the class it belongs too, second params is the variable name

hybrid igloo
#

that explains it

#

really hard to find documentation on this, both the network compendium and the official docs don't seem to cover it well at all

chrome bay
#

FVector has to be a UPROPERTY() too, with either Replicated or ReplicatesUsing set πŸ˜ƒ

hybrid igloo
#

yeah it is

chrome bay
#

cooliosauce

#

Best bet is to grab ShooterGame from Learn tab, it's a fully networked example in C++

hybrid igloo
#

ah, nice

chrome bay
#

Can learn a lot of good tricks from it

hybrid igloo
#

I'll keep that in mind

chrome bay
#

np'

turbid stratus
#

@compact gulch I also had some issues with a replicated array of actors stored in gamestate... I was never able to figure it out, and ended up not replicating the array (it only needed to be filled at level start anyway so I just filled it using RPCs)

#

(the issue I was having, was: I was spawning a bunch of tiles on the server, adding them to a replicated array in GameState as they were spawned, then a client would join afterwards, and all of the tiles were there as expected, but some of them were missing from the array on the client (just null/empty slots).

#

@thin stratus I'm using an old laptop to test steam. Even though it's the same network, internet sessions can still be tested <-- Internet sessions how? I have a laptop too, different accounts (it's how I was intending to test), but I am unable to connect this way (despite being able to find the session fine). Yet I sent the same packaged build to my nephew on Steam and he connected over the Internet no problem.

thin stratus
#

I don't know, it just works :o host online session, find it on the other pc/laptop and join

turbid stratus
#

hmm, I feel like I did try a non-LAN session but I'll give it a try

#

it worked, ffs

#

I'm sure I tried that a millennia ago. Oh well, here's to removing that "Use LAN" box from my game πŸ˜›

#

ahh actually I think I tried it when using OnlineSubsystemNull, and it didn't work iirc. Might leave the checkbox there for now in case I do more testing with null

#

thanks @thin stratus this makes me happy, I can continue work easily now

thin stratus
#

@turbid stratus hehe, subsystem null does not support online sessions

#

Due to obvious reasons, such as no masterserver to query serverlists from :P

turbid stratus
#

Yea, I just hoped it'd just force the session to be LAN with subsystem null, so that I could test without explicitely setting "Use LAN"

ripe folio
compact gulch
#

@turbid stratus it seems that setting it to always relevant works. but i'm a bit concern with network traffic in the long run

#

also i'm not entirely sure , but is this problem newly introduced in 4.13?

wintry flower
#

anyone know what's going on with this rolling ball bug? This is right after creating the project from blueprint template, nothing changed.

hybrid igloo
#

@ripe folio ah nice, thanks.

thorn merlin
#

@wintry flower it looks like the code for possessing the actor isn't setup for dedicated server multiplayer

#

@wintry flower that view is typically the "i have no actor" view - now because its always player #2, perhaps its in the actors auto possession settings

wintry flower
#

yeah I have no clue 😦

#

i can't find what's causing it

#

could you possibly make a project from the template and see if you have the same issue

prime horizon
#

Add another playerstart

#

I just did that and it works

#

actually, not all the time

#

But I get this when it doesnt work

#

LogSpawn:Warning: SpawnActor failed because of collision at the spawn location [X=-230.000 Y=253.557 Z=372.001] for [PhysicsBallBP_C]
LogGameMode:Warning: Couldn't spawn Pawn of type PhysicsBallBP_C at NetworkPlayerStart

wintry flower
#

yeah i tried that and it doens't matter if i have dedicated server checked or not. on both, sometimes it fails, sometimes it doesnt

#

so stupid

#

going to bug me if i can't figure out what's wrong lol

prime horizon
#

Seems to me like it's trying to spawn 2 players at the same playerstart

thorn merlin
#

i remember the advanced vehicle demo had a weird issue where it had one pawn on that map auto assuming a controller, then it would spawn them in for the other ones

prime horizon
#

I notice that when you put a lot of spawn points in the scene the problem occurs less

#

so it's spawning your pawn on a random playerstart even if something else is spawning on it

#

Which is weird

wintry flower
#

yeah that's really stupid. it does seem to help a bit, but i feel like there's some other issue as well

#

i don't know why you never see this in the third person template. it works perfectly there.

prime horizon
#

It has something to do with the physicsballBP

#

If you use defaultpawn as the pawn that it should spawn it works perfectly fine

wintry flower
#

doing that for me made both players have the issue...lol

prime horizon
#

Really?

#

Well, if I set the spawn collision handling in the PhysicsBallBP to Always Spawn, Ignore Collisions it will sometimes spawn both players next to eachother, confirming that it sometimes uses the same playerstart

wintry flower
#

but why doesn't the same thing happen in first person and third person templates. it just doesn't make sense

#

not saying you're wrong it's just weird

prime horizon
#

Im looking into it right now

#

I have a feeling

#

Let me check first :p

#

I figured it out I think

#

It only works with primitive components as the root component

#

the checking for onoccupied playerstarts

#

and since the physicsballbp has a static mesh as the root, it wont do that properly

wintry flower
#

so th en you can't use a static mesh? what's the workaround

prime horizon
#

Im figuring some stuff out atm to be sure that im right about what I just said

wintry flower
#

alright

#

thx a lot for your help

prime horizon
#

I spoke a bit to soon I think

#

Im looking at the function right now in source, first it checks for a movement component, if none then it checks for a primitive root component

#

if none it checks for any other scene component

#

oh nevermind it only works with primitive components as well there

#

If you wanna check yourself in the source its in UWorld::EncroachingBlockingGeometry

#

in LevelActor.cpp

#

which is called by AGameMode::ChoosePlayerStart_Implementation

#

Basically it only works with primitive components, a workaround I guess would be do make your own implementation of chooseplayerstart

#

I think its exposed in Blueprint too as of now

wintry flower
#

okay i will check it out

jolly siren
#

can someone explain to me what is sent over the network with function replication? variable replication obviously just sends the data for the variable. But function rep is more of a mystery to me.

#

ahh I see

#

In other words, the function's name, and all of its parameters, are crammed together into a packet of data, and transmitted to the other machine for later execution.

thorn merlin
#

hmm, so it would be intelligent to have shorter named functions

jolly siren
#

idk what their "cramming" algorithm is πŸ˜›

eternal anchor
#

i would guess function name is send as FName hash

#

not as string

jolly siren
#

yeah most likely

thorn merlin
#

well thats good then πŸ˜„

#

because my function names are long as hell lol

jolly siren
#

lmao

light grove
#

I believe it's similar to the process used for packaging spam in a can.

jolly siren
#

lol

#

if I can a multicast from a server rpc it will execute it locally on the server right away without sending anything over the network (for the server) part right?

#

πŸ˜‡

lost inlet
#

multicast executed on server will run instantaneously on the server

eternal anchor
#

it will also work in singleplayer

jolly siren
#

thanks guys, that's what I was hoping πŸ˜ƒ

vivid siren
#

can someone help me with a quick question

#

i have an actor simulating physics and i need it replicated. checking the replicate stuff doesnt do anything though, what gives?

prime horizon
#

I remember this from a while ago when I wanted to have replicated static meshes with physics

#

Dunno if it still applies today

jolly siren
#

Does anyone know if it's possible to replicate a variable to an object that I manually spawned on a simulated proxy?

#

I'm assuming not since I didn't spawn it on the server and replicate it. But really, there is a server representation of it. It's just not replicated. I handle it manually by spawning it on the simulated proxy myself.

#

@rough iron πŸ˜‡

rough iron
#

If it's not spawned on the server their netIndex wont match

#

but you can always create a proxy object for it and bridge all calls manually

jolly siren
#

ahh okay cool, I will look into that. Thank you πŸ˜ƒ

#

so TBitArray can't be replicated?

#

is there some other way to pack bools as single bits within an array?

#

i.e. uint8 bInputReleased : 1;

rough iron
#

You could just pack then using bit flags in a single uint32

#

or a TArray<uint32> if you need more

jolly siren
#

the usability of an array would be nice

#

so I would have to use bit shifting to access each "bool"?

rough iron
#

masking

#

checking for the flag

#

something like:

#
bool HasFlags(int flags, int flag)
{
    return (flags & flag) == flag;
}

jolly siren
#

so that is to check multiple flags at once?

#

I need to go brush up on my bits πŸ˜›

rough iron
#

you can check one or up to 32 xD

#

HasFlags(MyFlags, FLAG_1 | FLAG2 | ... | FLAG_N)

#

xD

#

so you can check multiple bools at once xD

jolly siren
#

okay, that's what I thought πŸ˜ƒ

rough iron
#

then you only have to assign a mask for each

jolly siren
#

okay sweet, that makes sense. thanks moss the boss

rough iron
#

^^ np dude

long hollow
#

hallo πŸ˜„ o/

jolly siren
#

is there a reason that ue doesn't handle data packing for replicated variables at a lower level? so we don't have to do it ourselves?

thorn merlin
potent steppe
#

@jolly siren Just to confirm you meant actually packing and not comrpession right?

vivid siren
#

i have a bit of a dumb question, but when I set the PIE to 2 player, the second player's camera spawns at 0,0 and has no input, but their body is where the second spawn point is

jolly siren
#

yes packing. For example, uint32 SomeBool : 1

vivid siren
#

any ideas?

jolly siren
#

why should we have to do that?

#

bool SomeBool would be nicer and then it's packed under the covers for you. Then you can do arrays of bools, etc. That is just one example.

#

@vivid siren "player" as in a character bp?

vivid siren
#

yeah, i think i maye have narrowed down the problem though

#

however the second player cannot use flight controls whereas the first can

jolly siren
#

do you have dedicated server checked? if not, the first player will be the server and the second the client

vivid siren
#

no its unchecked

#

i checked it and now my widget is giving errors: being added to none

#

lol

#

it's weird. with dedicated server checked, if i play with 1 player, they spawn at 0,0 with no controls. if i play with 2 players, they spawn at random spawn points with broken flight controls

#

i wish the multiplayer mechanics werent so unpredictable. it ruins any motivation i had for a project whenever i try to implement it

dusk granite
#

multiplayer isn't that unpredictable, given you build your game around multiplayer in the first place

jolly siren
#

yeah it's predictable if you know what you are doing

vivid siren
#

I've watched so many tutorials and asked so many questions but it never makes any sense

#

I don't see why my second player chooses to just not function correctly. All i'm asking him to do is spawn and use UE4s default flight controls

jolly siren
#

lol

#

i'm pretty sure that works in a default ue tp/fp project

vivid siren
#

this is the default fp one

#

so why can't the second player move? dedicated server wont fix the problem

#

is there any special setup i have to do so that ue4 understands the second player?

modern fable
#

how do you set things up though

vivid siren
modern fable
#

so if there are to players, only one moves?

vivid siren
#

thats true

modern fable
#

also keep in mind though you are executing that code on being play, so it executes on all instances of the actor

#

if I ain't wrong there

vivid siren
#

oh, thats true. i hooked up a print hello and when i start the game, the server says hello twice and the client is silent

modern fable
#

so begin play executes server-side only?

vivid siren
#

yup

modern fable
#

any Actors spawned after the game is started will have this called immediately.

#

anyhow,

#

you most likely want to perform what you're doing there on owning client's end

#

so that a widget is created locally only

vivid siren
#

right

modern fable
#

there's a possessed event, it executes server-side

vivid siren
#

thats on server side though, so i dont want to use that, do i?

modern fable
#

well you can have a custom event running on owning client

#

that is fired when the pawn is possessed

vivid siren
#

now both players have the widget, which is good

#

but

#

neither can fly now

#

also the second player is glitched out for the first 3 seconds, then he sort of fixes himself

modern fable
#

set movement mode server-side

vivid siren
#

so its okay to have custom events plugged into everything for the sake of replication, right?

#

because at this rate there's going to be just as many custom even nodes as actual nodes

dusk granite
#

that doesn't sound right

long hollow
#

oook so can anyone tell me if time dilation being set on 1 player will effect all players in a mp game mode ?

granite jolt
#

its client side i think. There is probably a differentiation for MP though.

#

hmmm some info on the forums says its server side and effects all players.

#

πŸ˜•

#

hate being wrong.

#

I could havw sworn there was global time dilation and custom time dilation for actors.

dusk granite
#

there is @granite jolt :) but the server always has authority

long hollow
#

hrm this couldd be fun then 😐

granite jolt
#

so if the global was at 1.0 and the client was at 0.5, it would force the client to 1.0?

long hollow
#

i guess so if server maintains authority

granite jolt
#

thats pretty weak but understandable

long hollow
#

yup.. but i will find a way around it, somehow 😐

granite jolt
#

maybe you can hax the implementation so the server doesnt have the authority on it ?

#

really bork things for a laugh

long hollow
#

or.. maybe i can hack in a way for it to temporarily hand authority to the client

#

hrm

granite jolt
#

wouldn't that lag like shit though?

long hollow
#

thats my fear

#

i wonder if @thin stratus would know, he's pretty hot on multiplayer / networking

thin stratus
#

If the variable is not replicated and server and client have different values then rip

#

(i guess)

long hollow
#

i was so hoping you weren't going to say that 😦

thin stratus
#

Just multicast the change or so

long hollow
#

i shall try !

modern fable
#

sup

#

@long hollow

light grove
#

Hiya folks! So I'm having this really weird issue where variable replication is taking upwards of 2 seconds for the client update. There's like nothing goin on inside the project - just the third-person template with some networking stuff set up.

#

the code is just onEvent, cast to playerstate, decrement health by 10%

#

Printing the value every frame shows that the server variable updates immediately but the client variable can take almost 2 seconds at times to change.

thin stratus
#

Hm

#

Code/BP?

#

If you have no packageloss stuff in action, then no real idea

light grove
#

It's literally just customevent (do on server) -> cast to playerstate -> set health

light grove
#

The editor's been crashing on me a lot today - maybe I buggered something up...

light grove
#

If I cast to PlayerState and set the variable there it takes a while to update the variable on the client, but if instead I cast to PlayerController and set a variable there it is almost instantaneous... Why would PlayerState be slow to update?

#

or at least, why would playerstate be slow to update clientside?

thin stratus
#

Where do you call that? And when?

#

Is the PlayerState maybe not yet fully initialized?

light grove
#

I'm calling from the Player Character pawn, and it's on a key-press event (currently just attached to jump) so I don't think it's that.

thin stratus
#

Hmpf

#

Is the event set to be reliable?

#

(just checking on everything)

light grove
#

Yep!

#

The only difference between both scenarios is where I'm casting.

thin stratus
#

Shouldn't make a difference

light grove
#

That's why I'm super confused.

#

Yeah - just switched it back to PlayerState and there's clearly a lag between the server update and the client update.

#

Friggin.... The PlayerState is set to update once per second by default, whereas most actors are set to update 100 times a second by default...

#

I fixed it.

potent steppe
#

Hey everyone! I am just wondering if I can create multiplayer games without using the OnlineSubsystem and session. For example use an external system and join other players games via there unique net id. Possible? Any guidance for me?

light grove
#

You could create listen or dedicated servers but you'd still need their IP to connect

#

You would have your player host a game (listen server), and the joining player would enter the connection destination and voila

potent steppe
#

yeah via the console the comand join <ip> or some such thing, correcT?

light grove
#

I believe so.

potent steppe
#

I ask becauseI am weighing the pros/cons of using a third party back end web service like PlayFab or GameSparks.

#

And as far as I can tell you do not need (or maybe should not) use the online subsystem in UE4. As sessions at this point seem unneeded. I think this is the correct assumption.

#

But I still want to connect players together and use UE4 replication rather than reinventing the wheel with their services

light grove
#

How far along are you in your development? Are you considering these options at the start, or have you got something you're already into?

potent steppe
#

Minimal gameplay. Frozen development until I can assess which route to take.

#

So, early one yes. The first thing I did was setup the steam online subsystem. I am now just exploring other options.

light grove
#

The online subsystems are just that - subsystems. You still have your basic client-server architecture and variable replication (handled by tbe server version of your game).

potent steppe
#

Oh yeah of course. I plan to use UE4's client-server architecture and variable rep. I just am trying to figure out the "correct" workflow for joining servers without using the sessions provided in the online subsystems.

#

I need to determine what information I need to store for the player in a 3rd party DB so that other players can join their locally hosted games.

#

I know IP is the first and simplest option. I was just wondering if UE4 provided something else

light grove
#

Is there a large amount of information that is tracked from game-to-game and server-to-server? Saving persistent variables can be done locally by the server - either by use of savegame or something like sqlite

potent steppe
#

The backend service I use has the means to persist any player data that needs to stick arond

#

UE4 need not worry about storing any data itself. I just need to handle the game to game specific in the engine

#

extenral api calls will be made to store whatever else I need

#

or retrieve of course

#

I guess the heart of the problem is this; One player hosts a game. What data do others players need to just join this game. I know IP is the obvious choice. Just wondering if anything else is available.

light grove
#

They don't really need anything else.

#

The subsystems are basically just a fancy packaging for IP addresses, anyway.

potent steppe
#

Yeah, that is what I thought. I just know using something like GetWorld()->GetNetDriver()->LowLevelGetNetworkNumber()

#

Will returns a SteamUID

#

and you can type "join <steamUID>" in the console

#

Or something close to that.

#

So, I was curious if i could do something similar without using a Steam or whatever else subsystem rather than using an IP address

light grove
#

Nope - unless you created the netdriver yourself - in which case you'd just be creating a backend instead of picking one.

potent steppe
#

Yeah, exactly.

#

Okay well I huess the best bet would be to use the external matching system. Wait for the host to load the map and then fire off an event containing their NetID back to all the clients who want to connect.

#

All via the external service

#

by NetID I meant IP address

vivid siren
#

So I've about had enough of Unreals networking.
Do I seriously have to resort to this, just to have a cube simulating physics to update properly for every player?

shrewd oxide
#

I haven't done a lot of networking beyond tutorials but surely replication is more low level than that, you just set a scope for it

#

forcing a network action on every tick sounds like disaster

vivid siren
#

Well it's all I can do because this engine doesn't seem to understand how to do simple things like this

#

I've watched countless tutorials and read all the crap that every forum has to say on networking, and all I get is "use a clusterfuck of replicate nodes"

shrewd oxide
#

hmm

light grove
#

If you set the actual actor to replicate it shouldn't need all that.

vivid siren
#

Nope, that doesnt work either

light grove
#

Are you referring to the fact that the physics simulation is non-deterministic?

vivid siren
#

I guess so. The physics objects just dont update on the other players unless I use the above code

#

like, when theyre moved by players

shrewd oxide
#

incidentally moved or as in pick-up-and-move?

#

good network design would give authority for an object to the player holding it

#

then release it when they put it down

#

you wouldn't force 1:1 updates on the network

light grove
#

Try posting in the physics section - this is more a problem with the physics simulation rather than the networking.

#

Maybe someone there has a better solution

potent steppe
#

@vivid siren Is the actor is properly replicating movement the physics will be calculated on the server and replicated postions to the clients. I have this with just setting a few variables. I am not sure why you had to do it that way.

eternal anchor
#

GameSparks afair, do not provide means for say world contruction

#

ie. data replication

#

it only provide backend services for match making,

#

profiles, inventories, etc

#

if need this you can use it, it's easier than developing your own solution for cloud

#

but depending on scale it might be better to rollout your own

#

Speaking for my self I would develop my own, but I like this area of development (;

lost inlet
#

i really want to find a way of using IP connections with steamworks

#

i wonder if it's as simple as changing the NetConnectionClass under the steam oss ini entry

#

the only reason i'd want to use the steam p2p stuff is for NAT punchthrough when hosting a listen server for something like coop

#

otherwise, IP connections pls

lost inlet
#

yeah so changing the NetConnectionClassName to IpConnection doesn't work with the steam OSS

#

it's still using steam IDs for the steamworks p2p networking

#

πŸ€”

night jay
#

Anyone know if UE4 has any lag compensation when it comes to firing a weapon?

#

Because currently I suffer from the issue where clients have to lead their shots in order to hit anyone

#

He took no damage at all

shrewd oxide
#

honestly it looks like you miss a lot

#

maybe there's some delay in the gun firing, like it waits for an animation cue?

night jay
#

No

shrewd oxide
#

do a more controlled test

night jay
#

The delay is latency

shrewd oxide
#

like shoot at him while he's not moving and time the delay until damage hits

#

or even better.... debug it

night jay
#

Alright

shrewd oxide
#

spit out some messages on the client for when it fires and when it receives hit confirmation

#

say of the gametime

night jay
#

But should this be happening or no

shrewd oxide
#

dunno

#

I'd leave it in and call it hardcore

#

or just call the players mad cuz bad

night jay
#

Nah this gives hosts a bad advantage

shrewd oxide
#

oh yeah always

night jay
#

Trying to minimize that

#

Every game we played the host always won

shrewd oxide
#

you could redesign it so the client that shot has authority on who it hit

night jay
#

Bigtime

#

That's exploitable though

shrewd oxide
#

sure but will anyone bother?

night jay
#

I've seen people bothering yes

shrewd oxide
#

shadowban them

night jay
#

2many

granite jolt
#

UE has always used replication rather than interpolation for it's networking so leading shots is part of that method.

#

it's actually more accurate in terms of things but then only if you lead your shots

shrewd oxide
#

unless railgun

night jay
#

We're not really aiming for a realistic approach

shrewd oxide
#

well

#

you could leave it in and artificially cause leading on the host

granite jolt
#

even then its a trace that relies on two sets of information being static for comparison. I guess you can interp manually

#

take an average of the latency of both clients, work out a relative location

night jay
#

Pretty sure that's what UT4 is doing

shrewd oxide
#

you could have both the host and all the clients in the viewport provide their version of the shot and take the average

#

just adding that comms in will remove the host's advantage

granite jolt
#

I always thought that if Client A hits Client B on Client A's screen, it should count regardless but after a few years playing counterstrike and being dragged back into an old position that I moved away from specifically to avoid that shot, or ending up back around a corner I ducked behind, I realised that leading shots is actually a better option

shrewd oxide
#

what happens then is people introduce lag to freeze then enemies while not sending their own location

#

they run around the map tagging everyone, then they open the floodgates

#

read up on titanfall's network code some time, it's insane

#

the server changes its estimations based on the weapon used

#

so if client A shoots and hits B but the server knows B suddenly hit jetpacks, the server can invalidate the hit

#

without even doing a trace

#

that's hit B in A's eyes

#

it'll often undo damage before the consequences of it are shown on screen

#

so a real active simulation

#

one of the main reason executes have such long animations was for a similar situation

#

gives client B a chance to say nah I was outtie

#

hardly ever happens though

lost inlet
#

there is no lag comp

#

you have to implement it yourself

#

the engine won't do anything you don't tell it to

night jay
#

Yup

#

Just checked it

#

Made the projectile fire on both the client and server

lost inlet
#

it would be hard to implement reliable lag comp the way UE4 has its animation system, in source and engines like it, it was easy because animation data could be saved for each game frame and not take up much memory

#

but in UE4 you might have to go with a hybrid client/server system

#

where the client tells the server of a hit and then the server runs some validation to check the hit could have happened

night jay
#

Ýeah that's what I'm considering atm

#

I was thinking about make hte projectile fire both on the client and the server

#

If the client hits, check where the server bullet is

#

If it's closeby, register hit

#

Íf it's far away(meaning the client tampered with the projectile position), no hit

granite jolt
#

wouldn't that be affected by physics though and produce different results at the floating point level?

night jay
#

Wouldn't the difference be negligible though?

granite jolt
#

not sure. physics can be whacky in two different instances

night jay
#

The difference should be a few cm at most, the client projectile's scan range has to be much bigger than that anyway since the difference in client and server positions can be a few dozen cm

#

And I don't think there's much to go wrong with a simple projectile heading forward

#

But if there's a better way I'm all ears lol

granite jolt
#

I think it would be worse with a projectile in the conventional sense. Especially the projectile movement component.

#

Different approaches for different types of projectile I guess

night jay
#

Our programmers are looking through UT4's source to see what their approach was

granite jolt
#

What I was thinking was taking the hit location on the client, average the latency, apply a sort of short-distance aimbot effect. So if you hit on your screen but was 200ms behind, you are allowed to miss on the target client by a certain amount that is applied to their received hit location.

#

this amount is based on the average latency and a multiplier

#

I think I would have to do something slightly different in the case of a much slower projectile though or one that interps with an in/out easing.

night jay
#

A slower projectile would not really suffer from this since you'd have to lead that anyway

#

So basically add bullet magnetism

granite jolt
#

yeah

night jay
#

And the amount you have is depending on your ping

#

But

granite jolt
#

well I think an average of the player/enemy but you could factor it into one

night jay
#

That would work if the players were to be going with a consistent speed

#

Say if your enemy is in a vehicle you'd need more magnetism as compared to the enemy running

granite jolt
#

as long as you hit on your screen, the target can be updated appropriately and they won't notice, unless a severe discrepancy at micro-timing occured, such as ducking behind a box when a missile is coming. If it's already landed on the firing player's client, the compensation is going to look wrong

#

or rather... it will look like counterstrike when you get bhind a wall in time but die and get dragged out

night jay
#

The issue is

#

"As long as you hit on your screen"

#

Is exploitable

granite jolt
#

everything is :p UE4 is open source :p

night jay
#

No I mean people can use that fact to cheat

#

Make client side modifications

#

Server registers a hit

#

Stuff like shooting through walls will be possible

granite jolt
#

I try not to worry about that as if someone wants to hack, there is always a way and in an open source engine, you are SOL for security unless you write something that negates any previous exploits. Which takes time. Which costs money. Not worth the effort unless your trying to make an eSport

#

I heard there were bots for Paragon during the alpha stage, I presume there still are, and that's an Epic game. You would think if anyone could stop exploits it's the people who wrote the engine

#

just my opinion and i'd code cheat security for the right money but im just a humble indie guy :p

night jay
#

Hence why making the projectile be on the server destroys the ability to alter the projectile to begin with

#

Only host would be able to cheat and if he did everyone would have the same advantages

frank quartz
#

I've setup steam multiplayer with blueprints, can I add "always on" voice chat just by moding the .ini files or does it require converting to c++? seems i've read conflicting versions of that.

vivid siren
#

Alright can someone hold my hand through this? I'm seriously having a lot more trouble than I think I should be having.

plush lagoon
#

Yo

vivid siren
#

I need to have a physics object replicate exactly across all connected players

plush lagoon
#

Whats the Best Concept for Procedurally Generated Tasks? Use a Web Server, Store them? Or Just Generate them ingame based off Time?

#

@vivid siren on the object, go and select reliable, and make sure it has the associated site selected for reliability

#

Xd Unreal Engine is off, while I wait for a Push from my Modeller XD give me a second i`ll give ya the exacte things to click on

vivid siren
#

alright thanks πŸ˜›

plush lagoon
#

Deselect Net Load on Client

#

Are you building this for a Server or Lan Based?

#

like Server then Players Connect?

#

Or Player is the Server?

vivid siren
#

Player is the server, listen server

plush lagoon
#

Hmm for some reason i keep getting the feeling I`m missing to tell ya something else to do.

#

But you have it right on the Money

vivid siren
#

It's not working though, when I push the cube with one player, its not the same for the other

plush lagoon
#

1 second

vivid siren
#

Okay so everything seems to be working now

#

New question guys: what's the best way to replicate the grab function i have?
here's the blueprint

#

i honestly have no clue which variable i should be replicating

plush lagoon
#

Give m a second

#

I did that already

#

Xd @.@ Waiting for a gitpush is like waiting for a package in the mail

#

smashes head against wall waiting

#

you only have to make a Call Trigger, and that Event is Replicated across all the Clients.

#

Reference, the Hit Location, and such int he Function which your replicating

#

Do the same movement, and such, but only apply it to the "Actor" that Announced it.

vivid siren
#

lol

#

uhmmm

#

what

#

Sorry I dont understand πŸ˜›

#

xD

jolly siren
#

so properties can be replicated to an actor before the actor's BeginPlay has happened? why just why?

vivid siren
#

okay i got it working ^.^

eternal anchor
#

@jolly siren makes sense. You might want on Clients properties from server, before you start playing.

#

though it's not something I would rely on anywa

#

anyway*

jolly siren
#

@eternal anchor okay cool thank you. I just moved the caching of the component I was needing in the OnRep from BeginPlay to PostInitializeComponents and that fixed the issue.

prisma iris
#

If I have animnotify event to play a sound do I still need to multicast for other clients to hear the sound? Or will the notify just run on each individual machine and play the sound accordingly?

thorn merlin
#

if the animation plays there, thats what triggers the sound

#

so if you've triggered the animation somehow, it should work

prisma iris
#

that's what I thought, thanks.

stiff wasp
#

so good to be home

potent steppe
#

Anyone know how to join a listen server using a steam ID? Ex// 'join steam.<id>:<port>'

#

Getting the player steamid is easy (unique id from player state) I just thought that setting up a listen server and joining via steam id was an option.

#

Or do I have to use sessions?

prisma iris
#

Well if you print out the server travel link it's a bit more complicated than just the steam id. Use sessions or access the steam API directly

potent steppe
#

I want to use ClientTravel(...), but I was not sure how ot ocnstruct the travel link.

#

Using sessions makes getting the travel link easy, but I didnt know if they were necessary if I was using something else for match making

prisma iris
#

Sessions should work with any underlying system being used, they encapsulate the information you need to host and join games. And it would have been nice if you could just join <steamId>:<port> but steam didn't really do that

potent steppe
#

From what I remember, that used to work in UE3. That is why I was trying it now.

prisma iris
#

Dind't work for me when I tried it. Sessions are easy to use.

potent steppe
#

Yeah. I they are easy. I guess I will just go back to using sessions and skip using most of their features.

jolly siren
#

anyone know why my USkeletalMeshComponent wouldn't be replicating?

#
Weapons[i].Mesh3P->SetupAttachment(GetMesh(), WeaponAttachPoint);
Weapons[i].Mesh3P->RegisterComponent();
Weapons[i].Mesh3P->SetSkeletalMesh(Weapons[i].MeshAsset);
Weapons[i].Mesh3P->SetIsReplicated(true);```
jolly siren
#

it's within a ustruct that isn't replicated

#

so I'm assuming that might be it

pliant cypress
#

hi everybody! πŸ˜ƒ do any of you have some experience with the Multiplayer Shootout game? I try to make the game work over the internet, but it seems that it won't let me connect (cant find any games). There is no error message of any kind either. Can you give me some ideas how can I check the connection, or if it is working properly?

halcyon finch
#

have you done the blueprint multiplayer tutorial?

#

other that that I have no ideas.

pliant cypress
#

@halcyon finch which one are you refering to? I have done loads, but maybe I missed something

halcyon finch
#

In this video we take a look at the finished project and step through each of the features that will be covered in this series. We show our functional Main Menu and its options, a lobby where players can chat with one another and select their characters for the game, some server options such as changing the map or match time as well as the ability to kick players from the lobby, all of this working with Steam integration. So if you are wondering how to build a networked game through Blueprints with Steam, t...

modern fable
#

@pliant cypress did you add an online subsystem value to your config file

#

and so on

prisma iris
#

you also need to add values to the defaultengine file

potent steppe
#

When creating sessions in C++, does the session need to be started after being created in order to be searchable?

potent steppe
#

Nvm, it turns out that you do not need to start the session. The reason it was not showing up was due to another error.

pliant cypress
#

@halcyon finch @Adam#2406 @prisma iris Thanks guys i will look into these. I used the MP Shootout game as a foundation of my card game because it seemed to work based on the tutorial videos, but I couldn't find a way to make it work so far only locally

sand juniper
#

Guys I need to make a MMO STAT!

ripe folio
#

@sand juniper I'll have a BP plugin for you right away!

sand juniper
#

πŸ˜›

granite jolt
#

Making an MMO is easy. it's the gameplay and content and making it all work and making it interesting and financing it and marketing and expanding it and selling it, that's hard. Oh and the merchandise. Got to have a pewter model to sell a pre-order collectors edition with. Those are a bastard to chisel out by hand :p

stuck stump
#

Hello :), I'm relatively new to networking. I need a dedicated server for my teams game and I dont know where to start. Any suggestion and recommendations? Do I need much server programming experience?

#

We want to use Steam as online-subsystem

brittle sinew
#

But if you mean the whole concept of a server/client relationship, that's a whole other deal. And that would most likely need at least a basic understanding of it

stuck stump
#

ah the first link was just what i needed πŸ˜ƒ thanks

prime horizon
#

How do I properly end a session on quit? When I create a session in PIE, stop PIE and then start PIE again it says there already exists a session

#

(using c++)

jolly siren
#

Destroy Session

#

@prime horizon ^

prime horizon
#

Yeah, but why does the session still exist when I exit PIE? I'm just curious

jolly siren
#

it shouldn't

prime horizon
#

That's what seems to be happening to me right now :/

#

play -> host (works) -> exit -> play -> host (fails, says Cannot create session 'Game': session already exists.)

jolly siren
#

and you are destroying the session?

prime horizon
#

no im not

jolly siren
#

lol

prime horizon
#

Thats what im saying though

#

Why does it still exist when I exit PiE, Im no engine expert but I was assuming that the session would automatically destroy

#

since when doing it in a standalone game it works fine

#

I can destroy it myself and it will probably work, but I wouldn't understand this part though, just curious

proud wren
#

hey, so I am trying to map travel after a match. I am using the Server Travel node, but only the host moves. The client just gets kicked out to the menu 😦 Any idea what I might be doing wrong

prisma iris
#

Do you have seamless travel enabled?

stiff wasp
#

knowing johnny he probably didn't

chrome bay
#

Anybody running into loads of random multiplayer bugs in 4.13?

#

Seems like half of AGameMode has been either deprecated or isn't called anymore -.-

ripe folio
#

Oh god, really?

fossil spoke
#

Didnt they do a massive refactor of AGameMode?

ripe folio
#

Please tell me PostLogin still works.

fossil spoke
#

^ does for me

ripe folio
#

Awesome. I'm still on 4.12 and use that function a lot

fossil spoke
#

I was running through the Roadmap and notice a node that said they were doing a cleanup of AGameMode.

#

Ive just updated our sourcebuild to 4.13 but havent had an opportunity to thoroughly test it

#

But at quick glance it works fine

granite jolt
#

InitNewPlayer is no longer called, which I just found out thanks to TheJamsh

thorn merlin
#

i upgraded to 4.13 this week, things seem to be working fine for me

#

wow initnewplayer indeed doesnt seem to be called, that was kind of important to me

fossil spoke
#

I think ill have to go back and go over AGameMode now, you got me worried haha

thorn merlin
#

that saved me some wtf moments when my testing gets that far

chrome bay
#

So basically, turns out they've added an override for InitNewPlayer

#

And all it does is call the OTHER verison of initnewplayer

#

But obviously because both versions exist, code still compiles

#

arghhhhhh

#
{
    FUniqueNetIdRepl UniqueIdRepl(UniqueId);
    return InitNewPlayer(NewPlayerController, UniqueIdRepl, Options, Portal);
}```
#

Like literally, why? Why not just updated the function signature and all calls to it... ugh

#

half of AGameMode was a bit of rage

thorn merlin
#

so they didnt bother deprecating/obsoleteing the old method?

#

reading build output

#

wait never... i didn't get any sleep last night, stayed up all night watching that dumb debate lol

jolly siren
#

Gross

#

Thank you for sharing that @chrome bay

chrome bay
#

np's

knotty frost
#

Is there any reason GetNetMode, GetOwnerRole, IsNetMode aren't callable from Blueprint?

rough iron
#

It's just not exported, exporting all would add quite some overhead, same applies to making all functions virtual which would impact code size and performance

brittle sinew
#

Yeah I actually found it quite odd things like the role variable aren't exposed to BP when I was working with someone else, seems like basic stuff like that should be in

knotty kelp
#

So I have a challenge I need to overcome when it comes to UE4's multiplayer for a project I'm working on. My target player count is roughly 200 or so, 300 at most if possible. Now, from talking with people that are working on Squad, I hear the UE4's server struggles at anything about 70-80, mostly because it's hitting one thread really hard. In trying to get around this limitation, I've come up with three possible solutions, I need to know if any of them are possible. Solution 1, which would be the ideal solution, would be to somehow spread the workload out across more cores to lessen the load on one core. Solution 2, which is assigning multiple servers on the same box to different CPU cores, and having them all control different segments of the map (eg breaking it down into 4 pieces and having 4 server instances running the calculations for each piece individually, then sending all the relavent information to the client). And finally, Solution 3, where I strategically hide segments of the game, like elaborate doors or hallways, to seamlessly travel between servers while remaining on the same map (I know the opposite is posisble, with staying on the same server but going to a different map, which wouldn't really work here). Would any of these actually work, or is there a better idea I haven't thought of to solve this problem?

thin stratus
#

Hm, for bigger player counts, you could also just trash the UE4 servers and use a Server system that is suited for it. UE4 servers were always kinda meant to be used for games of the size of UnrealTournament.

knotty kelp
#

Yeah, seems to be the realization Squad is coming to as well. Ideally though, the project would stay pretty close to the UE4, since major deviations might make it difficult to keep up with engine updates or introduce issues. Not to mention, I wouldn't even know where to begin with alternative server solutions.

#

At the end of the day though, I'll use whatever tools I need to in order to make the game the best it can be.

thin stratus
#

If you don't know how to create such an alternative server solution (or use an existing one), you may want to find someone who knows. Otherwise this will be a pain in the ...
Learning something like this while creating a project only will discourage you to continue the game, as you will face so much try and error

fast zephyr
#

anybody remembers author or link to that good multiplayr documentation (not epic one)

fast zephyr
#

thanks, so many questions about multiplayer on forum time to paste this link a few times πŸ˜„

#

i thought it was Cedrick's but could not find it

thorn merlin
#

one thing i like about discord is on the top right yo will see a pin, which is pinned messages per channel

#

in which you will find the link to this - imo it should be a little more prominent tho that a channel has pinned content

fast zephyr
#

oh i see that tiny pin now.

thorn merlin
#

@knotty kelp it will be costly but oodle support is coming to unreal, what caps you out after you go over 100 players? I know you need a big CPU to handle your physics or things start breaking down

#

if you had a master server, you could do a server migration style system where when players move to map B you could just migrate their save game to that server and have them connect to the other server - kind of like Arks dedicated server save game migration system

#

its a gross over simplification but thats kind of how EVE works, every "system" is a server (but really there are clusters by region)

marsh shadow
#

hello

#

anybody knows how i can initiate a listen and set the gamemode when i open a level

thorn merlin
#

on your dedicated server? or your local game client

marsh shadow
#

local game client

thorn merlin
#

a lot of this is when you open the map

#

so from your main menu, you open the map with the listen flag, and that map itself defines its game mode

#

and by game mode you mean what game mode class you have created correct?

marsh shadow
#

yes

#

i'm using the openlevel with added options

#

i have tried it several ways

#

listen&game='gm'

#

for example

#

it changes the gamemode

#

but for some reason it's not activating the listen

#

even if i make it game='gm'&listen

#

it does the same thing

thorn merlin
#

hold on loading up my project

marsh shadow
#

ok

thorn merlin
#

so what i use is client travel

#

mapname?listen?param=abc?param2=abc

marsh shadow
#

oh

thorn merlin
#

this is from C++ btw

marsh shadow
#

the openlevel node uses clienttravel

thorn merlin
#

i remember the qstring params not being http spec caught me for a loop too

marsh shadow
#

ghaaad πŸ˜„

#

10x man

thorn merlin
#

i also use ETravelType::TRAVEL_Absolute which may be a factor

#

i.e it could be taking the game mode of your current map and applying it over

#

that may be a good test

#

i.e setting your current one to something whacky and see it sets it to that one

marsh shadow
#

it's switching the gamemodes

#

so i don't think that's it

thorn merlin
#

like from map A

marsh shadow
#

yes i know

#

i was trying that

thorn merlin
#

cool well hope that helps

marsh shadow
#

it helped

#

*gives imaginary help points&

#

like i said 10x man

#

i tried it i think it works now i need to try it in steam

thorn merlin
#

πŸ‘

thin stratus
#

@fast zephyr I'm the author :P

marsh shadow
#

hey cedric

fast zephyr
#

yes now i remember it was you cedric πŸ˜„

#

it looks like there is new wave of people that are getting to "i want multiplayer" level of unreal skills

thin stratus
#

@marsh shadow Hey (:
@fast zephyr :D I hope so

fast zephyr
#

it is always same trap with multiplayer, they code game in blueprints with listen server, check "replicate" then wionder why actual remote clients do not work.

#

it took me whole weekend and 0.7 bootle of rum to figure basic multiplayer stuff

thorn merlin
#

yea, starting with a mp design is ideal imo - it really makes you segment your game logic better

#

its too easy to couple your designs in single player, in mp everything needs to be brokered correctly

#

thats how i learned, just kept beating my head against that wall until clarity eventually formed

eternal anchor
#

@knotty kelp that really depends. the question is where is the bottleneck ?

#

If the bottleneck lies in replication of properties, RPC then you would need to spread it over multiple threads if possible,

#

but that's unlikely imo

#

Bottleneck is probably simulation itself,

thorn merlin
#

my first bottle neck was cpu /w physics

#

turning off skeletal animations on the server helped a lot, but then again some games you can't get away with that

eternal anchor
#

i would guess so to in case of many players on single server

#

the problem here is

#

that unreal game code is inhernetly single threaded

#

and there is no easy way to spread it over multiple cores

thorn merlin
#

^^

eternal anchor
#

uobjects should be thread safe

#

same goes for physics

#

you can't really make async traces without running into race conditions

#

SpatialOS solves this problem

#

but for unreal it would mean, rewriting entire UObject code to make it thread safe, and then rest of the engine -;-

#

it's probabaly doable for something like AI, if you can offload AI to other system and communicate with messages

#

but it's not going to wrk for fast paced games

thorn merlin
#

I'd love a talk from the Ark server team guys

#

*guy & gals

#

actually at steam dev days I think there were be some people from the Ark team there, maybe I'll buy them all the booze for some tips

eternal anchor
#

I honestly don't think there is any particular things going on

#

My guess would a lot of compromises had been made

thorn merlin
#

well they went out the gates a year ago with 70 player support, and they have a ton of servers, it'd be interesting to hear how they've managed this

proud wren
#

hey I got a question

#

I need to get the name of the player, and the name of the other person connected. So two player names. I am casting to the player state and getting the player name, which gives me the name of the player

#

but how do i get the name of the other guy connected?

thorn merlin
#

get all actors of class (you player state object) then iterate that list somewhere

proud wren
#

cool, thanks!

amber plume
#

PlayerStates are replicated to everyone and are located in the GameState in the PlayerArray. That's how you would access everybody's PlayerState. Iterate through them grabbing the name from each

thin stratus
#

YES use the GameState and its PlayerState array

#

Don't use getallactorsof...

#

redirects @thorn merlin to his compendium

thorn merlin
#

yes, i keep meaning to read that, im sure there are gaps in my knowledge and some bad habits πŸ˜„

frank quartz
#

@thin stratus hi, is it possible to do Steam voice chat (mic always on) with blueprints only or does it require c++?

thin stratus
#

@frank quartz Never used Steam Voice Chat.
It's on the list for a (still private, but hopefully soon public) steam/session example project (c++)

frank quartz
#

cool looking forward to it πŸ˜ƒ

proud wren
#

Alright thanks @thin stratus and @amber plume

#

I have another questions

#

it has been bugging me for a while

#

so, I when my player spawns. Only the server is possessing it. I tried using a Run On Owning Client RPC and tried using the Switch Has Authority (remote) node. Nothing seems to work

#

not sure why my client won't posses his pawn

thin stratus
#

Only the Server needs to call Possess

#

Do you actually replicate your Character?

jolly siren
#

@frank quartz it's literally an ini flag

#

it's broken in 4.12 tho

frank quartz
#

that's what i thought i had read, (as long as you don't want push to talk) but wasn't sure

#

@jolly siren working in 4.13 tho?