#archived-networking

1 messages · Page 13 of 1

austere yacht
#

Whether a library supports N players depends on what you do with them. There is no absolute limit in any library, only relative ones. Mirror supports interest management out of the box. Depending on your game it might be enough or require custom implementation, but then you could use any other library again. Experience of most mmo projects seems to be that you need to go fully custom.

sharp axle
#

Unity and Photon built a 200 player battle royale demo.

#

If you need players moving between servers that's a whole different beast

frigid agate
#

How network for entities server side works? Is one of players host?

sharp axle
vocal yoke
#

Hey, i want to implement spine ik, but seems like only host can can send info about target point

#
    public Transform spineConstrainPoint;
    public Transform spineConstrainTarget;
    private void Update()
    {
        SetSpineConstClientRpc(spineConstrainPoint.position);
    }
    [ClientRpc]
    public void SetSpineConstClientRpc(Vector3 pos)
    {
        spineConstrainTarget.position = pos;
    }
#

here's my code

#

anyone know how to fix this?

sharp axle
vocal yoke
#

yeah it worked, thanks a lot

teal loom
#

Hey folks. Can someone help understand the Network Prefabs List in the Network Manager? Previously I had a list of prefabs and it was working, but after updating I'm not sure how to use this list. I've created a list in my repo and have assigned it in my Network Manager prefab, but every time I host / server / client it appears to clear out the list. The warning that's being thrown is:

[Netcode] Runtime Network Prefabs was not empty at initialization time. Network Prefab registrations made before initialization will be replaced by NetworkPrefabsList.

How is this list supposed to be used?

sharp axle
teal loom
#

How do I assign the list of prefabs then? Do I need to script it somewhere? 🤔

The DefaultNetworkPrefabs is getting cleared out due to the above warning so even though I have my prefabs in the scriptable object the Network Manager isn't using the list

vocal yoke
#

click it and it will take you to the SO

#

there you can add prefabs

sharp axle
teal loom
#

Hm.. I have it setup that way but something else may be going wrong. The issue I'm trying to fix is when I connect clients to a host / server it's saying:

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

why dead body here is launched to the space? I dont apply any force to it and colliders dont overlap

teal loom
#

Ah, I think I needed to create a new list and not use the Default. I just realized the DefaultNetworkPrefabs was set in my main editor's Network Manager but my clone's editor was empty

#

Thanks!

thin sinew
#

Hello, where can I have basic to advanced tutorial about networking in unity DOTS?

trail parrot
#

Hi all. I have a multiplayer pokemon/card game, with each "Pokemon, "PokeMove", "UIPokeMove" as a class. A value of a card can have dynamic stats and registers events, hence the class. A player has multiple pokemon. UIPokeMove has reference to PokeMove

Now, is it advisable to use class? At least for PokeMove and UIPokeMove. I'm thinking of changing them to struct. Just checking if there's a certain "standard" on making multiplayer card games/UICards
1 of the reason is bcoz clients don't maintain references between these
The references are handy on server side when doing operations. So i guess client side should always re-connect? Or if all use struct then gotta keep several idIndex and always find the needed instance thru a getter?

sharp axle
sharp axle
trail parrot
trail parrot
#

So i guess the issue is the pokemon/pokeMove instances are kept in multiple places
Some solution:

  1. Always only keep 1 master "container" of the instances. In this case in Player.pokemonComponent.pokemons list. And for PokeMoves, in Pokemon.moves list
  2. Pokemon and PokeMove gotta have enough info in the struct to find the master container. Maybe ultimately a method that can take care of updating the master container, no matter where/who changes the pokemon struct instance?
struct Pokemon
int playerId;
int pokeIndex;

public void AssignToList()
{
Player player = Player.Get(playerId);
player.pokemons[pokeIndex] = this;
}

Is this kinda practice uhh.. common?

sharp axle
full holly
#

Can someone please help me in setting up unity netcode
A very basic setup

#

I can't seem to figure out what I am doing wrong
If anyone can help me do a basic setup for netcode

frigid agate
#

What difference between netcode for gameobjects and network for entities what better for first person view multiplayer shooter?

olive vessel
sharp axle
frigid agate
#

I am about to use dots

olive vessel
#

Right, so you'd want Netcode for Entities

sharp axle
#

DOTs is a lot to wrap your head around. Its a totally different programming paradigm for object oriented.

olive vessel
#

I was surprised when they said DOTS, but we are in Networking so maybe they're a more advanced user

#

Or they have no idea what DOTS is

sharp axle
#

To be fair, you don't have to all in on Dots. A hybrid approach is currently recommended.

full holly
#

If anyone could help me one on one
I would really appreciate it

frigid agate
sharp axle
frigid agate
#

Thanks for the answer

frigid agate
#

Is there limitation for number of players with entities?

olive vessel
#

Eventually you'll find the limits of the hardware and software, the number depends on many factors

sharp axle
frigid agate
#

What is way to get best tick rate and lowest ping and delays? What about to build master server using C++ it is faster I heard

sharp axle
clear jolt
#

Hi everyone, I'm new to unity netcode and I found the tutorial about how to spawn an object seems not clear enough to solve my problem. I'm currently using netcode 1.3.1 in which the network prefabs are already replaced by network prefabs list. According to the history message in this channel earlier, I think I already put the network prefabs into the list and added to network manager. But the problem for me is that how to access that NetworkPrefab I want to spawn in script code and Inisantiate() it. Just directly access it with prefab name doesn't work. Here is my code:

using Unity.Netcode;
using UnityEngine;
using UnityEngine.Networking;

public class EntryManager : MonoBehaviour
{

    [SerializeField] private Transform Infantry;
    ......
    static void SpawnButtons()
    {
        if (GUILayout.Button("Spawn"))
        {
            Instantiate(Infantry);
        }
    }
}

This throws an error called An object reference is required for the non-static field, method, or property 'EntryManager.Infantry'
Changing the static property of this prefab doesn't solve the problem, I'm wondering what else I can do to solve this?

#

Indeed I'm just not sure how to properly access the networkPrefab, failed to find the doc on this, maybe I missed something.

fathom star
#

hey guys i started to work on a simple netcode project ( i am fairly new )
and got a question i tried to use server rpc and it doesn't change the value that i want in server

#
public class PlayerNetwork : NetworkBehaviour
{
    private NetworkVariable<bool> gamestart = new NetworkVariable<bool>(false);
    private NetworkVariable<bool> wait_for_client = new NetworkVariable<bool>(false);

    public override void OnNetworkSpawn()
    {
        gamestart.OnValueChanged += (bool oldValue, bool newValue)=>{
            Debug.Log("let's change gamestart from: "+oldValue+" to: "+newValue);
        };
        wait_for_client.OnValueChanged += (bool oldValue, bool newValue) => {

            Debug.Log("let's change wait_for_client from: " + oldValue + " to: " + newValue);
        };
    }

    void Update()
    {
        if (!IsOwner) return;
        if (IsHost)
        {
            if (!gamestart.Value && !wait_for_client.Value)
            {
                wait_for_client.Value=true;
            }

        }else if (IsClient)
        {
            if (!gamestart.Value)
            {
                startGameServerRPC();
            }
        }
        
        
        if (Input.GetKeyDown(KeyCode.T))
        {
            Debug.Log("ishost: " + IsHost);
            Debug.Log("game started: " + gamestart.Value);
            Debug.Log("wait_for_client: " + wait_for_client.Value);
            if (gamestart.Value)
            {
                Debug.Log("game has been started");
            }
            else if (wait_for_client.Value)
            {
                Debug.Log("waiting for the client");
            }
        }
    }

    [ServerRpc]
    private void startGameServerRPC()
    {

        Debug.Log(OwnerClientId);
        Debug.Log("runs in server");
        this.gamestart.Value = true;
        this.wait_for_client.Value = false;
    }



}```
#

can anybody help me why the value doesn't change when i start my client after that i have started my host

kindred mauve
#

How Do I Make Your Mic High Pitched For Others And Others Mic Low Pitched For You Using Photon Voice And Stuff

sharp axle
sharp axle
fathom star
#

if i log it inside the rpc it says it has been changed, however when it finishes the method everything is back to before

#

ok then can you guide me how to have a global sync variable between all clients and server

sharp axle
#

You'll need a game manager with those variables on it

fathom star
#

that's briliant thank you i worked it around like this:

#
if (!gamestart && !wait_for_client)
            {
                wait_for_client = true;

            }
            else if (!gamestart && wait_for_client) {
                var players = NetworkManager.Singleton.ConnectedClientsList;
                if (players.Count == 2)
                {
                    gamestart = true;
                    wait_for_client = false;
                }
            }
            if (wait_for_client)
            {
                Debug.Log("maybe add StartCoroutine!");
            }
        }
        else if (IsClient)
        {
            if (!gamestart)
            {
                gamestart = true;
                wait_for_client = false;
            }
        }
#

thanks for the guidance 🙏

jovial fiber
#

How would i get about doing multiplayer damage when using Steamworks Peer to Peer ?

#

The movement is done by the player themselfs and then synced by Steamworks/Mirror, but i dont know how to go about the damage.

#

I dont want the Player just to decide that hey i hit you for that amount of damage

#

but rather just the shooter decides with a hitray yes i hit with that weapon and the hit player says hey i got hit by that, time to take that damage

#

but i dont know how to do that reliable over steamworks

sick belfry
#

Hello everyone!

Currerntly I am using Netcode for GameObjects to test Multiplayer for my game, problem is that the Host can move and look all sides while the client can't move at all, and can only look up and down.

#

Any way to fix that?

nocturne vapor
# sick belfry Hello everyone! Currerntly I am using Netcode for GameObjects to test Multiplay...

Hey you whats happening is that you are using a server authoritive network transform, so only the server/host can set the positiom of an object. One way to fix it is setting the positions in a serverrpc, which would come with a sicnificat latency problem, but could make sense in vertain games, another way would be to switch to a client authorative network transform, hoe to do that is mentioned in the docs

sick belfry
#

Yeah, that did the trick. I just downloaded the Multiplayer Utility samples and used the Client Network Transform

clear jolt
full holly
#

NetworkPrefab hash was not found! In-Scene placed NetworkObject soft synchronization failure for Hash: 2779022876!
Failed to spawn NetworkObject for Hash 2779022876.
OverflowException: Reading past the end of the buffer

#
Failed to spawn NetworkObject for Hash 2779022876.
OverflowException: Reading past the end of the buffer

getting these three errors in unity netcode, can anyone help?

lusty wren
#

!code

raw stormBOT
#
Posting code

📃 Large Code Blocks
Large code blocks should be posted as links to services like:
https://gdl.space/, https://paste.ofcode.org/, https://hatebin.com/
https://paste.myst.rs/, https://hastebin.com/

📃 Inline Code
Surround code with three backquotes. Not quotation marks.
To get C# formatting the first line should only contain cs or csharp.
Add a comment with a line number if there is an error message.
```cs
// Your code here
```
Do not share screenshots of code unless requested.

lusty wren
#
 if (Input.GetKeyDown(KeyCode.Alpha1)) { photonView.RPC("Equip", RpcTarget.All, 0); }

[PunRPC]
    void Equip(int ind){
        if (currentWeapon != null) Destroy(currentWeapon);

        currentIndex = ind;

        GameObject newEquipment = Instantiate(loadout[ind].prefab, weaponParent.position, weaponParent.rotation, weaponParent) as GameObject;
        newEquipment.transform.localPosition = Vector3.zero;
        newEquipment.transform.localEulerAngles = Vector3.zero;
        newEquipment.GetComponent<WeaponSway>().enabled = photonView.IsMine;

        currentWeapon = newEquipment;
    }

i am trying to use an rpc to send over information that a object has been instantiated but when i call the rpc no errors or anything and it prints the rpc equip function but on the other players computer you cant see the instatniated prefab please may someone help me

#

Update: i have found the issue it had nothing to do with the script i was setting a camera active if the photonView.IsMine and if it wasnt it wasnt active and i had the weapon parented to the camera that was being set active so i dragged the weapon out and now i can see it

alpine pulsar
#

Hi, I have an issue with assigning colours to players where it shows the new colour of a late joining player for everybody else, but the new player can't see anyone's colour. I'm currently working with NetworkVariables to pass the info along, what could be causing it?

alpine pulsar
#

nvm sorted it

jovial fiber
#

What do you multiplayer peeps recommend: Mirror or Fishnet, i like Fishnets features, but it seems so new and also Mirror has a lot more Tutorials available online to get help from

full holly
#
NetworkPrefab hash was not found! In-Scene placed NetworkObject soft synchronization failure for Hash: 2779022876!
Failed to spawn NetworkObject for Hash 2779022876.
OverflowException: Reading past the end of the buffer
```getting this error can anyone help?
sharp axle
full holly
#

i am not using any network prefab in the first place

#

my network objects contain those hashes

#

when i remove the network object with a hash , same error shows up wiht hash of another objebct

#

and the issue is only on the client side

full holly
sharp axle
#

That is how i fixed it in the past

#

You might need to rebuild the client if hashes are different from the server

full holly
#

how?

sharp axle
#

are you not building the client?

full holly
#

what do you mean by build?

sharp axle
#

building it to a exe and running it

full holly
#

oh

#

yeah i rebuilt it several times

sharp axle
#

if the client and host/server are running the same build then it shouldn't be an issue

full holly
#

still shwoing the same error

#

i am running the host in the build and the client in the editor

#

showing same error

sharp axle
sharp axle
full holly
jovial fiber
#

If you ask here people can search for a question and dont need to reask the same question

sharp axle
# full holly can i dm you?

I guess you can, but I'm not sure how much more help I can be. You can also start a thread here if you don't want to clog the chat

jovial fiber
#

thats cool ? but not what i asked

wraith olive
#

I mean without ever using it, fishnet looks like its just netcode with a slightly different naming scheme and better optimization on the network data end

#

I just used netcode because it was builtin and easy to use

jovial fiber
#

so why would i use netcode

#

i decided on fishnet btw

wraith olive
#

very cool

jovial fiber
#

cuz its better optimized and has other features

olive vessel
#

Netcode is as "built in" as Mirror etc, they're all just packages

wraith olive
#

yeah

jovial fiber
wraith olive
olive vessel
#

It is, but it's not exactly hard to install any of them

sharp axle
#

also, Netcode is also free. Its just the Services that are paid

wraith olive
#

fishnet is free too right?

#

also you can host your own dedicated server on both netcode and fishnet right

sharp axle
#

Fishnet has paid pro tier that has things like client prediction tied to it

floral fractal
#

Hi, is it possible to receive the data of a internet file without downloading it into the computer and reading?

austere yacht
viral haven
#

For VR which one is more reliable? Fish-net or Photon?
It will be a P2P experience

austere yacht
viral haven
#

Okay, so it doesn't matter, right?

austere yacht
#

correct

floral fractal
sharp axle
warped goblet
#

hey there , looking for some input. I am using the new unity lobby package in version 1.1.0-pre.4 and I am failing to create a lobby on the server. The clients can create lobbies and everything is working fine, but I want the server to create a lobby as well once a match is created using matchmaker. The server has its own serviceuser and is authenticated and UGS is initialized. I do get the following error message on the server '[Lobby]: ValidationError, (16000). Message: request failed validation' and the stacktrace. According to the documentation every service call returns this nicely formatted error message https://docs.unity.com/lobby/en/manual/lobby-error-messages however I don't know how to access it. I have wrapped the call to the LobbyService in a try-catch block and intercept any LobbyServiceException however I am unable to get the ErrorStatus object which I would hope could reveal more detailed error messages. Any ideas how to access it?

#

from this post and the answer provided by RobustKnittedTortoise it seems that this error message is actually not propagated through the SDK so I guess I have to learn fiddler now as this seemingly has not been fixed in a long time

sharp axle
sick belfry
#

Hello guys! So I have a simple question. I am using Unity Relay and the Unity Authentification Service, now thing is, that the player sets it's profile which will be the UserName. How can I make a TMPro Text above a player's head, show the name of that specific player? Should I use an Network Object? Client Transform?

sharp axle
sick belfry
#

Hi everyone, back with something else. So I decided to use the AuthenticationService.Instance.Profile as the playerName. Player Name in the player data script is A FixedString128Bytes (like in Image 1) with WritePerms to the Owner and to send the value of the AuthService.Instance.Profile to the server, I am using a void (with ClientRPC) which is called every 5 seconds (just like in Image 2).

Now gigantic problem is, that after all of that, the client can simply not write the value to their Network Variable, as I get the error every time the void is called.

Would be really grateful if someone can help me, thanks!

neat veldt
sick belfry
neat veldt
# sick belfry That is right. I just wanted to try something, but anyways, instead of using Cli...

NetworkVariables exist to minimize RPCs. I would do something like this:

protected override void OnNetworkSpawn() {
  if (IsLocalPlayer) {
    PlayerName.Value = Authentication ...
  } else {
    PlayerName.OnValueChanged += OnValueChanged;
  }
}

protected override void OnNetworkDespawn() {
  if (!IsLocalPlayer) {
    PlayerName.OnValueChanged -= OnValueChanged;
  }
}

void OnValueChanged(FixedString128Bytes prev, FixedString128Bytes current) {
  _userName.text = current.ToString();
}
sick belfry
#

Thanks! Will try it out :)

warped goblet
# sharp axle Are you certain that your CreateLobbyOptions is valid? Also is there a particula...

I have been following the two sample projects by unity for game-lobby and matchplay and they are both using preview packages. Without it some rather central logic is not available. For example in the current available package version 1.0.3 it is not possible to set a password for a lobby and many callback events for data being added/changed in the lobby are not available as well.

my current implementation of the createLobbyCall looks like this. I don't see anything wrong with it. The client uses the exact same method where it works fine so it must be related to something about authentication i assume but I was unable to figure it out so far

'''
public async Task<Lobby> CreateLobbyAsync(string lobbyName, int maxPlayers, bool isPrivate, string password = null)
{
if (_createLobbiesCooldown.IsCoolingDown)
{
Debug.LogWarning("Create Lobby hit the rate limit.");
return null;
}

        await _createLobbiesCooldown.QueueUntilCooldown();
        var createOptions = new CreateLobbyOptions
        {
            IsPrivate = isPrivate
        };

        if (!string.IsNullOrWhiteSpace(password))
        {
            createOptions.Password = password;
        }

        _currentLobby = await _lobbyService.CreateLobbyAsync(lobbyName, maxPlayers, createOptions);
       
        StartHeartBeat();
        return _currentLobby;
    }

'''

#

the call to await _lobbyService.CreateLobbyAsync(lobbyName, maxPlayers, createOptions) triggers the issue with errorcode 16000

sick belfry
#

Yeah, but photon pun does not have the same performance, the same limits as Netcode.

honest gyro
#

Does anyone ever solved issues with stutter on photon fusion? Mine jitters and stutters on clients for some reason

stiff ridge
honest gyro
stiff ridge
latent lake
#

Guys

#

I use photon 2

#

After connecting 2 players the sense changes to game scene and everything is fine

#

And on the scene I have one empty object called game controller

#

Which is supposed to handle the game overall data

#

And I want both players to be able to provide some data to it

#

I added photon view

#

And some code

#

That allows me to type some text in an input field and apply it

#

And after the application it changes a string variable in the game controller

#

At least it's supposed to

#

Because for some unknown reason

#

When I try to apply the change as the creator it's synchronised

#

But when I try as the other player it only changes in the scene of the non-creator player

latent lake
#

it seems that either host cant read or other player cant write

novel cradle
#

What networking solution should I choose to learn?
NOTE: -

  • I have approx 2.5 months
  • I am preparing to get a placement in the XR industry as an XR dev
  • I checked out the best are FishNet, Netcode, Photon Fusion
mortal sparrow
#

In the netcode documentation (https://docs-multiplayer.unity3d.com/netcode/current/advanced-topics/networkobject-parenting/index.html) function NetworkObject.TryRemoveParent is recommended. However, when trying to access said function an error comes up saying 'NetworkObject' does not contain defintion for 'TryRemoveParent'. Am I doing something wrong, are there any alternatives?

A NetworkObject parenting solution within Netcode for GameObjects (Netcode) to help developers with synchronizing transform parent-child relationships of NetworkObject components.

sharp axle
sharp axle
nocturne vapor
# novel cradle What networking solution should I choose to learn? NOTE: - - I have approx 2.5 m...

I'd recommend Mirror then, it seems to be very similar to NGO but with a lot more ressources, which will help you
Additionally if you use chatgpt in a very specific way it can help you learn this things
The mistake while using this technolodgy is asking for solutions, what you need to do is explain your thoughts, like you were talking to a rubber ducky or something
But since Mirror has so many ressources it can give you additional information along the line

nocturne vapor
balmy sierra
#

do you have to use mirror to make a game using steamworks net ?_?
I cant seem to find anything except for one tutorial that makes a lobby system using just steamworks, the rest all use mirror

nocturne vapor
#

No you can use facepunch with ngo. You can use steamworks.net with ngo as well, but I was too stupid to figure it out

warped goblet
# novel cradle What networking solution should I choose to learn? NOTE: - - I have approx 2.5 m...

TL;DR: If you want Peer-to-peer learn Fusion, if you want dedicated servers learn netcode

Be aware that Fusion, Photon, Fishnet etc are business logic for networking only. When going for P2P networking this is fine but if you are planning to get dedicated servers working you will definitely have to work with some other tech as well. I have been working most with Fusion for gameplay and azure playfab for server hosting, matchmaking etc. However managing the handshake between these two libraries is a pain in the butt. Out of fusion and photon I would definitely go fusion.

But that is exactly the huge benefit of netcode because it ties in really well with game server hosting, matchmaking etc. But it is not yet as stable as Fusion.

mortal sparrow
#

nvm fixed it. Apparently you need to add package > add package by name to install the latest version of com.unity.netcode.gameobjects

sharp axle
carmine brook
acoustic inlet
#

a quick question

#

does netcode for gameobjects support webgl

#

?

mortal sparrow
# sharp axle weird. version number shouldn't cause that issue
GitHub

Netcode for GameObjects is a high-level netcode SDK that provides networking capabilities to GameObject/MonoBehaviour workflows within Unity and sits on top of underlying transport layer. - com.uni...

GitHub

Netcode for GameObjects is a high-level netcode SDK that provides networking capabilities to GameObject/MonoBehaviour workflows within Unity and sits on top of underlying transport layer. - com.uni...

sharp axle
novel cradle
acoustic inlet
novel cradle
#

Also, what about Unity Gaming Services (UGS)?

sharp axle
sick belfry
neat veldt
# sick belfry Thanks! That worked! kinda... So the text does update for the host. Clients can ...

That's probably because clients are loading in later which causes them to not subscribe to the event in time for the value to change. You can avoid this by updating the value immediately:

protected override void OnNetworkSpawn() {
  if (IsLocalPlayer) {
    PlayerName.Value = Authentication ...
  } else {
    PlayerName.OnValueChanged += OnValueChanged;
    OnValueChanged(default, PlayerName.Value);
  }
}
```Also consider renaming OnValueChanged to something more descriptive
warped goblet
# novel cradle Also, what about Unity Gaming Services (UGS)?

UGS is a collection of tools, such as Lobby, Friends, Multiplay etc. There is nothing particular interesting/something to learn that is UGS specific.

I guess that would depend on the kind of setup the game/company would go for. Generally speaking Dedicated servers is much more work and more expensive than P2P but it can provide great benefits. The developer has much more control and usually the latency for the player is much better. You should check which of the benefits of a dedicated server are useful for an XR game and decide whether these are required. If not you can get away with P2P and save yourself the struggle.

Most XR games I know only match 2-4 players together. P2P should be easily capable to handle this traffic. 8+ Users i would definitely look into server hosting. If you plan to work on games like beatsaber where latency and client prediction are not really a concern, P2P again is well sufficient. If you want to work on competitive VR shooters you will most definitely want to look into dedicated servers

graceful zephyr
fathom gust
#

[Netcode] [DestinationState To Transition Info] Layer (0) does not exist!

Anyone knows something about this error? I'm using NetworkAnimator component, server authoritative and getting this error on client side. It's regular animation with Blen Tree for walk/jog/run

alpine pulsar
#

hi, i've got a UI object that i want to show on the players screen when they walk into a collider but it's showing it on everyones screen and not just the client who walked into it. I'm using NGO but it doesn't have any form of networking on the object. How would I go about solving this?

sharp axle
alpine pulsar
#

I’ve sorted it now but thanks

full holly
#
{
    Debug.Log("working1");
    storeNetworkServerRpc(arr);
}

[ServerRpc(RequireOwnership = false)]
public void storeNetworkServerRpc(int[] arr)
{
    Debug.Log("working2");
    val = arr;
}``` the method storeNetworkServerRpc(int[] arr) is not running, the previous method is workking. do you know why?
mortal sparrow
full holly
#

the console is the clients

#

not working in the clients side so kept the console at the client to check whats wrong

mortal sparrow
#

Well if server rpcs are supposed to be executed on the server but you're looking at the clients console, nothing is going to be there

full holly
#

why?

#

oh yeah

#

my bad

novel cradle
distant plank
#

can somebody explain how to have my characters camera actually move up and down? I'm trying to get it to rotate but it seems to show up on the server side but not ever for the clients ```csharp
private void LookAround(Vector2 input)
{
float rotationAmount = input.x * rotationSpeed;

    xRotation -= input.y * rotationSpeed;
    xRotation = Mathf.Clamp(xRotation, -90, minViewRotationAngle);


    //accumulate that rotation to a variable
    accumulatedRotation += rotationAmount;

    //apply the rotation using euler angles
    
    playerHeadTransform.rotation = Quaternion.Euler(xRotation, accumulatedRotation, 0);
    playerTransform.rotation = Quaternion.Euler(0, accumulatedRotation, 0);
    

    //virtualCamera.transform.rotation = Quaternion.Euler(xRotation, accumulatedRotation, 0);


}

[ServerRpc]
private void LookAroundServerRpc(Vector2 inputVector)
{
    LookAround(inputVector);
}``` the playerTransform is mapped to the top most parent transform, and the headTransform is mapped to the headSphere's Transform which has the camera in it
weak plinth
#

Hello, I have a question, I am learning to use the Netcode library, and I am having some problems with the movement of the client. The client compared to the host or the server moves something "strange" here I leave a clip of how the client moves compared to the host.
I don't know if you can appreciate the weirdness
Hope it's understandable

mortal sparrow
sharp axle
#

Problem moving on the client

mortal sparrow
sharp axle
mortal sparrow
nimble fjord
#

is netcode bad in 2021 unity version? (saw a 1year old video saying its better in 2020 version wondering if its still the case)

lusty moat
#

i need some help i keep getting this warning whenever i load in to my game with 2 accounts.

sharp axle
radiant dome
#

This is the code that runs when a player quit and i return in the offline scene

#

can you help me?
Sorry for the audio in background...

river basalt
#

Hi everyone

#

can you help me?

#

It gives an error about not having "UnityTransport".

#

When I find the code "UnityTransport", the code is empty

#

I get this error only in the latest version 1.4.0 "Netcode for Gameobjects" package.

#

I would appreciate it if someone interested in this could help me.

sick belfry
#

Hello everyone! I am working on a multiplayer game, and I am using a struct with INetworkSerializble and IEquatable<> but once I have more than one value, I get an issue with an void, which is
"No overload for HandleClientConnected" matches delegate Action<ulong>
.

This is how HandleClientConnected method looks like (Image 1). This is what causes the error (unsubscribing too) (Image 2) and this is how the struct looks like (Image 3)

sweet flame
#

Hey anyone using Unity Matchmaker + Multiplay can help me out here?
I started a new Fleet for Region Europe and suddenly nothing works anymore. When polling the matchmaking ticket status I fail with this:

MultiplayAllocationError: request error: unknown regionid: 8ca6d32c-0985-4c7f-a4dd-cb482cbcf3a8 (request-id: 8a7ff4dd-ff7a-4541-a87d-48e518e38c4e)

I never explicitly set a region id in the ticket attributes? Or is this error misleading and has another reason?

sharp axle
kindred crest
#

Hey I just completed a project using PUN2 but the network movement was pretty jittery...so I am thinking to switch (ya I saw various documentation blah blah and got some help and all but didn't got any real solution) so is Photon Fusion is a good choice or should I consider fishnet or maybe unity netcode it self? Any suggestion guys?

austere yacht
kindred crest
#

Agreed but I really couldn't get any solution to the problem, in the end I can't seem to find any solution to that problem like ik it's something because of photon view in player, the position sync is causing the jitter but I can't seem to know why...watched a whole lotta tutorials, surfed through different qna posts but still nothing...maybe I am just dumb ^_^

honest gyro
#

hey guys anyone is on the photon discord server? I press join and it says I need to verify my account or something

#

nvm you just have to login on the discord website recently

graceful zephyr
austere yacht
#

some libraries make it their job to deal with it, and some persons may have the opinion that all libraries should, but I would not derive a general principle from that and discard any library that takes a different, more unopinionated view.

split hedge
#

How can I make spawnpoints in netcode?

pastel pelican
inland pier
#

any one know how to make each player control their own camera using mirror and fizzy steamworks

spring crane
inland pier
#

the problem is that one guy gets the other guys camera while the other guy still controls his own

#

if that makes sense

spring crane
inland pier
#

what do you mean by disabling based on target ownership though?

sharp axle
vagrant spoke
#

I'm unsure if this is the right place for it but I'm new to multiplayer game development in general and would like to test the Multiplay solution Unity offers but I'm afraid to go over the free tier stuff and get charged a lot of money due to some dumb mistake.

Is there a way to disable a feature if it goes over the free tier?

Another question I have is what does Unity considers "Sign Up" (for the 6 month / 800$ free period)? Is it the moment of account creation? Or after setting up a payment information? Where do I check such information?

sharp axle
lunar axle
#

Which networking solution is the best for fast-paced shooter games?

rain copper
#

I was wondering if anyone could give me some insight on how to handle achievements in a multiplayer setting using Steam and Mirror. Im having a lot of trouble unlocking an achievement for one player rather than all players. I want to have 3 rats in an area. When I player "finds" (enters rat's collider) all 3 rats I want to unlock a steam achievement. I cannot for the life of me get this to work with other players also being in the scene, it either unlocks the achievement for everyone if one person finds all the rats, or no one. Ive been trying to figure this out for hours and maybe its just so simple that I cant see what to do anymore, please help! Heres my code that is on the rats:

#

I have a very simple achievement manager script with the AchievementUnlock() to just unlock a steam achievement

#

I also am trying to make it so that is saves to playerprefs, that way if you find 1 rat and then quit, you can come back and find the other 2

bold birch
#

Would you guys recommend FishNet or Netcode for Game Objects for a 5-player competitive party game?

vivid rampart
#

Unity PhotonView.Ismine always true and ownerId always null

void belfry
#

How can i make that in multiplayer some players can go throught some object and some colide with it at the same time HELP???!!

rain nest
#

Hello, I'm currently using Netcode for GO and i have 2 main issues with the network Animator and Transform.

  1. The root motion does not apply well to from the host to the client. Maybe it's because of the very precise movement curve but there is some very weird movement on the client. For this issue, the only solution i can think of, is to write my own client prediction.

  2. Maybe there is something that i did not understand with the network animator, but to my opinion this component is weird. Basically, the trigger parameter sync diffently than other animator parameter and this is fine. Except when you have some big animator with a lot of parameter. If you change the animator parameters and right after the trigger, sometimes the trigger will sync BEFORE the parameters. This can be corrected with a coroutine but it feel weird anc can cause some severe animation sync bug.

I wanted to know if anyone encountered this problem, and what is your solution. Though I will may be drop the network animator to use my own sync with RPC call

spring crane
dull berry
#

I posted this on the PUN forum, but Smooth Sync can help reduce jitters

carmine patio
#

Can anyone help me with websockets and unity

carmine patio
#

Are there any assets that setup websockets for a webGL based multiplayer game

jovial fiber
#

pun2 is outdated and you shouldnt use it for a new project, it doesnt support network smoothing or rollback

#

use Photon Fusion If you want to stay with photon, it will automatically be more smooth, just cuz it has build in network smoothing / rollback

#

I personally can only recommend Fishnet, its very easy and since its heavily optimized you only need a cheap server to host 100 or more players.
or you use Steamworks with Fishnet to stay completly free (besides the steam fee)

nocturne vapor
bold birch
# jovial fiber Fishnet

Alright, nice! I'm trying to do something sort of peer-to-peer. It's a remake of a game, so it's definitely not going on Steam haha.

#

Is it good with peer to peer in any way? (Maybe with something like Radmin VPN/Hamachi)

jovial fiber
#

Youtube has plenty on Fusion, i never used Fusion myself, since i dont like Photons pricing

#

from my perspective i would recommend Fishnet with Steamworks or a small Server

nocturne vapor
jovial fiber
#

unless you host it on the same network via hamachi, but thats not a valid way if you want to release a game to public

#

You could also use Unitys Relay Service, thats free up to 50 CCU

#

But then you would have to check how many CCU youre currently having and blocking new players from connecting, so you dont step into unitys bad pricing

bold birch
#

I'm gonna be less vague:
So basically, this is basically a fan-made remake of a Nintendo game. I want to do something that won't get taken down, even if Nintendo steps in because of how they are with something like fan projects.

bold birch
jovial fiber
#

you need a relay serivce

#

that can get shut down

#

only way that happens is with hamachi or self hosting

#

but i think a host/client way with hamachi is a good solution in this scenario @bold birch

bold birch
#

Thank you very much!!

jovial fiber
#

Then Fishnet with host/client and hamachi is a completly free option but people need to be in the same hamachi network, only good for a game with friends..
Fishnet with host/client and Unity Relay is Free up to 50 Current Users

nocturne vapor
# bold birch It's DEFINITELY not legal to release on steam 💀 but would it be fine if I use t...

if you know it is not legal, let me give you a tip, just don't release it, espacially in nintendos case, lawyers can get pretty expensive
and yes it is fine to use steam relay with 480, wouldn't release it that way tho, but for only with friends it works fine
I personally wouldn't touch a game which requires hamachi anymore, from a player perspective you would want to use a secure but easy solutionm

jovial fiber
#
  • Your game is on Steam, the biggest Game platform there is
bold birch
nocturne vapor
#

do it on your own risk, I wouldn't wanna beef with nintendo haha
But if your target audience is willing to use it, it is a valid option

jovial fiber
nocturne vapor
#

yes that would work too, like minecraft

jovial fiber
#

yep thats pretty easy with fishnet

bold birch
#

Does Fishnet allow an easy way to do server executables?

#

(lol, was about to ask)

radiant dome
#

Guys with unity Relay when the CCU counter is trigggered and its value incremented?

jovial fiber
radiant dome
#

To decrement the CCU counter i just need to do NetworkManager.ShutDown?

jovial fiber
bold birch
#

I was mainly considering the virtual network option, because it doesn't require port forwarding on the end of the host.

bold birch
jovial fiber
#

you just need to display the current ip in a log output from the server and tell them to foward the port on the device the server is running

bold birch
#

Alright, sounds easy enough from a user perspective 🤷‍♂️

jovial fiber
#

the user you just have a ui to enter the server ip and the name they want to have

#

i mean none of this is automatic, but its very easy to grasp and there are multiple tutorials online and help projects on the github/website of fishnet

bold birch
#

Of course, of course. I think it'd be good to learn either way!

void belfry
#

How can i make that in multiplayer some players can go throught some object and some colide with it at the same time HELP???!!

dark axle
#

So i run into a Problem with the Dedicated Server Plattform Build with a Linux Server hosted on AWS. If i upload the Server application to my AWS EC2 instacen and start it over a console, all Logs get pushed to that console, wich i dont mind. But as soon as i close the console on my pc. The Server Application gets killed on the Server.

urban cradle
#

Hello,
My problem is that I make a multiplayer game with photon and in my script that manages the lobby and the spawns etc..., in this script I create a list of gameobject that I call players and as soon as someone spawns a l using the OnJoinedRoom() method I make sure that once the player spawns that I add it to my list, then I want to access this list so that my bot retrieves the coordinates of the nearest player and this moves towards him. Except the first player is add but the following ones are not and I don't know why.
Thanks in advance for the help.

neat iris
#

Use a site like pastebin to post code

urban cradle
#

And also for my alivePlayerCount it doesn't work either since the list is malfunctioning

glacial moon
#

hi, i want to make every player have different character
did i need to set active to false ? (to hidden the character in prefab)
or
i need to change Local Avatar Prefab ?
do i need change this

#

or set active in avatar ?

carmine patio
#

local avatar prefab player character 3d model

glacial moon
carmine patio
#

its in one of your avatar prefabs

#

either the local avatar prefab or local player or avatar 1 2 or 3

#

try one of those

#

configure it out test each one until it works

#

i didnt write the script im just going off what im seeing in the inspector

glacial moon
#

oh.....
thanks

carmine patio
#

send me the files i can take a look in a minute

#

@glacial moon

glacial moon
#

but i got error every other player join

#

this file attach to Avatar1 Copy

turbid hemlock
#

Hello everyone. I've got a question regarding NetworkObjects when using Unity Netcode for gameobjects.
I've already posted it in the forum, but received no answer so far, so I thought it might be a good idea to post it here as well.

" I have the following issue: Let's say there is this NetworkObject

  • Tile
    -- Game
    --- Traps
    ---- TrapA
    ----- MovingPlatform
    'Tile' is spawned during runtime.
    'MovingPlatform' has a NetworkBehaviour and NetworkTransform component. It is supposed to move when the player is jumping on it.
    All other Nodes have NetworkTransform components to make 'MovingPlatform' work.
    So far so good. But if for example, 'Traps' is inactive when 'Tile' is spawned and activated later during runtime (by so kind of event e.g. pulling a lever), 'MovingPlatform' doesn't know e.g. IsHost, IsSpawned, etc.
    Is there a way to make it work without having to move 'Traps' into a prefab and spawn it? Like telling the NetworkObject to refresh some of its children?
    It works when 'Traps' is active at first and set to inactive after spawning (at least locally, haven't tested it with Coop). But this feels awkward, is there an easier way?"

Link to the thread in the forum: https://forum.unity.com/threads/inactive-networkbehaviour-in-sub-node-not-initialized-when-activated-after-networkobject-was-spawned.1439605/

sharp axle
turbid hemlock
zealous thicket
#

is there any people using photon fusion ? i've a problem how to run function StartGame when i load scene from addressables

crystal marlin
#

hello, i am using netcode for gameobjects, and because I have many GO's in my scene, just simple monobehaviours, this shit is destroying my playmode performance. any tips on what to do?

crystal marlin
sharp axle
crystal marlin
#

in a sense it does

#

because if you have many mono's the aforementioned search for nested managers will take longer, since FindObjectsOfTypeAll searches mono's as well

#

super duper annoying

crystal marlin
#

is there a way to overwrite a file / method inside an embedded package? for example Packages/Netcode for Gameobjects?

inland pier
#

Multiple NetworkManagers detected in the scene. Only one NetworkManager can exist at a time. The duplicate NetworkManager will be destroyed.
how do i fix this

inland pier
# austere yacht delete one

i dont mean to have two, in one scene, i set it to ddol then go to a new scene, adn when i go back it says there are two and it deletes the first (the ddol one) which then throws reference errors

austere yacht
#

dont add one to your other scene then

#

and don't reload the scene that holds the ddol objects

inland pier
#

how do i not reload it

inland pier
austere yacht
#

how do you "come back"?

inland pier
#

not sure, the network stuff does it for me, but i can try to find it

#

i think it just loads the scene again

austere yacht
#

well, don't put your DDOL network manager into scenes that you are loading repeatedly

willow cloak
#

Put it in a scene that you load only once during the game session

#

Not some scene you can go back to

inland pier
#

alright thanks

#

ill try that

wind vine
#

What does the ngo documentation for the approval check mean by steam ticket, and why shouldnt someone use it in an approval check payload?

sharp axle
wind vine
white torrent
#

hi guys! i'm trying to make a Dedicated server game with fishnet and having poor results. And afaik fishnet is one simple network solution too. I clearly need to study some networking, I'm pretty sure I need to get some general networking lessons for unity, so not fishnet specific. Do you guys have any recommendations on what/how to learn and where? I can't seem to get how all of this works and I've read fishnet docus quite a lot without result.

buoyant gust
#

the dedicated multiplayer server build can be self hosted right?

sharp axle
buoyant gust
#

what is photon exactly?

#

I want my game to have between 2 to 40 players

#

per instance

#

what would be my options?

sharp axle
# buoyant gust what is photon exactly?

Photon is one of the many networking frameworks out there. Check the pinned message here for the other solutions. It really depends on your game but they should all handle around 40 players

sharp axle
tidal prawn
#

why cant I add the prefab to the network prefab list

buoyant gust
#

what is the most scalable between photon and NGO

#

I want only 40 players in my game but possibly expand on that later on

fierce viper
#

how would i execute code on server and return it to the client? using NGO

sharp axle
meager rain
#

https://pastebin.com/Lc5RsXFw

i have scripts that implement pvp turn based multiplayer game, it also utilizes mvc pattern, i have code correct but no connection to game is happening and no player are spawning.. no debug showing too

#

im using pun2 btw

hard creek
#

Hello, I'm working on a network game using netcode and cinemachine. I have a virtual camera that's following a network gameobject. It's client authoritative so, on this game object, I have a Client Network Transform component. At the init, the owner of the gameobject sets the position of the object. There is a delay between the moment when the position is set and when other clients receive this new position. During this delay the cameras of other clients follow a wrong position. Could you please tell me how to handle this problem correctly ? Ideally I would like to have the cameras following the object after at least one position synchronization.

sharp axle
tidal prawn
#
{
    private NetworkVariable<int> _connectedClients = new NetworkVariable<int>();
    [SerializeField] private GameObject playerBoardPrefab;
    
    
    private void Update()
    {
        if(!IsOwner||!IsServer) return;

        if (_connectedClients.Value != NetworkManager.Singleton.ConnectedClientsIds.Count)
        {
            _connectedClients.Value = NetworkManager.Singleton.ConnectedClientsIds.Count;
            SpawnPlayerBoardServerRpc(_connectedClients.Value -1);
        }
    }

    [ServerRpc]
    private void SpawnPlayerBoardServerRpc(int newPlayerId)
    {
        int rotation = 90 * newPlayerId;
        Debug.Log("rotations is " + rotation);
        GameObject go = Instantiate(playerBoardPrefab);
        go.GetComponent<NetworkObject>().Spawn(true);
        go.name = "setting name";
        go.transform.GetChild(0).GetComponent<RectTransform>().rotation = Quaternion.Euler(0, 0, rotation);
    }
}``` Im getting error NotServerException: Destroy a spawned NetworkObject on a non-host client is not valid. Call Destroy or Despawn on the server/host instead. and The object of type 'NetworkObject' has been destroyed but you are still trying to access it.
I dont get why the spawn happends in a serverrpc so the clients dont do it right?
hard creek
sharp axle
sharp axle
tidal prawn
#

this is all my code

sharp axle
tidal prawn
#

this is my network object on the preab

spring pilot
#

does anyone know what this error message might be caused by?
[Netcode] NetworkBehaviour index 1 was out of bounds for player(Clone). NetworkBehaviours must be the same, and in the same order, between server and client.
When using parallel sync, I will receive this error message and crash after joining on my other editor.

#

ah ok I fixed it

#

I was deleting the player controller script after joining my bad

full holly
#

unity netcode client host connecting only in the same computer and not in other devices

#

can we use netcode to connect devices that are not in the same local network?

full holly
#

"Unity provides a relay service that you can integrate with Netcode easily iirc. " can you elaborate or send a link?

wide girder
#

I think there's also a mention and explanation on integration in the Netcode docs.

full holly
#

👍 👍

weak plinth
#

Some I'm a bit ambitious, and I'm making a multiplayer VR Game. With no experience networking games at all. Where should I start?

#

I'm guessing the best Idea will be to purchase an asset to handle this mostly for me, and if so, what are some good ones?

compact shuttle
#

I have this game where a player is controlling a ball, the server is P2P - Unity's Relay (Netcode for Gameobjects)

The balls should be able to move smoothly without any noticeable delay, as well as being able to noticeably see when you collide with another player.

Would it make sense to have server-authoritative-movement?
Or should I make is client-authoritative?

I do know that Client-authoritative-movement is also less secure and can be susceptible to cheating.
But it's P2P, so does it really matter?

Are there any other ways of doing this?
If so, how?

compact shuttle
weak plinth
#

Alright, I meant handling realtime connections of players on a server

sharp axle
sharp axle
compact shuttle
compact shuttle
#

Doesn't include CSP, you have to make one yourself.
It's currently on the roadmap sadCat

frigid hound
#

Using unity netcode, how would i find a list of hosts that i can connect to?

sharp axle
frigid hound
#

Is there a way to do that without the Lobby Service?

sharp axle
frigid hound
#

aight

#

followup question

#

eh actually nbm

#

*nvm

compact shuttle
#

When teleporting the client, it teleports to a close location instead, and when I move it snaps interpolates to the actual location, is this a bug?

I am using a server-authoritative model.

Code

    [ServerRpc]
    private void RequestTeleportServerRpc(Vector3 position)
    {
        // Teleport the player to requested position
        NetworkTransform.Teleport(position, Quaternion.identity, new Vector3(1, 1, 1));
        
        // update the position on the client-side
        RequestTeleportClientRpc(position);
    }
    
    [ClientRpc]
    private void RequestTeleportClientRpc(Vector3 position)
    {
        // Set transform's position to position
        transform.position = position;
    }

At the end I moved the player, which results in the player interpolating to the actual location

#

I have tried both 2022.2.21 and latest 2023 version, both results in the same issue

#

Am I doing it correctly? 🤔
For NetworkTransform.Teleport should immediately teleport the transform without interpolating.
It can only be called on the server too, which is weird.

Host does not have this issue, only clients does.

wide girder
#

I'd assume that the client interpolation is unaffected by that causing the issue. You'd need to either disable the interpolation or look up a way to set the position without interpolation.

compact shuttle
#

🤔

sharp axle
compact shuttle
#

Just like this?

pseudocode

Interpolation = false
NetworkTransform.Teleport(..)
Interpolation = true

or does it require a specific delay between teleportation and turning it on again?

fierce viper
#

why is NetworkManager.LocalClientId 0 in NGO?

#

does this mean im the host??

sharp axle
sharp axle
fierce viper
#

ok ty

fierce viper
#

Networkvariables need the object to be spawned but how do check if the object is spawned in ngo

sharp axle
fierce viper
teal cedar
#

What is best approach for networking FPS shooter?

#

Should I go with PUN?

teal loom
#

Does anyone have experience manually connecting in DOTS using UNITY_DISABLE_AUTOMATIC_SYSTEM_BOOTSTRAP? I have UI buttons triggering this code but it's not working like I'm expecting:

using Unity.Entities;
using Unity.NetCode;
using Unity.Networking.Transport;
using UnityEngine;


public class ClientServerLauncher : MonoBehaviour
{
    const ushort PORT = 7979;

    public void StartHost()
    {
        StartServer();
        StartClient();
    }

    public void StartServer()
    {
        ClientServerBootstrap.DefaultListenAddress.Port = PORT;
        //ClientServerBootstrap.AutoConnectPort = PORT;
        Debug.Log($"Listening on port {PORT}");
        World serverWorld = ClientServerBootstrap.CreateServerWorld("ServerWorld");
        NetworkEndpoint ep = NetworkEndpoint.AnyIpv4.WithPort(PORT);
        {
            using var drvQuery = serverWorld.EntityManager.CreateEntityQuery(ComponentType.ReadWrite<NetworkStreamDriver>());
            drvQuery.GetSingletonRW<NetworkStreamDriver>().ValueRW.Listen(ep);
        }
    }

    public void StartClient()
    {
        ClientServerBootstrap.AutoConnectPort = 0;
        World clientWorld = ClientServerBootstrap.CreateClientWorld("ClientWorld");
        NetworkEndpoint ep = NetworkEndpoint.LoopbackIpv4.WithPort(PORT);
        var drvQuery = clientWorld.EntityManager.CreateEntityQuery(ComponentType.ReadWrite<NetworkStreamDriver>());
        drvQuery.GetSingletonRW<NetworkStreamDriver>().ValueRW.Connect(clientWorld.EntityManager, ep);
        Debug.Log("Connected.");
    }
}

When I host the server reports that it's listening and the script above reports the client "Connected." but then the client doesn't "connect" until after I stop play. If I open the entities tab after play is stopped it will even run some of the systems to create the player GO

#

Similarly, my GoInGameSystem debug log messages (for client and server) don't print to the console at all until after I stop play

weak plinth
#

how would i sync a list to the server and keep its value when other clients join?

wide girder
tidal prawn
#

is photon still a good choice? or is it better to go with the new unity NGO

sharp axle
tidal prawn
#

been having issues with NGO and got a photon course from humblebundle a while back

#

Ill try that out then thnx

weak plinth
#

say i have a gameobject, and i spawn it on a player, however if a new player joins, i would like him to see it, too. how would i do this?

sharp axle
weak plinth
native moon
#

whats a good multiplayer solution for a simple card game

#

i wanted to use photon but people say its outdated and that fish net is really good

sharp axle
native moon
#

i mostly care about concurrent player limits since im planning on publishing it to steam

weak plinth
sharp axle
sharp axle
grave frost
#

I have question about NetworkVariables. I have some data, which can change during game, but not very often. And it is important to get right value also for clients connected in middle of game session. Is it overklill to use NetworkVariable for this? Like what about using RPC on OnNetworkSpawn callback to request actual data from server and then sync value using another reliable RPC only when value changed? I am afraid of bandwidth overload when there is lots of NetworkVariables (asume RPC are cheaper for resources). How many NetworkVariables is too much?

austere yacht
spring pilot
#

hey guys, is there any way to use to serializer.SerializeValue() an AnimationCurve in an INetworkSerializable struct?

    {
        private AnimationCurve heightCurve;
        private AnimationCurve distCurve;
        internal AnimationCurve newHeightCurve
        {
            get => heightCurve;
            set
            {
                heightCurve = value;
            }
        }
        internal AnimationCurve newDistCurve
        {
            get => distCurve;
            set
            {
                distCurve = value;
            }
        }
        public void NetworkSerialize<T>(BufferSerializer<T> serializer) where T : IReaderWriter
        {
            serializer.SerializeValue(ref heightCurve);
            serializer.SerializeValue(ref distCurve);
        }
    }```
#

(sorry for repeat question, original channel was innapropriate)

#

current error message is: "Assets\workflow main\scripts\network\playerNetwork.cs(304,24): error CS8377: The type 'AnimationCurve' must be a non-nullable value type, along with all fields at any level of nesting, in order to use it as parameter 'T' in the generic type or method 'BufferSerializer<T>.SerializeValue<T>(ref T, FastBufferWriter.ForPrimitives)' "

abstract copper
spring pilot
#

?

#

and then

abstract copper
#

Sure, and then just send the index

spring pilot
#

curvelist[i] for example

#

ok got it

#

thanks

grim current
#

I am trying to download image from the web from url but it's throwing a null ref

weak plinth
#

how would i sync already spawned gameobjects to clients who joined after the object has spawned? [mirror]

austere yacht
weak plinth
#

keep in mind these are childs of prefabs instantiated at runtime

#

and networkserver.spawn is also not doing anything

austere yacht
balmy sierra
#

I've tried to get https://docs-multiplayer.unity3d.com/netcode/current/advanced-topics/session-management/
to work (I manually copied the code over because for some reason importing from git wont work with the package and causes a lot of errors)
but I'm a little lost on how it's supposed to be used.
I understand using a specific ID for the player instead of the NGO client ID's as they change based on who connects and disconnects, and I understand the concept of using the struct T to store data in relation to the players specific clientID, but I don't understand how to necessarily implement the session manager

[also yes, I'm fairly new if you cant tell by how stupid I probably sound lmaO]

For context I plan on storing 3 main vars (like "points" that will probably be ints (or floats if I get fancy with the point system and add decimals), an undecided amount of bool vars [for unlocking upgrades during the "session" of the game, these bools will allow client players to purchase things with the "points",] and an undecided amount of int vars (for tracking "fun" stats, like how certain games will show the person who did the most damage, etc.) I want this data to be linked to the player as opposed to having it linked to client ID as if someone leaves mid match and rejoins in the third round the client ID's will shift around [by leaving at least] Hence upon searching up something like structs multiplayer points or something like that I found the Session Management doc and am trying to implement that, as it seems to solve my problems but I can't quite figure out how to implement it.

If anyone knows how one goes about this, or if there is in fact a better way to implement what I intend to do, please let me know

You can use session management to keep data when a player disconnects and accurately reassign it to the player when they reconnect.

sharp axle
balmy sierra
balmy sierra
# sharp axle yep

ah very cool ty
and i presume upon the game ending I'd just clear the dictionary to get rid of all the data & restart ye?
[also would I make the dictionary be a network var? can you make a dictionary be a network var?]

sharp axle
# balmy sierra ah very cool ty and i presume upon the game ending I'd just clear the dictionary...

Just reloading the scene would take care of the data. Someone did make a NetworkDictionary a while back but its a bit outdated now. https://github.com/Unity-Technologies/multiplayer-community-contributions/tree/main/com.community.netcode.extensions/Runtime/NetworkDictionary

GitHub

Community contributions to Unity Multiplayer Networking products and services. - multiplayer-community-contributions/com.community.netcode.extensions/Runtime/NetworkDictionary at main · Unity-Techn...

balmy sierra
sharp axle
balmy sierra
sharp axle
#

lol, I've got the docs permanently pinned in my browser

tidal prawn
#
{
    private NetworkVariable<int> _connectedClients = new NetworkVariable<int>();
    [SerializeField] private GameObject playerBoardPrefab;
    
    private void Update()
    {
        if(!IsOwner||!IsServer) return;

        if (_connectedClients.Value != NetworkManager.Singleton.ConnectedClientsIds.Count)
        {
            _connectedClients.Value = NetworkManager.Singleton.ConnectedClientsIds.Count;
            InstantiatePrefab(_connectedClients.Value -1);
        }
    }
    
    private void InstantiatePrefab(int newPlayerId)
    {
        int rotation = 90 * newPlayerId;
        Debug.Log("rotations is " + rotation);
        GameObject go = Instantiate(playerBoardPrefab);
        go.transform.GetChild(0).GetComponent<RectTransform>().rotation = Quaternion.Euler(0, 0, rotation);
    }
}``` I got this code wich spawns a prefab whenever a player joins. Its not synced to the client but the moment I put the spawn command under I get errors like NotServerException: Destroy a spawned NetworkObject on a non-host client is not valid. Call Destroy or Despawn on the server/host instead.
misty python
#

is anyone here MAYBE developing on Mac and has tried to use Unity Lobbies?

await UnityServices.InitializeAsync();
AuthenticationService.Instance.SignedIn += () => {
Debug.Log("AuthenticationService_SignedIn: " + AuthenticationService.Instance.PlayerId);
};
await AuthenticationService.Instance.SignInAnonymouslyAsync();

this returns the same playerId for two instances of the app on mac.
So if I run the game on the editor everything is ok, I get one instance in the editor and one in build
but if I open the same build in a new window "open -n -a .app"
I get the same playerId on that client instance

#

found the solution, so thanks anyways 🙂

sharp axle
misty python
# sharp axle For those searching this later. The solution is to change Authentication Profile...

Exactly

 InitializationOptions initializationOptions = new InitializationOptions();
        initializationOptions.SetProfile(playerName);

        await UnityServices.InitializeAsync(initializationOptions);

        AuthenticationService.Instance.SignedIn += () => {
            Debug.Log("AuthenticationService_SignedIn: " + playerName + " - " + AuthenticationService.Instance.PlayerId);
        };

        await AuthenticationService.Instance.SignInAnonymouslyAsync();
orchid grove
#

im currently using Photon PUN to make my first multiplayer game, ive got movement synced and a room/lobby system working. the biggest part of the game is collecting randomly spawning fish but the spawning isnt synced between clients
i have no clue how to sync it, ive tried photon view on both the spawner and the prefab
im very clueless when it comes to this lol

gentle drift
#

Hello, using NGO and I have a quick question, if a parent GameObject is a NetworkObject are then all of its children NetworkObjects? Or do I have to give each child I want something to do over network its own NetworkObject component. I would also like to know that if I have a network player prefab if all children of the player prefab are owned by the owner of the player prefab

sharp axle
gentle drift
#

Thanks :D

spring crane
orchid grove
#

got it, i completely forgot PhotonNetwork.Instantiate even existed lol

balmy sierra
#

yo so uh why is my test player object not properly reading who is the owner? [start a game, host, and the IsOwner FALSE CHECK gets set off (although its the host???]
I know I probably shouldn't use OnEnable for network spawned objects but I can't find what else to use in the docs for some reason [I remember there being a specific portion going over a few but I cant find it again sadly :l]

#

should I use this instead or what ?_?

balmy sierra
#

any help appreciated sry for the essay lmao

sharp axle
balmy sierra
#

literally exactly what I was looking for and couldnt find
so does this mean I should call a function inside OnNetworkSpawn? Or should I do the initialization INSIDE OnNetworkSpawn?
just read it again lmaO ty gamer

balmy sierra
#

alright so anything inside this OnNetworkSpawn doesn't work... I'm spawning the object as a default player object using the network manager (ik ik Ill sort out something else later)

getting 0 debug log readings from anything at all both on host and client

sharp axle
frigid hound
#

for unity netcode/unity transport, is there a function or event when a client sucsessfully conects to a server/host?

raven bear
#

Anyone know, if I have network transform sync on an object, but the object is not moving, are packets sent?

sharp axle
sharp axle
raven bear
#

Alright thanks homie

balmy sierra
sharp axle
balmy sierra
topaz thistle
#

Is it possible to make photon pun 2 rooms stay online when someone has left

spring crane
topaz thistle
spring crane
#

Yea. PUN isn't really designed for persistent stuff

topaz thistle
#

It looks like they have a guide on room persistence

#

Ill do more research

spring crane
#

Yea you could save the state of a room somewhere else and restore it

topaz thistle
#

yeah maybe

spring crane
#

It's probably better to move to Photon Fusion (which is much more flexible out of the box for this sort of stuff) or some other networking framework

topaz thistle
#

I wanna achieve a system where a player can make their own world, lock the world and so its theirs, and from there on I could probably save the information to a firebase database and when another player wants to visit their already made world while their not online in the room, they can enter the world name and load the information from the firebase database

#

Ill have to test some stuff out

spring crane
#

Though I suspect you still might need Photon Server to do this with proper authority as you get into the weeds of this. All clients have a lot of control over the room they are connected to.

topaz thistle
#

True

#

Ill have to make another approach

finite moth
#

Hi

#

Hi, i want to make a 2d game with Rigidbody 2d and physics material with bounciness, player can use the bounciness to push then selves on collission. I dont know how predictable is this, but can i use that with the netcode for game objects?

#

maybe is better to just use the nerwork layer?

sharp axle
finite moth
#

this game will be for wifi only, and its for andoid

#

maybe i can use the network layer

#

if each player simulates the physics, the positions can be wrong rigth?

#

so maybe the host should be the one simulationg all the game?

#

I dont one such a thing like an authoritative server for this

#

sending the player positions is ok for me

#

but im not sure how to handle the physics

sharp axle
finite moth
#

also, on a wifi game, do you think we can have to much input lag?

#

and what about havo physics? but i think that is not free

sharp axle
finite moth
#

and is it free with the unity pro?

sharp axle
finite moth
#

Like a year ago, i readed that havok has an aditional cost, but maybe its free now

merry summit
#

why is my transform for the client on the host not in the right position, you can see here it is "hovering" after a jump. i am using a client network transform

finite moth
# sharp axle I don't believe there are any additional costs, no. But Dots Unity Physics is al...

I think this answer the question

Havok Physics for Unity can be downloaded from the Unity Package Manager, but only Pro, Enterprise and UIC users have access to use the features at runtime.

Havok Physics SDK License
Havok Physics for Unity is a binary-only distribution of Havok Physics (2021.2) that has the same industry-standard power but without access to C++ source code (known as "Base and Product" access) or direct support from Havok.

rich meteor
#

My game is top down and aiming is done via mouse pointing regardless of character orientation. For fast firing weapons, I just send "StartFire" and "StopFire" calls, since sending up to 100 shot info packets per second is madness. So, after sending StartFire call I just update the server with player's current aiming position which is just a float3. Problem is, it's noticeably choppy when only updating aiming target every 0.2 seconds. Is sending a packet with aiming vector every 0.03 (1\30) seconds fine? I know premature optimization is a bitch and such but I'm genuinelly not familiar with acceptable limits here 🤪

sharp axle
sharp axle
rich meteor
merry summit
#

although movement is quite choppy now, any idea why (i do apologise im new to the networking stuff)
it does suggest to use a networked rigid body but i dont see why that would make it choppy?

sharp axle
frigid hound
#

in a unity transport, what ip addres is suppossed to go into the address field

#

or like what do i change so that a client can connect to a given server insead of just the local host

sharp axle
merry summit
topaz thistle
#

Any idea why this block of code isnt setting my speech bubble as active once I click enter to send my message

errant heath
#

Hi, i can't seem to figure out why my clients movements are not being updated on the hosts screen. I can see the camera is moving but not the player position. I am sending a Video and my main statemachine script. Thank you for any help

verbal sable
#

When I test my project via parrelsync & mirror networking, I can move the host, but not the client. I have it set as client to server. I have been looking online and see others have had this problem, but I have yet to find a good resolution

#

If anyone has dealt with this before, would you mind shraing how you reoslved it?

#

I currently resolved it by adding an if(isLocalPlayer), but would that affect multiple players playing simultaneously?

gentle drift
#

I am using Lobby service, relay and NGO hoewever everything works great, but after a little while of playing the host times out does anyone know why this could happen

tidal prawn
#

I'm still stuck on the same issue, how would you handle spawning an object whenever a player joins? I got this implementation but it doesnt work ```using Unity.Netcode;
using UnityEngine;

public class PlayerManager : NetworkBehaviour
{
private NetworkVariable<int> _connectedClients = new NetworkVariable<int>();
[SerializeField] private GameObject playerBoardPrefab;

public override void OnNetworkSpawn()
{
    if(!IsServer) return;
    SpawnPlayerBoardServerRpc();
    _connectedClients.Value++;
}

[ServerRpc]
private void  SpawnPlayerBoardServerRpc()
{
    GameObject playerBoard;
    int rotation = 90 * (_connectedClients.Value-1);
    playerBoard =  Instantiate(playerBoardPrefab);
    playerBoard.transform.GetChild(0).GetComponent<RectTransform>().rotation = Quaternion.Euler(0, 0, rotation);

    NetworkObject netObj = playerBoard.GetComponent<NetworkObject>();
    netObj.Spawn();

}

}

sharp axle
tidal prawn
#
{
    private readonly NetworkVariable<int> _connectedClients = new NetworkVariable<int>();
    [SerializeField] private GameObject playerBoardPrefab;

    public override void OnNetworkSpawn()
    {
        if (!IsServer) return;
        NetworkManager.Singleton.OnClientConnectedCallback += SpawnPlayer;
    }

    public override void OnDestroy()
    {
        if (IsServer)
        {
            NetworkManager.Singleton.OnClientConnectedCallback -= SpawnPlayer;
        }
    }

    private void SpawnPlayer(ulong clientId)
    {
        Debug.Log(_connectedClients.Value);
        int rotation = 90 * (_connectedClients.Value - 1);
        GameObject playerBoard = Instantiate(playerBoardPrefab);
        playerBoard.transform.GetChild(0).GetComponent<RectTransform>().rotation = Quaternion.Euler(0, 0, rotation);
        NetworkObject networkObject = playerBoard.GetComponent<NetworkObject>();
        networkObject.Spawn();
        _connectedClients.Value++;
    }
}``` Ive been going for this aproach
#

this works and it spawns the boards

#

only the rotation is not working

#

the rotation works on the host but not on the client

radiant dome
#

Guys if i want to play with a player in US and i am from EU can i play with him with Relay?

vagrant garden
#

Yes just manually have them connect to the same region.

split hedge
mint sundial
#

hello i have little question

is "The Forest" and "Dying Light" multiplayer system client hosting (p2p) or dedicated server?

#

or something else?

#

and if isnt self hosting, is self hosting is ok for this games?

sharp axle
mint sundial
#

valheim can play with 10 players

#

is that okey for self hosting?

sharp axle
desert lion
#

hey so i'm looking to learn multiplayer networking for my game and i could use some advice with which framework to use. the key points are:

  • i have never worked with any kind of netcode before
  • the game is designed to be played by 1-3 players using any combination of local and networked players.
  • it's designed to be played with a set group of friends over multiple sessions, no automatic matchmaking or random lobbies. ideally you'd connect through an existing friends list system ie steam but i'll settle for anything that works and doesn't require a dedicated server on my end. which probably means someone has to type an ip address in somewhere lol.

i'd love any suggestions on what networking system to use and why - or which to avoid and why!

sharp axle
stark saffron
#

I might need some help with networking.
Basically, let's say I have a player script that can be controlled and stunned.

public abstract class BaseSquareController : NetworkBehaviour, IStunnable
{
   ...
    protected bool IsStunned;
   ...

[ServerRpc]
    protected void MoveServerRpc(float horizontal, float vertical) {...}
}```

Question number one - as you see, I tried moving the character with ServerRpc method and it proved to bee quite slow. The game is supposedly fast-pased, and control responsiveness must be great. If I understand everything correctly,  Rpc sends the code processing request to the host, the host then changes player's transform and sends it back. This proved to be quite slow even on the single machine. 

But giving the player the authority to move is scary - it gives a lot of possibility to cheat. What can I do to increase responsiveness, or maybe I should just suck it up and accept player authority. I saw people in another game called Omega Strikers teleport when they lag, but server rubberbanded them back if they failed to send the information about movement. The responsiveness was great, though.
#

My second question is:
Let's say I made some walls that supposed to stun people on collision:

public class StunOnCollide : MonoBehaviour
{
...
private void OnCollisionEnter2D(Collision2D collision)
    { ...

IStunnable stunnable = collision.gameObject.GetComponent<IStunnable>();
stunnable.Stun(forceMagnitudeVector, rotationAmount, stunDuration, rotationDuration, false);
    }
}

public abstract class BaseSquareController : NetworkBehaviour, IStunnable
{

   public void Stun(Vector2 force, float rotation, float duration, float rotationDuration, bool fromPlayer)
    {
    ...
        IsStunned = true;
    ...
    }
}

public class PlayerTestSquare : BaseSquareController
{
...
private void Update()
    {
        if (!IsOwner) return;
        if (IsStunned) return;
        
        LookTowardsMousePosServerRpc(FindMousePosition());
        ManageButtonMovement();
    }
...
}

Right now they are MonoBehaviours - than means they work only on the server or host side. When my client stumbles on them it forcefully moves but on the client side the IsStunned variable is false, which results in weird behaviour when the server forcefully updates the client player location, but client isn't stunned and tries to move instead. It synchronizes when the stun ends.

If client's character would have the authority to move and walls with the StunOnCollide component are supposedly a network object, will that result in minor desync because client moves faster on the client side? I suppose the code will run on both sides, and the results will be the same, but I am worried about this minor desync. I don't know how to appoach it. I decided to ask before testing it for myself.

mint sundial
#

hello there, when i buy steam direct is steamworks giving multiplayer servers? or whats they are giving about multiplayer

#

i read doc about steam game servers with unlimited ccu

vagrant garden
#

steamworks gives you access to the steam relay which you can use to connect clients together or connect clients to game servers. It does not host game servers for you, you have to host your own servers.

sharp axle
#

I might need some help with networking

split hedge
#

Hey somehow my character doesnt move when I want it to move
It jumps, and IT PLAYS THE ANIMATION, LOGS THE VALUE WELL, but it just doesnt move at all. Here is the moving part:

    {
        if (!IsOwner) return;


        horizontal = Input.GetAxisRaw(inputNameHorizontal);
        //transform.position += new Vector3(horizontal, 0, 0) * Time.deltaTime * speed;
        Vector2 PlayerMovementVector = new Vector2(horizontal, 0);
        Debug.Log(PlayerMovementVector.x);
        //rig.AddForce(PlayerMovementVector * Time.deltaTime * speed);
        //rig.AddForce(Vector3.right * 100f);
        if (horizontal != 0)
        {
            if (!canPlayWalk)
            {
                canPlayWalk = true;
                anim.Play("Walk");
                StartCoroutine(WaitP2());
            }

        }
        else
        {
            if (canPlayIdle)
            {
                canPlayIdle = false;
                anim.Play("Bored");
                StartCoroutine(Wait());
            }
        }

        Flip();```
gray sage
#

Does anyone have some resources i can take a look at about using root motion with netcode for game objects? I've been having problems about clients character being completely still, while the host character is seen by the clients as very jittery, almost as if its string to do the animation but going back to the default pose and i'm pretty stumped about it UnityChanThink

#

i don't know what's the cause

merry summit
#

after a client connects how do i change properties on their character that spawns?

calm hinge
#

Hi, do you have any suggestions on what approach to follow for a network "blackjack like" game?

sharp axle
sharp axle
sharp axle
merry summit
sharp axle
gray sage
wind vine
#

do I have to spawn things from the network prefab list or can i have network objects already placed in scenes?

#

nvm answered my own question just testing, i can

ripe yarrow
#

I'm having a lot of fun with NetCode. I tried Mirror and i got to say this is much better. there are lots of resorses and tutorials and information. I haven't needed to ask for help yet

#

❤️

split hedge
#

How can I fix this?

novel cradle
#

So, I am making a snake eating food multiplayer game with NGO but: -

  1. the client is not able to eat all of its food NO (network object) but passes over it.
  2. the host's food NO is also visible on the client which is not eatable as well.
    Everything works fine for the host tho.
    What can be the issue and how can I fix it?
#

I just dont know how to ask for this complex netowkring help 😅

merry summit
#

nvm i have the error: NullReferenceException: Object reference not set to an instance of an object

#

but why is this variable null?

sharp axle
merry summit
#

how do i do that?
im currently working on a solution that calls this method after the relay is joined
having some issues though

meager rain
novel cradle
#

Yes it is the same ig here too. How do I fix it?

meager rain
#

I only used Photon once, still a rookie in multiplayer field.. I'd make sure that both get connected on same network... Also it should be clearly defined if changes are going to occur on remote or local pc

#

I think in case of NGO it might be replication issue.. but that's all I can think of

sharp axle
novel cradle
#

I am but let me try to debug around that. Thank you very very much for replying.

split hedge
#

Hey how can I fix this?

viscid vale
#

Hi, I want to know how can I enable and disable a Unity Network object from Unity Netcode.
So that it synchronises to all the clients.

coarse light
#

Is there a way to sync the waves in the new water system between two game instances in multiplayer

sharp axle
sharp axle
dusty plover
#

How to make interactive objects using photon fusion

#

It's actually urgent

south palm
#

has anyone done port forwarding before?

spring crane
#

!collab

raw stormBOT
spring crane
#

Same goes for you @dusty plover

viscid vale
#

Hi

#

I am facing a issue.
I am spawning 2 Players using Relay. And the Player prefab has attached a Canvas to him, but when I test it with 2 players, 1 editor and 2nd build.

Then what happens is only host can see the both Canvas, but player 2(client) doesn't see any Canvas at all.

#

If anyone can help me, It would be appreciated.
I am ready to let you in by anydesk.

viscid vale
viscid vale
viscid vale
#

It's not syncing at all

sharp axle
viscid vale
viscid vale
#

It's kinda working,

But, Why There is no player in the client?

sharp axle
viscid vale
#

Here Im spawning a gamemanger, once host starts a new relay server.
But it doesn't appear in the client side. Resulting in no state change of the game for just Client.
So Host can play the game while Client can't do anything.

And when I'm trying to spawn the GameManager then from host then the players and gameManager are no syncing to the client.

#

And GameManager is a prefab with networkObject and networkTransform attached to it.
@sharp axle

sharp axle
viscid vale
sharp axle
#

If you instantate the health bar prefab on the client will not be syncd to the network

#

If its not a network object, then it would be completely local

sharp axle
#

This is a couple of years out of date but in theory should be able to be updated to work with 1.4
https://github.com/Unity-Technologies/multiplayer-community-contributions/tree/main/com.community.netcode.extensions/Runtime/NetworkDiscovery

GitHub

Community contributions to Unity Multiplayer Networking products and services. - multiplayer-community-contributions/com.community.netcode.extensions/Runtime/NetworkDiscovery at main · Unity-Techno...

dusty plover
spring crane
dusty plover
balmy basin
#

Hi. I'm just starting to learn how to use ServerRPCs and Network Variables using Unity's new netcode system, and I believe I'm running into a Write Permissions issue, but I need a little insight.

For context, I am making a bomberman style game where players drop bombs to try and kill each other. Before I learned how to use the netcode, I would have the player gameobject spawn bombs, and then the "stats" of the bombs (things like power, piercing, and remote control) would be synchronized by serializing my "PlayerStats" class component into the bomb gameobject, and then the bomb would be able to customize itself using that information. Then when I learned about netcode, I realized that I can't synchronize and network serialize a class over the network, but I could do that with a struct. So I created a custom struct that I use to serialize the stats from the player and send them over the network so that the server can use them to customize the bomb appropriately.

I'm running into some issues doing this, however. Whenever I spawn a bomb using the host player, I don't get any errors. But if I attempt to spawn a bomb using a client player, I run into an error, which I will attach in a screenshot. Here is the code used inside the "PlayerStats" class component:

#
    public struct PlayerStatsStruct : INetworkSerializable
    {
        public int _health;
        public int _power;
        public int _speed;
        public int _ammo;
        public bool _bombKick;
        public bool _lineBomb;
        public bool _piercing;
        public bool _satellite;
        public Character _character;
        public void NetworkSerialize<T>(BufferSerializer<T> serializer) where T : IReaderWriter
        {
            serializer.SerializeValue(ref _health);
            serializer.SerializeValue(ref _power);
            serializer.SerializeValue(ref _speed);
            serializer.SerializeValue(ref _ammo);
            serializer.SerializeValue(ref _bombKick);
            serializer.SerializeValue(ref _lineBomb);
            serializer.SerializeValue(ref _piercing);
            serializer.SerializeValue(ref _satellite);
            serializer.SerializeValue(ref _character);
        }
    }
    public void SerializeVariables()
    {
        playerStatsNetworkVariable = new NetworkVariable<PlayerStatsStruct>(
            new PlayerStatsStruct
            {
                _health = health,
                _power = power,
                _speed = speed,
                _ammo = ammo,
                _bombKick = bombKick,
                _lineBomb = lineBomb,
                _piercing = piercing,
                _satellite = satellite,
                _character = character,
             }, NetworkVariableReadPermission.Everyone, NetworkVariableWritePermission.Owner);
    }

And here is the ServerRPC inside of my "PlayerBehaviour" class component that actually spawns the bomb:

#
    [ServerRpc]
    void PlaceBombServerRpc(Vector3 gridSpace)
    {
        var placedBomb = Instantiate(bomb, gridSpace, Quaternion.identity);
        placedBomb.GetComponent<NetworkObject>().Spawn(true);
        placedBomb.layer = bombLayer.Value;
        placedBomb.name = _clientID.Value + _bombString.Value.ToString() + _bombNum.Value;
        playerStats.SerializeVariables();
        var bombBehaviour = placedBomb.GetComponent<BombBehaviour>();
        bombBehaviour.playerStatsNetworkVariable = playerStats.playerStatsNetworkVariable;
        bombBehaviour.bombsPlacedNetworkVariable = playerStats.bombsPlaced;
        _bombNum.Value++;
    }

You'll notice there are a couple of extra things I didn't mention, like naming and assigning a layer to the bomb when it is spawned. the layer assignment works from both sides, but the _bombNum value only updates from the server side, meaning all bombs spawned by a client always spawn as "0 Bomb 0". It doesn't really matter because I'm only worried about the bombBehaviour.playerStatsNetworkVariable = playerStats.playerStatsNetworkVariable; part because it doesn't seem like the power of the bombs is being properly assigned, and I'm receiving an error that the client is not allowed to write to the object.

Any insight would be greatly appreciated, please let me know if you need any more information, hopefully I provided enough.

ripe yarrow
#

I was trying to make my own NetwrokManager and found information from the documentation not seaming to work for me.

sharp axle
sharp axle
ripe yarrow
#

like
a girl or boy character

#

wait i just realised i can use the Network Prefabs List to spawn a custome player but then how do i not spawn the Player Prefab

#

or

#

do i spawn a player prefab the spawns the girl or boy player prefab after spawning the player prefab

sharp axle
#

With every new connection, Netcode for GameObjects (Netcode) performs a handshake in addition to handshakes done by the transport. This ensures the NetworkConfig on the client matches the server's NetworkConfig. You can enable ConnectionApproval in the NetworkManager or via code by setting NetworkManager.NetworkConfig.ConnectionApproval to true.

balmy basin
ripe yarrow
#

how dose that overide the NetworkManager spawn player prefab

sharp axle
ripe yarrow
sharp axle
ripe yarrow
#

I'm guessing it sets the player prefab befor you connect as a client.

#

I noticed i can make a custom NetworkManager. why would i need to do that?

sharp axle
balmy basin
sharp axle
ripe yarrow
#

but NetworkManager.ConnectionApprovedDelegate and playerPrefab.PrefabHash are giving me errors

austere marten
#

Photon pun 2 vs mirror
Pros and cons?

fading quartz
austere marten
fading quartz
austere marten
sharp axle
sharp axle
void estuary
#

Hello, I'm using unity for an uni project where I have to make a mobile AR application.
For this project I want to get Game State Integration from CSGO ( https://developer.valvesoftware.com/wiki/Counter-Strike:_Global_Offensive_Game_State_Integration ) and get player data of a live match into the mobile application.

You have to host a POST Endpoint Server to access the data. I never worked with server stuff and only have done it for the localhost to view data on my laptop.
Now my question is how would I properly transfer data from my Laptop onto my Phone in real time?
Should it be some server stuff or just a wireless connection?
Any tips and directions to look into are appreciated.

viscid vale
#

Hi, there is a script game Manager in The scene, but the gameManager only running on host side, client side's gameManager is not working.

But the NetworkVaribale is syncing to the client.

And GameManager is in-scene networkedObejcts not instantiated at runtime.

Can anyone tell what's causing the issue?

#

Actually, I'm toggling(On/off) UI which is a local gameObject in the scene.
So, the Host's side UI is toggling correctly but on the client side the UI is not toggling.

#

Do I need to attach NetworkObject script to the UI?

sand talon
#

if i wanted to network something like a grenade, or just an object wich gets instantiated and is owned by a player, how and where would i start?

austere marten
#

Is there like a link where it explains networking (using pun 2). Is there something the can explain authority,ownership, and how it works?

sharp axle
sharp axle
sharp axle
sharp axle
sand talon
#

alrighty!

ripe yarrow
#

Am i not able to spawn / Instantiate from "Network Prefabs Lists"

#

is the "Network Prefabs List" just referencing and keeping an eye out for if those things are created?

sharp axle
ripe yarrow
#

I'm not sure how I'm supposed to lay everything out.

sharp axle
# ripe yarrow

You don't need the clientRPC there. Use OnNetworkSpawn() in the game manager to call the serverRPC. as long as the custom players in the game manager are also in the prefab list, it should spawn.
You should also be able to reference the prefab list directly by using FindObjectofType<NetworkPrefabList>()

ripe yarrow
#

i think i figured it out
GameObject playerClone = Instantiate(FindObjectOfType<NetworkPrefabsList>().PrefabList[0].Prefab);

cunning sluice
#

Does anyone have any good resources for learning how to protect my game properly from injection attacks?

#

Or maybe just a resource that goes over general/common exploitative behavior to protect against in a multiplayer game

sharp axle
sharp axle
ripe yarrow
#

I tried asking ChatGPT but its very confused.

sharp axle
ripe yarrow
sharp axle
ripe yarrow
#
 MyDebugger.myDebugger.Log("Setup Player Server Rpc");

        //GameObject playerClone = Instantiate(customePlayers[0]);
        NetworkPrefabsList prefabList = FindObjectOfType<NetworkPrefabsList>();
        GameObject playerClone;
        MyDebugger.myDebugger.Log($"Prefab List " + prefabList);
        for (int i = 0; i < prefabList.PrefabList.Count; i++)
        {
            if (i == _selectedPlayerID)
            {
                playerClone = Instantiate(prefabList.PrefabList[i].Prefab);
                MyDebugger.myDebugger.Log($"Prefab Name " + prefabList.PrefabList[i].Prefab);
            }
        }

Dosnt spawn anything and says there is nothing there

sharp axle
#

Oh I guess if you have more than one then it might be finding the wrong one

ripe yarrow
sharp axle
#

What is it not finding? the prefab list or the prefab itself?

ripe yarrow
#

It says this is the problem

#

Do i need to
networkManager.gameObject.FindObjectOfType<NetworkPrefabsList>();

#

instead of looking for it i just made a NetworkPrefabsList variable

#

but the player only spawns on the host not the client and i cant move the host player

#
[ServerRpc(RequireOwnership = false)]
public void SetupPlayerServerRpc(int _selectedPlayerID)
{
    MyDebugger.myDebugger.Log("Setup Player Server Rpc");
    GameObject playerClone;
    MyDebugger.myDebugger.Log($"Prefab List " + plrefablist);
    for (int i = 0; i < plrefablist.PrefabList.Count; i++)
    {
        if (i == _selectedPlayerID)
        {
            playerClone = Instantiate(plrefablist.PrefabList[i].Prefab);
            MyDebugger.myDebugger.Log($"Prefab Name " + plrefablist.PrefabList[i].Prefab);
        }
    }
}
shrewd junco
#

Im still trying to understand the concept of NGO and NetworkVariables, do network variables automatically sync based on some network ID?
Correct me if im wrong: My current understanding is that if i have 2 players (1 host, 1 client) and a script on the spawned player prefab, there are essentially 4 versions of this script [see image]. Then a network variable is used to sync values so there arent 4 different values of a variable, only 2?

ripe yarrow
shrewd junco
#

I know how to use a network variable, im just trying to see if my understanding is correct

sharp axle
shrewd junco
#

ok thanks UnityChanThumbsUp

oblique sandal
#

Hey I'm new to Netcode for GameObjects and Networking in general!
Any idea where the NGO SDK sits on the OSI (Open systems interconnect) model ?

vagrant garden
#

Layer 7 (maybe 6 to some extent). Like pretty much any networking solution for games.

viscid vale
#

Hi, So I wanna know How Can I pass a List<Xclass> as a parameter to clientRPC call.

sharp axle
sharp axle
#

You could also serialize the list as Json and send that

viscid vale
#

Can we create list in networkvariables?

sharp axle
viscid vale
naive gazelle
#

I was reading this article https://gafferongames.com/post/udp_vs_tcp/ so that I could try to understand the use cases for UDP and TCP in multiplayer games. It was published in 2008. Is this a good reference, or did their use case change over time?

sharp axle
ripe yarrow
#

why dose importing Multiplayer tools Samples give me so many errors and how do i fix?

sharp axle
wind mantle
#

What's the best way to make a multiplayer physics based game sync properly? It's turn based to latency isn't much of a problem, but collisions look either goofy because of interpolation or choppy when I use network transform. I am using normal physics rn but its not deterministic so the server sync is really visible which I don't really want
Using Netcode for GameObjects

sharp axle
wind mantle
#

Yea but the syncing looks quite choppy, and collisions look unrealistic with interpolation. Is there a way to extrapolate or something to make it smoother?

sand talon
#

why can't i network this?
OrdnanceType Is an enum

sharp axle
vague coral
#

Is there a way to have a player ping a server for some simple information and to validate that its online? I'm working on a current setup for it but it involves a player joining the server, sending, recieving RPC, and then getting kicked once done. Feels ineffecient

ripe yarrow
#

am i unable to use it with new vertions of unity?

sharp axle
# ripe yarrow

That's the version I'm on. But I haven't loaded the tools sample before

sharp axle
vague coral
#

I'm not gonna be using Multiplay, servers will be run through the Relay service

ripe yarrow
sharp axle
vague coral
#

Welp guess forcing players to connect is the only option then

burnt tiger
#

I'm starting out with Netcode for game objects and trying to get the camera to follow the their own player.
So im doing GetComponent<CinemachineVirtualCamera>().Follow = NetworkManager.Singleton.SpawnManager.GetLocalPlayerObject().transform
However GetLocalPlayerObject() appears to be null on the client - even though it has spawned in a player
I've also tried NetworkManager.Singleton.LocalClient.PlayerObject wit hthe same result

shrewd junco
burnt tiger
#

Currently my camera is apart of the scene, that would mean moving it into the prefab right?

shrewd junco
#

I have mine currently like that, but otherwise u could try just having a script setup the cinemachine references on start
like

if(isOwner)
  // setup reference

not really sure if this has any downsides, but really 1 camera for each player shouldnt have a difference in performance. Its not like they are networked or will lag anything since they are disabled

burnt tiger
#

Yeah it makes sense, I think I did try something like that but had an issue with Ownership, let me try again

#

Oh no that's just working fine now haha just made a script with the 1 line private void Start() => this.gameObject.SetActive(IsOwner);

sharp axle
#

Either Photon Fusion or Netcode for Entities

unkempt thunder
vagrant garden
unkempt thunder
#

@vagrant garden https://github.com/blizzless/blizzless-diiis/blob/5e404e774650ddfe1a04c8be9b65125dfc1c6f4c/src/DiIiS-NA/D3-GameServer/ClientSystem/Base/AsyncAcceptor.cs#L27

vagrant garden
#

Yes this is for connection management and for the tls streams. But for the gameplay it uses raw udp sockets.

lyric bay
#

Hey, I'm planning to try building a multiplayer game. Haven't touched multiplayer before. For now I am planning to use Unity's Netcode.
I've a question regarding that.
A contextual summary before;
My game, in essence, will be a multiplayer car game, something similar to Forza. The player will join a kinda open map and just drive around, and challenge other online players to race if they meet in the map.
I'm thinking around the lines of having a server build (haven't done this before either) that will handle all the location updating of the online players and the players will by default connect to this server when they press play, and will spawn in.
For controlling the cars, I'm planning to use RCC (Realistic Car Controller) controller (by BoneCracker Games).

I've a spare laptop that I can probably install this server build on and it will act as the server.

Now my question is what things do I need to consider (just on the connection side) or what should I know before I can implement such server that will do what is mentioned above?
And will the RCC work with Netcode and the mentioned setup? or will I have to implement my own controller?

spring crane
lyric bay
#

Alright, I'll look into that as well

wind mantle
#

I asked how I'd sync a physics based game properly yesterday, but I think I need more help. This message is quite long but it has a detailed description of how the game works
The game is turn-based, the players apply force to coins in order to knock them off the area. The client selects the amount of force to be applied and sends it to the server which handles the physics calculations
I already set up some sort of a client prediction system, but Im not exactly happy with it, here's basically how it works

-The player selects the amount of force to be applied
-The client sends this force value to the server
-The server receives the force and performs physics calculations, using the Rigidbody2D.AddForce(force) method
-The server then sends the force value to all clients, and each client independently performs their own physics calculations using the same Rigidbody2D.AddForce(force) method
-Once all calculations are completed and the turn is over, the server sends the current state of the game to all clients
-The clients sync their game state with the one received from the server

This works, but there is a major problem. The syncing is very visible, as I tween to the server's state. This is mostly fine, but in some cases, the client's calculations may say a coin has fallen off, but the server's calculations are slightly different, and the coin is actually still in the game. The player has just watched the coin they attacked fall of the map. Then the server syncs, and bam the coin is back. This'd make them feel cheated.
Code: https://pastebin.com/aLdUMfHu
Any suggestions?

gray sage
#

quick question about NGO, i have initialized a vector2 network variable (default value = vector.zero, read perms = everyone, write perms = owner), now i'm trying to modify the X value only of this vector2 but its not allowing me as its sayign that vector2.Value.x is not a variable, is there something i am missing in the inizialization or do i have to create another temporary vector2 and then assign it entirely to the network vector2?

wind mantle
gray sage
#

🤔 i see, i'll try it

#

oh yeah that seems to be working, thank you 😄

wind mantle
#

no prob :)

#

You can use the same thing for transform.position

split hedge
#

Hey I'm trying to restock weapons, where if a player picks 1 up, it'll wait a second and spawn it right there where it was. But I'm doing this in multiplayer, and I despawn it whenever the player picks it up, so the weaponToRestock is null. But why?

teal loom
teal loom
#

I'll check this out. Thank you!

oblique sandal
#

Hey I'm a beginner to NGO! Any idea why my my movement feels sluggish

#

I use character controller to move

#

if I tap the keyboard, it feels responsive, but if I hold it for abit, it stops after a while

#

oh my bad

#

that had to do with input.getaxis

sand talon
#

can i network an enum like this?

sand talon
wintry bridge
#

Hello!

I am working on a simple multiplayer game with Unity Netcode for Gameobjects but I'm having a issue where the NetworkList playerDataNetworkList is not updating on the client.

This is the start of the class that contains the NetworkList (Called PlayerDataManager)

//Singleton
    public static PlayerDataManager Instance { get; private set; }

    //Network Lists
    public NetworkList<PlayerData> playerDataNetworkList;

    //Events
    public event EventHandler OnPlayerDataNetworkListChanged;

    private void Awake()
    {
        //Initialize Network Lists
        playerDataNetworkList = new NetworkList<PlayerData>();

        //Singleton
        Instance = this;
        DontDestroyOnLoad(this);

        playerDataNetworkList.OnListChanged += PlayerDataListChanged;
    }

    [ServerRpc(RequireOwnership = false)]
    public void SetPlayerPieceId_ServerRpc(int pieceId, ServerRpcParams serverRPCParams)
    {
        if (!IsPieceIdFree(pieceId)) return; //IsPieceIdFree is just a function that checks if the requested piece has been taken

        Debug.Log($"Set Piece ID. Sender: {serverRPCParams.Receive.SenderClientId}");

        int playerDataIndex = GetPlayerDataIndexFromClientId(serverRPCParams.Receive.SenderClientId);

        PlayerData data = playerDataNetworkList[playerDataIndex];
        data.pieceId = pieceId;
        playerDataNetworkList[playerDataIndex] = data;
    }

And this is the PlayerData struct

using System;
using System.Collections;
using System.Collections.Generic;
using Unity.Collections;
using Unity.Netcode;
using UnityEngine;

public struct PlayerData : INetworkSerializable, IEquatable<PlayerData>
{
    public ulong clientId;
    public FixedString128Bytes username;
    public int pieceId;

    public bool Equals(PlayerData other)
    {
        return clientId == other.clientId && pieceId == other.pieceId && username == other.username;
    }

    public void NetworkSerialize<T>(BufferSerializer<T> serializer) where T : IReaderWriter
    {
        serializer.SerializeValue(ref clientId);
        serializer.SerializeValue(ref username);
        serializer.SerializeValue(ref clientId);
    }
}

I've tried different things but when updating the list on the server it doesn't sync with the client.

There's also this function that both runs on the client and on the server.

public void LogData()
{
    foreach (PlayerData d in playerDataNetworkList)
    {
        Debug.Log($"ID: {d.clientId} - Piece: {d.pieceId}");
    }
}

The Debug.Log() on the server is different from the one on the client, something that should not happen with network lists.

sharp axle
wintry bridge
wintry bridge
#

Indeed, I do not have 2 singletons

burnt tiger
#

I'm using NGO and getting these errors
And im not sure how to hunt down what's causing it, any advise on how to debug this?

grand merlin
#

Hi everyone

#

Is anyone using Photon Fusion with Unity please? We have to use it on a project in class and I have to implement a turn based system that replicates and synchronise to multiplayer

#

But Photon's doc on Fusion is terrible for now and I'm completely lost

sharp axle
grand merlin
#

Can't find it

#

It seems like there's no official photon discord for now

vagrant garden
shy zephyr
#

I'm new here and I was wondering what do i need to know/learn for programming a multiplayer game

wintry bridge
shy zephyr
#

I'm only familiar with the user interface

earnest ice
teal loom
#

Has anyone ran into issues where it seems like the NetworkStreamDriver isn't processing messages unless the game is focused? I have a build for my server and client and the connection doesn't even complete successfully unless I switch between both .exes

vagrant garden
long totem
#

Hello, how can I use SetActive in Photon, to hide an object for both players? I tried this way but it gives an error:

GameObject nesne = liste[0];
PhotonView photonView = GetComponent<PhotonView>();
photonView.RPC("gizle", RpcTarget.AllBuffered, nesne)

[PunRPC]
    void gizle(GameObject nesne)
    {
        nesne.SetActive(false);
    }```

The error:
``Exception: Write failed. Custom type not found: UnityEngine.GameObject``
sand talon
#

You are sending a custom class as an argument. you can`t do that.

#

You could try determining the object thru other means.

long totem
sand talon
#

well, give me some context. what is the object you are trying to toggle used for?

long totem
#

It's an image in Canvas.

sand talon
#

aha

#

then you could attach a script to that image and a photon view and via an RPC call you could simply toggle this.gameObject

long totem
shy zephyr
sand talon
sand talon
#

No problem!

vague coral
sharp axle
heavy swan
#

Howdy folks! I'm working on an online-synced projectile, and I have some questions. My script currently instantiates a prefab with a script that tells the projectile what to do. It then assigns a field in that script to a ScriptableObject which has the information on that specific projectile type (eg. movement speed and damage). I currently have two ideas:

  1. Use a ServerRpc to spawn the projectile online, then somehow send an ID of the ScriptableObject to the client-side projectile. Then, simulate both projectiles seperately with server-authoritative checks to make sure the transform is correct.

  2. Use a ServerRpc and a ClientRpc to instantiate the projectile on all sides. Instead of sending over the ID of the ScriptableObject give the hotbar slot that the projectile was from. Then, simulate them on all sides, again using server-authoritative checks to make sure the transform is correct.

If I made any of this confusing or unclear, feel free to ask me to clarify anything.

vague coral
sharp axle
heavy swan
#

Great, thank you very much!

sharp axle
heavy swan
#

I may consider that, but I'll probably go with 1 so I can have the projectiles better synced.

winter cobalt
#

Guys when it comes to multiplayer games, especially ones with massive player counts like 64 v 64 matches, what stresses the server to the max?
Like for instance is it voip, or guns with projectile based bullets?

sharp axle
winter cobalt
sharp axle
winter cobalt
sharp axle
#

Your packet size and rate also comes into play. The different frameworks have a Maximum Transfer Unit(MTU) where they will send data in multiple fragments. Sending lots of large data will fill up the queue and things will begin to lag

sharp axle
faint cedar
#

Hello. In my game I have network objects that move until they reach a certain point then teleport back to a previous point. This works for the host but for clients the network objects fly across the screen instead of going there instantly. (using network transforms) How can I fix this?

sharp axle
faint cedar
#

Turning off interpolation worked. Thank you!

hardy quarry
#

Hello, does Unity have a specific owner client ID value to represent a null ID? I couldnt find one in the docs.

public NetworkVariable<ulong> CurrentInteractorClientID = new NetworkVariable<ulong>();

I have something like this to keep track of the client that is holding an object, but when its not holding anything, I am not sure what to set this value to. I couldnt find anything in the docs, so I am curious if you all have an answer

Im considering just using the max value for ulong but I dont know if unity has a specific recommendation

subtle depot
#

my particlesystem is displaying another one slightly lower on the other end

#

for both the client anf host

#

maybe shows for host more often

vital portal
#

Has anyone tried Multiplayer Play Mode? On two different projects, the player 2 window simply freezes up on me
https://docs-multiplayer.unity3d.com/tools/current/mppm/index.html

Multiplayer Play Mode (MPPM) enables you to test multiplayer functionality without leaving the Unity Editor. You can simulate up to four Players (the Main Editor Player plus three Virtual Players) simultaneously on the same development device while using the same source assets on disk. You can leverage MPPM to create multiplayer development work...

sharp axle
sharp axle
hardy quarry
vital portal
lavish breach
#

so I'm making a 3d multiplayer game, I want each player to have they're individual camera, I'm having this issue when player 1 joins, everything works just fine but when player 2 joins, player 1's view switches to player 2's view, is there any way to fix this issue?

lavish breach
#

i am using photon pun 2

sharp axle
sharp axle
long totem
#

Hello, I got this error in Unity Photon. What should i do?
Exception: Write failed. Custom type not found: System.Collections.Generic.List`1[System.Int32]

Code:

GetComponent<PhotonView>().RPC("setImages", RpcTarget.AllBuffered, IDlist);

[PunRPC]
void setImages(List<int> IDlist)
{
    for (int i = 0; i < IDlist.Count; i++)
    {
        cards[i].sprite = images[IDlist[i]];
    }
}```
sharp axle
long totem
#

Then how can I send this list alternatively

sharp axle
balmy sierra
#

it works for the host but not for client [the client calls the debug for "Server RPC Used" but none of the others]

#

the interaction works and is synced too its just that the non host client is unable to interact (but it calls the ServerRPC and gets the debug for Server RPC Used)

#

ive been debugging figured out problem i think but any advice anyway always welcome

woven cliff
#

how do i get the Player object from the client ID that owns it?

spring crane
woven cliff
#

network for game object

spring crane
woven cliff
#

ty

sharp axle
lapis mulch
#

Hello, I wanted to achieve it myself at all costs, but for several days I can't find a solution.
I am loading a Core scene at the start of the game, which includes Network Manager and other Managers. Then I load async the levels to have the game world scenes separated from the core part. I want to spawn the players only from the Core scene, but only when a async of the game scene is completed. How can I achieve this? I am a little bit confused after switching to NetCode and maybe I understand something wrong. Could someone shortly explain it or send maybe some manual of such thing?

sharp axle
# lapis mulch Hello, I wanted to achieve it myself at all costs, but for several days I can't ...

You would use LoadEventComplete scene event to know when all the clients have loaded the main scene and then you can spawn your players
https://docs-multiplayer.unity3d.com/netcode/current/basics/scenemanagement/scene-events/#tracking-event-notifications-onsceneevent

If you haven't already read the Using NetworkSceneManager section, it's highly recommended to do so before proceeding.

lapis mulch
#

@sharp axle omg, thank you, look promising

balmy vault
#

Is this the most appropriate channel to ask questions around Game Server Hosting implementation trouble shooting?

balmy vault
#

Appreciate it.

balmy sierra
true panther
#

Does someone has been working on a game and has been using Steam Inventory using Steamwprks.NET? (please reply with ping)

zenith copper
#

Anyone here used braincloud? Trying to decide between braincloud or netcode for gameobjects + UGS for an online turn based strategy game

#

I’m open to other suggestions as well, some detail about my game: turn based, up to 8ppl per match, will want to implement in game text chat, leaderboards, matchmaking

grave sable
grave sable
#

seems unlikely?

#

mine works on desktop, and in editor, but doesn't on android

#

would you recommend anything a bit more mainstream as a replacement library? I'm thinking of using Unitys new transport, but wonder if it'll have any performance issues

#

going to debug this a bit more next few days, have you ever used it on an android device? It would help to know its something i've gotten wrong

graceful zephyr
graceful zephyr
vagrant garden
weak plinth
#

hey is there anybody whos using Mirror networking? Can anybody help me with connecting to a host via internet? FAQ doesnt really tell anything at least i dont see anything

untold meteor
#

Is there a way to get a callback or overwrite a methode when a player gets spawned with the prefab?
I want to add the player transform to my camera target list.
Any clue?

untold meteor
weak plinth
#

Hey guys I'm planning to start making a Multiplayer game and wanted to know if unitys new Netcode is in a good enough place to learn/impliment it or if I should go with a 3rd party like mirror?

vagrant garden
#

Depends on the kind of game. Currently the Unity netcode (Netcode for GameObjects) is targeted at games that fall more on the smaller scale / co-op type games.

weak plinth
#

The closest game to what I'm making is "Project Zomboid". By scale I assume you mean connections, so I'd say probably say up to like 8 players tbh.

So in that case it's fine?

vagrant garden
#

You can probably make something like that in Netcode for GameObjects, whether it's ideal, is another question. Most multiplayer solutions should be able to handle that so it's a matter of preference.

weak plinth
#

Okay thanks Lukesta 🙂 I just didn't want to get through my project to witness anything essential not being in the package yet

untold meteor
weak plinth
#

That's good to know, thank you!

untold meteor
ripe yarrow
#

Instead of

if(isClient)Debug.log("client");
if(isHost)Debug.log("Host");
if(isServer)Debug.log("Server");

is there a
Debug.Log(network.typeThing);
?

white igloo
#
using System.Collections;
using System.Collections.Generic;
using UnityEngine;
using UnityEngine.UI;
using Photon.Pun;
using TMPro;

public class CreateAndJoinRooms : MonoBehaviourPunCallbacks
{
    public InputField createInput;
    public InputField joinInput;
    public TMP_InputFieldcreateInput; 
    
    public void CreateRoom()
    {
        PhotonNetwork.CreateRoom(createInput.text);
    }

    public void JoinRoom()
    {
        PhotonNetwork.JoinRoom(joinInput.text);
    }

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

whats wrong here? i want to use TMP for the lobby

spring crane
spring crane
#

Doesn't it come with some in the PUN folder?

white igloo
#

idk where they are

spring crane
#

Have you looked? 😄

white igloo
#

oohhh u mean those?

spring crane
#

Somewhere in the Photon folder most likely, but probably not in PhotonChat

white igloo
#

you know what its called?

#

the code

spring crane
white igloo
#

im new in this so sry. idk which i should use for lobby and loading scene

spring crane
#

Look at them to see if they look like they have the functionality you need. There should be scenes in there that you can open and play

#

If you feel completely lost, I would recommend doing a few more singleplayer projects before adding all this complexity.

white igloo
spring crane
#

Sure, just don't aim into a wall 😄

white igloo
#

@spring cranebut is this code even bad? cant i just use that?

spring crane
#

Looks reasonable, but I don't remember the details. There is some quite similar code in the examples for a reference.

#

Should share some more details of what is happening. Odds are PUN is giving some sort of feedback in the console assuming the methods you posted run at some point

stuck hinge
#

Good day, Multiplayer Floating Origin. Anyone have experience or willing to discuss ?

serene turret
#

Hi, I'm currently working on a two-player football game (players switch roles trying to score, whoever has most points wins), and I have this issue where it seems to duplicate the room host on start-up rather than actually adding a new player. Anyone got any idea what the issue could be (I have very little experience with networking)?

weak plinth
serene flicker
#

Hi, when using a client authoritative solution (with netcode for gameobjects) and using the default position threshold (0.001), movements from either two players (host or client) sometimes cause the displayed position to be incorrect for the other one. usually this is very noticeable and is a large difference in position. Setting it to 0 fixes it but that doesn't seem efficient. Should I instead use server authoritative or is there a possible solution?

latent valve
#

help! NetworkManager.Singleton.StartHost(); does not work and this error is being shown. What should i do?

silent vault
#

Hi. I am starting a new project with a friend and we want to go for online play this time. We would like to do it as "real" as possible and instead of directly connecting like our projects have done so far, create a server version that we can connect to and handle the logic on. If we create that to run on one of our computers at first, how hard is it to later transition to something like playfab as hosting for it?

lone needle
#

So, I've got a toggleable light on a player prefab, but when I toggle the light on and off it doesn't sync that to server or other clients. Looking for how I can fix this.

sharp axle
latent valve
sharp axle
silent vault
sharp axle
sharp axle
scarlet marlin
#

I'm going through the multiplayer networking tutorial, works great, but I've noticed one problem: When I use command line to spawn instances of the app to test with, audio is completely off. Any reason why this might be and how to fix it?

#

Works fine if I just execute the app normally or hit Run in the editor, this seems specific to launching via command line

median gale
#

Hello,
I'm using Photon PUN to make a multiplayer game.
I am using objectpooling to spawn the enemies and explosions that occurs on the enemies when get hit.
The enemies and explosions have PhotonView component and PhotonTransformViewClassic component with Synchronize Position enabled.
The master is working flawlessly. However the client could not get the list from the pool. When I place a breakpoint, it says the list is 0.
How can I make sure the object pool list is carried across? Or should I be approaching this in a different way?
The error I get is "ArgumentOutOfRangeException: Index was out of range. Must be non-negative and less than the size of the collection." which makes sense because the list is 0
See image for code

burnt tiger
#

I've made the basics of a networked 2d sidescroller using NGO but struggling to deal with the latency.

  1. I initially started doing it server authoritative, but even running locally it was laggy, turning the Physics Fixed Timestep down, along with turning the Network Manager tickrate up helped but I feel like it was masking the problem, any real scenario would have higher latency
  2. Client side physics calcs for your own character, broadcasting positions - using ClientNetworkTransform, however the player often ends up hovering just a tiny amount. If it wasn't for the hover desync this would probably be fine.
  3. Client side physics calcs for your own character, broadcasting inputs but the desync was too strong here
    I feel like having some sort of "action queue" might help, since i noticed in 1. and 2. that a jump would sometimes be missed, meaning that the frame jump frame never got send. But I'm struggling to find good tutorials on this.

Any advise on how to make it smooth and without desync?

woven cliff
#

in netcode for gameobject who can despawn network objects?

vagrant garden
#

the server/host

stiff ridge
#

In best case, you build a pool implementation for the built-in IPunPrefabPool and make PUN use it. Then you don't have to worry about the PhotonView setup and simply continue using the PN.Instantiate.

ripe yarrow
#

My custome player spawn system seams to be working but

#

Is there a way to let the network manager know i am using my own GameManager player prefab system?

sharp axle
ripe yarrow
lone needle
ripe yarrow
sharp axle
ripe yarrow
#

Thanks @sharp axle i think it worked i just need to get the player to controll its own play or sawn it so the player that spawns there player controlls there player

#

am i suposed to use use LocalClientId?
NetPlayerPrefabClone.GetComponent<NetworkObject>().SpawnAsPlayerObject(networkManager.LocalClientId);

#

I dont feel like i'm doing this right.

royal lava
#

HELP GETTING RAYCAST TO HIT UI ELEMENTS

ripe yarrow
#

nope didnt work

ripe yarrow
sharp axle
ripe yarrow
sharp axle
#

right that makes sure the default params will always get sent without you having to constantly create new ServerRpcParams