#archived-networking

1 messages ยท Page 69 of 1

jade glacier
#

Just get the pv

#

And use it

dusk basalt
#

alright thanks !

slim ridge
#

unless you actually print the value you are assuming what it is :D
murdering assumptions is an important programming skill

dusk basalt
#

I did, thats how i found out it sends the "ID" of the local Player, because i "printed" the actually ID on the UI to test it

jade glacier
#

Especially in networking, where debugging is 10x harder

empty yew
#

debugging is the same. just come here and someone 10,000,000x smarter will fix it for you

high night
#

While loops with network time related conditions are giving me debug nightmares mostly
(Stuff that i did to have my own controlled FixedUpdate-like update)

dusk basalt
#

@empty yew sorry that i ask questions

empty yew
#

?

#

I didn't even read your message

dusk basalt
#

Ah sorry, i thought you are reffering to me

slim ridge
#

lol bargos i do that too

#

networking + unity physics = no.

spring crane
#

@slim ridge Doing Unity physics stuff or PhysX stuff?

slim ridge
#

unity. the way fixedupdate works makes timing a nightmare

spring crane
#

Yea I've seen mentions about that. Seems like a lot of people are jumping on to take advantage of the more predictable physics for networking stuff

jade glacier
#

For all of my networking I had to create my own singleton that runs at the earliest exec timing and another that runs at latest, and I use that to reconstruct a "PrePhysX" and "PostPhsyX" master callback.

#

not having an actual PostSimulate in monobs is a real problem for good tick based networking.

golden breach
#

Hey I was wondering if anyone who knows there way around Photon Networking could dm me or something BC im having some problems

empty yew
#

You can ask your question in here

golden breach
#

Ok thanks

#

Im having trouble updating an int on all photon clients

jade glacier
#

I assume you mean PUN, and I assume you are using an RPC?

golden breach
#

I am using PUN and I have tried using an RPC and OnPhotonSerialzedView but I'm new to this and nothing has worked so I'm assuming I implemented them wrong

jade glacier
#

Probably yeah

golden breach
#

If I were to show you the scripts do u think you could help?

jade glacier
#

Dunno, can't hurt to try and form a question or isolate some code to show.

#

You haven't actually asked a question, you just kind of stated that you are lost.

golden breach
#

Yup

jade glacier
#

So, give it your best shot.

golden breach
#

I'm uploading pictures

jade glacier
#

have you done the tutorials on the Exit site?

golden breach
jade glacier
#

typically you want to use like hatebin.com or if its short code like that use the ```cs yourcode ``` format in here.

golden breach
#

U lost me there

jade glacier
#

yeah, you are miles away

#

do the tutorials first

#

you will never guess how to code for networking

golden breach
#

I've done a few but none on the hashbin thing

#

I read about it in some documentation

jade glacier
#

hastebin is for posting code, not for the networking dev part

golden breach
#

Sorry hash something

jade glacier
#

But you aren't even calling any of the PUN callbacks for networking there, so unless its somewhere else - you are entirely missing all of the connecting and responding to connection callbacks.

golden breach
#

Yes I deleted that so you could see the code but I'll try and recreate it

jade glacier
#

Have you gotten the tutorial working?

#

If you start with that you can then start adding your own things to learn how to do it.

golden breach
#

Sorry here's what I had b4

#

And if you have any recommendations I've tried quite a few tutorials and they haven't been working for me

jade glacier
#

I would start with the tutorials that come with it

#

Have you made a Unity game before? Or at least mostly completed one?

golden breach
#

Yes but networking is always something I've hated

#

Anyway the code up above in my 3rd picture seemed similar to the code in the GameLogic section

jade glacier
#

Still not a question really, sorry.

golden breach
#

Why isn't it working

jade glacier
#

You are missing a lot of things, I haven't seen any code yet that you have where OnJoinedRoom and such are being used so I really can't say anything.

#

Its not working because you have bugs in your code.... that is all I can say.

golden breach
#

Those are in different scripts

#

And that works

jade glacier
#

You are connecting and seeing the other player objects?

golden breach
#

Yep

#

I just need to sync this variable

jade glacier
#

and you have wired your component up to the PhotonView IObservables?

golden breach
#

Yep

#

I set the script not the transform

jade glacier
#

And debug.log calls inside of your serialization methods are firing indicating that they are being called to write and read?

golden breach
#

I didn't debug it

jade glacier
#

why does the pasted code have two identical IOnSerialize methods?

golden breach
#

Dang

jade glacier
#

Why not?

golden breach
#

Idk

#

And I can't freakin test it right now

#

My computer isn't accessing the internet

#

And the Photon can't work without connection

jade glacier
#

I got nothing for you sorry. You need to do all of the basic debugging stuff first and narrow it down to an actual question before I can assist. ๐Ÿ˜•

golden breach
#

I'll assume it's not being called anyway or else the variable would have been synced

jade glacier
#

Never assume

golden breach
#

Yah

jade glacier
#

Debug.Log.... everywhere

golden breach
#

Ye

#

I'm so annoyed

jade glacier
#

You have a wrong assumption, that is what you are trying to find.

golden breach
#

I'll have it being able to test tomorrow

#

Wait...

#

I think I have another theory too

civic stream
#

@jade glacier is it normal that I need to get the PhotonView of the GameObject I'm trying to call the RPC method on?

#

So if I'm trying to call an RPC method on a player from a game manager, I need to get the player's PhotonView?

jade glacier
#

I don't use rpcs, but seems reasonable to want to do that.

weak plinth
#

Yeah, you need to get that exact PhotonView.

#

I personally used events only when I was still using PUN.

jade glacier
#

PUN doesn't have the concept of LocalPlayer like Unet though. A player can own any number of objects and send rpcs from them.

uncut marsh
#

Hello my names billy a game developer/ concept artist, I need help on my project texturing a few 3d realistic mutant creatures for unity anyone here have experience on that field?

jade glacier
#

This is the multi player networking channel, probably meant that for a different channel @uncut marsh

whole granite
#

Hey guys,
Is there anything like connection tokens or something to pass data during connection in Unity.Networking.Transport?

clever quartz
#

hey everyone .. I've been searching for a while on how to implement the networks of an MMORPG and the only results I've reached
so far was using SpatialOS so I'd like to ask for your opinions on this matter and what the best approach would be.

jade glacier
#

Have you made any kind of finished or somewhat finished basic MP game?

Starting in with an MMO = kiss 2 years of your life goodbye with a high likelihood of abandoning your project half finished. I strongly recommend AGAINST beginning your networking journey there. @clever quartz

civic stream
#

Lol I figured as much

#

I'm literally trying to make a monopoly-type game to play with friends because the monopoly on steam is the laggiest game I've ever played

pastel spindle
clever quartz
#

I haven't .. I'm a junior computer science student with little background in networks so I'm hoping this gives me even the slightest advantage and
even if I gave up half way it would still count as experience so I wouldn't really consider the process as useless @jade glacier

#

what I would really like to know though is how to start with network layer and what tools to use

jade glacier
#

I would still first run tutorials for some of the more popular libraries, like PUN2, Mirror, Bolt - to get your head around the basic networking for games concepts and problems.

#

I always recommend to try and make a version of 2 player Pong that plays reasonably well over the Internet first. It will teach you the paradoxes involved in networking that you will be up against - before piling too many challenges on top of that right out of the gate.

#

an MMO is the deep end, and you will have so many broken parts at once you won't even know where to start.

#

Break it down into learning the small bits of what goes into game networking separately - and then once you feel you get it you can try to pull those all into an MMO.

night plover
#

I agree completely. And it sounds like you want to do it for learning and employment purposes. In both cases, finished products are much more valuable.

#

And you're not going to finish an MMO alone while still studying

jade glacier
#

You can break it down into smaller bits that later can find their way into an MMO. But seriously. Try to make 2 player networked Pong that survives 150ms pings and 10% packetloss. You will learn volumes from trying to do that.

#

All of this also isn't even touching the marketing side of MMOs. They require lots of users to even function as planned, and lots of users require lots of marketing and budget.

clever quartz
#

okey great I will do my best to get more familiar with the basics and the fundamentals so that I'd have some base knowledge when starting with the mmo

jade glacier
#

And to the point of a portfolio, you would get FAR more mileage out of a very small and tight study of some mechanic applied to a networked game, executed with genius.

#

Shitting out a sloppy barely functional MMO is not going to impress any networking people who are hiring.

#

The best portfolios I have ever seen are a lot of small, very intelligent studies of networking problems, and experiments produced that solve them in interesting ways.

#

So step one, make Pong and start to experience the problems we mean.

#

Step two... start coming up with genius ways to solve them.

clever quartz
#

@night plover yeah I'm doing it for the fun and the experience and I'm not really alone there are many people I know who are willing to help so implementing the base game is kind of my goal now

jade glacier
#

We can only tell you from experience and what we see here. The highway of this channel is littered with people showing up day one with "I want to make an MMO...."

#

And they all vanish

clever quartz
#

@jade glacier yeah I understand you clearly .. a half working mmo won't be impressive in my resume at all

jade glacier
#

And will just not be fun... at all

clever quartz
#

I know how difficult it is to pull it off and I know that it's extremely hard and complicated and that I most probably going to give up half way through, I know of the amount of people who wanted to do something similar and failed .. I don't mind failure because I really don't think that those people who vanished have failed .. they have gained some knowledge even if it's something insignificant as completing 1% of the game

jade glacier
#

You do you of course. We are just telling you what we know and see as networking devs ourselves.

clever quartz
#

so far it has been extremely fun for me and my other friend .. facing new problems and even struggling with the code :D

jade glacier
#

We have this exact conversation in here like 5 times a week. You might be the exception... who knows.

#

Networking is a lot of fun, for sure.

clever quartz
#

i'm not lol

jade glacier
#

MMOs can be fun as a graduation project after getting a handle on all of the smaller components first. But starting right into one to begin with. Strongly discouraged.

clever quartz
#

I really hoped being a c.s student gave me advantage .. looks like it didn't

jade glacier
#

not really, that will help you on the transport layer, but you don't do much work on that layer anyway.

#

Those libs are all made.

#

Game networking is largely a gaming problem, not a CS problem.

#

The core of it being how to reduce a game to States and Inputs, how to serialize and share those over the network, and the hardest part, how to hide the latencies involved and deal with lag/loss.

clever quartz
#

that's new to me

jade glacier
#

Making a system that is efficient and resilient has a lot of layers of complexity, and lots of paths you can go to solve those paradoxes and such.

gray ether
#

okay, how would i get two game instances, both connected to the same network, to sync scenes? something like the unity matchmaking or photon, but LAN only?

clever quartz
#

well I'll go for your advise so I guess my job right now is to fully grasp the fundamentals and start on small projects first

#

I do have a question though .. is there any reason to why I shouldn't use SpatialOS .. it looks fairly easy and I don't have to do any coding related to networking

#

at least not complex code as far as I understand

night plover
#

Isn't SpatialOS mostly backend stuff?

clever quartz
#

I'm not sure I'm still trying to understand how it exactly works

jade glacier
#

At this point I would try lots of things. Do all the tutorials you can... That will really get you down a good path.

clever quartz
#

okey great .. checking the popular libraries you mentioned earlier and making a 2 player pong sounds like a good idea to understand the basics

#

really appreciate it .. thanks ^^

silent zinc
#

Could anyone link me, some docs regarding async sockets for client side in c#?

slim ridge
#

hmm, i've just been googling about SpatialOS and came across their dispute with unity. I'm still uncertain. Can anyone clarify if we're allowed to run our server in the cloud without a separate unity license?

silent zinc
#

@slim ridge I followed that example like in many ways, from the strict one, to the creative one lol. I mean, i encountered lots of problems with my game using that example, WaitOne() makes the Unity Thread wait forever. Right now i'm using this class https://hatebin.com/ujwazvntnt for the Client.

#

I really don't know how should i implement those methods, in order to recieve all data without blocking.

#

Btw my class is ugly, i should take my time to adjust it

slim ridge
#

where's it blocking now?

silent zinc
#

it's not blocking atm

#

but sometimes it doesn't recieve data if i call RecvData in a while loop for example

#

The server is a python asyncio server

slim ridge
#

i havent used async sockets yet, but don't you need to EndReceive at some point?

#

oh, i see it there ๐Ÿ˜„

silent zinc
#

that bool that i set to false, is just to avoid multiple recv on to another

#

that erase the response

slim ridge
#

but since it's async it could be happening at the wrong time

gray ether
#

what would be the best approach for LAN multiplayer between PC and ios/android?

silent zinc
#

but since it's async it could be happening at the wrong time
@slim ridge what do you mean?

slim ridge
#

there could be two RecvCallback going at once

silent zinc
#

That is the class that calls recv and handle all the events

slim ridge
#

@gray ether do you need a server or is one of the clients acting as the server?

gray ether
#

one of the clients would be hosting

#

pc is in vr, i only need to send a render texture, probs dont need multiplayer but want to add more features on mobile than in vr

slim ridge
#

you'd have to build a server/client for each OS

gray ether
#

pc would be hosting

#

ahh, ok then.

silent zinc
#

use a python server ; ) hosted on a Linux machine

gray ether
#

no, i dont want servers

#

this is only for two players on the same network, but if i had to, i would be using python ๐Ÿ™‚

#

thanks @slim ridge

slim ridge
#

I'd recommend picking one then writing a server/client for it that encodes your RenderTexture and streams it

#

since it's LAN, you shouldnt need to worry about compression ๐Ÿ˜„

gray ether
#

id probs just use something that supports udp

tropic adder
#

How I can do it, that if the PhotonView is mine, that other Entities spawns as if the View is not mine.

gray ether
#

any recommendations for something that works on both?

tropic adder
#
public class WarriorSpawn : MonoBehaviour
{
    [SerializeField] private Warrior Prefab;
    [SerializeField] private List<Enemies> enemies = new List<Enemies>();
    public void Summon()
    {
        Warrior warrior = Instantiate(Prefab, new Vector3(-100, 190, 0), Quaternion.identity);
        // miner.AddComponent<Miner>;
        // Miner m = gameObject.AddComponent(typeof(Miner)) as Miner;
        warrior.MoveTo(enemies[0].transform.position);
    }
}```
jade glacier
#

@clever quartz If you are on the PC be sure to test your gameplay using clumsy.exe - you really want to see what latency and loss do to your system.

slim ridge
#

i dont know any, awesomepants, but something you might be interested in is multicast networking it seems appropriate for your situation

burnt axle
#

@tropic adder store it as a prefab?

tropic adder
#

Yes

gray ether
#

thanks! i'll look into that!

#

ok, no, i only need communication between two devices, a pc and either an android or ios device

#

unicast is enough

clever quartz
#

@jade glacier i will do that .. it's just that I want to set up the multiplayer for now and improve the connection later

tropic adder
#

Hello?

slim ridge
#

I haveno idea GoldGuy it's hard to understand your question ๐Ÿ˜ฆ

tropic adder
#

I want that:

#

If Player1 spawn a Warrior, the Warrior1 have to Spawn on -100, 190, 0. And if Player2 spawn a Warrior, the Warrior2 have to Spawn on 800, 190, 0.

jade glacier
#

What are you using for a networking library? @tropic adder

tropic adder
#

Photon

jade glacier
#

PUN2?

#

You should be using the instantiate built into that for spawning if so.

#

What you pasted above has no networking code, so not sure what you are trying to do.

weak lava
#

Hi, so im working on a server-client prototype where the client is always an android smartphone. Handling messages and stuff works kinda good. But im facing one problem. The client randomly disconnects, but only when i test it with a android build using Console everything works perfect. Actually i have no idea why this happens. Im using sockets and tcp protocol. Thats my client net code https://github.com/SradnickDev/Sockets/blob/master/TCPServerClient/Client/ClientPeer.cs. Or is there anything i have to take care when dealing with android and local wifi?

amber trench
#

@weak lava you might get more mileage using a websockets-based solution that already includes connectivity lifecycle, like SocketIO

#

if this is more for educational purposes, you should start with an environment where you can see what different connection states mean

#

like start with two computers on wifi. try moving one away from wifi. try sleeping it. try turning off the wifi adapter. etc. you'll be frustrated to discover that for these very real, concrete things, you will not at all get predictable connection states, exceptions, events, etc.

#

exactly zero people in this chat room, except maybe the PUN author, will know what would happen ๐Ÿ™‚

#

i don't even know

slim ridge
#

ya the android smartphone can change networks any time it pleases

weak lava
#

@amber trench alright, i'll not change to any third party lib, its more for educational purposes for my next project. That means i'll just keep tryin and testing stuff.

amber trench
#

you might want to see how socket IO works then

#

the answer will be "heartbeat"

#

basically every networking solution that has to work in a general way, especially for mobile devices, sends a heartbeat every X seconds

#

to determine whether or not there's a connection

#

"but TCP" doesn't matter

#

every rolled-your-own solution eventually uses UDP, because it's connectionless, and the heartbeat is a superior way to determine whether or not a mobile device is connected to a server

#

Clash Royale for examples uses UDP as its underlying transport

#

mobile devices have very good support for UDP, especially as their internet interfaces may change

#

or their sleep states may change

#

so i'll be honest, a stateful TCP connection is a dead end for you, unless you do a Socket-IO's level of work to manage the lifecycle of the connection

weak lava
#

Well i switched from udp to tcp because of the reliability, actually without packetloss where a problem. But im gonna check UDP next after studying Socket IO. I also had a heartbeat implemented but since im sending continuously packets due to testing, i deleted it, will remember to reimplement in when changing to udp.

empty yew
#

You're gonna have to share your code so that someone can help you.

jade glacier
#

you have set your NetworkIdentity on your player prefab to be localPlayer?

#

The client can't move meaning your controllers aren't working locally on the client?

#

Sounds like your hasAuthority check on your controller might be wrong.

empty yew
#

How are the players being spawned

frozen canopy
#

Hello, im looking for someone good with Photon Bult integrations, paying good to make a photon bolt integration and adaptation in my game.

Dm if interested, cant find someone outa there

worldly cedar
#

does anyone know why a UnityWebRequest GET call would perform syncronously (aka, blocking/freezing the app) in a WebGL build?

spring crane
#

@frozen canopy You have been told multiple times that we don't do job advertising here

#

@worldly cedar How are you doing the request?

worldly cedar
#

ah, ive posted the wrong one, 2 secs

#

network problems in 2 different projects haha

#

this is the main part of the code @spring crane

//Add auth header        
        using (UnityWebRequest www = UnityWebRequest.Get(url))
        {
            www.SetRequestHeader("Authorization", "Bearer " + accessToken);
            yield return www.SendWebRequest();
            resultText = "{ \"Items\": " + www.downloadHandler.text + "}";
        }

it works, it just freezes the app

spring crane
worldly cedar
#

right? Ive got a few other calls implemented exactly the same way and they arent blocking at all

#

but thanks for the links, helpful!

nocturne osprey
#

is anyone familar with the socket.io asset for unity? I'm having some problems sending json server with a seemingly simple emit command. everything is working on the node.js as I can send messages between two browser windows. i can also see that unity is making a socket connection and the beep() method that is provided (does not send data, ie socket.on('beep', function() as opposed to socket.on('chat', function(data){) which works correctly

https://pastebin.com/VtAqE6uK

tropic adder
#

I want, that if the PhotonView is mine, my Prefab Miner spawns as a Child of the empty GameObject: Player1

#

And also with Player2

#

Here is the Code:

#
using System.Collections;
using System.Collections.Generic;
using UnityEngine;
using Photon.Pun;

public class MinerSpawn : MonoBehaviour
{
    [SerializeField] private Miner Prefab;
    private PhotonView photonView;
    public void Summon()
    {
        GameObject ParentGameObject = GameObject.Find("Player1");
        GameObject ParentGameObject1 = GameObject.Find("Player2");
        Miner miner = Instantiate(Prefab, new Vector3(-100, 190, 0), Quaternion.identity);
        
        photonView = GetComponent<PhotonView>(); //Line 21
        if (photonView.IsMine)
        {
            miner.transform.parent = ParentGameObject.transform;
        }
        else if (!photonView.IsMine)
        {
            miner.transform.parent = ParentGameObject1.transform;
        }
    }
}```
#

Please nick me, if anyone have a solved Version of this Problem:

#

NullReferenceException: Object reference not set to an instance of an object MinerSpawn.Summon () (at Assets/Scripts/MinerSpawn.cs:21)

vital vector
#

which one is line 21?

tropic adder
#

photonView = Get...

#

I commented it

vital vector
#

ah yeah

#

well that's weird. I'd understand if the error was on the following line, since IsMine can't be accessed if the object if null... But on that line, the only possibility is that this would be null, which would be even weirder

#

are you sure the object hasn't been destroyed once the function is called?

tropic adder
#

Yes

vital vector
#

because that would cause this to be null (from Unity's point of view)

#

then it's hard to tell..

tropic adder
#

I did it before

#
private PhotonView photonView;
    // Start is called before the first frame update
    void Start()
    {
        photonView = GetComponent<PhotonView>();
        if (!photonView.IsMine)
        {
            foreach (var script in scriptsToIgnore)
            {
                script.enabled = false;
            }
        }
    }```
#

And there it worked

jade glacier
#

doing that in start is only going to work if you spawn that object after connecting

#

that will not work for scene objects

tropic adder
#

I mean the PlayerView.

jade glacier
#

If its being spawned after connect, that will work yeah

#

You can make that work for scene objects as well just by changing from Start to OnJoinedRoom and OwnerChanged

tropic adder
#

Ah. Ok

fierce niche
toxic lintel
#

should i use Unet or build my own server api for my fps

#

or is there another api option better then unet

jade glacier
#

There are a lot of options better than UNET. I would say all are better than Unet at this point, since its obsoleted.

#

I am sure you are about to ask "Which is best"

slim ridge
#

@toxic lintel any protocol you write is going to be easier to debug and modify than a plugin like unet, but perhaps what you're looking for is photon

toxic lintel
#

alright

#

probs go for my own protocol then

jade glacier
#

Photon is several products. The only one really suited for FPS is Bolt. It's designed to make AAA fps games, but it does have a learning curve and it does tie you to Photon.

#

Honestly though, what you are asking gets asked about 10x a day here.

#

the correct answer is none of that.

#

If you have to ask, it means you haven't done tutorials and build any networking experiments - so you should not even be trying to think about making an actual game yet.

toxic lintel
#

ye

jade glacier
#

The question itself indicates you aren't ready to ask that question

toxic lintel
#

im working on a tcp chat app rn

#

trying to learn some more about networking

jade glacier
#

Networking has a half dozen layers

#

the transport being the lowest, which is just connections and sending byte[] arrays around.

slim ridge
#

tcp chat is a good entry to socket layer programming ๐Ÿ‘

jade glacier
#

Game networking is about dealing with the paradoxes of latency and loss - and how you architecture to make that manageable.

#

chat is a good intro into the transport

toxic lintel
#

alright

jade glacier
#

but don't blur that with actual simulation and state transfer - those are a completely different set of challenges.

toxic lintel
#

ok i dont even know what these are yet

jade glacier
#

yeah, which is why it is WAY too early to be asking about the best way to do an FPS really.

#

Do tutorials for some of the major libraries

toxic lintel
#

i will

jade glacier
#

PUN, Mirror, Bolt for the middle layers

toxic lintel
#

networking seems like a good way to go once you have a good grasp on datastructures anyways

jade glacier
#

Bolt is the only full stack available to you, and is likely the actual best answer for making a real FPS... but you won't learn much from it alone.

toxic lintel
#

and how basic OOP works

jade glacier
#

yeah, none of that is really going to help you down this path.

#

Networking at the game level is a lot weirder

#

You need to know those, so you are ready to get into networking

#

But you really have to take some time to read up on the paradoxes you will be trying to solve

toxic lintel
#

PUN, Mirror, Bolt these three right

jade glacier
#

they are the more popular libraries yeah

#

Bolt is the only "correct" one

#

Pun/Mirror and such are a couple layers on top of the transport

#

PUN is relay based, Mirror is basically UNet in architecture.

toxic lintel
#

so that would be similar to things like ftp?

jade glacier
#

Totally going down a wrong line of thinking there

#

The transports typicaly work using either TCP or UDP

#

but what they are doing is always the same... they establish the connections, and they send byte[] arrays as messages

#

With optional reliability settings if its UDP

#

but that is about all that is going on down at the bottom of real consequence.

toxic lintel
#

alright

#

thanks for all the info m8

jade glacier
#

I would start with tutorials

#

That will lead to better questions

toxic lintel
#

its really helpfu;

jade glacier
#

then we can help way more

toxic lintel
#

helpful

jade glacier
#

gl

#

If you try mirror, they have their own discord channel

#

just be aware that that library will encourage some VERY bad networking practices

#

So take advice given there as debatable. But still very useful.

fierce niche
#

ok so im trying to understand how to RequestLeaderboard from the playfab api I thought maybe I was supposed to write my own function for it like this
C# Code blocks:

//Get the players with the top 10 high scores in the game
    public void RequestLeaderboard()
    {
        PlayFabClientAPI.GetLeaderboard(new GetLeaderboardRequest
        {
            StatisticName = "HighScore",
            StartPosition = 0,
            MaxResultsCount = 10
        }, result => DisplayLeaderboard(result), FailureCallback);
    }

    public void Displayleaderboard(GetLeaderboardResult result)
    {
        //show results in ui
    }
``` here are the docs, Im looking at the code under RequestLeaderboard https://docs.microsoft.com/en-us/gaming/playfab/features/social/tournaments-leaderboards/quickstart
#

basically im not sure how this "DisplayLeaderboard(result)" is intended to work since it doesnt exist. im assuming I need to write that "DisplayLeaderboard()" function myself. but GetLeaderboardResulsts is under PlayFab.ClientModels wich i am using. and obviously the code i pasted doesn't work

slim ridge
#

i still dont get it. You don't find what you need in result or the function isnt even called ?

fierce niche
#

DisplayLeaderboard in the line under max results "doesnt exist" even if I make that function myself

slim ridge
#

ah, it's using delegates

#

but you made a typo too

fierce niche
#

so im assuming im doing it completely wrong

#

shit lol

#

lowercase l I see it now

empty yew
#

what is pun good for, @jade glacier

slim ridge
#

emptying your wallet

empty yew
#

?

slim ridge
#

looks to me like PUN distributes your networking on their cloud

#

something you'd buy if you can't afford a cloud computing engineer

empty yew
#

i know bolt is good for fps, but why is it better for that

slim ridge
#

probably because of the mecanim replication, state replication

empty yew
#

you dont necessarily need bolt if you have a slower type of real-time fighting then, right?

#

not slow slow, but not fps headshot dead fast

jade glacier
#

Pun is relay based, so it basically removes the server from the equation - for better and worse. @empty yew

#

So it is not good for competitive authoritative game types, unless you start writing server plugins.

empty yew
#

so each client are just connecting to eachother

jade glacier
#

not exaclty

#

Relay is still a server, but its a dumb server

empty yew
#

I was using PUN for a magic based fighting game solely for friends at school. Should I cut my very short losses and swap to bolt?

jade glacier
#

I missed the start of the convo... what game type?

#

And is the goal to learn, or to get to market?

#

PUN for most fighting games in its vanilla form isn't going to be ideal.

#

Fighting games if you mean like Tekken really want to be extrapolative and deterministic

empty yew
#

This is basically the start of it lol

#

FPS style gameplay but with magic

#

Not for market, just for the experience and to hopefully have a finished product i can play with my friends

#

I don't need it to be perfect, just working lol

jade glacier
#

Just be aware of the architectures and how those will play out

#

in the case of fighting games, state transfer with client prediction and extrapolation are going to make for some "interesting" timings

empty yew
#

are you still on tekken type games

slim ridge
#

in that case i'd say go for it with PUN or whatever you want until you encounter these problems, but a professional project will require much more forethought

jade glacier
#

But worth trying, just to see.

#

Most of getting good at game networking is learning how to hide the timing paradoxes

empty yew
#

or just have the game be hilariously bad

#

and embrace the shittiness

#

PUN should work then?

#

or should i swap to bolt for the better chance of dealing with less lag

#

i literally have only connected to master and shared variables. I'm not that far in

slim ridge
#

try both

empty yew
#

I guess I'll stick to PUN until I discover what issues I can't get over

#

Thank you to both of you

jade glacier
#

np

#

If you are making a game that is typical FPS (missed that it is NOT a fighting game), you will mostly have to deal with not having an option for server authority. That means you really are going to be leaning on client authority.

#

@empty yew

#

For that type of game Bolt is the only full stack option. Alternative is to create your own client prediction system on top of a server based lib like Mirror/MLAPI

empty yew
#

Then I'll swap to bolt, considering that the second sentence there sounds awful

slim ridge
#

if your friends cheat you can reach over and smack 'em

empty yew
#

I'll probably just referee so I can keep an eye out for bugs and what not

#

It's meant to be a MOBA mixed with RPG elements, be it killing monsters for loot/spells and farming herbs for potions that can be stolen

jade glacier
#

I would switch to Bolt sooner than later if that is the plan at all

#

Since it has its own physics/controllers that make all of this possible.

#

The reason server auth is so hard is it requires the ability to rewind and resimulate properly, and to do that the system needs to manhandle inputs and states in a replicatable way.

empty yew
#

Yeah, I think that would be for the best. I stopped working on the networking mostly because of school, but also I want to create everything in single player simply to have that out of the way.

#

So by the time I finish that, I'll have forgotten PUN anyways

jade glacier
#

PUN of all of your options for an FPS is probably the WORST one - so I wouldn't get too deep yeah.

echo flax
#

Hey, I had a question about UNET right now will it still be working later on if they removed it and if they make a new API with better Features and functionalities will my project be upgraded some how and can i use these Features? I heard it might be removed should i start with something else?

jade glacier
#

The new one is not even remotely related, there will be no upgrade path.

#

You would be better off moving to Mirror now, its going to be the upgrade path for Unet for the foreseeable future.

#

@echo flax

echo flax
#

Okay but if am in a middle of a project with UNET or finished one do i need to remake it with Mirror or is it a small difference in like the plugins and the extra features ?

jade glacier
#

I would save for your git, then join the mirror discord.

#

@echo flax

echo flax
#

What do u mean with git am sorry?

worldly cedar
#

hey all, anyone got advice in making sure unitywebrequest output is utf8>

#

*?

amber trench
#

@worldly cedar unitywebrequest will use the content-type header to determine the encoding of text. for example, content-type: text/plain; charset=utf-8

worldly cedar
#

I have tried both text plain with charset utf-8 and application/octet-stream, no luck. Someone on stack overflow has commented saying that it may be sending it in a url form format, and suggests using UploadHandlerRaw, so im gonna give that a go

#

And that seems to have fixed it!

amber trench
#

great ๐Ÿ™‚

jaunty quest
#

What's the best option for a mobile multiplayer game?

#

And by that I mean what route should I take for the multiplayer aspect and how would I go about doing this? For learning sakes.

gleaming prawn
#

What kind of game is it?

#

What platforms as well

#

Do you want to learn to create multiplayer games, or how to write a multiplayer framework?

#

Honest questions... Without more details about your goals you'll receive totally random answers

jade glacier
#

Drive-by

delicate kindle
#

So i have 1 one body on the bottom there is a walking animation etc, but on the top i have script that makes the upper body to look where the camera is pointing, i tried adding photon view (transform viewer) and at the ended looking terrible how do i achieve that

#

@me if you know the answer

jade glacier
#

The vanilla animator sync in PUN is a bit limited, but what you are describing indicates some kind of an ik-like thing you may be doing you need to serialize and sync whatever that script is doing to the upper body if it isn't manipulating the player through the animator. @delicate kindle

delicate kindle
#

wait, i'll record it for you!

#

give me a mec

jade glacier
#

You also need to use the animator view if you are using an animator.

delicate kindle
#

there is a empty transform that is parent to the upper body

#

if i sync that transform it will glitch and it will look strange

#

it will have delay

#

etc

jade glacier
#

You have multiple issues it sounds like

delicate kindle
#

well it's 1

#

how do i sync that transform without delay and other things

jade glacier
#

Depends what delay you are referring to

#

The internet IS delay

delicate kindle
#

this is ingame

#

see how it looks

#

it has delay

jade glacier
#

And syncing requires buffers which create some last as well

#

No idea what I am looking at sorry

#

Delay in what?

delicate kindle
#

it stretches' the point

#

compare the first video with the second one

#

for example because i am syncing 2 transforms, when i move, the 2nd transform has small delay

jade glacier
#

Yeah, you have something of a mess going. I would start over and get just the basic animator and transform syncs working before trying whatever you are doing to the upper body.

#

Yeah, you have bugs. Looks bad.

delicate kindle
#

that's how the other clients see it

#

for me it looks fine

jade glacier
#

Yup, you've got issues for sure

delicate kindle
#

so if i move transform 01 forward after 1 sec or something the 2nd one will move after 1 sec or something, but only when i am syncing with photon

#

so my question is how do i sync 2 transform points, but to be synced and don't go all over the place

jade glacier
#

You are mixing timeframes somehow. You definitely are doing one or more things wrong there.

#

Too big an open ended a question sorry. Without having your code in front of me to see how you Tangled things up like that, I can't even guess how to fix it.

delicate kindle
#

Well it has nothing to do with the code, maybe i should contact Photon, or syncing it every frame without waiting to change position and then sync it

jade glacier
#

Typically you do all local animation and transform handling, and the syncs replicate that. You are doing something that is fighting with them most likely.

#

I am photon PUN.

#

What are you using for a character controller?

delicate kindle
#

Wdy?

jade glacier
#

?

#

I would during dev have it update continuously yes, to be sure its not a weird timing issue

#

you can also try the SNS stuff, which has much better syncs

delicate kindle
#

I'll try to update it continuously

#

i am 78% that is going to work

#

so yea

#

thank you btw for the help

jade glacier
#

The SNS syncs are tick based, so they ensure that transform/animator syncs happen on the same ticks exactly as they were on the owner. If that is the problem they will help. If the problem is your controller is doing some weird stuff on clients, then you have to track that down.

golden breach
#

How do you get Unity UI to update based on what a player on the other screen is doing with said UI (Im using Photon PUN)

jade glacier
#

Same as locally. You have fields that represent the state, and UI gets callbacks when things change.

#

You just have to sync the backing fields with rpcs or such.

golden breach
#

ok

fierce niche
#

I wana set up a leaderboard / log in system and I dont think I have the time / skill level to learn it from scratch. I'm setting up playfab currently but it doesnt have a clear pricing structure that I can see. Does anyone have any recommendations?

slim ridge
#

ur right. "other limits apply" how ambiguous

#

but looks like you can get by for a small project without paying

mint acorn
#

It's a trap, after creation project, check full limits inside project

#

@fierce niche

fierce niche
#

@mint acorn I've seen that said before (which is why I'm worried) but I cant find any limits that immediately seem too small (at least under my 10k registered user limit)

#

any idea what usually runs out first?

slim ridge
#

storage i'd guess

#

and probably these "capped at number of development mode users per title" thing

fierce niche
#

ATM I think im gona risk setting up with playfab and hope for the best TY @slim ridge

slim ridge
#

@dry wave what were you going to write your server in?

dry wave
#

Probably Java for now, and then check if something like NodeJS could be a better option

#

Of course if there is a framework to use I can just use that, just trying to avoid some weird in-between solution

slim ridge
#

it's a hard problem to tackle. in regards to networking and unity, it seems photon suite of products is the only player. (maybe spatialOS?)

or you could take the same route as me and write your server in an environment that makes sense to you and bend unity to your will to achieve determinism

dry wave
#

What I want for now is just so that my sync is actually there. So let's say I interact with a character, that I can check if the player is actually next to that character and not somewhere completely different

#

And then I don't have to delve into half a year old code later to put the sync in

#

Photon does peer to peer no?

#

& yes that's what I want to do, just have Unity as a front and send the data to the server, have the server handle the rest

#

The issue is that I have no clue how to for example, make other players appear in someone's Unity front

#

I can send data, I can do stuff with it, I can do security (basics not advanced), but I don't know how to do the sync back to the clients

slim ridge
#

ah ok, i got a good video for that somewhere...

dry wave
#

Also I don't know if APIs or Websockets (or something like that) are a better option

slim ridge
#

your solution will use TCP or UDP sockets

dry wave
#

Is that a question or a statement?

slim ridge
#

ok i lost the video ๐Ÿ˜ฆ but the basic concept is:
clients send their input to the server
server propagates this to other clients

dry wave
#

Yes but how do you send back position information around a certain player from the server

#

Like do clients just have info on ALL players in the game?

#

I'd assume only the ones that are nearby

#

If all it's quite easy though ๐Ÿ˜„

slim ridge
#

no, server should have authority over everything

#

it's pretty easy to intercept and modify packets coming from your computer

dry wave
#

No I mean does the server send ALL player info all the time to clients, or only the player info of players nearby

#

I didn't mean that one client sends its info to the others

slim ridge
#

the server is telling clients what's what. you could do both ways you just said

dry wave
#

For example, I have an Interact() method now, the player uses this to interact with any interactable in the game. There I'd send data that the player is attempting an interaction, and have the server check if that's possible, and what the outcome is.

#

That I know, but not what to do with moving parts not decided by the player's interactions

#

Yes, but how do you know if you should send certain info to a client

#

Like, when does the server send info about player A to player B

slim ridge
#

i think what you're talking about is determinism

#

which means, given the same input all clients will result in the same output

dry wave
#

Also, should I use UDP to update other player's information and interactions in general in the world (e.g. moving NPC) or and TCP for what my player does, or both TCP?

#

which means, given the same input all clients will result in the same output
@slim ridge Yes

slim ridge
#

then all your server has to say "this thing is happening here" and all clients will know how to handle that

dry wave
#

Yes, but that part I know

#

But when to send the info I don't

#

If player A click on a furnace I know he wants to use the furnace

#

If player B moves closer to player A, how do I know player A should see him?

#

Also, isn't it insane to send player B's transform every x ms?

#

An NPC can move in the game world and then be corrected by the server, but a player can't

slim ridge
#

the simulation has to run on the server too

dry wave
#

Yes, it will

slim ridge
#

and you'd write the logic of checking proximity into your server

dry wave
#

So it's like player B is 100 distance from player A you send the info in every call?

slim ridge
#

no, just the input since both clients will determine the same result

dry wave
#

So all players have info on all players?

slim ridge
#

instead of sending the transform each frame you'd send one message that says "move from here to here"

dry wave
#

But that's the transform no?

#

How else do you know?

#

Thanks for helping me understand this better btw

jade glacier
#

Unless you are deterministic, there needs to be a state authority and that needs to replicate to all clients.

#

Couldnt tell by browsing the above what the question was.

slim ridge
#

it's a complicated article but probably explains better than me

#

listen to emotitron he knows this stuff better than me

jade glacier
#

It's all pretty boilderplate advice, same as others will give on the topic

dry wave
#

@slim ridge I didn't fully read it yet, but yes this is what I wanted to do. And this works perfect with my game since its click to move, meaning that I can send the destination. My question is more, when to send things. I don't think I should send all player info each time, only the nearby ones. But what is nearby? And what is the most optimized way of sending data, e.g. Tcp websockets (how does that work in unity+self made server)? @jade glacier

jade glacier
#

Sending a destination can be tricky, since that is relying on determinsm to play out the same on all clients

dry wave
#

Boilerplate is fine I just want a system early on and then optimize it later, just to already send the correct info and not having to redesign my code in half a year

#

@jade glacier how would it not play out the same?

jade glacier
#

You need to read up on what determinism means for that answer

#

That question would literally take me a day of typing to explain in generic terms

#

If you can remove all non-deterministic factors, you can do what you are saying. But that is not easy.

dry wave
#

I understand determinism, or at least I think I do. But I don't understand how if all elements are the same in 2 client that the character would not move the same

#

If you have good sources, even a book, please tell me. I'm really okay with spending time on this

slim ridge
#

read all of gaffer on games articles xD

jade glacier
#

All elements are 100% certain to be deterministically the same?

#

Then sure, will work great.

#

But, I seriously doubt they will be if you haven't gone to great lengths to ensure determinism.

dry wave
#

Don't understand why not, or at least close to

jade glacier
#

Yeah, thus why the research time is needed

#

determinism is a huge topic

#

Or, just try it

#

and see how it works out

dry wave
#

Alright I will look into it more

burnt axle
#

Is there a video/benchmark result of PUN? I see Photon has some videos on youtube where they show quantum framework in action by displaying 2-3 clients at same time and this looks really good - no noticably lagg, very smooth and fluent.

#

Maybe it's something misconfigured on my end but i wasnt to impressed with the multiplayer experience using PUN, it was noticably laggy. Quantum is probably really smooth because it uses the deterministic technique (and probably other stuff too).

#

So i just want to see if someone have taken the effort to put up a benchmark result/video of how good PUN can be using simple games.

night plover
#

Determinism doesn't have anything to do whether there's lag or not

burnt axle
#

For information, i tried the PUN on a simple game where very little is synchronized. Only a cube's transform component per player is synced.

#

Really? Isnt it supposed to do the next synced move locally first, then correct/verify it by the actual network later on, and this is what creates the smooth movement?

burnt axle
#

I forgot a little about what deterministic simulation is again, i somehow thought it predicted the state for remote players which is impossible, when it actually predicts the state of the local player in a server authoritive model. The local movement is fine, its the remote movement which is laggy.

#

Nevermind my request about PUN in action, i tried out some games using it and its pretty good so the laggy state is on my end ๐Ÿ˜›

slim ridge
#

determinism vastly reduces the amount of data you need to transfer

#

it allows clients to predict state because determinism means the same result is achieved by the same input. (you only need to transfer input data)

burnt axle
#

So instead of sending the transform component, you just send the input so recieving clients use the input to move the player "locally"?

slim ridge
#

yeah, you send the initial state once when it's relevant to the client and they can control it using input data after that

burnt axle
#

I can definitely see how that is reducing the bandwidth on larger games that synces alot of data. I was wondering about this the other day when thinking about how larger and complex games that synces alot of data deals with the bandwidth limits.

slim ridge
#

i'd recommend examining the bandwidth usage of several games. You'd be surprised how bad some of them are

burnt axle
#

Yeah im actually trying to get info on it now. Pun for example has 60GB bandwith limit in total for 20CCU. Is that accountant for outgoing and ingoing bandwidth? And what is the rate limit of the bandwidth?

gleaming prawn
#

@burnt axle

The local movement is fine, its the remote movement which is laggy.
Not really, both are predicted, so neither is laggy

#

predict/rollback determinism (whose simplest possible implementation, GGPO, is popular with fighting games communities - aka rollback netcode) uses input extrapolation to predict the whole simulation (not only the local player)

#

This is what quantum uses (I#m one of the engine developers)

#

@slim ridge prediction can be done WITHOUT determinism... just transfer input and do local extrapolation
What you gain with determinism is the ability to transfer ONLY input and get both Prediction (via predict/rollback) and synced results (via determinism over verified frames)

jade glacier
#

I assume Rocket League isn't fully deterministic, but it does extrapolate for sure.

#

I believe it does state transfers

#

I would say the "smoothness" of Quantum is actually counter to what it is really doing. The constant resims if shown to you in their raw form would be jittery as F

burnt axle
#

@gleaming prawn Thanks for answer.

jade glacier
#

State Transfer with interpolation is inherently "smooth" but that is because it is working with known historical states rather than extrapolated guesses

gleaming prawn
#

@jade glacier physics objects are inherently Smooth, because simulation of loose objects is always driven by physics, not network.

#

What could be jittery are remote player movement in those moments they change direction

jade glacier
#

I assume though until a missed input prediction, if that was shown immediately as the new sim result it would lurch

#

yeah, was referring to that

gleaming prawn
#

THat we smooth out using an error-based interpolation mechanism

jade glacier
#

I think we are on the same page

#

Just clarifying that determinism wasn't making smoothness, that is still the lerping operations

gleaming prawn
#

But we're talking about 2-5 ticks of rollbacks... SO it's tiny smoothed fixes

#

yep

burnt axle
#

I just observed the bandwidth usage of active gameplay in CSGO with 10 players, it only used 50kb at average. My ISP provides 50MB up and down so it only uses 0.10% of available bandwidth.

gleaming prawn
#

CSGO AFAIK sends full state snapshots, with delta compression... But their game states are also tiny

burnt axle
#

In comparison, a 4K video on youtube recieves 3000kb/s ๐Ÿ˜›

slim ridge
#

imagine a game with states as big as 4k video frame LOL

burnt axle
#

Lol. And netflix used the same amount as youtube 4k video despite being 720p (maybe 1080p, didnt look that good).

jade glacier
#

video streams buffer WAY ahead though and don't skate the razors edge of trying to get and consume packets with as little buffer time as possible.

sinful niche
#

Hey guys, does anyone have any experience with PUN's Photon Animator View? I cannot get it to work for the life of me ๐Ÿ˜ฆ

jade glacier
#

How are you trying to use it currently?

#

@sinful niche

sinful niche
#

I have a GameObject prefab which has an animation for rendering a 2d sprite walking. The Photon Transform View is working fine, however no matter what settings I utilise for the PAV none seem to work. This is what it looks like - I'm not sure if using 2020.1 is causing the problems

jade glacier
#

can't speak to 2020... haven't even touched that. 2019.3 is buggy enough for me already. ๐Ÿ™‚ Is the animator just not replicating ANYTHING at all?

sinful niche
#

The animation works locally, just not on other clients

jade glacier
#

The vanilla pun animator isn't the most comprehensive but it usually gets some kind of working result.

#

You can try the beta SyncAnimator which is quite a bit more intensive, but you do have to add the whole beta to your project to try that, so I would save your git first.

#

Before trying that - do you have all of your controller code disabling when not IsMine ?

#

ie- you are sure your controllers aren't stomping on any syncing remotely

sinful niche
#

Thanks! I do have the controller code doing so. I may also try the legacy one

#

I did last test that an hour or so ago though so I shall double-check beforehand

jade glacier
#

Converting stuff not built specifically for networking to do networking is usually a game of hide and seek like that.

sinful niche
#

Yeah, I only have basics so I hooked it all up today and this is the smallest thing not working but it's enough to drive me insane ๐Ÿ˜‚

jade glacier
#

Some controller code uses triggers, which might not serialize right, since they happen to fast.

#

SNS has passthrough methods you use to catch those. I don't recall if the vanilla PUN animator view has them or not.

sinful niche
#

Yeah I've avoided triggers

sinful niche
#

So in my "Update" function for the controller attached to each prefab, it hits IsMine as often as !IsMine as expected

#

Ok - so I done some detection of if not IsMine and looked at whether the animator.GetBool that starts the movement animation was true...it was recieved false on the client, so there seems to be some kind of issue in that property being transferred

#

...so it randomly started working...thanks guys!

jade glacier
#

Wacky

dry wave
#

@jade glacier @slim ridge So as requested I looked into determinism, and read a lot of other articles too. I understand better how everything should work, but I can't find any articles on what data best to send. I know what to send TO the server, but not what to send back from it. What is too much? What is required? I can't those answers. Do you have any sources I could read?

jade glacier
#

You ideally are just syncing player inputs, that is one of the main advantages of a full deterministic system

dry wave
#

Yes, that I understood indeed

#

But what if a player interacts with an NPC for example. How much of that NPC data do I send

#

That's what I don't know yet

#

Or if another player uses an animation. Do I just send the start of it, or do I send it frame by frame

jade glacier
#

The server is just the final word on what each player inputs were each tick

#

To ensure every client has the exact same input history

dry wave
#

But I understand the input, but not the output

jade glacier
#

There is no output, that is the point

dry wave
#

Then how would stuff be displayed?

jade glacier
#

Locally simulations produce new states

#

By simulating each tick

#

And that produces the state results

dry wave
#

But if Player A moves, on Player B's screen. A local simulation is not doing anything if Player B doesn't know how Player A moved?

#

So there is always some kind of output

#

But I don't know what exactly that would be

jade glacier
#

It knows what player A's inputs were

slim ridge
#

server would tell player B when player A is close enough along with player A's state (as it relates to player b)

dry wave
#

@jade glacier The server knows yes, so what do you send to the other players

jade glacier
#

The inputs

slim ridge
#

initial state and whatever input comes after that

dry wave
#

@slim ridge What does state entail, what data is in that state

jade glacier
#

Every player gets every other players inputs

slim ridge
#

everything the client can't figure outon it's own

dry wave
#

@jade glacier You just said there is no output?

#

That is output from the server to players

jade glacier
#

I'm out of ways to reiterate the concept, sorry

slim ridge
#

for example: for simple objects that change position the initial state would just be a position

dry wave
#

So what exactly would be in that output, position data or input? Because if it's only input how would a player know if an NPC moved

jade glacier
#

The same way it knows anywhere

slim ridge
#

a more complex state might include animation state, identifiers for different assets that need to be rendered or associated with it, etc..

dry wave
#

So you would send, for example this (let me write something):

jade glacier
#

Npcs are deterministic, and their actions are produced by the simulation..
The same on all clients

slim ridge
#

another way to describe it is like designing a conversation between your server and clients

dry wave
#

{
playerA:
position:x,y,z
animation:0,
rotation:x,y,z
...
npc1:
position:x,y,z
animation:0,
rotation:x,y,z
...
}

#

Or not?

slim ridge
#

yeah

dry wave
#

And you do that for any NPC / object / player in the vicinity of the player yes?

#

On every frame

#

When applicable ofc

slim ridge
#

yeah you'd have some loop on the server that decides all this

dry wave
#

Only the changed ones

#

Maybe I didn't explain my point of view correctly yesterday then

#

I'll look into that Azure link you sent me, see if that helps me set something up, otherwise I'll write it myself.
Thanks for the help

#

For anyone that could use it

#

That's page 3 though you have to go to page 1 first

jade glacier
#

If it's full determinism, the server doesn't need to run the sim.

azure quail
#

@jade glacier in practice wouldn't you usually want server to run sim tho?

  1. if you want people to join mid-game server should be able to send current game state
  2. if you want to record game results at end of a match e.g. xp earned or who won/lost

just wondering if there's something i don't see

jade glacier
#

If you need to account for late joins or disconnects it's useful yeah

dry wave
#

So back with another question. Been looking even more into all of this, and found one decent tutorial which I've been skimming through to get a better view on the full setup. One thing I don't get yet though is collisions. Assuming you don't want to run a simulation of your game on the server, would you define every object in your game on the server via code? Or how would this work?

slim ridge
#

in full determinism you'd define every object in your state

dry wave
#

But your state is just object and their transform no?

slim ridge
#

the state of one object

dry wave
#

My question was more about how it would work

slim ridge
#

your whole simulation has a state too

dry wave
#

Which is what exactly?

slim ridge
#

everything's transform

dry wave
#

Yes. So my question still stands, how would that work?

#

Do I define all objects in code, or how would that work?

slim ridge
#

i dunno, what tools are you using?

dry wave
#

What tools do you suggest? ๐Ÿ˜„

slim ridge
#

i can't help you with photon

dry wave
#

Not photon that's peer to peer

slim ridge
#

but that's what everyone suggests

#

photon is not just pun

weak plinth
#

Has anyone here had major issues with webRTC crashing mac builds?

slim ridge
#

photon = mommy of bolt, pun, quantum

dry wave
#

Okay. To answer your tool question, none I assume

jade glacier
#

Pun more specifically is relay. There is a server, but it's very generic and doesn't run any simulation. It handles connections and relaying messages.

#

As such, it is a client authority system in most cases, unless you write server plugins to give the server more logic.

dry wave
#

Okay. But does anyone know the answer to my question? Or do you need more specific information?

#

Or just a direction you could send me in to find the answer would be really appreciated too

jade glacier
#

I'm reading on a phone here, so not sure what question you are looking to have answered.

dry wave
#

How to handle collision detection, or at least validation of a player's location, on the server side. Theoretically I understand how to do it, but how would I go about having all my objects (transforms) to check?

#

Would I need to define all of them in code? Do I have my game world running on my server? How would this work?

#

Basically if possible how do I get the world defined in Unity, but without rendering it, so I can just check transforms

jade glacier
#

For what kind of architecture? I don't know what you are making or what lib sorry.

dry wave
#

I don't know why that exactly matters, but I'm just trying to make a simple server for my game

jade glacier
#

Most people just use the built in physics

dry wave
#

Yes, but how would I do that without rendering anything? + Then I have to use a Unity build as a server no?

jade glacier
#

So by server you mean you are doing server authority started transfer?

#

Like with mirror?

dry wave
#

What I mean is, the player clicks, the servers moves the player. The player clicked into a wall, the server should know there is a wall. How does it know there is a wall

jade glacier
#

That is full server authority then. There server has to run physics.

dry wave
#

Yes I know, but how would I do that without rendering? ๐Ÿ˜„

#
  • then my server would be a Unity build, or not?
jade glacier
#

By building it out as headless

dry wave
#

Aha, I did not know that was an actual option. That already helps a lot

jade glacier
#

Has to be Unity, unless you plug in your own physics engine or simulation

dry wave
#

Yes I expected that, but if I can do a headless build I guess that should be fine

#

Thanks a lot for that

jade glacier
#

Np

sacred patrol
#

Oh hey there emotitron. Glad to see fellow competitors active in this chat.

sacred patrol
#

Getting hammered with support requests yet ? It's been crazy month due to things happening atm.

jade glacier
#

Heya. On which front do we compete? Are you an asset maker?

sacred patrol
#

Simple Network Sync and AnySync

jade glacier
#

assuming yes by the color

#

ah, right on

#

Just the usual sorts of questions, usually how to make server authority work and such.

#

Mainly working on expanding it to become part of core PUN2 stuff for Exit.

sacred patrol
#

Oh ye, everyone wants fully authoritative movement for some reason.

jade glacier
#

The asset itself is pretty drag and drop (until Mirror pushes breaking changes on me)

#

So I don't hear too much thankfully on the support front

#

Which they did right when I came down with my fever with Covid... literally the next morning I had two emails waiting for me saying it was throwing errors in Mirror... so that was fun.

sacred patrol
#

Mainly working on expanding it to become part of core PUN2 stuff for Exit.
This is great. The lack of proper sync tool for PUN2 and UNet was the main reason why I decided to roll my own.

jade glacier
#

Yeah, its a pretty common problem for the mid level apis

sacred patrol
#

Damn dude, get well. I don't want your customers because my stuff is designed strictly for network programmers.

jade glacier
#

Mostly over, just lingering cough stuff. We got off pretty easy if it was it.

#

I only was really full on trainwreck for about 2-3 days

#

So no complaints

#

I don't get the impression we overlap much in our asset usage. I don't really make much from it anyway, it more just has a price tag to keep it from being free. Free assets = cesspool of reviews

sacred patrol
#

Oh yea. I learned not to make free stuff a while ago.

jade glacier
#

Free assets = users dumping 20 free assets into a project = them then giving all of those assets 1 star for "not working"

sacred patrol
#

Free stuff = free review bombing.

slim ridge
#

free stuff is great, i want a better rating system

jade glacier
#

I would have kept it free, but Unity admins make NO effort to curate.

sacred patrol
#

I barely make anything these days either. It's very rare to spike over $100 a month.

jade glacier
#

If it was easy to purge that dumb negative reviews that had no business being there... I would still have my old libraries up on there for free.

#

About the same, I suspect the people who buy one of ours buy both.

#

and SS as well

#

Usually my help requests consists of "Tried the built in one, SS and Anysync... does your do XXX?"

sacred patrol
#

Wow lol. Thanks for letting me know that.

jade glacier
#

SS gets most of the sales I think. First to market and all.

#

And they also really try to sell it as a business.

#

I literally try to convince people to not buy my stuff.

sacred patrol
#

Same. I'm better off working on contracts instead of spending precious time on support. I'm basically telling them "go away, buy SmoothSync instead".

jade glacier
#

They aren't worth the $8 for me to be obligated to maybe support them later.

sacred patrol
#

I'll send them your way instead now c:

jade glacier
#

I don't agree with SS's architecture choices, but it works for what most people are looking to do. So good enough.

#

I removed official Mirror and MLAPI support, and PUN2 they can get it basically free with the beta I have for that.

#

So I am TRYING to discourage people from buying it

sacred patrol
#

SS is basically just lerping the position, right ? It doesn't actually keep position keyframes but just lerp them as they arrive ?

#

I'm not sure because I've never tried syncing assets.

jade glacier
#

Its time based and doesn't do any kind of fixed buffer from what I have seen of it.

#

so it is prone to rubberbandyness and non-deterministic recreation in relation to other components.

#

basically the same issue I have with the vanilla stuff in unet/mirror/mlapi/pun

#

They just execute the smoothing and lerping much better

#

so it does what it says... it makes things smooth.

sacred patrol
#

I see. Well, honestly this was the exact thing I was trying to avoid.

jade glacier
#

But its still "bad" networking

sacred patrol
#

But uh, whatever works for customers is good.

jade glacier
#

yeah, if the rest of their game isn't tied to a fixed tick and a simulation, its not going to matter much anyway

#

its all just squishy timey whimey anyhow... not my place to try to fix that for them.

sacred patrol
#

But this approach swallows netcode quality issues. When it comes to my solution - one wrong variable or one wrong setting and you're pretty much screwed.

#

Jittering all over the place, sliding way off screen, sliding while idling

jade glacier
#

Sounds like a recipe for a support nightmare yeah

sacred patrol
#

You name it - I've dealt with it on a support ticket.

jade glacier
#

I didn't even incorporate handling for anything time based

#

Its all strictly on its own fixed update based tick singleton... so all the users can play with is SendEveryX physics tick

#

Makes for a lot less support issues, since it basically acts like they are on a simulation.

#

If they arent... it still works, just less than ideal.

sacred patrol
#

I see. Well mine is kinda similar, but I still detect time drift (in case of lost packets that lose time delta, temporary app freezes, etc.) and slightly nudge it into a correct timeframe

jade glacier
#

yeah, my original asset was like that

#

NetworkSyncTransform

#

but when I started to adapt that code base to do deterministic server auth stuff I changed it up to be a fixed tick without any squishiness, other than an Overwatch style handling for buffer reduction where clients would actually change their simulation rate to make the server happy.

#

But that going backward to SNS translated into a hard fixed tick, and the only adjustment occurs if the buffers decide they are too large or small, but those hard adjust are rare.

sacred patrol
#

Going for deterministic is pricey, but always desired.

jade glacier
#

The benefit there is it is conducive to an entire system of components and such

#

Its not actually determinstic, I just wanted my core buffer and timing systems to play nice with deterministic when i was doing work on that.

sacred patrol
#

I see. Mine's other way around. Mostly designed for trusting the client, but still work for authoritative servers.

jade glacier
#

Yeah, I think yours is in the vein of NST and SS

#

I made SNS really as just a gateway to simulation based ring buffers for people interested in getting away from adhoc timings

#

And made it possible for me to build a whole component set on top of it

sacred patrol
#

Noice. At least now I know where to send people asking about authoritative setup.

jade glacier
#

It doesn't solve that problem though, its just the tick/frame buffer engine from it.

#

Bolt is the only working answer to server authority atm

#

You can't do it without manhandling the controller code and the simulation code in the networking library

#

and Bolt is the only one that has a layer that codegens for those

#

I built it trying to make a server auth engine, but I ended up having to write so much I said F it.

sacred patrol
#

Getting a working client-side prediction and time rewinds is pretty much a suicide when it comes to unity, so props to fholm for getting that done.

jade glacier
#

I had to write the controller generation, the input capture, and the controller physics in order to make rewind possible. It is too much to make "just work"

#

He made his own colliders and such in Unity 4 to make it happen. And it was a support nightmare as a result.

#

So yeah, I don't touch that.

#

If people want real server auth, they need to learn to code ๐Ÿ™‚

sacred patrol
#

I had to write the controller generation, the input capture, and the controller physics in order to make rewind possible. It is too much to make "just work"
Omfg.

jade glacier
#

I literally was recreating Bolt... so I ejected on that idea.

sacred patrol
#

If people want real server auth, they need to learn to code ๐Ÿ™‚
That's what I've been telling my customers the whole time. Even I myself try to avoid server auth whenever I can afford to do that.

jade glacier
#

At least with prediction

#

if they want server auth without prediction, that is easy as can be. Send inputs to server... server sends states to all including the player. But that input lag is going to be objectionable.

sacred patrol
#

Yeah, player experience should never be sacrificed for anything. Input lag in most games is simply not an option.

jade glacier
#

Stadia... cough

sacred patrol
#

I'm not sure why it exists.

#

But we're talking about realtime games. There are games that aren't realtime, right ?

jade glacier
#

They have some pretty first persony games on that platform that I can't see feeling good

sacred patrol
#

So uh, what are you working on besides the asset ?

jade glacier
#

Just general work on PUN2 at Exit

sacred patrol
#

Noice.

jade glacier
#

Its kind of the older neglected asset since Bolt and then Quantum came along

#

so its been needing some love

#

Quantum is nothing short of amazing, looking forward to working with that.

sacred patrol
#

Yeah, I can imagine that it's amazing. I've almost got my hands on it with one of the companies, but things weren't meant to be.

#

I was very sad about it.

#

But then I remembered the added difficulty that deterministic simulations imply and moved on.

#

Finally I've got some time working on my own project, since the world economy is pretty much paused at this point and nobody has spare money to pay for my services, since I'm just a contractor.

jade glacier
#

Game networking isn't going anywhere at least.

vivid owl
#

can I get some help on MagicOnion

#

@amber trench I'm trying to figure out a way to have shared data in a hub in MagicOnion

#

as far as I'm aware, each connection gets a separate instance of the streaminghub, even if they're in the same room

#

also where are a good place I can get documentation for MagicOnion?

vivid owl
#

the question is, how do I communicate data between the streaminghubs

amber trench
#

In my experience you can use something as simple as a reactive collection to achieve most of what you need

#

@vivid owl but yeah somewhere you will simply use a field on the room? I think that will be fine

vivid owl
#

I've looked into that

#

but do I have a separate room manager?

#

like this

#

MagicOnion doesn't define the concept of room in itself

#

so I would need to write my own

#

which would mean that I need to handle room load balancing myself

vivid owl
#

one question

#

how would I make sure the two Unity clients are connected to the same pod, in a kubernetes cluster setup

dry wave
#

Alright back on it again. Found a decent tutorial series, and also bought a C# networking book. I have a big question left though. Would TCP or UDP be the preferred choice? Most interactions are quite slow paced (think RuneScape, World of Warcraft, ...) but other interactions are slightly faster-paced, yet not as fast as an FPS (think League of Legends, ...).
I know World of Warcraft uses TCP and it's still covering 1v1 PvP in the open world, League of Legends uses UDP (I think) with a tick rate of 30. Runescape has a tick rate of only 10.
But when using UDP I'd have to make sure that things like item buys, player interactions, etc are for sure coming through right? And I could use TCP disabling Nagle to have no delay but then would I still have too much overhead or would that be fine?

winged sun
#

@dry wave The thing that will slow you down your game is not TCP vs UDP debate but the implementation of memory management and packet handling.

dry wave
#

@winged sun Yes I know, but I'm speaking only of TCP vs UDP right now. It makes sense that if you implement either badly that it'll slow down your speed significantally, but imagine both are implemented correctly.

tribal vessel
#

@dry wave If you use UDP, how do you know if the client recieved the information?

dry wave
#

@tribal vessel By sending ACK packets.

winged sun
#

@tribal vessel You write the thing that TCP does by yourself.

dry wave
#

Part of it, not all

tribal vessel
#

so.. ah

dry wave
#

TCP does more than just sending ACK, + you'd not re-send insignificant data.

tribal vessel
#

also TCP auto resends data that was recived with an error in the bits. right?

#

dont we have to ASSUME there will be tramsisison errors?

winged sun
#

@dry wave I use UDP because SteamNetworkingSockets use UDP. Thats actually the only reason. I can also recommend ENET C# by nxrightthere. These are both UDP and work pretty well. And the only reason I recommend these is because they are well made not because they are UDP.

dry wave
#

@tribal vessel All that is covered in my question, errors in positioning is fine if you have a tick rate of 30 for example

#

@winged sun I'm building it myself.

tribal vessel
#

I don't understand.. couldn't the error be the most signifcanrt bit of a coordinate?

winged sun
#

I dont recommend doing that. but you can ofc do whatever you like.

dry wave
#

No, a few milliseconds after you have a new position. That small amount of time isn't visible

tribal vessel
#

(thanks for the explanation by the way.. sorry to jump in on your Q)

dry wave
#

@winged sun I just need to simply send and receive data to sync clients right now. Everything on top of that is for later.

#

I can always replace stuff once I have an interface with a working prototype

winged sun
#

@dry wave ENET is exactly that. The only thing it does it sends packets.

dry wave
#

Yes but by using a library I don't know exactly how it works

#

Thanks for the tip though I'll for sure look into it, for now just wondering about my question above

winged sun
#

wow is 10 years old and the networking sucks. and runescape is webbrowser game so they do things that you would usually not do.

dry wave
#

@winged sun Abut WoW: yes exactly, networking has improved a lot of the last 10 years, so makes TCP more viable. Runescape is not a web browser game.

winged sun
#

what runescape do you mean

dry wave
#

?

winged sun
#

oldschool or runescape?

dry wave
#

Either

winged sun
#

they are both browser games. idk what to tell you.

dry wave
#

@winged sun Yes, sure, you win the argument. Can you now please reserve this channel for networking questions?

#

Alright back on it again. Found a decent tutorial series, and also bought a C# networking book. I have a big question left though. Would TCP or UDP be the preferred choice? Most interactions are quite slow paced (think RuneScape, World of Warcraft, ...) but other interactions are slightly faster-paced, yet not as fast as an FPS (think League of Legends, ...).
I know World of Warcraft uses TCP and it's still covering 1v1 PvP in the open world, League of Legends uses UDP (I think) with a tick rate of 30. Runescape has a tick rate of only 10.
But when using UDP I'd have to make sure that things like item buys, player interactions, etc are for sure coming through right? And I could use TCP disabling Nagle to have no delay but then would I still have too much overhead or would that be fine?

jade glacier
#

Have you completed a small multiplayer game of any kind yet? Or is this going to be your first?

dry wave
#

@jade glacier No I have. But not with Unity, nor C#

#

And it didn't matter much back then how fast it ran or anything, it was just a small project. So I understand how everything works, but not fully what the best options are.

dry wave
#

@tribal vessel Since you were asking about this earlier. My book says the following: "UDP has no handshaking or acknowledgment signals to indicate whether a packet was properly transmitted from host to host" The handshaking part is quite important too, not just the ACK

tribal vessel
#

Ineed, and I don't see how you COULD do handshaking with broadcast packets. Or, CAN UDP be used for peer 2 peer?

dry wave
#

You could code the handshake yourself but then you really can just use TCP

#

That's why my question above was purely about latency

tribal vessel
#

I get the TCP part... not seeing how it would work with broadcast packets tho.. wouldn't EVERYONE see you handshake acknoledgements?

dry wave
#

I have no idea

#

Maybe I could tell you after finishing the book, no clue how in-depth it goes

tribal vessel
#

ok. suspect I'm just off base on what "broadcast" means with UDP

slim ridge
dry wave
#

Already read that

slim ridge
#

also dont forget you can use both

dry wave
#

Yes, but when I looked into that a lot of articles said that's a bad idea.

#

You could if the functionalities are separate, for example your chat and your game systems, but having both UDP and TCP for the game system would be a bad idea.

#

Although I have been wondering why not use TCP to send information, and UDP to receive it?

slim ridge
#

it's fine as long as you maintain control over their concerns

#

TCP and UDP doing the same protocol is a bad idea

#

is what they probably meant

dry wave
#

Although I have been wondering why not use TCP to send information, and UDP to receive it?

#

What about this?

slim ridge
#

it doesnt work that way

dry wave
#

Why not?

slim ridge
#

you cant send a tcp request and get a udp response

dry wave
#

Yes, but why not?

prisma girder
#

TCP is a connection-oriented protocol.

#

UDP is connectionless.

slim ridge
#

because they both must bind to a port

prisma girder
#

Also known as stateful vs stateless.

dry wave
#

Use two ports?

prisma girder
#

UDP doesn't actually have to bind to a port per-se.

#

But that's unrelated to why TCP can't get UDP responses.

#

TCP works by acknowledging packet send and receipt on both sides, for every packet (almost).

#

If you send a TCP packet, you must receive a TCP ack at some point.

#

Otherwise the TCP sending stack will resend it, assuming it was lost

#

UDP has no such insurance

slim ridge
#

use TCP for things where the response is required for whatever system to move forward, use UDP for things where response is not required or can be dealt with after the system moves forward

dry wave
#

I didn't say you can't send the ACK

prisma girder
#

They're not the same protocol. You can't respond with UDP

dry wave
#

But why not two streams, UDP incoming and TCP outgoing

#

(on client)

prisma girder
#

If you want to use two streams, that's fine, but they will remain unrelated as far as the networking stack is concerned.

dry wave
#

So going back to my original comment

#

You can just have UDP incoming, for transform updates. And TCP outgoing, for player input

#

But would that in any way be beneficial?

slim ridge
#

you're overthinking it drissy

prisma girder
#

Depends. Many netcodes differentiate between reliable vs unreliable delivery. Some of them try to reimplement TCP on UDP to make it reliable, but that's really unnecessary imo. TCP provides the options to make it a fine choice

dry wave
#

@slim ridge How is that?

prisma girder
#

Primarily by disabling the Nagle algorithm and using selective ACKs

slim ridge
#

you're thinking so far ahead without trying anything

dry wave
#

Link is to my original question (or a copy of it)

prisma girder
#

For reliable delivery I'd pick TCP over reimplementing reliability on UDP, yes. Bare minimum, the internet routing infrastructure is heavily tilted towards favoring actual TCP.

dry wave
#

@slim ridge I'm just trying to understand everything that's all, to see why certain things would work better / worse

slim ridge
#

seeing for yourself is better than trusting ppl on the internet

prisma girder
#

If it's tuned poorly, you can get inconsistent performance, but it's not 1998 anymore

dry wave
#

@slim ridge I bought a book though ๐Ÿ˜„ (book incudes code)

slim ridge
#

you're going from hypothesis -> hypothesis without any experiment

#

and trying to solve problems you haven't even encountered yet

prisma girder
#

FYI, I do this for a living. Just changed jobs but I was a cloud network architect for 10 years at a hosting provider. I can probably answer any questions you have about network protocols

dry wave
#

@prisma girder What I'm struggling with the most is understanding when you would be okay with losing data and when not

#

In a videogame context

slim ridge
#

i'd do the whole thing in TCP until i can actually test lag situations and make informed decisions about what to do next

dry wave
#

I understand it outside of that

prisma girder
#

Well that depends. If you're writing a replication system yourself, and wanting server authoritative, then you care that the server gets accurate client input.

#

You don't care as much about accurate position/velocity transfer from server to client, since deltas are usually small and missing packets will get corrected

jade glacier
#

Largely going to come down to your state replication model as well

prisma girder
#

^

#

The next big question is how many replicating objects you have, and how many clients, and then how do you plan to multiplex the streams.

jade glacier
#

If you are going for fast and unreliable, you need a mechanism for eventually getting things into agreement if something gets lost

dry wave
#

"The next big question is how many replicating objects you have" What do you mean with replicating objects?

jade glacier
#

You can send a separate reliable channel, but you will the have to account for the asynchronous nature of the two channels.

prisma girder
#

Anything that has state in your scene

jade glacier
#

race conditions are networking hell

prisma girder
#

It's also worth mentioning, UDP really isn't that unreliable. Again, it's not 1998. Yes you need to architect around dropped packets, but you should realize that these are "My wifi is disconnecting" and not so much "Oh yeah you just lose 20% of those all the time"

dry wave
#

Ah. I don't know if this answers it, but what I thought of doing was have all physics logic on the client as well as on the server. Then based on the client input the server would know if there is a collision or not, and then send the position of the players back. (or npcs etc)

jade glacier
#

you just have to account for lost packets, and make sure they aren't going to break anything

#

like a lost transform state is easy to deal with... a lost "pickup item" can be a bit more pesky

dry wave
#

Yes, I understand it's not unreliable as in: if you lose 20% it doesn't matter because you send x packets per second anyway, no one notices it. But if the player consumes food for example, I want that food to be consumed and that interaction not lost.

#

So that's what I'm struggling with to understand.

#

For updates server -> client UDP seems fine for sure, the other way around I don't get, as in it seems that TCP is (almost) mandatory.

jade glacier
#

Typically then you let the server be the authortity to avoid that headache

#

the player sends inputs, or "I try to eat this food" to the server....

#

And the server then simulates what happens to the food and the state results... and replicates those to clients

#

So worst case without any replication of lost packets... the food goes uneaten

dry wave
#

That I understand, it makes complete sense. But the "I try to eat this food" input can get lost with UDP no?

jade glacier
#

and the player has to try clicking again

dry wave
#

So you implement your own ACK for input or?

prisma girder
#

Yes, it can, in theory, in which case your replication model becomes "try to do this"

dry wave
#

Player having to click it again is unacceptable.

prisma girder
#

There's several ways to deal with this.

#

TCP is one.

#

ACKs is another (reimplementing TCP in UDP)

jade glacier
#

OR you employ RUDP and force that packet to be reliable, but that can create the logjams you are avoiding. Which leaves you with the player needing an ack from the server for that tick... and if it doesn't get it sends another request.

prisma girder
#

But a more sophisticated approach is to merge state deltas

jade glacier
#

There is no one answer to this problem, the problem itself is the nature of high level game networking.

prisma girder
#

Client gets click, knows state should change, sends delta to server, server is always sending deltas about state changes to client

jade glacier
#

You employ the right answer for the game type and requirements of your game.

prisma girder
#

If client doesn't receive updated state from server, it's able to keep sending its desired state

#

Until the server state matches.

jade glacier
#

You will have to resolve disagreements if say your packet gets lost... some other player says they ate it next... and that gets to the server first.

dry wave
#

But then what if the client is modified, the state would never match right?

prisma girder
#

Welcome to decades of "how do I deal with merging multiple states over asynchronous channels"

dry wave
#

Trading is another example, imagine you trade an item to another player and only one of them receive the traded item.

jade glacier
#

Which is why doing this by hand is just best avoided, and its better to just come up with a server authority model that just doesn't break when these things happen, and the players have to live with some weird behavior when packetloss is present

prisma girder
#

Step 1 is a single point of truth. That means clients may try to do something and fail.

#

Which must include inputs and clicks

jade glacier
#

If the player tries to eat the food and its in the middle of their connection losing packets... some weirdness isn't going to end the world.

#

Or make it all reliable, and deal with the logjams.

slim ridge
#

do the transaction somewhere reliable like a database

jade glacier
#

You still have to unwind race conditions that played out wrong.

dry wave
#

But, how much slower is TCP really?

prisma girder
#

If you assume that the client is always right, and can never fail at an input or activity that involves a shared resource, then you have invented an unsolvable problem

dry wave
#

If you just disable Nagle

#

Would it be that much slower really?

#
  • you could have a 100ms cache like in the article micken linked
prisma girder
#

TCP without congestion prevention algorithms and with selective ACKs and some other tweaks is perfectly performant

jade glacier
#

Like if the player says "I ate this on tick 9"... that gets lost... other player says "I ate this on tick 10"... if the first player finally gets its message that it ate it on tick 9... you have a choice.

sinful niche
#

Hey guys - apologies for breaking up the conversation into my own query here, but I've been trying for...a fair amount of time ๐Ÿ˜‚. I have a local PlayerPref that is stored that sets up an animator - setting the animation condition to play (it's a different sprite), however, I can't mentally piece together the correct way to do this, as what I think should work, only does so for the 2nd client to join etc, despite me using an RpcTarget.AllBuffered. Using Photon, small grab of the area of code mentioned provided.

prisma girder
#

Even with congestion algorithms, it's mostly fine

jade glacier
#

and that previous now wrong state has already been sent out.

dry wave
#

I'm copying that phrase @prisma girder

#

I'll look up what that congestion stuff is and see how to implement it later

prisma girder
#

Most resources online about TCP behavior are old. Decades old. Most don't even cover window scaling or how slow start mostly doesn't exist

#

So I wouldn't worry too much about TCP until or unless it becomes a problem

dry wave
#

The thing is I don't want to cover everything right now, I'm completely fine with having a mediocre solution. But I don't want to completely rebuild it later. So if TCP connection would be completely fine, I can do the basics of that and look into it more in-depth later.

jade glacier
#

@sinful niche not sure where all the usage of buffered RPCs is coming from, but generally that should not be the answer to anything. Relay and PUN doesn't work like that.

dry wave
#

So from all this I take it that TCP would be fine (with adaptations), and implementing UDP would make it way more complex.

jade glacier
#

Typically if you have a bunch of stuff you need to get from a client to inform late joiners, you will want to just send that when clients detect a new player joining the room.

#

@sinful niche

prisma girder
#

UDP isn't more complex really. Here's the thing

#

If you use TCP for reliability, yes, it will retransmit on packet loss or corruption

#

But if you wait for that, always, it may take a while with a lossy connection.

#

20% loss on UDP doesn't slow you down.

#

20% loss on TCP means you're stuck

jade glacier
#

Are you trying to go for razors edge low latency?

prisma girder
#

If you set very low timeouts, that's fine, but now TCP = UDP

#

So... you need to plan for desync no matter what

dry wave
#

@jade glacier League of Legends latency

jade glacier
#

What does LoL use?

dry wave
#

It was in my question, one sec I check

#

UDP tick rate of 30

jade glacier
#

its not the latency though, its more the tolerance for logjams

prisma girder
#

^

jade glacier
#

Like a quake type game, the buffers are very thin.. so if a packet doesn't arrive in time, its discarded anyway.

dry wave
#

Let's take Quake as an example, imagine the player shoots, you don't want that comment to disappear right? How is that handled

jade glacier
#

If you have a giant deterministic system in play, you might want TCP or RUDP all the way, to avoid desync hell

dry wave
#

Because I'm quite sure (most) shooters use UDP

#

@jade glacier Yes I do actually

jade glacier
#

If you shoot in quake and you lose those packets, I am not sure sure that shot does exist.

#

it doesn't rewrite history

#

because the server is a train that keeps rolling

#

and once it simulates, that is now the word of god

prisma girder
#

@dry wave You're not factoring in client prediction.

#

Maybe this is part of your confusion