#archived-networking

1 messages · Page 1 of 1 (latest)

zenith rampart
#

That's great, but I couldn't even get photon to update two ways (the host was frozen on the non hosts screen).

wary gorge
oak portal
#

I have created an XR project via MRTK that incorporates ML-Agents. I would like training of the agents to be done live when the project is built to the HoloLens. I need to build the project to the HoloLens and run the machine learning training via an external computer--how can I facilitate communication between the two to run ML training in real-time?

Do I need to run ML-Agents training on a headless server and build the project in server mode? Or do I have to look into C# socket scripting? I'm new to networking so any guidance is greatly appreciated. Thank you.

obtuse tulip
#

Pun question:

    {
        int viewId = gameObject.GetComponent<PhotonView>().ViewID;
        float currentHp = _player.CurrentHP;
        photonView.RPC("SendUIClaimNetworkHPBarMessage", RpcTarget.OthersBuffered, viewId, currentHp);

    }

    [PunRPC]
    protected void SendUIClaimNetworkHPBarMessage(int viewId, float hp)
    {       
        if (photonView.IsMine)
        {
            Debug.Log("Whats the view id: >>>>" + viewId);
            _controller.SendUIClaimNetworkHpBarMessage(viewId, hp);
        }
    }```
 

My understanding is that I should get a call from everyone else and get THEIR viewId, but for some reason the only viewId I get is my own.
cedar belfry
#

I'm looking to setup a game just for fun and am wondering if using SteamWorks would be a good idea, and how do I connect this to Unity? I'm currently using Mirror.

cedar belfry
zenith rampart
wary gorge
#

r u using pun2 or something newer

#

?

fringe pasture
#

when someone gets the chance I keep getting thies 2 errors

Error    CS0115    'ConnectToServer.OnConnectedToMaster()': no suitable method found to override
Error    CS0115    'ConnectToServer.OnJoinedLobby()': no suitable method found to override

eventhough in the vidio i watched it works fine and i followed the steps up until this point where i stopped
btw its in stem 4 of https://www.youtube.com/watch?v=93SkbMpWCGo

edit i forgor to change MonoBehaviour to MonoBehaviourPunCallbacks

naive rapids
#

I started working with Unity's mirror plugin and the networking features today and I am having trouble figuring out how to destroy objects server side

#

i know its probably a fairly simple process but i can find very little information on how to do it succesfully

zenith rampart
zenith rampart
#

Asset:
EXIT GAMES
PUN 2 - FREE

zenith rampart
# wary gorge ?

And I have it linked to a pun server, using photon views and transform views to photon network instantiate prefabs from the resources folder, and I made sure to disable the other players camera but it still doesn't work both ways

#

Do you think getting Pun 1 would help?

placid stream
#

i follow this tutorial https://www.youtube.com/watch?v=kld9sINMLGw and i done everything it dont work idk why mu playerlistitem dont spawn

In this video I will be showing you how to display members who join your lobby. I will show you how to make this modular so no matter how many people join your lobby will look neat and nice. I will also go over how to display steam usernames and profile pictures and how to get it all setup so no matter who joins and leaves it works. Finally I wi...

▶ Play video
teal timber
#

Can someone help me with netcode for gameobjects how ownership of the player object works

I'm working on player movement when I build and run to test I launch host in editor and client on the build and the client doesn't have ownership of it's spawned player object.
The host has ownership of its playerobject and can move around probably just because it the server tho
I have tried to assign ownership via clientid but dint seem to work I don't know what am doing wrong lol

wary gorge
#

but i would recommend photon fusion or quantum (i just dont know them)

#

but they are new so try em

naive rapids
#

is it not possible to send parameters to a serverside void?

#

im trying this simple script but keep getting the object reference not set to an instance of an object error

#

it lets me convert the gameobject's name to a string and print that but not just get the name from teh gameobject itself

#

i finally got it to work 🥲

compact imp
#

trying to use the new netcode library, does NetworkList<T> actually work? it doesn't seem to trigger change event on client

teal timber
#

Could anyone help with my Multiplayer issue trying to get movement to work my code has the host move and sync transform but the client on the built game cant move dont know what im doing wrong

quaint moon
#

It is your just looking at the logs of the client

#

It’s in the logs of the server since it’s a command

winter patrol
#

im having touble following this video and the comments arnt much help https://youtu.be/y69wBS13wwA?t=1085
here is the code i have with the error as a comment on the line that the error apears at https://hst.sh/eqifugegap.cs

Xsolla: https://xsolla.pro/Blackthornprod_PN
PART 2: https://www.youtube.com/watch?v=D28Drg9MCi4&t=1s

In this unity tutorial we will use Photon 2 and the C# programming language to create a multiplayer lobby system!
This is a fundamental part of any multiplayer game project. The lobby enables players to connect to a server, cre...

▶ Play video
naive rapids
#

I am trying to code an item in unity mirror, so that when it is picked up, its transform is changed to match the player's

#

this works fine for the host client

#

but no matter what I do, the other client's item will not change transform on the server

#

I have tried everythign for two days now, I think I narrowed teh issue down the being that on the host client, the item is marked as isServer, which it is not on the other client, how do I change this?

#

I guess teh better question is, server authority sucks, this is a game Im sharing amongst friends so i could care less about handling cheating, how do I switch a game to client authority?

dense ravine
#

(photon pun) if anyone wants to help me please hit me up in the dms, its a lot of typing work to exactly explain what i want. if someone has some spare time and can help me, please. its about destroying objects, switching cameras, and raycast. (more complicated than this but ok)

#

and i just cant get it to work damnit

shut knoll
#

will the netcode documentation on the unity website still work for 2D?

shut knoll
#

okay thank you

#

i find it extremely confusing so thats fun

dense ravine
#

haha

shut knoll
#

video

#

because my brain doesnt process most info unless its being told to me

quaint moon
#

Don’t build and run like that

#

Use parrelsync

rocky nebula
#

@naive rapids have you tried checking the mirror discord, I believe this question has occurred a few times

silk linden
#

Which one of these services is better for multiplayer?
Netcode, Fishnet, Photon Fusion, Mirro, etc.

haughty heart
#

Neither, they're all made for multiplayer and do so successfully.

#

Your job is to research the pros and cons of each and make an informed decision.

naive rapids
#

thanks though, i didn’t know there was a mirror discord

quaint moon
#

Google it

subtle fog
#

Hi everyone,
I would like to ask you what networking solution do you suggest to a game which has

  • players as hosts (no dedicated server)
  • rts-like gameplay (2-4 players per room)
  • game rooms to join
    (In terms of architecture, its almost like Warcraft 3)

What I found is Mirror or Photon Quantum would be the best options, but i dont have a lot of infos on Quantum. On the other hand, Mirror would require additional solutions for lobbies/rooms, and I am not sure about the performance

half sage
#

whats a good free multiplayer network for an fps shooter?

haughty heart
#

Nothing is free. Free to try, sure. Photon and Mirror are popular options.

regal dune
#

I’m looking into networking at the moment, take a look at the EPIC solutions. They provide a suite of free tools (lobby, relay etc) https://dev.epicgames.com/en-US/services

Epic Online Services

Scale your game and deliver the next-generation of connected and immersive social gaming experiences using our fully accessible and open service.

regal dune
#

No

#

Works with a whole bunch of stuff

weak plinth
#

i just want to make it when
u create a room
if its not a private one
it appears on the servers list

#

using photon

runic rampart
#

I'm using Netcode for gameobjects - we got Exception: Server Scene Handle (-422) already exist! Happened during scene load of EmptyWorld with Client Handle (-450). Any idea what this could be? We were using a built version of the game

dim smelt
#

Made a few tutorial videos for Fish Networking and Visual Scripting. The exact same concepts apply to C# scripts so it should be easy to get started either way. I will be making a few dozen videos so check the playlist if interested. Thanks!

https://youtu.be/594e5Z17o8Y

Getting started with Fish Networking in Unity Visual Scripting.

Goal of this video is to get people up and running with the basics of Fish Networking. More videos will follow showing more specific examples of how to network multiplayer games effectively.

Scripts mentioned in video
https://github.com/WelfareCheckVS/FishNetworking/tree/main

...

▶ Play video
velvet sonnet
velvet sonnet
#

nvm got it, needed namespace "using Unity.Netcode.Transports.UTP" , then NetworkManager.GetComponent<UnityTransport>().ConnectionData.Address="someString";

summer geode
#

Hello !
I have a question
i'm using Unity Netcode for Gameobject and i'm trying to disconnect my client.
Basically; it's giving me this error :

NullReferenceException: Before using the library you should call Init() and do not forget to call Shutdown() afterwards

I searched on google, and it's telling me to use this :

Networktransport.Init();

Now the problem, is, as you can see in the screen : I do not have this function.

I'm heritating from NetworkBehaviour in my script, not Monobehaviour.

Would someone know how to fix that please ?

Someone told me I had to get an instance of Network Transport but can't figure out how
I'm sorry, I'm pretty new at networking. Thank you ! :)

austere yacht
summer geode
austere yacht
austere yacht
#

Alterntatively you can try to not call StartClient() immediately when starting the game but instead wait a second to give the library time to initialize

summer geode
#

It's long so I couldn't send it in a discord message i'm sorry

austere yacht
#

use a paste site

raven halo
#

Does anyone know the optimal way to use Netcode for LAN multiplayer?

I've only used Photon in the past and it was server-based, so I am a little disoriented with the new documentation and how to use it. I think I need to use the Unity Relay services, but I'm not sure if that's the right direction.

austere yacht
raven halo
#

Oh, I see. For reference, I was following this tutorial https://docs-multiplayer.unity3d.com/netcode/current/learn/dilmer/dilmer-video/index.html and me and my friend couldn't connect to each other without the Relay for some reason, that's why I got confused.

shut knoll
#

how would i go along making a code based lobby system ?

somber drum
#

How do you guys manage your ccu tests? Is there any reliable way of doing it autonomously(without humans)?

pulsar lion
somber drum
#

Fair.. thanks 🙂

maiden bear
somber drum
maiden bear
#

for 200 headless clients will be enough. and it is a bit easier to make. you will need to create fake controllers but thats about it.

somber drum
#

yeah, it's really just testing the aoi across the map and seeing how it all goes down in concentrated numbers.. way more freedom than organizing public tests. Sounds easier than I thought

crisp panther
#

anyone experience with photon dedicated server?

#

I did research it was something with fusion

stiff ridge
#

What is the actual question?

zinc marten
#

does anybody here work with netcode for gameobjects?

#

Im trying to access the connected clients so i can sync the data for all clients but I get an error saying that connected clients can only be used on the server. Anybody know how to fix this? Using IsServer does not allow the clients to send the data which is what I want.

austere yacht
#

You need to send the data to the server and have it then send the data to all interested clients. This is done via Server/ClientRPCs or custom messages with custom handlers.

zinc marten
# austere yacht Sounds like a misunderstanding how sync works in netcode

Yeah.. I'm kinda confused about how that even works. For example now I want to have a scoring system which is two players that move around and touch a ball and if the ball becomes the color of the player he starts gaining points. However I cant figure it out. I have two network variables player1color and player2color and they are compared to the ball color to see who is controlling it right now. I think my logic is completely wrong right?

austere yacht
#

but to explain how exactly is tedious and wont help you, i'd recommend reading the netcode docs in their entirety (they aren't that long) until you fundamentally understand how stuff is supposed to be done, and from there it is somewhat obvious how these kinds of systems are implemented

zinc marten
#

okay thank you for your input!

half shuttle
#

does anyone know how to destroy an object on collision using photon as the client

stiff ridge
#

You can call PhotonNetwork.Destroy(go) on one of the clients. In best case, the client which currently controls the object, will do the Destroy.

weak plinth
#

how can I make this work on other players over the network. right now it only works on monsters or other players on a local build.
caster.combat.DealDamageAt(candidate,
caster.combat.damage + damage.Get(skillLevel),
stunChance.Get(skillLevel),
stunTime.Get(skillLevel));

night thunder
#

Heya, quick question, how is shooting usually handled in online shooters? They wouldn't be client side cuz cheating and stuff but most shooter seem too accurate to me to not be clientsided, is there some trick to that?

austere yacht
austere yacht
#

you can put 0.0.0.0 in there to accept all incoming requests, localhost only responds to 127.0.0.1

weak plinth
#
    {
        // candidates hashset to be 100% sure that we don't apply an area skill
        // to a candidate twice. this could happen if the candidate has more
        // than one collider (which it often has).
        HashSet<Entity> candidates = new HashSet<Entity>();

        // find all entities of same type in castRange around the caster
        int hits = Physics.OverlapSphereNonAlloc(caster.transform.position, castRange.Get(skillLevel), hitsBuffer
);
        for (int i = 0; i < hits; ++i)
        {


            Collider co = hitsBuffer[i];
            Entity candidate = co.GetComponentInParent<Entity>();
            if (candidate != null &&
                candidate.health.current > 0 && // can't buff dead people
                candidate.GetType() == caster.target.GetType()) // only on same type
            {
                candidates.Add(candidate);
            }

        }

        // apply to all candidates
        foreach (Entity candidate in candidates)
        {
            if (candidate != null)
            {
                // add buff or replace if already in there
                candidate.skills.AddOrRefreshBuff(new Buff(this, skillLevel));
                // add buff or replace if already in there
                // deal damage directly with base damage + skill damage
                caster.combat.DealDamageAt(candidate,
                                           caster.combat.damage + damage.Get(skillLevel),
                                           stunChance.Get(skillLevel),
                                           stunTime.Get(skillLevel));

                // show effect on target
                SpawnEffect(caster, candidate);
            }
        }
    }```  I have this code but it doesn't work on players, only monsters.  any ideas why?
crisp panther
weak plinth
#

anyone got any advice?

spring crane
crisp panther
crisp panther
# weak plinth anyone got any advice?

you you mean like only able to trigger on enemy well player hit enemy? if that it mind be something with naming for example tag = enemy will only run this script

#

cause seem was network gameobject won't work cause even object will be spawn from server object id you need to let the project to know where your object id was at

weak plinth
#

this only happens on login with a remote server, not server and play

zinc marten
#

does anybody know hot to check ms ping on all clients through netcode for gameobjects?

high night
#

@zinc marten Not familiar with netcode particularly

#

But I believe you should be able to have a "round trip time"

#

That you can access like you access a network time

high night
#

Allright, I made it work
I think I wasn't waiting long enough for the first msg to arrive
And I wasn't using a correct clumsy expression

mild shell
#

Any recommandation for a good ressource to start learning how Multiplyer works ?

high night
mild shell
high night
#

np

shadow bridge
#

what has a steeper learning curve, photon or mirror?

reef jetty
#

how can i use different player prefabs for people on different teams?

brave bronze
#

idk if it should suppost to be here, but I have a question about the google Authenticator function.

How do you get this pop up to sign in with google after clicking a button?
Every other youtuber makes an e-mail login and register theirself, but not like this.

jaunty crane
#

This might not be the right channel, but is there anyway to make network variables changeable in the inspector?

#

this is using the most update netcode for gameobjects btw

thick valley
#

movement only shows on 1 of my clients for some reason, i already have the Networking Transform on the player prafab and the spawning and everything works, except the fact that u can only see movement on one of the clients

#

thoughts?

half shuttle
#

can someone please help me

jaunty crane
#

@thick valley are you sending the inputs to the server, or are you moving directly on the client?

thick valley
#

Oh I completely moved to photon it’s 1000x easier lol

#

Mirror is so much more confusing

empty night
#

Can someone help me fix this? this script gets the server time from playfab (in utc) the coverts to my local time zone (est) , then displays that in the scene.. Everything works fine on pc in the editor but when i build for internal tesing on google play and download to my phone it does not work
my script
https://pastebin.com/PXGe6ybf

crisp panther
#

Question if i wanna put my game build out from webGL to my own website how ya? using mirror

stiff ridge
sharp pawn
#

Hey, I have a problem with NetworkVariable. I am using a NetworkVariable<FixedString32Bytes> and it looks like the game throws this error:
Exception: Type Unity.Collections.FixedString32Bytes is not serializable - it must implement either INetworkSerializable or ISerializeByMemcpy
This error appears on the host side when a client connects, but host itself has no error like that happening. I am using FixedString32Bytes for player nickname, so if there is a better way to handle this, please enlighten me.
EDIT: Fixed, turns out I was just using a wrong version of Netcode. A rookie mistake.

fringe pasture
#

when someone can help, can someone tell me how to make my player invisible to me in first person but still visible to others

#

ive tried puting my player in a layer not seen by the first person camera but i cant see others and they cant see me when were in firsty person

jaunty crane
#
if(IsClient && IsOwner)
{
  GetComponent<MeshRenderer>().enabled = false;
}

@fringe pasture this should work if you put it in the start method or something

fringe pasture
#

i couldent get to work the way i wanted but i found a new way, thanks anyways

jaunty crane
#

np

fringe pasture
#

when someone gets a chance when ever i click the menu button i have it gits rid of the player but it dosent load the menu and leaves me on the lobby scene this is in my player controller
my code

public void Menu()
    {
        if (view.IsMine)
        {
            PhotonNetwork.LeaveRoom();
        }
    }

    public override void OnLeftRoom()
    {
        PhotonNetwork.LoadLevel("MenuM");
    }
fringe pasture
#

i fixed it

#

i maoved the overide void too the manager

crisp quest
#

is there a way to call a clientRpc only on the localplayer in netcode for gameobjects? I know I can probably run a (isOwner) check inside the rpc function but im trying to avoid that

crisp quest
#

thankyou, I did find it after a bit. I have one more question, I can't seem to get my networklist values from client side, is this intended? I try to run .count on client even as a clientrpc and consistently 0. when running .count on server side it returns the actual count though.

spring crane
crisp quest
# spring crane Yea it's common for servers to not broadcast that information.

can you help me out with this case, I have a solution but just trying to make sure it's the best.

Lets say I have a networklist<Vector3> called occupiedPositions.

whenever a new player joins the game, I make a local copy of those positions to a List<Vector3> localOccupiedPositions.

the way I do this is by running a

CloneOccupiedPositionsToLocalServerRpc()
{
foreach(Vector3 pos in occupiedPositions)
{
AddToLocalListClientRpc(Vector3 pos);
}
}

AddToLocalListClientRpc(Vector3 pos)
{
localOccupiedPositions.Add(pos);
}

#

i tried passing a list of vector3s to my client rpc first but doesn't seem to like it, I get the following error:

Don't know how to serialize NetworkList1. RPC parameter types must either implement INetworkSerializeByMemcpy or INetworkSerializable. If this type is external and you are sure its memory layout makes it serializable by memcpy, you can replace Unity.Netcode.NetworkList1<UnityEngine.Vector3> with ForceNetworkSerializeByMemcpy1<Unity.Netcode.NetworkList1<UnityEngine.Vector3>>, or you can create extension methods for FastBufferReader.ReadValueSafe(this FastBufferReader, out Unity.Netcode.NetworkList1<UnityEngine.Vector3>) and FastBufferWriter.WriteValueSafe(this FastBufferWriter, in Unity.Netcode.NetworkList1<UnityEngine.Vector3>) to define serialization for this type

#

I tried passing both List<Vector3> and networkList<Vector3> basically get the same error for both, right now it works fine as long as i pass one by one

#
CloneOccupiedPositionsToLocalServerRpc()
{
  foreach(Vector3 pos in occupiedPositions)
  {
    AddToLocalListClientRpc(Vector3 pos);
  }
}

AddToLocalListClientRpc(Vector3 pos)
{
  localOccupiedPositions.Add(pos);
}

reformated my code

jaunty crane
crisp quest
#

for sure, i left it out of the code, i got it working, im just wondering if theres a better way to clone a networklist to a local list

jaunty crane
#
public struct NetListVector3 : INetworkSerializable
{
    public List<Vector3> list;
    public void NetworkSerialize<T>(BufferSerializer<T> serializer) where T : IReaderWriter
    {
        for(int i = 0; i < list.Count; i++)
        {
            Vector3 value = list[i];
            serializer.SerializeValue(ref value);
        }
    }
}
#

this will probably be better

#

@crisp quest

crisp quest
fringe pasture
#

ive been trying to find a way to make push to talk with photon voice but i couldent find much, anyone know a good tutorial to get some sort of push to talk set up?

violet jolt
#

I am trying to send a file containing level data from Unity to my (currently local) flask server. Can anybody point me to the right direction? The main problem is interpreting the data that is arriving at my server.

levelData = request.data.decode("utf-8")
does not work.

file = request.file
tells me there is no file.

#

Ok I got it. This is the C#-part of the script that converts my data to a wwwform:
WWWForm form = new WWWForm(); form.AddField("name", in_levelData.name); form.AddField("data", in_levelData.text);

and this is how I interpret it on the other end (flask):
levelForm = request.form levelName = levelForm.get('name') levelData = levelForm.get('data')

Its always the same. You fiddle around for 60 minutes without progress, then ask on the discord only to solve it 5 minutes later. 😅

night thunder
#

Short question, is there something like a Client Network Transform within the Netcode for Gameobjects package? Im having trouble letting my clients control themselves, host can move fine, scripts are accordingly disabled/deleted, so I'm wondering if I got the wrong network transform on the prefabs

bright mauve
night thunder
fringe pasture
#

when someone gets a chance, i use photon voice 2 and i am trying to make a voice indicator for my push to talk, this is my script (playerController)

void Update()
    {
        if (view.IsMine)
        {
            // push to talk
            if (Input.GetKey(KeyCode.LeftShift))
            {
                recorder.TransmitEnabled = true;

                micOn.SetActive(true);
                micOff.SetActive(false);
            }else
            {
                recorder.TransmitEnabled = false;

                micOn.SetActive(false);
                micOff.SetActive(true);
            }
      }
  }

but it dosent change on the other players screen only on the players screen who holds shift, and i even gave both images their own photon view but still nothing

fringe pasture
#

when someone can help, once i switch levels, the ui in the level i switched to stop working

lavish oak
#

are there any tutorials or blogs or anything on how to use mirror with webgl? cause I can't find anything

fringe pasture
#

anyone know how to teleport all players each to a random x and z position when host clicks a start game button in photon multiplayer

placid turret
#

i want to send camera with parameters. how can i do.Mirror

fringe pasture
#

ok I kinda fixed it but now i just get this error RPC method 'ChangeBounds(Single, Single, Single)' not found on object with PhotonView 1001. Implement as non-static. Apply [PunRPC]. Components on children are not found. Return type must be void or IEnumerator (if you enable RunRpcCoroutines my new script: http://pastie.org/p/2Hw6Hw8vmqwdnTeDYjIFmD

weak plinth
#

anyone have a kick script

hasty valve
#

Hi can anyone help me with Photon Pun2?

#

Im using Photonview.IsMine to make sure all characters dont move at same time

#

It works for all except host

#

The host isnt able to move

#

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

public class PlayerMovement : MonoBehaviour
{
public PhotonView view;
public Rigidbody2D rb;
public float speed;

private void Update() {
    if(view.IsMine){
        float inputDirX = Input.GetAxisRaw("Horizontal"); 
        float inputDirY = Input.GetAxisRaw("Vertical"); 

        rb.velocity = new Vector2(speed * inputDirX, speed * inputDirY);
    }
}

}

#

could anyone help?

fringe pasture
patent fog
#

L:18 you try to access a gameobject of a param that is already a gameobject ? That might be a typo, but even then, I'm pretty sure you can't send a gameobject through RPC

#

That's what the error message is trying to tell you : it can't serialize a gameobject to send through the network

#

I don't use PUN but I'd assume you're have to send via RPC the network id instead, then find the matching gameobject on the server side

#

@fringe pasture might be other ways to achieve that with PUN but that's the first naïve approach I'm thinking about

dapper lily
#

(Using Mirror) I need to set up a system using either proximity or collision, so that I can call events when two objects get close to each other. Does anyone have any recommendations for how to do that? 😦

patent fog
#

You just described OnTriggerEnter and OnCollisionEnter callbacks

#

Are they what you are looking for?

dapper lily
#

Do those work with Mirror? 😮

patent fog
#

That's Unity engine

dapper lily
#

I'll give those a try and see what I can do, thank you 🙂

patent fog
#

Not sure if mirror have network-aware equivalent

#

You'd have to sync data yourself if need be

fringe pasture
patent fog
#

Like I said, I would pass the network ID instead of the GO in that RPC, and see if PUN provides a method to find GOs by id. Then you're back at the same point

fringe pasture
#

ok

#

but how would i find the network id of the object

patent fog
#

There's also seem to be PhotonNetwork.Destroy() variant for networked objects

fringe pasture
#

ok

sharp pawn
#

Is using NetworkVariables a good idea of handling player inputs, or should I perhaps use RPCs? I was thinking about making it so the client can set the NetworkVariables (basically floats, for horizontal and vertical input), and then the server can read those and use them in the controller script (apply throttle, brake or turn). This way I can replace ClientNetworkTransform with NetworkTransform and have nice, realistic collisions

#

Looking at my case, I think it makes sense, but maybe someone more experienced can enlighten me

austere yacht
#

network variables are just wrappers around messages to make the more convenient, same as RPCs, the difference is just that network variables retain the state of the last message received and enable delta compression (only sending a network message when the value has changed). Based on that property (retained state vs ephemeral state) you decide which one suits your use case better. another point of view is that RPCs model events, variables model state. Naturally you can manually convert one into the other at any time. Whether you sync inputs with either one depends on how you receive inputs. On the server you will likely want to retain some sort of input state between ticks. @sharp pawn

sharp pawn
#

Hm... I guess this confirms my idea. I read the input using ReadValue<float> when an input is performed. I think NetworkVariable will be better, since otherwise I'd have to send RPC like every frame (or, just send them on change, but then I think this is what NetworkVariable actually does)

#

I can try, we'll see how it works out.

fringe pasture
#

when someone gets a chance how could i destroy all objects with a tag and have all players see it (i use photon for multiplayer)

sharp pawn
#

It looks like NetworkVariable based player movement serverside works, but there are some problems. Aside from small issues like being unable to read speed from rigidbody (because it's kinematic), or the obvious (but small) input lag, there's a thing that on the client side, the vehicle seems to be moving in a very shaky way, as if the interpolation was having some problems. On the server side, as expected, the movement is smooth. Any idea on how to fix that?
Ok, apparently for this kind of issues there is client-side interpolation, like written here: https://docs-multiplayer.unity3d.com/netcode/current/learn/clientside_interpolation/index.html

hollow linden
rain arrow
#

Hey all, general question if I may (I'm new to this stuff). I set up a client and server using riptide networking and a video guide on YouTube. The issue I'm having is that, while i can connect the client from my own network, I cannot connect from outside my network. The issue seems to be more with my computers personal ip address because even with port forwarding and adding exceptions to inbound and outbound ports I cannot connect. The issue seems weirder since I csnt even ping my own public ip in the cmd.

I believe I've set the server and client side connections correctly and its an issue internally with the PC or network settings.

My question with all that said, should I be okay to continue working on my project with the local connection working or should I fix the issue with my public ip first?

signal talon
#

anyone here use lite net lib?

velvet sonnet
#

Is there any way to know when Netcode is about to reach the next tick?

#

any events I can subscribe to or something?

upbeat mauve
#

hey, I missed this, noted for the next time, thank you 🙂

radiant walrus
#

Hello,
I was working on some api calls and wanted to keep a separate cs file for all the network based commands.
Sould I use a normal cs class or go for something like a singleton or something else

pulsar oak
#

I want to make sync movement which means movement per tick.
Idk why but this doesn't guarantee me sync movement

#

Delay between clients 100-600 ms seems like server work for them individually

civic dune
#

hi, so i'm making a multiplayer fps using steamworks. i made it so that when a player gets hit, the function DecreaseHealth() in this script https://gdl.space/apicuropud.cpp gets called. the amount is the damage variable of the gun. for some weird reason though, the health doesn't decrease, but the function gets called. does someone know what could be wrong with this?

olive vessel
#

The amount should get decreased on this instance of the script

#

But I see no code to broadcast this to any other clients or the server

civic dune
#

wdym

#

how do i do this

olive vessel
#

There's a lot of Mirror tutorials online, some covering this topic

#

The Mirror does have a synchronisation section too I think

civic dune
#

thanks

azure crown
#

Is Netcode for Gameobjects "safe" to use in a commercial project? Thinking about a co-op type of game.

rustic shard
#

Hi all! Can someone point me in the right direction please? I'm trying to learn more about Netcode, almost all of the links are broken: https://docs-multiplayer.unity3d.com/netcode/current/about. I have tried looking for tutorials, the ones on YouTube are a year out of date and half the code they are using is deprecated. I'm considering using Mirror, but I would really rather use Unity's official networking solution.

civic dune
#

the network manager wants a player object controller, i assume thats a script? does the object you drag in have that script?

olive vessel
#

They have a Discord pinned in this channel if you're not already in it, might be worth letting them know about that docs page

civic dune
#

hey, does someone know what this error means?
FieldAccessException: Field 'UnityEngine.RaycastHit:m_Point' is inaccessible from method 'Mirror.GeneratedNetworkCode:_Write_UnityEngine.RaycastHit (Mirror.NetworkWriter,UnityEngine.RaycastHit)'

#

im making a command to run when a player gets hit, and give it the raycastHit thing, so it can detect which player was hit and decrease their health. for some reason i get this error tho and i have no idea what it means

civic dune
#

nvm fixed it

rustic shard
#

@olive vessel thank you for the info!

naive vortex
#

hey i have trouble spawning a object as a client on the server. I watched a few tutorials but it does not work. It would be great if someone would help me out. ( Using unity with the mirror asset)

inland pier
#

I am making a multiplayer game with my friend, and the game works when your on the same computer twice (ie one in the built project, and one in the unity editor). however, when i try to join a server created on my friends computer, it doesnt work

olive vessel
inland pier
olive vessel
#

You’re joining the same room?

inland pier
#

yes same code, although when you click the join button nothing happens

inland pier
#

we fixed it idk how tho

inland pier
#

does anyone know how to fix this

inland pier
#

nvm

weak plinth
#

I'm not sure if this goes in networking, but I want to use the player in the screen to do some stuff, but I can only put the prefab in the inspector? how can I overcome this in code

sharp pawn
#

How are RPCs handled when there's many instances of one script (like, one per player object)? If I call a ClientRPC like firstScript.DoSomethingClientRPC() then will it fire only for that one given script? Or should I use ClientRpcSendParams to specify the client? Sounds obvious but I'm asking to make sure.

austere yacht
#

call the subscribed function from OnNetworkStart or whatever it is called in your library

spring crane
#

Oh and multiple instances are generally separated by some sort of ID that is automatically handled by the networking library.

fringe pasture
#

anyone know how i could teleport all players to a random piosition when the host hits start

austere yacht
fringe pasture
#

ok

fringe pasture
#

this is in my player controller and it wont open the menu scene when i leave the room

public override void OnLeftRoom()
    {
        if (view.IsMine)
        {
            PhotonNetwork.LoadLevel("MenuM");
        }
    }
#

how would i fix this

fringe pasture
#

(photon PUN2) how i could teleport all players to a random position when the host hits start, ive fiddled with my code all sorts of ways to no avail

calm granite
#

I have a question, I made shooting, but it doesnt show up on the other client, the other client also cant shoot. I basicly shoot a raycast from the player and check if it has the PlayerTarget script i made

#

any help is appreciated

#

my code is:

#

this is my player movement script:

#

and this is my player target script

still hare
#

I doubt anyone is going to download your code just to see it, so you should put the hotbar logic in a paste site as well

calm granite
#

ok

#

there i did it

#

@still hare

still hare
# calm granite there i did it

Well, for one, you SetIsShooting to true at the top of the Shoot function, but then you set it to false at the bottom. This code runs instantaneously, so basically it's just as if you never set it to true in the first place...

#

Does the damage get dealt though? Only the visuals aren't working?

#

You want to use RPCs for stuff like this, not SyncVars

still hare
#

Remember, this only runs on the server since it has the [Command] attribute

#

So of course other players wouldn't see muzzleflashes

#

Only the host player can!

calm granite
#

rpcs

calm granite
#

@still hare it shows the muzzle flash now but it doesnt register shooting each other

still hare
#

Remember, anything tagged with the [Command] attribute will only execute on the server, and it will use any references from the server's scene.

#

It knows nothing about the client's scenes.

#

So every time a player shoots right now, it's trying to shoot from the host's camera position and direction.

calm granite
#

mhm

#

so how do I make it know if it hit the other player

#

@still hare

tranquil hull
#

Hi, does anyone know how to let enemy target player in multiplayer mode please?

#

I just know drag the prefab into target slot.
But once in multiplayer mode, player name will be change
eg: player connid=0 , player connid=1, etc....

velvet sonnet
#

Is it possible to use ServerRpc/ClientRpc without inheriting from NetworkBehaviour? I'm using Netcode for Gameobjects

olive vessel
high night
#

And call the rpcs there instead

#

If you don't want to inherit from NetworkBehaviour, I assume you already have a plan to keep track of this particular gameobjects reference over the network

velvet sonnet
#

Yes, all my spawning is syncing is manually handled via RPC. I don't want to use scene management, so I disabled it but that means I can't have pre-existing NetworkObjects within my scene, meaning my GameManager that handles all RPCs cannot have a NetworkObject, meaning it can't send RPCs anymore....

#

I tried using the prefab/hash override but it doesn't work right. All it does it create a clone of my existing GameManager on game start, then disables all scripts on it.

austere yacht
velvet sonnet
#

eeee

#

ouch

#

that's way beyond me lol

austere yacht
#

Why are you trying so hard to remove all benefits and convenience of netcode?

velvet sonnet
#

I want to spawn Addressables in my Netcode project, but Netcode does not support Addressable spawning. So therefore all my spawning and syncing must be without NetworkObject components on them. Which is fine, I have the code for that, but my scenes are also Addressable, and Netcode SceneManagement doesn't work with Addressable scenes either. So I disable Scene Management, but turns out disabling SceneManagement throws errors if you have any pre-existing NetworkObjects in the scene. I have one pre-existing NetworkObject, and that is my GameManager, the sole GameObject that sends/receives RPCs. So if I remove NetworkObject from my GameManager, I can't use RPCs

#

Anyway, currently trying out Fishnet.

languid shuttle
#

can anyone good with photon help me with getting a function to go off for master client? i have a maze type thing made by photon.instantiate and now im trying to destroy it all when game wins and make new maze
it works if master wins but if anyone else does it throws errors
my rpc wont work```
public void WinGame()
{
PhotonView pv = this.gameObject.GetComponent<PhotonView>();

    //GameObject.Find("ThreeOfClubs").GetComponent<CreateThreeOfClubs>().DestroyGame();
    pv.RPC("MasterDestroy", RpcTarget.MasterClient)); //player1 = PhotonView.Find(1001).gameObject;

}
[PunRPC]
void MasterDestroy()
{
if (!PhotonNetwork.IsMasterClient)
{
throw new InvalidOperationException($"Only master can perform this action");
}
DestroyGame();
}

public void DestroyGame()
{
    GameObject[] walls;
    walls = GameObject.FindGameObjectsWithTag("Wall");
    foreach (GameObject wall in walls)
    {
        Destroy(wall);
    }
    Destroy(GameObject.Find("Win(Clone)"));
}```
#

im just trying to destroy and make a new maze when the game is won

timid shadow
#

Why games separated into room like battlefield or cod have different ping for different room? Even though they connect to the same server?

zinc marten
#

I'm trying to use unity's Relay solution on top of my Netcode for gameobjects. When I was using just Netcode everything was working fine. With Relay the host can join just fine but when the client joins with the relay code I get a lot of errors. Is there a way to find the specific gameobject with that hash? And also why would the host be able to join no problem but the client cant?

regal karma
#

Hi, sorry for the longread 🙂

I have an app, which is easiest to describe as an imitation of a webpage: you have a vertical ScrollRect with a bunch of interactive elements (Image Gallery, Text, Video, etc), all of which are generated from an input from an external CMS. All this is done with regular Unity UI objects.

Now I'm trying to implement a "Group Mode" for this app, that is: a "Teacher" uses his device to interact with the content, and then all "Students" are seeing a duplication of what the Teacher is doing on their devices; sort of as screen mirroring (across the LAN network).

I see the implementation of this Group Mode in 2 ways:

The example of a ScrollRect on a Canvas:
In both Server and Client I would have the following:
|— Canvas
L—— ScrollRect

when the Server scrolls the ScrollRect, I need to send its normalizedPosition to all the Clients.

#

Option 1:

  • make Canvas and ScrollRect NetworkObjects
  • synchronize NetworkObjects:
    -- on Server: AddListener to ScrollRect.onValueChanged, which would update a NetworkVariable<Vector2> ScrollNetworkVariable
    -- on Client, listen to that NetworkVariable changes: ScrollNetworkVariable.OnValueChanged += (..., Vector2 currentVector2) => { ScrollRect.normalizedPosition = currentVector2 }

problem:
this requires both Canvas and ScrollRect to be NetworkObjects, which means I need to Intantiate() and Spawn() them separately one by one, and then re-parent ScrollRect.transform.SetParent(Canvas.transform). This is already annoying, but also ScrollRect’s RectTransform gets broken in the process of re-parenting, because Unity UI changes its coordinates before I reparent. This principally sucks because there are no nested network objects in Unity, and therefore this Instantiation+reparenting needs to be done.

#

Option 2:
Canvas and ScrollRect stay just regular GameObjects.
I add some “Synchronization Manager”, which does the following:

  • ScrollRect.onValueChanged emits a Vector2EventSO called OnServerScrollValueChanged
  • SynchronizationManager (is a NetworkObject) has a Vector2EventListener, which, if (IsServer) — listens for the OnServerScrollValueChanged event, and then updates SynchronizationManager’s NetworkVariable<Vector2> ScrollNetworkVariable
  • SynchronizationManager’s if (IsClient) subscribes to ScrollNetworkVariable.OnValueChanged , and when that changes, it emits a different event called OnClientScrollValueChanged
  • Client’s ScrollRect has a Vector2EventListener, which listens for OnClientScrollValueChanged, and then updates the Client’s ScrollRect.normalizedPosition based on the value it receives

problem:
I have this “retranslator/synchronizer” that creates a large chain of actions (Server ScrollRect Emits event —> SynchronizationManager (Server) Listens —> SynchronizationManager updates NetworkVariable —> SynchronizationManager (Client) Listens for NetworkVariable —> SynchronizationManager (Client) Emits event —> Client ScrollRect Listens)

#

I'll appreciate any comments on these 2 solutions, or a different one altogether, since I might be thinking wrong about this whole concept

limber sparrow
#

hi, im going to start a game that uses networking with 2-4 players, should i use Photon pun or fishnet, or something else, thanks

#

bruh

glad birch
#

I'm not sure if this is right section for this, but I want to be able to catch network connection issues in my application and bring up a popup to notify the user, but in the editor when ever i get a connection error unity closes. Has this happened to anyone, its only really started a few weeks back.

I was building the external api so I didn't have time to check it out anymore. As this haven't happened to me in the past i'm not fully sure where to start. I am using 2019.2.15f1 (I kept using this version because this is an old project that we're working on).

#

The built out project show the connection error, but inside the editor unity just closes.

zinc marten
# limber sparrow bruh

I'm currently developing with Relay and Netcode for gameobjects (Both are unity's brand new multiplayer solution which came out of beta a few months back). I wouldn't recommend it that much especially if you are brand new at networking because the documentation is poor (Except if you want a very basic result) and there are next to none tutorials about it. Although it is an interesting solution and I can see it catching on in the next few years. @limber sparrow

limber sparrow
#

K thanks

tranquil hull
#

Question.

Hi guys, I'm create a multiplayer pacman.

is it possible to bring network netid to another gameobject transform? Coz that's not local which mean unable to drag and drop it.

My aim is to make ghost will detect the player once they join and chase them.

Welcome for any suggestion. Tqvm !!
Here is my code.

#
public class Ghost : NetworkBehaviour
{
    private GameObject pacman { get; set; }

    public Transform target;
    public Transform target_Mirror;

 private void Awake()
    {
    target_Mirror = Instantiate(pacman.player_Mirror);
    }
}

#
public class Pacman : NetworkBehaviour
{
    [SyncVar]
    public Transform player;
    public Transform player_Mirror;

 private void Awake()
    {
        player_Mirror = GetComponent<Transform>();
    }
}
#

I unable to perform the function in Ghost script (awake part)

regal karma
#

I think I encountered a basic bug in netcode for gameobjects, if someone could confirm before I open an issue, as it's fairly straightforward:

  • start Server
  • start Client (connect to Server)
  • Server: spawn Canvas -> canvasInstance
  • Server: spawn Image -> imageInstance
  • Server: imageInstance.transform.SetParent(canvasInstance.transform, worldPositionStays: false)

result:
On Server: imageInstance is a child of canvasInstance with correct UI coordinates
On Client: imageInstance is a child of canvasInstance with incorrect UI coordinates, which would be result of worldPositionStays being set to true
Additionally, a warning is produced on both Server and Client:
Parent of RectTransform is being set with parent property. Consider using the SetParent method instead, with the worldPositionStays argument set to false. This will retain local orientation and scale rather than world orientation and scale, which can prevent common UI scaling issues.

agile phoenix
#

how to get header in response of UnityWebRequest using post API ?

fierce acorn
#

quick question
who here know how to make an object disconnect you from the server then reload the server and make you join back the server? and when you grab the ball it doesn't end up disconnecting you
im using photon btw and unity vr

unreal token
#

Does anyone know where to find good info comparing photon fusion netcode mirror and just all the possible multiplayer networking possibilities in Unity?

austere yacht
#

so best make a list of what you need and check which of them support those things (stuff like server authority) so you can eliminate those that are incompatible with your goals and then read the docs and talk to the communities to see which one seems more fitting. You are gonna marry that library for the project, so you probably don't want second hand info and a casting show to find the right match.

velvet sonnet
#

And I got that exact error message when the client tried to join the server with Scene Management off, except my hash was a different valu

#

Anyway, I gave up and used LiteNetLib instead. Much better. You need to manually spawn and sync stuff between server and client, but the code is much more light weight, and easy to use. I'll be honest though, the Documentation for LiteNetLib is kind of barebones... no real descriptions, just lists of commands

open path
#

In Photon Unity Networking (aka PUN Legacy, now), is the best way to send inputs across to other players PunRPC? Or is there a better way.

zinc marten
weak plinth
#

I am trying to use steam credentials to log into mirror

#

I can get their user name with this command, auth.loginAccount = SteamFriends.GetPersonaName();

#

I was hoping SteamID would handle all account info, but I don't know how to utilize it

hallow junco
#

I don't know if you can get the password

#

Is this there steam account?

weak plinth
#

well I can get the steam id which stores all their credentials

#

but it's like this huge number

#

I dunno how to use it

hallow junco
#

Okay

#

Well if you were able to get there password that's a HUGE vulnerability for steam

#

Becuase then random people can get random passwords.

weak plinth
#

ya, I don't want their password, per se

#

mirror wants a password tho

hallow junco
#

Oh

weak plinth
#

in ummorpg you can just make a username and password and it will create an account for you

#

I'd rather have steam handle all that

#

steam is way cleaner than ummorpg imo

hallow junco
#

What's ummorpg?

#

I've never personally used it

weak plinth
#

it's a game engine using mirror that uses about 6000 lines of code to handle 1000 ccu

hallow junco
#

Okay

weak plinth
#

very powerful

hallow junco
#

Well, why do you need the players credentials?

#

Is it necessary?

weak plinth
#

to make it more convenient for them

#

I've been working on this project for about 2.5 years and have to login everytime. but now I have a steam license so I just wanna use that to login

hallow junco
#

Oh

#

I see

#

So make a login

#

Then make an auto fill

#

So you have control but it's still more convenient

weak plinth
#

I just took out the autofill for the name

#

they still need a password tho

#

I bet there's a way to transmit the entire steam credentials into mirror directly, I use fizzysteamworks so I'll continue looking through their documentation

hallow junco
#

Okay

oak latch
#

Hello guys.
I'm currently looking into the level organization for my game world. Project will stay single player for a while, but I take steps to make every system multiplayer-friendly, so I don't need to make massive overhauls in the future. And I want to make game world level traveling compatible with multiplayer. I read that unity doesn't support multiple scenes running serverside, with players traveling between them independently of each other.
What would be the best architecture for a game with several levels that allows players to be dispersed throughout all of them simultaneously ?

#

Initially I planned to make a separate scene for each of the levels, and pass the world model and the player between them. But seems like this approach would require some serious overhaul for multiplayer to be added.

fringe pasture
#

i have a lobby above my game and when a player gwets a game over they get sent to the lobby, how could i check if all players are at or above y 25 so i can run some code to clear the game so it can be started again

fringe pasture
#

nevermind i found something that suits my needs

inland pier
#

what is the best way to execute some code when a player joins a photon room, including the host joining?

#

?

wide girder
inland pier
#

for some reason nothing is working

wide girder
inland pier
#

i tried it but nothing wants to work

wide girder
inland pier
#

all i had to do was add that into update :)

fringe pasture
#

anyone know any good tutorials for a scroeboard that expands when someone joins for photon multiplayer?

weak plinth
#

how can I setup a dedicated server on steam, it says look for this link but I can't find it on the website. "All Associated Packages, DLC, Demos and Tools" section for your app and clicking "Create new Tool" button.
did they change the website? where should I go?

spring crane
#

Job/collab posting is not allowed on this discord. There is a section on the Unity forum for both.

jolly wadi
#

It forces the children to expand passed the designated size

#

I think

#

Pun or Fusion. Fusion you can use a [Networked] variable but Pun honestly idrk, you could get the “Player” out of the OnPlayerJoined callback, and directly send an rpc to that player with you health

jolly wadi
#

Very broad

#

Like gameplay inputs like shooting?

open path
# jolly wadi Like gameplay inputs like shooting?

Like key presses.

Specifically, I am having two players, in a rhythm game, play different parts of a track at the same time in a cooperative manner. How would I have the players sync each other's inputs?

jolly wadi
#

Yes

#

If you send it in the csllback

#

Callback

#

Not at the start of your game

#

When a player joins

#

Send it directly to that player so they are up to date

#

No

#

Each player rpc them the health of themselves

#

No

#

That’s why fusion is predominatly better

#

20ccu and then payed

#

Same as PUn

#

But steeper learning curve

#

If you have barely started networking

#

Then I recommend switching

jolly wadi
#

Sort of, but with net variables it doesn’t require any other work, and player props it requires extra complicated code

terse idol
#

Hi, I've made an online fps game using photon and for some reason Joining someone else's lobby only works if both players have the game open, for example if someone hosts a lobby and the other person didn't open the game yet. once opened he can't see the lobby

#

how can I fix that?

robust cypress
night thunder
#

How can I access the Network Transform from the current Netcode for Gameobjects version by a script? GetComponent<XXX>() does not seem to know Network Transforms as a valid component even if that component is on that object

#

OnNetworkSpawn is clearly valid so the Netcode libraries are accessible

plush swift
#

Hi, I am trying to connect to a TCP server (written in Java) with TcpClient and receiving data in a thread. When the data is received, I invoke an Action and try to change the transform of a UI Button. When I try that, I receive an exception saying get_transform can only be called from the main thread. How can I overcome this situation?

sinful harness
#

is there too much of a difference between networking solutions that makes one better than the others, or is it all based on what you're trying to make?

spring crane
spring crane
night thunder
night thunder
sinful harness
#

so i just kinda need help in finding out which one would be best suited for my needs

pseudo reef
#

Hello all, fairly new to Unity, been using it a few months for taking some general gaming development classes for my graduate degree. I've been tasked to create a game that I have pretty much completed, but I'm having issues with mirror networking. It's a basic PONG game, and all I want to do is synchronize the "score" of when a ball hits the opposite wall (goal), it updates the text values on both server and client. Currently I can only get it to work on server. The mirror networking documentation is a little confusing to me as I'm a beginner. I was wondering if anyone would be willing to help?

fringe pasture
#

anyone know how to make or a tutorial to make a loading bar for the progress of this script

    void Start()
    {
        PhotonNetwork.ConnectUsingSettings();
    }
    public override void OnConnectedToMaster()
    {
        PhotonNetwork.JoinLobby();
    }

    public override void OnJoinedLobby()
    {
        SceneManager.LoadScene("MenuM");
    }
woeful shale
#

Greetings everyone, can somebody show me how to add a player prefab through code? The only way to do it that I'm seeing in the documentation is through adding it in the inspector, and I'm looking for adding it through code.

#

I'm using NetCode for game objects package

quasi jetty
#

what happen to netcode cant find?

dense tartan
#

Does anyone know any good tutorials for setting up a lobby system for physics games in Mirror - apparently the process is different for 2d and 3d games

crystal sand
#

I am trying to activate a panel with Unity's new UI, but this panel to be active only on the screen of the player who triggered it and not to the others. I am trying to use photonView.isMine but it is not behaving as it should.

thin jolt
#

hey i need help with something its urgent. so if anyone here knows photon i was using it it was working fine untell i did something that broke photon its not working anymore and my game has been broken for days now. and the people that play my game are very sad so i need this fixed really fast, so does anyone know photon to help me?

olive vessel
severe fable
#

When using the Netcode package I have an empty object with NetworkManager component. I then have a few UI buttons with script attached and I'm using NetworkManager.Singleton.StartHost() and NetworkManager.Singleton.StartClient() to connect. How do I listen to NetworkManager events? For example I want to have a UI script which listens for every time a client connects so that it can update/display the user counter.

austere yacht
#

Use sync/network variables that automatically propagate their value to late joiners. Absent those you need to build a system to effectively replicate their behavior by hooking into the client-joined event on the server with everything that has state that needs sync

keen lotus
#

Hey i have a problem player syncing just dont work
i have tried multiple tutorials but they all say the same
its the same with the Photon Transform view and without it
Maybe someone can help 😦

glossy ledge
#

Hey folks!

Trying to plan out a strategy for making Cross platform between VR and PC happen. Not an overly complex project, just a simulation of an environment for users to explore. Does anyone have experience with making this happen? Will more than likely be using Unity with Photon as we have experience with it.

I can't imagine it being too different from a standard multiplayer setup, and is more local checks to see what platform then translating data correctly. But very open the idea that I am completely wrong.

muted wolf
#

I am having a problem in my mp game players are lagging not a lot but a little bit I'm using PUN 2 free

austere yacht
#

subscribe to the changed-callback/-hook of those syncVars/networkVars

muted wolf
austere yacht
#

photon is a company, do you mean PUN ? if so, why? and maybe use something that supports what you need.

#

photon fusion, mirror, netcode for gameobjects, fishnet, ... lots of options

#

who told you to use PUN? how did you find it?

#

photon is a company

#

not a product

muted wolf
#

Anikki cloud you maybe help me if you know how to fix it I'm desperate

junior aspen
#

is there an event that gets triggered when connection happens

#

like when connection to server is approved

olive vessel
junior aspen
#

oh yeah I'm using netcode

#

I tried to look for it

#

couldn't find the event

#

or at least name of it

olive vessel
#

Called on the client or server?

junior aspen
#

when client's connection is approved to server

olive vessel
#

There probably is, you might be best asking in their Discord, it's pinned here

junior aspen
#

oh alright

#

thanks!

modest current
#

If i call my command it just cuts the client
does anyone know why
public void updateMap()
{
Debug.Log("Update");
if (!hasAuthority) { return; }
CmdPlaceObs();
}

[Command]
public void CmdPlaceObs()
{
    Debug.Log("Cmd");
    RpcPlaceObs();
}

this is the only code that pertains to it that i can think of
the line to call gets caled
and then the client ends before Cmd is printed?

still hare
#

client side

tough rose
#

Assets\Script\Launcher.cs(21,26): error CS0115: 'Launcher.OnJoinedLobby()': no suitable method found to override

#

how i can resolve this?

severe fable
severe fable
#

When I try to use NetworkList<Player> I get this from my IDE: The type 'Structs.Player' must be valid unmanaged type (simple numeric, 'bool', 'char', 'void', enumeration type or struct type with all fields of unmanaged types at any level of nesting) in order to use it as a type argument for 'T' parameter...how can I get the list to work with my own struct instead of just simple types?

austere yacht
#

if you want to sync more complex structures (with references) you need to invent a way to do that yourself. I think NetworkObject references can be sync'd so thats maybe the part you have to leverage if you don't want to create custom messages.

#

mind that "Netcode for GameObjects" is a mid-level API, as such it does not aim to provide you with readymade stuff that is only useful for a specific use-case or type of project, so things like this are left for you to implement as they are fairly specific to each project.

severe fable
#

I see; I'm basically a noob trying to make a game which involves both local and online multiplayer (ie you might have 2 controls on 1 PC and then 2 on another PC and all playing together). Plus you don't control a specific character, you can switch between characters. It seems like it's going to be hard going.

crystal sand
#

how can i destroy player who collides with that object

hearty dock
#

With the Destroy function

fallen prairie
#

Have a 4 player Mahjong game, for multiplayer play Im thinking of using a server and using Go to write the match making game controller code. Is this a good idea?

hasty hinge
#

Im using Netcode for Gameobjects right now, and for my NetworkManager I tried changing the IP from the internal feedback ip to my own so I could have other people connect. However, I'm now unable to connect to a server/host from a client, but if I use a host it works by itself. Any ideas?

austere yacht
hasty hinge
austere yacht
hasty hinge
#

Should I put 0.0.0.0 as the normal address IP?

#

and for that question, Im able to host a minecraft server with no problem

austere yacht
#

0.0.0.0 means "all addresses" by convention

hasty hinge
#

yes but do you mean that for the "address" or "server listen address" box

austere yacht
hasty hinge
hasty hinge
#

just for reference, this is what my Unity Transport component looks like

#

i blocked out my ip, but its the actual ip clients would connect to (i assume)

hasty hinge
austere yacht
#

idk for sure what the difference is, there was only one field last time i used it, probably combining the two

#

i suspect the "server listen address" is relevant only for a server/host

#

"address" would be the address your client connects to

hasty hinge
austere yacht
#

are you able to connect on your LAN?

hasty hinge
#

I think the server listen address is what the server itself it supposed to listen to (?), but when I set it to my actual ip it failed

hasty hinge
#

like on my own machine?

austere yacht
#

your from your local network

#

not from the internet

hasty hinge
#

i cant even connect between the server and client im running on the same machine

austere yacht
#

then you probably have specified the wrong addresses / port

hasty hinge
#

maybe

austere yacht
#

there are only so many options that would make sense

hasty hinge
#

it works with 127.0.0.1 locally, but i assume that wouldnt work for anyone else

austere yacht
#

try your LAN IP

#

192.168.x.x usually

#

or 10.10.x.x

#

and make sure the port is correct on both ends

hasty hinge
#

I can try that, but then there must be somewhere else to specify an actual IP to connect to right?

#

the port is almost certainly correct

austere yacht
#

also make sure the server actually starts (it can fail if the port is blocked)

hasty hinge
#

I assume the server is starting, since the host is able to work on its own

austere yacht
#

you should assume less and confirm more

hasty hinge
#

yeah

#

im going to add some logging tomorrow to check all this, but rn its 5:00 am

austere yacht
#

then maybe ask again tomorrow

hasty hinge
#

i was able to try the lan ip, and that works

#

but again, I don't see how it would be able to work for anyone else, seeing as I havent put my IP anywhere else in unity/the code

austere yacht
#

did you read the docs i linked, its all explained there

#

TLDR: you can't just have someone from the internet connect to your server, you need to configure your network properly or use a service that eliminates the need

hasty hinge
#

yeah, you need to port forward, but i've done that and I know i have ports open

#

it might be a firewall thing, but if so Ill have to figure that out tmr

#

but thanks for the help today

weak plinth
#

Question when making a multiplayer game using steam, do I have to use mirror? why? and why does mirror do since steam provides the server?

digital stag
#

Hi is it generally OK to bombard a server with lots of requests and then await all of them to return or should you stagger requests, even do 1 at a time?

still hare
#

mirror just makes networking in Unity easier to do

#

steamworks allows access to the steam api to invite friends, display active servers, create lobbies, etc

weak plinth
edgy tiger
#

Looking for some help with PUN 2, is anyone here familiar with it?

weak plinth
#

very basic unity code question - how do I say "if this is a player, but not THIS player" ? (like for multiplayer)

austere yacht
muted wolf
edgy tiger
austere yacht
edgy tiger
austere yacht
#

this is because streaming data like that saturates the servers bandwidth immediately, degrading all other sync (of gameplay) and it does not scale.

edgy tiger
#

Yeah that makes sense

#

They are large clips

austere yacht
#

are they dynamically created?

edgy tiger
#

No

austere yacht
#

You would not even send the clips to another method if it were a local thing without networking

edgy tiger
#

It's from a gun class which pulls it from a scriptable object

#

Can't have a photon view because it's a parent of another object

#

So I'm a bit stuck on how i could sync it

austere yacht
#

then everyone already has the sound. Only thing you need to sync is which one to play

edgy tiger
#

Would you be able to source a photon view from a parent object?

austere yacht
#

or maybe not even that. All clients might just play it in response to an action the sound is already associated with. So you sync only the gameplay action

austere yacht
edgy tiger
#

It only syncs the damage taken on the player that is hit

austere yacht
#

Photon is a company, not a product

edgy tiger
#

Apparently pun is deprecated now

#

And i need to move to fusion

#

Thanks though

#

That was helpful

zinc marten
#

does anybody have any experience with VR multiplayer? Netcode and Relay in particular

#

Im trying to sync the head and hand movement over the network but since it is a package script i cant really edit it. Any ideas?

elfin token
#

How can I edit an instance in real time so it syncs to all the players in the same build? Like if I spawn something in my editor instance how can I make everyone to see everything I do in real time from their builds, even if an object is not actually in the scene? Like those sandbox games that spawn things and it does for everyone.

#

Ping when reply pls

elfin token
#

I'm using photon

halcyon heron
#

Should I use Mirror or Netcode or some other network library for a simple pvp/pve (cube enemies) game?

  • Only physics the game contains is box colliders
  • I have no experience in networking
zinc marten
# halcyon heron Should I use Mirror or Netcode or some other network library for a simple pvp/pv...

@halcyon heron I'm learning Netcode for my job, I gotta say tutorials are pretty rare to find given the full release came out a couple of months ago. Documentation is okay, covering the most basics of stuff without many examples. I would say find a network library that has more tutorials if u are a beginner. Its not like Netcode is terribly hard to implement. Its fairly simple and using it alongside with relay is pretty flawless not gonna lie. But yeah documentation and tutorials are my main issue with Netcode, especially now that Im doing an online VR prototype... there is almost nothing online.

brave perch
#

Does anyone have a written tutorial of FIsh networking? I'm getting tired of videos because they don't explain stuff

weary steppe
#

Hi! I'm trying to make a multiplayer 2D top down game using Photon, but I have some issues. My game has a soccer ball and I can't make it so it doesn't bug on different clients, can someon help me?

using System.Collections;
using System.Collections.Generic;
using UnityEngine;

public class BallMove : MonoBehaviour
{
    private Rigidbody2D rb;
    private Vector3 lastVelocity;
    public float speed;

    private void Start()
    {
        rb = GetComponent<Rigidbody2D>();
    }


    private void Update()
    {
        lastVelocity = rb.velocity;
    }

    private void OnCollisionEnter2D(Collision2D collision)
    {
        var speed = lastVelocity.magnitude;
        var direction = Vector3.Reflect(lastVelocity.normalized, collision.contacts[0].normal);
        rb.velocity = direction * Mathf.Max(speed, 0f);

    }
}
pulsar lion
tranquil hull
#

Hi guys, I have a question here.

public Transform target;
List<GameObject> PlayerObjectsList = new List<GameObject>();


public void UpdateUsers() {
        if (PlayerObjectsList != null)
        {
            PlayerObjectsList = packManNetworkManager.PlayerObjectsList;
            foreach (var item in PlayerObjectsList)
            {
                //Assign GameObject in PlayerObjectsList in target slot.
            }
        }
    }

I'm going to assign the data in list playerobjectslist to target. Can someone help me please?🙈
Welcome for any advice, thanks ~

PlayerObjectsList store the player joined game.

digital stag
#

Anyone used Unity with Laravel & session-based security? And did you base code on some existing API?

weak plinth
#

Easiest networking tutorial?

raven roost
#

if anyone is familiar with Photon multiplayer in unity, I'm having an issue where pretty much all movement works fine except jumping. the player jumping will be fine but on the other screen its like the player is jumping and snapping to the ground at the same time.

I have photon view and photon rigidbody 2d view as well with synchronize velocity on as well. I'm using velocity to have them jump. can i not use velocity to jump?

marsh birch
#

Do any of u know if its possible to change roomOptions after creating the room (eg. closing it after starting the game)

knotty tendon
#

can anyone tell me the best way to make a first person multiplayer game with netcode

fringe pasture
#

when someone gets a chance, I have a couple problems in changing values and deleting objects for all clients with photon Pun2, I cant seem to find what is wrong, the bounds dont change when the rpc changes them, the flag dosent get deleted when a client other than master collids with it, and when all the cops get deleted it somehow triggers one more to spawn, I cant find out what is causing it, any help would be nice
my scripts: http://pastie.org/p/5L1OHMmjdujod6HMueOBfg http://pastie.org/p/67rBDJaDbpGZDDY5SVtbst

wide girder
fringe pasture
# wide girder Might want to add some debugs to see if the RPCs are getting called on the clien...

i did and what it said is that the bounds had changed from 25 to 50 but i still am confined to 25 by 25, and for the objects being spawned i dont know what causes it still nothing sets spawn enabledd and spawn cops to true when the host goes to lobby or when everyones out, and i know the problem with the flag and im trying to figure out how to use the ownership transfer stuff i need to do

wide girder
#

Otherwise, I can only guess that it resets locally to the other value. Might want to turn the field into a property and print log in it's setter to troubleshoot that.

fringe pasture
#

well ill try

fierce acorn
#

is it possible for 100 people to join one lobby because im going to by photon pun+

weak plinth
#

how to check if a player connected to the room in photon

safe loom
#

is canvas, camera, audio, listener part of the prefab player in netcode

#

i mean

#

or i need it to be out of it parent to be local because i think this happens when gameObjects are out of player prefabs they turn into local

still hare
#

not sure what you are asking exactly, but no, you generally shouldn't have your camera or audio listener as part of your networked player prefab

#

if you have all of those on the prefab, you will have to manually remove them for every other player when they spawn in

safe loom
#

ok thx

fringe pasture
#

when someone can help, i am slowly fixing the problems i said w hile ago, I found the issue for the flag destroying and i found a diffrent way that destroys the flag but i still get this error i know it functions but it would be nice to fix this error
the error: Failed to 'network-remove' GameObject. Client is neither owner nor MasterClient taking over for owner who left: View 1002 on Flag(Clone)
the new scripts: http://pastie.org/p/6l2UbfK5pZsKx2zJOAjLxK

edit: i changed stuff and i cant find a way to change the owner i just keep getting errors

fringe pasture
#

i might be able to get it working if i can figure out how to transfer ownership of the flag to whoever it collided with, any one know how

severe fable
#

I have a NetworkManager prefab setup. Normally when playing the game you'd go through various menus, hosts/clients would get started and then carried over to the next scene. However when developing I want to be able to jump straight into a scene. So I have added the NetworkManager prefab to every scene; but I want to add a script to it so that on Awake it checks to see if the NetworkManager already exists (if so use existing one) and also check to see if we've jumped into game midway though and need to start host. Here is my script (below). The problem is that Unity is saying that I cannot add a NetworkBehaviour script to my NetworkManager....so what should I do to make this work?

using Core;
using Unity.Netcode;
using UnityEngine;
using UnityEngine.SceneManagement;

public class NetworkManagerScript : NetworkBehaviour
{
    public static NetworkManagerScript Instance;

    public NetworkVariable<NetworkString> thescene = new NetworkVariable<NetworkString>("MainMenu");

    void Awake()
    {
        if (Instance)
        {
            DestroyImmediate(gameObject);
            Debug.Log("NetworkManager was already started in previous scene");
        }else {
            DontDestroyOnLoad(gameObject);
            Instance = this;
            if (SceneManager.GetActiveScene().name != thescene.Value)
            {
                Debug.Log("We have jumped into the game midway so start the host");
                NetworkManager.Singleton.StartHost();
            }
        }
    }

    private void Start()
    {
        thescene.OnValueChanged += (value, newValue) =>
        {
            CheckScene();
        };
    }
    
    public void CheckScene()
    {
        if (SceneManager.GetActiveScene().name != thescene.Value)
        {
            Debug.Log($"Load new Scene: {thescene.Value}");
            SceneManager.LoadScene(thescene.Value);
        }
    }
}
fringe pasture
#

anyone know why my rpc for changing the menues only works for the client who called it but no the others
code: ```cs
public void StartGame()
{
// code not nessecary for my question here

// sets canvases
view.RPC("RPC_ChangePauseMenues", RpcTarget.All, false);

}

[PunRPC]
private void RPC_ChangePauseMenues(bool isInLobby)
{
pauseMenuLobby.SetActive(isInLobby);
pauseMenuGame.SetActive(!isInLobby);

isPaused = false;
SetPaused();

}

buoyant bone
#

Hello everyone, how ya doin'?
Does anyone have any experience with Rollback Netcode Implementation in Unity?
More specifically, Determinism in Unity?

I already know that the Unity Physics system is non-deterministic, but are the animator and Navmesh also non-deterministic?
(I'm not sure I'll use Navmesh, but I'd still like t know if it's deterministic or not).

There ain't enough info on determinism in unity, so any help would be appreciated.

weary steppe
#

Hi! I am currently trying to try making multiplayer games with Photon, but I have an error and I don't know why, could someone help me?

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

public class Scoreboard : MonoBehaviour
{
    [SerializeField] private Transform container;
    [SerializeField] private GameObject scoreboardItemPrefab;

    private void Start()
    {
        foreach(Player player in PhotonNetwork.PlayerList);
        {
            AddScoreboardItem(player);
        }
    }

    private void AddScoreboardItem(Player player)
    {
        ScoreboardItem item = Instantiate(scoreboardItemPrefab, container).GetComponent<ScoreboardItem>();
        item.Initialize(player);
    }
}
fringe pasture
#

i get an error like Observed scripts have to implement IPunObservable. after i added IPunObservable to a script for something, got rid of the thing that needed it and then getting rid of IPunObservable after, how do i fix this

edit fixed

weak plinth
#

I have a function which i want to run once when two players join the room in photon

opaque silo
#

is unity netcode for objects out of beta and recommended to use?

crisp panther
#

can i ask how can i awake or anything to make it into [conid=0]?

#

i am looking for something like
awake or update
pacman = netid

#

instead of getting my prefabs name i wan to get network id name as well

fringe pasture
#

(photon pun2) i have an rpc called RPC_ChangeBounds, everytime the host hits start or lobby they call the rpc, my problem is that the other clients bounds dont change, the debug i put in the rpc itself says the x and z bound are 50 but the bounds somehow are still 25 which is proven when i try to go past -25 or 25 on the x or z and it dosent let me and the debug there says its 25, I am truley stuck and cant find the cause. any and all help is appreceated.
my code: http://pastie.org/p/1RlYX9gJCvPm8mrBC9pTrq
i forgot to mension that with the execption of in one function and the rpc, i have no other places that the bounds get set and yes ive tried taking out the part where they get set in the one function and it had no effecthave some rpcs that wont

steel crow
#

I building a multiplayer pong game and need help with a thing. The ball isn’t on the same position on client and host, the client is behind. How can I solve the problem?

fringe pasture
#

im just making a new script for my player, the old one is broken, but i still cant change a variable for all clients, anyone know how i can do this (photon pun 2)

inland pier
#

Command Function System.Void ReadyUp::CmdReadyUp() called without an active client. what is this

inland pier
#

bro does anyone know how to make ready up thingy in unity pls help

olive vessel
inland pier
#

bro idek what that means

olive vessel
#

It's pretty self explanatory, you must be a client on a server to invoke a [Command] on the server

inland pier
#

what if i am host

olive vessel
#

You must not have been hosting at the time

#

But it's the same explanation, you're both the client and server

inland pier
#

i still dont get it

inland pier
olive vessel
#

A [Command] is literally an RPC

inland pier
#

oh

#

welsh cow do you know photon at all

heavy zinc
#

hey do you know any good tutorials for unity netcode for beginners? except docs

elfin token
#

How can I edit an instance in real time so it syncs to all the players in the same build? Like if I spawn something in my editor instance how can I make everyone to see everything I do in real time from their builds, even if an object is not actually in the scene? Like those sandbox games that spawn things and it does for everyone. I'm using photon. Ping when reply please.

tranquil hull
#

Anyone know what is <spriteRenderer>k__BackingField ?

austere yacht
tranquil hull
spring crane
safe loom
#

how do i convert

#

this?

still hare
#

it probably has a .value or something

#

try putting a dot and seeing what your IDE gives you as potential options

sleek zealot
#

why do i get these errors after i install "Photon Unity Networking Classic" to my unity project?

#

hello?

sleek zealot
#

i just deleted it now

safe loom
#

what is this?

haughty heart
#

Exactly what it says, any method marked [ServerRpc] must have the name of the method end with ServerRpc.

safe loom
#

i didnt understand

haughty heart
#

As in, you still don't understand?

safe loom
#

i dont speak english very well

#

what i need change

#

?

haughty heart
#

Because you have UpdateClientPositionToServer() marked with [ServerRpc] you have to change the name of it to UpdateClientPositionToServerServerRpc()

#

Which is a little long, but that's what it is

#

You have to include the words ServerRpc at the end of the method name, is what it's telling you.

safe loom
#

in the update?

haughty heart
#

The name of the method, which of course includes any reference to it.

safe loom
#

oh thx

#

i think worked

#

is returning me thix exception

#

is this because of my variable ?

#

write permission

#

?

#

the right way to transform a networkObject is transform first in the client and send the network variable position to the server and server to all clients - owner (you)

#

or client dont transform it and just send the network variable position to the server and the server transform it in all clients including the owner (you)?

hybrid mural
#

Hi, sorry, I didn't want to interrupt anyone's question or anything, I've just been struggling with some problems implementing Photon and I figured I could come here for some guidance. Basically, I'm trying to create a 3d ultimate frisbee game, but having the frisbee successfully go from one owner to another and back again has proven to be tricky. I'm able to successfully throw the frisbee from the host player to the other player, but when the other player throws it back, it ends up in a totally different position in both instances of the game. I've basically just been making random minor adjustments for the past few days to address the problem, but honestly I'm pretty stuck. If someone could provide me with possibly a blueprint for how they would approach this problem, or this idea in general (throwing an object back and forth in Photon), that would be really, really helpful. I can provide code also but I've been really slacking on readability and the general tidiness of the code tbh in an attempt to get everything to work. Thanks!

safe loom
#

how to instantiate GameObjects in multiplayer netcode?

austere yacht
# safe loom how to instantiate GameObjects in multiplayer netcode?
regal karma
#

hi,
if, as a server, you subscribe to OnClientDisconnectCallback, and try to check the ConnectedClientsList.Count, you will get a number WITH the disconnecting client still being in the list

#

so if you had only 1 client, who then disconnects, you will get the ConnectedClientsList.Count == 1 on the disconnect callback

#

if you run a routine with like 2 second delay, and check the ConnectedClientsList.Count again, it would then be == 0

#

is there any way to get a callback/event when the ConnectedClientsList.Count == 0, to avoid the ambiguous waiting routine?

keen plover
#

Hello, does anyone want to make 2D Multiplayer game with me, I have already started but I need someone to help me with some mechanics. This project will help us learn more and have great fun. DM if someone is interested!

olive vessel
stiff ridge
# hybrid mural Hi, sorry, I didn't want to interrupt anyone's question or anything, I've just b...

I assume you are using PUN 2. I would recommend looking into Fusion, which is our state of the art networking solution.
In PUN 2, one player is the "controller" of any networked object. This client sends where it belongs to. If you throw the frisbee from A to B, you possibly want to pass control to B as well. Else, B can't just tell everyone where the frisbee belongs and this will complicate matters.
In Fusion, you could do something similar and it is better suited for games with physics aspects (such as throwing).

stiff ridge
stiff ridge
sleek zealot
#

like the pun 2 and photon unity networking classic

stiff ridge
#

The Asset Store only provides a single version of the packages. No way to pick another.
I would not recommend using PUN Classic. Actually, PUN 2 is a bit dated (if usable), too. Of the Photon products, my recommendation is Fusion...

terse idol
#

Hi, I made a game using photon engine but only 2 out of 3 of my friends see the room to join it

#

how can I fix this?

gritty olive
#

I am making a LootLocker Leaderboard. Here's my code

    {
        LootLockerSDKManager.StartSession("Player", (response) =>
        {
            if (response.success)
            {
                Debug.Log("Succsess");
            }
            else
            {
                Debug.Log("Failed");
            }
        });
    }
    public void SubmitScore()
    {
        LootLockerSDKManager.SubmitScore(MemberID.text, GameManagerScript.Score, ID, (response) =>
        {
            if (response.success)
            {
                Debug.Log("Succsess2");
            }
            else
            {
                Debug.Log("Failed2");
            }
        }
        );
    }``` Basicly my problem is I get a "Failed" and if I try to submit a score this error:
weak plinth
heavy zinc
#

hey does anyone got that error? I'm getting it everytime when I want to change scene via server (I can't track where the problem in my code is, because I'm not using "ConnectedClientsList" from network manager)

austere yacht
heavy zinc
#

okay nevermind I fixed that, by changing scene on my destroy function I shutdown my netcode connection, I'm dumb lol

safe loom
#

how to make this function do a multiplayer netcode to all pc?

nocturne rover
#

how can i make a button leave a normcore room?

tidal moat
#

So I follow all the series about steam multiplayer by zyger and I added pause menu with a button to go back to menu but when I try to host lobby again I can't because the first lobby I created still exist.
How can I delete lobby?
I tried Do this

public ulong CurrentLobbyID;
private const string HostAddressKey = "HostAddress";

public void DeleteLobby()
    {
        SteamMatchmaking.DeleteLobbyData(CurrentLobbyID, HostAddressKey);
    }

but it require CSteamID and now ulong

olive vessel
tidal moat
severe fable
#

When using unity NetCode; when I load a scene (using SceneManager.LoadScene) which contains NetworkObject component the network object does not "Spawn" automatically. So I have to add something like this:

        private void Awake()
        {
            if (!NetworkObject.IsSpawned)
            {
                NetworkObject.Spawn();
            }
        }
#

Is there a way to have NetworkObject always start by itself, without having to do this on every NetworkObject?

gritty olive
#

I also got this message, but in the tutorial I was told, I should use IOS

weak plinth
# gritty olive But I just wouldn't work, right?

Not sure what you are saying here sorry. I would check if that sdk support desktop environment or if it only works on iOS itself which could be the case as to why its not initializing for you.

gritty olive
#

Nevermind I got it working but thx

severe fable
terse idol
#

Hi, I have a multiplayer game made with Photon but I want to switch it to steam. I already got a main menu & lobby going, what's the easiest way to import all the files to the new one?

acoustic torrent
#

Hello! Is it okay to post Photon Quantum related jobs here? (Paid)

haughty heart
digital stag
#

Hi what do you guys use to read JSON data out of a web request result? Do you use Unity's JsonUtility to deserialize into a class representation or a simple JSON library like SimpleJSON (Bunny83's) or something more complex...?

digital stag
austere yacht
#

dealing with a HTTP/REST api in itself is the biggest bloat/overkill you incur

digital stag
#

true

azure crown
#

So what is NGO and MLAPI? What is their difference? I don't get it :/

austere yacht
safe loom
#

Hello, i am using unity netcode multiplayer, and i need to set 2 variables of a networkObject on spawn, and i am actually spawning the netWork object on server side, but when i try to set local variables or networkVariables on it, it never changes

#

so i need help

#

i call this spawning function on client side to be done on server side

austere yacht
#

You could set the network variables before you spawn the object

severe fable
#

With Unity Netcode is there any built-in way to get a clients ping/latency?

austere yacht
# severe fable With Unity Netcode is there any built-in way to get a clients ping/latency?

you can just send a timestamp from the client in a ServerRPC that immediately sends back the same timestamp in a ClientRPC in which you compare the actual time with the received timestamp

float _roundTripTime;

void UpdateRTT() {
    ToServerRpc(Time.time);
}

[ServerRPC]
void ToServerRpc(float ts) {
    ToClientRpc(ts);
}

[ClientRPC]
void ToClientRpc(float ts) {
  _roundTripTime = Time.time - ts;
}
wet compass
#

are network variables constantly being syncd or only when they change on the server are they reflected on the clients?

#

(in netcode)

#

I would expect it works sort of like rpcs, and whenever you set the networkvariable value on the server it does a clientrpc which passes the new value to the clients? I just want to make sure having many network variables that dont change much are not making heavier packets unnecessarily

safe loom
#

hello i am getting missing reference exception when i try to despawn a gameObject from netcode, some help?

#

i call this function in a client that is not the server

austere yacht
haughty urchin
#

im trying to add these lines
where do i find the packages/manifest.json files

#

i get an error every time i try adding the URL

tepid skiff
river basalt
#

i want to make online games. How can I do it?

jaunty yew
#

Hi, i want to try make a fps pvp game with photon do you guys know good tutorials on how to set up photon?

#

I'm really new to multiplayer

severe fable
#

I'm having an issue where "Late joining" clients are not getting a synced copy of a NetworkList? They only get synced once the NetworkList has been changed after they join (so they get an empty list as the initial value even though it is not empty)

#

How can I force new connecting clients to sync the networkvariables?

haughty urchin
#

hey im trying to make player 2 spawn with a different prefab than player one but they both spawn on player 1 prefab can i change this?

high night
#

It will be like the players "soul"

#

It will possess the character and control it

haughty urchin
#

its the biggest yet simple prblem i have

#

my games already done i just cant set up the second player

high night
#

im going to sleep in a few mins

haughty urchin
#

damn it

#

well how to do you asign one person that "soul" or script

high night
#

you'd spawn a character for the new player seperately

#

with an rpc

haughty urchin
#

rpc?

#

also i dont know how to detect when the second player joins the lobby

high night
#

there should be callbacks for that

#

something like OnPlayerJoined

haughty urchin
#

wait wait

#

could i say on player joined make player count 1

high night
#

Or you'd know from the spawning of the player prefab

haughty urchin
#

if player count is 1 spawn second character????

high night
#

yeah

haughty urchin
#

im using photon you think it will still work??

high night
#

you can keep track of joining characters using the callback

#

this goes for phoron and mirror

haughty urchin
#

im not sure how to use callbacks

high night
#

probably all other options

#

they are not too different afaik

#

You should be able to call an RPC method

haughty urchin
#

couldnt i use SpawnPlayers : MonoBehaviourPunCallbacks

high night
#

If you call an rpc in your gamemanager amd your gamemanager inherits from networkbehaviour or its photon equilavent, has the network identity component and all

#

The rpc you call on servers gameobject

#

Will be called on clients with same parameters as well

#

Thats how mp comminication works

high night
haughty urchin
#

i have to use it yuea

#

i already know that

high night
#

You should be able to type something like OnClientConnected

#

or joined etc

haughty urchin
#

are override voids like update voids?

high night
#

In a component that implements photons class

haughty urchin
high night
haughty urchin
#

ok then i can finish this

#

omg thank you

high night
#

yeah

#

you should also be able to access the clients id somehow

#

if its 0, you can spawn prefab0

#

if its 1 spawn prefab 1 maybe

haughty urchin
#

ok ok

high night
#

there should be an id going in order starting from 0

haughty urchin
#

at the start is when player 1 joins

#

once they join player count becomes one

#

id someone else joins room and player count is 1 they get the second prefab and position

#

i just gotta test it now

high night
#

yeah

haughty urchin
#

it just spawned a thousand prefab 2s

errant crane
#

So for work I'm trying to introduce agents to play in place of players when the player count is low.
We are using PUN 2.39, going by the documentation, and I'm kind of at a loss on how to do it properly.
How do I get the Agents to exist server-side and then be shown client-side during play?

#

Because far as I can tell, PUN2 does not have a method with which to make "fake" players or basically AI players.

keen pivot
#

Hello

#

how can I make a matchmaking system with photon based on the level of the player

#

To join people of same level and ability in the same lobby

stiff ridge
#

In theory, you could invest more effort and make AI that properly connects to PUN rooms with separate connections but that will eat CCU and be quite some effort.

#

To the suggestion is to let one player do more work. Sync which players are faked and let them be controlled by AI running on the Master Client or so.

clear sky
#

hello, I wonder how could I host my little game: I would like my game server stay online even when no players are online. Do you have clues ?

olive vessel
#

Rent a server and host it from that

night thunder
#

Anyone experiencing weird jittering of PlayerObjects when using the new 1.0.1 Netcode for Gameobjects (compared to the perfectly working 1.0)?

keen pivot
#

Is there any tutorial?

fresh zealot
#

Hey guys, what is the easiest way to play websocket media stream?

cyan tiger
#

can someone help with extremely bad way of downloading files

runic rampart
#

Has anyone here had massive issues with the NetworkSceneManager in full builds?

haughty urchin
#

can someone add and call me i really need help with some of my networking code using photon, screenshots and chat arent enough

brittle gyro
#

Is there any repo that contains best practices for a simple turn-based netcode for gameobjects game? esp. if it has any kind of test framework integration?

errant crane
clear sky
#

@olive vessel thank you, but I looking for some information about doing that and don't really find how can I do that 🙂

stiff ridge
errant crane
#

I was told recently that PUN2 is just some prototype stuff and that we won't use it anyway for the product so it seems I don't have to care about it at all hah

#

I appreciate you wanting to help though @stiff ridge

stiff ridge
#

Glad to read that. It's not our favorite solution anyways. Unlike Fusion, PUN is not built with running on dedicated machines in mind...

errant crane
#

Yeah it would be nice to use Fusion

#

Though it seems we have some proprietary thing we have to use instead so

#

I guess we'll see

#

I'll probably be back with vague questions again in the future, don't you worry

#

Lol

rocky garden
#

i'm using webrequest to download images from api. I'm downloading around 500 images and displaying them in raw images as textures. but the problem is when this is happening cpu and ram usage are very high so high that some times the game crashes any way i can reduce the cpu usage in this part

clear sky
#

Im beginner but In my game I use something for just load images clientside

#

<iframe width="560" height="315" src="https://www.youtube.com/embed/SMHjvKqUO6I" title="YouTube video player" frameborder="0" allow="accelerometer; autoplay; clipboard-write; encrypted-media; gyroscope; picture-in-picture" allowfullscreen></iframe>

#

sorry for this weird link

#

not the json and php /sql part of the video

patent fog
patent fog
#

Oh damn you wanted to share the link to the video only xD
Looks like I'm tired

#

ooook and there's no question because it was an answer to the line above yours. That's it I'm off, I need a break :p

rocky garden
#

but actually not at once

#

the code is set in a loop

#

yeah maybe you can say at once

#

is this something like lazy load

royal marten
#

Hi, I am having an issue with Firestore for my webgl build.

I am actually adding documents directly to a subcollection (collection1/document1/collection2), would this be an issue?

eg. AddDocument("Logins/Date/Players", string)

The Date document in the database shows up in italics, not sure why.

clever verge
#

Hello, I get the following error when I try to join a host in netcode
HttpException`1: (404) HTTP/1.1 404 Not Found
Unity.Services.Relay.Http.ResponseHandler.HandleAsyncResponse
The room code gets generated from the host
but when I join as a client, it doesnt work
JoinAllocation allocation = await Unity.Services.Relay.RelayService.Instance.JoinAllocationAsync(joinCode);

#

The code I get from the host is as follows

#

JoinCode = await Unity.Services.Relay.RelayService.Instance.GetJoinCodeAsync(data.AllocationID);

#

I get a 6 letter string

#

and try to join it using a input field on the client

#

but doesnt seem to work

#

Referred it from the documentation

rocky garden
#

has anyone worked with photon and webgl need some help also not sure if this is the right channel to ask

patent fog
#

it is displayed by the console to respect the hierarchy, but can't be queried and won't appear in results

vagrant olive
#

so its my first time using photon and I'm using 2 different prefabs 1 for player 1 and another prefab for the player that joins does anyone know how I make the first player that joins the first prefab and the second player the second prefab

little sorrel
#

I am trying to make a game using photon but when one player presses w it makes all players move

little sorrel
karmic dagger
#

Wdym by that

karmic dagger
#

Could i show u my code plz

#

Ive been stuck with this for 2 days so it would mean a lot

karmic dagger
#

U need the photon view

little sorrel
little sorrel
#

its ismine

#

ownership

karmic dagger
#

And the

#

In the script

#

Do

#

And reference the photon view

#

And called it what ever for example view

little sorrel
#

Im kinda confused

karmic dagger
#

And do if (view.Ismine)

#

And movement in there

little sorrel
#

playerPrefab is the photonview

karmic dagger
#

Add me and il help

#

Or dm

#

I need help with the thing tho

#

I have no idea how to do it

stiff ridge
clever verge
#

Hello, could someone explain how host migration works in Relay?

#

If the host disconnects, do the clients get a callback that I can use to set them as the new host?

#

In a 4 player game, I would like the game to continue even if the host disconnects with the other 3 player

#

Thank you

little sorrel
woeful shale
#

Question: Is there a way where I can know if the server is full. I'm using Netcode for game objects

jagged sequoia
#

guys , im getting this error when I try to type on a chat that i just scripted with photon, what does it means ?

woeful shale
#

Hello, I got an issue where the host and the client cannot see each other. I'm using netcode for game objects

#

Is there something I could have missed? Any tips?

inland pier
#

how to call a function when a player joins the room in photon?

olive vessel
#

Photon PUN has good docs

jagged sequoia
#

Can someone recommend a wich networking works the best for the type of game im trying to make ? is a 3d android game wich every person has a character, your own house, social type of game just like "Playtogether" kind of game on android

woeful shale
olive vessel
austere yacht
#

PUN is only useful for games where you trust all players to not exploit/cheat or where it would not matter

#

If you want a solid mid level base that you can take anywhere use mirror or netcode

#

if you want a mmo, just stop now

#

if you want the fastest way to do a competitive/pvp fps, use photon fusion of quantum

#

if you feel adventurous (or want to do some deep learning) build your own library on top of ENet or another transport library

jagged sequoia
#

Im so confused. if i want lets say, a game people join in the same world with 300 players lets say. They can go to diferent locations on the map to fish, play minigames, etc. Kinda like club pinguin 3d like , social with games or activities to do in the map, collection of clothes, furnature, etc.

austere yacht
#

300 people on one server on a shared world is an MMO and it’s 99% likely that you will fail to ever make it work. Especially if you have to ask here how to do it.

jagged sequoia
# austere yacht How big is your team?

is just me , im trying to make at least the core to test 2 players interact with each other with chat, bubble chat on their heads when they type and then in the map like a river to fish

austere yacht
#

Both can potentially handle 300 players. But it’s very dependent on how you design and implement your stuff.

jagged sequoia
#

Allright , thanks for the info i will check those out

austere yacht
#

mirror has a lot more stuff built in to get you going with non trivial player counts (like interest management)

jagged sequoia
#

Cool ill go for that then

haughty urchin
#

hey i need help with something

#

im trying to get this button to be instantiated so it will display room names and join on clicking it

#

but it wont instantiate

#

the 1st photo is my scipt that instanitiates the room object

#

the 2nd one is the script that belongs to the room object

little sorrel
#

I am making a game with photon and everything syncs except when I shoot. Bullet has a photon transform view on it and photon view is observing it. Also this only started when I added pv.IsMine though the bullet still instantiates which is the function that is protected by ownership. Also I did make sure I was using monobehaivor pun callbacks.

using System.Collections;
using System.Collections.Generic;
using UnityEngine;
using Photon.Pun;
public class shoot : MonoBehaviourPunCallbacks
{
    public Transform firePoint;
    public GameObject bulletPrefab;
    
    public float bulletForce = 20f;
    public PhotonView pv;
    // Update is called once per frame
    void Update()
    {

            if(Input.GetButtonDown("Fire1"))
            {
                Shoot();
            }
        

    }
    
    void Shoot()
    {
        if (pv.IsMine)
        {
            GameObject bullet = Instantiate(bulletPrefab, firePoint.position, firePoint.rotation);
            Rigidbody2D rb = bullet.GetComponent<Rigidbody2D>();
            rb.AddForce(firePoint.up * bulletForce, ForceMode2D.Impulse);
        } 


    }
}
severe fable
#

I'm using Unity netcode and I'm having a problem where I'm checking to see if client is the owner then doing a ServerRPC, such as this:

            if (IsOwner)
            {
                var movement = CalculateMovement(_movementInput, m_Momentum);

                if (movement.DidMove)
                {
                    SendMovementServerRpc(movement);
                    ProcessMovement(movement.Simple());
                }
            }

The problem is that I have another ServerRPC call on a different button to remove ownership. So the server might have already removed the clients ownership by the time the client tries to run the movement RPC....at which point it is correctly being ignored by the server....however the server splits out errors like this Only the owner can invoke a ServerRpc....is there some way to hide these errors...or should i do something else so that these errors don't even occur?

jaunty yew
#

Do you guys know a good tutorial that goes over photon? I want to try make simple multiplayer games

leaden glacier
jaunty yew
#

Thanks!

#

I'll try PUN2 first

leaden glacier
jaunty yew
#

There is?

leaden glacier
#

yes

jaunty yew
#

I didn't know that :l

leaden glacier
jaunty yew
#

Can you, thanks!

amber void
#

does anyone know what the easiest way to implement networking into your game is?

#

I've found a lot of stuff like mirror but sometimes it works and sometimes it doesnt

#

I'm looking for something more beginner friendly and easy to work with

austere yacht
pure acorn
#

When networking a item that moves, how do you keep everyone on said item?

little sorrel
#

Can you put a photon game on the web

raven halo
#

Hi everyone! Is anyone familiar with Netcode? I've been learning it for a couple of days now and would like to understand better why would someone use [serverRpc] instead of setting the NetworkVariable`s permission to Owner, and just setting the value on the client?

At first I thought that NetworkVariables wouldn't be propagated to all clients if set by the client owner, but I've tested with three, four clients and it still seems to sync fine.

Here's a code snippet to illustrate my question.

spring crane
trail parrot
#

Halo. Maybe a noob question

Unity runs on 1 thread, but what if i run multiple unity instances? Will they all run on the same thread, or will each instance take different thread?

#

So yeah basically should my server run multiple instance, or just 1 instance with many room sessions?

#

I guess a factor is, how much processing each session needs

I only need to host 2 heavy sessions, and the only benefit i can see to combine them in single instance is i can communicate between the 2 individual additive scenes from within 1 instance (i need this)

#

In the future ill definitely separate them, and have them comm via just Rest
But im just making a prototype for now, so i can ignore scaling

pallid mulch
#

@trail parrot Thread != core
So if your server has to run Unity then multiple instances would be better 🤔 I think.

frank meteor
#

If I just need a networked messaging system for transferring data between Unity and a different program on the network, should I just use C# networking sockets, or is it still worth getting a networking solution? I just need to read and write streams to a network port like it were a text stream. Would I start to run into issues if I tried to just handle it myself?

somber drum
#

I think mirror would be worth a shot since it's free and very open-ended with how you use it @frank meteor

#

various community made transports etc

spring crane
frank meteor
#

I'm interfacing with a java program through network messages to control a unity program. Basically taking a bunch of math from a java based simulation program and rendering it in unity with objects and whatnot. It's not connecting separate unity applications so I don't need a full multiplayer suite with things like player ownership, I just need to pass data to and from the Java program on the network

austere yacht
frank meteor
#

Potentially

#

But the most common use case is localhost

spring crane
austere yacht
#

if you can exclude the internet, i'd just roll my own solution for that specific app with UDP (if its realtime)

frank meteor
amber void
#

i implemented photon into my game to make it multiplayer but when i have two players in a game, it moves the wrong character even though i am focused on my chosen screen

#

it only started doing this when i added my character movement script

#

here is my character movement script

#

another weird thing that it does is that it also moves my player's camera based off my normal mouse movements irl, but doesnt actually show it on screen

spring crane
robust delta
#

Hi,I have some problem now, if I want to creating metaverse multiplatform webGL version, what service I can use for networking?
pls, suggest me.

worldly drift
worldly drift
clever verge
#

Hello, I have a question about the Boss Room sample

#

can it be converted into a server client model?

#

I mean hosting it using Multiplay that is

#

The rep says it uses relay

#

Does the networking logic remain the same?

#

Only the connection to the server changes?

hoary nebula
#

whats the closest network to unet that i can use on 2021.3.9f1

olive vessel
#

Mirror

split gyro
#

hey! so I am trying to make an online 2d game, I have the spawning working but I am using a CM vcam and I have no idea how to make it so when each player spawns in they have their respective camera

#

I am putting my player in an empty gameobject and putting all the camera stuff in there to see if it would work

#

Actually

#

I think I got it to work

#

ok

#

so now I am having trouble with priority

#

they are both set to one when spawned but idk how to make it so the camera focuses on the character that it spawned with

elder umbra
#

so i just did the exact same thing, here is how i did it

split gyro
#

ok

#

and if I put this they will have their seperate cameras focused?

#

like the priority

elder umbra
#

look, there are two camera in a scene, 1 of A and 1 of B. If B is the owner then A's Vcam gets disabled so both cameras now follow the active one.

split gyro
#

eh

#

I wanted them to follow seperate objects

#

it is going to be an online game

split gyro
#

so A follows player A and B follows player B

elder umbra
#

that is what will happen

split gyro
#

ahh

#

ok

#

I see now

#

thanks!

elder umbra
#

any time

split gyro
little sorrel
#

why doesn't my bullet sync across clients
Component

amber void
#

i imported a flashlight asset into my project but the flashlight and the light emmited dont show up on the other persons screen (im using photon btw)

#

(PUN, to be specific)

spring crane
elder umbra
#

Hey,

#

Im trying to make a multiplayer car game. I initialize the car controller from the Network manager. and here is the script for the car controller:

#

but only the host can control the car for some reason

#

the clients wheels turn and all but it doesnt move.

#

this is the prefab:

elder umbra
#

anyone?

elder umbra
#

😦

#

if I turn off interpolate in the network transform, it starts moving in the client window but the host player does not update in the client window

thorn crown
#

For A* and mirror is there any plugins that would sync movement or do I need to all movement events on the master client?

#

Or just say fuck it and let each client handle their movements?

vestal echo
#

Anyone know how to use Unity Gaming Services Lobby with dedicated game server instead of relay?? Im desperately searching for tutorials but theres none, almost all tutorials using relay instead of dedicated server

little sorrel
#

why doesn't my bullet sync across clients
Component

#

Please help

split gyro
#

@elder umbra it won't let me use Unity.Netcode or NetworkBehaviour