#archived-networking

1 messages · Page 85 of 1

high night
#

just figure it out, thats your issue
(entity.IsOwner)

weak plinth
#

alr thanks man

high night
#

np

weak plinth
#

Hey, I'm using Mirror Networking, and so far I've managed to set up a simple scene where two players can move & it syncs very well. Note that it's my first time trying out implementing multiplayer.

Then, I added a pistol to the players and allowed them to shoot - in the script, I instantiate a bullet which goes to the right of the player, and there's a muzzle flash effect.

Problem
The instantiated bullet only shows on the "owner's" screen, i.e. only the player who shoots sees the bullet, the other player(s) do not. Same with the muzzle flash, it doesn't show up on the other client's screen when I do gameObject.SetActive...

I'd appreciate any help regarding that. If you think you know the solution to this, please add me so we can solve it through DMs where I can provide pics of my code and hierarchy. Thanks. 🙂

jade glacier
#

I would be sure to join the Mirror discord

weak plinth
#

I know I have to use NetworkServer.Spawn, but it's giving me an issue.

jade glacier
#

I wouldn't expect DMs for help

weak plinth
#

Oh, they have a Discord?

#

Thanks, I'll join it right now 😄

jade glacier
#

And you will need to post your code, or no one can guess what you are doing wrong. But that you are instantiating bullets already sounds suspect.

#

Bullets are events, not objects.

weak plinth
#

Nah, I'm making a 2D game and it actually instantiates a visible bullet object.

#

And the bullet has a set velocity to go right of the player until hit hits something or its "life time" runs out.

jade glacier
#

Then you will want to post you how you are serializing your "bullet" events

weak plinth
#

I'll ask around in the Mirror Discord.

#

Thanks. 🙂

jade glacier
#

NetworkServer is not active.

#

You are trying to perform an action that only the Server is allowed to do.

weak plinth
#

It'll be a stupid question, but, how do I activate it LMAO

#

It's my first time trying to make MP game.

jade glacier
#

You don't active at it. The server is is the server.

weak plinth
#

So I'm obv dumb here lol

jade glacier
#

All others are the clients

#

I would join their channel and do some tutorials.

#

You aren't really ready for this yet.

weak plinth
#

Alright, thanks.

#

I've watched a few tutorials, that's how I managed to set up the basic player movement sync.

serene fern
#

using, Tom Weiland's networking solution:

#

(No one's responded in 5 hours on their discord)

weak plinth
#

is GameManager.players a dictionary?

serene fern
#

yes

#

of int and PlayerManager

#

PlayerManager is a script all players have

weak plinth
#

is 0 a player ID or are you using it like an array index?

serene fern
#

the problem is

#

I don't know if the IDs start at 0 or 1

#

I've looked over the whole thing and cant find where things get added to the dictionary

#

nvm

#

ah

#

i see

#

nope nvm still lost

#

@weak plinth I was using it as a player ID

#

the thing is i tried it with both 0 and 1 and neither work

#

maybe the code is being called before the players get added?

weak plinth
#

I haven't used that networking solution before, but generally you don't hardcode player IDs into your code. is there are reason you're doing that?

serene fern
#

well right now im using that to debug

#

Since what I was trying to do is to have the client receive the colours of existing players when they join and have the gamemanager apply it to them

#

e.g, 2 players join, choose red and blue, then when another joins they receive "red, blue" essentially and the game manager sets players 1 and 2 as red and blue

#

but each time it said its not present in the dictionary

misty shale
#

Hey all, I’m looking for a backend solution to store my game’s inventory items centrally in a server. It would need to be authoritative and the inventory would need to be synchronized constantly between the client and server.

Any thoughts on what a good stack might be for this? I’m thinking of using ECS on the client so something that serializes to / from that would be ideal

#

Any libraries and backend services out there that I can piggyback off?

weak plinth
jade glacier
#

That isn't really a networking question as far as I can tell.

weak plinth
#

What about PhotonView ?

#

Where should I ask about this topic?

jade glacier
#

I can't make out the actual question. Pun2 is used for serialization of states and managing network entities. Your question seems more about cameras and creating your actual game.

weak plinth
#

Thank you! 👏

misty shale
#

Anyone have thoughts on my question above?

jade glacier
#

It's a bit much to unpack, so probably most people are avoiding it @misty shale

misty shale
#

Let’s start slow then 😄

What backend database providers are people using? And why?

jade glacier
#

PlayFab comes up often

livid onyx
#

so.. idk if this counts as a networking thing but, im working on a game and i wanna play live audio from a site i really like. ive tried a lot of things and nothing has worked- can anyone tell me how to use unitywebrequest to play live audio?

flint granite
#

Hey all, I’m looking for a backend solution to store my game’s inventory items centrally in a server. It would need to be authoritative and the inventory would need to be synchronized constantly between the client and server.

Any thoughts on what a good stack might be for this? I’m thinking of using ECS on the client so something that serializes to / from that would be ideal
@misty shale You shouldn't constantly be synchronizing your inventory with a main server, instead give a inventory in game to a player, a when he leaves the game, save the inventory to the server.

misty shale
#

@flint granite but using this model that would mean that I’d be awarding the items on the client which is not secure

flint granite
#

Alright

silver steeple
#

@livid onyx you need to launch your HTTP request in a coroutine, and instead of yielding to it's Run method, create a while loop that constantly checks the bytes downloaded from the Download Handler and pipes them to whatever audio thing your using

livid onyx
#

ah

#

so how do i do that-

livid onyx
#

oh- so

#

i have the statement

#
             {
                 Debug.Log(www.downloadProgress);
                 yield return new WaitForSeconds(.1f);
             }```
silver steeple
#

you wouldn't do wait for reconds. You'd just do yield return null to wait till the next update

#

also you need to be looking at www.downloadHandler.data

gleaming prawn
#

@misty shale the concept of authoritative game control and saving a player profiler (including inventory) after a match are treated separately

gleaming prawn
#
  • if you do not have server authority (game server), clients save inventory at the end
  • if you have server authority (which is the TOPIC in itself), this does NOT happen at the SAME server where DB/Profile is... ItÄs a different thing
#

In the later case, the gameplay server (authority) is the one who requests the player inventory (from wherever you saved it, like playfab or custom backends), and responsible for saving AT THE END of the match

#

As people said:

  • no constant saving to slow backends
  • save at the end (if from authoritative server source or another, it's a separate questions)
#

Treat your problems separately, then it's easy to maintain and handle

misty shale
#

Sure thing, so I’m thinking of using the ECS server model for authority, as seen in the FPS sample. This would mean that I’d then have to from that server persist the inventory.

Does playfab / gamesparks play nice with ECS?

slim ridge
#

doesnt look like playfab has the data solution you'd need. gamesparks does though

if i was doing it i'd pick the cloud provider i know how to use (gcloud) and choose a NoSQL solution that met my requirements.

gleaming prawn
#

@misty shale id stay Very Far away from anything dots unless your purpose is just studying

#

It's nowhere near minimally useable

misty shale
#

I am just using it for learning, yes

#

My project at the moment is just for fun

#

It’s a Diablo style click and loot thing but I don’t want to trust the client

jade glacier
#

That is a lot of new, broken and difficult to make work tech behind a development project.

#

If you are just learning, I would avoid anything resembling a real project, and just make small proof of concepts that you can throw out and finish in a week or two.

#

Because anything larger than that will turn into a multi-year time sinkhole that never gets finished.

misty shale
#

Sure thing! I guess I want to understand what the full pipeline would be so that I can better target my prototypes, which are individually contained learning experiments.

E.g. Prototype 1 - keep track of a player’s list of items on the client (done this currently using ECS)

Prototype 2 - ??? Very much depends on where I want to go long term

high night
#

@misty shale I guess you can deterministically sync the inventory (communicating only the changes in inventory)

#

Dont know how it would be done best in ecs though

jade glacier
#

For all DOTS ECS related stuff, best to ping the DOTS channel. Almost no one here uses Netcode or DOTS, but they do in that channel.

misty shale
#

If I wasn’t using DOTS how would you guys deterministically sync an inventory?

worldly mirage
#

Hi, I'm currently trying to stream a portion of my screen from OBS to VLC to Unity through the videoplayer. Does anyone have any experience with this?

jade glacier
#

communicating only the changes in inventory @misty shale

#

All deterministic means is that the same operation will have the same results on all clients/architectures

misty shale
#

@jade glacier how I have approached this previously is through time stamps. Pull down all entities (probably in json format) for any entities that have changed since the time stamp of the last call to the webservice

#

I was going to manually call this operation after key in game interactions where items could have changed on the server and also every x minutes on a timer

teal timber
#

Can anyone help when i am trying to request data from a website for my highscore table i get a error saying request made more than once in a second i've looked through my code and the Coroutine is only ever called once it works fine when i begin playing the game i only get the error when player dies and it loads back to the main menu where the highscore table is

teal timber
#

fixed now

misty shale
#

What was the problem out of interest?

teal timber
#

Kept getting request made more than once in a second new to downloading and uploading data from a website

#

@misty shale I'm also using WWW instead on unitywebrequest because of old tutorial that I followed

jade glacier
#

I would join the Bolt Discord if you haven't. More Bolt users in there than in general. @weak plinth

weak plinth
#

Hey guys i made a test project for photon pun 2 and the movement of the players keep lagging/glitching does anyone know why?

jade glacier
#

Typically that means you haven't disabled your controller code where ismine == false

weak plinth
#

this is the tutorial yes?

somber drum
#

Trying to pin this graph down, I'm fresh enough to take my time with coding something running on the network, but graphs are something else.
Would anyone care to comment if this logic pans out?

Run the movement on the server, animations on the client

#

That's the way to go right? I'd imagine then just syncing the variables from the server, to the client when needed like for combat etc

weak plinth
#

Nobody can read that

#

unless u have a magnifying glass

#

nvm

jade glacier
#

Not readable even magnified.

#

Though that kind of layout suggests a wrong and overcomplicated thinking.

#

All networking is just input and state buffer replication.

past garnet
#

which network solution u use guys?

weak plinth
#

testing out photon pun 2 atm

#

since bolt is acting kinda gay

#

is there a way i can see my ping in game on pun 2?

serene fog
#

So what you guys prefer for networked Coop Game in Unity? I need some Info on this matter because I come from a UE4 background and in UE4 the out of box UnrealNetFrame work has Client Server Architecture and it works well 99% of time unless you are making a mmo. what do you guys use and if someone is the user of both UE4 and Unity which one you prefer?

prime beacon
#

Unity's built-in networking sucks atm

#

most popular networking libraries are mirror/mlapi/photon

hardy citrus
#

How do you guys initialize canvas panels when starting game in multiplayer?
Like loading the inventory panel,
The spawned player have no idea of server things, so i use FindGameObjectByTag, but it seems kind of wrong.. Any ideas?

shut yarrow
#

I think your question is kind of vague, but for as far I can understand what you want to do, you have to send the client whatever inventory is available to him and then initialize it on the client

#

How you go about finding the canvas on the client has nothing to do with multiplayer really, so you can either use FindGameObjectByTag or whatever other mechanism you can think of to get a reference to a canvas

hardy citrus
#

But is that the right way to to, or is the "standard" an individual canvas that spawns with the player prefab?

shut yarrow
#

There is no standard really, it is completely arbitrary. However, using GameObject.Find functions are generally frowned upon because they are slow, and usually there is no need to use them if you can already set a reference through the inspector

#

Ultimately, it doesn't matter too much if you only set the reference once like in Awake/Start

#

Sorry didn't read your last question but the answer is similar. There is no standard really, but usually there is little need to spawn each player with its own canvas because only the local player needs to have one

#

For example players in my game have a nametag above their character, and I'm using a single canvas for all of them

#

Using multiple would seem like more straightforward but I don't find this to be any more difficult to use a single canvas, and it also has less overhead because typically a canvas has quite a few elements in its hierarchy

#

But I wouldn't worry too much about this though, just do whatever you feel most comfortable with, and only try to fix things if you notice there is a problem

hardy citrus
#

Thanks!

#

Does anyone release games with standard UNET? Does it meet todays requirements or do i need MLAPI, Mirror or something?

slim ridge
#

mirror/pun2

sleek laurel
#

how can i play a sound using photon pun

#

@slim ridge

#

do u know

gleaming prawn
#

you play a sound with Unity

#

What you do is fire something like an RPC or so

prime beacon
#

RPC or RaiseEvent I'd say

gleaming prawn
#

To trigger the sound in each machine

sleek laurel
#

k how do i do that

#

i want to play a sound when i press space

gleaming prawn
#

Do you know how to play a sound when you press space on Unity (not with PUN)?

sleek laurel
#

yes

gleaming prawn
#

So, just create an RPC (read the docs about it) and call THAT instead of your function that would play the sound

#

The RPC will trigger the sound in all machines.

sleek laurel
#

can i have rpc docs

gleaming prawn
#

RPC = remote procedure call (fancy name for: calling a function on this object in all machines)

sleek laurel
#

uhhh

#

i still have no idea what im doing

gleaming prawn
#

you should check the basic tutorials

#

I'm sure there's a section on RPC

#

This is the very basic bread and butter of PUN: serialization + RPCs

prime beacon
#

follow this

sleek laurel
#

@gleaming prawn

#

also do i need to keep putting photonview.ismine in every void

#

@prime beacon

gleaming prawn
#

you should NOT check for Keypress on the RPC

#

YOu check for keypress, THEN call the RPC

sleek laurel
#

oh ok

gleaming prawn
#

What you are doing makes no sense at all

#

Please, try to follow basic tutorials

#

check for keypress BEFORE you call Honk

sleek laurel
gleaming prawn
#

remove that isMine from last function

sleek laurel
#

k

gleaming prawn
#

Please do NOT flag me

#

YOu REALLY need to read and follow very basic tutorials

sleek laurel
#

k

#

i tried

#

i was confused so i came here

gleaming prawn
#

try again

#

These are very basic programming mistakes

sleek laurel
#

well i am new to networking

#

its still not working

#

uh

#

u there?

#

@gleaming prawn

#

...

#

@prime beacon

gleaming prawn
#

Please, do not flag

sleek laurel
#

sorry

gleaming prawn
#

Try to read more tutorials, we won't write the code.

sleek laurel
#

you didnt respond

gleaming prawn
#

Sorry, that's it

sleek laurel
#

i am trying i cant find anything

#

also i dont think it would hurt to point out what im doing wrong

gleaming prawn
#

I pointed you to try to learn what you are doing that's the only advice.

#

Have a nice one, going to sleep here.

sleek laurel
#

what am i doing wrong

#

ugh

#

i have no idea what it is

#

well thanks for "helping" me

#

because all i know now is how to move 2 lines of code

#

anyone?

prime beacon
#

remove ismine check from your RPC

sleek laurel
#

i did that

prime beacon
#

and add Debug into your RPC to see if it fire

sleek laurel
prime beacon
#

and you should really follow tutorials

sleek laurel
#

i have tried but i cant find any

#

as i have said multiple times by now

prime beacon
#

finish this

sleek laurel
#

i dont see anything to do with my issue

prime beacon
#

...

mild salmon
#

where is honk() being called

sleek laurel
#

yes

#

what about it @mild salmon

mild salmon
#

did you honk() in update?

sleek laurel
#

ohhhh

#

wait

#

yeah

#

i see now

#

i am really stupid

mild salmon
#

aren't we all

sleek laurel
#

it works

#

XD

#

thx so much

mild salmon
#

np

somber oxide
torn ermine
#

this is for multiplayer right?

#

this channel

somber drum
#

thanks for those who commented under my graph,
my intention was not for someone to read the graph, but to see where I primitively described it's function using bold text and large boxes.
While it may seem like I'm overcomplicating it which is likely, the actual function of the graph serves more than movement and combat, such as cover, reinforcement, and even a mission he can choose to go on if certain parameters are met.

this for example, from the division looks pretty "overcomplicated" but it all serves a purpose haha

#

so to clarify my original question, when doing network AI it's a good idea to run the logic on the Server, and the Animations on the client- right?

#

@torn ermine yep

torn ermine
#

oh thanks

weak plinth
#

how can i see my ping while playing my game in pun 2?

somber drum
#

PhotonNetwork.networkingPeer.RoundTripTime maybe that's too dated though @weak plinth

weak plinth
#

alr ill try it

ruby bolt
#

Is there a way I can spawn an object from the server on a single client? Something like NetworkServer.Spawn() but, well, for a specific client.

weak plinth
#

in the docs it says "static int GetPing()" but how do i use it? @somber drum

sinful smelt
#

Hello! I trying to use mirror(for a multiplayer game) but i want to instantiate a different player prefab for the second player. This is the code:

        {
            Transform startPos = GetStartPosition();
            GameObject player = startPos != null
                ? Instantiate(playerPrefab, startPos.position, startPos.rotation)
                : Instantiate(playerPrefab);

            NetworkServer.AddPlayerForConnection(conn, player);
        }```
somber drum
#

@ruby bolt TargetRPC?

#

you can spawn something on the network.spawn but it doesn't have to sync to everyone

#

in fact, maybe this is me being naive with network stuff but if just the client needs to know it exists, almost doesn't even need to be called on the server no ?

#

@sinful smelt you could use the registered spawnables and leave the playerPrefab blank
spawnPrefabs

#

how you choose which spawnable prefab is up to you

#

up to the player on login / random etc

sinful smelt
#

and how can i use registered spawnables?

somber drum
#

for example the player chooses a prefab from the list, a drop down w/e
then call it on the server
Player player = CreateCharacter(chosenPlayerClasses[classIndex], name, account);
if that makes sense

#

PlayerClass player = Instantiate(classPrefab).GetComponent<PlayerClass>();

#

since you're doing this from the network manager it's available for you to choose though

sinful smelt
#

and where should i put this lines ?

somber drum
#

totally up to you how you go about it

#

you would be taking the NetworkConnection and listening to it's selection in a custom method, then in another creating it when player has authority @sinful smelt

sinful smelt
#

but how can i make the host to get the first player and the client to get the second player ?

somber drum
#

while inside the available players to choose from, the first character chooses x, x goes x++, second player joins, he gets the next in line would be my suggestion

sinful smelt
#
        {
            Transform startPos = GetStartPosition();
           
if(x<0){
GameObject player = startPos != null
                ? Instantiate(playerPrefab, startPos.position, startPos.rotation)
                : Instantiate(playerPrefab);

            NetworkServer.AddPlayerForConnection(conn, player);
x++;
} else {
            GameObject player2 = startPos != null

? Instantiate(playerPrefab2, startPos.position, startPos.rotation)
                : Instantiate(playerPrefab2);

            NetworkServer.AddPlayerForConnection(conn, player2);
        }```
#

like this @somber drum ?

somber drum
#

I'm a week into mirror I couldn't tell what's wrong with this as long as it's being registered on the server, but x won't be less than 0 if that's your starting place js

#

trial and error man! that's what I've been scraping by on haha, google is a lot of help as well

sinful smelt
#

Ik but i didnt find anything useful

somber drum
#

I believe the tanks example provides a showcase of multiple prefab selection @sinful smelt have you gone through any of those?

sinful smelt
#

Nope

somber drum
#

maybe I'm thinking of a plugin, I would check those demo's out though regardless

sinful smelt
#

I saw the pong one

#

Ok ty :D

somber drum
#

sorry I couldn't give the exact answer, probably more confusing than helpful lol. good luck with it!

sinful smelt
#

No problem

somber drum
#

@weak plinth Have you figured the ping thing out already? I don't use photon but I've read this somewhere;

public override void Reset()
        {
            ping = null;
            
        }

        public override void OnEnter()
        {
            DoGetPing();
            Finish();
        }

        void DoGetPing()
        {

            ping.Value = PhotonNetwork.GetPing ();
            pingString.Value = ping.Value.ToString();

        }
#

my msg was deleted sorry for the double ping lol

weak plinth
#

i thought i was tripping

#

no i didnt im kinda retarded so i was just stuck there staring st my screen

somber drum
#

lol hopefully that works for ya now, good luck with the project

#

I had wondered this at some point as well

weak plinth
#

thanks man!

#

it says ur a content creator whats ur channel?

somber drum
#

I'm not uploading as of late, I should probably change it out lol

#

used to stream if that even counts

weak plinth
#

i still wanna sub

somber drum
#

nothing uploaded atm it was all live stuff, probably not even qualified I'm a fraud 😬

weak plinth
#

lmfao

#

i used to make vids when i was like 10 and half of them got taken down for copyright

#

i wasnt smart

somber drum
#

tough life out there on youtube lol, I would change my tag if I knew how 😆

weak plinth
#

i think in settings

somber drum
#

yea if you check out bot commands you'll see me fail, I'll figure it out

weak plinth
#

you did it

#

congrats!

oak flower
#

@weak plinth Please don't use ableist slurs.

weak plinth
#

it didnt work because im not smart @somber drum

#

@oak flower sorry

somber drum
#

@weak plinth what kind of errors u getting?

#

post was from 2015 might be different api

#

GetPing is still a thing tho

weak plinth
#

ping does not exist in this current context and OnEnter, reset are not something for override

#

im trying something else

#

with the GetPing

#

it worked

#

it also broke my game

#

but it worked

somber drum
#

oh well yea you need to establish the string and ping int

        public Int ping;
        public String pingString;
#

oh ok

#

OnEnter is a separate thing probably, so you'd do your own method for calling the ping like when someone joins the lobby etc- glad it worked

weak plinth
#

but how can i make it constantly do that?

#

for now it just says 87 twice then stops

somber drum
#

@weak plinth Invoke in update? so it's not running constantly but still has decent estimation

#

maybe that's not a thing and you want to base it off NetworkTime idk sorry man lol

#

totally guessing

weak plinth
#

same here

#

alr thanks anyways

#

have a nice day

somber drum
#

u2

weak plinth
#

yooo i think its bcs it changes scenes

#

im not sure

#

cause while i was loading in it showed my ping

#

yeah it worked i did it @somber drum im officially built different

somber drum
#

hell ye congrats

weak plinth
#

hey guys does anyone know how i can fix stuttery/laggy movement in pun2 i alr use OnPhotonSerializeView() and transfrom view classic but its still stuttering any ideas?

grizzled narwhal
#

Read the gaffer on games networking tutorials. They are great.

weak plinth
#

gaffer on games?

grizzled narwhal
weak plinth
#

im pretty sure they dont use photon

gleaming prawn
#

That is not the question

#

They explain the REASONS and the techniques

weak plinth
#

oh alr

gleaming prawn
#

We from Photon read a lot of stuff to implement these things, and that blog is one of them

#

It's not a bad reference... It's very good.

#

Although he does not need to be right in every single thing

weak plinth
#

so which article should i go to for lag compensation?

gleaming prawn
#

I'm biased, I always think you need to understand things to be able to reason why stuff behave like they do

#

So I never point specific articles, unless you have a very very specific question (which only comes when you have experience)

#

Your question is very generic, so read as much as possible

weak plinth
#

alr thanks

gleaming prawn
#

First:

  • laggy is different than stuttery, these are different things
weak plinth
#

well its stuttery

gleaming prawn
#

I'm not sure which one you have

weak plinth
#

the player keeps jumping into a new position

#

its not smooth at all

gleaming prawn
#

Stuttery normally means you need to interpolate more, because your sync frequency is not fast enough

#

Again, this is ASSUMING you are sending state (like PUN2 does)

#

As there are other techniques

weak plinth
#

my send rate is at 30

gleaming prawn
#

its not smooth at all
So it just looks like you are not interpolating

#

my send rate is at 30
That's high actually

#

It will not help just making it higher

#

You need interpolation

weak plinth
#

every other interpolating option makes the character fly to jupitor

#

and lag like crazy

gleaming prawn
#

But I believe other people have been giving you advice

#

and lag like crazy
Interpolation IS lag

weak plinth
#

i dont think so i probably slept through them

gleaming prawn
#

I think you are failing to understand that lag EXISTS, it's because the data is limited by the speed of the transmission

weak plinth
#

so im basically just stuck like this?

#

idk im not smart

gleaming prawn
#

What you normally do is:

  • interpolate to smooth jitterness
  • (optional) extrapolate to HIDE lag
#

But I've seen you nick before, I'm sure a lot of people have been giving you advice already

#

Please, take everything into consideration, read a bit more

weak plinth
#

alr thanks man

gleaming prawn
#

If you want to hide interpolation lag, you need to understand a lot more

jade glacier
#

You might want to also grab a screen cap app like shareX, so you can capture short videos of what you are seeing, since it is easy to mix up the terms used to describe the issue.

#

And please don't crosspost your questons @weak plinth They end up getting answered in two places, and they litter up discord. Just ask in one place.

weak plinth
#

alr sorry

jade glacier
#

The most likely issue you are describing is what I addressed in the other channel, which is you controller code not being disabled based on ismine. Once that is sorted, you can move on to other improvements.

weak plinth
#

i did disable it

jade glacier
#

I would pick up ShareX and set that up. Easier to post videos of lag/hitching behavior than try to explain what you are seeing.

weak plinth
#

what abt obs?

#

does that work?

jade glacier
#

obs?

weak plinth
#

obs studio

jade glacier
#

No idea

#

if you can cap video and post it, then sure

weak plinth
#

alr

#

@jade glacier

jade glacier
#

That looks uninterpolated. How are you syncing?

weak plinth
#

transform view classic

jade glacier
#

Does TransformView produce a smoother result?

weak plinth
#

not at all

#

they start flying

#

witchcraft

jade glacier
#

Then there is some other code still affecting that transform it sounds like

#

nothing exotic should happen. Do these players have the ground as a parent? Or are they unparented?

weak plinth
#

unparented

jade glacier
#

If you are just moving your transform, the build in transform views should be getting smoother results than that.

#

Can you post your movement code into a bin?

gleaming prawn
#

Can you post your movement code into a bin?
Do you realize this is "expert" jargon Mr D?

jade glacier
#

Gotta learn it sometime 🙂

stiff ridge
#

That is "expert" level? Huh. Easier than I thought.

gleaming prawn
#

Lol... Expert means understand at least 90% of the specialized jargon... That is just one...:)

abstract wasp
#

can someone help me?

#

i am having an issue with my networking

#

the other client is moving with my mouse position

jade glacier
#

Be sure to include which networking library, and relevant code. Likely the same issue as discussed above. You are not disabling your controller code on non-controlling clients. @abstract wasp

abstract wasp
#

i am using photon engine

#

photon multiplayer

jade glacier
#

Pun2 I assume you mean

#

Be sure to disable all controller code using IsMine

#

And complete the basics tutorial before trying to do anything of your own.

abstract wasp
#

yes Pun2

#

i saw many tutorials

jade glacier
#

Seeing and doing are not the same though.

#

Complete the tutorial, or you will burn hundreds of hours trying to guess your way through this stuff.

abstract wasp
#

i cant find any tutorials about mouse position rotation in multiplayer

stiff ridge
#

The problem is not the mouse position. It's more about control.

abstract wasp
#

then what do i do to fix it?

stiff ridge
jade glacier
#

disable controllers based on IsMine

abstract wasp
#

i did it but ill try again

#

i can send you the script

#

send a photo

stiff ridge
#

i sent you working code.

#

you really need to learn to debug this, cause there is not always someone to send your code to.
you need to check which scripts run, which of those affects a character and why. when input is applied, where it's sent.

#

this is sadly essential.

#

it's getting late here. i'm off. hope you fix this asap.

abstract wasp
#

i am using photonView.IsMine but the other client keeps rotating

jade glacier
#

paste your controller code in a bin if you would

abstract wasp
#

i will send a photon of my script

#

photo*

jade glacier
#

please use a bin

abstract wasp
#

do i send a photon or the code from hatebin?

jade glacier
#

paste your code into hatebin... save it, and post the link here

abstract wasp
#

also i found the code from google because i was having another network issue

jade glacier
#

at a glance this set of code should be restricting inputs correctly. There are no other scripts on the object in question that can affect movement? And what are you using to sync rotation?

abstract wasp
#

to sync rotation i am using photon transform view

#

there are no other scripts for movement

jade glacier
#

Which line of code in this bit is where you are applying mouse input?

abstract wasp
#

at the function GetPlayerRotation

jade glacier
#

120ish, I see it now

#

And the problem you are having is that this rotation is happening for both player objects?

abstract wasp
#

both players are rotation

jade glacier
#

How are you instantiating these player objects? You are sure they don't both belong to the same client?

abstract wasp
#

rotating*

#

i am using this script for spawning players

jade glacier
#

If this is the only code that is affecting rotation, and it is happening on both - that indicates both are owned by the same client. What happens when you move the mouse on the other client?

abstract wasp
#

all clients are rotating on both mouse positions

#

on every mouse position

jade glacier
#

Something is in play then that I am not seeing here. If you remove the sync what happens?

abstract wasp
#

if remove it the players are not updating the position and rotation in the server

jade glacier
#

There is no server, you mean the master?

abstract wasp
#

yes

jade glacier
#

Without the sync, both objects rotate on the second player when they move the mouse... but they do not rotate on the Player 1 (Master) when Player 1 moves their mouse?

#

What is targetObject? That looks suspect

abstract wasp
#

the object that they are looking to rate

#

rotate*

jade glacier
#

You have an instantiated object instantiating another object.

#

Without getting too deep into your code (I am working so I can't really do work on your project) - that looks like a suspicious thing.

abstract wasp
#

ill try to fix it with photonView

#

ill tell you if it didnt work

jade glacier
#

Not sure what "it" is you are doing. But you seem to have some needless complexity going on here.

#

I would step back and simplify what you are trying to do, rather than getting to far down the path of trying to fix this.

abstract wasp
#

english is not my first language

jade glacier
#

No problem. But rethink the complexity of what you are doing here.

#

This can likely be done in a very simple way.

abstract wasp
#

which is?

jade glacier
#

You have a second instantiated network object. That likely is not needed.

abstract wasp
#

the one object is not instantiated on the other player's screen

#

because it doesnt instantiates on the master server

jade glacier
#

I'm completely lost there. Regardless. That looks suspect.

abstract wasp
#

can you send a tutorial or something?

jade glacier
#

Nope sorry. I am working. I can only give general help.

abstract wasp
#

ok

jade glacier
#

There is something fishy about your use of that target object is all I can say.

#

Someone else might have an opinion, so you can post any questions or code you want here.

#

I am not the only person in the channel, others might have time and knowledge.

abstract wasp
#

emotitro are you still on?

#

@jade glacier

jade glacier
#

I am around

abstract wasp
#

i have changed the script

jade glacier
#

Does it work?

abstract wasp
#

no but i will send it so you can see it

jade glacier
#

Looks cleaner. What is breaking?

abstract wasp
#

line from 96 to 102

#

the player rotates but both players are rotating

jade glacier
#

No idea where you are going wrong. If you have debugged that this script is only firing on the owned object, then there is something else going on.

abstract wasp
#

i think i need to change something in line 113

jade glacier
#

Stick a ```Debug.LogError(photonView.ViewId)```` into your IsMine == true code and make sure everyrone has proper ownership of just their object.

abstract wasp
#

what do i need to change in line 113?

#

return; doesnt work

jade glacier
#

I can't get into that level of help - I honestly am working right now. I can't help everyone in these channels code. I can only answer questions about Pun2 and Simple.

#

Make sure ismine is giving the values you expect... if so - debug your code.

#

If not, find out why your ownership isn't as expected.

abstract wasp
#

both players have different ViewID

jade glacier
#

They both own their correct object?

abstract wasp
#

no

jade glacier
#

Then something is off with your instantiation handling.

abstract wasp
#

It doesn't instantiate anything, i deleted that line.

jade glacier
#

Debug.LogError(photonView.IsMine + " " + photonView.OwnerActorNr);

#

Stick that line inside of your fixed or update and see who owns what.

#

How are you not instantiating?

#

You have two players, how do they come to exist?

#

How are you instantiating your PLAYER objects?

#

If done correctly, each Actor will own ONE object.

abstract wasp
#

I mean that the players are not instantiate anything

#

The manager instantiates the players

jade glacier
#

Debug.LogError(photonView.IsMine + " " + photonView.OwnerActorNr);

What does this produce in your log?

abstract wasp
#

both players have true photonView.IsMine

jade glacier
#

What does that produce in the log?

abstract wasp
#

Error

jade glacier
#

...

abstract wasp
#

what do you mean?

jade glacier
#

WHAT DOES THE LOG SAY....

abstract wasp
#

True 1

jade glacier
#

every time?

abstract wasp
#

and True on other client

#

True 2

#

yes

jade glacier
#

Where did you place it?

#

inside of the ismine check, or outside of it?

abstract wasp
#

inside

jade glacier
#

So is mine is working correctly. You have some code somewhere that is not checking it correctly, or there is a bug somewhere in the code you showed me.

#

The ownership is correct

abstract wasp
jade glacier
#
        {
            transform.LookAt(new Vector3(0, 0, 0));
        }``` why does that exist at all?
#

That is controller code

abstract wasp
#

to prevent the second player to looking to the other player's mouse position

jade glacier
#

Does that make sense to you?

abstract wasp
#

no

jade glacier
#

Then why is it there?

abstract wasp
#

because i dont know what to put in there so it can be fixed

jade glacier
#

You do nothing there. If you are the owner of the object you move it. If not... YOU DO NOTHING.

abstract wasp
#

but the problem still occurs

jade glacier
#

I don't know where your error is, but it really feels like you are doing trial and error on all of this, rather than following a working example.

#

IsMine is working correctly. So you have to debug your code. No one else can do that for you.

#

I need to get back to work. Best of luck.

abstract wasp
#

i noticed that the mouse of the first player is moving based on the movement of the second player

#

emotitron i think i know why it happens

jade glacier
#

excellent

abstract wasp
#

its happening because the mouse moves but it cant stay in the same position on the other client because I move it

#

on the computer

#

because im testing it in 1 computer

jade glacier
#

That would do it.

abstract wasp
#

Thanks for the help!

jade glacier
#

Glad you found it

terse relic
#

how to use multi aim constraint with photon. trying to create a realistic looking fps/tps

jade glacier
#

Not familiar with that term @terse relic

terse relic
#

its a unity 2019.4 function

#

its basically built in ik

#

but restricted

jade glacier
#

with all IK, you either serialize out the IK target and let it solve remotely, or you serialize out the joint rotations.

#

I am not sure what that multi-aim thing does that is unique, but I would assume it still comes down to that same thing.

gleaming prawn
#

If I got it just from the terms meanings, it resolves with constraints to avoid weird positioning of the aiming hand and arm, etc...
So it's:

  • visuals
  • exact source of the shot (visuals mostly, but could also be the offset of the projectile source for the tick raycasts)
#

With that in mind, I'm sure that syncing just the aim DIRECTION and letting the solver work for the visuals locally on each client should be the way to go.

#

From the original QUESTION:

#

trying to create a realistic looking fps/tps
Emphasis added by me...:)

smoky lagoon
#

Hey Guys, i'm curious if some advanced programmer would have mercy to explain (in detail, with code snippets) how exactly 'client prediction', 'server reconciliation' and 'entity interpolation' works... i just can't get my head around it, i followed all tutorials and blog post i could find, such as this: https://www.gabrielgambetta.com/client-server-game-architecture.html
but it's still a big question mark. I'm developing kind of an RPG/FPS mix, so far i have my server set up, handling tcp & udp... players can connect and watch each other moving around.
I wrote some code to simulate latency & jitter to test client prediction etc... i just can't get it to work

gleaming prawn
#

1 - you need the simulation to be tick-based (in that the update frequency is controlled by server, using a synced clock somehow - however you want)
2 - movement is done with a "command". Client sends command to server (attached to tick) and stores it in a local buffer;
3 - server directly applies commands when they arrive (and the POSITION computed by server is sent down)
4 - when client receives confirmations, they come with the corresponding tick-command number... So you correct the client character position to the fixed one... RE-apply ALL commands AFTER that on from the local buffer (to predict again.

#

add interpolations on top of everything... play with it until it's good...:)

#

Something in these lines...

#

Notice I'm not describing the SECOND thing you normally do with this type or arch, which is lag-compensated raycasts (favor the shooter) on the server side (which also requires a position buffer for all moving shootable things on SERVER, etc)

#

That's what done automatically with netcode tools like Photon Bolt, new Unity dots netcode, Unreal Networking, Source Networking (CS), etc...

#

NOT handled by tools that normally only work on the transport-data-around level, like Mirror, MLAPI, PUN2, etc

#

Notice Gabriel also describes lag compensation...:)

#

Does not look like a bad reference BTW (I have not dealt with it before - as I do not work with this type of architecture normally), looks nice...

#

As for code snippet, NO...:)

smoky lagoon
#

yea thx for nothing

gleaming prawn
#

I can delete everything if you are pissed

smoky lagoon
#

yes pls

gleaming prawn
#

Or you can pay someone for code..::)

#

I don't know how you want code snippets if you are writing your OWN code

#

Code snippets work for specific libraries...

smoky lagoon
#

i dont know why you think summarizing a whole block post in 4 steps would help me understand topic...

gleaming prawn
#

But from your attitude I see it's useless, so I'm done... Have a nice day.

#

i dont know why you think summarizing a whole block post in 4 steps would help me understand topic...
I don't know how you want people to help you by being an ass***...:)

smoky lagoon
#

yea sure i am... i just said, i dont get it, could someone pls have mercy explain it in more detail... and you come along thinking well i'll roast this noob even more shwoing how easy it is in 4 steps

gleaming prawn
#

You could have followed up with a technical QUESTION of exactly WHAT is not working in your code, which is probably very close already

#

But not...:) So, sorry... Maybe someone else will do like you want...

jade glacier
#

No one seeing that hostile response to Erick's answer is likely going to want to help.

smoky lagoon
#

Wow. seems like everyone here be on one's high horse... "if you dont get it with this information, not my problem"...I particularly highlighted, that i tried to understand it with every resource i could possible find and i would like detailed information about the topic, but people come along like here is a 4 step guide, without any detail, figure it out.
And literally say "Code Snippets? naah"...
2 options here... 1. you didn't understand what i asked for, 2. you didnt care what i asked for...

And if i didn't provide enough information, the appropriate response would be "not enough information", but no, instead hacking in your first thoughts which dont provide any value to my question and calling me an ass**** because i'm not grateful

jade glacier
#

We are all working, so any help given here is a gift to the community. There is no high horse involved. All discord help is pure charity.

#

If you felt his answer missed the mark, rephrase the question, or disregard it. He isn't just posting it for you. All posts here are for ALL viewers... many who are silent and just read this discourse.

smoky lagoon
#

As for code snippet, NO...:)
But this is?

jade glacier
#

You are angry because he didn't want to write code for you?

smoky lagoon
#

i ask for something and "no" is a appropiate answer?

jade glacier
#

That is absurd.

#

Alright. You be you. I will be blocking you now.

smoky lagoon
#

👍

weak plinth
#

Erick's answer is pretty much the gist of what those systems are. If want like a good code example for lag compensation, check Unreal Tournament's github repo.

sleek laurel
#

how can i make name tags using photon pun

gleaming prawn
#

Can you be more specific @sleek laurel ? I did not quite understand exactly what you mean.

sleek laurel
#

like a name above the players head

gleaming prawn
#

If you mean little names over the characters, that's more like a Unity question... Is that it?

#

Hmm

#

So... Assuming the characters are Game Objects with a photon view

sleek laurel
#

yes

gleaming prawn
#

You have there the reference to the PhotonPlayer object that OWNS them... In all machines they will have the right PhotonPlayer object

#

So, from that photon player object, you have the Nickname property

sleek laurel
#

ok

gleaming prawn
#

Then it's just about how to write the UI code... Which is same as a local game

sleek laurel
#

how i do that

gleaming prawn
#

give me a minute

jade glacier
#

Where do you want to be pulling that players name from? @sleek laurel

#

Or UserId? Either way, those would be the things you probably want to look into as your source for the Player's name.

sleek laurel
#

k

gleaming prawn
jade glacier
#

photonView.Owner.NickName for example

gleaming prawn
#

with the nickname above and the UI stuff like the link I pasted, done

jade glacier
#

Actually putting it into your scene, as Erick says, is not a networking problem to solve. That is just basic unity for that part.

sleek laurel
#

uhhhh

#

@jade glacier im still confused about what i have to do

jade glacier
#

Which part?

#

Do you know how to make a name tag in single player?

sleek laurel
#

no

#

i dont

jade glacier
#

Then you REALLY should hold off on networking, and go complete some single players games.

#

I would not even think of trying to make a MP game until you are very comfortable with Unity.

#

Either way, this question you should ask in General programming channels, its not a Networking question - so you won't get much help here with that.

sleek laurel
#

?

#

idk something like that

jade glacier
#

You will not guess your way into networking happening with trial and error coding.

#

I don't know how else to answer this. You aren't even close to ready to take on multiplayer games if this stuff is hanging you up. You need to get comfortable with Unity before going down this path.

sleek laurel
#

well i know how to do movement and stuff

jade glacier
#

You are not ready for networking.

stiff ridge
#

If you really mean it. It covers a lot of the stuff.
Else, it may be best to do another singleplayer game.

jade glacier
#

That tutorial specifically deals with a name tag and health bars correct? @stiff ridge

stiff ridge
#

Yes.

sleek laurel
#

yesss

#

i think i know what to do now

#

i got it to work @jade glacier

jade glacier
#

Excellent

sleek laurel
#

by guessing

jade glacier
#

Your choice.

sleek laurel
#

now i just gotta test

jade glacier
#

Just things will take about 10x longer to complete

sleek laurel
#

yeah ik

#

:>

#

still worked tho

#

i have a question tho

#

@jade glacier

#

how can i make it face the camera

jade glacier
#

Still not a networking question. Are you in general? Ask those questions there. You will get far more answers.

sleek laurel
#

k

jade glacier
#

You can also Google that topic. It is very commonly asked.

full girder
#

is Mirror the best alternitive to Unet?

floral turtle
#

@full girder Unet is deprecated. Mirror is a community continuation of the UNET HLAPI

full girder
#

ok, so is it the best option, or is there other option?

floral turtle
#

Unity does not have many comprehensive networking packages that will handle all facets of it

full girder
#

thanks

#

dang it seems so confusing, with so many options. I might just stick with mirror. :/

floral turtle
#

what kind of game are you making?

full girder
#

a 4 person fps that is Player versus Enemy

floral turtle
#

note that Mirror doesn't provide any help with players getting set up together, stuff like PUN does

full girder
#

alright

#

i am not going to add the multiplayer quite yet, but I am going to soon

#

better to look at networking now than later

gleaming prawn
#

You are correct. If you'll add multiplayer, you START with that

#

"add later" is just a fallacy...

#

Multiplayer dictates how you implement the game logic... It's not about transporting and syncing data...

#

That forum thread is interesting, but very incomplete, as it does not even mention some of the most advanced solutions.

tall storm
#

Is photon the lastest thing that we use in unity multiplayer games? Is there a new sheriff in the town?

prime beacon
#

how good you are with networking? Photon products are probably most easiest one to get it working

#

if you want to host your own server and open source library Mirror and MLAPI are other options

tall storm
#

Ok thankyou very much my game is a small and i am just testing it so photon it is @prime beacon

prime beacon
#

yeah PUN/Bolt depending on your game

tall storm
#

Is there a game demo on git hub where i can find a project that is made like that

prime beacon
#

what you making?

#

they come with some demo scene

tall storm
#

Like a multiplayer setup where i am the teacher showing around something to other kids

#

Its like teaching a subject

#

To someone

prime beacon
ember thunder
#

uh, wut should i pick:

Mirror OR photon

jade glacier
#

They are different architectures and have different deployment models. You need to do the tutorials for each before you can decide which is right.

somber drum
#

Any downsides of using a behavior tree over the network? I've replaced my coded fsm and it just seems ridiculously easier- though I'm wondering at what cost

#

Ik it depends on some factors but in general

#

Maybe reducing branches getting updated constantly

jade glacier
#

Is that a visual scripting reference?

somber drum
#

Behavior trees is a ai graph, no dependencies like fsm

jade glacier
#

Ah, not enough experience in that area for me to comment. Others in here I know have dealt with AI behavior though.

#

anything with networking will come down to efficiency of serialization, and determinism though.

#

AI typically has determinism problems, so often when the system is not deterministic, you are going to end up sending states... which is spendy.

gleaming prawn
#

Behavior trees use more CPU in general (for their processing)

#

Than a well designed HFSM

#

At least they "encourage/let" AI designers to be less careful IMHO

#

We have both HFSM and BTs implemented for Quantum's Bot/AI SDK... @fleet harbor (the lead dev on those) was careful to check the references for the fastest possible approach to BTs, but I still expect that the HFSMs will be in average less costly...

#

In our case, neither incur in any networking changes (because quantum is determinsitic and we only exchange input).

#

In that sense, I think both would be a bit complex to replicate (although it could be ust signaling events like state changes or so)

#

in a classical network sense... IF necessary... If you have server, then normally no need to replicate the AI graph (whatever if FSM or BT) itself...

somber drum
#

understood, thanks for the information I think I was leaning towards it being a temporary solution as I flesh out the gameplay, really see where I can take this within limits then translate to a more efficient way of doing it down the road
this confirms it really I knew it couldn't be without a downside

fleet harbor
#

@gleaming prawn Exactly -- Behaviour Trees usually puts the control of too many things on the hands of the coder/designer, otherwise they wouldn't be able to be "creative" when coming up with new Decorators, Composites and Leaf nodes...
Stateful Behaviour Trees is very useful when optimizing the CPU usage, so it is a balance on "how many data can you afford to have saved on the frame data, for the BT nodes, to prevent the need of iterating over the tree to get the data needed"
So yeah, in average HFSMs will be less costly in comparison to BTs, but depends a lot on how much the BT is stateful and if the coder knows how to benefit from that

jade glacier
#

Serialization of these will be different though I assume? Unless your system is deterministic you are going to need to sort out synchronization.

trail parrot
#

Anyone i can bother for like 5 mins? Who's familiar with uhh, client authorized movement packets, but server validated (for speed hack) kinda thing?

jade glacier
#

Best to just put a question to the channel

night night
#

Is the networking same for Android as well?

#

I found a tutorial about how to set up a dedicated server, and I wonder if it works for Android as well, cause I wanna make a game for my friends

jade glacier
#

Which library and how have you set up hosting to work?

#

A dedicated server means a server is hosted by you. So in that case it would be the same for all platforms.

reef charm
weak plinth
#

Hey, how can I give a random player a tag like isEvil, isInnocent when he joins the game for Photon. Its like Among Us

jade glacier
#

I would think you could just have players randomly generate that when they instantiate their player object, and serialize that as part of the instantiation data. @weak plinth

weak plinth
#

@jade glacier do you have any example/documentation for that? Because i don‘t really understand what you mean

jade glacier
#

Have you completed the Basics Tutorial for Pun2?

trail parrot
#

So in the case that the player moves with CharaController, and then sends position packets to server (client authority move)
Then server validates it for speed check
(This is how an mmorpg template asset does it)

Should the server also simulate the player's CharaController before validating the move speed?

Bcoz i'm getting issues where if the player's moving against obstacles, there's desync and the server ends up behind (after simulating CC again on server's side), and then on next frame it thinks the player is moving too fast

Should the server just lerp the player through the move packets?

jade glacier
#

Typically you have to resimulate on the client when a desync occurs. Which means going back to the tick the server disagreed on, using the server state values, and reapplying the controller simulation for every tick that followed until current.

#

@trail parrot

#

What are you using for your reference on how to do server authority?

trail parrot
#

reapplying the controller simulation
This means, server also simulates the player through CC.Move ?

jade glacier
#

No, the server was the final word

#

It is on the client to get back into agreement

trail parrot
#

This is just how this asset is set up

jade glacier
#

If you are doing standard server authority - the server's word is the final word on states.

trail parrot
#

Ok so...

#

I'm currently trying to change the asset's default, which is Warp-ing when server detects an invalid speed + discarding all pending move packets of the player

jade glacier
#

No idea what your asset is or how it works, so can't comment on that sorry.

trail parrot
#
  1. I wanna not Warp to the last valid position, and instead ClampMagnitude that invalid speed to the max possible speed
  2. Not discard the pending move packet, instead edit the position of all remaining packets by the offset result of the clamp mag
#

Yeah...

#

It's uMMORPG CE btw, in case u know/tried it

#

From the creator of Mirror

#

Actually nvm this part

jade glacier
#

I am well aware of it yes

trail parrot
#

So all im asking is, if the client moves via CC.Move, and sending the resulting position updates

jade glacier
#

You will want to hit up the Mirror channel for help with that. Or whatever discord he recommends for support of that asset.

trail parrot
#

Can the server just not re-simulate CC.Move again? Can the server just lerp through the packets (or actually, just snap to the packet's position) ?

jade glacier
#

I have no idea how he chose to handle simulation. He doesn't do anything tick based, so I suspect you will have to do it how that asset wants you to do it.

#

Proper resimulation probably isn't possible.

trail parrot
#

What i mean by re-simulate is, the server does CC.Move again on that same player

jade glacier
#

That is not standard server auth model, so it really comes down to how he coded that to work.

#

The server should not be resimulating, that defeats the point of the server.

trail parrot
#

Yeah well, these kinda core changes will be very slow to be updated/fixed. So i'm asking around other place bcoz this is getting into some "general mmo" techniques

#

The server should not be resimulating, that defeats the point of the server.
So this is what i mean. I'll try to do a step by step of what i think should be happening:

jade glacier
#

You probably are right, the question seems to be more how to modify his asset to behave more normally - which I can't speak to since I make a point of not knowing the details of that asset.

#

Best to ask that in a discord with other MMOXXX or Mirror users who may have some experience with that library.

#

Are you going for a client auth movement model? With server validation?

trail parrot
#
  1. Client press W (forward)
  2. In client, the chara moves with CC.Move
  3. This client moves from 0,0 to 0,1
  4. Client sends move packet (positions: 0,1)
  5. Server receives it
  6. Server first check if his previous position packet (0,0) into this new packet (0,1) is within valid speed
  7. If invalid, then do some resync attempt for the client to do (more on this later)
  8. If valid, server simply moves this client to 0,1, then broadcast this new position packet to other players

So, #6 and #8 is all there is to it right?
Bcoz in uM's case, #8 is actually doing a CC.Move with a move vector of 0,1, and THEN checks the resulting position after it, which may be different

jade glacier
#

Client sends move packet (positions: 0,1)
So the client sends the input or the state?

trail parrot
#

His network movement is pretty general (network API wise), so i feel it's alright to ask here/other places

#

Client sends position state

jade glacier
#

I assume state, because input requires a proper tick system, which I don't think MMO makes any use of.

#

So this is client auth movement, with server validation. Ok

trail parrot
#

Yep

jade glacier
#

Same rules still, server replicates its validated position out to others, not the clients state state.

#

The player should detect that the server returned a different value than it gave it... triggering your client resimulation

#

The server is still the final word, and it doesn't ever retest or resim.

#

Once it dictates a state, that is the law.

trail parrot
#

The player should detect that the server returned a different value than it gave it... triggering your client resimulation
Ok, this is in the case of an invalid state

But specifically about step #8, the server re-do ing CC.Move towards state (0,1) is pointless, right?

jade glacier
#

No idea how his controllers work

#

if that is how you "set" a state then that should be fine.

trail parrot
#

Unless this is for like further cheat detection or whatever

jade glacier
#

No idea what else happens with .Move()

trail parrot
#

Lets say his CC is like standard Unity CC

jade glacier
#

As long as the state gets applied, that is fine.

#

But that is not a resimulation

#

resimulation means rewinding to a previous state and reapplying inputs.

trail parrot
#

Yeah, i shouldn't have used the term resimulate..

jade glacier
#

If .Move is just setting the state, then that is fine.

trail parrot
#

I meant literally, re-doing CC.Move for that frame's movement process

#

Well, no

jade glacier
#

re-doing still implies a resim

#

But in this case it isn't a sim

trail parrot
#

re-doing still implies a resim
Eep

jade glacier
#

just check the incoming vector value for validity

#

Clamp it as needed, and apply that.

trail parrot
#

Here's the thing, if there is a slight discrepancy between client and server, then the result of the server's CC.Move might make the chara land in a slightly different position. It may call CC.Move(0,1), but it may not land to that state (0,1)

jade glacier
#

That model kind of sucks yeah

trail parrot
#

What's happening in my case (and many others), is, server doing CC.Move towards (0,1) ends up making the chara land in (0, 0.8)

#

And then, next packet, which is (0,2) (from the client), the server will do CC.Move from (0, 0.8) towards (0, 2), which means 1.2 move vector,

#

And then server complains that 1.2 is invalid speed

jade glacier
#

What is causing it to come up with different values? Fixed vs Update timing?

trail parrot
#

Wait

#

Happens when client moves along/on/off walls

jade glacier
#

Having seen Vis's code in the past, I would guess that the handling is wildly not deterministic, and that the movement exists in both Update and FixedUpdate

trail parrot
#

I really doubt CC.Move (or any kinda CharaController's) done in server/client can be 100% deterministic. Hence a slight timing of when the client thinks it's not bumping on the wall anymore, will be off for the server

#

The movement is fully in Fixed, it's fine

jade glacier
#

It can't be, which is why you have to code it to not be frame dependent and to not rely on determinism.

trail parrot
#

I dont think his CC is the problem

#

I think the fact that server has to call CC.Move again to "re-test" the new state packet, is the problem

#

I think that step is unnecessary

jade glacier
#

What is in the guts of CC.Move?

trail parrot
#

Hmm, 2 sets of move with collider cast checks. 1 horizontal, 1 vertical

#

Pretty standard CC stuff. And very long lines of codes like any other..

jade glacier
#

I don't see how he is making correct use of that unless he suddenly changed Mirror to make use of FixedUpdate for capturing and applying networked states.

#

Mirror is all time based, not tick based. Which is not conducive to any of this.

trail parrot
#

Oh

#

Oh yea u got a point

#

It's sent through Command, which is probably sent as packed packets per interval whatever thing

jade glacier
#

Yup

trail parrot
#

Oh wait

#

The server receives the packets via Cmd yes, but the processing is done in FIxedUpdate

#

And it has a buffer

jade glacier
#

He is numbering his updates?

trail parrot
#

So i still think this part is also handled fine

jade glacier
#

Last time I saw the internals of an MMOxxx library of his, I saw all kinds of no-nos with timing. Maybe he finally reworked all of that, but I suspect you are going to be up against the lack of a tick engine here.

trail parrot
#

I dont think so.. Cmd stuff are all ordered already, and as long as the fixed tick rate is the same then they'd get the same expected rate

jade glacier
#

Best bet is to try to relax the speed hack check so it can just absorb the errors.

trail parrot
#

I dont think so <-- im referring to the numbering

jade glacier
#

Oh yeah, this is all Reliable TCP too isn't it?

trail parrot
#

Yep

jade glacier
#

oh jeez

#

So what happens if a packet arrives too late for the Fixed?

trail parrot
#

There'll be error

jade glacier
#

a legit error?

trail parrot
#

Hold on

jade glacier
#

like Debug.LogError("WTF"); ??

trail parrot
#

//else Debug.Log("none pending. client should send faster...");

jade glacier
#

TCP is going to generate late packets, I would hope not

#

Holy shit.

trail parrot
#

Yo dude

#

I'm not trying to make fun of his asset or anything here btw..

#

😄

#

It's very educational as a simple, showing mmo stuff and it does a great job in all the other aspects

#

It's just the movement that's a tricky thing

#

It's the only script that has 2k+ lines compared to all the other stuff. I'm sure he's trying his best to also make it understandable and simple n all that

jade glacier
#

You are going to run face first into the flaws with its timing and frame buffering mechanism. Not sure what the easy answer is.

trail parrot
#

Is it that bad to have 0 remaining pending packets?

jade glacier
#

The whole mechanism is bad.

#

Best to just add more slop into the validity checks

#

And make sure the movement code self-corrects

trail parrot
#

By default the threshold has +20% tolerance
But if u see the vid, the server's detecting like 9.5 speeds when the original is 5. That's almost double

jade glacier
#

LOL. Solid.

trail parrot
#

Might as well allow people to cheat with 180% speed, that's already profit

#

Anyways

#

Step #8

jade glacier
#

It has a garbage timing system. So you are kind of in the weeds on this one.

trail parrot
#

Server hard-setting the pos to the new state is fine, right? No need for the server to call CC.Move again

#

I'm really just curious about this one

jade glacier
#

I would think, but if the server is also a player, it gets murky

#

but the standard practice is Fixed is "reality" and Update is "lerping"

trail parrot
#

No, in release the server wont be player

jade glacier
#

In that case, the server just skips all lerping

#

and deals only with hard FixedUpdate reality

trail parrot
#

Yeah

jade glacier
#

Update() is where clients interpolate between those hard states.

#

If the server is pure fixed, then just hard set the states.

trail parrot
#

In the case of games with CC, let client be the sole determiner of where his CC takes him

jade glacier
#

There is no timing system in Mirror though for properly capturing states for serialization AFTER all components have simulated.

trail parrot
#

Server shouldn't deal with or be questioning the CC

jade glacier
#

A very likely problem you will run into is that Mirror will tend to do its capture of states in LateUpdate(), unless he has reworked that.

opaque dew
#

@trail parrot arent you on the mirror server as well? I don't remember if you're a supporter or not, sorry...but if you are FPS Land is available to my supporters and is full server auth and I use a CC

jade glacier
#

LateUpdate() has no direct tie to FixedUpdate... it isn't a one for one.

#

So make sure all apply/capture exist in Fixed

trail parrot
#

What do u mean capture of state? Like, when the client sends the move pos packets? It's also done in Fixed

#

@opaque dew Server auth CC movement?

#

What does the client do then? Send input?

opaque dew
#

also, FPS Land uses UDP. Get that TCP garbage out of here lol

jade glacier
#

Fixed is PreSimulate, so be aware of that - but it can be workable, even though it will induce some latency.

opaque dew
#

I use a character controller to move my character. That's what you meant by CC, right?

trail parrot
#

Yep

jade glacier
#

You really want to capture states postSimulate

trail parrot
#

@jade glacier Well, if CC.Move is called in Fixed, then it will be done in that moment

#

U check transform.position right after CC.Move, then that's the post sim

jade glacier
#

True, it is probably setting the RB.tranform value, which will get captured... though not sure how he ensures that the serialization happens AFTER rather than BEFORE without a singleton.

opaque dew
#

delgelato, I don't want to banter you so I want to be sure, have you been able to look into fps land yet?

jade glacier
#

I would monitor your sent positions and make sure they indicate even changes

trail parrot
#

Not yet @opaque dew

#

Anything paid i can't do. I'm super broke
I never ever got to check out uhh, what's his name. Fish? FirstGearGame? Thingy either

jade glacier
#

The serialization code is inline with the movement code?

#

PunFish

trail parrot
#

Frankenfish

opaque dew
trail parrot
#

He's not in this discord 😄

jade glacier
#

If you are seeing odd discrepancies in movement between client and server, I would check to make sure your clients are sending nice even movements - and that the server is applying them every tick. You shouldn't be getting wild variations.

trail parrot
#

I would monitor your sent positions and make sure they indicate even changes
@jade glacier Yes, checked that and it's stable. No invalid move when it leaves the client
And neither in server when he's receiving the packet

opaque dew
#

oh geez disregard that playlist. I didnt actually stream the movement code.

#

probably because it took so long to get it to work with mirror

trail parrot
#

The problem is, server's validation happens after server calls CC.Move again (from the server's version of the chara pos, towards nextState.pos)

opaque dew
#

delgelato, are you an adult?

trail parrot
#

@opaque dew I can't say i'm super happy with uM's movement, but it's good enough bcoz my game's only a medium-paced

#

Yes an adult from a third world country, whos job was related to tourism all this time and now bcoz of corona there is simply no job at all and i'm currently full timing as a farmer and coconut seller

opaque dew
#

haha. I mean, I like coconuts

trail parrot
#

Me too. I also sell strawberry jam. 5$ for 330ml jar

#

Sold 2 so far

opaque dew
#

I can't provide support on how everything works but if you want a free copy of FPS Land, to rummage around and figure things out, you're welcome to one. Obvious don't share source with anyone, dont reveal it's code, ect

#

Might help you to see how I did it. Its actual auth movement.

#

I also saw a really good article, let me see if I can find that too

trail parrot
#

I really appreciate it. But to be honest, i can't put too much effort on the movement for now... i just wanna get this done with and for a mid-pace game, TCP is really fine... i think

#

When i'm more done with the game, and when i can afford reworking the movement, i should also be able to afford to pay u in the future and will definitely check it out tho

#

(I can also check it out now, but i dont think i'll rework and implement the movement now...)

opaque dew
#

okay, im still trying to find that article. its the only one Ive seen so far that actually got it right

trail parrot
#

I read Dota's net movement, since that's 1 of the game's biggest influence

#

Basically UDP, and always lerp between 3 states

jade glacier
#

TCP is perfectly fine... UNTIL you run into some congestion.

trail parrot
#

But even that, i cant be bothered to implement it and just gonna cope with uM's design

opaque dew
#

well, store it away for later then perhaps. 😛

trail parrot
#

If the packet's buffered, and combined if needed, then it should be fine, right?

jade glacier
#

No idea

trail parrot
#

That's just how vis does it in uM

jade glacier
#

If the fixed updates are one for one for capture and remote apply, then you should be able to make it work.

trail parrot
#

And i dont see any major issue even if i fully lag out 1 client

#

capture and remote apply
What's this?

jade glacier
#

capture state... send state... apply state

#

every tick... no exceptions

trail parrot
#

Yeah it seems like it

#

I mean, i'm only sticking with uM bcoz they did that 500 (or 1000?) CCU test in the past and it seems legit

jade glacier
#

LOL

trail parrot
#

And my game's gonna be only ~100 CCU anyways

jade glacier
#

I would create a test at that scale before relying on that.

#

Find a working title using that library running those kinds of numbers and see how it plays. And make sure you can see those kind of numbers in close proximity.

trail parrot
#

Well, they did. Isn't that not legit enough?

jade glacier
#

They did what?

trail parrot
#

500 ccu test, with many people helping out logging in

jade glacier
#

Hosted a playable game where 1000 people all connected and participated in close proximity?

trail parrot
#

Im gonna read ur article

jade glacier
#

They have 500 friends all connecting? My understanding is they are all local bots.

trail parrot
#

Im sure something will help

#

Haha yea that's the part that i'm not sure of

#

I'd really like to participate and feel the lag

#

Vis said he'll do another ccu test soon, testing a new transport etc. Hopefully this is a public test this time

jade glacier
#

uMMORPG is very old now, are there no released titles to look to?

trail parrot
#

uM CE is new

#

And.. uM is i'd say... bad and impossible to make a working title out of

#

Bad in terms of how there's only 1 giant script for player, etc instead of componentizing it

#

Anyways why am i advertising..

weak plinth
#

I would think you could just have players randomly generate that when they instantiate their player object, and serialize that as part of the instantiation data. @weak plinth
@jade glacier You told me to do that and now I've read a lot of documentations and so on.
I know how I can Instantiate a player prefab into the scene, but how can I give him a role now ? I can't figure it out

jade glacier
#

Your role is just an enum or a an enum mask I assume?

#

Have the client pick one, and send that choice as part of Instantiation Data

#

@weak plinth

#

Reading the docs won't really get you all that far, most of it you will just gloss over. We STRONGLY recommend completing the tutorial, not just reading it.

chrome rover
#

What is the best online game solution ? Photon or Mirror ?

weak plinth
#

Photon

chrome rover
#

ah?

somber drum
#

Not much said in that one particularly but it comes down to need & preference imo

chrome rover
#

so no preference

somber drum
#

If you have no preference I would ask what you need it to do

#

Which one you're more comfortable working with
By reading documentation, reading the api talking with the respective communities and comparing

weak plinth
jade glacier
#

Always do tutorials for the networking libraries you are considering before even thinking about doing a real project.

weak plinth
#

yes ;P

#

so... any solution to correct this red marked words error?
it should work since i am following the tutorial

full girder
#

did u remeber to 1) Download the package for the turtorial and 2) use the using at the top

weak plinth
full girder
#

in your script

#

you prolly have to you use
using FireBase or something like that

weak plinth
full girder
#

yeah. You might have to refence the turtorial, to see if you installed and refrenced everything correctly

weak plinth
#

ok. i will do it again. thank you

weak plinth
#

Hey, I've asked you yesterday about it but I still can't figure it out how to solve the problem.
First, I'm using Photon Pun 2
I'd like to give a random player in my game a role. For example in a tag.

prime beacon
#

create it locally then send RPC/RaiseEvent

weak plinth
#

hm makes sense, im gonna try that out thank you very much

jade glacier
#

Depends which client is giving it the role

#

The answer is still likely to have the client pick its own role, and send that as Instantiation Data @weak plinth

#

If the Master Client is picking one, then that means the master client will handle that, and it should be sent to all with the game instantiation data from the Master.

#

If you are trying to mimic Among Us, then the Master Client will have to do that, since clients can't pick themselves.

proper igloo
#

does anyone know to add/input player names in start screen/main menu using mirror?

weak plinth
woven jackal
#

Hi! I'm a student, for my final project I'm creating a turn-based multiplayer game in VR in Unity.
After some research I'm still not sure what is the best networking engine to use for free?

#

Is it possible to make a auto matchmaking with no room or anything in Mirror? just click to find a player to play against?
If not can I do rooms? one player is creating a room and will self-host and the other will pick the room out of a list and just click to join?

#

Forgot to mention, it will be two players, maybe 4 max...

high night
#

@woven jackal You can easily connect multiple players via lan or hamachi btw

#

hamachi is very simple and straightforward to use
it puts you and your friends in a virtual lan over internet
it is not related to unity or anything

limpid sorrel
#

is there anyone here that can help me with port forwarding with xFinity xFi?
This piece of shit 24/7 security bullshit won't allow me to remove open ports, and the ports that are already open don't work

slim ridge
#

haha

#

throw xFi in the trash problem solved

limpid sorrel
#

I can't 😦

mortal horizon
#

Hey guys, I'm having a problem. whenever I build my game as a server build it wont let any clients connect and spams the terminal with this message? any help would be greatly appreciated.
(mirror)

slim ridge
#

does anything in your scene use that shader?

mortal horizon
#

Nope thats whats wierd

slim ridge
#

you may be able to remove it from your build via project settings.
it may be in "Always included shaders"

#

but tbh i would not recommend anyone to use unity as a server it requires it's own license afaik

mortal horizon
#

I'm choosing server build in build settings and mirror is automattically doing the rest

#

Ill have a look into that real quick about the always included shaders

#

I just checked, that shader thats giving the error isn't in that list

#

Does anyone know how to reinstall the legacy shaders? Perhaps i corrupted them somehow

umbral sequoia
#

I am looking for a consultant to help me implement Addressable Assets with Remote LoadPaths and dynamically changing Content Catalogs.
If you are familiar with Addressable Assets and I could really use your help and would happily pay your consulting rate

frail steppe
#

does anyone know what kind of system that among us and phasmophobia uses for their online multiplayer room code generator? im kinda interested

jade glacier
#

Among Us wrote their own, loosely based on photon. Phasmophobia uses pun. @frail steppe

frail steppe
#

good to know, thanks for the help!

stable epoch
#

Hey simple question (I hope), im making a multiplayer thirdperson game. How do you do cameras in a multiplayer game?

mortal horizon
#

@stable epoch What networking solution are you using

opaque dew
#

@jade glacier What do you mean loosely based? Is Among Us PUN?

jade glacier
#

The devs are long time users of Pun is what I am told, and recommend it to others. But they opted to write their own variation for Among Us. I assume because they had the knowledge of how to do it, so they saw an opportunity to keep more of their profits.

#

If I had to guess. I haven't spoken to them so that is all third hand information.

opaque dew
#

Hmm, wonder if the game is client auth.

#

Been an uprising of paid client auth games haha. Guess it doesn't matter unless you make it big.

jade glacier
#

I suspect it is all client auth of movement. Nothing about the game screams the need for server auth of movement.

#

They have full control of their relays though, so they can add any amount of logic they want.

violet scarab
#

Hello. Can UNET work with steam ? I mean if i want to create p2p with steam, do i have to write with steam api, or after creating in UNET, can i somehow make it work on steam ? Thank you for answers in advance.

gleaming prawn
#

Unet is obsolete

#

You may be talking about MLAPI or Mirror

#

Their more recent maintained implementations (official UNet is deprecated by Unity)

violet scarab
#

@gleaming prawn Does it differ from UNET too much ?

gleaming prawn
#

no

#

neither, AFAIK

#

Then you should ask in their specific discords...

violet scarab
#

So unity will not create a network system, they will use mlapi for future ?

#

@gleaming prawn

gleaming prawn
#

That you need to ask them /Unity)

#

Currently they said they are working on a DOTS netcode (which somehow Alpha state, etc)

#

There are no public plans shown AFAIK.

#

There are other mature options around