#multiplayer

1 messages ยท Page 455 of 1

ivory portal
#

But is a player state an actor?

bitter oriole
#

Yes, it is

ivory portal
#

ok interesting

bitter oriole
#

I'm pretty sure it's kept

thin stratus
#

"Persist" might be the wrong word. But you do get the chance to move data from old to new playerState

ivory portal
#

because now I am doing this very ugly hack of storing a lot of data in playercontroller and transfer the properties through the onswapcontrollers event

thin stratus
#

The PlayerState has functions for that too

#

OnOverrideWith

#

And OnCopyProperties

#

They are both more or less used for the same. I actually always loose track of what is doing what

ivory portal
#

yeah, I searched for OnCopyProperties but it wasn't blueprint available

#

but the OnOverrideWith is

#

the consistency!

#

(Slowly learning to do more in C++ as well ๐Ÿ˜› but for some things blueprints just seem so much faster to use)

thin stratus
#

It#s both in BPs

#

I was the one exposing them

#

@ivory portal

flint plaza
#

Can someone check out my code?

thin stratus
#

Well first off, limit your BeginPlay to Client only if that's the only one sending the rpc

#

Currently your timer runs on everyone

#

And then I have 0 idea what you are doing in that SyncLocation

#

That looks kinda horrible

#

You are passing teh PlayerController

#

Then you get all PCs

#

And filter for the passed one

#

What?! :D

flint plaza
#

I want to see and then correct the position of the player which sends its location according to the version on the server

thin stratus
#

You pass the PC, why do you need to search for it afterwards?

#

It's like "I have a red pen. Let's get all pens. Go through them and pick the red pen."

#

You had the red pen to begin with!

flint plaza
#

I pass the PC so that I can identify which player is it that is sending the it and can find it on the server's version

thin stratus
#

When passing it becomes the Server Version

flint plaza
#

okay. I didn't know that

#

will rectify that

thin stratus
#

How else did you think would this work?

#

A PlayerController, similar to all other classes, is a entry in the PCs Memory.
When you send a replicated Actor over the net, there is no way that what the Server receives is the Client#s PCs version, as they don't share any memory.

#

They are connected via a unique ID

#

So what you actually send is just the underlying ID

#

And that gets matched to the PC on the Server. So you already have the correct one

flint plaza
#

Okay got it

#

but I want to match the location of the server's version on the client which is sending the location

#

Do you want me to rectify my code first and send again before we get to that part?

ivory portal
#

@thin stratus Oh I see now, copyproperties is a function

#

damnit now I've used playercontrol while I could have just used the playerstate

flint plaza
ivory portal
#

The fun part about refactoring is that you always know you will screw up somewhere

thin stratus
#

@flint plaza Kinda yeah, but you need to remember that LERP is for Static Values.
So static location to other static location.

#

You are however grabbing the ActorLocation

#

Which is also set

#

So this is constantly adjusting

#

You need to save the start location before executing the timeline

#

Also, in what actor are you doing this?

flint plaza
#

Pawn

thin stratus
#

Why are you passing the PC

#

And get the Pawn from it

#

If you are already in the pawn

flint plaza
#

Oops ๐Ÿค”
I'll fix that as well

#

how can I get the controller that I need instead of that?

thin stratus
#

Why do you need any controller?

#

You are on the pawn

#

All you do is get the pawn from the controller

#

But you are already in it so it's redundant

flint plaza
#

but I want the pawn that is sending the location

#

if I did get pawn on the server, wouldn't it get the pawn which is being controlled on the server itself?

thin stratus
#

Why "Getting" the pawn?

#

You said you are executing this in the pawn

#

So that code there happens on the Server Version of the Client's pawn

flint plaza
#

So let me get this straight

#

for example there are 2 players

#

1 playing on the server (listen server)

#

and other client

#

if I send the location from other client

#

to the server

#

will it be executing on the same pawn as the server on the server?

thin stratus
#

2 Players, ListenServer and Client.
Let's say only the Client has a spawned pawn (Server is just watching atm).
Client sees locally their own Pawn replicated. Server sees the Client's pawn.

If you call a ServerRPC on the Client, inside of their pawn, you'll remain inside the Client's Pawn but on the Server side.

#

These two Pawns (Client and what the Server sees) are two indipendent spawned actors, connected via a unique ID.
Modifying non-replicated values on server or client, will only change them in their version.

flint plaza
#

Awesome! That is something I would have never known.
1 follow up question: what if, in the current scenario, instead of the same pawn, I wanted to get another pawn?

thin stratus
#

Idk if pictures help you

#

But you could imagine Server and Client with their own little bubble as world

#

With more players, there are more bubbles

#

A multicast on the Server version of the Client's Pawn would then be an arrow to all client bubbles

#

Something like this basically

#

More or less

#

what if, in the current scenario, instead of the same pawn, I wanted to get another pawn?

#

That depends on what you need that for.

#

Getting a specific pawn is often not that easy.

#

You usually need another players pawn cause you interact with it

#

May it be via an Overlap or a LineTrace.

#

That way you usually get other player's pawns

#

You could technically also use GetAllActorsOfClass Pawn

#

But then you have no idea who is who

flint plaza
#

That's quite helpful actually (Y)

thin stratus
#

Correct

flint plaza
#

Doesn't work I just tried it

#

SHould the timeline be replicated?

thin stratus
#

The booleans at the top are weird

#

Just get the Length of the resulting vector

#

And check that

#

Well, usually "BReplicatesMovement" takes care of sending the update to the client

#

But that is not interpolated

flint plaza
#

The pawn doesn't have normal movement

#

it has a hovered movement that I replicated myself

buoyant hazel
#

is there a way to do co op without steam

#

?

flint plaza
granite kite
#

hey guys, is there an easy way to package a dedicated linux server executable? I know this can be done for windows. Also, if not, are there any metrics on windows dedicated server performance? thanks!

fluid flower
#

@buoyant hazel yeah, you could try connecting directly to each other, but it's very likely you'll run into issues with strict NAT etc.

buoyant hazel
#

hmm how could i do that

#

i just dont want my game on steam i rather have my game on itch.io

fluid flower
#

first player: open mapname?listen

#

second player: open ipoffirstplayer

#

thats the core of it, ideally you dont want your users to type console commands ofc

#

so you could save the started sessions in a database online and query it when needed

buoyant hazel
#

i see

#

do you know any peer to peer tuts

#

if so could i has links<3

winged jasper
fluid flower
#

not sure! I haven't dived deep into that issue yet because I'm focusing on Steam atm. I hope someone else here can chime in ๐Ÿ˜ƒ

granite kite
#

@fluid flower so is there a different approach to connections/matchmaking when using steam? is there some sort of package available for this?

fluid flower
#

when you use steam, the engine uses the steamworks api. And that api has NAT punchthrough built-in. So you simply call the create session and join session functions and it will connect you most of the time.

granite kite
#

ahh, interesting

fluid flower
#

We've personally never had any NAT issues with it yet

#

the steamworks one works great, with the downside that you can't use it without steam

granite kite
#

yeah

#

but that is only for having a player listen server, correct?

#

you can have multiplayer operate with a dedicated server infrastructure independent of steam or whatever else

fluid flower
#

yep

granite kite
#

are there any services for hosting ue4 dedicated server instances?

bitter oriole
#

Any hosting service will do

granite kite
#

I mean for scaling. Also, Im still curious if you can create a headless linux build, because i only see information for windows builds available

#

but Im sure i could have missed something

bitter oriole
#

You should be able to build your dedi for Linux using the regular cross compilation process

#

As to scaling you'll need your own tech

granite kite
#

alright. ill do some testing

ivory portal
#

We are currently using Gamelift

bitter oriole
#

^

granite kite
#

@ivory portal Thats amazon right? is that just a layer above ec2? how do you like it?

ivory portal
#

It is quite a big step at start

#

but after you get the hang of it, it works

#

It is quite limited in terms of user profiles etc

#

and with that I mean, none exist

fluid flower
#

I couldn't even set it up ๐Ÿ˜ฆ GameLift, I might give it a go in the future again

ivory portal
#

it is purely matchmaking and hosting

fluid flower
#

Are you guys happy with it so far?

ivory portal
#

Yeah, the price is good and the SDK works good

fluid flower
#

nice

ivory portal
#

just lack of documentation (or just so spread around) makes it hard at start

fluid flower
#

do they have a breakdown of prices, it's something that's hard to predict for me since its so much dependant on the game type/instance type etc

ivory portal
#

Yeah, on their website you can see the prices

#

I'm currently using frankfurt with spot prices

#

and linux servers (so 10 min intervals)

#

and its like 0.145 Euro/hour

fluid flower
#

cool, what type of game are you building if you dont mind me asking

ivory portal
#

just testing everything a bit

#

brb

thin stratus
#

Make sure to use Linux servers though

#

iirc windows was a chunk more expensive

fluid flower
#

yeah it seemed to be a lot more expensive indeed, I wonder how MS competes with their Azure stuff

soft inlet
#

I am having trouble replicating the spawning of a static mesh component to the client. on the listen server, both players are holding said static mesh, but on the client neither are holding anything. any idea?

celest geyser
#

(nvm)

twin juniper
#

there anyway to always replicate a value's state even if it doesn't change? i have clients set a bool variable locally to true, and do some prediction.
but at no point does the value change back to false (on server its false) call a repNotify that undo's everything.
i know everything works fine because the rep notify fires when the server tells client its true. things just get wonky when clients locally set bool to true because server wont replicate false state each update.

any ideas ?

dusky light
#

are you using bp or cpp?

twin juniper
#

cpp

#

i tried REPNOTIFY_Always in a condition notify still same results

ivory portal
#

Yes indeed, we went to Linux after seeing the differences

#

The one thing with the whole Gamelift implemtation is a bit wonky at the fact that they put the code in GameMode, but that changes when you change your map (if your map uses a different gamemode) so I've put it in GameInstance at the moment

celest geyser
#

I have a question: Here's a bit of code that toggles a widget on/off for each player, and tracks the state of the widget via the PlayerState. It seems to be running as it's supposed to, the variables are getting replicated correctly and the functionality is there, however, when I run this on my Client, there is a very noticeable delay until the IsPlayerHandWidgetOpen variable on the PlayerState is updated, somewhere between 0.5s and 1s. How can I improve this?

#

(click 'open original' to see the full resolution, discord compresses horribly)

ivory portal
#

This is going to be a question where I already think I know the answer to... to build a dedicated server, you will need to use the github version of unreal or can we do it through the official launcher?

glacial pollen
#

For developing:
Use the launcher version, in play settings you must have "Use single process" turned off. The big issue, is you don't have blueprint debugging on the server this way. (Dedicated) (You will be doing tons of print strings if you need to debug)

For shipping: You have to use the github version

craggy hedge
#

Hello,

what do i need for implementing multiplayer in my game? Do i need to pay? I've heard about a server they have for this.. i don't know? Because paying for a server if its my first game is not possible if its expensive

past rain
#

@craggy hedge Hey. Making your game multiplayer can cost $0 if you so wish. In UE4 there are 2 models, dedicated server (Where you buy/rent a dedicated server, which will host your games, can get extremely expensive real quickly) Or Client/Server model, which means that one of the clients a.k.a players, will act as the server, this costs nothing, but comes with some drawbacks such as, that one particular player that is both the server and client, can easily cheat and such, not to mention that if he lags, everyone else lags, if he disconnects, the game shuts down (You can obviously write code to prevent this from happening, but by default it would happen)

craggy hedge
#

So i need to pay for making a normal multiplayer?

past rain
#

Whats your definition of normal?

craggy hedge
#

Connecting to the game normally and join the game

#

idk

#

Through steam

past rain
#

No, you dont have to pay anything

#

its free

#

But it comes with the drawbacks i mentioned

craggy hedge
#

You said when another player hosts server?

past rain
#

yes

craggy hedge
#

Cant i host the server and everybody else is joining me?

past rain
#

Yes you could

craggy hedge
#

Players should not be able to host their own servers or rooms in my game

#

Just connect to the game and start the multiplayer matchmaking

#

How much do dedicated servers cost?

past rain
#

Eh

#

It can get pretty costly, depends on quality and such

craggy hedge
#

Where can i rent them?

#

Are there any sites you know?

past rain
#

There are hundreds of websites

#

Just type Rent dedicated servers on google

craggy hedge
#

Ok

past rain
#

Keep in mind

craggy hedge
#

How do i know what it needs to have on specs for beeing good enough for the game?

past rain
#

If you want your game to be played everywhere in the world

#

on top of paying for a dedicated server

#

you would need multiple

craggy hedge
#

Like how much for like 100 players for example

#

Oh fuck

#

Are there sites where i can buy servers in multiple locations?

past rain
#

Probably 1-2 in europe

#

2-3 in USA

#

its really expensive

#

if you are indie

craggy hedge
#

Ok so until developing a multiplayer game i need to develop smaller games and get some profit

#

Shit this wasnt my plan xD

#

But ok thanks for the info

past rain
#

You can still develop a multiplayer game

#

Dont worry so much about dedicated servers

#

People would still be able to play the game multiplayer

#

And you'll learn a lot

#

from the experience

craggy hedge
#

Are there tutorials atleast how to setup the dedicated server then? :/

#

Yeah i will try

#

How would it affect my pc if i would use it as the server for like hundreds of players for example?

#

So i host and evertybody else joins

past rain
#

Eh, thats hard to say, your pc would have to be on all the time, and if it ever dies, your game dies

craggy hedge
#

And can you tell me which specs are important on dedicated severs, i see some on google now but idk if SSD is needed, or which kind of hardware is the most important

past rain
#

That I can not answer, I actually want to know an answer to that myself ๐Ÿ˜„

craggy hedge
#

Yeah obviously, but how much performance is taken per player or something or could it handle infinite?

#

Oh ok

past rain
#

The great thing is, switching between client/server model, and dedicated serverl model, is extremely easy

#

So you can develop the game the same way with both in mind

#

And decide in the end ๐Ÿ˜ƒ

craggy hedge
#

Later i want to make a big open world survival game

#

Like H1Z1 Just Survive

#

Im saying later, not yet dont worry xD

past rain
#

Once you become a millionare right?

craggy hedge
#

nah

#

look at SCUM

#

the developers wasnt millionaires i think

past rain
#

Yeah that was more of a joke, but I hope you arent planning on taking that task on by yourself

glacial pollen
#

So I have a strange bug.
On PIE, My character stands on top of a floating platform.
But if I turn off "Use Single Process" in the play setttings, which spawns a separate dedicated server that is detached from the editor, my character can no longer stand on this platform.. However, I can control the character as normal.

#

Oh, I should point out. This only happens after using servertravel

#

If I start the game in that map, all if fine, no matter HOW I start the game

#

If however, i start in the menu map, and then server travel, with "Use single process" turned off, then, and only then, my character will fall through the platform

#

I guess I should point out my platform is moving, which is based off a Character type

#

So,

I can tell, it WANTS to block, but it only blocks for like a quick second, and then the player falls through anyways

#

So, it would appear the block is happening on the client, but the server doesn't see this, and tells the client to forcefully move the character

willow parcel
#

I am looking for guidelines about how many collision spheres on a character are too many in a multiplayer game?

plush wave
#

When an actor becomes network relevant (for example, getting closer to a distant actor), does the actor call a function when becoming relevant?

#

Is, for example, BeginPlay() called?

#

Since the actor has been re-created on the client?

elfin veldt
#

I'm in need of a bit of assistance. atm I can apply damage to things as my character but only from the server, if I try on the client it give's me 0's. Any clue how I can fix this?

graceful cave
#

@elfin veldt only the server can apply damage and that is the only way it should be

#

also if a client tried to apply damage it would only show up on that client and not affect the actual game

#

if you want the client to have authority over the damage they do then you need them to tell the server to damage something for them but that is a really bad practice

elfin veldt
#

okay, then I feel like I'm misunderstanding some very basic things

#

if i want two players to be capable of damaging each other how would I go about it?

thin stratus
#

Well, UE4 has some damage function for you, like "ApplyDamage" or whatever it's called.

#

Every actor has that and every actor also has the "AnyDamage" event.

#

And the ApplyDamage event has to be called on the Server.

#

Same for RadialDamage and such.

#

So if an attack is launched by a Client pressing a button, you have to ServerRPC over to the Server and let it deal the damage.

#

@elfin veldt

median elbow
#

I've got the advanced steam sessions plugin to work, but when it gets the players name, it caps it at like 20 characters

#

is there a way around that?

#

i get the player name from the player controller -> get player name

#

@thin stratus i know you probably hear this a lot, but your network compendium was really helpful

#

i really liked that it was straight to the point, and not wordy at all

thin stratus
#

(: Glad it's helpful!

elfin veldt
thin stratus
#

No, it's limited to servers

#

So that clients can't/shouldn't call it

#

It doesn't automatically call it on the server

elfin veldt
#

ahh, i get it.

graceful cave
#

a big thing i didnt understand when i first started multiplayer is that you need to be aware of who will be running whatever code youre making

#

for example, when a character spawns

#

the server and all clients will be running begin play

#

on that actor

#

so you can use the Switch HasAuthority bp node or a branch with the IsServer node

#

or you can use the IsLocallyControlled node

#

but its important to pay attention to who will be running code as you make it

#

so for example if you have an input event like a key press

#

and directly try calling ApplyDamage on that exec chain

#

it wont work if the key was pressed by a client

thin stratus
#

I think there is a bigger picture you have to take.

#

It's not really about "Who calls what?", because that's just a sideeffect.

#

What you need to understand is, that Replicated Actors are existing once per Game. (in most cases).

#

You gotta picture a bubble for each player (including the server).
And if you have a replicated actor, that actor exists once in every bubble.

#

And the RPCs help moving from one bubble to another.

#

E.g. your PlayerController exists in your own bubble and once on the Server as a copy.
If you ServerRPC, you go to the Server Version of that actor.

#

Some Actors also only exist in one bubble, like the GameMode only exists on the Server.

#

Something like this

graceful cave
#

@thin stratus is the multiplayer lobby kit on the marketplace the one that used to be called multiplayer lobby system

#

has a different name but its in my library

thin stratus
#

Yeah, it got renamed to fit the rest of our kits

#

And also refactored in 4.20

graceful cave
#

yeah i got that for 4.18 over a year ago and helped me learn a lot about multiplayer

#

id recommend that one to anyone trying to learn

thin stratus
#

Yeah it's a lot different in 4.20 now

graceful cave
#

also handles all the "backend" stuff and lets you focus on gameplay logic

thin stratus
#

I would recommend not touching the pre 4.20 version anymore

#

The new version properly utilizes Seamless Travel and concentrates more on the "how to move data from lobby to game and back."

#

And cuts away the actualy gameplay part for some VERY basic test gamemodes

graceful cave
#

sounds like a huge improvement lol

#

i reworked the 4.18 one to support dedicated servers for my last project but the menu layout is still the same

#

but all im really saying is thats a good learning tool

thin stratus
#

Thanks!

#

(the new one also supports dedi servers now)

grizzled stirrup
#

To prevent people sharing . sav files with unlocked items, is loading / saving on launch using PlayerState->GetPlayerName() as the SlotName a valid way to go about this?

#

This way if online with steam, it SHOULD always load / save only to the steam username

#

Unless it's trivial for people to edit the .sav files to change the name

bitter oriole
#

Not really a multiplayer issue

grizzled stirrup
#

Sorry, just thinking through steam and regarding people seeing skins in game

graceful cave
#

you would need to validate that through steamworks

bitter oriole
#

But generally, if people want to do it they will, PC platform has 0 security on file editing.

thin stratus
#

It's pretty much impossible if you don't reward the stuff on server side in the first place.

grizzled stirrup
#

It's all P2P so I guess I'll just not check at all

thin stratus
#

Even if you stop them from sharing, if aquiring the skins can be done offline, you can just grant it to yourself anyway.

#

Yeah ListenServer setups aren't really worth worrying about

grizzled stirrup
#

I find it incredibly impressive that people manage to figure out how to do that, like how can they find the line of code that unlocks an obscure skin? Or is it simply setting some memory address that enables it?

thin stratus
#

Most memory address stuff

grizzled stirrup
#

Probably quite trivial if they know what they are doing, especially since there are many ue4 games that they are familiar with

#

Thanks a lot

#

Saved a lot of work and headaches

#

Will leave it all local and not try to prevent it

thin stratus
#

There will always be cheaters

#

Always

bitter oriole
#

If you want somewhat safe save data you basically need to store it on servers and don't let clients modify them directly, but only through your safe deidcated server.

thin stratus
#

And there will be a good chunk of people who don't cheat.

#

Take Risk of Rain 2 for example.

#

The game has characters you can unlock

#

All offline stuff

grizzled stirrup
#

Yeah are all the items in risk of rain offline?

#

Wow

thin stratus
#

I could unlock them by cheating, but that's really not fun at all

#

Yeah I'm not conncted to any backend afaik

grizzled stirrup
#

Ok so it's only really the people who really want to cheat will do it

#

That's cool

#

Great example

worthy perch
#

People were sharing modded .dlls that allowed for 16 player lobbies for RoR2. I don't know how they managed to do that.

grizzled stirrup
#

Part of the fun of these kind of rewards is the challenge of getting them, just wanted to prevent it. It seems risk of rain 2 is completely peer to peer, correct?

thin stratus
#

The most funniest thing ever was how Assassin's creed two was cracked.

#

They brought up the "You have to be online." shit

#

A server was validating some codes whenever you reached a new mission.

#

What did they do? Made a custom Server, let someone legally play through the game, record all traffic, and simulate that with the custom server.

#

people will always find ways ยฏ_(ใƒ„)_/ยฏ

grizzled stirrup
#

๐Ÿ˜„

#

wow

#

Yep ok I'll go ahead with the mentality of "they'll do it, don't worry about it"

#

Instead of preventing

#

Which could cause split saves, and lots of problems for legit players playing offline etc.

thin stratus
#

Question is

#

Is your game F2P and needs the customizations to be paid?

grizzled stirrup
#

No

#

Just in game for fun

#

Unlockable through challenge

thin stratus
#

Or is the game Buy2P and customizations are achieved through playing?

grizzled stirrup
#

No store

#

It's just for fun, the items don't matter

#

It just would be nice to think all players earned them by playing

bitter oriole
#

Don't worry about it then

thin stratus
#

Point is, if you don't make money by selling items.

#

Then why care in the first place

grizzled stirrup
#

๐Ÿ˜„ very true

thin stratus
#

If you however build up the game on a customization basis, then yeah you need to prevent them from cheating

grizzled stirrup
#

By the way while you are here eXi, do you think Risk of Rain 2 did anything special to network the extreme amount of stuff happening on screen in later rounds?

#

Not sure how much you have played but there can be literally thousands and thousands of text widgets spawned per second

#

And it appears that they are all replicated

#

Not to talk about hundreds of AI and individual projectiles

#

I'm quite impressed that I haven't experienced any side effects from latency or anything playing on a peer to peer network

thin stratus
#

I was at like 70-80 min runs with 3 players

#

So I know how much shit can be on the screen

#

It's not UE4 after all

#

So it can be really cheap on bandwidth what they are sharing

#
  • the graphics are already pretty forgiving
#

Or is it ue4?

#

xD

grizzled stirrup
#

That's true, I'm just thinking purely on the amount of data / individual RPCs that have to be sent

worthy perch
#

It's Unity.

grizzled stirrup
#

I think it's Unity

thin stratus
#

Oh.

#

I don't think they do anything else than others do

grizzled stirrup
#

Just seeing that UE4 can hit the bandwidth limit of 10kb/s with a few default characters walking around (unless you change the limit)

thin stratus
#

Code the game. Check the bandwith. Cut down whatever calls too often with too many bytes.

grizzled stirrup
#

I find it crazy to see all this additional stuff on the screen with no problems over p2p

thin stratus
#

Well it's not p2p

#

Keep that in mind :P

grizzled stirrup
#

Risk of rain is AFAIK?

thin stratus
#

ListenServer != p2p

grizzled stirrup
#

Oh is peer to peer where no one is the true host and they all keep state?

#

Sorry

worthy perch
#

What numbers should you aim for for server out netbandwidth?

grizzled stirrup
#

Still yep over the listen server I'm impressed with the amount of stuff sent per second

thin stratus
#

Yeah RTS like P2P is something we don't really see today anymore

grizzled stirrup
#

I'm going to run some tests soon with UE4 spawning loads of text actors like that

#

But as far as I can tell you'd need to call an RPC every time you deal a specific type of damage to spawn an individual widget

#

That could be like thousands per second

thin stratus
#

Technically yes

#

We have something similar in Hoverloop, but not that many of course

grizzled stirrup
#

Do you notice saturation / slowdowns or am I treating RPCs as more expensive than they are?

#

Unreliable in this case of course

#

Can you get away with thousands per second?

thin stratus
#

Well they are unreliable to begin with

#

They are dropped for more important stuff

#

You don't need to always see the numbers on your screen

#

And if you really need to, you could simulate most of it locally

#

The client also knows what the bullet/spell should deal

grizzled stirrup
#

Ahhh true

#

So you'd just simulate firing of the other client on your machine with an "is firing" repnotify or something

thin stratus
#

Thing is, with enough time, you can do a lot of stuff in UE4.

grizzled stirrup
#

And do all the cosmetics on your screen

#

It just might not be fully accurate

#

But with a game like ROR2 it doesn't need to be really

thin stratus
#

Just as an example

#

Not multiplayer, but 10k AIs

grizzled stirrup
#

Damn impressive

thin stratus
#

Yeah hehe, she did a good job on that. But did also only work on that client, so enough time to optimize the hell out of it.

#

So if you have a enough time (and c++) at your hands, you can do risk of rain 2 amount of enemies and Ui stuff

grizzled stirrup
#

I'd assume you'd need custom movement to ensure it's all blazing fast

#

Default CMC is very expensive in comparison for many actors

#

But very inspiring stuff, I'll aspire to get there one day

thin stratus
#

These aren't even Actors.

grizzled stirrup
#

... Wow

thin stratus
#

But I can't really tell much, NDA.

grizzled stirrup
#

Of course!

#

That's cool though

#

Super barebones

#

I wonder if the UI stuff would also need similar work or if tons of widgets can be spawned in worldspace

#

Will test soon as a fun project

thin stratus
#

IF, UMG is the bottleneck

grizzled stirrup
#

So I'd have to use slate?

thin stratus
#

You'd see yourself using Slate in the end.

grizzled stirrup
#

Ok

#

I mean for simple text I'm sure it's doable

#

No experience with slate though have to look at the docs

#

At the end of the day it's spawning a camera facing number and destroying it after a few seconds, challenge accepted!

thin stratus
#

have to look at the docs Good luck.

grizzled stirrup
#

Oh no is it one of UE4s lacking doc areas?

#

๐Ÿ˜ฆ

thin stratus
#

Yus. :D

#

Well you wouldn't spawn camera facing numbers

#

You spawn a UMG widget that gets posititioned on the screen to match the projected world location

#

I assume RoR2 stuff is also screenspace

grizzled stirrup
#

Ohhh ok, so worldspace stuff would be more expensive / overkill?

#

I'll try first with UMG and profile

#

So it's all 2D but just in screenspace

#

Interesting

#

I had seen those fancy 3D widgets and thought it'd be that

#

But I guess that's more for very specific stuff or VR

thin stratus
#

You can set a 3D widget component to be screen space

#

Which does the math for you

#

But that is kinda weird to use for damage numbers

#

I guess... maybe it can be utilizid

#

But it kinda dislike how annoying it is to access that component if it's meant for you own ui

grizzled stirrup
#

If it's just a simple fire and forget widget, spawns on bullet impact, destroys itself then I shouldn't have to access it again- will look into it

#

Thanks for the great chat

#

Learned a lot (have your mp guide eternally open in a tab)

#

Appreciate your great help making it much easier to understand mp stuff in UE4

elfin veldt
#

Many a thanks btw @thin stratus I think I understand now. at the very least I've got it working.

jolly siren
#

Does anyone know where _Validate functions are processed and kick players if they return false?

winged badger
#

reading a generated.h with one of those should provide a clue

chrome bay
#

I think it's handled somewhere quite low level in the replication system IIRC

ivory portal
#

@glacial pollen Yeah. I am testing a new Gamelift implementation but... needs to be compiled with Target=Type.Server

#

so out of luck ๐Ÿ˜› Downloading the 4.22 now

#

Let's see if 4.22 is really faster compiled

celest geyser
#

Hey, I seem to be having some issues setting the materials on a replicated actor. It gets spawned from the PlayerController with a RunOnServer Event - this in return calls an event inside the Actor's BP which sets the mesh and material based on passed variables. The mesh is getting replaced correctly, but the material isn't .... any ideas? o.O

#

I also tried setting the material directly in the RunOnServer Event that spawns the Actor but no dice either...

onyx gale
#

Hey is anyone familiar with utilizing WebSockets with an UE4 game? We successfully did a HTML5 export, but now want to set up online matchmaking via the web

slender yarrow
#

@celest geyser rep notify in the actor's BP. had this problem last week

#

use the rep notify function to change mat

celest geyser
#

@slender yarrow Where can I find that? I have 'Component Replicates' turned on on the StaticMesh component, and these are my settings in the class defaults

slender yarrow
#

well for example in my game, I spawned the players for the first time from the gamemode when the first enter the server. I then set a rep notify variable the lives on the actor bp FROM the gamemode. That activates the rep notify function on the actor bp which changes the material on all so all clients can see

#

rep notify is under the replication options on the variable by the way

celest geyser
#

hm, I tried swithcing around the replication settings on my variable to no effect ๐Ÿ˜ฆ

#

ah, let me try it from the PlayerController when I spawn it

slender yarrow
#

rep notify automatically creates a function in your function section

celest geyser
#

aaaaaah!

#

and I set the material in the function!

#

that worked, thank you! ๐Ÿ˜„ ๐Ÿ˜„

slender yarrow
#

๐Ÿ‘

celest geyser
#

These are still unique to the instance of the actor, correct? Meaning when I set the repNotify variable on one instance of the actor, it doesn't run the OnRep_Function on all of them, correct?

slender yarrow
#

well it does run on all so they can all see the change, but it will only change the mat for that specific actor.

celest geyser
#

perfect! ๐Ÿ‘Œ

#

thank you! ๐Ÿ˜ƒ

slender yarrow
#

youre welcome

#

So i have a question for anyone: I have a little shop menu pop up where you are able to buy killstreak rewards. This is obviously a client UI. Im wondering how I would be able to buy a killstreak from that UI on the server? I cant visualize a way though because the UI is absolutely deadlocked to the client and theres no work around to have it be able to talk to the server. How does one approach this?

#

I feel like the click events on the UI are the only way to trigger setting the required variables for this.

graceful cave
#

@slender yarrow communicate from the widget to a server rpc in the player state where the server can validate and activate the reward

onyx gale
#

Hey is anyone familiar with utilizing WebSockets with an UE4 game? We successfully did a HTML5 export, but now want to set up online matchmaking via the web

slender yarrow
#

@graceful cave ok so to the playerstate. I will give it a try

vital steeple
#

for a round timer, should it just be a replicated timer that the server runs or a timer that the server runs (but doesnt replicate) and a multicast that kicks off on the clients when the match starts or a client joins? seems like replicating one less thign is always good

graceful cave
#

@vital steeple have the seconds value as a byte and the cost of replicating it is basically nothing

vital steeple
#

just a byte variable for seconds then another for minutes?

graceful cave
#

yeah an int would work for minutes

#

if you ever expect it to go over 255 anyway

vital steeple
#

naw should be 10-20 min

#

if they go to 255 then they deserve the timer to stop working

#

thanks for the recommendation, thats simpler

rocky badger
#

i'm having an issue where a local function call is being called before my replicated server call is completed.
In the lines,
playerRef->AlterHealth(baseDamage, instigatorRef); playerRef->UpdateHealthUI();
the first line is a replicated server call in the player while the second line is a local update to their UI. My issue is that the second line is sometimes being called BEFORE the 1st line finishes running. Is there anyway I can make the 2nd function wait for the server call?

storm forum
#

So I have an idea that i want to know how possible it is. I want to figure out how to make time stopping a thing in my multiplayer game. I was wondering if you could desync the time stopping character from the server then resync them, if that would allow you to move while everyone else was not moving.
or maybe there is another way

glacial pollen
#

1 player, dedicated server. BodyPartComponent is a part of Mech_Base which is owned by my player controller

buoyant hazel
#

hey could i call someone who knows alot about multiplayer and blueprints?

spring ore
#

any idea why i can only fire weapons on server side?

#

ok i explained this badly

#

the server player can fire and the bullets are spawned on both the client and server but if the client player fires, the bullets are only spawned on the client

fossil spoke
#

Well then your not telling the Server to fire the bullets on the Clients behalf.

#

Or at least, your not telling the Server that the Client wants to fire a bullet, the Server should then decide if that Client is allowed to.

spring ore
#

here is the firing logic

#

is this wrong?

unreal pine
#

Anyone know if I can replicate the bUseControllerRotationYaw variable on the PlayerController? Basically my pawn is always using the movement component for yaw unless it's the server or the client's owned pawn.

spring ore
#

@fossil spoke any ideas?

glacial pollen
#

I'm spawning an actor in gamemode, and the client thinks its Simulated_Proxy.... but its single player... with a dedicated server...

jolly siren
#

How many bytes is a FVector_NetQuantize ?

#

Or what is the range assuming it isn't static?

brittle sinew
#

The size of the object itself is the same as a normal FVector (it inherits from it); it's the serialization size that is affected. Like the docs say, each component can take up a maximum of 20 bits in the serialized version.

jolly siren
#

Right, I meant it's replicated size

#

okay, so up to 7.5 bytes

brittle sinew
#

Yeah, there's also a header on the serialized version to provide that number, however, so you'll have to factor that in

#
// written (size = Log2 (MaxBitsPerComponent)) to indicate how many bits are actually used. ```
jolly siren
#

Does the real serialized size depend on the contents then?

glacial pollen
#

I'll ask again, and hope someone pings me in the morning:
I have a dedicated server, with 1 client.
The game mode spawns an actor, with the client's player controller as the owner.
If I call get local role, on the client's actor's begin play,
I get Simulated_Proxy....
In a single player game....
If I call Actor->Get owner, i get players controller...
If I call Actor->Get owner -> Get local role....
I get Autonomous Proxy...

What can be wrong?
I've tried turning off single process,
turning off auto connect
possessing the actor (character)
Spawning the actor on gamemode, or on the clients player controller on the server side.

The really weird and final point I would like to note:
If direct my output from Simulated_Proxy, to code/blueprint that runs under Autonomous _Proxy... it works... I can make calls to the server's copy of the actor, and the players controller...

If it works why am i here? Because this shouldn't be happening, and it makes coding/blueprint confusing, I have to remember, that for the main character, to treat it differently than everything else I was taught how this is supposed to work.

PlayerControler: Role is correct
Another players actor : Role is correct
Client only spawned actor : Role is correct
My own actor : Apparently is another client's, even though i've tested with a single player...

next warren
#

Hi ..in my multiayer project vehicle movement lags idk how to solve this issue

#

Any suggestion or ideas

#

On steering and also on accelerate there is a lag on the vehicle movement

#

Like jittering

bitter oriole
#

@next warren How did you implement replication ?

#

Vehicle replication is no small feat

next warren
#

I m working on thd sedan template project..

#

The vehicls replicated

#

When the person presses f he enters the car then he posses the vehicle then on accelerate or steering movement there is a lag like jittering

#

In vehicle game when i simply play with run as dedicated server there is no lag or jittering... in this project i m getting the jitter or lag

#

Will u give sme suggestiin or ideas or workflow bro... @bitter oriole

bitter oriole
#

@next warren My question is how the vehicle is replicated

#

Replicating movement is very involved

#

Why it doesn't work well depends a lot on how you did it

next warren
#

1.I created a wheeled vehicle bp
2.then i simply replicated the sedan in replication category
3.then i implemented some of the controls for throttle and steering

bitter oriole
#

So you just ticked "replicate position" ?

next warren
#

S

bitter oriole
#

S ?

next warren
#

Yes bro

#

Ticked the replicate movement

bitter oriole
#

Then it's normal that it doesn't work well, because outside PIE where the two players are connected directly, network lag destroys this

#

Think about it : you move on a player, tell the server you moved

#

Then the server replicates movement back to you

#

But when it replicates, it is a position / rotation (transform) that was older than now (basically as old as your ping time)

#

So it goes back

#

Vehicle movement is way more involved than clicking replicates movement, which only really works for initial location of objects

next warren
#

There is no much tutorials for vehicles so i m not able to get the ideas

#

In vehicle game demo it works well on playing run as dedicated server

bitter oriole
#

It won't work over a network

#

Multiplayer vehicle is hard. Here are the main ways to do it :

  • Client-authoritative, where you keep your regular physics vehicle, tell the server where you are, replicate the location with the "Skip owner" condition so that you're unaffected, and add some interpolation on remote clients to smooth out the movement. People can cheat very easily that way, so beware.
  • Server-authoritative, where the server is told your player input, simulates it entirely there, tells you its own version ; while the player also simulates locally. This is known as rollback + replay, if you want to know more there' a great udemy course for UE4. This prevents cheating, but it also prevents using physics vehicle.
#

Right now what you have is client-authoritative, but bad

#

If you want to fix it, it's quite easy, but beware cheating will be impossible to prevent

next warren
#

Thanks for taking ur time to explain my doubts

#

I will try to apply ur ideas in my project

#

Will u send some of the youtube tutorials link for me i searched for two days still i m not getting good videos

bitter oriole
#

If you're going to keep client auth, what you need is extremely simple :

  • a RPC call from player to server on tick to send the current position, rotation and velocity ;
  • three replicated variables that have "skip owner" as a replication condition ;
  • on non-locally-controlled vehicles, on tick, set position / rotation / velocity to the latest replicated value
#

The last part will need smoothing at some point but it will work much better already

#

For the second approach (server auth), you'e going to need a much more involved course, and C++

next warren
#

The vehicle game demo project will it support multiplayer

#

I played it with run as dedicated server there is no lag in that project
If that supports then i can simply use that vehicle bp

bitter oriole
#

There are no built-in multiplayer vehicles in the engine or sample content. There is at least one plugin for (client-authoritative) physics vehicles on the marketplace

#

And you need to test your projects in the real world for multiplayer. Run two games locally, one as host, the other connecting to it, with the engine packet lag simulation enabled

#

And test on real networks with multiples machines once you're pretty sure it works

thin stratus
#

If it wouldn't be such a pain to setup server-authoritive movement (specially for vehicles and such) I would push out something just for learning.

#

I'm still somewhat sure that it's possible to create a generic movement component that allows extending via BPs.

#

But would need some new variables types

humble comet
#

hey guys how would you implement relative team/healthbar coloring, e.g. when my team always be blue, while enemy team always be red

bitter oriole
#

Check team ID in player state for each player, blue if same as local player, else red

celest geyser
#

Is there a way to check if the window has focus in BP ? I have an edge scroll function that gets called on tick, but I want to only fire it if the window has focus

humble comet
#

by window what you mean? your game screen? or umg widget?

civic zenith
#

Hi guys I'm barely new with this multiplayer stuff and I'm trying to find the server session as a client, so I wonder if when I run the game with the checkbox "Run dedicated server" checked, it creates a session automatically?
Sorry for my English, it's not my first language.

bitter oriole
#

No, it does not

#

Sessions don't exist in PIE (editor)

civic zenith
#

Ok, thank you!!

celest geyser
#

@humble comet My game screen. When I test in PIE, I only want the edge scroll function to run whenever the PIE window gets focus

#

so that when I switch between different PIE windows for testing, my screen doesn't scroll off into infinity on the unselected window ๐Ÿ˜„

humble comet
#

@celest geyser FSceneViewport::OnFocusLost() there must be something like this in this case

celest geyser
#

hm, I can't find anything corresponding for BPs :S

humble comet
#

yeah, seems like there are no corresponding bp nodes for this ๐Ÿ˜ฆ

past rain
next warren
#

@bitter oriole i m not finding any multiplayer tutorial for vehicle

#

One video found that too they are not doing anything simply replicating the bp(self)

#

Youtube channel (unreal tek) topic replicated vehicle @bitter oriole

bitter oriole
#

@next warren Simply replicating won't really work.

#

Like I said

#

I pointed you toward two clear options ๐Ÿ˜ƒ

#

It's client authoritative, so cheating, but right now that's the only way to have physics anyway.

past rain
#

Can someone please help with this one?

glacial pollen
#

@past rain the fact it spawns two is your first problem

past rain
#

Yeah, the functions are being called twice, even though Im telling it to only run on the server

#

which is what I cant figure out right now

glacial pollen
#

Show me the event

past rain
#

Do you mind doing this over screenshare?

glacial pollen
#

I'm at work

#

Use share x

#

You can do partial screenshots and it's auto copied to clipboard

#

Which you can paste here

past rain
#

When the player presses left mouse button Fire() is called

glacial pollen
#

Why

#

Are you spawning

#

Without auth check

past rain
#

shit

glacial pollen
#

That whole function should be auth

past rain
#

So the if statement at the top simply tells the server to run this code

#

but then the client runs it too?

glacial pollen
#

Only the fire function

#

You need to control the entire function on server

#

Unless you like cheaters in your game

glacial pollen
#

Fire :: if auth :: spawn

past rain
#

like this?

glacial pollen
#

Yes

#

You might as well make it all one auth check

past rain
#

Would I remove the Role < Role_Authority?

glacial pollen
#

Nevermind

#

You have it right

past rain
#

Okay let me try

#

see if its called twice

#

Okay now it spawns once! so thats an improvement

#

however, the velocity is wrong

#

It just goes down to the floor like in the video, rather than where I aim

#

(Works fine for the server, but not on the client window)

glacial pollen
#

Make sure it's replicated

#

All the components

#

Including projectile comp? (Not sure)

past rain
#

They dont have replicate

#

Do I have to somehow Continuously update the movement to the server?

#

I mean, it does move, just on a fixed direction

#

which I did not set

glacial pollen
#

No

#

Projectile movement comp does all that

#

If it works on server but not client

#

It's not being replicated

#

Make sure the mesh and collision is set to replicate

#

Because the movement components move the collision cylinder

#

And the mesh should be somehow attached to that

#

Directly or through another parent

past rain
#

Im looking at Epics shooterGame example, and their projectile rocket, which uses projectile movement component, dont have these on, so they are irrelevant

#

I have the relavant replicates on

glacial pollen
#

When you spawn do you set the owner?

past rain
#

For the projectile?

glacial pollen
#

Yes

#

Owner determines replication

past rain
#

isnt that done here?

#

this = weapon class

#

this function is in the weapon class

glacial pollen
#

Okay, who is the weapons owner?

past rain
#

checking

#

if it has the right owner

glacial pollen
#

If you say the character, then tell me who is the owner of that

past rain
#

shit

#

apparently the owner of the weapon

#

is the weapon itself

#

so thats setup wrong

glacial pollen
#

The point being, you should be able to follow the chain of owners down to a player controller

ivory portal
#

Why is match-states an FName and not an ENUM? Also, why does the documentation miss any mention of the different match states ๐Ÿ˜•

glacial pollen
#

So the server can know who owns it

#

@ivory portal I would wait for unreal to release their new cross platform multiplayer stuff

#

Just get basic multiplayer and work on the rest

past rain
#

Yeah this is a bit messed, the owner of the clients weapon, is the server weapon

glacial pollen
#

Unless you need to release this. Year

past rain
#

That cant be right

glacial pollen
#

Projectile-weapons-char-playercontroller

#

YOU CAN EVEN JUST DO:
projectile-playercontroller
Weapons-playercontroller
Char-playercontroller

#

I do that, but I have a complicated attachment system, and it depends on attachment points to determine "parent" which is irrelevant of network owner stuff

past rain
#

Okay what about this

glacial pollen
#

The most outer owner of any actor should always be a player controller

past rain
#

I need the playercontroller in teh weapon class, because I do the ray-tracing there

#

If I have the owner, I cant find a good place to initialize the controller

#

if that makes any sense

glacial pollen
#

No it doesnt

#

The controller is given to the player

#

That controller is the link between the server and client

#

Any other actors are owned by that controller one way or another

past rain
#

I just mean I need a reference to the player controller in the weapon class, so I can use functions

glacial pollen
#

Simple

#

Function:
Role < Auth(
Get player controller 0
Do x)

#

Why does this work? Because the client cannot see other controllers so 0 is ALWAYS its own controller

past rain
#

ohh

glacial pollen
#

Now if you said role=auth, then it would matter

#

Because the server can see EVERYONES controller

#

To solve that is also easy, just pass the controller from the client during your rpc server call

#

So the server knows which controller to call back on

past rain
#

so I could simply use UGameplayStatics::GetPlayerController(GetWorld(), 0);

#

to get to the player controller

#

locally

glacial pollen
#

Yes, BUT USE role= anotumous proxy

#

(I have a weird bug right now where I get simulated proxy) on an actor, but anotumous proxy for it's owner

#

So I might not know what I'm talking about xD

#

No one has answered me, so I can only try to help at this point

past rain
#

You're being very kind

#

The ownership is correct now

#

The character owns the weapon

#

Its a bit different now, but still wrong

#

Just goes to that exact spot no matter what

#

again, only on client, not on server

glacial pollen
#

um

#

just for sanity

#

who owns the character?

past rain
#

checking

glacial pollen
#

remember, at the end of the owner chain, needs to be a player controller

past rain
#

Trying to log the owner's name in players begin play

#

crashes teh editor

#

So.. no one?

glacial pollen
#

Just check where you spawn the character

past rain
#

Player is spawned instantly

glacial pollen
#

using game mode right

#

default pawn?

past rain
#

I havent gotten to coding the game mode, I only have a blueprint version of it

glacial pollen
#

yes yes

#

so default pawn

past rain
#

default pawn is set to the character

glacial pollen
#

okay cool

glacial pollen
#

so the owner of character SHOULD be the player controller

past rain
#

PlayerController_BP

#

which is the blueprint of the player controller

glacial pollen
#

I shouldn't crash

#

do you have debugging symbols installed?

past rain
#

Editor Symbols for debugging is off

#

let me see what the crash says though

glacial pollen
#

i promise the crash, is a one liner

past rain
#

this is the crash

glacial pollen
#

without debugging symbols

past rain
#

it is

#

But logging the owners name sholdnt cause it to crash?

#

Its already spawned in beginplay

#

Let me try logging it someplace else

glacial pollen
#

You will want debugging symbols... eventually

#

its shouldn't crash there, and you need to find out why

#

you can't ignore stuff like that, and hope it goes away.

past rain
#

Logging it anywhere crashes when I want it to log... so I guess getowner = nullptr

glacial pollen
#

Also, try getdisplayname

past rain
#

for some reason

glacial pollen
#

then check for nullptr

#

But I am guessing

#

a proper crash log would tell you if its a nullptr

#

without having to code it in constantly

past rain
#

Who is getdisplayname a function of?

glacial pollen
#

its a blueprint thing

#

not sure what it is in c++

#

UKismetSystemLibrary::GetDisplayName(Object)

#

Also: GetActorLabel() . You don't need to use that namespace.

past rain
#

Display name is correct

#

and checking if getowner is not nullptr, makes it not crash

#

So my character doesnt have an owner

#

How exactly is that possible?

glacial pollen
#

because, you need to stop thinking, that your function is only called once

#

I bet

#

if you did
controller not equal null :
do this
controller equal null :
break point here

#

it would hit

#

For example,
Server, client 1 client2
Server spawns Actor1 for client1

Actor1 begin play : Server, client1, client2
role: Auth, Autnomous, Simulated

#

client2, will CRASH if you use get owner on Actor1
because its null

past rain
#

Getowner is nullptr in singleplayer too though

#

wait

#

I might be dumb

#

one sec

#

nope not dumb

#

Character dosnt have an owner in singleplayer either

glacial pollen
#

Even single player, is still networked

past rain
#

hmm

glacial pollen
#

If the char, is owned by the server,

#

and you call get owner on the client

#

crash

past rain
#

So I need to setowner in the constructor/beginplay?

glacial pollen
#

I'm not sure why your default pawn does not have an owner

past rain
#

From the picture that I sent you

#

it should

#

right?

glacial pollen
#

Are you using gamemode, or gamemodebase?

past rain
#

base

glacial pollen
#

Also, get into the habit of using role = whatever, on begin play

#

so you know who is running

#

also, if something doesn't run, when it should you will know the owner is not set

past rain
#

I'll keep that in mind, but as you said, the owner should be set, I do that in the gamemode bp

glacial pollen
#

ummmm.

past rain
#

Should I try switching to gamemode instead of gamemodebase?

glacial pollen
#

you can't set the owner for the default pawn, as the built in code, will do that already

past rain
#

Well apparently it does not

glacial pollen
#

Sure, so block it

past rain
#

not in this case at least

glacial pollen
#

by overriding

#

SpawnDefaultPawnFor

#

inside of that

#

spawn actor, and link the input player controller, to the owner, of the spawn node

#

and output that spawned actor

#

also, break the transform apart, so it doesn't complain

past rain
#

Should I do that in the game mode c++ class?

glacial pollen
#

nah

past rain
#

blueprint?

glacial pollen
#

simpler to test in blueprint

#

do quick tests in blueprint, to make sure it even works, before you pull your hair out, because you missed stupid piece of code, and thought it didn't work

#

Yea

past rain
#

Set Default pawn class?

glacial pollen
#

so in gamemode bp

#

no

#

SpawnDefaultPawnFor

past rain
#

I can only find Spawn Default controller

#

cant find the one you mention

glacial pollen
#

change your gamemode

#

I never used gamemodebase

#

good to know that override is in gamemodebase

past rain
#

still cant find it ๐Ÿ˜ƒ

#

sigh

glacial pollen
past rain
#

let me make a new game mode

glacial pollen
#

why

#

how does that solve anything?

#

it there

past rain
#

oh

#

its there

#

lol

#

okay found it

glacial pollen
#

change that to your custom char

#

IF THAT DOESN'T WORK. Then you have something really wrong.

past rain
#

like this?

glacial pollen
#

yes

#

but why are you spawning a default pawn

past rain
#

just followed your picture :;D

#

alright fixed it

#

do I remove PlayerStart?

glacial pollen
past rain
#

do I remove the playerstart thats placed on the map?

glacial pollen
#

why?

#

how do you think

#

works?

past rain
#

by finding playerstart :p

glacial pollen
#

xD

#

so leave it

past rain
#

so do u want me to try and log the owner now?

glacial pollen
#

yes

#

log the owner in gamemode, when you spawn it

#

and log it again in begin play of actor

#

also, do role checks in there

#

(in blueprints its : GetLocalRole)

past rain
#

its not crashing anymore

#

Its logging this out

glacial pollen
#

Okay, now shoot

past rain
#

the only thing that changed, is the fixed spot where the bullets go

#

but they all still go there no matter what

#

oh wait

#

NO

#

WAIT

#

wait

#

wait

#

my bullets go

#

where the servers crosshair is

#

not clients crosshair, but the servers

#

server is also a client btw

#

is this because I do the linetracing server side only?

glacial pollen
#

no\

#

its because, you do mouse movements on the client

#

and you don't tell the server

past rain
#

this is what I use for the mouse movements

glacial pollen
#

That is meaning less

#

Where are your auth checks?

#

Where is the RPC call to the server?

past rain
#

I thought that was done automatically when its the character

#

at least the WASD movements are

glacial pollen
#

Character Movement Component, has replication built in

#

AddControllerPicth input, is NOT a part of the CMC

past rain
#

You're right

#

so do I create custom functions, and in those functions, make sure we are the server, then call the AddControllerPitch functions?

glacial pollen
#

yes

past rain
#

Okay brb

glacial pollen
#

OnMouseMove :
If client : call serverMouseMove

ServerMouseMove: add pitch input

past rain
#

should I have pitch and yaw in one function

#

or 2 individual functions

glacial pollen
#

in one, because mouse input is basically ticked

#

no need to run the function twice, just pull from both events

past rain
#

If Im doing these functions myself, how will I get the Val (-1 to 1)

glacial pollen
past rain
sleek current
#

how can I check each projectile variable on collision?

glacial pollen
#

OnOverlap/Hit -> get actor -> Get variable

#

Thats basic blueprint stuff

#

@past rain Yes, that looks better

#

Cheating in blueprints, one function call, for both mouse inputs xD

past rain
#

I looked at how the pawn functions moves the mosue

#

and they do AddControllerPitchInput(Val);
AddControllerYawInput(Val);

#

adding those in didnt work for me though, cant move mouse

glacial pollen
#

Look for auth checks

past rain
#

is locally controlled?

glacial pollen
#

Also, make sure, that in char has UseController Pitch/yaw/roll enabled

#

default settings I think?

past rain
#

he only has use controller yaw

#

should I tick the pitch too?

#

enabled

glacial pollen
#

yea

#

I personally, have trouble, depending on what I am trying to do

#

you have to play around with those

#

Also, rotate controller != rotate actor, UNLESS use controller xyz is on

#

Also, rotate actor != rotate controller, if use controller is on!

#

Anyways, lunch is up. I gotta go. I might peek in later

past rain
#

please do ><

#

have a nice lunch

glacial pollen
#

Lol, lunch is over

#

I'm back at work ool

past rain
#

evo

#

just wanted to thank you for all the help so far ๐Ÿ˜„

#

So how tf did they replicate mouse movement

#

I dont think replicating mouse movement is the way to go, if we just locally linetrace from the client, and tell the server of that position

#

should work no?

past rain
#

@glacial pollen pls dont leave me ๐Ÿ˜„

past rain
#

I just checked, and the issue is that since the fire function is only run on the server, Hitlocation (the line trace) is run from the server perspective

#

Not from the clients

#

thats why all my shots go towards the servers crosshair

glacial pollen
#

Ahh

past rain
#

Yeah, When i shoot from my client, my hitlocation is that of the servers

glacial pollen
#

Well the issue is

#

You can't trust client

#

Line trace should happen in the server

#

Or people make aim bots

past rain
#

Okay so how do I get the clients starting location?

glacial pollen
#

?

past rain
#

A line trace has a start point and end point

#

Right?

glacial pollen
#

Actor-getlocation?

past rain
#

so I need the start point to be the client that is shootings position

#

but this is server side, and the server is a client too

#

so it wouldnt work

#

when a second client shoots

glacial pollen
#

Eh

#

I think the even listen servers treat their own player like a client?

past rain
#

yes

#

on a listen server, the server is one of the clients

glacial pollen
#

You miss my point

#

Server=player1, player2 right?

#

So

#

Auth, autonomous, simulated roles

#

EVEN THOUGH PLAYER1 IS THE SERVER

#

It's STILL AUTONOMOUS

#

AND AUTH

#

For player 1

#

At least how it should be

bitter oriole
#

On listen server the local player is authority

#

Not a client

past rain
#

theyr'e both client and server

#

as in, they are still playing

bitter oriole
#

The role of e.g; the pawn owned by the listen server will be authority on the listen server, rather than autonomous

past rain
#

I wish I knew what that means

#

Ive never heard of autonomous before

bitter oriole
#

You basically have three net roles for actors

#

Auth, autonomous and simulated

#

Auth = server

#

Autonomous = remote client for owning player

#

Simulated = remote client for non-owning player

#

If you have a listen server, the "server" owned pawn will be auth on server side, simulated on client ; the "remote" owned pawn will be auth on server, autonomous on client

past rain
#

That makes sense, so if Im doing the line tracing server-side, Im still not getting how I'd do it so that it uses the clients information

bitter oriole
#

Haven't followed the conversation before so feel free to refresh me ;P

past rain
#

Okay so

#

When player 2 shoots, the projectile goes to player1 (server) crosshair

#

The hitlocation of player 2, is the hitlocation of player 1

#

no matter where player 2's crosshair is

#

Does that make sense?

#

small video showing it

bitter oriole
#

Is it what you want, or what happens ?

#

What happens right ?

past rain
#

Thats what happens

#

I want each player to have their own hit location

#

This is my fire function

bitter oriole
#

Right, this is very much expected given the code.

#

Educated guess : GetCrosshairHitLocation uses the player controller (well, its HUD)

past rain
#

It does

bitter oriole
#

But on the server there's only one viewport, and that's the server's.

past rain
#

exactly

bitter oriole
#

So of course it aims there

#

The solution is easy : do the trace on client first, and send it over to the server

#

Your Fire() method would take a vector parameter

past rain
#

where would I calculate it client side? Fire is called from the player