#archived-networking

1 messages · Page 88 of 1

deep coyote
#

this is the game

teal violet
#

why this line returns an error? sound = DownloadHandlerAudioClip.GetContent(url);

#

url is public UnityWebRequest url;

#

and sound in AudioClip

ornate zinc
#

the webrequest is null, thats what it says

weak plinth
#

Hey, I'm using photon for networking and everything works fine. But for some reason, I have 2 players on 1 client. Can someone please help

keen laurel
#

hey folks

#

if i just want to make a chatroom, like discord but with 3d avatar moving around in my game.
before diving into network scripts, i want to know how costly it is and which service to use for a simple chat. firebase ?

#

there's plenty of services for this task and i'm just confused

somber drum
#

simply free chat + avatar movement? photon

#

@keen laurel

#

ccu (connected players at once) limit is 20 in the free tier though, mirror is another option (no ccu cap) but requires more knowledge for setting up a server, port forwarding etc

#

photon though I must say, you will get up and running the quickest comes with it's own chat / voice, players won't have to setup port forwarding they are simply connected + huge amount of resources available

#

reasonably priced for what it provides once you leave free imo.

#

@weak plinth check if local player before doing local player input

keen laurel
#

@somber drum thanks dude

#

so u advice photon and mirror, i want to use mirror !

somber drum
#

@keen laurel no worries :)
search for the mirror discord (not sure I can post here), lots of friendly people who know their stuff can help you get setup 🙂

weak plinth
#

Good Morning, I already had a good discussion with user here that helped me a lot, but I am still lost about porting my local "pass the screen" 2player game into PUN2.....
i started testing stuff (after tutorials) using RPCs that hide/show UI panels from the players, depending if it's their turn or not. and evidently it's the wrong way to do things.
but I'd love to have someone point me in the right direction, logic wise: the main gameloop.... so far, for my local 2p version, I have coroutines that go one after another and switch from player1 to player2 ....
I feel that for the online version I will do something like : a gameManager that deals with going from Turn to Turn, knowing whose turn it is...and sending an RPC (or a RaiseEvents?) to each Players telling them : it's your turn (you can show your UI / allow actions) or it's not your turn (hide your UI, block actions)....
should this be in the Update function of the gameManager? will this be run only in MasterClient ?
thks for your guidance !

hallow zinc
#

Hello, im trying to make speedhack anticheat but can't really figure out how to get the time between sent commands. Any ideas how to do it properly?
Here's my code

    [Command]
    void CmdSendPosition(Vector3 _position, float _playerAngle, float _cameraAngle, double sendTime)
    {
        double _timeDelta = sendTime - lastSendTime;
        Debug.Log(_timeDelta);

        if(Vector2.Distance(new Vector2(posDestination.x, posDestination.z), new Vector2(_position.x, _position.z)) > (movement.runSpeed + 0.5f) * _timeDelta)
        {
            ReturnPlayer(connectionToClient, posDestination);
        }

sendTime is player's NetworkTime.Time

short mortar
#

Does anyone know how to check if something is local in photon bolt

#

?

jade glacier
#

you mean owned?

#

local can mean a lot of things, so you might need to be a little more specific @short mortar

grand elm
#

How can I get unity to connect to a nodejs server using websocket and send and receive packets?

short mortar
jade glacier
#

I would join the Bolt discord for any Bolt specific questions first. Going to find a LOT more bolt users there.

short mortar
#

I asked there

#

no one is replying

jade glacier
#

I don't know Bolt well enough to give you a good answer. Just helping you clarify your question for others.

short mortar
#

if they are familiar with bolt or networking in general they'll understand what I mean

#

wait I think I found a solution

#

thank u for helping tho

#

really appreciate it

sly quiver
#

hey guys! I'm trying to spawn dynamically generated objects the same way on all clients (Mirror Networking) and could use a hint!

I found out that I should use ClientScene.RegisterSpawnHandler() for that, but I don't know how to link the asset id to the NetworkIdentity...

_currentPiece = child.gameObject;
NetworkIdentity nwid = _currentPiece.AddComponent<NetworkIdentity>();
Guid pieceAssetId = Guid.NewGuid();
ClientScene.RegisterSpawnHandler(pieceAssetId, SpawnPiece, UnspawnPiece);
NetworkServer.Spawn(_currentPiece);
#

as you see, the pieceAssetId is newly generated, and has no connection to the NetworkIdentity

#

the Mirror docs don't explain this any further

spring crane
#

You'll likely get better help in the Mirror discord

full girder
#

I am using the Asset Store Mirror package on Linux. I am trying to make a linux build, but I am getting an error saying that it
Failed running /home/thewhiterice200/UnityEditor/2019.4.4f1/Editor/Data/il2cpp/build/deploy/net471/il2cpp.exe
what is wrong here?

weak plinth
#

how do i check what my actor number is on photon

harsh dew
#

If I remember correctly there is a LocalPlayer property in the PhotonNetwork class that has a ActorNumber property

weak plinth
#

i am new to unity what is networking about?

digital urchin
#

~~Hey everyone :)
Working on a new multiplayer game and I am trying to find a fitting networking library. Here are a few things I am looking for:

  • Reliable and Unreliable UDP channels
  • Ability to do all functionality via scripts, potentially optional component usage
  • Ability to encrypt messages for things like authentication (no, I don't want to setup HTTPS servers and ping around messages on a backend that doesn't exist yet)
  • Self hosted, so no requirements on a third party service to run servers
  • Preferably open source, but I can let this one slide

Any options any of you know of that would support a lot of the above functions or requirements?~~
Answered

weak plinth
#

Socket Send/Receive in Unity do not work with Spans yet

#

Is there any way to work with unmanaged memory with these at all?

#

Is there any Socket.IO library/package that is still being worked on?

graceful zephyr
#

@weak plinth use native sockets

#

Only way to get decent perf out of it anyway

graceful zephyr
weak plinth
#

Good morning,
About CUSTOM PROPERTIES in Photon PUN2

  • do custom properties attached to players keep their data when changing scenes (photonnetwork.loadlevel) ? (players are already entered a room)
  • when I enter my new scene, i try to retrieve my CP and i get a nullreference .... (in the previous scene, i attached my CP like _myCP["tag"] to the 2 players (LocalPlayers[0].CustomProperties = _myCP; and same for player 1)
    but in next scene, i cant get to them...
  • should i maybe use Room CP ?
    thanks a lot !
patent fog
trim monolith
#

do you guys think that tcp is save enough to transfer sensitive things like passwords or login tokens?

digital urchin
#

@trim monolith TCP by itself is entirely unsafe, you will need an encryption layer running on top of it to encrypt and decrypt messages. You could also consider using HTTPS requests instead if you don't want to setup encryption through your TCP connection in order to transfer those to the right places and then have the server check for or be notified of any new logins.

trim monolith
#

how fast is https compared to tcp? In form of server side deserilisation

quick rivet
#

can someone explain at the end "Health Checking For Game Over" I think they messed up the tutorial cause unity is giving me an error

trim monolith
#

whats the error

quick rivet
#

Assets\Scripts\PlayerManager.cs(47,21): error CS0103: The name 'GameManager' does not exist in the current context

patent fog
#

Did you create the GameManager from the previous tutorial ?

quick rivet
#

yeah I added it to the scene

patent fog
#

OK. Somehow Unity doesnt find it. If you're sure it spelled correctly and its is where it should be and so on... try to restart Unity ? It might be drunk sometimes

#

check namespace also ?

quick rivet
#

Yeah I did that but still has the error

quick rivet
patent fog
#

Works now ?

quick rivet
#

Yess THANK YOU

patent fog
#

Alright happy coding !

grand skiff
#

Hello, why do i get this?

#

when i try to RPC

weak plinth
#

Hi, i get errors when i try to retrieve customproperties..... after loading scenes....i set the CP to a room ....

#

in scene 1 : PhotonNetwork.CurrentRoom.SetCustomProperties(_myCAS);

in scene 2 : if ((int)PhotonNetwork.CurrentRoom.CustomProperties["team"] == 0) >>> nullref error ...

#

in scene 1, i have also : _myCAS["team"] = 0;

spring crane
#

@grand skiff There might be some additional operations being done when RPC is received? I would probably peek into the code to see what it is doing

grand skiff
spring crane
#

Would also consider if I'm messing with the components or something that trigger that

#

Also make sure the clients are running on the same version

#

As in, don't use old builds

#

By code I meant PUNs code

grand skiff
#

they're, i cannot still find the bug

spring crane
#

Are you implementing IPunObservable on Server?

grand skiff
#

yes

#

what is IpunObservable?

spring crane
#

Interface for OnPhotonSerializeView

grand skiff
#

wait

#

where is it

#

i think i don't know where is it

spring crane
#

Well PUN doesn't know either, hence the error 😄

grand skiff
#

it was working recently

#

i do not know what did i break

grand elm
#

How can I get unity to make a WebSocket Client connection?

weak plinth
#

dear friends...any help about CustomProperties....

#

Scene 1 :
public ExitGames.Client.Photon.Hashtable _myCAS = new ExitGames.Client.Photon.Hashtable() { { "team", 0 } };
...
_myCAS["team"] = 1;
PhotonNetwork.CurrentRoom.SetCustomProperties(_myCAS);

scene 2:
if ((int)PhotonNetwork.CurrentRoom.CustomProperties["team"] == 0) >>> NullRef error.... 😦

spring crane
#

@grand elm I don't think Unity ships with one out of the box. Unity Transport would probably be the closest official one, but some thirdparty library would also do.

#

Any WebGL platform supporting network solution should do

weak plinth
#

I changed the _myCAS["team"]=1 to ..... _myCAS.Add("team",1) ....still no luck 😦

grand skiff
#

i don't know what is onphotonserializeview

weak plinth
#

even, if i try, right after Add a value to my hashtable, to access _myCAS
-- Debug.Log("cas : "+ (int)PhotonNetwork.CurrentRoom.CustomProperties["team"]); --
i get errors....

#

i am so lost:/

weak plinth
#

OKAY I GOT IT WORKING !

#

wow... thanks a lot guys for your help

weak plinth
#

@graceful zephyr Thanks for the tip

graceful zephyr
#

np!

lunar orchid
#

For mirror, why is it creating the player, but hiding it?

full girder
#

In mirror, My players spawn in and I can see both of them on the host. But on the client, I can only see one of the players. What could cause this?

unreal prairie
full girder
#

local location rotation scale of the transform

#

i am guessing

teal hemlock
#

Is it possible in the current state of Unity to create a 100 person battle royal game?

#

Without building a custom stack

weak plinth
#

Hey, I'm having a problem, but I don't really know why it's happening. It's not to do with errors, it's just that it isn't working as it should. I've tried a lot of things but I can't seem to make it work. So I'm making a 3d among us game, and I'm writing a script to determine who is the impostor. The script is here: https://hatebin.com/quusqmjmqi
My problem is that it only runs for 1 of the clients, and not the other one. I'm currently using 2 clients for testing (build & editor). If you can help, that would be greatly appreciated. I can explain more if this is confusing, so just let me know if you need a better explanation. (Using Photon PUN2)

lunar orchid
#

so many people asking questions, but no one is answering them

patent fog
#

Well we don't HAVE TO. It's not free support.

#

😉

full girder
#

lol

slim ridge
#

the answer in here is usually the same so it doesnt get much attention

full girder
slim ridge
#
  • use mirror or pun
  • go to mirror's discord
  • multiplayer is too hard go back now
  • emotitron or eric helps you with a photon issue
trail parrot
#

Go back nao! U have wife n kids!

teal hemlock
#

I'm brand new to Photon. Would it be possible (realistically) to create a 100 person battle royale type game with Photon?

trail parrot
#

Which photon? PUN?

teal hemlock
#

Yes

#

Or would it work better to adapt DOTS for this?

trail parrot
#

PUN uses the masterClient architecture afaik, so its almost like peer to peer

#

So.. idk if that's the best way to make 100 players game. Host migrating will be a pain to do

jade glacier
#

local tells it to use localPosition and localRotation instead of position and rotation. They will tend to be more appropriate choices for child gameobjects. @unreal prairie

weak plinth
#

how do i send the value of a variable to other clients

graceful zephyr
grand skiff
#

Hello

#

What causes this bug?

#

I cannot understand the problem & fix

#

it was working recently

stiff ridge
#

The log kind-of tells you what's happening. A method is missing or does not have the correct parameter signature.

grand skiff
#

Can someone help me with fixing? I got this while everything was working perfectly

#

and now i cannot RPC

#

what should i do

patent fog
#

Do you have a GameObject with a PhotonView component that contains a "Server" script in the Observed Components list ? If so, your "Server" script should have a method OnPhotonsSerializeView()

#

so that Photon can sync data

grand skiff
#

Yes, i have

#

but before, it didn't have and it was working

#

why does it give error now?

patent fog
#

Dunno blind like this. Maybe you updated something ?

grand skiff
#

I don't know but i tried something weird, probably it caused

#

is it like this?

#

i think i found

grand skiff
#

thanks

#

it worked

fair badger
#

Hi!
I'm working on an AR app that uses real time footage from an IP camera. I'm having a hard time in displaying the footage over the mesh renderer (I'm using a quad in my project), it's more of a connection problem. Is it fine if I troubleshoot this on this channel or should I do it in #🤯┃augmented-reality?

weak plinth
#

can someone give me a good beginner tutorial on PUN2

patent fog
teal hemlock
#

Would Mirror be able to handle a 100 person battle royale game?

fair cosmos
#

@teal hemlock ask in mirror discord, it can but with optimizations

teal hemlock
#

Did that, they said it would be possible, but I understand that they could be a little biased, so I wanted a second opinion.

sharp yew
#

what would the best/ideal networking package be I'm kind of lost on where to start

harsh dew
weak plinth
#

So I'm using PUN and for some reason whenever I jump with Player A's game, Player B's game shows Player A jumping but they are really laggy, anyone know why this is? I tested my ping and its around 20 so that shouldnt be the problem

#

Its a 2D game and my jumping is just adding force to a rigidbody, so I'm not sure why this would be happening.

weak plinth
#

@weak plinth increase send rate and serialization rate

spring crane
#

@teal hemlock Thelast.io does upto 100 players on the same room IIRC.

weak plinth
#

wouldn't you be able to get to 100 players on mirror?

weak plinth
#

hmm

#

lerp the movement

ember kettle
#

Maybe use the NetworkRigidBody component?
nvm thats for mirror

high night
#

Make your own script that syncs movement
It should queue time stamped positions, and interpolate
Lerp(pos_at_t0, pos_at_t1, (currentTime - averageLatency - t0)/(t1-t0))

unreal prairie
#

Why does dis start function run twice I , I have to instanci from it but I check if you are the masterclient and two people can’t be te master client

jade glacier
#

Seems like you might be mixing up some concepts. If Start() runs twice, then you have two instances. That is just a Unity thing.

#

We have no idea what that Start is on without context.

weak plinth
#

am i able to make a python socket script and connect to it from unity? i'm not that good at c# sockets but i am at python. i'm just looking to make a simple system with chatting, multiplayer, etc.

#

i don't wanna use anything from the asset store for making multiplayer, such as photon or mirror

#

also @unreal prairie you made a typo with "ChooseSpanwPoint", it should be "ChooseSpawnPoint", unless it's supposed to be like that.

lunar orchid
#

Any idea why?

lunar orchid
trail parrot
#

Any tips on making a dash/dodgeroll in multiplayer?

#

My clients only gets other client's pos and move delta, so if a player does dodgeroll, i guess it's gotta be Rpc'd

#

And then what do i do? Dodgeroll is a curve lerp? Or a single Cc.Move(dodgeDir*dodgeSpeed) ? and let all clients deal with it? Wouldn't it dampen bcoz it's dragging on the terrain? Or should the dir have a +Y too so it's like a mini hop?
But what if it's dodge rolling against an uphill slope? I'd let the controller handle that, so maybe an overwrite Cc.Move for the duration?

weak plinth
#

How would i randomly assign a team to each player in photon pun 2? I'm new to multiplayer so I don't know much

spring crane
#

PUN ships with a connection based team setup, so all you really have to manage is the method with the team.

#

Though built-in team utility isn't ideal if you are planning to have NPCs

weak plinth
#

hi i have a question about photon:
When i try to do Rigidbody.AddForce while using Photon the player moves and instantly gets teleported to his original position. Do i need to use a RPC?

weak plinth
#

@weak plinth Yes. You need to match protocols, and that's all

#

If your python and C# socket are both udp or tcp, it's fine

#

Of course, also make sure they use the same user-defined protocol on top of that

#

@graceful zephyr I found your UnsafeCollections repository. You can make it accessible within the Unity Packet manager if you add package.json file

graceful zephyr
#

Ye I know I never bothered to figure out how they work

weak plinth
#

I can make you one if you'd like?
Also, I think you need to remove the .asset files and the manifest.json

#

@spring crane ok, i'm not gonna use any NPCs, so i guess i can use that. any useful videos you could link to?

spring crane
#

I would just check the API documentation and the samples PUN ships with

bright sparrow
#

Hello! I'm Dr Melina Vidoni, a researcher at RMIT University in Melbourne, Australia. I research mostly software engineering, but now I am working in a project researching specific challenges in thedev process to help small indie devs to get organised and grow into larger companies.

Who is the target? Small (mostly informal or just starting) studios of less than 6 people, where most of them are not formally employed at the company (i.e. work as a side job) and that hopes to grow in the future. If it is just a hobby to you, then this is not the goal of my study.

The survey is in English and Spanish, and it is long (~40minutes), but valid answers can enter on a giveaway for 10 Steam Codes (open worldwide)!

Survey [EN/ES]: https://tinyurl.com/y3mpkckz

Please, redistribute among your peers -the goal of this project is to help the community!

vapid leaf
#

Any fixes for this because the RPC still does not work

#

?

weak plinth
#

should i continue using photon or should i switch to mirror?

#

there are probably going to be more than 20 players playing at once

#

so

weak plinth
#

photon

sterile cape
#

I'm following a networking tutorial by Tom Weilend and I was wondering, I want sounds and animations when the player and enemies shoot, do I put the sounds and animations in the server code or the client code?

weak plinth
#

Both?

sterile cape
#

Ok, ill try it

weak plinth
#

I'm assuming the server is also a person that plays the game

#

If it's a dedicated server, then only the client of course

sterile cape
#

the server is a seperate app but yeah im playing and also have the server running

unreal prairie
#

In the firs picture I send an rpc with an int as parameter but the int doesnt change on the other player the called rpc function is in the second picture

weak plinth
#

bruh

midnight dirge
#

Then it's a dedicated server
Are you guys talking about Photon or Mirror?

weak plinth
#

Neither

midnight dirge
#

Ah alright
Btw which one is better? photon or Mirror
Heard a lot about Photon but mirror is based on the old Unity multiplayer system

weak plinth
#

I can only recommend Photon Bolt

midnight dirge
#

Alright I'll look at it
Had some experience with mirror but I'm not feeling very satisfied with it

#

Also is there a chat for injections?

weak plinth
#

Photon is made by professionals while mirror is maintained by hobbyists

#

Is there any reason that Photon is lagging for me?

midnight dirge
#

I didn't know that, if so then I should switch to photon
thank you!
Hopefully the knowledge I gained from Mirror would provide a nice beginning

iron stump
#

hi idk if dis is d right place to put it but does unity have a built-in netoworking system? i know dey had smth like UNET but i heard dats ded and der replacing it so is der a new one yet?

weak plinth
#

mirror is basically the new UNET

#

so you can use that

iron stump
#

so unity isnt gonna make a new UNET?

inland stag
# iron stump so unity isnt gonna make a new UNET?

Unity is working on one, but I wouldn't wait for it to be released.
Right now all you have are 3rd party solutions.

Mirror and Photon PUN are the two main ones that are recommended.
Main difference is that PUN takes care of hosting and the hard stuff, but costs money after 20 CCU.

weak plinth
#

mirror is very similar to UNET

#

it's based off of it

worldly cedar
#

So, actually just learning mirror now on my end. Weirdly, finding the small stuff harder than the big stuff haha. I have moving players, with physics etc. I have synced button presses. But one thing im kinda struggling with is Synced Vars

I have a kind of 'central point'. As a test, i want to be able to just have it display the id of the last player to interact with it. So, I have a uint 'ownerID' as a SyncVar

#

Do I modify this with a [Command], or just normally?

#

The object has a NetworkIdentity

#
[SyncVar(hook = "OnIDChange")]
    public uint ownerID;

    public void Own (uint _id)
    {
        Debug.Log("OWN1:" + _id);
        CmdOwn(_id);
    }

    [Command(ignoreAuthority = true)]
    public void CmdOwn (uint _id)
    {
        Debug.Log("OWN2:" + _id);
        ownerID = _id;
    }

    public void OnIDChange (uint oldValue, uint newValue)
    {
        Debug.Log("OWN3:" + oldValue + "|" + newValue);
        foreach (var t in outputs)
        {
            t.text = ownerID.ToString();
        }
    }
#

This is my current setup, but only Own1 is getting called, and the id is never changing

severe owl
#

Seems like that would work

#

Ask over at the mirror discord

worldly cedar
#

Theres a mirror discord?!? Awesome haha

grizzled narwhal
#

Does anyone know a decent serializer that doesn't use runtime il code generation or an additional code generator?

weak plinth
#

@grizzled narwhal It's either IL, reflection, or writing it yourself

grizzled narwhal
#

Mhh. I wanted to avoid having a gc leak

weak plinth
#

What does this have to do with "gc leak" exactly?

grizzled narwhal
#

Every time I serialize an object using for example JsonUtility it allocates a string which I dont want

#

I would like to serialize into an existing buffer so I dont allocate garbage

weak plinth
#

Oh, that's what you mean by "gc leak".

#

There's probably some serializer out there that lets you use your own buffer, but that doesn't mean it doesn't use reflection

grizzled narwhal
#

Im fine with reflection but not with runtime il generation because of il2cpp

clever verge
#

Hey guys, im using Photon Unity Network for my multiplayer game. I have setup a rejoin system with playerttl set to 30000. However, I want to remove the player from the photon player list if he manually quits the app using a button in the game
how would i go about doing this?
right now if the player quits I get a playerleftroom callback with the same player list

#

after the playerttl i get another playerleftroom callback with the right amount of player list

jade glacier
#

The first callback is for the soft disconnect, the second for the hard. Quitting inside the game I would expect to result in a hard disconnect in most cases, so not sure why it is treating it as a timeout.

grand skiff
#

Hello, i'm using Photon. I want client to send server a data, and i want server save the data, and when player enters again, i want server to send back data from saved data

#

now my questions are

#
  • i'm using photon cloud, should i use photon server for this?
  • how can i add events to server, not client
  • how to make server send message to client
grim violet
#

you can use photon cloud for that, you need a server, either a web one or one you make yourself, if using a web one (like apache) you can use something like php to received the request and save it to a database that you made (mysql or the like), once your able to send to the server using webrpc you can get a reply back, same thing for when you login, you gotta login on a server with custom authentification, then get whatever data you want back

#

there alot of stuff behind all this gotta search google on each subject

#

i think there some third party service that do all this for you but i dont know much about it

grand skiff
#

thanks!

#

any tutorials on webrpc?

#

or any tutorials for server events or database etc.

grim violet
#

its all on photonengine website on the tutorial part

#

except for the server side

#

that you gotta make it yourself, you can search how to setup apache on a server and code something with php to get the request

grand skiff
#

thanks again

weak plinth
#

php? 🤔

#

It's 2020, please consider using at least something like Javascript

unreal prairie
#

have a problem for three day and I just can’t fix it I have been asking on discords and searching on the web but I still can’t fix it maybe someone here knows how to fix it.
I have a scrip on my playeravatar wich is an empty gam object just for connection to the server and on on that scrip I instantiate the player I can just instatiate them randomly on the spawn points that I have chosen but then it’s just luck that they don’t have the same spawnpoint. So I wrote also some code to check the master his spawnpoint and then set the client his spawn point to the remaining one so they never have the same but it’s still random, this is my code

#

the problem is that the values i set in the rpc function only change on the master but not on the other player but the other player does eceive the rpc because the debug log says so and the debug log statement that i have set inside the rpc i also see in the debug from the other player but the values only change on the master side

#

this is the masters player in this case the standalone and the values are changed here, its just null this time but i also is somethimes one, the client spawn doest change on the master because that part of the code is only runt on the client version and the bool is set to false so on this player(the master ) the values do change how they supposed to do

#

here i set the bool from the other player(not master) manuel to false so that the coroutine starts and it does what it needs to do , the int is just lucky that is zero on the masterspawn and that its also default zero so it will spawn the clieng on spawn 1 but i need to do this manuel to work because for som reason the value dont get set on the other player(not master) from te script

#

i realy hope someone can help me because i have tried basicly eveything but i just wont set the value on the other client(not master client) while i use an rpc with target all bufferd?

weak plinth
#

@graceful zephyr I've made a PR for UnsafeCollections so that it can be used with the package manager

graceful zephyr
#

Let me take a look in a bit

weak plinth
#

Sure thing

grand skiff
#

How to Server RPC in Photon Cloud?

#

I mean, i want Server to RPC to Client

#

Should i use WebRPCs?

grand skiff
#

Hello, can someone help me with WebRPCs?
I needed server to send messages back, i also want to have a database and i want server to send data from database.
Someone suggested WebRPCs. Now, i'm trying to learn it

#

But i'm stuck rn

#

I've read the doc but i couldn't get it

tall storm
#

Hi
I have made some addressables in unity and i am accessing them through google cloud and it is working very in windows
But when i follow the same principle in android build then it doesn't work and it doesn't give out any errors
What's wrong here?

mellow sable
#

I'm making a multi player game using mirror, networking is all working fine. However when I'm running 2 test build windows my controller inputs are being read on both instances. I've tried disabling "Run In Background" and setting my input script to only read "if Application.isFocused" but it's still not ignoring input on the inactive window. Does anyone have any idea how I can resolve this issue, it's making testing very difficult. It seems to only be an issue with controllers, keyboard and mouse work as expected so it's not an authority issue. Thanks.

#

I'm using the new input system package. On 2019.4.14f1

grand skiff
#

isn't your question about inputs? not networking

#

@mellow sable

mellow sable
ruby hatch
weak plinth
#

have someone a basic tutorial video on PUN 2??

fair badger
#

Hi!
I'm working on an AR app that uses real time footage from an IP camera. I'm having a hard time in displaying the footage over the mesh renderer (I'm using a quad in my project), it's more of a connection problem.
Here's the code I currently have: https://pastebin.com/9hb8rhaK

I've tried to retrieve the footage texture from the HTTP url in several methods and reiterations on the script but I keep getting the following errors

Any help is appreciated.

patent fog
#

so stream is null right ?

#

GetVideo is asynchronous

#

But you try to read from stream immediately (next line)

#

This is my guess

gloomy sand
#

Hi there, backend engineer looking for insight. Sorry if this is not the proper channel.
I've started a common game backend project that will be used for desktop and mobile games, akin to Nakama, but with a structured plugin ecosystem.

I was looking into OpenAPI code generation for Unity and while there is client code generation for .NET 4.x, I wasn't able find a proper one for Unity.

  • How well would .NET 4.x's built in http libraries work with Unity? (I've read about incompatibility with WebGL builds, but I won't be targeting those)
  • Do Unity practices favor UnityWebRequest over System.Net ?
  • How do you manage API calls for your games? Do you simply wrap api endpoints in functions that accept serializables, or do you build a more object oriented system, multiple managers etc.

Bonus question:

  • Has anyone succesfully used gRPC for Unity?
patent fog
#

@fair badger stream = resp.GetResponseStream(); but resp is never assigned, only declared ?

#

Line where it's assigned is commented out

#

I expect resp to be null, and so does stream

#

Looks like you tried a bunch of things and mixed them along the way ?

fair badger
#

yes, something like that

#

I commented that line because i couldn't find an identifier that wouldn't cause an error

slim ridge
#

@gloomy sand this is as good a place as any. Anything that uses threads will be broken in webgl (thats where most of the problems arise)
I haven't gotten far enough for API calls in my project yet but I would try .NET first.
Unity can use native plugins if you wanted to write it in something like C, C++, or GO.

#

if i was in your position i'd actually try doing it in C# as a .NET plugin. that way you could deploy it on NuGet or something and support your api in any .net project

unreal prairie
#

can you send an rpc inside an if(ismasterclient) because when i do this the rpc only gos to the master and not the other clients

vital hawk
#

posting this here in case people don't follow the blog or blog channel here: https://blogs.unity3d.com/2020/12/03/accelerating-unitys-new-gameobjects-multiplayer-networking-framework/

Unity Technologies Blog

The open source MLAPI project joins the Unity family. Read on to discover some of the changes you can expect as we build Unity’s first-party GameObjects multiplayer networking (netcode) framework. One of Unity’s top priorities for 2021 is to expand the Unity ecosystem with a first-party multiplayer networking solution for GameObjects that is eas...

jade glacier
#

They basically are right back to HLAPI.

weak plinth
#

Hey Emotitron, haven't seen you in a good while

floral turtle
#

it's nice to see Unity thinking about game object based solutions, but I feel with their resources they could build something that manages the simulation layer to encapsulate the netcode side best as possible, since HLAPI did not do that well

jade glacier
#

Which many people wanted, for better or worse.

floral turtle
mellow sable
jade glacier
#

Yeah, monob is not going anywhere

open light
#

Hello all,

I have been following a Unity +Mirror Networking Tutorials playlist and at one point I am supposed to connect to a AWS Lightsale dedicated server from the Unity Editor and a clone editor via the client connection. However, I am not able to and am receiving an error message and the following results when trying to run the server config. Does anyone have any insight or thoughts?

#

This is the youtube link to the tutorial series

#

Additionally, I noticed that TelepathyTransport script is deprecated, but the KCP Transport script isn't helping either

severe owl
#

KCP is UDP

#

So if you only opened TCP that could be it

#

Ohhh wait I didnt read that right the first time

#

Ask over at the mirror discord

grizzled narwhal
#

@gleaming prawn I've seen your talk about deterministic rollback networking. How do you deal with components having reference type fields?

solar garden
#

Anyone knows how the FPSsample does Rollback ? i'm trying to do physics based client prediction and it seems that you have to create a physics scene to handle it so i tried to look how the FPSSample did but there is no mention of an additionnal scene created

#

nvm they use a characterController..

oblique vine
#

Any help to learn about networking from scratch?

gleaming prawn
#

@grizzled narwhal we have our own on-frame reference types

#

EntityRef, Ptr, etc

#

Quantum can rollback a full frame consistently

open light
slim ridge
somber oxide
#

This will be our first major stress test of the network code, hopefully it hold up!

unreal prairie
#

I you send an rpc with targetalbufferd, will te other player than first reveive the rpc or first the start methode

versed rock
#

hey dudes, any know any example of game loop for a MMO server? tick rate implementation

grizzled fossil
#

Hi, I want to send mobile input to the pc game in Unity(specifically, gyro and accerelometer). What tool should I look into doing this ?

versed rock
#

Any example or idea how implement rick rate in loop? i mean 60 ticks per seconds for example

patent fog
#

@versed rock

#

And it's ECS

versed rock
#

thanks! amazing

opaque dew
#

oh geez that thing is awful in every way

#

@versed rock if you want a headache, look at the DOTS FPS sample.

versed rock
#

i think simple loop for a test project for MMO

            int tickRate = 30;
            int m_ThreadSleep = 1000 / tickRate;

            while(!m_Closing)
            {
                m_world.Tick();
                Thread.Sleep(m_ThreadSleep);
                Console.WriteLine($"Date TICK {DateTime.UtcNow.ToString("hh.mm.ss.ffffff")}");
            }
opaque dew
#

are you talking inside unity or outside?

versed rock
#

outside

opaque dew
#

Okay, I figured as much with the thread call.

versed rock
#

i'm trying to make a test example of loop for MMO and make some test

opaque dew
#

The general idea is you run the server at a steady tick, whatever you want to be. that code is pretty straight forward.

#

Simply run physics/steps or w/e every 20ms

#

(example rate)

versed rock
#

the MMO prototype don't have physic engine

opaque dew
#

the server never deviates from that. and if the tick is marginally off on the server who cares

#

its same principle though

#

clients try to send data at the same tick rate but that wont happen irl

#

so the server will determine based on how much data its getting from the clients if theyre sending too fast or too slow; in return will tell clients to speed or slow down their simulation

#

clients simulation rate = variable. server = constant

versed rock
#

for the client, i'm trying to implement a queue

#

for now my purpose is

  • Simple game loop in server, with 20/40/60 tickRate for manage the items, character and player inputs
  • TCP class for connect client and manage message
  • Queue for Send/Received
spring orbit
#

Hi everyone I am using the mirror plugin to make my multiplayer game and I am a bit stuck the problem is when a client with another camera connects to the scene it will display the same camera on both screens this means I cannot go any further with my game I have tried using chinemachene but it still has an answers I would love to know so I can continue with my game thanks!

maiden wagon
#

Attach the camera to the player instance

severe owl
#

Ask over at the mirror discord, more mirror specific help there too

spring orbit
#

Ok thanks

unreal prairie
#

Is there a way to know which player spawns first

coarse heart
#

when i am using joystick for controller in android in photon bolt, there is the problem that both the joysticks are present at one place and move both the players at the same time

#

any solution

#

pls

cunning sluice
weak plinth
stiff ridge
#

@coarse heart, you mean you got 2 joysticks locally on the machine? Then you need your controller code to react to only specific buttons for each character.

versed rock
#

we only value the movement with the speed, direction and the position

weak plinth
#

What prevents a player from walking through a wall on their screen

#

And having it synced on everyone else's?

versed rock
#

have all this invalid position in the server, like Albion online

weak plinth
#

You're going to need exactly this same information on the server, yes

graceful zephyr
#

@versed rock Albion uses photon server fwiw

river elk
#

New ECS NetCode question : has anybody information about wether we will be able to control quantization of position and rotation anytime in the future again ? (they removed the possibility to edit those fields in inspector since serialization happens per component and no longer per ghost)

patent fog
#

You can do it via code with field attributes

river elk
#

sorry my question wasn't clear, i mean per prefab basis. Let's say I have some ghosts that don't need rotation synchronized, only position. I could save bandwith by untoggling their rotation component. (this was possible with netcode 0.3 if i remember correctly, but isn't anymore) I was wondering wether unity plans to bring that back

patent fog
#

Dunno if they plan to bring it back to through the inspector. From now you could be able to mess with it at least from code.

spare eagle
#

i know this sounds really dumb but does anyone have a working multiplayer system that i can use?

versed rock
gleaming prawn
#

This is apples to oranges, sure you can use any language

#

Photon server solves a lot of thing for you in terms of scalability and load balancing

versed rock
#

yeah, but i ask if any know any BASIC mmo backend like photon but open source

#

i mean, tick rate, tcp communication implementation and other things

#

but only the basic

gleaming prawn
#

Maybe there is, I’m just not aware

weak plinth
#

I think it's pretty interesting that Albion is made with Unity/Photon

#

How many CCU does that game have?

gleaming prawn
#

Notice they do not use pun, they run photon server with a custom application (not our default load balancing). Photon server raw sdk is quite flexible and it had an “mmo” base sample that they got inspired by

#

They also run photon server in their own clusters

#

So I do not have their ccu numbers per server, not how beefy their servers are

#

But they are quite happy with their infra afaik

#

They also have a nice setup for ddos protection (something we also run)

weak plinth
#

It's always interesting to hear how a company solves some technical challenge for their own requirements.

gleaming prawn
#

They use the photon server because it is very stable, jasmine thread safety feature, and handles thousands of@connections from a single machine just fine

weak plinth
#

I'm glad some of these developers take the time to explain a thing or two about their designs

gleaming prawn
#

How many depends a lot on the complexity of the app and the machine specs

#

But from 4K to 10k client connections is normal

#

From one machine

weak plinth
#

That's very impressive

random matrix
#

hey guys im having some issues, when i try to test my multiplayer, only one instance runs smoothly

#

the instance im focused in runs smooth but the background ones lag hard

gleaming prawn
#

But, that is normal

#

Nut

#

Rendering in background task is pow@priority to the os

#

Maybe you can change that in the build@config but I’m not@sure

random matrix
#

it doesnt happen in the vid im watching

#

22:45

gleaming prawn
#

@weak plinth it is kind of impressive, ye. But for us that is just the normal... server runs io completion ports, which is totally different that regular sockets

#

So it handles a lot more data than a simple unity instance... this is what it was designed for

#

And this is why we don’t even bother to answer when someone asks here how to write an mmo with unity servers (one of the reasons)

#

Só there is probably a way to make builds not get low priority @random matrix but that is not exactly network related

#

Maybe you should ask at the mirror discord, maybe they can help better

weak plinth
#

That, and an mmo is one of the most complicated multi-user systems to design

gleaming prawn
#

Exactly

#

The guys at Albion are really nice, also appreciate they share some of their stack design

somber drum
#

Shrine Wars youtube channel is great, love how he breaks stuff down

fiery patio
#

I've build a linux server, then i've uploaded it to a dedicated host(ubuntu bionic) i did the chmod +x thingy then run it and i have this error

#

it seems my server wants to use the GPU?

#

that's weird

#

maybe i should remove the main camera

fiery patio
#

anyway it worked when i connected my client so i'm good now 🙂

quaint jackal
#

Is there a way for a dedicated server to get its public IP address? To give to the master server containing a list of all public servers

river elk
#

any bandwith experts out there that know when to use a ghostfield instead of rpcs to sync values ? example : a unit can have 3 items (byte itemSlot01 ,02,03). Items change only rarely (maybe once per minute on one unit, when user is dragging it onto the unit). Would an rpc whenever a user assigns an item beat the itemslots being ghostfields ?
Imagine a game with 10 players, each having 10 units)

gleaming prawn
#

What is the netcode sdk you are using?

river elk
#

unity ecs netcode

gleaming prawn
#

So you probably better ask at the dots channel, as almost nobody here uses it. I apologise but I’m not familiar how their delta compression works

#

Because depending on how it works, it should not use any space until things change, but the ecs netcode is far from stable and I do not really know anyone using it

river elk
#

alright, thanks for your answer 🙂

signal halo
#

hi gys i.

#

I could not find anything about SignalR.
I decided to write an API to build multiplayer in Unity with SignalR.

#

If you know the source code, please send it.
Thank You

grand elm
#

How can I create a websocket client in unity?

slim ridge
quaint jackal
#

Do you guys recommend France or Germany for EU game server location?

digital urchin
#

Hey everyone :)
I am considering making an MMO. Yes I know, don't make an MMO, whatever, I want to try it out. Here is my general idea:
There are a few core servers for the game, proxies for handling client to server communication (more later on this), instances, worlds, and persistence. These 4 make up the stack of servers.

Proxies can send messages to all of these internal servers, instances for pushing user messages, worlds for getting the initial client state setup, and persistence for things like authentication or loading global data like active events and notifications. Proxies also send messages they get to the client if marked as such.

Instances handle things players can do in the game, like authenticate movement, crafting, combat, rewards, ect. These cover sections of the world, but can read outside those bounds, and ask to write for nearby instances. Instances essentially own whatever they contain, and handle their actions accordingly. They can talk with other instances, the proxy to send updates to clients in their regions, and persistence for when actions need to be saved. On rare occasion they talk to the worlds, the worlds will most likely talk to them though.

Worlds are the global moderator, they handle all instances within their limits. These limits most likely are things like seamless sections of the world, or perhaps mini areas like dungeons. They don't directly know about game state, but will handle ownership between sections, spinning up or fixing sections, and talking to the proxy about who they should talk to for certain information. They will talk to instances about things that are about to happen on global scales like moving instance locations, handing off function to other servers, ect

Persistence is the most important server, as it handles object persistence and current state. High IO, must just go. Everyone talks to this server, but it won't talk to other servers without being asked.

Is this a good setup or should I change the design?

modest anchor
#

Interesting, unless someone has experience supporting an MMO, it's not wise to vet a design in theory. Have you looked up post mortems from MMO games that have big user bases?

#

Bake time is very important to vet a design. You can then build off what's true and tried. (IMO)

digital urchin
#

The design is based on a few architectures I found, just putting a lot more function on the proxy and hiding an entire network behind it instead of exposing the persistent, authentication, and other servers, it just hides it as the proxy functions, creating a clear divide between secure and insecure sections.

I am not even expecting anything that high, 1k concurrent in the entire game would blow my mind, which a beefed up server could probably handle on its own, every single service, entire game. Maybe not the website on top of it all since it might max its networking at that point.

I could honestly get away with just having transition zones and assigning entire regions to individual servers, with a proxy still to handle talking so you aren't switching connections all the time.

modest anchor
#

Gotcha

#

I think on a high level, have an authoritative server for each section of the map. I'd keep it simple before I'd start adding proxies. The problem is everytime the source of truth is duplicated you have to deal with syncing and staleness

#

CAP theorem

#

you should also have servers be super strict on their scope of authority.

#

again just from experience buildling servers outside of games for other types of products

#

the servicing/livesite is a big source of headache if things are unnecessarily complex

gleaming prawn
#

@digital urchin doesn’t look bad at first glance. You seem to have made your research.
1k ccu is definitely possible, and it’s good that you are willing to make design decisions (like boundaries) based@on restrictions

#

I would worry a bit with two aspects:

  • what actual tech stack, language to write the server code with, and see how well you can manage developments of all pieces
  • as you said, persistence might be your bottleneck (but again this is theory)
digital urchin
#

@modest anchor I think that would work. The main reason I wanted to put a proxy is to simplify client connection and processing and also make the amount of connections to the actual working servers limited so they wouldn't be completely flooded with incoming connections, and something more specialized could handle it. Granted completely unnecessary to begin with, would make it so I didn't need to identify all of the servers individually.

@gleaming prawn Thanks :)
Ya, actually developing it will be interesting. Things are going to be written in C# simply because writing in another language, even if it increases speed, would end up with worse performance simply because I know the tricks of how to get C# to go, while something like C++ I would end up just making things worse. The entire networking side of things would be UDP, reliable and unreliable using LiteNetLib, that only handles messaging back and fourth though, so guess I would have a lot of pieces to build.

Persistence bottlenecking really comes down to a single feature I am thinking about: If you chop down a tree in the forest, does it simply reappear in the same spot, or do the nearby trees drop seeds and sampling start sprouting and growing? And does it persist across the current server session, or is it something that can impact the server for days or weeks? That would be the main pressure on persistence, actual living breathing environments that persist throughout the life cycle of a "realm" of sorts.

#

Of course that kind of persistence would probably work better in more of a player plot system, but it is interesting to think about if there is just a forest in the world that everyone could access, what would happen.

digital urchin
#

I am wondering how I would do server authoritive movement though, PhysX would probably not be very deterministic, inefficient, and would introduce latency due to needing to run on server ticks... So simply doing PhysX simulations is out. I could do a fixed point physics engine, but it is worse in every aspect except deterministic, which would do the job but also burn the poor main thread of the server.

Any tips for actually doing server authoritive movement with either simulation or checks? I would prefer to catch as many potential cheaters without generating false positives very often, and not absolutely murdering server performance.

gleaming prawn
#

I think you got the persistence down quite correctly

#

Balancing what you actually need to PUSH to disk VS what you can afford to keep only in memory is the key

#

MMOs are such beasts that you start to think about file-system DB-based techniques of pushing command buffers to disk and commiting to single machine later...

#

I "guess" (because I am not working on one of these beasts) having things only exist in the memory realm is acceptable, like the Tree Lifecycle example

digital urchin
#

After watching some videos on up and coming MMORPGs, I think I am going to need a combination of in memory and actual disk persistence. I am going to simplify the server architecture while also increase potential things you can do.

The world is predivided into regions, only a single server will own a region at a time. These are geographically divided into roughly equal patches of land which vary in shape, environment, and progress. Progress, or the destruction of, persists permanently. This would be things like a city with different buildings, facilities, citizens, ect. built by players to some degree. Each region can individually be evolved and devolved during in world events of different degrees. This would be constantly streamed as records in a database whenever changes to this major scale happen. This would be write only unless the server is loading. Trees would be a server lifetime system, so they would reset to default unless they are part of something like a dedicated area in which case they persist and are more valuable.

Very fun to think about the hell that will be to try and save and load.

Also, I am creating this in a way which only requires a single Unity editor to test the entire setup, no networking either. Everything sits within a parent named _Client_ or _Server_, with the server sitting below the client, they will operate side by side in the same scene, so I can do things like simulate thousands of servers and run around between them, no support for multiple clients planned since I should probably be running that differently. I am also abstracting things away to use an in memory direct messaging system which still respects a "port" system and hosts, just so I have something reliable to build upon that isn't a bottleneck.

#

Basically using some thing that I learned from Spatial IO, but less of the pain and works more how I want it to, with the ability to actually know my damn costs and self host.

unreal prairie
#

Hey I have raid that you can’t cross object rpc but when you use an if(potonview.ismine) and send an rpc does it only send to that player because it can’t cross object ?

gleaming prawn
#

No, it sends to all clients you assign in the target group (optional param afaik)

#

Others and All are the options I think

#

You can’t cross game object, rpc is called in the same corresponding game object on all affected clients (in all behaviours that have the component)

#

Thiamin gowns remember it works

#

That is how* (sorry, typing from phone)

north rock
#

Anyone know how I could detect when a player has joined the server?
Im using Mirror and wanna call an RPC when a player joins
but the one function OnPlayerJoined uses some deprecated variables or smthn
and doesnt wanna work

north rock
#

ok I went a bit of a rough way

#

oof

modest anchor
#

@digital urchin I get you now. I think just have a "front door" type server that will bounce connections to the next server.

#

This server will also be critical for telemetry, auth etc.

#

ping me privately if you want more wisdom in this area. They're fed by a many livesites 😅😅

digital urchin
#

@modest anchor Ya, like a front door. I think I have a rough idea of how to do it, but I will take you up on that offer if I need it.

knotty heart
#

We need to develop a little unity based ego shooter with multiplayer for our university project. What would you recommend ? I saw Unet is deprecated and the new dots system not production ready yet. So i have found photon... are there better alternatives for such a game ?

white stone
#

@knotty heart I would have a read of the pinned messages, tons of information in there.

knotty heart
#

@white stone Thanks ! But what would you recommend ? ^^ Oh and... the high level api, is that unet ?

white stone
#

Like the blog post mentions its hard to specify something for your needs because the game/software you run compared to what I run is completely different, reading the blog will certainly ask you a ton of questions and probably open your heart to have a real hard think about networking.

#

The link in the blog about choosing the right netcode has a ton of information and well worth a read, knowledge is power.

knotty heart
#

Alright, thanks : )

white stone
#

There are many different types of networking we can use and everyone will use something different. Just depends on what your needs are, too many variables come into play, have a read of that, will take you awhile to read.

harsh dew
#

Haven't used it myself but that sounds like a good use case for photon bolt @knotty heart

knotty heart
#

Alright, thanks both of you ! 🙂

#

So i read the article... and for my "case" i could either pick MLAPI or Mirror... The problem here is that both of them are "client-server" based... in an FPS where you select a room to play in, this isnt the best option... so i think im gonna take a look at photon

white stone
#

how many players does your game support

knotty heart
#

Well we plan to support up to 32 players in a lobby... Probably we go with something like 24 instead. Its a typical ego shooter... so we have two teams fighting against each other on a map ^^ atleast thats what our prof wants

#

Actually both ideas are cool... cloud based rooms or the ability to host and register servers on our own... so other people could host their own servers. Photon does already includes that room system. Mirror requires some extra work to get that "list-server" working

knotty heart
#

Ok heres something i dont get... Photon PUN uses some sort of dedicated cloud server... and bolt uses the client itself as a server host... right ? In pun host migration is possible and in bolt it simply disconnects everyone. Why the hell do they say thats perfect for an rts or battle royale ? A battle royale uses dedicated servers and no client hosters xD

spring crane
#

Odds are you aren't going to find anything more convenient than PUN when it comes to general purpose networking solutions

#

Almost too good for learning purposes for that very reason 😄

knotty heart
#

@spring crane Thanks ^^ i think im really gonna go with PUN... did you get the difference between bolt and pun ? I found a page that lists all differences, but the only major difference is that bolt uses "peer to peer" right ?

#

Ah... or can it use both ?

spring crane
#

Haven't looked too closely into it, but I do know it comes with a lot of the annoying time travel stuff sorted out for you.

#

Authoritative aspect of the package makes it perfect for these more competitively serious games

knotty heart
#

@spring crane Thanks ! And do you know if pun is performant enough for up to 24 players fighting against each other and probably some spawnable npc's ? Havent found a benchmark so far

harsh dew
#

If i remember correctly photon pun has a limit of 16 players (per room)

spring crane
#

It's probably fine.

#

You likely need to start being careful about what you are doing when approaching 24 players + NPCs

#

Photon also has their own discord server(s) where Photon employees are active.

#

Same goes for most networking solutions for that matter

weak plinth
#

That's the benefit of creating your own stack

#

And I'm sure Bolt doesn't have problems with those numbers

weak plinth
#

@graceful zephyr Do you think it's possible to create an unmanaged Monitor using Interlocked?

alpine pivot
weak plinth
#

You can also ask your router

gleaming prawn
#

I think the safer one is STUNs reflexive address queries...
The amazon thing is an HTTP version of it

weak plinth
#

Yes, definitely

wet ingot
#

Hi guys, got a question... How would you handle physics over the Network? we have a building that we want to blow up and come crashing down. Right now the building blows up and falls apart but both clients never see the same outcome.. and I understand the Server should never handle physics on a large scale.. so wondering what the best approach would be.

digital urchin
#

@wet ingot Handling physics over the network is a ton of hell fun. You can definitely simulate physics on the server, it just makes it more expensive to run said server. The problem you are always going to have, is that PhysX is not going to be deterministic, you can get it to be close, but don't rely on it. You most likely will have to stream some information from the server about that building while it is falling apart.

I am working on a game where everything is synced across the network with complete determinism, so I won't be able to use things like PhysX, and I am going to be doing things like running things in a tick based system, with roll back and resimulation being common. Nothing other than input synced across the network, but everything stays in sync.

It may not be a solution you can choose to use however, so you might want to consider just synchronizing the data from the server instead. You can do some optimizations like compressing the floats down, or only syncing pieces that need to be updated (sleeping rigidbodies don't need to be synced, so you can just say the rigidbody fell asleep and the last state it was in). It will be pretty difficult but if you aren't able to simply move everything to be completely deterministic, it would probably be one of few options you have.

steep pendant
#

I'm pretty new to networking when it comes to game development, is there some horrific downside to writing your own server? I'm looking to have a server that hosts small lobbies (10 people per) but I keep seeing people talking about Photon and Unity's inbuilt networking

#

i've written networked applications before, worked with networking through Spigot (i.e. minecraft plugins), and generally have a grasp on the process, so I'm not keen on using out-of-the-box solutions atm

#

actually, I guess a better question would be: if I were to use something like Photon for simplicity's sake, how easy would it be to port that in the event that I need larger-scale hosting or find something with better rate charges?

slim ridge
#

unity makes it extra difficult because Vector3 does weird things behind the scenes

slim ridge
wet ingot
#

Thanks @slim ridge and @digital urchin were having a bitch of a time getting out building to sync over clients.

#

and get somewhat a consistent outcome over clients.

slim ridge
#

yeah, it's all fine and dandy until you do trig, square root, or division

wet ingot
#

Right now.. one client will see the whole building down.. and the other will only see half

#

Which is way to much of a difference to be ok with, lol

orchid pendant
#

so i made a create button with photon and when i create a room it gives this error

stiff ridge
#

@orchid pendant, creating rooms is done on the server, so you need to be connected to the correct one. In best case, read and code-along the Basics Tutorial. It will explain the steps to create a room.

orchid pendant
#

oh okay

junior willow
#

What's the best networking solution for a small fps game for around 3-6 players per lobby?

jade glacier
#

if it is competitive, you will likely need to explore Mirror or MLAPI since you will want to get your hands dirty. Pun2 is great for that player count, but it is pure relay, so if you want any kind of server authority you will want to make server plugins for the relay. Upside is hosting is a breeze with relay. Upside of Mirror/MLAPI is your server runs a Unity EXE.

Other option is Photon Bolt if this is a serious FPS, as it is the only full stack library that has an architecture meant for AAA fps games.

signal halo
#

warning in unity 2019.3 to upper .

#

my game cant use the unity web request

#

Modules/UnityWebRequest/Implementations/TransportCurl.cpp

#

i used the unity 2019.3 2019.4 2020.1 but this problem not solved

spring crane
#

?

#

@signal halo Is there a moderation related problem?

signal halo
#

i am sorry take mistake

spring crane
#

You can't ping anyone not in the conversation

signal halo
#

ok thanks

spring crane
#

!warn 688014472408727567 Don't ping staff or people not in the conversation.

raw stormBOT
#

dynoSuccess CleverWise#0947 has been warned.

grim violet
#

What you're error is saying is that your certificate is not trusted and cant be verified while trying to do that secure connection

signal halo
#

this error is just for android 9 to upper .

#

in android under 9 not have problem

grim violet
#

fix your certificate

signal halo
#

my certificate have not problems . i think problems has another place

signal halo
#

thanks bro

#

i try it

grim violet
#

it work, thats how i do it too

reef charm
signal halo
urban sonnet
#

i wanna destroy a gameobjects that was instanciated normally with out having to add a photonView

#

pls help

sterile void
#

Is there still some people using Unet?
If yes, I don’t know why but, a Command function that I use with 2 arguments doesn’t work at all...
There isn’t any error in the inspector... Can someone help me?

sterile void
#

I’m on phone right now...

#

Will try to show tomorrow

slim ridge
#

no

weak plinth
#

almost no reason to be using unet hlapi still, switch to mirror at least

digital urchin
#

Unless your supporting an old project, or upgrading to Mirror is that hard (it has an auto conversion tool), you should switch to Mirror.

reef gust
#

How would one begin to work on a fully server authoritative game? Thinking of trying something mobile "simple" where values are stored server sided (rather than two people walking on a map) and all logic being done (as in gaining/spending such values) is done by the server then relayed to the client. I've read into databases in storing peoples data, and okay. Cool. But how would one go about doing logic not in the client?

digital urchin
#

@reef gust Really depends on the game, real time or turn based, if you plan on saving things between sessions (MMORPG), or if it is a session based game (think most FPS games), is it simply for leaderboards? There is a lot you need to know before you can really figure out how to make it multiplayer, let alone server authoritive.

You most likely won't need a database unless you plan on saving information between the shutdown and restart of your server, and this more than likely should be handled by a backend service instead of your game server.

reef gust
#

I know connecting two clients together is a whole different thing, but if I learn the logic behind doing everything on the server with regard to one client, I would imagine that is a nice step to take afterwards

#

I do want to dive into persistent data, but I don't need to mess with databases now. Keeping everything in a file that the server reads from is just fine

digital urchin
#

Instead of trying to find the solution, why don't you try and first define what you are wanting to end up with.

#

What is your goal.

reef gust
#

Starting simple, though the solution is going to be complicated.. a game where you can get 1 coin by pressing a button with a 5 second cooldown where nothing is trusted from the client. In this case, the gold received or the cooldown

digital urchin
#

No, define it from the players perspective. What can the player do, what happens?

reef gust
#

That's the simplest case I can think of where I would learn what I need to know. Don't want to connect any two clients together, because thats all I've done so far in the fps and moba

#

Player can press a button every 5 seconds, and receives one coin from doing so

#

Yeah, sounds boring, but knowing how to do that could lead to so much more

#

Idk of any game as an example of what I'm thinking of. Maybe clash of clans? Full server authority over everything. I don't think you connect to other players in live time.

#

They may have changed that, but thats how it was years ago. haha

digital urchin
#

Have your client connect to the server, the server responds with how much time is left until they can press the button. On the client side, it starts a countdown from that time, and displays it. Once it is below or at zero, make the button pressable. When the button is pressed, disable it and send a message to the server. The server will check to make sure that its timer is below or at zero, and if so, will tell the client and store it. If it was above, notify the client they were too early. The server can simply store the timer and coin counter in memory, and you can write it out to a file if you would really wish.

grim violet
#

what if you have 200 player

digital urchin
#

You don't make the server "fully authoritive over everything", and you don't "connect to other players", your players connect to the server only. The authoritive part is that the server checks that what the client is doing is either valid, or the amount of information the player can provide is minimal enough that they can't do anything that isn't intended.

#

@grim violet 200 connections each with their own version of the button, perhaps it tells the other clients about the current coin count of the highest player.

reef gust
digital urchin
#

Your external server more than likely will be an instance of your game running on your own machine, a VPS, or the cloud.

#

It may very well just be a build of your client that runs in a server mode, or perhaps it is something custom built in Python. So long as you "host it" somewhere, and make sure people can access it, it should work.

reef gust
#

As in not the logic behind very niche operations, but having a unity client connect and read data/sent input from client/server

grim violet
#

gotta choose your net library first i think, mirror hlapi and photon arent working the same

digital urchin
#

This is more than likely handled by your networking solution. So C# sockets, LiteNetLib, Mirror, and many more.

reef gust
#

Okay, cool

digital urchin
#

You will need to find and choose one after making sure it will work for what you are trying to achieve, and then follow their tutorials, guides, and implement it into your game.

reef gust
#

Any preference/bias towards one of the other? Are some more suited for live connections of multiple people than others for example? Because I am not really looking for that

digital urchin
#

Do you want to host the server yourself, or do you want it to just be a turn key solution? Do you want to have an actual server, or just a master client? You need to define how your game runs before you can really choose one. For self hosted, I would recommend Mirror (server client setup) or a custom solution, and for turn key I would recommend Photon (master client).

#

Networking is something you need to know a lot about your game before you can actually sit down and get it working, at least well.

reef gust
#

Thanks btw, this is very helpful.

#

I'll have to do some research on these terms

hybrid arrow
#

So I'm sitting here thinking whether this would be a good approach or not.
I'm currently developing my own network server, and a test client to go with it.

Here are my thoughts.. Each client would obviously want to keep track of all the players that are currently online for various reasons..
Let's pretend that there are currently 10 people on the server in order to work with this theory that I'm about to explain.
I boot up a new client and connect, and going back to what I said earlier about wanting to keep track of the connected players,
I would then ask the server something like.. "Hey, can you please let me know how many players are connected and their corresponding ID"
The server would then send 10 packets (one for every already connected player).
I would then take those packets, parse them into Player objects and chuck them in a collection on the client, for it to keep track of.
And then later down the line just append to that collection when the client gets notified that a new connection has been made.

Is this a good approach?

azure rock
#

like the master client or actual server or what??

#

@reef gust

#

oh and @digital urchin

digital urchin
# azure rock which one of those networking solutions would be best for clash of clans???

If you want an actual Clash of Clans setup, the server usually has private sessions with each client, and the game servers are all knowing, so you want an actual server and to separate the clients from each other as much as possible, perhaps into their own rooms, since clients really shouldn't be able to see or talk to each other unless they are spectating.

azure rock
#

are there books or videos on creating such a setup

#

or is this possible through proton or something

digital urchin
digital urchin
azure rock
#

huh

#

not a tutorial on making clash of clans, but this "actual server" you talk about. also, in an RTS people connect to each other in live time, but they do not in clash of clans

#

so I'm wondering if there is a more targeted type of server series regarding this instead of dissecting individual components from an rts series because it is a completetly different type of thing

digital urchin
#

@azure rock "Connecting to each other live time" is called peer to peer networking. The setup you need is server client. Not all RTS games are peer to peer either, a lot are or should be server client if they are competitive.

The thing about game development is your going to need to research and learn bits and pieces to get what YOU want to make to work. No one is going to make a tutorial on exactly what your doing, but maybe something close enough where you can transfer the concepts.

#

I say "actual server" but I am more or less referring to a server you setup yourself instead of a solution you simply pay for and everything is setup and all running.

azure rock
#

"The setup you need is server client. Not all RTS games are peer to peer either, a lot are or should be server client if they are competitive." oohhh right. of course haha oops

azure rock
digital urchin
#

I did mention Mirror as one of the options, it is an existing networking solution that you need to pop into your own server and handle yourself. Do more research, there are plenty of options which all depend on what setup you want to go with, or how specialized you need something.

I am personally using LiteNetLib because all I want from my networking solution is a messaging system, the rest I want to handle myself. I am making an MMORPG, so I really want and NEED the fine control I won't get with Mirror or many other solutions.

azure rock
#

interesting

digital urchin
#

If I was making a Clash Of Clans game, I would do something pretty specialized for the sake of making my life easier for other features like replays or spectating.

#

Clash Of Clans is actually very similar to Clash Royale in terms of networking design if that helps

azure rock
#

ty

digital urchin
lapis vapor
#

Guys, In Photon, for doing PhotonNetwork.RaiseEvent, Is there a PhotonView Component is necessary attached in the component where our above script exist

wary notch
#

If anyone is bored on ideas I'm working on either a VR or third person story driven content that needs some guides and work... I haven't buddy that writes books and publishes them on Amazon he gave me permission to reroute one of his books into a game

knotty heart
#

Anyone here having experience with photon ? I just saw that there are "states"... and well... i think its quite a ugly solution to have OOP here, it doesnt feel composite like... each state can only have one other state as a parent... which is quite restrictive... is there an other solution to send transform data etc. over the network ?

#

Any help here is appreciated 🙂

high night
#

@knotty heart I had made my own system for whole thing

This is how serialization worked:
I had references of all objects in there in a list and stuff with id's and all

When i want to serialize and get the "state" as ByteStream, i'd create a single ByteStream and i'd iterate this list to serialize each object, in the same stream
One after another

Each object would have its own logic about how the serialization happens

#

.
You can have the parent method serialize(buffer) and deserialize(buffer)
And just override it
In your objects

#

Or make like an ISerializable interface for it

knotty heart
#

@high night Thanks for the insight ! But does this adress the states itself or the behaviours ? ^^ Or didnt you used states at all and just used the lower level api to send the data ?

high night
#

I wasn't using "states" if its something photon defines

Its just about iterating all of my objects and making it into a flat byte array

And then i'd send that array and read it on the other side

I called this flat byte array, my "state"

#

@knotty heart

knotty heart
#

Thanks 🙂 But you still used photon ? Or what network library ?

high night
#

I would iterate monobehaviours, gameobject by gameobject

#

I used mirror, but it wouldnt matter what you use if you just call a single rpc to transfer a single byte stream for everything in your game

knotty heart
#

Thanks ! I really think im gonna quite with photon due to that state stuff... i probably gonna try to implement your solution or search for a network library that is more "composition" pattern like ^^

high night
#

What kind of networking architecture are you doing?
@knotty heart

knotty heart
#

Client-Server based, room like... thats why we have choosen photon. But that was before i discovered that state shit ^^ we need to develop a little ego shooter for a university subject.

high night
#

I hear photon bolt may help you with "states" but i havent used it myself and i might be wrong

knotty heart
#

Yeah but those states are awfull... they are pure oop and dont use any composition. Lets say you have an inventory and either players or mobs can have one. Then you cant just create one state for inventory, one for player and one for mob. They dont have any composition :/

high night
#

@knotty heart Why dont you define your own composition patterns without monoB stuff

#

MyComponent components;

read write from state:
foreach(MyComponent in components):
component.WriteIntoBuffer(buffer)
foreach(MyComponent in components):
component.ReadFromBuffer(buffer)

update logic:
foreach(MyComponent in components):
component.Update(deltaTime)

#

@knotty heart

knotty heart
#

Because i was looking for a simple network solution ^^ I honestly dont wanna write that much network code by myself. And bolt is nearly perfect, if the states could get composed it would be perfect.

knotty heart
#

@high night One more question... you said you used mirror, right ? How does the mirror networking looks like ? Lets say i have a "HealthScript" that contains currentHealth, maxHealth and a few other variables, then i need a NetworkBehaviour, right ? Is it possible for an entity to have multiple of those "NetworkBehaviours" ? Or one "NetworkBehaviour" for each gameobject ?

knotty heart
#

Anyone here having experience with MLAPI ?

#

Not sure how its called, but is it possible to host a server in the clients game itself ? So that the client does not need to buy/rent a server and can use his pc as one and other friends can connect ?

high night
#

@knotty heart it was network identity component i think

#

i basicly enables you to call rpcs/commands for that object

#

i had only one object per client and server with network identity

#

and used that as access point between clients and server

floral turtle
alpine pivot
#

And yes, MLAPI can do that

wooden pebble
#

Guys can you suggest me which software to use in linux cui server to make a tcp server

#

I don't want to use ngork

#

as it just have limit of 20 CCU

#

for free plan

#

Serveo/localtunnel/any else what can be better

alpine pivot
uncut knoll
#

For those who have done networking, which do you think is better. Photon or Unet?

wooden swan
#

Depends on the type of game you're making and what fits it

spring crane
#

Keylon is right, but the answer is probably Photon.

#

You'll always at the very least get a really solid transport layer 😄

somber drum
#

Is it possible to host your own bolt servers? I always see it being pointed to as the go-to for a competitive shooter but also see its not only p2p it has no host migration?

slow monolith
#

Can someone help me understand prediction? How does the server know where the client is, in between the update packets? How will it know if it's the wrong ending position?

#

Do you have to store information about past frames?

#

Still, how would the server determine if the player is in the wrong position?

gleaming prawn
#

@somber drum yes, you can host your own dedicated servers (both with free and pro versions). Or you can have one player be the host (listen server). In this case Bolt runs punch through + keeps the relay connection as a fallback (between the client and the listen-server).

#

It does not come with host migration (this is a super complex feature, that is not easy to do out of the box on client-server archnitectures)

#

@slow monolith

How does the server know where the client is
It's proportional to the ping/2. In a tick-based netcode (like photon bolt), the exact tick the server will raycasts against in the past is part of the input struct that is received on server. Server can validate that with the measured-ping, of course + assume a limit (this is another topic)

#

Do you have to store information about past frames?
Yes, on server. You need a buffer of full states of the colliders you need to raycasts against.
Bolt uses a custom query system for these raycasts (as PhysX is pretty expensive to rollback).

#

Still, how would the server determine if the player is in the wrong position?
This is another topic... The server has authority over the actual player position, as it is the full simulation authority.

#

These are separate topics:

  • lag-compensated raycasts (this requires a ring-buffer of full collider data on SERVER)
  • client side prediction of local character movement with server reconciliation via rollbacks (this requires a ring buffer of inputs on CLIENT to be reaplied when reconciliating a server authoritative position for a specific tick for the local player)
#

Both are automatically done for you in Bolt (as long as you comply with the authoritative API guidelines)

sly hare
#

Hey there!

I am using photon to create a ball type game. I have run into an issue when one player owned ball collides with another "remote" player owned ball, the "local" collision does not register for the remote client, and makes it feel like hitting a brick wall.

Example: Player A runs full force and collides with Player B. Since the collision happened on Player A's instance of the game, Player A's ball flies away (with Physics Material), but Player B's ball remain unchanged.

This creates a feeling of hitting a brick wall rather than the expected outcome of both balls bouncing away in different directions.

It is important to note that both Players have a Physics Material with Bouncy set to 1.

I have a few solutions to this issue:

  1. Send over collision data from the player where the collision happened, so that the other "remote" player handles the collision accordingly.
  2. AddForce

I would much rather implement solution 1 as it would create a more realistic and expected collision than addForce would.

My question is does anyone know of a way to implement this feature? Is it even possible?

high night
#

@sly hare Are you okay with input delay proportional to your latency?

#

Syncing physics objects is no simple topic

#

Its rocket league type of stuff

#

But if you just make everything serversided and dont do predictions on clientside, you will have it easy but at the cost of some input delay

sly hare
high night
#

It has to be either that

Or a predictive system like rocket league

Or some hybrid its like that but only player movement is predicted

#

@sly hare

sly hare
#

hmm alright

#

Thanks for the info! 🙂

high night
#

np

floral turtle
# sly hare Hey there! I am using photon to create a ball type game. I have run into an iss...

You can either do input delay Bargos said above, which will result in the client seeing the results of their actions RTT (round trip time, the ping to server and back) later. Alternatively you predict the entire simulation locally on the client, and when the server sends data about inputs or state, you reset the simulation to the latest server data and resimulate all the predicted frames. This requires your game to be able to rewind the state of the game, and be able to perform correctly when simulating ~10 ticks or so in a single frame. Quantum is an example of an engine that does this

sly hare
high night
#

@sly hare Then you might wanna read about rollback networking, and you need a stateless physics engine to hop between states like that.
.

#

stateless physics engine:
no more info stored in physics engine other than that velocity,angularvelocity,position,rotation, mass etc etc etc
.

#

unitys default engine stores some extra data to make objects stable and stuff i think

and you cant access the engine to include this information in your states, and that will cause mispredictions

#

.
if your physics is not too complicated, make your own simple physics

sly hare
#

Would for example mirror networking work better with that type of set up?

floral turtle
# sly hare Would for example mirror networking work better with that type of set up?

none of the networking packages for Unity other than quantum provide any kind of rollback setup (Bolt does do some rewinding stuff for lag compensation hitboxes iirc, but not super knowledgeable about that). Note that while PhysX will not be entirely deterministic when rolled back/resimmed, you could have the server also synchronize the state of the game so that full determinism is not required (the predictions will be pretty accurate short term). Forum thread about this topic: https://forum.unity.com/threads/deterministic-rollback-lockstep.1017223/

...also, since PhysX does not have a built in API to rewind to its previous state, manually rewinding it by setting the state of objects incurs a performance hit (to rebuild internal data structures).

sly hare
floral turtle
# sly hare Alright. I'm going to try to wrap my head around this. So in short no other netw...

there are some links in the thread to various github projects that implement things like GGPO, but some work needs to be done to implement rollback/prediction (you need to decouple all your art from your simulation, since for the fast forward phase you don't want to play a billion sound fx at once). I'm not sure if there's a clever setup that avoids prediction to solve the problem you're having, since I'd think most things would require prediction of the opponent's ball's motion on some level.

for doing it deterministically, PhysX is a no go, and floating point arithmetic is not always consistent cross platform

high night
#

@sly hare If you arent going for full determinsm, you will be more than okay with a physics engine that is "stateless"

#

floating point determinism helps you sync a game by sending inputs only

#

I think sending a state every 2 seconds while sending inputs for every tick would be a pretty good solution, but i dont see that being applied often

#

I mean its deterministic rollback networking but with states being sent every 2 seconds to fight the butterfly effect

#

Still need a stateless engine though

#

btw, DOTS physics is stateless

floral turtle
# high night Still need a stateless engine though

would a stateless physics engine be required if you are syncing state from the authority? It incurs a performance cost to restore the state of an engine like physx, and the predictions will not be identical, but over a short period of time it would be unnoticeable

high night
#

how you sync the state is just replacing velocity,position,rotation,angVel

#

let me think about the issue i had with physics for a moment

sly hare
floral turtle
#

👍
I did a little demo of rollback with physx (no netcode, just locally), and tho there's a big hit to set all the states, no divergence is noticeable. Ofc it needs to first not diverge over the frames you are resimming, and also not diverge frequently enough so that the server doesn't need an insane send rate on the states

sly hare
#

I will try to implement to implement DOTS and the input sending. See what it results to.

high night
#

if you run two simulations on two different pcs it's very likely that they will never diverge depending on the cpu architecture

but if you load different states randomly, it will diverge because you cant restore the internal state of the engine

sly hare
#

The main idea of the game is to be cross platform. You mentioned cpu architecture, but what about playing mobile vs computer. Won't that effect the outcome of the simulations?

high night
#

mobile vs pc probably will be different

#

not sure tho, never tested

floral turtle
#

re: determinism, you'll be fine on AMD/Intel if you avoid SIMD...probably...maybe. PhysX is not determ across Intel and AMD. Big problem using any black box like Unity is you cannot control the low level stuff

high night
#

But as soon as a fast collision happens, it will diverge too much
Until a next state comes from server, you see false prediction

Fast collisions are really bad imo if you dont have high state send rate

floral turtle
#

yeah, I think you would need to be clever about the send rate, prioritizing important objects over unimportant

#

and interpolate the view of the objects that diverge to avoid too much pop

high night
#

There's one more thing, i think one can make the physics stateless

#

By doing SetActive(false) and SetActive(true) on all rigidbodies before each physics update

This seems to delete these internal states i think

#

I will probably mess with the box stacking abilities of the engine but it might make things more deterministic

floral turtle
#

ahh that's clever, yeah

#

maybe threshold it, so that if objects are idle you don't do it? Since they aren't liable to diverge quickly

high night
#

yea

floral turtle
high night
#

@sly hare You use ints for math, and you do all that deterministic stuff Roystan talks about and implement the rollback correctly, you might not even need to send states ever

#

This is rocket league type of networking btw, theres a 40min+ video in youtube explaining about rollback networking rocket league uses

floral turtle
#

is rocket deterministic? It's PC only, and I think unreal, so they could control for float arithmetic if needed

high night
#

It uses bullet engine, its not floating point deterministic

#

But that vid explains rollback networking well i mean

#

Maybe it is, i dunno i am not sure if they send states

#

I think you could eliminate alot of server traffic via checking players if their floating points are deterministic with server and decide not to sync states with them

floral turtle
#

that would be interesting. Though I think if I had sending states implemented, the temptation to avoid coding determinism would be too strong 😄

sly hare
floral turtle
# sly hare Hmm I do not fully understand what all of these things mean. Is there some resou...

https://www.gamasutra.com/blogs/DanielCollier/20151124/251987/Minimizing_the_Pain_of_Lockstep_Multiplayer.php this article covers a dev who made a determ game. I made a short post in the above thread about it

abstract zinc
#

Hello, if anyone here knows how to use the mirror networking plugin, can you help me out? Basically, I wanna know a two things: 1. How/where do you guys host servers? 2. Is it possible to make an among us style server system with Mirror, you know, with players creating their own lobbies?

sly hare
high night
#

@abstract zinc By default, any player who knows how can host a minecraft server will be able to host the same way

hazy leaf
#

does anyone know if iOS14 broke anything with webrequests or coroutines? an app that worked in iOS13 no longer works in iOS14 at the point it initiates a webrequest to the server to check credentials

high night
#

@hazy leaf you probably know what you are doing but i'd like to say, try debugging the build on the iOS14 device if you didnt already

hazy leaf
#

trying that, everything goes smoothly until its supposed to send the webrequest, it never triggers the success or failure event, its like its just getting hung up on it

#

and its not the webrequest itself because the request is fine in editor/pc

#

it even works on iphone, its just broken in ios14 ipad it seems

abstract zinc
#

Is something like this possible in mirror?

high night
#

ah, yea my bad
thats how photon PUN works by default
there might a mirror trasform that does such a thing, i am not sure

#

@abstract zinc DarkReflective transport for mirror should work like photon PUN i believe

#

Oh, i think these guys also let you host your own relay servers for free i think

jade glacier
#

Among Us was made by a Pun2 user who decided to build his/their own version of what Photon stuff does. So it is very similar to Pun2.

uncut knoll
#

What is this error?

#

Copying assembly from 'Temp/PhotonUnityNetworking.dll' to 'Library/ScriptAssemblies/PhotonUnityNetworking.dll' failed

gray pond
grim violet
#

JustNick you can just use a room and call it a lobby, no one beside you will know, you can set a password and make it private or public etc ;p

vivid thistle
#

i have a scene set up with crewmates (im using mirror) with movement and 1 player just controls all of the spawned players

#

can someone help me?

haughty blade
#

Which method would you use if you had to sync 3 transforms from the client (2 hands and a VR headset position / orientation)? Is it RPC Commands every input tick (client side does client's own tracking while sending positions) or NetworkTransform sync (client side does client tracking with full client authority while network syncs the transforms)?
Can you even "rollback" NetworkTransform, though?
Mirror / UNet, I should mention.
I guess is there any downside to sending like 45 RPC per second?

spring crane
#

@vivid thistle All of those PlayerMovement script instances seem to be reading input from the local device regardless if the object is owned locally or not.

vivid thistle
#

How can i fix it?

jade glacier
#

Be sure to ask in the Mirror discord, but in most cases that is about disabling controller code based on hasAuthority and IsLocalPlayer (or whatever the current values are in Mirror for those) @vivid thistle

slow monolith
#

Websocket connect crashes unity if the connection fails

#

does anyone have a solution to this?

weak plinth
#

Are you handling the failed connect attempt?

ornate zinc
#

@slow monolith can you show your code, you are using?

slow monolith
#
        ws.Connect();```
#

@ornate zinc Both in start()

#

ignore the url, it came with the example

#

but yeah totally crashes unity if it fails

ornate zinc
#

Do you handle the error somewhere?

slow monolith
#

no, a guy in the other chat said it wouldnt do anything

#

since its outright crashing unity

ornate zinc
#

Hm, the code is not that complex 😄 it should work, what websocket are you using?

slow monolith
#

websocket sharp

#

if I remove ws.connect, no crash

#

I googled the question, apparently common, but nobody else has answers

#

besides running the websocket in another thread, which I have not tried yet

ornate zinc
#

I am using EasyWS from the asset store, maybe you give that a shot? It works for me

weak plinth
#

The Connect is synchronous/blocking?

#

Doesn't it have callbacks or is awaitable?

ornate zinc
#

its async

weak plinth
#

Are you sure it's not throwing exceptions?
Why don't you throw a try-catch around it?

ornate zinc
#

you can just catch them with something like this

public void StartWebSocketClient(){           
            var ca = "wss://" + _serverAddress + ":" + _serverPort + "/";
            SystemExtensions.Log("Connect to " + ca + " (WS Client)", SystemExtensions.MessageType.Network);
            wsc = new WebSocket(ca);
            wsc.Log.Level = LogLevel.Trace;

            wsc.OnMessage += (object sender, MessageEventArgs e) => {
                ClientDataBuffer.ReceivedBytes = e.RawData;
                string jsonString = System.Text.Encoding.GetEncoding("Shift_JIS").GetString(e.RawData);
                ServerCall jsonToCall = JsonUtility.FromJson<ServerCall>(jsonString);

                SystemExtensions.Log(DeviceUser.deviceState + " receiving: " + jsonToCall.type + " ( Station: " + jsonToCall.stationNumber + ")", SystemExtensions.MessageType.Network);


            };

            wsc.OnError += (sender, e) => {
                SystemExtensions.Log("WS Err msg : " + e.Message + " (WS Client)" + sender, SystemExtensions.MessageType.Error);
                AppManager.instance.SwitchAppState(AppManager.NetworkAppState.Disconnected);
            };

            wsc.OnOpen += (sender, e) => {
                SystemExtensions.Log("Connected to webSocket server (WS Client)", SystemExtensions.MessageType.Network);
                ClientDataBuffer.IsConnect = true;
                AppManager.instance.SwitchAppState(AppManager.NetworkAppState.Connected);
            };

            wsc.OnClose += (sender, e) => {
                SystemExtensions.Log("Disconnected from WebSocket server (WS Client)", SystemExtensions.MessageType.Network);
                ClientDataBuffer.IsConnect = false;
                AppManager.instance.SwitchAppState(AppManager.NetworkAppState.Disconnected);
                CloseWSClient();
            };

            wsc.Connect();
        }
slow monolith
#

alright

ornate zinc
#

So maybe it is crashing because you dont have hooked up anything on close, ocnnect, error, just assuming.

weak plinth
#

@ornate zinc Where do you see that it's async?

#

The source code doesn't suggest this, provided I'm looking at the correct repo

#

And if it was, he should be awaiting the Connect

slow monolith
#

how do I do that

weak plinth
#

You can't if it's not marked as async

ornate zinc
#

Oh sorry, You can use async or not async

slow monolith
#

ah

ornate zinc
#

Just try that code above I send, try to hook something up to onmessage error close and open, simple debug, and see if it gives you something or is still crashing

slow monolith
#

nah the async fixed it entirely

ornate zinc
#

orrrr go with async 🙂

slow monolith
#

but ill probably add the onclose stuff too

ornate zinc
#

You might want to reconnect and stuff, so yeah, I would check for them 🙂

spring crane
#

SimpleWebTransport https://github.com/MirrorNetworking/SimpleWebTransport might be one of more maintained WebSocket transports when it comes to free ones. It was made by one of the Mirror Networking peeps after getting burned by all the other viable WebSocket transports, like websocket-sharp and Ninja.WebSockets.
There doesn't seem to be any documentation beyond the source and a reference implementation in Mirror though.

haughty blade
#

Does anyone know if MLAPI's "BitStream" would pretty much be kind of like LiteNetLib's normal (low level) features?
Like, are there any advantages of using MLAPI for connecting clients and stuff, and then just doing kind of low level stuff and not using their SyncVars?

spring crane
#

MLAPI has a nice discord server btw.
At least it would wrap the transports for you? 🤷‍♂️

strong axle
#

I'm using Photon Pun and I tried to connect using the same device running a built version of the project but it doesnt match up with unity editor scene

using System.Collections;
using Photon.Pun;
using System.Collections.Generic;
using UnityEngine;
using Photon.Realtime;
using UnityEngine.UI;
public class PhotonOnlineServerMaker : MonoBehaviourPunCallbacks
{
    [SerializeField] private InputField CreateGameInput;
    [SerializeField] private InputField JoinGame;

    private void Awake()
    {

        PhotonNetwork.ConnectUsingSettings();

    }
    public void JoinGameFunc()
    {
        RoomOptions roomOpts = new RoomOptions();
        roomOpts.MaxPlayers = 3;
        PhotonNetwork.JoinOrCreateRoom(JoinGame.text, roomOpts, TypedLobby.Default);
    }
    private void Start()
    {
        

        
    }

    public override void OnJoinedRoom()
    {
        PhotonNetwork.LoadLevel("a Scene");
    }

    public override void OnConnectedToMaster()
    {
        PhotonNetwork.JoinLobby(TypedLobby.Default);
        Debug.Log("Connected");
    }
jade glacier
#

They end up in different rooms?

strong axle
#

Wdym

slow monolith
#
void Start() {
        ws = new WebSocket("ws://localhost:8765/echo");
        ws.ConnectAsync();

        ws.OnOpen += (sender, e) =>
        {

            ws.Send("CONNECTED UNITY");

        };

    
}```
#

Is this the right way to use events in unity?

#

Like should the event be in start() or somewhere else?

alpine pivot
# slow monolith Is this the right way to use events in unity?

Yes, this would work, tho I'd add all my event listeners before calling Connect, it's safer, since you can be certain that you won't miss any events.
Unity won't restrict you on these stuff, just follow the intended usage design of the library you're using and you'll be fine

#

Well ... Actually, there is one restriction I can think of now, all operations on unity objects need to be performed from the Unity Main Thread, but your socket library will most likely invoke its events from a separate thread.
So you'll have to queue those events as Actions and invoke them from the Unity Main Thread, such as in an update loop.
But that's for you to be surprised by later 😉

slow monolith
#

Ended up just making them into their own methods instead

#

seems to be a lot cleaner

gray pond
slow monolith
#

@manic raven That's definitely not a networking question. If you're using rigidbodies, then your problem is that you're rotating the rigidbody. Don't rotate the rigidbody.

#

I do, however have a networking question for someone in here. When implementing server-side movement in unity, should you use physics.simulate to simulate multiple velocity changes in a single update?

#

Specifically, trying to build clientside prediction. I think I already know the answer, just want a definitive answer before I waste 3 hours implementing it tomorrow

#

Second question. If I am, in-fact, supposed to use physics.simulate, and the player bumps into a rigidbody hinged door, for example, would it still work as intended if not doing physics.simulate?

high night
#

@manic raven That does look not related to networking and lerp
Looks like your camera moves in fixed update
Camera should move/rotate in update and movement delta should be multiplied with Time.deltaTime

Or if you wanna use rigidbody for camera, should have interpolation setting enabled and edit camera transform via rb.position and rb.rotation instead

#

.
@slow monolith You wanted to predict everything or just the player?

hexed remnant
#

i had network transform working in a 2d top-down space racing game that i was making, i was using the mirror network transform thing, but now i have had a headache for a hour cause i tried improving it, then broke it entirely and now cannot get a backup back or anything, it just does not sync at all between the two instances, and on the client screen both player objects do not even spawn

#

i have had unity for only two days so i am definetely a beginner and i just dont know what to do now

#

please someone help me
i can tell you info and screenshots of my settings

#

i didnt manage to figure out how to spawn two players with one prefab, dont shame me, i know there are better ways, if there is one that fixes this AND its better, please let me know

grizzled narwhal
#

You have errors @hexed remnant

#

Errors stop Unity from running properly

#

If you have only been using Unity for 2d days DON'T make a multiplayer game

hexed remnant
#

Hmmmm

#

That is a good point

grizzled narwhal
#

Make a small, simple game. Get used to c# and the unity workflow

hexed remnant
#

now i have another problem

#

the player keeps disappearing when i hit start

#

like it gets

#

disabled

#

why does it do that

#

ok fixed it

graceful zephyr
#

@weak plinth i cant' merge ur PR

weak plinth
graceful zephyr
#

wrote this on GH: "I can't accept this PR because you changed the entire project structure, namespacing, tons of changes to method naming, etc... it means i'd have to update all my projects that use this which is too much code to go through and patch by hand."

weak plinth
#

Ah I see it now.
I was secretly hoping a PR would keep the pointer to the branch when it was made. Instead of including the latest

graceful zephyr
#

so this is unusable to me sorry

weak plinth
#

I'd have to check if I can create a PR from a specific branch, and revert that one to include only the package.json

graceful zephyr
#

dont bother

weak plinth
#

Hmm, alright

graceful zephyr
weak plinth
#

Yes, only in places where I actually edited something

graceful zephyr
#

where you changed formatting and renamed methods?

#

that is NOT how this license works you know that right? you cant just claim EQUAL copyright because you modified some small parts of my code

#

i still wrote 99% of it

weak plinth
#

I wasn't aware of some arbitrary percentage that you need to contribute in order to see yourself as a contributer

jade glacier
#

Dude. WTF.

hazy verge
craggy garden
#

Hahahahaha

strong axle
#

I am using Photon Pun and this code

using System.Collections;
using System.Collections.Generic;
using UnityEngine;
using Photon.Realtime;
using Photon.Pun;
public class PhotonOnlineMatchMakingOnePointOne : MonoBehaviour
{
    public LoadBalancingClient LBC;
    public ExitGames.Client.Photon.ConnectionProtocol ji;
    public void QuickMatch()
    {
        OpJoinRandomRoomParams OPJRRP;
        EnterRoomParams ERP;
        ERP = new EnterRoomParams();
        ERP.ExpectedUsers = new string[2];
        OPJRRP = new OpJoinRandomRoomParams();
        OPJRRP.ExpectedMaxPlayers = new byte();
        OPJRRP.ExpectedMaxPlayers = 2;
        PhotonNetwork.JoinLobby();
        LBC = new LoadBalancingClient(null, "MyAppId", "0.1", ji);
        LBC.OpJoinRandomOrCreateRoom(OPJRRP, ERP);
    }


    

}

I have connected to a lobby and the 'master' from another script but i get this error:

Operation OpJoinRandomOrCreateRoom (225) not called because client is not connected or not ready yet, client state: PeerCreated
jade glacier
#

this is networking, all of this stuff is async

#

calling JoinLobby doesn't instantly put you into a lobby. It is the internet, so that just starts the process. You have to use callbacks. Be sure to do the tutorials before trying to guess how to do this.

strong axle
#

Couldnt find any effective tutorial on most of it i only found PhotonNetwork.JoinUsingSettings() and PhotonNetwork.JoinLobby(). I just saw LoadBalancingCLient and OpJoinRandomOrCreateRoom in the docs and done the rest on my own

#

also how is async relavent to any of this. How is it async

grim violet
slow monolith
#
    {

        protected override void OnMessage(MessageEventArgs e)
        {

            Debug.Log(e.Data);

        }

    }

    // Start is called before the first frame update
    void Start()
    {

        var wssv = new WebSocketServer(8765);
        wssv.AddWebSocketService<Echo>("/Echo");
        wssv.Start();

    }```
strong axle
#

The function is called by pressing a button and the buttons script says that it is only able to be clicked(by changing its scale) OnJoinedLobby()

slow monolith
#

My server doesn't seem to be working

#

I'm sending him data but he's not receiving it

#

My client works fine because I already tested with a python server

grim violet
#

usually you have to be bind a port and address (unless its taken automatically in websocket, no idea)

#

the client shouldnt know if its localhost or internet address

#

server i mean

slow monolith
#

The client connects to localhost:8765

#

/Echo

grim violet
#

is the server open on localhost

#

is that the server code

slow monolith
#

yes

#

client code works fine

grim violet
#

isnt there any overload on this var wssv = new WebSocketServer(8765);

#

on WebSocketServer()

slow monolith
#

I have no clue, this is my second day with websockets

grim violet
#

well, check ;p

#

you just type WebSocketServer( in vs it should point to all method with some arrow to go up and down

#

sometime it can says if its default local or internet address

#

i never worked with websocket but most socket api work like this

#

i cant find anything related to WebSocketServer here, just checked

#

where did you get that from

#

package?

#

protip, you should use photon, take sometime to learn but you will get further and way faster overall.

slow monolith
#

Okay yeah for some reason nothing in my console is displaying on my server scene :/

#

so there's that

#

so the websocket is most likely not broken

#

oh, I never attached the script to a gameobject, im a fucking retard

#

That's one way to waste 2 hours

tulip wharf
#

When using PUN(v1) , when setting isMessageQueueRunning to false does it also disable all the PUN Callbacks like OnPhotonPlayerConnected etc? Or only RPCs and OnPhotonSerialize callback is affected?

timber karma
#

Hello Everyone !
Christmas is close, and I got a present for you my fellow Unity Developers : 💯
We're over the moon to introduce you Synergiz LightHouse :
https://techcommunity.microsoft.com/t5/mixed-reality-general/introducing-synergiz-lighthouse-integrated-real-time/m-p/1998329#M35
🥳
It's a really powerful multi-user solution, mainly for Mixed Reality HoloLens but works everywhere!
LightHouse is quick and easy to implement at any stage of the development !

midnight latch
#

anyone know a way to sync animations in socket io?

vapid seal
#

guys

#

i have question

#

when i press key on my keyboard

#

this info is send to the server

#

then server calculates the pos

#

and then send it to client back

#

but when i testes that on high

#

ping

#

when i move my client simulate what server can simulate

#

and move

#

but then delayed datda from the server is send to client

#

and client is teleporting back

#

and following this path again

#

how i can fix that

#

chech last pos and dont teleport?

grizzled narwhal
#

U send what input the server has seen to the client along with the pos update. Then you reapply all movements the server hasnt seen to the pos

white stone
#

Did you read most of the pinned documents @manic raven

white stone
#

Yes

grizzled narwhal
graceful zephyr
#

@grizzled narwhal 🙂

graceful zephyr
#

Streaming again tonight at the same channel https://www.twitch.tv/fholm and same time (9pm CET). Same topic, building a udp transport from scratch.

graceful zephyr
graceful zephyr
versed yew
#

does anyone know how to impliment rollback networking using PUN?
or at the very least make players keep moving when lagging?

jade glacier
#

Pun is typically client authority. Rollback doesn't typically come into play in a relay environment.

versed yew
#

so I can't do rollback with PUN?
is there any free online thing that I can do rollback with

jade glacier
#

Rollback for what? Server authority shot rewind?

somber drum
#

taking the plunge into bolt from mirror today, seems the necessary step at this point with what I know and what I need to know to get a solid system in place for an fps

#

any warnings before I do so?

#

I've heard the workflow is a bit, weird

versed yew
#

Im very new to networking stuff so i hope that makes sense

floral turtle
versed yew
#

Fighting game

floral turtle
#

@versed yew other than Photon Quantum, there aren't any full feature rollback solutions out there for Unity really. There's a thread on the topic here: https://forum.unity.com/threads/deterministic-rollback-lockstep.1017223/

here's another discussion on implementing GGPO, a library that helps with rollback for fighting games: https://twitter.com/mauvecow/status/1182084533035757568

Alright. Can actually talk for an extended period again instead of making one-offs, so let's talk a little more about GGPO and rollback netcode implementing.

Retweets

498

Likes

904

versed yew
#

thanks
should I still be using PUN or should I drop it

floral turtle
#

I'm not actually sure what the most common way is to get started fast with fighting games netcode, so I'll see if anyone else has thoughts—for some genres, you can just skip server authority entirely and allow the client to decide where their character is etc. This has the drawback of allowing cheating, but until your game is successful it may not matter

#

not sure how well client authority would mesh with fighting games

versed yew
#

I'll try stuff out, thanks for the advice

jade glacier
#

If you just want to learn advanced networking, try writing your own. If you intend to get a game to market, go with Quantum.

weak plinth
#

Many ways to get there too

#

And you'd be surprised about how little developers care about players cheating

#

Deep Rock Galactic is a pretty popular 4-player co-op game, where you can just edit your save file and get every item you want

graceful zephyr
#

Yes people are way to obsessed about their indie games with a combined player count of 83 people being target of advanced cheat creators from china 😄

sharp cradle
#

So, League of Legends Wild Rift was made with Unity. Any1 knows how they handled their networking part?

silk ether
#

With a server

#

A physical server

earnest leaf
#

Is there any guide how to save playerprefs in any cloud?

ornate zinc
#

playerprefs are saved in the registry of your system, not sure you can really export directly, you rather have to come up with your own savefile or json or what not to store it and shar eit @earnest leaf

earnest leaf
ornate zinc
#

It would but it is just a pain in the **** to debug... you always have to either build a manager around it to show in inspector or always use the regeditor to check them. You are easier with just writing a custom class that holds your stuff and save that to a file and load it. Therefore you can see everything easily in unity

earnest leaf
#

i'm just curious

ornate zinc
#

Ohh, well, if someone deletes the game, the progress is gone too

earnest leaf
ornate zinc
#

Well you can just use a simple CMS like wordpress or so to get a REST API and save load files there. Just for starting, do not worry too much about that. Where you are saving is something you can still think about later

weak plinth
#

Are you sure you can't just use the Android APK for something like that?

#

That's what I'd expect, comparing to Xbox and PS at least

pliant comet
#

Hello does anyone know if i can create multiplayer card game online with p2p networking ?
and if there is an unity asset which can help me doing that, thank you.

weak plinth
#

Heyho 1 question i currently use Mirror and have everything done networking wise the only thing i miss is a Good Login/register system with a database
is there any out of the box solution for that ? like a service that hosts a Database and has API calls for a login system

#

i could make that login system by myself but that would be hella insecure

gleaming prawn
#

Playfab

hard badge
#

What networking does Rust use?

spring crane
somber drum
#

Probably nobody, just curious has anyone heard of the new photon Fusion supposedly replacing bolt/pun? I've just began the process of moving from mirror to bolt, so this is a bit worrying

gleaming prawn
#

jump to MLAPI discord

#

There was a long discussion about it there

#

But @somber drum, a couple of things:

  • Bolt will still receive bug fixes
  • If you have enough time, take a look at the new stuff when it comes out (it won't take long)
somber drum
#

Awesome will do thanks!

graceful zephyr
graceful zephyr
tiny edge
#

when overriding Photon Pun's OnRoomPropertiesUpdate method in a MonoBehaviourPunCallbacks is there a way to retrieve the previous values of the custom properties?

weak plinth
#

hey quick question bois, how do I sync the position of a gameobject that isn't the player with other players via photon?
feel like I just need to add something to the gameobject so photon can see the position but not really sure. Noticed that host can pickup a cube and the other players will see it just fine but when non host players grab the cube its just stuck and starts glitching the screen hard if you try to pick it up.

#

Thanks in advance, new to photon/networking so sorry if dumb question lol

spring crane
#

@weak plinth That is most likely due to authority. The one who has authority generally sends stuff for other clients to receive.

weak plinth
#

@spring crane how would I go about resolving that so everyone sees everyone’s stuff

versed yew
#

I'm pretty sure you need to add the photon view component and the transform photon view component to the gameobject

#

but I'm not 100% sure, I'm not super good with photon yet

weak plinth
#

That’s my current setup on the gameobject @versed yew

frank quiver
#

make sure the transform photon view is dragged into observed component in photon view @weak plinth

spring crane
#

@weak plinth The simplest solution is to change the owner on the fly

weak plinth
#

@spring crane change the owner of the room? @frank quiver that is also my current setup, do I need to add a script or anything to the gameobject?

spring crane
#

@weak plinth Owner of the object

weak plinth
#

@shadow stagny

#

ooops sorry lol

#

think you might be right gonna dig deeper into that, thanks!

hybrid slate
#

What are people doing these days for networking? All the docs seem to say everything is deprecated, good luck. I'm making a card game, so don't have particularly high needs, but authoritative servers are required. For a new project (Unity 2020) what would the recommendation be to start with?

severe owl
#

Mirror is kinda easy mode for that. Its pretty much the use case for mirror.

hybrid slate
#

Cool, thanks!

ember tulip
#

Is it bad practice to send animator parameters over the network?
My player motor moves my character controller, and I set a Speed property on my animator.
When I just sync transforms, the animation doesn't play on other clients because nothing is setting speed.
I can either have other clients determine speed, or I can sync the animator parameter for speed.
Which approach is generally more recommended? Thanks for any help