#archived-networking

1 messages · Page 34 of 1

patent bronze
#

this is only in the scene, the game looks normal

#

is there any way to deactivate this?

tepid bane
#

How much work is it to convert SP game into MP with NGO? Should I start with MP right away?

sharp axle
#

This is part of the Multiplayer Tools. You an find it under Windows -> Multiplayer -> Multiplayer Tools

twilit ingot
#

Hello all. Using NGO, What's the proper way of handling the GameObject with the Network Manager Component on it?

It lives on the start menu and I guess internally it is already set for DDOL. But every time moving back to Start menu, it spawns a duplicate.

tame slate
twilit ingot
tame slate
sharp axle
twilit ingot
zealous violet
#

Does Firebase Analytics events show up immediately after being called or they take time?
Like this one

EventCall("ABC Game " + Levels.ToString());

void EventCall(string eventToCall)
{
try
{
FirebaseAnalytics.LogEvent(eventToCall);
}
catch (Exception e)
{
print(e.ToString());
}
}

bright coral
vague niche
willow jackal
#

Another question about distributed auth and NGO with WebGL.

I have this function that runs fine on the MacOS or PC. But when I build for WebGL it does not.

Basically the Debug.Log($"ServicesHelper: Before CreateOrJoin"); Gets printed but the Debug.Log($"ServicesHelper: After CreateOrJoin - Success"); Never does. and also none of the catch messages. And the code never gets to Debug.Log($"ServicesHelper: Session created/joined successfully. Players: {m_CurrentSession.Players.Count}");.

async Task ConnectThroughLiveService(string sessionName)
    {
        Debug.Log("ServicesHelper: ConnectThroughLiveService - Starting");
        
        try 
        {
            var options = new SessionOptions()
            {
                Name = sessionName,
                MaxPlayers = 4,
                IsPrivate = false,
            }.WithDistributedAuthorityNetwork();

            Debug.Log($"ServicesHelper: Before CreateOrJoin");
            
            // Specific try-catch for the CreateOrJoin operation
            try 
            {
                m_CurrentSession = await MultiplayerService.Instance.CreateOrJoinSessionAsync(sessionName, options);
                Debug.Log($"ServicesHelper: After CreateOrJoin - Success");
            }
            catch (Exception createJoinEx)
            {
                Debug.LogError($"ServicesHelper: CreateOrJoin specific error: {createJoinEx.Message}");
                Debug.LogError($"ServicesHelper: CreateOrJoin stack trace: {createJoinEx.StackTrace}");
                
                // Also log the status of MultiplayerService
                Debug.LogError("ServicesHelper: MultiplayerService connection failed");
                Debug.LogError($"ServicesHelper: Is Authentication signed in: {AuthenticationService.Instance?.IsSignedIn}");
                throw;
            }
            
            Debug.Log($"ServicesHelper: Session created/joined successfully. Players: {m_CurrentSession.Players.Count}");
            
            m_CurrentSession.RemovedFromSession += RemovedFromSession;
            m_CurrentSession.StateChanged += CurrentSessionOnStateChanged;
        }
        catch (Exception e)
        {
            Debug.LogError($"ServicesHelper: Failed to connect: {e.Message}");
            Debug.LogError($"ServicesHelper: Stack trace: {e.StackTrace}");
            throw;
        }
    }
weak plinth
#

Does anyone know a good system and tutorial for p2p networking

#

(Im using p2p because I can't afford to host a server for connection)

sweet siren
#

But Unity has another service called Lobby you could pair with NetCode for GameObjects which would let players host lobbies (duh) and you can tell the lobby to swap hosts and then you could manage connecting to the new host yourself (lobby is INCREDIBLY cheap and it would take tens of thousands of players constantly joining and leaving lobbies to even cost you less than $1)

weak plinth
#

That could work yes. I could have a warning before the host leaves to tell them if they disconnect it will end everyones game, and have a system for if a host consistantly leaves when hosting then they are banned from hosting the games

sweet siren
weak plinth
#

Yeah ive seen that channel. Thanks for the help

sweet siren
#

No worries good luck!

weak plinth
#

Cheers

tidal trail
#

How to get PrefabInstance in client this code?

#

i using netcode for GameObjects

sharp axle
tidal trail
#

how to use that function

tidal trail
#

result is here

tame slate
#

If you want the OwnerClientId of the PlayerObject through OnNetworkSpawn, you would use OnNetworkSpawn on a script on the player object itself - not in PlayerSpawn which I assume is an in-scene NetworkObject

sharp axle
low saddle
#

Anyone using Photon Fusion 2 can tell me if Mono Celi is still required? i get conflicting information on the web but the doc no longer reference it

spark terrace
#

Hello, I have a question about Unity6's Multiplayer play mode. If you do something that requires scene loading in a newly opened virtual scene, Build Profile will tell you to set the scene or many game objects will be missing. Is it a bug? Is there a way to fix it yet?

Based on 1.4.0-pre.1, the latest version of multiplayer mode, clicking the original Unity Editor during SceneLoad of the virtual scene causes the Build Profile to specify a scene.

sharp axle
spark terrace
static dust
#

can i get photon help here..?

sharp axle
weak plinth
#

Im not sure what IP to do here if I want it to work anywhere

#

for example someone from USA and UK connecting to host in Germany

sharp axle
weak plinth
#

ah

#

Im still a bit confused

#

what do I change for this?

#

im using netcode

tame slate
weak plinth
#

ok, but Im still not sure what to do with it. since I set that thing up but do I change the protocol type or what?

#

im new so please be patient

dry halo
#

Hello, I'm trying to use WebRTC in Unity I'm not sure whats happening but I can only receive one frame and then I don't receive anything else

#

I was wondering if anyone had a similar issue?

#

If I receive the video stream on my browser I'm able to see the entire video stream

rough lion
#

Hi ! I am using the Unity Relay Service and I am trying to also implement a LAN solution for my game, but for that I need to change the Protocol Type in the Unity Transport component of the NetworkMaganer from "Unity Transport" to "Relay Unity Transport", and vice-versa. I know you can change dynamicly to "Unity Transport" by changing the SetConnectionData (like stated in this post : https://discussions.unity.com/t/how-to-set-protocol-type/924171/2), but is it possible to do the opposite and change to "Relay Unity Transport" ?

plain zenith
#

Hey guys I’m trying to figure out how to setup my first person shooting mechanics in a multiplayer setting. I’m wondering how to make the pov from a second player accurate to what the first player sees on their first person rendered pov. (Making the player model and first person model accurate to eachother). And how I can hide a players own model from their own pov, while also being able to see other player’s player models. I’ve run into a problem where the player models are all on one layer that the first person camera blocks through culling mask.

#

I’m also curious of how to create a first person pov haha, making the full player model took me a lot of time on its own, and trying to replicate the arms, and then any equipment on the arms during runtime might be kindof difficult

sharp axle
plain zenith
sharp axle
plain zenith
#

I will have to Create two seperate animations for every single weapon AHHH

#

And I’ll have to learn how to actually make a first person pov with the arms and legs lol

sharp axle
rough lion
sharp axle
sharp axle
floral jay
dire sorrel
# plain zenith Hey guys I’m trying to figure out how to setup my first person shooting mechanic...

Some first person shooters like Apex Legends don’t have body parts other than arms and hands. They have no torso, legs, or feet or head. You could have a completely invisible body that casts a shadow on the ground and then add arms and hands in front of a second camera that is rendered over the main camera view. Halo does it, it looks strange when you get up against a wall, but the hands never clip into the wall- you always see them.

#

Halo has feet but it’s a real effort to position the camera to look down, see the feet, but not have the torso in the way.

#

Halo’s camera is not at the eyes. And you don’t want them attached to the body. You want the camera attached to the capsule.

plain zenith
plain zenith
# sharp axle In OnNetworkSpawn(), check for isLocalPlayer then set it's gameObject.layer
    private void OnNetworkInstantiate(){
        if (IsClient){
            GameObject playerModelObject = gameObject.transform.Find("PlayerModel").gameObject;
            searchTree(playerModelObject);
        }
    }

    // Recursive method used to search through child objects.
    private void searchTree(GameObject node){
        int i = 0;
        while (node != null){
            node.layer = 6;
            node = node.transform.GetChild(i).gameObject;
            searchTree(node);
            i++;
        }
    }``` My attempt at what you said, not working for osm reason, maybe because im starting the game as a host?
tame slate
plain zenith
#

Im using netcode for gameobjects, and joining by selecting start host

#

does OnNetworkInstantiate() go after start or update or something? Im not sure if that would affect it being executed or not?

tame slate
#

public override void OnNetworkSpawn() { }

plain zenith
# tame slate It's OnNetworkSpawn()
        int i = 0;
        while (node != null){
            Debug.Log(node.name);
            node.layer = 6;
            node = node.transform.GetChild(i).gameObject;
            i++;
            searchTree(node);
        }
    } ``` apparently an empty GetChild() doesnt return a null?
tame slate
plain zenith
#

ah I see, its an array not a list

#

thankyou, and that override keyword made that function work, I appreciate it man!

tame slate
plain zenith
#

well if it was a list, the next spot reserved for another object would be null, if it was empty

#

wheres in an array its out of bounds error

tame slate
faint idol
#

Hi friends, I am trying to make a multiplayer game but there are always two players controlling each player I want to make something different like there is only one reward wheel I want it to be controlled by both players turn by turn. For example, first player A turns the wheel, and player B just sees and then player B spins the wheel, and player A sees.

sharp axle
faint idol
#

@sharp axle how can i do this phone pun2

sharp axle
faint idol
#

oh no i want it to make multiplayer this same screen shows on both players deveice but at a time only one player can spin the wheen

flat vector
#

Any suggestions on best tutorial video on websockets.

sharp axle
flat vector
dusk shard
#

I feel like am missing something obvious, but I'm going through the Boss Room sample project learning about relay/lobby, but I keep running into issues in my own project with errors about classes and methods existing in two packages like The type 'Allocation' exists in both 'Unity.Services.Multiplayer, Version=0.0.0.0, Culture=neutral, PublicKeyToken=null' and 'Unity.Services.Relay, Version=0.0.0.0, Culture=neutral, PublicKeyToken=null' but I see both of these packages in the Boss Room project as well without any issue. Does anyone have any idea what the difference could be I could look into?

I've also tried just removing the Relay package to see if that fixes it, but then other errors show up that need that package, so I am currently stuck.

#

Same thing happens with Multiplayer and the Lobby packages, even though that one is also used in the sample project.

dusk shard
#

I managed to use the upgrade guide to get these issues fixed, but I am still curious why this isn't necessary in the sample if anyone knows.

sharp axle
wooden lagoon
#

Hi guys i been creating a unit combat system like this. When trigger the attack behaviour will start by create a collider to check all the unit in side, and then search for valid target, it will then call a function from the target health behaviour script to reduce the amount of attack token, if the attack token is > 0 then it will sync the target to client and network, subscribe it change target function to target death event, then move to target, then after reached the destination, it will start attacking it's target. And if the target died, it will trigger the event to change the target. The problem is when changing the target, sometime it got a very weird interaction that will prevent the attacker to regain attack token if it's being targeted by another unit. I know it's a very complicated thing to describe, but i hope to get some help from u guys. TY ! catto

#

I've been trying to fix it for week, but sadly still cant understand what's causing the problem

sharp axle
wooden lagoon
dusk shard
sharp axle
#

Widgets do currently lack customization but I hear that is coming

dusk shard
sharp axle
dusk shard
# sharp axle If you are on Unity 6, the Multiplayer Center has a Quickstart section with some...

I feel it was too easy to be led down an old deprecated path, especially with the multiplayer sdk essentially swallowing relay and lobby. I agree that the Boss Room prroject was surprisingly high grade for a sample and certainly didn't expect to see dependency injection lol, but I was able to tear through it to understand it and at least had something to work against. Maybe that will serve me well as I change approaches yet again lol

ocean wadi
#

Hi! So I am still pretty new to networking and ran into some issues regarding certain networking methods in Fishnet running twice on the host player as the server and client side is being handled by the same game instance.

I was recommended to separate out the server and client. I had some questions about this.

What are your thoughts on this method?

This would still be peer-to-peer right as the server is still on one of the client's computers (I wouldn't need a dedicated server when eventually shipping the game)?

Additionally, when testing this I would need to create an additional game instance to act as the server, how would this work in a shipped game where you would only be able to run one instance of the game?

sharp axle
ocean wadi
sharp axle
ocean wadi
junior sapphire
#

Hi I've noticed some peculiar behaviour with my remote Linux NGO game server instances (using secure websockets). I generally start up 3-4 game servers with NetworkManager.StartServer() so that clients have something they can quickly connect to.

If these server instances have been running for an extended period (a couple hours or so) without any client connections, they seem to go "stale" and a connecting client will be disconnected immediately after connecting with the following TLS error on the server.

\Failed to decrypt packet (error: 1048580). Likely internal TLS failure. Closing connection.```
Does anyone know what might be the cause of this? The work around I have is to automatically restart inactive servers every 10min or so but I'd like to know more about what is causing the failure if anyone has experienced something similar?
dusty girder
#

I'm trying to follow the tutorial for multiplay, and when i get to the deployment step, it fails on fleet, and I can't seem to get past it. Don't see any kind of useful error, just "failed to deploy: HTTP/1.1 400 Bad Request"

#

I'm using the "Small Scale Competitive Multiplayer" sample project's tutorial

sharp axle
dusty girder
compact shuttle
#

It doesn't mention anywhere as far as I'm aware what the difference is

tame slate
# compact shuttle What is the difference between Anticipation and Prediction? Specifically <https:...

https://docs-multiplayer.unity3d.com/netcode/current/advanced-topics/client-anticipation/

Netcode for GameObjects doesn't support full client-side prediction and reconciliation, but it does support client anticipation: a simplified model that lacks the full rollback-and-replay prediction loop, but still provides a mechanism for anticipating the server result of an action and then correcting if you anticipated incorrectly.

Client anticipation is only relevant for games using a client-server topology.

#

A bit better explained here

compact shuttle
#

Ah, thank you! cheers

tight rapids
sharp axle
sand ginkgo
#

@sharp axle @ornate zinc @opal dust @noble spindle @tame slate I'm looking into using WebRTC in Unity and saw that you posted or answered around messages for WebRTC recently. Did you get those solutions running or continue those messages threads anywhere?

#

I'm aiming to use WebRTC with a Quest 3 build and the OpenAI Realtime API so that I can mock talking to an AI assistant in realtime in VR.

#

WebRTC, Unity, Quest 3 VR: I haven't worked with WebRTC before, so I'm trying to understand the standard, available tools, and what I'll have to implement. If there's some response on this, I can also share openly here in case that helps anyone looking in the future.

sharp axle
sand ginkgo
#

Ah apologies if that was a nuisance. I gave it a shot since it seemed like a lot of unclosed threads.

#

And thanks for the response. Have you used that WebRTC package with success? Do you happen to know of any Android limitations? I ask because some quick research shows that people seem to say it's hard to work with.

#

Of course that might just be development errors too and not the package itself.

sand ginkgo
#

I haven't worked with WebRTC before, so

#

Apologies for extra channel spam. I just created a thread I'll add to for anyone that's looking in the future. Accidentally threaded the wrong message at first though - sorry all if that pinged you a ton!

prisma thistle
#

Hello everyone! I'm currently trying out the unity vr multiplayer template but encountered an issue. In their setup, one player acts as a host and the other players that join act as clients. All physics interactables are setup to have a Client Network Transform Component. However, the host can't move the objects, they just stay in place (The client can, though, and it also gets synchronized).
There was also a question about this on the forum here https://discussions.unity.com/t/host-cant-move-objects-in-base-vr-multiplayer-template/1571622 but no one answered it.

#

From my understanding, shouldn't the host also act as a client and therefore be able to interact with the Client Network Transform Objects?

#

Also, the host seems to own the objects as well, still can't move them however

sharp axle
prisma thistle
sharp axle
prisma thistle
# sharp axle You'll need to check that the ownership is actually changing to the host. No clu...

Thanks for your quick help! I experimented some more and it seems that it works differently for objects that I create add myself. Here, the host can move it but when the client tries to move it the object snaps back to its originial position after letting go. This would add to what you said that I need to ask the host for ownership, do you know of good resources where that is described?

#

No idea why this doesn't work for their objects though, from what I can see they're using the exact same configuration🤷‍♂️

ornate zinc
livid frost
#

Hello! I've started using the networking packages on the 6000.0.30f1. Up until now, all the information I've seen including official documentation is saying to use the MultiplayPackage. Notably for hosting dedicated servers, the MultiplayService.Instance is need to access stuff like the ServerConfig and setup correctly the NetworkManager and the likes.

However, the package is marked as deprecated and although I've seen disccusions mentioning that it can be swapped, as indicated in the package manager, with the new unified Multiplayer.Services package. I fail to see how I would go about getting an equivalent to the MultiplayService.Instance.ServerConfig

livid frost
#

EDIT: My mistake, I'm using assembly references and missed the Unity.Services.Multiplayer.Multiplay

open cobalt
#

[MIRROR] Hello, I am trying to host an online webgl game on itch.io but the problem is that i cant make a websocket server i say the docs and there is nothing really usefull for me.The game as a pc game works with online. how could i make a dedicated websocket server or maybe even use AWS for websocket connection

sand ginkgo
idle sonnet
#

i'm making a chunking system for streaming world chunks, if a player edits a chunk(like adding a GameObject to it) that a client dosent have loaded how would i pass that change to new clients that load that chunk?

i assume the server will have to have all chunks loaded but will that be performant enough? i'm not really sure how the headless unity server build works

tight rapids
#

**[Multiplay] ** hello peeps, what do you guys generally exclude when creating a headless server build? Currently when running mine on Multiplay, I get about 50%+ usage with nothing but a ground plane and a skybox. When I get 2 clients to join, it goes up to 56%. I have limited the FPS to 60 because I read online about uncapped framerates running as fast as possible due to no rendering but that only took it down a notch. Any other stuff you guys exclude to bring the usage down?

ripe mesa
ornate zinc
open cobalt
sharp axle
compact shuttle
#

Is it normal to have such high CPU usage in a dedicated windows build?
It goes up to 85% if not more
Processor is 24 / 32
Unity: 6000.0.33f1

Unsure whether this is part of networking or if it's part of something else, please redirect me if I'm in the wrong category.

Edit: Ah I forgot to limit the target frame rate for the server, my apologies!

open cobalt
sharp axle
#

UTP is the Unity Transport Package

open cobalt
#

can i use it with mirror?

#

since it is based of NGO

#

oh wait you can

open cobalt
#

k thx

feral siren
#

Hi guys, does anyone know how to run animations and sync between all clients using Netcode for Entities? I'm struggling with this and haven't found anything useful yet. All the Unity examples (megacity, ecs samples, multiplayer FPS) only use objects that don't need animations (cubes, capsules and cars that only move on the x, y and z axes), I haven't seen an example showing any real animations such as running, jumping, shooting, dying, etc.

austere yacht
#

but as that example states, its kinda pointless to sync animations directly, cause they are typically irrelevant for gameplay logic

#

note that entities (if you are using that) does not (natively) support animations yet and this limitation extends to netcode projects made with entities.

sand ginkgo
sharp axle
slate fog
#

Hello, I am trying to run the following code for RelayManager

public async Task<string> StartHostWithRelay(int maxConnections = 3)
    {
        Allocation allocation;

        try
        {
            allocation = await RelayService.Instance.CreateAllocationAsync(maxConnections);
        }
        catch
        {
            Debug.LogError("Creating allocation failed");
            throw;
        }

        NetworkManager.Singleton.GetComponent<UnityTransport>().SetRelayServerData(new RelayServerData(allocation, "dtls"));

        string joinCode = await RelayService.Instance.GetJoinCodeAsync(allocation.AllocationId);

        return NetworkManager.Singleton.StartHost() ? joinCode : null;
    }

Though, StartHost() always returns a NullReferenceException. I'm new to Unity so I'm not exactly sure how to fix it.

https://pastebin.com/EkdUgYte (Error)

slate fog
#

my bad i forgot i changed yesterday

#

i was on unity 2022

#

and updated to unity 6

#

same project im working on now

#

i forgot they changed the name

#

but yeah im using multiplayer services rn

#

(I think)

#

i downloaded the multiplayer services package, but I didn't change this stuff. am i supposed to import different stuff here now in unity 6

slate fog
#

ty

slate fog
slate fog
#

i've tried that, but it doesn't work

#

and i have it installed

#

nvm reopening vscode fixed that part

#

butttttt

#

this issue where things such as this, which previously worked fine with lobbies, is happening

#

i now added Unity.Services.Multiplayer

#

but for some reason its dulled out

#

and nothing is using it

#

such as this, it isn't recognizing unity.services.multiplayer, so idk if I'm doing smth wrong

tight rapids
# slate fog

is what you're looking for Unity.Services.Multiplay?

tight rapids
#

Hello guys, currently trying to figure out how to get one of my servers to go from available to allocated. Currently everything works with the test allocation so tryna get this done through code but I've been hit with a wall.

An allocation is only returned in the api response json if a server is already allocated,
and to queue an allocation requires it's id in the api request body

so how does one acquire the allocationid in the first place

feral siren
feral siren
feral siren
feral siren
#

I'd like to hear your opinion guys, I'd like to create a game samurai warriors like (I can leave a link below for those who don't know the game) but multiplayer, about 4 - 6 players in a room, hundreds of enemies and a couple of bosses. I'm trying to use Netcode for Entities and Unity ECS for it, but I'm struggling with the animations. Do you have any other suggestions for a better Unity Network for a game like this? Maybe Mirror, Photon... I'm not using Netcode for GameObjects because Unity said it's not a good solution for competitive games and to handle several network objects.

torn lance
#

Need a bit of a sanity check on Networking for Gameobjects order of RPC calls--

I know that RPC order is not guaranteed between different network objects, but is the execution order guaranteed between different networkbehaviours on the same network object? Or is it determined by the script execution order?

sharp axle
sharp axle
sharp axle
torn lance
feral siren
sharp axle
torn lance
#

luckily very few games use animations, so it doesn't cause many problems smugibble

feral siren
slate fog
tame slate
#

If you're wanting to use the new Sessions (which encapsulates Lobby/Relay/NGO) that is under Unity.Services.Multiplayer

#

Actually that might be inaccurate - I think if you're wanting to use Lobby directly, you have to stick with the standalone Lobby Package and not have Multiplayer Services installed. If you're wanting to use Multiplayer Services, I believe your Lobby code has to be migrated to use the new Sessions.

sharp axle
slate fog
#

Then what's Using Unity.Services.Multiplayer for?

sharp axle
arctic iris
#

Hey guys i have a quick question.

Is Cloud Code necessary with Cloud Save if i want to make sure the players don't manipulate there data on Cloud Save?

rough lion
#

Hey, its probably me that messed somethig up, but for some reasons it seems like the InputField.onValueChanged.RemoveListener doesn't seem to remove the function and still gets called after the NetworkSpawn. Wich is weird because the SetPlayerColor does indeed get removed (they are added in Awake). Could someone help ? I've looked everywhere and this literally the only time SetPlayerName is used so I did not add it later by mistake

#

Really sorry if I bothered anyone, found my mistake. I added the function to the event by the editor and forgot to remove it 😅.

arctic iris
sharp axle
hollow pelican
#

I am trying to use unitywebrequest.post with the following json data:

#

"{'{ \"model\": Scarlet,\"messages\": [{\"role\": user, \"content\": who is godzilla? } ] }'}"

#

the url works, but combined with the json it returns status code 400

#

I am using local host

#
 UnityWebRequest www = UnityWebRequest.Post(url, form);
 yield return www.SendWebRequest();
        Debug.Log("Status Code: " + www.responseCode);
 if (www.isNetworkError)
        {
            Debug.LogError(string.Format("{0}: {1}", www.url, www.error));
}
 else
        {
            Debug.Log(string.Format("Response: {0}", www.downloadHandler.text));
}
}
arctic iris
tame slate
slate fog
tame slate
#

Whether or not you can access Lobby directly through the Multiplayer Services package - I don't know for sure.

But either way Lobby related code is accessed through Unity.Services.Lobbies.

tacit edge
#

Hi Guys with NGO ive sucessfully got my Client Authed Player to smoothly follow a SeverAuthed SteeringWheel Object with transform movement Using lateUpdate(I Believe this is because lateupdate contains the Interpolated transform values) Im trying make my players velocity match the velocity of the server authed object now, Im doing this by saving the Velocity on server to a networkVar and getting clients to match it, this works great for local(Singleplayer) But doesnt work very well as a client on a dedicated server, Does anyone know why? im confused as to how im able to accurately match the position of a server authed object but not the velocity.

#

This below is an visual example of the issue, Player is slowly sliding off when not using steering wheel and using velocity matching (As a client on a dedicated Server)

#

And this shows it working correctly where the player is not sliding off (On local/SinglePlayer)

sharp axle
sharp axle
arctic iris
sharp axle
#

But that is a value call that only you can make

arctic iris
#

yeah i did go through the pricing, maybe i am not understanding it right but i am hesitant.
Like what does Invocations Compute hours & Egress mean

#

I'm going to research more so i understand these in depth.

arctic iris
sharp axle
hearty hamlet
#

i have this simple serverrpc to sync player movement with the server and a networktransform on the player, but with this setup the client cannot move

#

im new to networking so i thought this would sync because the serverrpc sends the movement to the server and the networktransform distributes this data among all clients

#

here is my network transform attached to the player prefab

tame slate
#

[ServerRpc(RequireOwnership = false)]

hearty hamlet
#

i was thinking maybe its because the networktransform is also syncing to the original client

#

so the serverrpc keeps sending its original position which is sent back

tame slate
hearty hamlet
#

the serverrpc is inside Update, the player movement script is a basic one

#

im taking the position and sending it to the server

hearty hamlet
tame slate
#

i have this simple serverrpc to sync

tacit edge
#

Anyone got any experience with velocity matching a player to an object, In a multiplayer setting where player is controlled by client & Object is controlled by server?

sharp axle
tacit edge
sharp axle
potent falcon
#

hello yall ive ran into a problem with my first ever multiplayer game! i am working on the health and shooting system using photon PUN and everything is working great except that when i shoot another player his health updates but the text before stays there and my health also updates like on the picture but when i kill him my health goes back to 100 health script: ```cs
using System.Collections;
using System.Collections.Generic;
using UnityEngine;
using Photon.Pun;
using TMPro;

public class HealthManager : MonoBehaviour
{
public int health;

[Header("UI")]
public TextMeshProUGUI healthText;

[PunRPC]
public void TakeDamage(int _damage)
{
    health -= _damage;

    healthText.text = health.ToString();

    if (health <= 0)
    {
        Destroy(gameObject);
    }
}

}´´´

tacit edge
sharp axle
tacit edge
sharp axle
tacit edge
sharp axle
tacit edge
sharp axle
tacit edge
sharp axle
tacit edge
sharp axle
hazy hollow
#

the debug messages arent even spawning

hearty dock
# hazy hollow

Put a Debug.log in Start to make sure Start is even running

#

Netcode for GameObjects has two parts to its messaging system: remote procedure calls (RPCs) and custom messages. Both types have sub-types that change their behavior, functionality, and performance. RPCs as implemented in Netcode for GameObjects are session-mode agnostic, and work in both client-server and distributed authority contexts.

#

Note that the Server RPC is only going to run on the server

#

Which means:

  • there needs to be a server
  • There needs to be an active network connection
    etc
hazy hollow
#

start debug works and Im just starting out on spawning it on the server, not running another instance atm, but its not even spawning in the main project

#

the script is inhereting the networkingbehaviour

hearty dock
#

Are you sure the running instance is a server

#

What's your network topology

hazy hollow
#

also wdym network topology

hearty dock
hearty dock
hazy hollow
#

ah , its hosted by the client

#

in this case, if I do "start as host", that instance will be a hybrid of client/server right? So the rpc should still work ? Just trying to understand the difference between start as host and start as server

hearty dock
#

Yes it will be both the server and a client

#

Server RPCs just run locally on the server when called from the server

#

like a normal function

#

The page about RPCs I linked you above explains this all

hazy hollow
#

ty

sharp axle
torn lance
#

for persistent RPC targets, it says I need to call Dispose() on them, but doesn't have an example. Is this what it means? myRpcParams.Send.Target.Dispose(); There isn't any dispose method for the params object.

sharp axle
torn lance
torn lance
tacit edge
sharp axle
tacit edge
sharp axle
torpid stirrup
#

I made an online game with NGO and it shows me a lot of null reference errors. And this error only happens in Android and is not a problem in Unity!
With Android Logcat, I found out that the error is in the Unity NetworkManager script and from this part. Can anyone help me, what is the cause of this error? Thank you.

wild cypress
#

I'm instantiating objects in a card game one each client and right now they do not have network object attached. When they play the card I want to instantiate/spawn the card for the opposing player. Should I be using network object to declare spawn or is there a way to do it without having a network object attached?

tame slate
#

You could use an ID for the card like an integer or an Enum.

wild cypress
tame slate
#

Custom RPC targets can be read about here if none of the basic targets work for you: https://docs-multiplayer.unity3d.com/netcode/current/advanced-topics/message-system/rpc/#custom-targets

Any process can communicate with any other process by sending a remote procedure call (RPC). As of Netcode for GameObjects version 1.8.0, the Rpc attribute encompasses server to client RPCs, client to server RPCs, and client to client RPCs. The Rpc attribute is session-mode agnostic and can be used in both client-server and distributed authority...

wild cypress
#

thank you partyparrot

dusk ledge
#

So i am making a unity 3d fps multiplayer game with photon fusion and i have stumbled upon a problem where the other players can not hear your footsteps, i have tried using photon [Rpc(RpcSources.All, RpcTargets.All)] but this did not work. Anyone that can help?

tame slate
sharp axle
#

Yea, animation events will fire locally

tawny mesa
#

hi how come im getting the error:
SocketException: No connection could be made because the target machine actively refused it.
when trying to connect to a server on the same pc, 127.0.0.1, and debug logging the attempted server to connect to, and the server itselves ip and port, it shows the same numbers (127.0.0.1, and port 7777)

#

im trying to just check if a server exists. everything i see online uses onfailedconnect which is called, but i wanna call a function and return a value based on if it connected or not

sharp axle
tawny mesa
sharp axle
tawny mesa
sharp axle
tawny mesa
#

ah nvm you said that

#

how do i know if it's timed out then or wait for a timeout

#

or only continue the code when / if it succeeds to connect?

sharp axle
bitter rune
#

Hey, I am invoking an event whenever the player right clicks and wants to move a unit. I subscribe to this event on my visuals controller so that a visual effect is being spawned at the clicked location. However, subscribing to this event never actually triggers and therefore does not happen. What am I missing? I noticed, that it works sometimes in rare cases and very randomly. I assume it has something to do with the order things happen or maybe with OnNetworkSpawn?

the visual controller (attached to every unit object in the scene):

#
using UnityEngine;

public class UnitSelectionVisualController : NetworkBehaviour {

    [SerializeField] private GameObject moveParticleEffectPrefab;
    private UnitController unitController;

    private void Start() {
        unitController = GetComponent<UnitController>();
        if (unitController == null) {
            Debug.LogError("UnitController not found on " + gameObject.name);
        }
    }

    public override void OnNetworkSpawn() {
        if (unitController != null) {            
            unitController.OnWaypointSet += UnitController_OnWaypointSet;
            Debug.Log("subscribed to OnWaypointSet!");
        }
    }

    private void UnitController_OnWaypointSet(object sender, UnitController.OnWaypointSetEventArgs e) {
        PlayMoveEffect(e.destination);
    }

    private void PlayMoveEffect(Vector3 position) {
        if (moveParticleEffectPrefab != null) {
            GameObject effect = Instantiate(moveParticleEffectPrefab, position, Quaternion.identity);
        }
    }
}```
#

the event invoke logic:

    public event EventHandler<OnWaypointSetEventArgs> OnWaypointSet;

    public class OnWaypointSetEventArgs : EventArgs {
        public Vector3 destination;
    }

    private void SetDestination(Vector3 destination) {
        if (playerNavMeshAgent.isOnNavMesh) {
            playerNavMeshAgent.SetDestination(destination);
            OnWaypointSet?.Invoke(this, new OnWaypointSetEventArgs { destination = destination });
            Debug.Log("Invoked OnWaypointSet event!");
        }
    }```
sharp axle
fathom bison
#

Hi,
I'm struggling to set up a working NetworkObject with a NetworkRigidbody properly.
When the client tries to move the object, it completely glitches out, starts shaking and refuses to move. The cube is being moved by setting its linear velocity, so I can not make it kinematic and just sync its position.

#

Is there something I don't understand what don't I understand with the way Netcode works ?

sharp axle
fathom bison
#

Yes

sharp axle
fathom bison
#

I think it's the case, but how could I check that?

sharp axle
bitter rune
tame star
#

i am developing an multiplayer for my game right now, using Unity Netcode for Game Objects and it uses "Lobbies" for it as far as i went, and i like how it works but i feel like i missing something, because i want to create permanent servers as those in battlefield and Netcode uses a lil too specific naming, lobby as i imagine it, is a temporary server for couple of friends. So is it ok to use it for hosting a game similar to battlebit for example? Sorry if stupid question, i am begginer

sharp axle
tame star
tame slate
tame star
#

Oh okay, than can i use some external hosting while still using Netcode for Game Objects as multiplayer utility?

tame slate
tame star
#

Thank you very much

sharp axle
tame star
#

can i use unity relay for testing and developing now and transfer later to more powerful host without much issues, in that matter?

tame star
#

Omg thanks

tawny mesa
#

hi i've got this code

void Awake()
{
    if (Instance != null && Instance != this)
    {
        Debug.LogError("More than one player spawner exists!");
        Destroy(this);
    }
    else
    {
        Instance = this;
        DontDestroyOnLoad(this);
    }

}```
for a singleton, yet when i start a client it destroys the objects? but it doesn't when i start a host? and the debug.logerror never fires either which is the only place i have destroy
#

i start a client then load a new scene too, if that changes anything

tame slate
tawny mesa
sharp axle
tawny mesa
#

how do i run code on onnetworkspawn?

sharp axle
tawny mesa
# sharp axle It's an override. Make sure this is in a network behavior

ok so that broke everything.. it doesn't even seem to be running this code

public override void OnNetworkSpawn()
{
    base.OnNetworkSpawn();

    if (Instance != null && Instance != this)
    {
        Debug.LogError("More than one player spawner exists!");
        Destroy(this);
    }
    else
    {
        Instance = this;
        DontDestroyOnLoad(this);
        Debug.Log("Singleton for " + this.name + " set");
    }

}```
#

none of the debug logs are running in the client

#

i just get this a bunch

#
Debug.Log("Loading scene");
NetworkManager.Singleton.Shutdown();
unityTransport.ConnectionData.Address = ipAddress.text;
unityTransport.ConnectionData.Port = ushort.Parse(port.text);
NetworkManager.Singleton.StartClient();```
this is the code that starts the client on a button press
tame slate
tawny mesa
#

ok so if i remove the destroy then, but what about the rest of it? it shouldn't be destroying anything anyway as i only have one in the scene

#

nor does the error that more than one exists ever show

#

does the network object get spawned before it connects to a server successfully?

#

or after it connects to a server

#

aka does onnetworkspawn fire when the object is spawned / on game load in this case, or when a server is connected to

sharp axle
tawny mesa
#

ok so.. how can i get data from the server about a different scene

sharp axle
#

You can use Dont destroy on load. just do't make it a static instance

#

You can also use scriptable objects to persist data across scenes

pulsar gorge
#

https://github.com/Unity-Technologies/multiplayer-community-contributions/tree/main/Transports/com.community.netcode.transport.steamnetworkingsockets
using steamworks.net and this layer for netcode, when starting a client once joining a lobby my game freezes and no errors are displayed. How do I fix?

GitHub

Community contributions to Unity Multiplayer Networking products and services. - Unity-Technologies/multiplayer-community-contributions

lilac forge
#

[System.Serializable]
public class Character
{
public string characterName;
public Sprite characterSprite;
public GameObject ballCharacterPrefab;
public GameObject characterPrefab;
public GameObject podiumPrefab;
}

hello how can I make this serializable? right now I get Unity.Netcode.Editor.CodeGen.NetworkBehaviourILPP: (0,0): error - Character: Managed type in NetworkVariable must implement IEquatable<Character> issue

tame slate
lilac forge
#

public class GamePlayer : NetworkBehaviour
{
//private Character playerCharacter;
private NetworkVariable<Character> playerCharacter = new NetworkVariable<Character>();
private NetworkVariable<Character> hoveredCharacter = new NetworkVariable<Character>();
private int playerNumber;
private int playerHealth;
private bool isCPU = true;
private int userNumber;
private int roundWins;
private bool isReady;
private MainManager.Difficulty playerDifficulty;

#

public void ReplacePodium(int podiumId, int characterIndex)
{
foreach (GameObject podium in podiums)
{
if (podium.GetComponent<Podium>().PodiumID == podiumId)
{
GameObject replacedPodium = Instantiate(MainManager.Instance.characterDB.GetCharacter(characterIndex).podiumPrefab, podiumPos[podiumId], emptyPodium.transform.rotation);
GamePlayer player = MainManager.Instance.GetPlayer((int)NetworkManager.LocalClientId);
player.HoveredCharacter = MainManager.Instance.characterDB.GetCharacter(characterIndex);
replacedPodium.GetComponent<Podium>().PodiumID = podiumId;
podiums.Add(replacedPodium);
replacedPodium.GetComponent<NetworkObject>().Spawn();
podiums.Remove(podium);
Destroy(podium);
}
}
}

#

that was my script

#

it was working well until I struggled with network variables

#

I have a character database, I get chars from there

#

with index

tame slate
#

Which is usually the case with Sprites/Prefabs

lilac forge
#

okay so I Initialize 4 player classes at the start

#

these player classes have character variable

#

I just want to make players change their player classes itself

#

like player.PlayerCharacter = chosenCharacter

#

so instead of that do I need to make it like player.PlayerCharacterIndex?

tame slate
#

Network the chosen character as an ID or index and then let each client update visuals and whatever else on their own based on that ID/index.

lilac forge
#

okay but how can I update player classes on all clients?

#

like I want player2 updated when second player picks

#

on all clietns

tame slate
#

Use a NetworkVariable for the ID/Index and then use OnValueChanged to update whatever you need.

NetworkVariables are a way of synchronizing properties between servers and clients in a persistent manner, unlike RPCs and custom messages, which are one-off, point-in-time communications that aren't shared with any clients not connected at the time of sending. NetworkVariables are session-mode agnostic and can be used with either a client-serve...

lilac forge
#

private void InitializePlayers()
{
players = new GamePlayer[4];
for (int i = 0; i < players.Length; i++)
{
players[i] = new GamePlayer(i); // Assuming Player constructor takes a player number
}
}

#

okay ty

tawny mesa
#

why does

NetworkManager.Singleton.OnClientConnectedCallback += OnClientConnect; (in start) 
private void OnClientConnect(ulong clientID) 
{ 
  Debug.Log(IsClient); 
}

return false?

#

doesonclientconnectedcallback not call when a client has connected to a server?

#

what does?

tame slate
#

If it's always returning false, it's probably just too early in the network cycle to accurately return the proper value. If you check it at any later point, it should be correct.

#

I've seen a handful of bugs with OnClientConnectedCallback as well. It is recommended to use OnConnectionEvent as OnClientConnectCallback and OnClientDisconnectCallback will be deprecated at some point.

tawny mesa
#

how do i compare the connectioneventdata passed into onconnectionevent to a connectionevent? i.e how do do i check if the value passed == clientconnected? which i assume would mean the client has connected to a server / host

tawny mesa
tame slate
tawny mesa
#

unity 6 if that helps, netcode

tame slate
tawny mesa
#

ok, i enabled it for testing, and it doesn't load the same scene when i run startclient

tame slate
tawny mesa
#

also, this debug.log i put runs now

private void OnTransportevent(Unity.Netcode.NetworkEvent eventType, ulong clientId, ArraySegment<byte> payload, float receiveTime)
{
    if(eventType == NetworkEvent.Disconnect || eventType == NetworkEvent.TransportFailure)
    {
        NetworkManager.Singleton.Shutdown();
        Debug.Log("Client disconnected (is there a server on the ip and port?)");
    }
}```
#

im right in saying 127.0.0.1 is the local ip right?

#

ok yeah debuglogging the ip and port on the client and the host have the same numbers

tawny mesa
#

NetworkManager.Singleton.StartClient();

#

it's not connecting to the server

#

i think i fixed it, but now running my rpc gives a "the given key was not present in the dictionary" error

#

i have an rpc running set to sendto server onsceneload, yet on the server it runs 8112 times, and the client gives a given key not present error

#

why does onsceneload fire 8112 times???

mossy bluff
#

anyone have problem with network objects? when i click on one in the hierarchy it seems to do loads of stuff over and over and its difficult to even click off it

#

using netcode..

mossy bluff
#

also does networking disable the "step to next frame" button? not been able to use that in ages

full perch
#

Hello, does anyone know a good method to archieve multiplayer damage by teams?
Been looking for tutorials on YT but all I seem to find is basic offline damageable behaviours

sharp axle
sharp axle
sharp axle
mossy bluff
#

i think its something to do with that setting where it can auto add network obj script

sharp axle
mossy bluff
#

yeh!

mint anvil
#

this may be a dumb question but, i want to have a few default items in the inventory (items are int/id's in an int network list), but it's not possible to do that with a network list directly, right? (to set the network list default content in the inspector) i have to first instantiate the list and add in the content in start from another list manually?

sharp axle
meager lynx
#

Hey guys, I'm currently setting up UGS Multiplay, I've set the minimum available servers (in fleet->scaling settings) to 0, but I'm not quite sure how the machine's supposed to start up (because it isn't, even though there's an active matchmaker ticket)

#

(Everything works fine when I set the min available servers to 1 or more though)

#

Nevermind

#

Looks like the machine just took ages to load up

tawny mesa
#

why is my rpc not loading at all? it shows KeyNotFoundException.. the rpc is in the same file that the rpc is being ran from,
rpc:

[Rpc(SendTo.Server)] 
public void RequestServerMapRpc() 
{
    //Debug.Log("sdfljhkbndrsfgsgfdsdgtf ");
    Debug.Log(IsServer + "sdrfg");
    if (IsServer)
    {
        SendMapToClientRpc(map);
    }
}```
running requestservermaprpc causes the keynotfoundexception. even if i comment the code and have it only be a debug log it still gives an error?
#

how can it not find the rpc but it's able to run the code that runs the rpc, which is on the same script

#

running the rpc on a host works fine, the client fails though

sharp axle
tawny mesa
#

and there is nothing setting it to active or destroyed ever in my code at all

#

it's set to a dontdestroyonload

sharp axle
tawny mesa
tawny mesa
wild cypress
#

I’m having a hard time with the concept of multiplayer rpcs. The game I’m working on is a two player card game. Right now I have client authoritative deck creation and dealing. When I was moving it to server authoritative I got stuck on the step of instantiating the decks with instantiate then spawn. now I needed to pass all the information to the client within an rpc(I think) or find a way to get card info stored on a separate matchmaking scene. My biggest issue is that I still don’t understand how get both players to function with separate decks. Or am I supposed to just 180 the board at scene start? Please let me know how you would do it.

tawny mesa
#

but now, on a different script a network object on the host shows "spawn" and on the client it doesn't ?

#

this is one that's loaded by loading into a scene

sharp axle
sharp axle
tawny mesa
sharp axle
wild cypress
sharp axle
tawny mesa
#

rpc not properly working

elfin token
#

Hey guys, I have a chair<network object> inside of a vehicle<network object> that is supposed to allow passengers to ride with each other. Everything works great until the vehicle despawns. The chairs do not despawn with the vehicle. They simply stay active. Is there a solution to this behavior?

sharp axle
elfin token
#

@sharp axle I will give that a shot after you get off work

elfin token
#

@sharp axleNot quite what I'm looking for. I just want the child network objects to deactivate with the parent.

tame slate
elfin token
#

@tame slate Haven't tried that yet, currently building a cleaner work around. The chair is messy lol

lilac forge
#

hello I have a problem

#

I have a mainmanager and I initialize several player classes inside at the start.

#

private NetworkVariable<int> hoveredCharacterIndex = new NetworkVariable<int>();
private NetworkVariable<int> playerCharacterIndex = new NetworkVariable<int>();
these players have that values. How can I sync them with other clients?

#

private void InitializePlayers()
{
// Create 4 players without using prefabs
for (int i = 0; i < 4; i++)
{
GamePlayer player = new GamePlayer(i);
players.Add(player);
}
}

I initialize here

public class MainManager : MonoBehaviour
{
private List<GamePlayer> players = new List<GamePlayer>();

#

do I need make mainmanager also network object?

sharp axle
proud sky
#

Hello everyone, I would like some help in trying to make a VR multiplayer game using Netcode but i am stuck since the materials that i am using from unity are working well for third person player and now i am trying to implement it in VR.

mint anvil
mint anvil
tame slate
#

Or do they stay in the inventory the whole time from the moment they're added

mint anvil
tame slate
olive whale
#

How can I make a network leaderboard for my game? The game will be for IOS. Unity6.

tame slate
olive whale
#

Thanks a lot

lilac forge
#

public void InitializePlayers()
{
if (IsServer)
{
for (int i = 0; i < 4; i++)
{
Debug.Log("Instantiating player " + i);
// Instantiate the player prefab
GameObject playerObject = Instantiate(playerPrefab);
playerObject.name = "Player " + i;
NetworkObject networkObject = playerObject.GetComponent<NetworkObject>();
players[i] = playerObject.GetComponent<GamePlayer>();
players[i].PlayerNumber = i;
networkObject.Spawn();
}
}
}

it doesnt spawn prefab for other clients anyone know why? Yes my prefab has network object component

public override void OnNetworkSpawn()
{
    base.OnNetworkSpawn();
    if (Instance != null)
    {
        Destroy(gameObject);
        return;
    }

    Instance = this;
    // Initialize players
    InitializePlayers();
    DontDestroyOnLoad(gameObject);

    for (int i = 0; i < characterDB.CharacterCount; i++)
    {
        Debug.Log("works");
        availableCharacters.Add(characterDB.GetCharacter(i));
    }
}
sharp axle
lilac forge
#

its on mainmanager

#

singleton instance

#

it has networkbehaviour too

#

what I need to do then

#

:/

sharp axle
lilac forge
#

but this is on character selection screen

#

Ive made setup with relay and unity lobbies already

#

later all players go to the character selection screen

#

cant I syncronize when other players join or something?

#

these player classes are basically to store information. I was doing it without gameobjects before but I reallized its hard when its networked

sharp axle
lilac forge
#

no no these happen after lobby

#

I dont allow people to pick characters on lobby because my character selection screen is pretty animated

tame slate
#

I would store your character selection locally on the client, and then when they connect to the server they can send an RPC to the server to request the player object to be spawned.

lilac forge
#

how can I make that they get these player objects too?

#

when they enter to game example

tame slate
lilac forge
#

ah okay so I ca njust say

#

if its not server

#

call an rpc

sharp axle
lilac forge
#

okay thanks

obsidian crest
#

Hello guys. I am making an Android app that uses Google Drive. I am using this package to access Google Drive

https://github.com/elringus/unity-google-drive

It works really well in Editor, but when I try to Upload a text file to Google Drive in my Android Phone, it crashes. What should I do?

Unity 2020.3.30f1

GitHub

Google Drive SDK for Unity game engine. Contribute to elringus/unity-google-drive development by creating an account on GitHub.

sharp axle
obsidian crest
#

I dont know how to look to logs error on mobile.

obsidian crest
#

Thank you

wild cypress
#

How do you name an instantiated prefab on clients? I can't get the GameObject instance as a ref so I'm struggling with this concept. Right now I have the name I want being passed into the rpc for clients, but since I'm spawning so many I can't get them to work.

sharp axle
wild cypress
#

doesn't that use alot of bandwidth?

#

Still it is looking like the only option

#

Thank you for the pointer

sharp axle
wild cypress
#

oooooo, that is good to know, I thought it was doing some type of gameobject serialization

proud sky
river gazelle
#

Hello again, been a while since I posted here.
I'm looking to learn how to set up my own game server, preferably C# / ASP.NET so I don't need to study a 2nd programming language.
I've build a tiny real-time game before in node.js with socket.io. I'm a mid-level developer but I don't have much experience with servers.

I think I'd prefer a mid/high level solution so I'm not re-inventing the wheel, if proper solutions exist I'd like to use those. But I do want to be able to control how the game logic works. I'd rather not have to worry about the networking too much.

Not entirely sure what kind of game I wanna make yet. Probably something for 2 players, max 10 players. Like 2 player co-op or 5v5 PvP.

Specifically I'm looking for a library that handles everything or most of the things I'll need for a small multiplayer game, with a lot of freedom to change game logic (not networking logic) and I'd prefer it to be fast, like say max 50ms latency. I would need matchmaking and lobbies, but can write those myself is necessary, again if a proper library exists for them I'd prefer using that. It also needs to be free, not looking for a service that requires me to pay per user or something.

I've been doing my own research and found some libraries that look interesting, but from experience it's always better to ask people actually working with them than just reading some articles on the internet.

river gazelle
ripe mesa
#

no, its okay

river gazelle
#

SignalR, but seems too slow.
LiteNetLib, but seems very abstract to me

#

Ideally I'd use a Unity service, but the cost per user just grows out of control too fast

ripe mesa
#

what most matter here is:

  • where it will be deployed
  • what is gameplay looks like
river gazelle
#

What I've read the latency for SignalR would be around 100ms at a minimum, I want my game to feel smoother than that

#

I'm thinking a real time co-op tower defense for now, but it might change to PvP and I'd prefer to learn something I can use for more fast paced games in the future as well

#

Not sure where/how to deploy it, but probably a managed dedicated server somewhere?
Gameplay no idea yet, but fairly simple. Why is this important? Might be able to give a better answer if I understand.

river gazelle
ripe mesa
#

highly competitive?

ripe mesa
river gazelle
#

yeah I'm not sure what game to make yet 🙂 just a general direction I wanna go in
anti-cheat is very important to me, definitely want a competitive game

ripe mesa
#

tower defense PvP?

#

Im still dont getting the idea of the gameplay

river gazelle
#

not extremely fast paced, but I want the game to feel very smooth regardless, like 20-50ms preferably
it really depends on what idea I got with, if it's co-op tower defense the pace will be much slower
if it's pvp tower defense one player might be dropping units, which need to appear for the other player as fast as possible
sorta real-time strategy
but I might go with something else entirely, not sure how to explain it better

ripe mesa
#

its suitable for cross-platform, lot of entities

main phoenix
#

Hi all - using Unity.Networking.Transport and jobs... the tutorial uses Driver.Accept() in a job. I was under the impression it is not thread safe or has this changed?

river gazelle
#

I did a business plan based on UGS and the cost efficiency was terrible

#

Looks really good though

ripe mesa
#

100CCU seems small right?

river gazelle
#

not really, just worried about the cost

ripe mesa
#

oh okay, then you can upgrade your plan

#

quantum is cost efficient because we dont pay for servers

#

while in in traditional client-server, we still have to pay for dedicated servers for secure gameplay

river gazelle
#

what are it's major downsides? what games shouldn't I use it for?

ripe mesa
river gazelle
#

oh wauw, that's good to know

sharp axle
river gazelle
#

unity netcode seems more flexible too, I like that

sharp axle
#

Any of the modern libraries can more or less do whatever you need. The difference are mostly built in features(some paid for, others free)

sterile creek
sterile creek
sharp axle
tame slate
sharp axle
#

The only exception to the UGS free tiers is Multiplay Server Hosting which can get very expensive depending on the game

river gazelle
#

Yeah that's why I'd rather build my own server and host it, which is much cheaper not?

main phoenix
sharp axle
river gazelle
#

Is the main difference between Photon Fusion & Quantum just that Quantum is specifically made for Unity? Or are there any other major differences?

ripe mesa
#

both are made for unity

ripe mesa
#

but maybe you can opt in industry license or something to allow self host the photon quantum server

river gazelle
#

might a (a lot) more work though, that I don't know

ripe mesa
river gazelle
ripe mesa
#

it will be capped there

#

the player 101, will get kicked

#

talking from a business perspecitve, if you managed to get 100 ccu consistently, then your game is hit

haughty berry
#

what is most user friendly networking solution

river gazelle
ripe mesa
haughty berry
#

would like to make first person zombie shooter with only like 4 players in each lobby

ripe mesa
haughty berry
#

yeah

ripe mesa
haughty berry
#

yes

ripe mesa
#

where would it be deployed? steam?

haughty berry
#

yes

ripe mesa
#

how many zombies?

haughty berry
#

not to many it doesnt need to be able to handle that much

ripe mesa
haughty berry
#

allright thanks

river gazelle
#

What would you recommend for a fast-paced 2d adventure fantasy rpg with simple combat both PvE and PvP? Won't have a lot of monsters
Something similar to like Graal Online or Maple Story

river gazelle
#

probably, but might go with platform instead, not sure yet

#

maps will have like a max of 10-20 players

#

but usually less

#

needs to be deterministic too

#

think Quantum still works for this type of game?

river gazelle
#

what would the limitations of quantum be for this kind of game?

river gazelle
#

like max number of players/zones? something else it can't do?

ripe mesa
#

quantum can be not suitable for game with Big Maps

river gazelle
#

yeah probably not making huge maps, but maybe in cities it would be nice to have higher player counts

ripe mesa
river gazelle
#

fog of war would still work for non-cheating players right?

#

might do something like that for atmosphere mostly

ripe mesa
#

but if its regular player, its fine

river gazelle
#

Setting up a project with quantum now to do some testing 🙂

warped spruce
#

Hi everyone !

I have a problem with my proximity voice chat
It works and I can hear other players speak but the sound crakles and it's very annoying.

I use FizzySteamworks for the steam implementation.

Does anyone know how to fix this issue ?

wild cypress
#

What do you do if you want an RPC to return a value? I'm getting an error in steam that rpc must return void. Right now I'm sening and recieveing a networkObjectReference

tame slate
#

If you want a "return" you'll have to ask the receiving client of the RPC to send information back to the sender.

#

Usually with another RPC.

wild cypress
#

gotcha thanks for the help. I'm very new to multiplayer partyparrot

sterile creek
#

I would take some time to learn the multiplayer principles.
Understand that multiplayer communication is alot like me and you are sitting in an office, using an assistant to pass notes back and forth.

We both keep working, some notes get lost, and there is a delay in receiving a reply, since the assistant needs to walk the message.

Everything is just bytes (the words on the notes). RPC's are just one way of calling a direct method that gets translated down to bytes and then converted back up into a function call.

we dont know anything about eachother that wasnt in our predetermined starting knowledge.

#

So if you want me or anyone else to know something about the state, you have to tell us.

#

RPC are handy ways of sending commands back and forth that we both understand.
NetworkedVariables are convient ways for changes in them to automatically get sent over. Its all abstractions that take care of all the messy translation work to go from bytes to a specific object and value

tame slate
#

!collab

raw stormBOT
#

:loudspeaker: Collaborating and Job Posting

We do not accept job or collab posts on Discord.
Please, use Discussions to promote yourself as job-seeking, advertise commercial job offers, or look for non-commercial projects to participate in:
Collaboration & Jobs

topaz sage
#

Thank you!

wild cypress
#

I'm looking for a solution to parenting objects in a 2 player card game. Before multiplayer I was parenting cards to the deck, hand, discard, board etc. Now I'm limited to only parenting with the server, so it looks like I might have to change how I was moving cards. How would you go about moving objects in multiplayer for clients?

sharp axle
eternal heart
#

Hi, i have a issue of smooth movement with Photon Fusion 2 Shared Mode, i dont know where i can ask my question please

sharp axle
dusty hill
#

I want to have a list of player gameobjects in the server only that things can reference, so I made the playerprefab send an RPC that tells the GameManager to go through the SpawnedObjects list and add players it sees. The list length is correct for number of connected players, but then in the NetworkBehaviour'd enemy script I try to reference the GameManager instance and get the list, but it seems to be incorrect. Is the enemy not going to reference the server gameobject? Is there a way to make it do that?

sharp axle
dusty hill
tidal trail
#

is there any example of AnticipatedNetworkVariable or AnticipatedNetworkTransform? i want to create client prediction system

tame slate
#

Reminder that Anticipation does not equal Client-Side Prediction

ocean wadi
#

Hi! So I recently was recommended to look into decoupling my code in regards to networking for my game. From my understanding, network decoupling is where you separate out the code involving whatever networking I am using (in my case FishNet) from my core code, so that in case I need to refactor or swap to a different networking system it is easy to change my code.

I was just wondering, how easy would it be to decouple my networking code as a beginner to networking? Should I be doing that if I am planning on staying on Fishnet for my whole project? Is it common industry standard to decouple your code?

tame slate
#

In terms of wanting to do it for easy migration between networking solutions - FishNet is already very similar to other popular Unity networking solutions and migrating your code would be very easy and essentially just changing syntax.

dry maple
# ocean wadi Hi! So I recently was recommended to look into decoupling my code in regards to ...

There are very big differences between various networking solutions that what you are saying is simply impossible. Unless you try not to to use the specific/unique features of each solution and simply use the most common ones across different solutions, basically creating a bare-bones interface. This is simply a bad idea. And it will most likely not work in practice, due to the various small differences on how the different systems handle intricate details.

You just need to find the right networking solution for your game, and stick to it.

Industry standard is to write your own netcode.

river gazelle
#

Is Quantum 3 capable of using UGS Private Player Data? This data is only accessible from a server.
I'd also need the script to only be on the server, since it would have credentials for logging in that clients cannot have access to.

#

Also I just found out about photon Gaming Circle, which basically costs $500 for basic support and has more samples
It looks extremely scammy, basically sounds like they're denying basic tutorials for free users so they can sell this

river gazelle
#

Anyone using FishNet? Is it good?

tame slate
river gazelle
tame slate
river gazelle
#

Yeah but it's not the most important thing, I mostly just want it for anti-cheat

#

The requirements for my game are:

  • top-down 2d rpg
  • fully server authoritative
  • must be able to save/load character data on the server
  • low latency, smooth gameplay
  • fast paced action PvE & PvP
  • lots of different zones to explore
  • max 20 players / zone is sufficient, + if it's capable of more
  • good documentation / easy to get started
#

Quantum doesn't seem very good for handling different zones or save/load systems

  • it has basically no documentation unless you pay them $500/month
river gazelle
#

Anyone using Hathora? Seems extremely easy to set-up.
Does it support multiple zones/scenes? Why is their pricing not visible on their website, that's sus

sharp axle
ripe mesa
#

it looks like your game is similar to Online RPG

ripe mesa
river gazelle
#

been playing around with FishNet today and I love it ...

ocean wadi
#

Hi! I have a quick question. I was just wondering what the best practice is for syncing projectiles in a peer to peer set up.

I was wondering if I should be making the projectiles network objects or if I should just have the spawning of the projectiles synced through rpcs. From the research I've done, simple, short-lived projectiles should be handled through RPCs, while multi-functioned, long-lived projectiles should be handled as network objects (No idea if this is a correct line of thinking or not, but seems to make sense).

rugged shoal
#

Hey @ocean wadi,
It's not a bad way of approaching the problem. And it would depend on your use-case really.
The team summed up the design decisions quite well in the below docs that would help you to decide which approach to take :
https://docs-multiplayer.unity3d.com/netcode/current/learn/rpcvnetvar/

but yes, essentially if you want to keep the data associated with projectiles available longer for late joiners go with NetworkObjects, otherwise RPCs

Choosing the wrong data syncing mechanism can create bugs, use too much bandwidth, and add too much complexity to your code.

neon crest
#

can someone pls help me set up photon for a gtag type game (vr) 🙏

bright coral
#

Net stack agnostic question;
Any drawbacks to using AssetReference (Addressables) when dealing with object replication and coupling networked object ids to prefab assets? At first glance it seems pretty well suited, but before I start digging into it I figured I'd ask to see if anyone has any immediate reasons why it wouldn't be a good idea.

bright coral
#

👆 Turns out this works great

weak plinth
#

I have an additional editor instance setup as a run config, and it takes forever to launch, any way to speed it up?

#

for example

#

it literally takes ~30 secoonds if not more to launch, my personal machine isnt garbage and my project isnt that large

wild cypress
#

How do delagates run in netcode for gameobjects? Is there a way to make it work like an rpc? This is an example of what I'm working with, it only runs on the server, even if the client is the one clicking the buttonendTurnButton.onClick.AddListener(() => { if (!GameManager.Singleton.IsPlayerTurn()) { Debug.Log("cannot end turn : Not current player turn"); return; } GameManager.Singleton.EndTurnButtonPressedRpc(); });

tame slate
wild cypress
#

Does that mean I need to make the button a network object or make it use unity events?

tame slate
#

Your button just needs to follow this general flow:

  • Client presses button locally
  • Button press sends RPC to server
  • RPC is received by server and needs to tell all clients the current turn is over
#

Making it a NetworkObject or using Unity Events won't really change anything.

#

A button is a button and doesn't directly have anything to do with networking. It is up to you to make it so that the press of the button sends info over the network via an RPC or NetworkVariable.

wild cypress
#

Okay thanks for the knowledge

#

I added in a yield return new waitforseconds(1) in one for the rpc calls and it works now. Is there a more elegant solution to timing issues?

tame slate
rain sapphire
#

How would one handle spawning an ability from 1 of 2 players with Rpc for a class for setting up abilities that does not inherit from NetworkBehaviour? Basically, I am helping my friend set up and ability system for their game, and it works on the host, but when the other player tries to use abilities we've been encountering issues from it needing to be host (without rpc tag) or nothing happening (with rpc tag but no network behavior since now it looks for data like inputs from host). And when we do try with NetworkBehaviour it uses the variables from the host so things like when an ability was used don't get updated.

lunar wind
#

Problem: Getting player input from UI Toolkit to server

I'm in the process of converting the new UGS & Netcode for Entities action FPS template to RTS style.

Here's how things are happening right now:

  • player clicks a UI button
  • UI Document's controller mono code fires up the event callback
  • the callback function spawns a "request" entity via EntityManager
  • the player input system iterates over request entities, then writes to IInputComponentData accordingly
  • the server input system checks IInputComponentData and spawns request entities for other systems

Snippet:

    [GhostComponent]
    public struct RtsPlayerCommands : IInputComponentData
    {
        // Lobby
        [GhostField] public InputEvent IsReady;
        [GhostField] public InputEvent StartGame;
        // Fleet
        [GhostField] public MoveFleet MoveFleet;
    }

    public struct MoveFleet : ICommandData
    {
        public Entity FleetEntity;
        public float2 Destination;

        public NetworkTick Tick { get; set; }
    }

Can I even use MoveFleet like this? Is it possible to pass custom structures as command buffers?

Now, the thing is as you can see this system looks so complicated that I started to think I'm doing something terribly wrong.

I've initially thought about using RPC's for the entire "player input" system as this RTS game has no input other than commands. But after reading netcode manuals, they STRONGLY oppose against rpc for anything other than meta-game elements.

This is a bummer because a data only rpc of my custom types is simply what i need. Just have to write a system to map rpc's with Player ghosts. I lose prediction (iirc) but the system gets much simpler: spawn rpc request entity directly from the callbacks ( or just buffer a command queue to spawn from main thread )
And on the server, the related system can directly consume the rpc.

Am I missing something, or i should go with RPC's even though the docs say use command streams?

#

the full command system idea is

they are one-tick "messages"
commands are validated on server before they are processed
commands can be pre-validated on clients for clarity (like greying out UI elements)
executed commands only act on Ghost prefabs, they might also interact with server exclusive logic

#

I hope someone who knows this stuff helps because this became a huge roadblock for me as I need this to work to complete the main menu -> multiplayer game begin flow.

This is the first time i planned a game with this big architecture ( personal project for now )

sharp axle
#

Spawning Abilities

sharp axle
faint cedar
#

Hello. How can I force a client network transform to synchronize? Meaning that it would synchronize when I want instead of only when the object is moved.

#

For context, in my game if a player joins after a gameobject is moved, it wont be synced on the players client.

tame slate
faint cedar
#

well its not

tame slate
# faint cedar well its not

That would indicate that there's something incorrect with your setup and/or management of the NetworkTransform - not that you need to force it to synchronize.

faint cedar
#

ive tried different settings but havent gotten it to work

#

i should note it was working before then i updated to unity 6 the other day and now its not working

sharp axle
tame slate
# faint cedar

This may not be it, but if you're using a version of NGO that has Authority Mode on the NetworkTransform - you don't need to use the ClientNetworkTransform component.

sharp axle
#

But yea, use the regular Network Transform

faint cedar
#

2.2

#

alright ill try

#

im having the same issue

night condor
#

I'm having a real issue in my script, so may a kind and gentle unity netcode user help me?

#

so I have a first script assisgned to a game object synchronized via network object, it references the variables for the names displayed on a leaderboard

#

everyone is getting a tag when spawning so this works very well (the owner of the server who is the first one to spawn will always get the tag 1, and the cients 2, 3 and 4 in order)

#

So the owner (with tag 1) is able to change the network variables

#

But the clients can't modify the network variables even via server rpcs

#

I've tried figuring this out for hours and even days but nothing I try work

hearty dock
#

what's the end goal here?

#

WHy are you assigning custom tags to players instead of just using their Client IDs?

hearty dock
#

And why not just use the client ID as like the key to a dictionary or something

#

instead of having separate variables...

#

which implies a fixed number of players

night condor
#

The problem is that the clients aren't able to modify the network variables even by server rpc

tame slate
hearty dock
#

where is this playerName variable coming from

night condor
#

Player name comes from an input field where every players enter their nickname and this variable is registered as it can be verified by checking the editor while running the code

#

How can I modify a network variable with a client?

tame slate
hearty dock
#

which clearly your players are not typing in

#

Send the name in the RPC, or, since you're basically just going to let the client set the name to whatever you want anyway it seems, you could also just let each client own their own network variables for their names.

night condor
#

As owner, I suppose that the clients will be able to modify their own variable

#

Then, I'll try to get every player instance's network variable

#

And change the TMPs in consequence

sharp axle
#

For player names use a network variable on the player object with owner write permissions

dusty hill
#

Would I want to do something like above for all player stats? Working on more of an RPG thing with lots of numbers, so do I just attach a NetworkBehaviour with a half dozen NetworkVariables inside it on the player objects and use RPC to change values? I can kinda picture it but I want to make sure I'm not setting myself up for trouble later down the line.

dreamy condor
tame slate
dusty hill
sterile creek
dreamy condor
tame slate
ocean wadi
#

Hi! So I have a question.

Pretty much I am trying to sync up my enemies across the host and clients currently. I am working on the Skeleton archer enemy, which charges up an arrow and then fires after a short duration. During the charge up time, the bow is pulled back, the weapon HOLDER gameObject rotates to face the player, and the enemy will flip horizontally to face the player, creating the effect of the bow rotating around the skeleton to aim at the player (2D top down game).

I made it so that the script that rotates the weapon holder syncs the rotation through the use of RPCs. But since there is a slight delay, when the enemy flips, the bow for a short duration flips as well, and then corrects itself when the observer RPC in charge of syncing the rotation corrects the orientation. While not a huge issue, it makes the enemy look really janky, was wondering if anyone had a fix for this.

night condor
sterile creek
quaint niche
#

What is the best/most widely used solution for p2p?

#

I want to make a very simple p2p multiplayer game mode for my game,

#

My understanding is that Netcode seems to be the most widely used option?

sharp axle
dark horizon
#

So for uni we (class) want to make a lethal company style game. We just had a quick look to try and understand how a “moon” scene and a “maze” scene would work in multiplayer (p2p probably) but couldn’t find anything definitive that’s within a reasonable scope. Can anyone point us in the right direction or is it simpler to just teleport them somewhere else in the scene
(NGO ideally)

jaunty stirrup
#

does anybody know how I can add a first person camera onto a player ghost prefab in netcode for entities?

sharp axle
sharp axle
jaunty stirrup
dark horizon
sharp axle
dark horizon
river gazelle
#

Using FishNet, would it somehow be possible to connect to UGS Private player data or like an sql database or something?
How would that work? I literally just started, but from what I see the client has access to all the same files & data as the server?
Are there like seperate files/folders that only go to the server? Or do you upload the account data (password / api key) to a file on the server or something?
Really no clue how this works or how to get started. But I need a clear answer on if this is possible or not (without doing crazy complicated/expensive stuff) so I know if FishNet is suitable for my game.

tame slate
river gazelle
#

Wouldn't that cause issues where the client has the same "power" as the server and could just save whatever they send?
How would Cloud Code/Save verify the data is from the server?
I just find the whole FishNet server thing very confusing, since it's basically just another client acting as server if I understand it right?

sharp axle
#

There are also access controls that can block a client from accessing the different services

river gazelle
#

Which is exactly what I'm asking, where do I put the authentication details?
So far all I've seen is you program a client in unity, that also acts as a server, you can then press some buttons for several services that makes it a "dedicated" server, but the client would still have access to everything, including my authentication details. Unless there is a way to put those somewhere, somehow, which there probably is, but I don't know

sharp axle
river gazelle
#

mate stop making stuff up
I'm not using a real dedicated server, it's created from the client with fishnet, as far as I know
which is exactly what I'm asking

tame slate
river gazelle
#

But I'd still need to call cloud code from my client, which has exactly the same code as my server, so there's no way to differentiate?

tame slate
river gazelle
#

Yeah Fishnet has plenty of ways, but if one of my clients decides to adjust their client to think it's a server ...

sharp axle
#

You'll need to use fishnet to build a dedicated server if security is an issue. There is not much you can do if someone hacks your client.

river gazelle
#

but there are tools like edgegap that let you just start a server from the unity client, no setup required

tame slate
river gazelle
#

this is the tool I mean
it just lets you run the game as a dedicated server
which again, is why I'm asking how I would get some form of authentication on it

crimson sleet
#

Hi im using ECS and creating a system that is only simulated on the client side bit like a boid group that follows around the player's ghost object
I have some systems like spawn x amount of boid members connected to x player
I am struggling on how to communicate from one client to another to spawn said object because I don't know how to get a reference on every other client to the player / connection that is sending the RPC that says spawn this stuff to the server

river gazelle
#

This is like a very simple basic requirement for a multiplayer game not? A secure way and location to store player data? Why is it so hard to get an answer I can understand?

crimson sleet
#

Like I can get the connection on the server's system from the RPC but how do I communicate that to the other clients?

sharp axle
crimson sleet
#

perhaps I was unclear

#

the boid members are not ghosts

#

because I have seen no reason to make them so

sharp axle
#

Spawning them seems to be a reason to me. But your only choice in that case would send an RPC to instantiate the entities and then have another system created to keep track of them

crimson sleet
#

would making hundreds of these things ghosts not just introduce an element of lag

#

their exact position does not matter at all

#

i just need x amount to be on x player and for that to be consistent between clients

#

and for their movement to be fluid

#

that's why I didn't make them ghosts

#

is that not the case?

tame slate
crimson sleet
sharp axle
crimson sleet
#

in fact, does client 1 even know that there is a connection client 2?

sharp axle
#

No, the clients would not know about each other

crimson sleet
#

hmm yeah so how then can I send an rpc from the server to the clients with a 'reference' so to say to the ghost object that it needs them spawned to

sharp axle
#

I would have an enableable ghost component on the player that you could use to trigger your boids

crimson sleet
#

hmmm maybe but then each client would need some way of disabling it for themselves after the spawn is done for that specific client but if it was a ghost that's obviously not possible

#

perhaps I can have a ghost component that just says x amount of objects need to be currently spawned for this player but checking that and counting often seems costly

sharp axle
#

If its a timer then the local system can handle that on its own

crimson sleet
#

its not

#

to elaborate it's a party game where you play as grim reapers collecting souls that follow you around

#

and you can steal other people's etc.

#

so I am making a system whereby say you complete a challenge that gives you x amount I need to communicate that to all clients

#

but I really don't want to make them all ghosts because the calculations for their movement is fairly complicated I don't want for tiny bits of lag to make them teleport all over the place and when you think you are walking into them to steal it its actually somewhere else but your connection just hasn't caught up right

#

like I prioritise most that when it looks like to the client they are here then everything you do to interact with them happens

#

thats why I didnt make them ghosts and just simulated on each client

sharp axle
#

NFE client prediction is actually pretty good. But if they aren't interacting with other players directly then its fine from them to be local only. A ghost field with the amount of souls for each player should work as well

crimson sleet
#

yeah I think that's the fallback option but it's ideal if when you steal another player's soul it doesnt literally just despawn it and spawn for you I need to change that soul's target boid to the proper player's

#

and that system means that isn't possible

#

could a ghost list containing the player's ghosts work???

#

thereby if I say ghostlist index 1 wants to spawn souls then it would be consistent across clients?

crimson sleet
#

because it is hard to say soul number 117 needs to move to player 3 on a different client

#

though I could just transfer across a random one for the other clients
cause the visual of them flying about to different players is a very cool one that I would like to preserve

#

and they are close enough together you probably cant even tell

crimson sleet
river gazelle
# tame slate I mentioned Cloud Code several times. Using it with Cloud Save is the way Unity ...

and I asked you every time how that stops my client from getting all my passwords?
I probably just don't properly understand how fishnet works, which I've mentioned several times as well and is exactly what I'm asking

If I add code in my game to save/load data through cloud code and then cloud save, then my client can just use that code to save whatever data they want.
So there must be some way to add code to my game that doesn't go to the client?

I clearly don't understand what you're trying to tell me, so repeating it isn't going to work.

#

For clarification, I do understand how a normal server works, I've worked with UGS and Cloud Code & Save.
I do not understand how FishNet works

tame slate
river gazelle
#

my questions have nothing to do with cloud code???
the way I sent a request to cloud code is by putting it in my game
my server is literally equal to my client
I start my game and click "start server" and then "start client" and then I can open another window to connect with another client if I want
there is no server specific code in the game

so it doesn't matter what cloud code does, if my client can just alter their files and pretend to be the server and send the same request

#

My issue is that there is no server for fishnet, it's just another client acting as a server.
Everything in the server is also in the client, as far as I know as a complete total beginner with FishNet.

So it would be impossible for cloud code to tell the difference between a client and a server, because they are identical

tame slate
#

From your perspective there are no 100% trustable parties in a Client-Host setup. Just because someone starts a Client+Server instance via FishNet in your game does not make them trustworthy. So spending time trying to 100% accurately differentiate between the two is meaningless.

sharp axle
river gazelle
tame slate
sharp axle
red garnet
#

I am using net code for game objects and I want to set the playerController parent when the scene switches.

When the scene changes I run this code transform.SetParent(targetParent.transform);
But I get this error "NetworkObject can only be reparented under another spawned NetworkObject ". The object I am trying to set as the parent, does have the network object component. Any ideas?

tame slate
sharp axle
halcyon girder
#

im working on multiplayer, and the character controls the other players movement, not their own. ive been struggling on this for an hour so i just decided to come here

im using photon

halcyon girder
#

for the player movement?

snow imp
#

yes

halcyon girder
#

how do i like put it in the special black box

#

so its not spam

#

''' hi '''

#

''hi''

#

'hi'

snow imp
#

i think its just if its big enough

#

not sure though

halcyon girder
#

anything yet?

halcyon girder
#

mhm

#

idk why

tame slate
#

That would mean that IsMine is returning true on Player Object 2 for Player 1 and vice versa. Which means the ownership of your objects is probably backwards.

#

I don't work with Photon, so I'm not sure how ownership is generally assigned - or how you're doing it for that matter

halcyon girder
#

thanks a lot man!

#

im happy i know the issue

halcyon girder
#

It was because i didnt attach the script to duplicate the camera for each player.. silly mistake

#

Ok now i can sleep at ease

red garnet
tame slate
red garnet
#

Is OnNetworkPostSpawn a event that I would need to subscribe to in my controller?

tame slate
red garnet
#

Hm how would I make use of it then?

tame slate
#

protected override void OnNetworkPostSpawn() { } should work in any NetworkBehaviour

red garnet
#

actually seems like that method is never hit?

idle flare
river gazelle
#

How do big competitive games handle terrain collision? How do they prevent/check for cheating where players just walk through walls?

bright coral
cursive sparrow
#

Hey

dry maple
#

So, there is no checking at all, it just works.

polar girder
#

Hi, can someone familiar with the Boss Room sample explain the advantage of using this ActionID wrapper instead of just a simple int, thanks :)

#

As explained, it just wraps an int "ID" value

river gazelle
dry maple
dry maple
polar girder
#

it doesn't have any helper methods, just boilerplate

#
public int ID;

        public bool Equals(ActionID other)
        {
            return ID == other.ID;
        }

        public override bool Equals(object obj)
        {
            return obj is ActionID other && Equals(other);
        }

        public override int GetHashCode()
        {
            return ID;
        }

        public static bool operator ==(ActionID x, ActionID y)
        {
            return x.Equals(y);
        }

        public static bool operator !=(ActionID x, ActionID y)
        {
            return !(x == y);
        }

        public override string ToString()
        {
            return $"ActionID({ID})";
        }
dry maple
# polar girder it doesn't have any helper methods, just boilerplate

Then most likely to simply add type-ness to the integer, since a raw int can be misinterpreted and used incorrectly while when wrapped in such a struct it would be differented from raw ints.

I think it's better not to focus too much on things like this because something like this fully depends on the original writer preferred way of doing things, and usually there is no strong reason for it.

polar girder
#

Thats what I figured, just was wondering if there was something I was missing

dry maple
#

I have noticed this sample to be very over engineered.

polar girder
#

For a sample thats meant to be tinkered with its a good thing if anything in my opinion

#

But that might just be me as I'm specifically using it to learn about system design

dry maple
#

Good system design does not mean overengineered. Things should be kept as simple as possible.

This is the KISS principle, which is very important in proper design.

sharp axle
#

I am not a fan of Boss Room

#

It is a good exercise in jumping into a preexisting project with no idea how/why anything was built.

polar girder
#

For what it is and the actual content, sure it's overengineered yeah

#

If you guys have any better resources please let me know for sure

sharp axle
#

Depends on what you want to learn

polar girder
dry maple
#

Best way to learn is to do things yourself.

That's how you learn why someone did X instead of Y. Because you might do Y initially and discover its subsequent issues, which causes you to rewrite and do X instead and find better results.

Otherwise you wouldn't know why someone did this instead of that, etc.

sharp axle
# polar girder If you guys have any better resources please let me know for sure

The NGO bite sized samples are not bad
https://docs-multiplayer.unity3d.com/netcode/current/learn/bitesize/bitesize-introduction/

If you are into long form video tutorials, Code Monkey recently released some multi hour courses on the NGO and NFE.

The Bitesize Samples repository provides a series of sample code as modules to use in your games and better understand Netcode for GameObjects (Netcode).

crimson sleet
#

how to get ghost entity from ghost id on client?

crimson sleet
#

That returns an int from an array of ghost instances

#

But nvm I was being stupid you just query ghost instance

torn lance
#

I'm trying to set up multiple play mode instances for testing multiplayer, and I see there's this tag that I can change for each instance. How do I read the tag to change the behaviour of my scripts, though?

sharp axle
torn lance
fluid lintel
#

Hey guys - Sorry if this has been asked before, but how do you get around sending a Transform over the network? Do you split it into its respective Vector3's and send those? Or what are your clever tricks?

tame slate
#

If I want Transform data from the sender's perspective at the moment in time they send the info, then yeah, I'd probably grab the position/rotation/scale and send it over.

#

If you're okay with the Transform data being based off of the receivers perspective at the moment in time they receive the message, then I'd probably send a NetworkObjectReference or NetworkBehaviourReference and just grab any Transform data from that on the receivers end.

fluid lintel
ruby hedge
#

idk if this is the right channel for this but how do i get access to the unity cloud organization

sharp axle
ruby hedge
#

i am the owner

sharp axle
ruby hedge
#

apparently the subscription didnt go through before

#

devops wasnt enabled

#

i didnt notice

#

must have been a connection error

granite moat
#

Hi everyone, i'm making a basic multiplayer fps and have some question about setting parents.
I'm using the animation rigging package to "attach" the weapons to the player, and wanted to set the weapons as children of a Rig, like it's show on this video: https://www.youtube.com/watch?v=s5lRq6-BVcw&t=525s

However, from what i understand, in order to do that, the rig itself would need to be a prefab with a network object, and i would have to manually spawn it first, is that correct?
In fact, not just the rig, but every part of the player visual would need to be turn into a network object.

I'm wondering if there is a better approach to this

Working with humanoid animations in Unity

Animation is a crucial part in games and Unity’s Animation system has been supporting projects for several years. In this video we will show you how to use the Animations systems in Unity to import existing characters and animations into your project. We’re going to look at key tips and techniques for w...

▶ Play video
granite moat
pastel tendon
#

So I'm trying to call a ServerRpc from the client when it presses click to use my flashlight and toggle the light in all clients.
The thing is that it gives me a "KeyNotFoundException" every time I click when calling the ServerRpc, not really giving me any more insight.
FlashlightObject's class inherits from UsableObject (a custom class to make everything modular) which inherits from NetworkBehaviour.
The flashlight's GameObject with the flashlight script is inside my player's object holder inside a NetworkObject.
Can someone tell me why this happens and how to fix it? It's been haunting me for the past two days and I've searched everywhere for a solution. 😭

fluid lintel
#

Do you guys know why this is returning a null PlayerObject for a client who connects?

public override void OnNetworkSpawn()
{
    base.OnNetworkSpawn();

    playerUi = GetLocalPlayerUi();
}

private PlayerUI GetLocalPlayerUi()
{
    return NetworkManager.LocalClient.PlayerObject.GetComponent<PlayerUI>();
}
pastel tendon
flint harbor
#

Hey guys, i have tried the Unity Friends Sample, and its quite nice that you can get real time updates over ur friends (online status & bio) send and receive friend requests.
I want to know if there is anything related to custom notifications between friends, my objective is to aim for a party invitation system, so i just need to know how to send custom "message" with callback to the sender once the receiver chose to accept or cancel.

Thanks 🙂

red garnet
#

Is it normal for the console to spam these random looking messages when I start my game in the editor?

blazing arch
#

Hi, When I change something like the colour of a sprite of a network object, will it automatically sync across all clients, or will I need to create a client RPC

void fiber
half quarry
#

Im doing some advance netcode for gameobjects INetworkSerializable work. Id like a second opinion on some of the design choices Im considering. My basic issue is I have a set of """Layers""". Each Layer can contain a List of """Features"""". Each Feature can be individually editted by who ever is currently using the drawing tool. I was considering a NetworkList of NativeArrays<Feature>. In this, each element of the list would be a layer, and the NativeArrays would be the individual features. Im somewhat concerned that this approach wont send the deltas in the individual features correctly though. Thoughts?

#

Id like to avoid spawning in additional network objects if possible. While it would be trivial to just make each layer its own network object, they're all handled through the same system and its just extra clutter

#

@blazing arch You likely need either a network variable or a RPC to sync the change. Any code thats not 'networked' will be executed as if your running in single player (Assuming your using Netcode For Gameobjects)

#

Personally, Id go with a NetworkVariable for your usecase, that way late joiners can also see the color change. RPCs are one and done, so if you miss the RPC, you miss the change in color

blazing arch
#

Or should I create a new variable, called spriteColor, and check the value of the spriteColor in the OnUpdate method

#

Or should I create an event, and subscribe all clients to the event, and call the event on the server?

half quarry
#

Network Variables can only be made from 'structs'. This basicly means that the 'type' of data must be fairly primative. This means that the sprite renderer, which is a class rather than a struct, cant be made into a network variable. Instead, what i would do is delcare a network variable that stores the color (private NetworkVariable<Color> _colorNetworkVariable = new();) and then subscribe to its OnValueChanged event

#

NetworkVariables are a way of synchronizing properties between servers and clients in a persistent manner, unlike RPCs and custom messages, which are one-off, point-in-time communications that aren't shared with any clients not connected at the time of sending. NetworkVariables are session-mode agnostic and can be used with either a client-serve...

#

The basic workflow would be that you would setup a public void ColorChange_Rpc(Color spriteColor) rpc that would send a color to the server. The server would then update the value of the color variable. Finally, this change is sent to all the clients, who would then execute the code to change the color of the sprite renderer

blazing arch
#

ahh, thanks a lot

faint plume
#

hello! quite often I get a Rate Limited Exception from GetJoinedLobbiesAsync(), even if I know for sure I haven't called it for a very long time. is it possible that it happens because I did another lobby request right before? I assumed their rate limits would be like, individual per function, seeing as they are listed as separate in the Rate Limits doc

blazing arch
faint plume
#

Nah

hazy hollow
#

hii, im using Unity 6 trying to get a networking object to spawn and move, and currently works, but when I spawn 2 cubes, both players move around when touching the screen (its also a mobile game). I ran into a HasAuthority() so for my movement I have some debugs to track and when I run the game in the editor the debugs spit out correctly (host debugs Client owned, and player2 debugs Not Owned, but both objects are still moving around:

void FixedUpdate()
{
    if(!HasAuthority))
    {
        Debug.Log("Not Owned");
    }
    else MovePlayer();
}

// in MovePlayer I have the Client owned debug at the top of the function ***

#

void MovePlayer()
{
    Debug.Log("Client owned");

    if (Input.touchCount > 0)
    {
        Touch touch = Input.GetTouch(0);
        Vector3 touchPOS = touch.position;

        Debug.Log("TOUCH POS: " + touchPOS);

        // Create a ray from the camera through the touch position
        Ray ray = Camera.main.ScreenPointToRay(touchPOS);
        RaycastHit hit;

        // Cast the ray into the scene
        if (Physics.Raycast(ray, out hit, Mathf.Infinity))
        {
            // If the ray hits an object
            Debug.DrawRay(ray.origin, ray.direction * hit.distance, Color.yellow);
            Debug.Log("Did Hit");
            Debug.Log("HIT POINT: " + hit.point);
            //transform.position = new Vector3(hit.point.x, hit.point.y, 0);
            targetPosition = new Vector3(hit.point.x, hit.point.y, 0);


        }
        else
        {
            // If the ray doesn't hit anything
            Debug.DrawRay(ray.origin, ray.direction * 1000, Color.white);
            Debug.Log("Did not Hit");
        }
    }
    transform.position = Vector3.MoveTowards(transform.position, targetPosition, speed * Time.deltaTime);

}

flint harbor
tame slate
#

There's a callback for when a message is received. You would just have to put in some sort of "InvitationResponse" data in the message, and have it be read through the callback to see whether it was an Accept or Decline.

tame slate
hazy hollow
#

how do I specify movement based off who owns the client? Ive tried isowned/hasuathroity and netObj.SpawnWithOwnership(clientId) ?

tame slate
cobalt fern
#

Hi guys! I'm using Distributed Authority in webgl project. In editor it works, but after Build and Run it doesn't. Specifically in Try and catch block it doesn't provide answer after await Multiplayer.Instance.CreateSessionAsync(options);

            {
                Debug.Log("Starting session..."); // this message is printed
                
                // options setup code which use distributed authority
                
                ActiveSession = await MultiplayerService.Instance.CreateSessionAsync(options);

                Debug.Log($"Created session with ID: {ActiveSession.Id}"); // doesn't print this mesage
            }
            catch (Exception e)
            {
                Debug.LogException(e); // doesn't print this message either
            }
            finally
            {
                Debug.Log("final block"); // doesn't print this message either
            }

Anybody have any thoughs why this doesn't work?
P.S I use UniTask, as somebody said that threads won't work on webgl build

hazy hollow
#

im trying to set up a lobby rq for online multiplayer and trying to follow the docs, kinda struggling bouncing around different documentation pages and what not ngl. Anyways I installed the services package and copy/pasted the create lobby example of the docs but im getting an error on not importing it correctly ig:

using Unity.Services.Lobbies;

/// ...rest of code

string lobbyName = "new lobby";
int maxPlayers = 4;
CreateLobbyOptions options = new CreateLobbyOptions();
options.IsPrivate = false;

Create lobby isnt being read, and under Unity.Services.lobbies (Services), im getting an import error

tame slate
hazy hollow
#

im trying to learn networking and just looking up tutorials. I found some nice CodeMonkey ones but they were using a deprecated lobbies package so im just into a rabbithole at this point

#

ill look into sessions then and see if thats easier, lobbying seems to be overcomplicating things

lusty veldt
#

Do we have MMR now?

#

mmr based match making system

sharp axle
cobalt fern
#

Hi, Can somebody explain me why MultiplayerService.Instance.CreateOrJoinSessionAsync(_sessionName, options); is able to connect by using _sessionName (which is just a text from input field) instead of actual sessionId?

sharp axle
#

There is a join by ID function, but you already have an ID then there is no need to create a session

stoic crypt
#

Hey I have an issue, when 2nd player joins

Player Spawned. IsOwner: False, ClientID: 1, LocalClientID: 0 UnityEngine.Debug:Log (object) MultiplayerPlayerMovement:Start () (at Assets/Futbol/MultiplayerPlayerMovement.cs:24)

i can only move the player 1, the session owner, the second player does not register input

cobalt fern
sharp axle
cobalt fern
#

That's what I'm doing CreateServer method:

           {
               Name = _sessionName,
               MaxPlayers = _maxPlayers
           }.WithDistributedAuthorityNetwork();

           _session = await MultiplayerService.Instance.CreateSessionAsync(options);```
In JoinServer method:
```_session = await MultiplayerService.Instance.JoinSessionByIdAsync(_sessionName);```

And this is CreateAndJoinMethod:
```            var options = new SessionOptions() {
                Name = _sessionName,
                MaxPlayers = _maxPlayers
            }.WithDistributedAuthorityNetwork();

            _session = await MultiplayerService.Instance.CreateOrJoinSessionAsync(_sessionName, options);``` - have no idea why this is working, and other two methods don't
sharp axle
cobalt fern
sharp axle
cobalt fern
stoic crypt
sharp axle
stoic crypt
#

oh i was checking isOwner instead

#

Just realized that means the session owner and not the local

#

Still, 2nd player is unable to move

#

!code

raw stormBOT
stoic crypt
sharp axle
#

hasAuthority can work too

stoic crypt
#

same results using hasAuthority

sharp axle
stoic crypt
#

i can move the player that creates the session

#

but not the 2nd player joining

#

this is the code

#

I'm unsure if I have to change anything on the network manager?