#archived-networking

1 messages · Page 113 of 1

dusky storm
#

NetworkTransform has an option for authority

merry arch
#

hey quick mirror question, on the pong example, why is the rigidbody simulated only for the ball but not for the players?

warped pilot
#

The host of the game should be connected with host too ?

#

I am working on a multiplayer game which is have very simple networking system.

merry arch
#

if you want to host AND play then you also need to make the host a client

#

from my limited understanding

grim bramble
#

What is the best for a Lobby Ranked game. Unity MLAPI or Photon Pun 2? I will have a dedicated server hosted somehwere

fickle geode
#

Steam could also be an option

grim bramble
#

I am looking for days for a good and easy to implement Multiplayer system. Which i can have multiple loobys and a ranking system. Phonon does that but its laggy

fickle geode
grim bramble
fickle geode
#

but please do your own research and prototype because I have no experience actually implementing this. I mostly did some research into different solutions but for my usecase it was simple enough to write it myself

fickle geode
#

Ah I see, yeah that is the fee for publishing the game on Steam, it's not specifically paying for the networking though

#

You also get it back if your game has 1000$ revenue

grim bramble
#

So i can try that steam feature

#

Thanks

#

But if implement that, the game wotn be on steam servers right? When i publish and pay, it goes to the steam server?

grim bramble
#

Because on the documentation i dont see any reference to spawning objects

#

And other things

granite yew
#

How can i make it for my social deduction game's informed minority (the traitors) to know who eachother are? I am using Photon Unity Networking/

#

the way i want to do it is so that the players with bad roles will see eachother with red names while the others dont.

fickle geode
#

You can also mix the pipes and toilets, so such Steam for the infrastructure and Mirror for the multiplayer logic, however finding a good integration is challenging I believe. If you feel you are strong programmer with a good understanding of UDP and server-client architecture then for small projects I would even recommend writing it from scratch.

opaque dew
#

Photon is only free up to 20ccu, something to keep in mind.

fickle geode
merry arch
#

Hi! I have been reviewing the code of the example projects and I dont understand this (from mirror)

#

NetworkServer.RegisterHandler<CreatePlayerMessage>(OnCreatePlayer);

#

this is done on the network manager when the server is started, CreatePlayerMessage is a struct that only contains a name, while, OnCreatePlayer is a void method

#

this is on the Chat example

grim bramble
grim bramble
#

The only thing that i dont understand is where the server is hosted if i use MLAPI and steam

fickle geode
#

it totally depends on the game, you can have one of the players be the "host" (server) and the other players will connect to that player (Client/Host model). In that case you don't need any hosted server. If you are able to do that for your game, it simplifies things in most cases so I'd recommend it. Now if you have a case where you need a central server and the players connect to that server, yes, then again it depends on what it is that the server does, if it just passes the data from player A to player B that means you need a Relay server and Steam (and some others) can do that. Now if you need what is commonly called a dedicated server that runs a headless version of the game that server can be hosted anywhere, but that is outside of the scope of I think all of the big frameworks. The connections to that server can be done with again Proton, Steam, MLAPI, etc.

#

But, judging by your answers, I think you might have to first look into your game multiplayer architecture before you can decide on any frameworks. In my opinion of course.

#
grim bramble
#

Games like League of legends and Apex legends, the lobbys where players are, are on a server or the game sees who have the best PC and select him as a host?

#

What i pretend is this:

#

I just need to know how to structure this. Because i make a server, and i use steamNetwork to connect to that server right?

#

Can i host my server on Steam?

#

Or i have to use another hosting website?

#

"The other option is to use something like the SteamP2PTransport, which will work without the need of setting up any servers if you release your game on Steam." This is on Unity MLAPI documentation, that from what i understand is saying that i can use Steam servers

#

But isnt steam just a conection?

#

I am lost xD

mortal horizon
#

No, the transport allows you to use steams relay servers

#

You can't host dedicated servers over steam

#

Steam networking is strictly for client host games

grim bramble
#

And use steam to connect to it

mortal horizon
#

No you would just connect to it normally

#

You wouldnt need steam

grim bramble
#

But because of port fowarding i need steam

mortal horizon
#

No the VPS provider you pay will have port forwarding

#

or wherever you host it

grim bramble
#

Ahhhh i get it. So i just need to use MLAPI

mortal horizon
#

Yes any networking library would do in this case

grim bramble
#

Nice
For testing over two different machines and network, i need to host or is there a easy way to test?

mortal horizon
#

you can just host server locally and join over lan with other computer if theyre on the same network

#

but for over the internet testing you will need to port forward or pay for vps

grim bramble
#

Can you talk more about that VPS? I place the server on a vps?

grim bramble
#

i used photon but it fells laggy

warped pilot
#

I solve this problem

#

as a old minecraft developer decided to make it like minecraft

grim bramble
#

In Photon Pun 2, the CCU limit is for lobby or for all lobbys?

#

I will try first with Photon 2, if the lag is aceptable i will continue with it

grim bramble
#

Or mirror xD

#

Dammmn its hard to choose

mortal horizon
#

@grim bramble Mirror is free and supports the server architecture you're describing, pun2 is another relay service similar to steam (but includes netcode)

dusky storm
granite yew
#

Hello, i currently have issues with my system for my social deduction game where players on the Mafia team can identify eachother. My issue is that when mafia players identify eachother (they identify eachother by name color since white = not mafia and red = mafia) only happens when the MasterClient is Mafia and only for the MasterClient and not the other mafia members plz help me. (using Photon Unity networking)

stiff ridge
#

The logic for that is completely custom, so it's a bit tricky to help with.
Also, I did not understand yet, what the problem is. Something only happens when the Master Client is in the Mafia? But .. what happens then?

granite yew
#

let me explain

stiff ridge
#

Also .. why is this part of the game state fit in the color of a player name??

granite yew
#

thats how mafia members know eachother

#

if ur mafia u have a red name visible only to u and other members

#

anyways

stiff ridge
#

but that's something that is just a visual effect, based on a custom player property?

granite yew
#

in my game there is 10 players, and 2 of them are mafia and i want the mafia to know eachother via red name and the masterclient(if mafia) is the only one who knows who the others are, meanwhile if a non masterclient gets mafia, they wont know their teammate

granite yew
#

Maybe the Mafia GameObjects dont get synced since i only call the function where roles are assigned so how can i sync GameObject references?

stiff ridge
#

You can't. You can only refer to networked objects and those have a PhotonView.viewID.

granite yew
#

damn it

stiff ridge
#

But .. the objects should not matter in this case. Being in the mafia or not does not relate to an object but to the player / client. So you could sync that via Custom Player Properties or Room Properties.

#

Each character that gets synced (for moving) has a PhotonView anyways and the PhotonView also has a reference to who controls it. So you know the Player and actornumber.

granite yew
#

like custom properties is a hard to understand as a math test

stiff ridge
#

Well, I don't have any better way to explain it, really. You might need to experiment with this, without the burden of doing a complete game. In worst case, try to update a property and check what that does for the other clients.

#

The PUN Basics Tutorial may also help establish a few basics that may be missing. The terms and key APIs are explained there in some context, which may help.

grim bramble
#

Should a network with dedicated server be my first game?

haughty heart
#

No

grim bramble
haughty heart
#

The complexity of a networked game is hard enough for even experienced developers.

#

For someone just learning how to code, making a single player game is already an enormous amount of work.

deep jungle
#

Hey so I'm trying to pass along a PlayerManifest that holds all the data associated with the player. So like when a client logs in to a server they then send username, player color, inventory, etc in a manifest file to the server that then syncs that data with all the other clients.

What is the best way to do this? I can't send an RPC without ownership of "something" on the client.
Is there some mechanism specifically for sharing initial player data that I'm not seeing? Or is the standard practice to do a data sync step after a player is all connected to the server?

Using MLAPI/Netcode for GO

runic rampart
#

Is it possible to dynamically add components to networked prefabs?

mortal horizon
runic rampart
#

Can't find it in the documentation

slim merlin
#

I'm going through the Photon Fusion documentation, and something caught my attention. How's it possible to drag and drop a prefab into a slot with type NetworkPrefabRef? I thought the type of the slot had to be GameObject, and NetworkPrefabRef doesn't even derive from GameObject.

spring crane
#

Unity can serialize component references

slim merlin
#

Huh, thanks Danny, I'll have to look into that!

spring crane
stiff ridge
broken snow
#

Hello good people, im trying to create a small 2d tank game, im moving the tanks via rigidbody2d, that means im using FixedUpdate, but my client does not seem to fire FixedUpdate, i cant really find anything on Google about this, can somebody help me ? 🙂

spring crane
#

FixedUpdate is called on all active components. Confirm it by logging without any conditions

#

Networking shouldn't really affect this

broken snow
#

Ok ill try thx 🙂

dull eagle
#

How can I properly set a gameobject's parent and sync it all over the clients and the servers of course as well.

#

Mirror

mossy solar
#

which multiplayer api is the best?

vital hawk
#

now just wait for any MP asset dev join the discussion with their "ours" comment

#

(you won't find many unbiased answers to that question)

dull eagle
#

They are not too different.

mortal horizon
slim merlin
#

In Photon Fusion, anyone know what NetworkPhysicsSimulation3D does? It's not described in the tutorial or manual, yet it's used in the basic sample project.

gray pond
# dull eagle Mirror

Mirror has it's own Discord for support...link is in Mirror's ReadMe and in the Asset Store page.

weak plinth
#

Hi,
I'm working with photon pun 2.
I'm trying to sync OnAnimatorIK using PunRPC within this method.
But when doing this, it only works local but it doesn't sync with the other players, any idea why?
I'm also using the photon Animator view, but that shouldn't matter I think?

merry arch
#

Hey, Im trying to have my players connect to my server with a name they set before they connect, however, in my code, all the players end up being named after the host

#

what am I doing wrong here?

gray pond
#

answered in Mirror's Discord ^

lapis vapor
#

Guys, is there an Ideal value for PhotonNetwork.GetPing which can be considered as a disconnection?

stiff ridge
#

There is a callback to notify you of timeouts.

pale ore
#

hi I can see this being a subjective question but I'm going to venture into networking soon and was wondering what's a good go to networking base for coop (1-4p).

stiff ridge
#

For coop games, you may get away with some inconsistencies. The players work on the same team after all.
It depends more on what you want to achieve gameplay-wise. Which genre? How many characters, units, enemies, etc?

crude juniper
#

Hi guys, im implementing multiplayer via mirror in my game and i just cannot figure out this issue im having. Basically.. the host + 1st client can move around and the movement is happening on the 2nd client. But the second client is stuck and can't move. I know its cause the command/server code sin;t running but i just cannot figure out why, i've looked at that many tutorials and examples and my code seems 100%

https://pastebin.com/ma4jnrMm

any help would be great!

vital hawk
#

@crude juniperhave you tried Mirror discord?

crude juniper
vital hawk
#

just mentioning that in case one didn't know it exists, probably get more mirror users eyes on the issue there

grave ice
grave ice
mortal horizon
grave ice
mortal horizon
grave ice
#

thank you for the clarification

wooden stone
#

im having trouble understanding the playfab docs for groups, im not sure what an entitykey is

crude juniper
ornate sable
#

i watch some tutorial about photon, they pick photon PUN but i dont understand what it does, btw what other type does?

short needle
#

They all are diffrent things what i know..
example Chat & Voice stands for what they stands for, they are Chat and Voice add-on (I guess you can call them "Add-on")

Here's the diffrent between PUN & BOLT
https://doc.photonengine.com/en-US/pun/current/reference/pun-vs-bolt

Fusion and realtime is something else, try google it up.. I hope i helpt you a bit atleast (:

ornate sable
#

when i build project with photon,this happen, i dont know what is this

short needle
ornate sable
short needle
#

Example: C:\UnityProject

ornate sable
#

im sr but i dont know what file u need

short needle
ornate sable
#

ah, right here

short needle
#

Yeah, drag that back one folder

#

Do it in UnityWorkSpace

#

Call the folder Build or something there

ornate sable
#

like this?

short needle
#

Yeah but

#

Create a new folder

ornate sable
#

oh,ok, i create

short needle
#

called Build or something yeah

#

Then it should work

ornate sable
slow lichen
#

How to create offline menu scene and game scene?

#

When I connecting to host I should unload main menu and load game scene

#

Or how it should work?

short needle
#

What networking system? @slow lichen

slow lichen
#

Netcode for gameobjects

ruby hill
#

It is better netcode than mirror in performance?

spring crane
#

Which performance metric?

solar warren
#

my game was working fine with multiplayer connecting to each other but there was no player syncronisation as it had not been set up but when i do set it up the players no longer move by controlls at all the host of the server just jitters back to the oringal spot but other player wont move
i folllowed this:
https://youtu.be/AZRdwnBJcfg?list=PLhsVv9Uw1WzjI8fEBjBQpTyXNZ6Yp1ZLw&t=1122

broken snow
#

Hello, has anybody had any success in syncing a string in Networkvariable ? Im trying to follow Dapper Dinos Playername tut and I cant really get it to work.

fluid bison
#

is there any way I can color text on a server build

mortal horizon
fluid bison
gray pond
ocean snow
#

Hey guys! I am really new to Networking and I have a question about it. I just installed Photon and multiplayer to my game in Unity. I just found my first problem with it. My ragdoll player is glitching on the screen of the user. Only the ragdoll of the other player is glitching. I don't understand why this is happening. Can someone maby help me?

lapis trench
#

How do i make server like in Rust? I want it to run always even if the host disconnected

spring crane
#

Unity's netcode for gameobjects, Mirage and Mirror are frameworks you can use to explore this

heady stump
weak plinth
#

hey i have issue with photon network
when i join game i can move and rotate
but if someone joins game i cant move or do anything
and how to add here thing so if player leave the camera will stay in same player

kindred sinew
#

Hello, I'm trying to implement **MLAPI **for a first time.
I achieved quite nice Movement for Host and Client players.

Now I'm trying to generate and assign color to both Host and Client.
I don't understand sync of NetworkVariable.OnValueChanged ->

  1. Host starts game, asks server to generate color. OnValueChanged is triggered and Client (player 1 - on the host computer) successfully changes its color.
  2. Client joins game, let's call him Player2. He asks server to generate color. OnValueChanged is triggered so both Host and Player2 successfully change color of the Player2.
    2b. Client never gets information about Player1 color - so OnValueChanged is never triggered here.

Code: https://gdl.space/lolelesero.cs

Thanks.

heady stump
heady stump
heady stump
#

I mean, does Player2 get that information about Player1

kindred sinew
#

Well, yes, I can see the correct color of P1 in P2 editor

#

Basically Server is not informing new clients about last state of the NetworkVariable

heady stump
#

Okay, it seems that this color change is only transmitted on change, it also needs to be updated about all players when a player joins. I'm not well versed in MLAPI but basically however the position and rotation data is sent about old players to new players is also how you need to add color information on some kind of a join function. Does this make sense?

#

And this will probably be a recurring issue when you want to add other things such as health, weapon equipped and so on..

kindred sinew
#

Not really as Transform is sent via NetworkTransfer class. That's something completely different.
Color is sent via NetworkBehaviour's NetworkVariable - which sync is not working on join.

#

Yep. I need to find out a way to make NetworkVariable sync every time new client joins.

heady stump
#

I see

#

I wish I knew more about MLAPI so I could help, good luck

kindred sinew
#

It's fine, hopefully someone else will notice my call for help. Thanks.

slow lichen
#

How I should create main menu?

#

I should use NetworkSceneManager or just scene manager when I loading the game scene?

#

MLAPI

slow lichen
#

Where is should be NetworkManager?

#

In main menu or in game scene?

wind hinge
#

I need help with an error i get when i leave my match. This is a picture of the errors:

#

After i left the match, I cant rejoin another one.

short needle
stiff ridge
#

And like Nrex suggests, it's of interest to know how you ended up there. Are you using DontDestroyOnLoad for any object in any scene? And .. are you maybe using GameObject.Destroy in some place, instead of PhotonNetwork.Destroy?

small kettle
#

@wicked fox

wind hinge
wind hinge
kindred sinew
#

Would anyone know how to trigger NetworkVariable.OnValueChange for P1 when P2 joins the game as Client?

wind hinge
stiff ridge
past elk
#

I have a working singleplayer 3D shooter game, pretty basic stuff with 1 player and 2-3 types of enemies with AI

How do I get started with making this game have networking with a 2nd player? Aside from adding P2's logic (which should be identical to P1, except maybe with small UI changes and obviously reacts to P1's attacks differently), will I have to refactor my entire game (or worse, even build from scratch), or do I just need to change a couple things to make this work?
Sorry if this is a vague question, but I just don't know where to start (have almost 0 idea how networking will work, except a vague understanding of basic protocols like TCP and UDP), and the Unity Manual seems to suggest multiple ways to handle networking

stiff ridge
#

There are multiple ways to handle networking and how much you have to refactor depends a lot on how you built your game initially. It also depends on which networking solution you pick (cause all are slightly different).

#

There is no way to guesstimate how tricky it will be for any game, as there are endless ways to implement singleplayer (and then some more for multiplayer).

#

I would recommend having a look at the various networking solutions available. Take a few hours for your top 3 and build something independent from your main project. Then decide which one you'd use.

stone wind
#

guys im looking to give a shot on learning steamworks.NET or facepunch.steamworks can i do the entire netcode using them or should i just use steamworks as a transport?

strange stag
#

Is steamworks paid? or there are options, some are paid, other are not?

mortal horizon
#

steamworks is free as long as you pay the 100 dollar fee to steam for your game

weak plinth
#

hey guys I am trying to get a dedicated server build to run on centos but it's not loading. any ideas?

strange stag
#

I am using Photon, my game is fine but has bugs in reloading the game, the collision detection is slow and etc.

#

Please look at this video to see the game, I have shown the problem in the video

#

It is the errors

#

Thanks in advanced

ornate sable
#

im using photon, the math is :
i join a room A, if room A dont exist, create new room A
how can i fo that? im new to photon and dont know how to write

ornate sable
strange stag
#

That can be done by this code:

public void CreateRoom()
  {
    if(string.IsNullOrEmpty(roomNameInputField.text))
    {
      return;
    }
    PhotonNetwork.CreateRoom(roomNameInputField.text, new RoomOptions()      {BroadcastPropsChangeToAll = true });
      MenuManager.Instance.OpenMenu("loading");
} 
#

This is the one i am using

#

And if the room exist, it will get you to the page saying the room already exists

#

so my title menu look like this

ornate sable
#

so we have to logic ourself?

strange stag
#

Can you explain?

#

My project is like if you want to create a room, type a name and it is created.
If you want to join a room, You will see a list of room and click on anyone to join

ornate sable
#

um, let me have a look

#

i mean, there is nothing as OnJoinOrCreate?
if the room already exist, join it, if not, create one

#

oh, i found it lel xD

strange stag
#

I dont know if it is there but you can do like if in PhotonNetwork.RoomList (Pretty sure it is like this) if name matches then join room, else create

ornate sable
#

okok

strange stag
#

What did you do? Is there something like JoinOrCreateRoom?

ornate sable
#

a, yep, i found this, and it work

rapid horizon
#

Hello. What the hell is this thing talking about ??? i just dont understand what it means

short needle
gray pond
#

Answered in Mirror's Discord ^

celest halo
#

Hello People!
I'm using Mirror and NetworkTransform, NetworkRigidbody and NetworkAnimator for my player prefab. I'm having weird problems since yesterday. If I change the scene as the server (which makes everyone travel with the server, that's okay I want that), I get the error message "NetworkClient is not ready" on the Client and the client gets disconnected.

The error message seems to get called from the NetworkTransform script. I didn't have this problems two days ago, it just "appeared". Is this maybe a bug?

lethal pasture
#

I made multiplayer with Photon, and when entering the room, two players are summoned and no movement is transmitted.

gray pond
celest halo
lean anchor
#

im trying to disabled and enable object (using setactive) but it doesnt sync between players

lean anchor
#

photon 2 pun

lean anchor
gray pond
#

you'll have to wait for someone who knows that package...I don't.

celest halo
#

What is the best most simple way to get kinda clean collisions using NetworkTransform and NetworkRigidbody? Pulling down the syncing interval works a bit, but I doubt that this is a way.

#

It doesn't have to be perfect, but avoiding overlapping objects would be a good achievement, since that causes clients to collide multiple times.

sweet pewter
#

whats your sync interval?

#

i know its common for it to be pretty quick

celest halo
#

0.02 for transform & rigidbody

#

i still have overlappings tho, even if it's a lot less than the intervals of 0.1 before

celest halo
sweet pewter
#

Might wanna just increase the size of the hitbox

#

Just a tad

celest halo
sweet pewter
#

yeah.. lol.. good point.

lean anchor
#

i am using photon pun 2, and whenever i disabled objects (using .SetActive();) , it doesnt sync between players (meaning the other player cant see that the object was disabled)

#

how do i sync disabling of objects? i tried following a tutorial but it sent me an error saying "namespace "Player" could not be found" after i used: public override void OnPlayerPropertiesUpdate(Player targetPlayer ,Hashtable changedProps)

slow lichen
#

How to work network scene manager? He just syncing scene change?

#

MLAPI

rapid horizon
flat coral
#

@ Anyone ... Does anyone have any examples or can point me to a good tutorial for PUN 2 item spawning & pickup? New to PUN and can't find much more that Player instantiation (and I already know how to do that) :S

short needle
rapid horizon
#

yup am fine now but if you can explain what that meant that would be great

#

i was helped from the unity nerworking server

#

wait it was the mirror server

lean anchor
lean anchor
#

im using photon pun 2 and i cant find a way to use OnPlayerPropertiesUpdate() because it says the namespace "Player" cannot be found

olive vessel
#

You likely are missing a using directive

#

A configured IDE should tell you this

weak plinth
#

is dedicated server mode like headless mode?

spring crane
#

Yes, but it does additional stripping of systems that are likely not needed in the server build.

short needle
weak plinth
#

ok so I connected the linux computer and the windows computer together. I'm not sure if this is possible, but I setup a portforward on xfinity on the linux computer. I can ping it with like 50% loss rate. Anyway. can I use that to host a server? or what would I need to connect to this instance from another machine off the network?

lean anchor
#

i have a problem with photon pun 2

the script i have is written ok however i am still getting an error "no suitable method found to override"

graceful harness
#

is there a way to instantiate an object, change a variable on a script of it, then spawn the object and have all clients versions of that object have that changed variable?

mental geode
#

Hi there, Im pretty new to unity multiplayer and ive been experimenting with unity with 2d top down movements. ive ran into a small problem where IsLocalPlayer returns false on clients, what would be the main problem for this? Any help is much appreciated!

strange stag
strange stag
#

like gameObject a = PhotonNetwork.Instantiate(_prefab, _position, _rotation)

#

a.GetComponent<SCRIPTNAME>().myFunction("Whatever value you want to have")

#

_prefab should have a script called SCRIPTNAME (whatever you like), and the script should have a function to change the variable

#

'or'

#

You can do like

#
a.GetComponent<SCRIPTNAME>().variable = THISVALUE


graceful harness
#

thank you

old spindle
lean anchor
grand elm
#

Hi, how can I create a connection from c # to a socket.io server?

weak plinth
#

So im using the unity netcode package and wanted some advice.

#

the game I'm working on is an auto battler like TFT and it requires it to be server authoritative so the server will run all the simulations and stream it to the client.

#

but i kinda just realised that when i build the code server code will be built with the client's code which probably will increase the size of the build.

#

is it fine to just leave it like that or are there any good practices

weak plinth
#

also how would one approach matchmaking

weak plinth
merry breach
#

Not sure where to ask this, but my friend and I are having trouble getting Unity Collab to work with us. Our project wouldn’t sync on my end, so he sent the files over to me and they’re not syncing on his end. Collaborate is enabled and the package is up-to-date on my end, not sure about his end though. Anyone have any ideas on what to do?

cloud orbit
#

Hey guys, anyone here willing to share some experience with Unity Relay? I'm trying to integrate it with our project for the first time and I'm struggling a little bit. I keep running into error messages that I don't know how to interpret.

molten dragon
#
public class ServerSocket :MonoBehaviour
{
    string ipAddress = "";
    int port = 54010;

    TcpListener server;
    TcpClient client;
    IEnumerator doClient = null;

    void Client_Connected(IAsyncResult res )
    {
         client = server.EndAcceptTcpClient(res);

    }

    private void Update()
    {
        if(client != null && doClient == null)
        {
                doClient = DOClient();
                StartCoroutine(doClient);

        }
    }

    IEnumerator DOClient()
    {
        int bytesReceived = 0;

        byte[] buf = new byte[49152];

        var stream = client.GetStream();
        do
        {


            bytesReceived = stream.Read(buf, 0, buf.Length);
            if (bytesReceived > 0)
            {
                string msg = Encoding.ASCII.GetString(buf, 0, bytesReceived);
                if (msg == "QUOTE")
                {
                    byte[] quoteOut = Encoding.ASCII.GetBytes("I am from server");
                    stream.Write(quoteOut, 0, quoteOut.Length);
                }
            }
            yield return null;

        } while (bytesReceived > 0);

        doClient = null;
        client.Close();
        client = null;

        
    }

    void Start() 
    {
        string ipAddress = "127.0.0.1";
        int port = 54010;
        Debug.Log("start");

        IPAddress ip = IPAddress.Parse(ipAddress);

        server = new TcpListener(ip, port);
        server.Start();

        Debug.Log("Waiting for clinet on ip: " + ipAddress + " port : " + port);

        server.BeginAcceptTcpClient(Client_Connected, null);

    }




}
``` idk what wrong with it , my server get hang when i try to connect to it
strange stag
#

I think the function does not take in a simple hashtable as an argument

#

It takes special hashtable by Photon

#

It is like this

#

ExitGames.Client.Photon.Hashtable

#

Fine?

#

My code looked like this

#

Then I used OnPlayerPropertiesChanged override to make changes accordingly

#

I hope it is clear

lean anchor
molten dragon
grand grotto
#

so like im a complete beginner in networking and i noticed they've given the wrong github link on the site to install the package i hit the copy button thing as well hoping that it would copy the legit github link but no luck

olive vessel
#

Works for me with that URL

grand grotto
#

im on version 2020.3

#

it just gave me a bunch of errors saying couldn't find the package you were looking for

#

i tried again after restarting and now it says that the package was found but there was some error adding it

#

guess i'll just restart it again and try

#

yep it works now

#

lmao

olive vessel
#

Well there we go

#

Thanks Unity

grand grotto
grim current
#

any idea how can i do it ???

upper wharf
#

hello if i want to learn how to make a mmo like tibia and ultima online, is unity a good idea for?

alpine cape
#

Is there anyway to test my game without building it for a multiplayer game? (Server and client running at the same time)

spring crane
#

Often you can run in host mode for basic testing. You can easily setup 2 editor instances with ParrelSync.

neon timber
#

helloo

#

how can i call an RPC method for a specific client?

spring crane
#

Network message is probably what you are looking for, since RPCs at least in the context of these networking libraries generally imply some specific gameobject instance, which you won't be able to do until you have spawned some objects with network identities of some kind

neon timber
#

in Godot we have autoload scripts

#

and we can call them like Foo.rpc_id("method", params...)

spring crane
#

It's probably not that different once you are actually executing code on a gameobject that is a networked object, but the next message after OnClientConnected is probably not really tied to a networked gameobject, but more general client messaging

neon timber
#

what is CustomMessagingManager?

spring crane
#

Haven't used netcode for gameobjects, but I imagine it just handles some stuff for you when it comes to sending custom messages. You can probably peek at the source to see what it is doing for you

neon timber
#

there are static functions

#

for adjusting objects

#

what if i need two connections at same process?

#

who are inventing these things?

#

is there a Unity engineer here?

#

im really curious

#

Unity just hire me

spring crane
#

Yes, but users are not allowed to ping other people into questions. I would check out the dedicated discord server for Netcode if I wanted to increase the odds of relevant people seeing it

spring crane
#

Yes, invite is in the pinned message

neon timber
#

big companies are interesting

#

Join button is not accessable

#

am i at an impossible level of testing things?

#

or other peoples

#

can't do that

spring crane
#

Hey that's on Discord 😄

neon timber
#

yes yes

spring crane
#

Jump to the message itself

neon timber
#

just another money maker

neon timber
#

thank you so much

#

to be honest

#

Unity company managers

#

listen to me

#

Unity devs are copying project folders and linking them with symbolic links

#

to open multiple editors on same project

#

for just an empty scene

#

when i start NetworkManager server and client in two Unity editors

#

my fans are going crazy

#

im using 10 Godot editors with a complete game

#

one server and 9 clients

#

i can start multiple Godoot editors on same project and im able to debug all

#

and my fans are not going crazy!

sweet pewter
#

cool

#

fix unity

neon timber
#

this reason is a reality and it is enough to say Godot is extremely better engineered

#

i understand you are making unnatural extremely high level APIs and interfaces for making everyone able to make games

#

but i can't just do

Server server = new Server();
server.listen(port)
#

in your engine

#

there is no such API

#

this is not normal

#

open source development will grow

#

these kind of company management is not good for you

#

i don't want "click here, drag this and yes there is a cylinder and it is networked, it is moving for all clients without any code.... cool!!!"

#

so what is this approach for?

#

i understand but it is really interesting im not able to just start a server and connect it

olive vessel
#

So you want the engine to do everything for you, that sounds boring

neon timber
#

i mean Unity is trying to do everything

#

i just want natural lower level interfaces

olive vessel
#

Well you could have used the Unity Transport then

neon timber
#

oh god

#

finally i see something looking "natural"

#

OMG

#

😱

neon timber
neon timber
olive vessel
#

¯_(ツ)_/¯

languid plume
#

So I was following a tutorial to better understand Photon.pun and I have it working to a point. In the tutorial they mention using if(!PV.mine) to destroy the other players rigid body component so that the physics of the movement/jumping aren't calculated on both clients.

However, my characters have CharacterControllers and if I delete them, neither player sees the other player. Is there a solution to this? Must be some workaround right?

alpine cape
#
    const int SPEED = 5;
    [SerializeField] Rigidbody2D rigidbody2d;

    [Client]
    void FixedUpdate()
    {
        if (!isLocalPlayer) { return; }

        CmdMove();
    }

    [Command]
    void CmdMove()
    {

        // validate 
        RpcMove();
    }

    [ClientRpc]
    void RpcMove()
    {
        float x = Input.GetAxis("Horizontal");
        float y = Input.GetAxis("Vertical");
        rigidbody2d.velocity = new Vector3(x, y, 0) * SPEED;
    }

Hey, I'm new to networking and was wondering how I can implement basic movement validation for server authority? (using Mirror)

verbal lodge
# neon timber i can start multiple Godoot editors on same project and im able to debug all

Your points are noted and here are a few thoughts on your comments:

  • It looks like Unity Transport or another low level networking library is more alike what you are looking for.
  • In regards to symlinking for opening multiple editors I'd personally recommend ParrelSync which is a tool that makes that process a bit easier. It's something we are looking into though and hopefully will be able to provide better solutions.
  • Unity Transport does not support WebGL (no websockets currently)
opaque dew
#

Oh heck yes! Looks like FishNet is finally out!

lean anchor
#

how do i sync particles?
i am using photon pun 2

unkempt flame
#

HELP

weak plinth
#

Hello guys i need some real help with my project, help with server dedicating and listing , 1- i wanna list my server so people can join , 2-Server run 24/7 itsa survival game pvp (we are stuck)

#

any help/tips ?

formal ermine
#

is there anyway to make the same terrain generation for more people on a multiplayer game?

#

i am using photon pun 2

formal ermine
#

so i can't make more seed but the player have the same?

#

sad

azure crown
#

I am having issues with joining others on Android LAN. I am using Mirror. Firewalls are checked and fine. After failing to join, hosting and everything else stops working until the app is closed and reopened. But Hosting works just fine before joining. What could be causing this?

olive vessel
#

Every different game can have different seeds, but if you want people to see the same thing, players who are in servers together both need the same seed for that world

#

Isn't that how Minecraft does it? Seed for the world data and then any specific changes

shadow spoke
#

I started looking into it, but then things happened and I stopped looking into the bug

shadow spoke
#

That would be info about blocks destroyed since generation, etc.

#

But if you seed the world the same across all instances, then you should get the same result... in theory.

obsidian remnant
#

guys how can i change the perspective for each client?

#

like the concept for it

#

i am remaking my first ever game, and im adding multiplayer

#

however, i want the perspective to change for the player or enemy

#

im thinking of just switching the id's

#

but it didnt work

weak plinth
#

Any tips how can i make online servers in my game and list them so people can join these servers , they cant make servers only pre-made “official” ? Like ark or rust

azure crown
#

@shadow spoke Oh really? So what should I do? Should I make a bug report for the Mirror devs?

shadow spoke
azure crown
#

@shadow spoke Alright, thanks a lot!

shadow spoke
#

Other services exist too, but your mileage may vary.

weak plinth
#

Wow thats very helpful and how can i make dedicated server where the ip is public we made on but its local any tips ?

#

Thanks 🙏

shadow spoke
#

You'd have to somehow get a public IP via an external API

#

Services exist that allow you to query it and it'll simply say "your ip is blah"

#

You should not be hosting official servers in your basement connected to the outside world via your ISP; use a $5 VPS from Vultr or Linode and learn a little Linux knowledge in the process

#

Unless you have a static IP and you also have port forwarding, you will have pain. Not to mention, your ISP might have something in it's terms of service that prevents you from hosting game servers on their connections for whatever reason (I've seen some australian ISPs do that)

#

Oh, and mobile network servers over 3G/4G? No.

shadow spoke
shadow spoke
#

Trust me on that one

#

Hosting any server on 3G or 4G is pain incarnate

weak plinth
#

True

shadow spoke
#

However, it is a very good real world test on how your network code handles turbulence 🙂

obsidian remnant
shadow spoke
#

What do you mean?

obsidian remnant
#

how can i explain this

shadow spoke
#

Most of the pokemon games when a player selects an option to attack or whatnot you get a "WAITING..." prompt

#

I'm thinking back to Pokemon Red and link cable days

#

You would select what you want to do, then the menu at the bottom is blanked with "Waiting..." popup window

obsidian remnant
#

yes they wait till the enemy finishes their turn

#

i want to replicate that

shadow spoke
#

Yeah, so? Why would they "switch sides" or whatever?

obsidian remnant
#

the view

#

wait

shadow spoke
#

I have not seen any pokemon game switch sides in a online match in a 2D game, maybe in 3D pokemons the camera will zoom in and do action shots, etc

obsidian remnant
#

that kind of switch

#

it kinda sucks not having english as my native language

#

cant explain things

#

so basicly lets say

client one does not have a sprite for now
and client 2 is the circle

#

i want the client 2 to see the circle in the spot of the client one's sprite

#

and vice versa

#

ok this is the view for client 1

shadow spoke
#

Ok, I kinda get you

#

Go on

obsidian remnant
#

but this is the view for client 2

#

do you get it?

shadow spoke
#

Ahh

#

Hmm

#

It is possible to do this.

obsidian remnant
#

well thats good news

shadow spoke
#

Off the top of my head, I would have two structs in memory that holds the local player and the remote player data.

#

These structs would simply be the UI data, like HP and whatnot.

obsidian remnant
#

could it work with scriptableobjects?

shadow spoke
#

Honestly have little to no experience with that

#

But basically

#

you would have a script that controls the UI elements

#

Are you local player? Then you are closest to the camera.
If not? You're away from the camera.

obsidian remnant
#

i think starting in 3d would have been much easier

shadow spoke
#

2.5D works, you can use bill board sprites like what I think some DS versions of Pokemon did

#

they had a 3D-ish environment but the sprites where 2D

obsidian remnant
#

i could have the sprites always rotate to the camera 🤯

#

that might look wierd and good

shadow spoke
#

Another example is Golden Sun on GBA

#

that uses a 3D-ish rotation system, and the characters are scaled/zoomed accordingly

#

I feel though you should tackle the visual stuff first, then worry about the network bits

obsidian remnant
#

is there a way to go from a 2d project into a a 3d one?

shadow spoke
#

yes, but it's recommended to backup your scripts and just start a new 3d project

#

I mean, there's a few switches you need to flick to get unity out of a 2D mode but it's easier to just use the fresh start

rocky thunder
#

Hi, I am a beginner trying to make a 1v1 fighting game, but I am struggling with what I should send to the other player:

  • Only our player's state / Ours and their state
  • When attacking, do I just include an "attack" field in the data sent on the next state update? Or do I send a seperate message which would only contain the "attack event".
    Any help/info appreciated! 🙂
weak plinth
#

what's the proper way to build a dedicated server in 2021? there's no more server build option, and I can't get the dedicated server option to fully run.

lean anchor
#

how do i sync particles in photon pun 2

weak plinth
#

does anyone knows how do we connect these servers after making them using node to unity so we can server list them in there?

graceful zephyr
#

Every other way is bad tbh

sweet pewter
graceful zephyr
#

Eh… no, I mean.. it’s not really a relevant thing… “attack data “ all you should send is input

#

How it’s sent as long as it’s low latency without Head of line blocking isn’t really relevant

weak plinth
#

does anyone knows how do we connect these servers after making them using node to unity so we can server list them in there?

rocky thunder
#

alright thanks guys, I'll look into it

weak plinth
#

hey i have issue with photon, when i join lobby everything i normal but when i join from other session i cant rotate and i dont see other player moving but i see when other player moves the boxes and its look like the boxes magicaly move

#

and when i shot i dont see bullet from other session

#

when i join the cameras are switching and when i leave it does magic too

cloud orbit
#

Hey guys, I'm trying out relay right now. Since one of the players will be hosting my game on their machine under this architecture, I'm wondering if they can connect to it locally instead of going through Relay. I imagine that this would be more efficient and cost-effective but it doesn't seem to work when I try.

shadow spoke
#

@cloud orbit "Connect to it locally" ?

#

You mean LAN play + relay?

#

You'd have to have two transports running

#

One listening for local connections, the other handling relay

cloud orbit
#

Exactly. It would all be on the same machine but yeah basically a LAN connection

#

I didn't know that this would require two seperate drivers though. I figured I could use the relay one for both

#

I'll try that though. Thanks @shadow spoke

shadow spoke
#

Terminology for that is "multiplexer"

vital yoke
#

How do I create a mirror multiplayer chat? Do you have a tutorial video?

olive vessel
#

I'm sure there is a tutorial, I remember seeing it

cloud orbit
misty scroll
#

Hello, how do I make a multiplayer game. I know this is very general but like with io games how does it get people in the same server and stuff.

weak plinth
#

ok guisz
mlapi
or mirror

olive vessel
misty scroll
#

Yes true lol

olive vessel
#

There's a lot of ways of doing it, some better suited to your needs than others

#

Unity has it's new official system, Netcode for GameObjects

misty scroll
#

Yeah i see. I will try to do some research

olive vessel
#

Then you have community solutions like Mirror and Photon products

spring crane
spring crane
rapid horizon
#

Howdy, there i got a problem with mirror, The cilent cant call some commands, but the host can What should i do . . . .

#

These are the commands clients cant call but the Host can

#

these is where am calling that Command

#

what should i do

spring crane
#

What happens if you try?

celest halo
#

Always worked for me before

celest halo
rapid horizon
#

like this ...

celest halo
#

and all of it inside if(isLocalPlayer) because you'd try to call it for other people otherwise

celest halo
#

but I don't want to "teach" anyone, because i am new myself but this works for 3 players right now for me

rapid horizon
#

xd am newer than you are Probably

weak plinth
rapid horizon
#

quick qn MLAPI and mirror which one works better

#

how do i install MLAPI now or is MLAPI just gone / changed to Net for gameobjects

spring crane
#

Yea it was renamed

minor iris
#

Let’s say there’s a game, in said game all players are put into 1 server, every single player online into 1 instance, would that be possible?

oak flower
ember kettle
#

Sorry, I didnt know this was a whole controversy. I've just used fishnet before and thought I could give my opinion

#

good to know

#

👍

shadow spoke
#

There are more than one way of doing things.

weak plinth
weak plinth
olive vessel
#

Unity acquired MLAPI, made loads of changes (perhaps rewrote it) and then renamed it to Netcode for GameObjects

forest kite
#

Host works completely fine, but client conneting to host doesnt move just plays the animations.

misty scroll
mortal horizon
#

if you want to make io games your best bet is mirror, afaik mlapi and photon (fusion) dont support webgl

#

Well mlapi does but the webgl transport is broken i think

weak plinth
#

You could technically do it from scratch but probably not worth the effort

alpine quiver
#

hi folks, can anyone help me on mirror and openXR, i been having problem with giving an authority to client to pickup prop for a while now is there any example on how to do it or an alternative, coz right now the client in my project can't interact with anything.

ripe steeple
#

How can i get started on networking? I want to make a multiplayer game

spring crane
ripe steeple
spring crane
#

I haven't used MLAPI. Just ask your question and someone will help if they can. There's also a dedicated discord for it, invite link in the pinned message.

ripe steeple
ripe steeple
rapid horizon
#

Here comes again

#

Which one is better btn mirror and Netcode

regal kestrel
#

hello i did some basic networking stuff in c++ but i don't seem to be able to understand Unity's NetCode at all, i'm currently trying to move each player on its own client using the new input system.
in C++ i would do something like on the client get desired destination from UI, send message to server with my client id and desired destination and await response, on the server i would then check if its a valid move, move the client's player, and send response OK to client, client would then update its position on the UI

#

how would i do this in Unity? because it seems that the last client that i open is also running the code from all of the other clients, so i have to have flags all over the place with if(!isLocalPlayer) return; and for some reason the same piece of code is only moving my player on the host client, all of the other clients cant move, i guess that i have to make the position shared between client and server or something like that? and how would Unity know which client to move? I'm so confused.

weak plinth
rapid horizon
#

So is Multiplay like the new Playfab or what am i missing here

green dust
#

anyone know a good course for photon? I want to have a pretty deep dive in it. Haven't found anything yet.

short needle
green dust
weak plinth
#

if im gonna host my game with dedicated servers and listed servers in game do i need to buy servers or vps servers ?

short needle
weak plinth
# mortal horizon most likely yes

we are trying to like make online survival game and listed servers in our game so its our servers and people can join them only they cant make do i need to buy like a whole server around 10k ? or it works with vps

mortal horizon
#

you can just rent servers and pay more as you scale

shadow spoke
#

You don’t need to buy a $10k a month server. You don’t even know if your game will make that money from day one

#

Grab a bunch of $5 Linodes or Vultr instances and use them, when you are at or over capacity then expand

#

I had a $80 per month rackmount and it was bleeding cash

weak plinth
# shadow spoke I had a $80 per month rackmount and it was bleeding cash

i have very important situation that i need help with , im trying to make a server on my pc then list it in the game so when i join the game i can see my server running and no one else can make servers , but everytime i do it turns to be local and i give the build to my other friends they cant join , u have any tips ?

#

whats best ways to make it dedicated on my pc and list it?

shadow spoke
#

You can use something like Node List Server I linked above in the channel a few days ago. Otherwise port forward the required port from your router and use something like ip.pizza to get your public IP address.

#

Using your own internet connection is a bad idea, for testing purposes it's OK but seriously just use a cheapo $5 linode/vultr linux instance and you're going to have way less pain

weak plinth
#

just testing we are trying

#

everytime it turns local we dont know why we port forward and still

shadow spoke
#

You give others your public IP.

weak plinth
#

if u have time tmr can u check the code if u dont mind ? :/

shadow spoke
#

Lemme take a look in my pile of stuff sometime, I think I might have a code fragment that might work

weak plinth
#

ok?

regal kestrel
#

how do you deal with race conditions of NetworkVariables, if i understood them correctly they will be shared between server and all clients and lets say i want to do this:

/*** only change the light color when light is red ***/

/* client 1 */
private void Update(){
  if(nv_light.color == red) ChangeLightServerRPC(() => nv_light.color = green);
}
/* client 2 */
private void Update(){
  if(nv_light.color == red) ChangeLightServerRPC(() => nv_light.color = blue);
}

it could happen that the light changes from green to blue , or blue to green no? i don't know if this code even compiles but the idea is there

#

oh and also could anyone confirm if this would be illegal?

/* client 1 */
private void Update(){
  if(nv_light.color == red) nv_light.color = green;
}
weak plinth
#

i got a problem because my machine is a bit too weak to run 2 hdrp clients at same time on it to test stuff what could i do

#

i can run 1 but 2 my machine becomes a jet

hasty ingot
#

Hey! I need to add a websocket client to my unity app since it will be talking to a nodejs server as a backend. Can I use any C# websocket library and will it still work when i export it as a website?

celest halo
#

What do you guys think is the best way to implement a "punching" system? Like clicking on objects to punch them away. I got a working system, but the client sends a command to the server, which of course results in delayed reactions.

I'm adding a force to the rigidbody of the punched object as an impulse. The rigidbody doesn't have client authority.

umbral hare
#

Hey what are some good multiplayer platforms that are good for big scaled maps and can support players and ai

mortal horizon
umbral hare
#

I'm looking for server authority, has a good matchmaking api

#

Is able to have partys

#

And void

#

Also real-time mp do if you die the other client can see your loot etc.

umbral hare
#

@mortal horizon I was researching what do you think about photon fusion

mortal horizon
#

photon fusion is built for team based games and competitive playstyles (csgo, valorant esque games)

#

i dont think it supports a ton of ccu per server since its fully server auth and predicted

mortal horizon
#

concurrent users

#

or the amount of people in a server at once

umbral hare
#

To give you a better understanding think of escape from tarkov

#

Something similar to that

mortal horizon
#

ok then yes, photon fusion probably the best for that type of game, it has alot of built in stuff for that type of thing

#

I was thinking mmo since you said large maps

umbral hare
#

Yeah

mortal horizon
#

yeah probably fusion then

umbral hare
#

Welp thx I wanted to think of these things early

#

Gonna work on the movement component and hopefully get it replicated

#

Thx man

mortal horizon
#

yeah no problem, fusion should do really well with that stuff, and has matchmaking stuff built in too i believe (there are some photon staff that float around in here that can confirm)

shadow spoke
#

Fusion is a great choice, just beware that when you get popular (exceeding their free tier limits) they’ll force you into a paid subscription as the free tier is good enough for testing. I believe it’s like 20+ players CCU? By that time though, you should be able to have some funding coming in and be able to afford their network stack subscription

#

I honestly want to look at Fusion sometime in 2022

meager crypt
#

Im trying to use Netcode as a starting platform for networking, and i'm trying to import a community extension which adds a NetworkManagerHUD. However I keep getting this error. Anything i could do to solve this. (Importing via git as said on the repo)

shadow spoke
#

The full error message is hidden. Click the error and screenshot it.

#

The area below the list will reveal the full message; likely you don't have dependencies or something is unsatisfied

dusk flume
#

Hi, have anyone implemented functionally UNET in a published game? Does it really work for a professional project? If you did not publish any game with this internet system, do you know any real video game example published with UNET? Thanks a lot if you have info.

olive vessel
dusk flume
#

I want to be sure before studying and implementing it

olive vessel
#

Not personally no, they have a Discord pinned here. I know Mirror is used for a lot of projects including a personal favourite of mine, SCP: Secret Laboratory

dusk flume
#

pay*

olive vessel
#

Mirror is free, however you must either host your own servers, allow players to host servers, or allow P2P connections

#

Photon has products which you pay by the amount of CCU

#

Netcode for GameObjects is like Mirror in that sense

spring crane
#

If you really want something production ready, commercial products like the ones Photon provides are probably the safest bet

dusk flume
#

So NetCode is the new built in solution of Unity, but you have to have and external server, so it is not completelly free

olive vessel
#

None of this is free dear, you have to pay for something somewhere

#

Unless you let players host their own servers or use P2P

#

But really if you want your own servers, you should expect to pay

dusk flume
#

Thanks mates!

#

I was also said that Unreal servers are free, also for Unity-made games, do you know any of that? I mean, maybe I can program the internet staff with NetCode and use Unreal servers??

spring crane
#

Epic and Steam do have free relay servers, but they primarily just relay packets and facilitate connections.

#

Someone still needs to be the host

dusk flume
#

All that said I guess I will have to study Photon

graceful zephyr
#

Afaik steam doesn’t do punch through anymore either

#

And is a pure relay

#

Which sucks for latency sensitive games

sturdy wharf
#

Soooo, I want to make pipe system that is similar to electricity circuits as works like lego blocks.
Here all important details:
https://github.com/bustedbunny/GasExpansion/issues/1

Any help with solution to this problem is appreciated.
P.S. no idea how to actually ask help with such questions, if you know I did smth wrong, let me know

GitHub

For efficient pipe network ticking, all connections should be resolved outside of ticking. Upon installation of pipe objects, or changing it's flow data. Currently raw data available in suc...

minor parrot
#

what are you trying to achieve with this?

#

are you asking a question about a simulation of a physical network of pipes?

errant sandal
#

Hi all, I'm having difficulty with WebSocketsSharp in Unity....
It seems that my ws.Send() is only being sent, once I call ws.Close()... but I need to stream often, and low latency.
Could someone help me work out how I can send, for example "hello world" several times a second?
Thanks

errant sandal
hasty ingot
errant sandal
hasty ingot
#

weird problem

#

on my phone so can’t link it :|

errant sandal
#

I feel like I'm missing something obvious?
Maybe I'm not doing something correctly?
I followed the examples I saw... but dont understand why my ws.Send("Hello"); is only being sent when I close the connection...

Even if I do several in a row, like...
Ws.Send("hello 1")
Ws.Send("hello 2")
Ws.close();

All of the Sends arrive at the same time, just as the connection is closed 😭

spring crane
#

You might have to call some dispatch messages method

errant sandal
#

This is my code which is causing the issue. Thanks

spring crane
errant sandal
#

Ah yes, I wondered about that... But I couldnt figure out how to do it.
Do you know the method I can call on my ws object, that would trigger this?

spring crane
#

What library are you using?

errant sandal
#

I tried two, and both had the same file name.
I believe they are called WebSocketSharp, and WebSocket-Native

spring crane
errant sandal
# spring crane It does seem like at least one of them implies that messages are sent just by ca...

Thanks for this, I'm going to try this now. However, can I just confirm.... Looking at that link to github you sent, how would 'you' download that, and install it into Unity?
I dont see the .dll in the files, theres no 'Release' or 'Packages'... Do I have to build this manually?
(When I googled originally, I had this 'native' one allready as a .dll file. But apparently is does not contain a definition for 'DispatchMessageQueue')
So I wonder if the one you linked is different? (which 'does' hvae 'DispatchMessageQueue' mentioned in the examples)
Thanks

spring crane
#

Copying the contents of Assets folder in NativeWebSocket folder into your assets folder should do

rough garden
#

hey guys, i have been having some issues wrapping my head around networking and such, have tried a few libs but not sure what to stick with. recommendations? I'm looking for something to support a 10-15 player survival world (procedurally generated)

minor parrot
#

mirror is the main one, mirage is based off of mirror. if you don't mind paying there are good paid solutions

errant sandal
#

But same behaviour

#

oops, wrong one

errant sandal
#

There, that's me latest one... Same behaviour...
Messages only delivered when ws.Close()

minor parrot
#

where are you receiving the messages?

errant sandal
minor parrot
#

have you tried against the example server they mention in the package?

#

and are you using the .net 4.x runtime?

errant sandal
errant sandal
mortal horizon
#

you can check in project settings

errant sandal
#

Ah I think I found it

#

Does this matter if I'm building to an Android game?

minor parrot
#

it matters because native websockets says they require it

errant sandal
#

Ok, I have switched that to 4

minor parrot
#

maybe it works now

#

¯_(ツ)_/¯

errant sandal
#

does the .net compile over to Android builds then?

minor parrot
#

i mean

#

yes

errant sandal
#

ok cool thanks, I'll let you know what happens

errant sandal
minor parrot
#

have you tried against the test server

#

that eliminates one more unknown step

errant sandal
#

That's my next step

errant sandal
minor parrot
#

u got a text

errant sandal
#

?

minor parrot
#

in the video u posted i heard a vibration

errant sandal
#

ok?

minor parrot
#

just letting u kno

#

you should also set a breakpoint in there

celest halo
#

Heyho! I'm implementing a hockey-like game where the puck has an own script to update position, rotation, velocity and angular velocity with syncvars.

My question is would anyone know how to implement an as simple as possible solution for a okayish-clean clientside gameplay?

Currently my idea is to update only the velocities and update the transform position and rotation IF the pucks position/rotation on the client is too much off

dreamy magnet
#

Can anyone please suggest best multiplayer networking API specifically for UNITY?

austere yacht
past garnet
#

I like mirror for selfhosted and photon for cloud hosted services, i really liked unet so mirror is very nice for me, in near future i will check out the new fishnet and i have to read about unitys new multiplayer api... but at the end it depends on your needs

toxic halo
regal kestrel
#

is this normal using Netcode? server is sending 10 bytes to clients and i'm pretty sure i'm not doing anything

dusky storm
cloud orbit
#

Do you guys not like Relay?

#

Asking because I just started using it myself

#

Also, if there are any experts around, I could use some help figuring out why I can't establish a local connection using Unity Transport

mortal horizon
#

relays are great, haven't tried unitys that much, couldn't get it to work either haha

#

used to writing my own instead

cloud orbit
#

Hmm so it's not just me? 😂

mortal horizon
#

@cloud orbit fwiw i tried to use it outside of MLAPI, so that might have been the issue as well

cloud orbit
#

I was expecting to make great progress on my project over the break but I started off with rewriting my netcode to use relay and I've been stonewalled by bugs

#

hard to maintain motovation

#

Same

#

I just want to use it to send custom packets

#

I had my own servers that I was hosting locally to do all of this before so I think we might have a very similar implementation

#

But I heard that relay is basically free if you don't have too many players so I decided to give that a go and spare people testing my game the trouble of having to host a server themselves

mortal horizon
#

i know epic online services relay is free forever if you wanna try out their sdk for that

#

Mirror has an impl of it, but i'd assume you want to keep it custom

cloud orbit
#

Honestly I'm very new to netcode so I can't say that I even know what I want with confidence haha. What I do know is that I don't need something like mlapi because I'm working on a turn based strategy game where the actions are infrequent and pretty strictly defined. That being said, I'm still pretty open on what to do beyond that (whether to roll my own solution, use Epic's, use Unity's, etc and whether to use a relay service or some other type of solution).

#

I thought about giving epic a go but I went with Unity instead since I'm more engrained in that ecosystem

#

Also I've rewritten this netcode like 3 times already haha

#

I've been hearing about mirror for a very long time too but my understanding is that it's more similar to netcode for game objects

#

Which isn't really what I need as far as i can tell

mortal horizon
#

Yeah your game probably doesnt need it, ngo and mirror are very similar

median aspen
#

Anyone uses Pun?

#

Photon

#

Trying to sync up a text gameobject for all players in a server room

#

tried RPC and Photon view, dont know if Im doing it right smh 😦

#

if anyone has info/experience appreciate it if you can help me out!

subtle citrus
#

hi guys my unity mirror networking functions are not appearing in intellisense

#

like my class is inheriting from network manager

mortal horizon
#

try rebuilding project files

subtle citrus
#

I got it to work by redownloading

#

thanks for the help

ornate sable
#

im using colyseus and this happen, i dont understand it

frosty crystal
#

Hey!

#

I'm going to model a databse in mssql. which tool is the best for modeling tables?

#

got any recommendation like web sites or should I download sql server?

#

thanks

weak plinth
crude juniper
#

hi guys, has anyone successfully networked with scriptable objects?

topaz forum
#

im working on a game that every 30 seconds a player on a team spawns the units they have built. So first round player 1 will spawn all their units and so will player 2. I am using photon.

The situation im trying to avoid is what if player 2 networks lags and cant send the information needed?

shadow spoke
#

It will send the info eventually

#

It’ll keep retrying until photon gives up

crude juniper
#

hi guys, does anyone know how to ... create scriptable objects onthe network? as in does it need to be instances per object or can the players ref the same one with different data? im not sure how to tackle it

grizzled palm
#

So can I have user created servers in mirror

mortal horizon
grizzled palm
#

Ok thnx

spring crane
subtle citrus
#

what tasks does server side code handle in unity and what does the client side code handle

#

and when do i use remote actions?

#

thanks in advance

crude juniper
# spring crane Generally I use them for static data and attach IDs to them for network communic...

Hi Danny, sorry I'm pretty new to networking so just figuring stuff out a bit

basically i have a spell SO and my spells inherit from that, spell has a bunch of methods and data

i noticed that when i tested the game in multiplayer that the clients would essentially share the same SO asset, the symptom of this was that the spell would spawn in the same location (whatever updated the spawn pos last)

then i releaised that SOs are instanced or whatever and now im down the path of figuring out how to create them or.. pass the data seperately to themethods and do that way so the players can use the same SO methods and some data but the player will send in data over the network via the SO to get the spell going

not sure if any of this made sense but any insight you have would be great, i can provide more info but let me you know if what i said makes sense

spring crane
crude juniper
spring crane
#

The page and the method tells you what is returned. Yes, both variants return the cloned object.

crude juniper
#

sorry dumb question i see it now on the page

crude juniper
hasty cosmos
#

Is there any way to use the legacy networking system in a 2020 version of unity. I have a project that was developed in 2017 version and because of the networking it is not working in 2020.

grizzled palm
#

Man I tried looking but I cant find any thing in detailed documentation on how to fix my scripts to work with mirror

past garnet
#

So really noobish networking design question

#

If you do a Single/Local and Online Multiplayer game, how you handle the single/local part of it? Just create a NetworkManager and act as host and player or do seperate managers for online and offline mode?

wheat furnace
#

ENet Transport question: is there a good way to build the DLLs for both windows and mobile builds?
Currently working on converting a project to have a mobile builds that uses the community ENet Transport layer and am running into issues where on mobile (android) builds the dll is not found and thus the project opens but cannot connect to the network

mortal horizon
mortal horizon
#

that way you dont have to duplicate code

mortal horizon
grizzled palm
#

Ok thnx

shadow spoke
#

Mirror is probably one of the best choices to get a older project that's not working with old UNET/HLAPI up and running in the modern day

shadow spoke
#

What?

#

The transport layer for what networking?

paper jewel
bright mauve
#

does anyone know why could i be getting this warning?

[Netcode] NetworkConfig mismatch. The configuration between the server and client does not match

UnityEngine.Debug:LogWarning (object)


Unity.Netcode.NetworkLog:LogWarning (string) (at Library/PackageCache/com.unity.netcode.gameobjects@1.0.0-pre.3/Runtime/Logging/NetworkLog.cs:18)
Unity.Netcode.ConnectionRequestMessage:Receive (Unity.Netcode.FastBufferReader,Unity.Netcode.NetworkContext&) (at Library/PackageCache/com.unity.netcode.gameobjects@1.0.0-pre.3/Runtime/Messaging/Messages/ConnectionRequestMessage.cs:79)
Unity.Netcode.MessagingSystem:HandleMessage (Unity.Netcode.MessageHeader&,Unity.Netcode.FastBufferReader,ulong,single) (at Library/PackageCache/com.unity.netcode.gameobjects@1.0.0-pre.3/Runtime/Messaging/MessagingSystem.cs:241)
Unity.Netcode.MessagingSystem:ProcessIncomingMessageQueue () (at Library/PackageCache/com.unity.netcode.gameobjects@1.0.0-pre.3/Runtime/Messaging/MessagingSystem.cs:260)
Unity.Netcode.NetworkManager:OnNetworkEarlyUpdate () (at Library/PackageCache/com.unity.netcode.gameobjects@1.0.0-pre.3/Runtime/Core/NetworkManager.cs:1154)
Unity.Netcode.NetworkManager:NetworkUpdate (Unity.Netcode.NetworkUpdateStage) (at Library/PackageCache/com.unity.netcode.gameobjects@1.0.0-pre.3/Runtime/Core/NetworkManager.cs:1125)
Unity.Netcode.NetworkUpdateLoop:RunNetworkUpdateStage (Unity.Netcode.NetworkUpdateStage) (at Library/PackageCache/com.unity.netcode.gameobjects@1.0.0-pre.3/Runtime/Core/NetworkUpdateLoop.cs:149)
Unity.Netcode.NetworkUpdateLoop/NetworkEarlyUpdate/<>c:<CreateLoopSystem>b__0_0 () (at Library/PackageCache/com.unity.netcode.gameobjects@1.0.0-pre.3/Runtime/Core/NetworkUpdateLoop.cs:172)
hasty cosmos
#

Thanks everyone.

wheat furnace
verbal lodge
#

Steps should be the same. You should be able to just additionally add the enet android dlls to the project.

brisk relic
#

Where is isServer set? My server is returning the wrong answer. I assumed it was by clicking Server Build under Build Settings, but apparently not... or something is overriding it

celest halo
brisk relic
#

I'm using Mirror and have an OnServerPrepared that kicks off everything when Server Build is selected, but I just realized that isServer isn't being set correspondingly

mortal horizon
#

Where is your network behaviour in the scene

#

as a child obj, on root obj etc

brisk relic
#

root object that is instantiated after the start.

#

which is weird, I know

mortal horizon
#

how are u spawning it

brisk relic
#

a game manager that spawns it

#

instantiate

mortal horizon
#

like the actual code i mean

#

Just instantiate?

brisk relic
#

NM = Object.Instantiate(NetworkManagerPrefab);

#

from a prefab

mortal horizon
#

Your network behaviour is on the same obj as network manager?

brisk relic
#

yup

#

dumb idea?

mortal horizon
#

You can't have that, network manager cant have a network identity, which means you cant have network behaviours on it

#

Also, when spawning objects with network identity/behaviours you have to NetworkServer.Spawn it as well, not just instaniate

brisk relic
#

well that would explain alot

mortal horizon
#

You should run through the quick start guide in the mirror documentation, or join the discord server (available on google or in unity console) :)

brisk relic
#

thank you very much!!!

mortal horizon
#

no problem :D

lapis gorge
mortal horizon
#

Why?

lapis gorge
#

I'm trying to figure out how to change the max-connections from a lost file.

mortal horizon
#

I don't understand what you're trying to do, sorry

lapis gorge
mortal horizon
#

Are you trying to edit an existing game's assembly?

lapis gorge
#

Yeah my existing game assembly. All the files went lost pretty much.
Been attempting to re-create things

mortal horizon
#

Sorry, im assuming youre trying to use unet, which I don't know much about, it's been deprecated for years

lapis gorge
#

rip

#

oh well worth the try

bright mauve
#

for some reason my online game does not sync?
im using netcode for gameobject

#

i mean, the players spawn but when i move one, it doesnt move the other.
the network manager is in the scene and they both have network objects component

#

do i need to write the syncing protocol myself?

celest halo
bright mauve
#

i tried that, it didn't work the first time but than i played with it a bit

#

and i managed to fix it

#

thanks!

#

although the camera is still broken, for some reason the input is only working on the first player who joins so i will try to look on that now

celest halo
#

You may also need NetworkTransformChild for rotations etc. depending on your prefab

#

For the camera you should do something like

if (!isLocalPlayer)
camera.SetActive(false)

Assuming camera is your game objects name

bright mauve
#

oh that is smart! thank you so much!!!

celest halo
#

If you have to sync the transform of a child object too use NetworkTransformChild I'm just saying this because I lost days figuring out how to sync player rotations ... xD

bright mauve
#

i will go write some code now, thanks :D

celest halo
#

Good luck!

gray pond
celest halo
#

Guys I'm still struggling with collisions right now. Currently I'm using NetworkRigidbody and NetworkTransform for the players and the object they have to play with in a collision based game.

The clients however, can not collide properly, they get pushed upwards by the object. Removing NetworkTransform solves this, but desyncs the object.

celest halo
#

Extrapolating the rigidbody and only interpolating the position & rotation helps a lot, but is inaccurate tho

bright mauve
#

if i call a [ServerRpc] function() from a client, will it execute on the host?

celest halo
#

I'm using Mirror and [Command] is the same i guess

runic rampart
#

I am using MLAPI and want to replicate a reference to an assets: e.g. a prefab, an image, a scriptable object, etc. This asset is on disk for all clients. Is there something built in I can use to do this?

#

I guess I'm wanting to replicate the asset's global object ID?

#

Ah no that's editor only

mortal horizon
#

in my experience i will hash the prefab name and turn it into a unique id and send that over network

runic rampart
#

I'm so shocked there's nothing like this out of the box

#

I don't understand why unity puts all the unique id/asset management stuff behind UnityEditor, this stuff should exist at Runtime

shrewd birch
#

Can I use mlapi with Unity webgl?

delicate iron
#

Hello everyone! Where "Rotation axis" is like in Unet, only in the Mirror > Network transform?

light ginkgo
#

Hey, I have a problem with Photon, how to resolve these errors?
Multiple precompiled assemblies with the same name Photon3Unity3D.dll included or the current platform. Only one assembly with the same name is allowed per platform. (Assets/Photon/PhotonLibs/netstandard2.0/Photon3Unity3D.dll)
Multiple precompiled assemblies with the same name Photon3Unity3D.dll included or the current platform. Only one assembly with the same name is allowed per platform. (Assets/Photon/PhotonLibs/Photon3Unity3D.dll)

spring crane
#

No idea if there are community websocket transports available for MLAPI

crude juniper
#

hi guys, im having trouble understanding something...

i have a player prefab with a list of spells on them, i drag and drop spells into the list via the inspector to populate their spell list

my client+server can cast spells no worries but my client cannot

when the client connects /starts etc.. i init each spell and generate a spell id for each spell, when the player tries to cast a spell they just pass the id from their spell list, the server does a lookup using the spell id to find what spell to use.. for the client+server this returns the spell.. but for the other client it returns null.. makes sense cause the list is only on the client side...

im struggling to understand if i should have a networked list of spells with all the spells from all the players or... just sync each players spell list?

i tried using synclist and various other methods but i couldnt get them working... does anyone know how i can solve this?

dusky storm
crude juniper
#

synclist wont work though cause i need to use a custom type (spell)

glass lichen
#

Whats the best tutorial/walkthrough for netcode for gameobjects currently available?

#

aside from unity documentation

runic rampart
#

very little documentation

#

if you have questions I might be able to help

glass lichen
#

i understand it atm, just love getting every peice of knowledge about it first

runic rampart
#

yeah you just gotta read code, most of it is in C# luckily so it's available

glass lichen
#

sweet, although one quick question, implementation with playfab, how much effort is that(if you have done anything with azure playfab before)

runic rampart
#

that's not really related to mlapi

#

it's like implementing any other backend

glass lichen
#

yeah true

#

one question related to netcode then, cause may aswell ask rather than spend an hour figuring it out

glass lichen
#

i have noticed that the objects networkobject component has "owned by server" as true, will this be effecting it, and if so, how do you go around making an object owned by everyone

runic rampart
#

That's unfortunately not how it works. The server should be the one owning most of the NetworkObjects in the world

runic rampart
#

The sideeffects of the pickup need to also be replicated from the server side - meaning that if you add an item to the inventory or something, the inventory should be replicated

#

The client should run 0 game code that executes the pickup in an authoritative way: e.g. setting game state data. All of it should come from the server

#

Hope that makes sense, this isn't a specific bit of code you need to change, you need to build your code around the paradigm that the server owns everything and the client communicates with ClientRpcs

lethal robin
#

Hi

#

Unity multiplayer system

#

Can I use this for like 30byears from now or is it's just for a short period. I ain't saying this for money but I read this somewhere that unity multiplayer system Is closing and that we use photon nowadays?

#

Can anyone tell which one should I use?

glass lichen
#

netcode is very new so shouldn’t close in a while and should only be built on for at least a long time

#

mirror is also free and just got updated two days ago

lethal robin
#

Netcode?

#

Is it free

#

Like for development you get 20 players free or something like that

glass lichen
glass lichen
runic rampart
#

oh yeah, same concept

glass lichen
runic rampart
#

the "side effects" I mention still apply, all that needs to be done the server

wispy oar
#

In unity pun is it possible to set up a queue to only let a certain number of players connect at a time?

delicate iron
#

Hello everyone! Where "Rotation axis" is like in Unet, only in the Mirror > Network transform?

#

Like this

austere yacht
# crude juniper anyone know? 😢

generally, the server needs to know the spells, the clients all need to know at least some ID that the server understands for each spell. those can be hardcoded. if you want to validate which player can use which spell, you maintain a spelllist for each player on the server and sync that via RPC or NetworkVariable. Whenever a spell is cast the player that should cast will send an ClientRPC to the server requesting that spell cast, the server does the spell cast and syncs the result back to all clients via network spawn and ServerRPCs.

crude juniper
#

thank you that generally makes sense to me i think i will ned to use an RPC cause i cant network var a list of type spells, thanks again

austere yacht
#

player can mean the actual app/game that the client PC runs or player as in the avatar/localPlayerNetObject in the app that represents the local client PC or player as in the person sitting in front of that local PC, potentially controlling multiple player characters inside the game that all are handling their server comms through a single localPlayerObject

crude juniper
#

that makes sense, keeping that in mind

i think i will init the spells on the server.. then send the spell ids that the player should have to the player and add them to another list then pretty much do what im doing already? i think

austere yacht
#

yes, network variables just try to encapsulate/abstract that process a bit

bright mauve
#

how can i access the local player's Network object?
i tried
NetworkObject ClientObject = NetworkManager.Singleton.ConnectedClients[clientId].PlayerObject; but it didn't work because only the server can access "ConnectedClients"

grand grotto
#

just updated to the latest version of netcode and I started getting this errorUnityChanPanicWork

#

ok f.. this im done for the day im out

bright mauve
grand grotto
bright mauve
#

lmao

bright mauve
delicate iron
#

Hello everyone! Please help me! I have an error that there are several audio listeners on the stage. I want to add it to the "Components to disable" array, but I can't put it there. What to do?

mortal horizon
#

This isnt networking related, but anyways, you can't access scene objects from the prefab editor

#

@delicate iron

delicate iron
mortal horizon
#

Find the object in start method and add them to list

#

Or awake

median aspen
#

Hi, I am working on a multi-control game, kind of like the dream 2 player controlling one player video.
How would I load in my player? If I want 2 players to control one character, what should I use?

transform view? RCP?
I tried the Photon transform view classic, but after toying around I can only seem to get the horizontal Camera to sync up 😦

#

Im using Pun from Photon btw

delicate iron
mortal horizon
#

Whatever script you want, I don't know how your game works

delicate iron
glass lichen
#

Im trying to understand the RPC calls from the netcode for gameobjects documentation, however i dont exactly understand it. What is the process of for example when a client clicks move an object for every client

glass lichen
#

@runic rampart

runic rampart
#

Hey sorry

#

Ok so this is what my setup would be

  • I have a prefab which are the objects the clients will move. They have a NetworkObject component and a NetworkTransform component.
  • I have an RPC somewhere that looks like this
[ServerRpc]
void MoveObjectServerRpc(NetworkObjectReference ObjectToMove)
{
    ObjectToMove.TryGet(out GameObject go);
    go.transform.position = ...;
}

And somewhere when the client clicks on the object you call

MoveObjectServerRpc(gameObject.GetComponent<NetworkObject>());

Hope that makes sense @glass lichen

#

When you set the transform on the gameObject, the NetworkTransform component will automatically sync the position on all clients in a smooth way

glass lichen
glass lichen
#

This is the current code i have, atm it doesnt do anything on click

#

with this calling it

#

In update

#

Putting a debug.log in the function, doesnt look like it is getting called at all

lethal robin
#

Is netcode better?

#

Than photon?

glass lichen
#

anyone ever had problem with network objects not using gravity? even though use gravity is enabled

#

i have disabled it once in run time via script however i have taken that out so it shouldnt stay enables.

#

nvm i had is kinematic enabled

runic rampart
glass lichen
runic rampart
#

yeah either one works

median aspen
#

Hi,
I am trying to create a game where 2 players can control the same character, where one player controls the movement, and one player controls the interacting and other things.
However, right now I am trying to get the Camera to sync up with both players
Essentially I would want both player clients looking through the SAME Camera.
I played around with RPCs but realized that it is meant for infrequent calls thus making it quite impractical for an EVERY frame update
Im also trying “Photon Transform view (classic” and applying that to a photon view component.
It is not quite working and Im kinda stuck right now, any ideas?
Thanks!

stiff ridge
# median aspen Hi, I am trying to create a game where 2 players can control the same character,...

That idea might be a bit tricky. Especially, when movement corrections need to happen and the "interacting" player's screen moves away from whatever was the target...
Aside from that, it should be doable.
Basically only one player has a character to move. The camera needs to be attached to that and the second player's input needs to get ignored for it.
I don't actually know if PUN supports sub-objects being controlled by another client, so that may be an issue.
I would not use RPCs for the second player's movement anyways. Just use RaiseEvent and send some event content that describes what the arms do and which interactions there are.

acoustic lodge
#

found a few fixes on my code

#

but how do i change something from a gameobject after PhotonNetwork.Instantiate?

#

I did GameObject a = PhotonNetwork.Instantiate but it doesn't change it in other clients

bright mauve
#

does anyone know why am i getting this error? (Rpc)

Unity.Netcode.NetworkBehaviour.get_NetworkManager () (at Library/PackageCache/com.unity.netcode.gameobjects@1.0.0-pre.4/Runtime/Core/NetworkBehaviour.cs:219)
rpc.MessageClientRpc () (at Assets/rpc.cs:51)
rpc.Update () (at Assets/rpc.cs:24```
```csharp
[ServerRpc(RequireOwnership = false)]
    private void MessageServerRpc()
    {
        if (NetworkManager.Singleton.IsHost)
            Instantiate(SpawnThis, new Vector3(3f, 6f, 3f), Quaternion.Euler(new Vector3(0, 0, 0)));
        else
            Instantiate(SpawnThis, new Vector3(-3f, 6f, 3f), Quaternion.Euler(new Vector3(0, 0, 0)));
        //Debug.Log("Ive Got This Running In My Server");
    }

i did reference SpawnThis and serialized it.

olive vessel
#

Which line is the NRE on?

summer tapir
#

Hey everyone! hope everybody is having a nice day 😉
I´m a little of trouble about how to use the network variable with Unity Netcode preview 1.0.0_4

how does it works? how do I update values from server side to client side? I´m a beginner on netcoding.

https://gdl.space/ujohemuyih.http <- this is the sample of my code, just the important parts.