#archived-networking

1 messages ¡ Page 9 of 1

sharp axle
#

Yea. the host can call a ServerRpc

#

Totally misread that, but yea it can call a clientRPC as well. Should get broadcast out like normal

versed lily
sharp axle
versed lily
#

so the method itself must be on a network object. Good to know 🙂

marble urchin
#

Anyone run into a situation where a ServerRpc call will sometimes simply not be received by the server? The same function works 99.9% of the time but as I detail in this forum post I sometimes get to a point in the game where that same call, even though I verify it's initiated on the client, is never received by the server.

https://forum.unity.com/threads/some-serverrpc-calls-not-working.1393840/

sharp axle
marble urchin
# sharp axle RPCs are sent reliably by default. So in theory that should not be happening

Any idea how to troubleshoot this? It's a blocker for sure. I've verified via log statements and breakpoints in the debugger that the client is attempting the ServerRpc call and the server is not getting it. This is obviously a case where I'm debugging on the host machine and the host player is encountering the issue. But I've gotten this behavior with the client sometimes as well.

sharp axle
marble urchin
#

No. I can try a different play and it will work. And another player can drop to the same spot. But it continually rejects that particular call from that player (note that this is the same ServerRpc function used for every card that’s dropped).

sharp axle
tribal coral
#

Good morning!

#

Back to it then!

#

So, I made a few changed to how my customizer works. As the player is done customizing, an array of indexes is created, indicating which index each part character is using (Got a list of every modular piece in a list)

I can use this array to loop through this index list and activate each index accordingly.

How could I go about updating everyone when a player does this change?

sharp axle
tribal coral
#

Currently working on the whole ClientRpc and ServerRpc, will do that list later on

marble urchin
# sharp axle The Network Profiler might help you track down where the call is failing. I'm pr...

Okay, my initial assumption was false. The ServerRpc function is getting called. I thought it wasn't because apparently, when debugging, I don't see log messages from the server function nor do I hit breakpoints inside them (and I can't step into them). This makes debugging server issues tricky.

By passing more detailed log messages back to the client I've determined that the server is rejecting the drop in some cases. I must have an issue in my IsLegalDrop() logic I need to fix. Time for some unit tests I think.

novel kettle
#

is it wrong to leave all multiplayer components (networkbehaviours, etc) on the player prefab when they enter singleplayer? Will there be any conflicts or can I keep using the netcode components without any issues because the player is not a host nor a client when in singleplayer?

#

Because I don't think having both a multiplayer and singleplayer version of all of the player's prefabs is a good idea...

sharp axle
novel kettle
#

o really?

#

does that require an internet connection though?

#

I'd like to hear people's opinions on that approach

sharp axle
novel kettle
sharp axle
novel kettle
#

sure, but what if the steam transporter is used?

sharp axle
flint scarab
#

Hello brothers,
can i stream and receive Renderer.material of objects in OnPhotonSerializeView?
and if i can how, what is the code i should put
for example any game object state

can be streamed with ---> stream.SendNext(GameObject.activeSelf);
And readed by --> GameObject.SetActive((bool)stream.ReceiveNext());

#

or how can i sync colors without OnPhotonSerializeView
if there is not a way with it
im trying to make when i press a button player tshirt color change
and i want to sync new color for all clients (for the player who press the button not all players t shirt get changed i ment only 1 player)

hearty dock
#

you wouldn't stream the material itself

#

just send either:

  • an int that you map to the color somewhere
  • the color itself
flint scarab
#

its a texture

hearty dock
#

Then have your code set the material as needed

hearty dock
#

Because if not you can just reference it with some kind of small ID

#

you don't want to be sending large amounts of data unnecessarily over the network

flint scarab
#

using System.Collections;
using System.Collections.Generic;
using UnityEngine;
using Photon.Pun;
using Photon.Realtime;
using UnityEngine.SceneManagement;
using UnityEngine.UI;

public class RandomMaterialScript : MonoBehaviour//, IPunObservable
{
public Material[] randomMaterials;

public PhotonView view;


// Start is called before the first frame update
void Start()
{
    view = GetComponent<PhotonView>();

    if (view.IsMine)
    {
        int TheRandomMetNumber = Random.Range(0, randomMaterials.Length);
        Material TheRandomMet = randomMaterials[TheRandomMetNumber];
        view.RPC("RPC_SendShirtColorToClient", RpcTarget.AllBuffered, TheRandomMet);
    }



}

[PunRPC]
void RPC_SendShirtColorToClient(Material randomMaterial)
{
    gameObject.GetComponent<Renderer>().material = randomMaterial;
}

public void OnPhotonSerializeView(PhotonStream stream, PhotonMessageInfo info)
{
    if (stream.IsWriting)
    {
        ;
    }
    else if (stream.IsReading)
    {

    }
}
// Update is called once per frame
void Update()
{

}

}

#

This is my code now

hearty dock
#

Yeah don't do this

#

don't try to send the whole material

#

just send an identifier of some kind that your game knows how to find the material in its own files

#

you could use Resources.Load for example, and just send the string of the file over the network

#

or map all your materials to an int id, or an enum

#

Even better since you have this:
public Material[] randomMaterials; you can just send an int

flint scarab
#

i will put it in Resources folder

hearty dock
#

and every client will know to just grab randomMaterials[thatNumber]

flint scarab
#

that the player in

#

and how to change it only for the player who press E

solemn haven
#

Hello. I have build photon fusion's project. Want it to open 2 times, but when I click build.exe, it does not open in new window, I only get one game playing. How can I solve this?

acoustic sapphire
solemn haven
#

Thank you very much)

weak plinth
#

anyone know why im getting this error?

#

i registered my project as android too so idk why im getting an error abt iOS

sharp axle
solemn haven
#

Hello. can you help me to translate From PUN to Fusion? This code:

hybrid berry
hybrid berry
#

What are some ways to pass data to the server on game start? I'm building a 1v1 card game where both users would have their own decks, player info, et cetera. Matchmaker's TicketOptions seems decent, but I'm not sure if its suitable to cram everything in there.

#

Is it normal to handle something like this in OnNetworkSpawn?

sharp axle
hybrid berry
hybrid berry
#

Also, separate q - how would you handle bsending different data to different clients? For example, when a player’s turn start, i want to send that player the info of what card they’re drawing - whereas the other client should only know that the player has drawn a card.

sharp axle
hybrid berry
#

these are both exactly what i was looking for!

forest grotto
#

is this a unity GS thing or am i going smthing wrong

#

my server dissapear if i dont use it for a day

sharp axle
forest grotto
#

when i try to start a game it doesnt start the server or could be the timeout time to short for fresh allocation

sharp axle
#

With matchmaking it's probably timing out before the new server starts

forest grotto
#

240sec and i get the error of max server capacity

fathom meadow
#

can someone help me setup a simple rigid body box with netcode for Gameobjects? applying Network object, network transform, rigidbody and network rigidbody doesnt make the box movable on both host and client...

sharp axle
fathom meadow
#

wierd, in my project the box is only bumpable on the hosts side...

#

the client also has a collider tho

#

this is how my player is set up

#

this is what my box looks like right now (ignore the position)

sharp axle
fathom meadow
#

oh that is something i forgot to mention

#

i need to call on collision enter on the box, in another script and that doesnt seem to work with the box collider

fathom meadow
#

i am new to netcode :/

sharp axle
#

or try capsule collider on the player

fathom meadow
#

does not seem to help

#

created a separate box in another scene, to make sure its nothing else, but its still unpushable on client side

ember kettle
#

hey, is there a way to do network discovery with NGO? I'm trying to find all local IP addresses in a LAN that are running the game

#

ik UNet had this functional, and that NGO probably doesn't since it's newer, but is there a way I could do this myself?

sharp axle
# ember kettle hey, is there a way to do network discovery with NGO? I'm trying to find all loc...
GitHub

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

ember kettle
weak plinth
#

anyone familiar with playfab what do i need to do here

hybrid berry
#

Up until now I've just been stuffing data into JSONs, but it feels natural to move away from this for an online, competitive game. What are you guys using for database stores? Do you rely on JSONs or a cloud SQL provider like AWS?

hybrid berry
sharp axle
hybrid berry
hybrid berry
sharp axle
hybrid berry
#

and is this stored on the client side? how do you prevent malicious clients from adding cards to their collection/deck that they shouldn’t have?

sharp axle
hybrid berry
#

that’s my main worry, figuring out how to store this without exposing anything to the client

stark light
#

So I've got a system where players can spawn their individual avatars from Ready Player Me at runtime. This loads the glb from there and parses it into a nice game object.

Struggling with how to sync/spawn that new prefab across other clients since that object isn't in anyone else's network prefabs list.

unreal sky
#

greetins

#

ok so basically

#

is it a bad idea to have a networkvariable only be around for a single frame?

#

i notice that when i have it so clients have a variable up for a single frame that it sometimes doesn't register server-side

hybrid berry
austere yacht
unreal sky
#

and a serverrpc to turn it off :)

austere yacht
#

A buffer has a fixed size, it wouldn’t be a buffer if it could grow. The expected usage pattern of a buffer is to fill it temporarily with data to either aggregate it over time or to process a large stream in increments

wild wedge
#

Im using matchmaker and I have rules. Players have skill value, and teams should be balanced in reference to that skill. How can i retrieve information about player's team?

austere yacht
#

individual units of transmitted data in netcode should be of a fixed/statically known size to minimize allocations and memory pressure caused by variable size structures, the way to handle large/variable data amounts is through the use of buffers as described above. If there is a reason to size buffers dynamically the architecture would probably benefit from a revision

austere yacht
#

idk this depends on many details. when using a framework that already aggregates messages per tick, you’d just send inventory changes individually and design it in a way that only minimal info about the items needs to be exchanged, potentially in multiple messages or by representing all items by the same fixed size structure (but that depends on context)

unreal sky
#

heya!

#

considering that my game is run entirely server side

#

what are the top reasons for why a client could be running slower than the actual server

ionic wind
#

Hey guys, I am trying to create a multiplayer with a single dedicated server. However, I was thinking about creating multiple rooms inside the server.. Is it possible to achieve this using a single server? My game will consist of multiple room maps and I want them to be independent of each other (Like different virtual worlds).

Also, I was thinking about using NodeJS server which will store a list of rooms and will work as a room query system is this a good idea?

unreal sky
sharp axle
#

Matchmaking rules

sharp axle
unreal sky
unreal sky
ionic wind
neat totem
#

Hey all, has anyone here worked with photon fusion for networking? Or knows a good video on it?

hybrid berry
# neat totem Hey all, has anyone here worked with photon fusion for networking? Or knows a go...

i haven’t, but it’s one of (if not the most) popular networking solution for unity. there should be tons of material or youtube & their docs

https://doc.photonengine.com/fusion/current/getting-started/fusion-intro#

sharp axle
muted basin
#

Anyone know how to code with networking for games

sharp axle
viral briar
hybrid berry
wintry flume
#

I've got some weird jittering going on with my camera, im using cinemachine and photon fusion with the networkcharactercontroller. I know its something related to what time the camera updates, but after switching to manual update and updating in the network's fixed update, it still doesn't get rid of all of the jitter. it even shows a bit of rubber-banding. any ideas?

quartz atlas
#

morning, some question about using remote config, i cant find prices, but i think this is not a free tool from unity, maybe is about the size used by my players ?

olive vessel
#

Have you created a dedicated server build?

#

Oh wait

#

Are you about to ask us how to run a Rust server?

#

Well then yes, make a server build of your game and run that

#

It's one of the options in build settings if you installed the module

#

Linux/Mac/Windows Dedicated Server Build

#

Then you'll be able to find the option in build settings when you build your game

#

Well yes, and you do not have the module

ember kettle
#

hey how can i check if a network object was spawned in the scene?

raven bear
#

For anyone who uses netcode for game objects, does anyone know the function that calls on the host whenever a client connects

raven bear
#

ty

hasty hazel
#

For anyone who knows mirror, I'm having a slight problem where my first player(who hosts) can interact with objects physically just fine but my second player has alot of difficulty.

unreal sky
#

ello

#

so

#

i have a networkobject on the server

#

with a networktransform

#

and on hosts it works just fine

#

but on clients it ungulates in ridiculous ways

#

even clipping through walls

distant dirge
#

Is there a proper way to transfer ownership of network game object from client to host and in opposite ? For some reason with this code I am getting, Client wrote to NetworkVariable ... without permission, Why I am getting this error, (I am trying to transfer ownership via Server rpc) ?

uncut bluff
#

at the moment that I am starting a host or joining as a client, were can I fetch the data of the current loading/connection?

#

so I can make a loading bar

#

for exmaple

#

or display a message while its connectig

hard creek
#

Hello, I have a client authoritative gameobject. When the object moves and collide a wall, I play a sound. My problem is that the sound is only played by the owner, other clients don't play the sound because OnCollisionEnter is called only on the owner side. So to play the sound on all clients, I would like to call an Rpc to tell to other clients to play sound but "ClientRpc" cannot be call from a client. What is the correct way to handle this use case ?

#

Currently the only way I can see is, call a servrpc, then the server calls a clientrpc. Seems to be very complicated for this use case.

versed lily
#

within a Host, when I call a ClientRPC (which will also run on the server), can I be sure that the host version of that RPC executes before continuing to the next instruction? ie is
MyServerRPC() { SomeClientRPC(); if(SomeValueSetInClientRPCcall == X) DoSomething(); } reliable?

hard creek
#

ManzellBeezy, I'm new at NetCode so I'm not sure, but from what I observed, RPC calls are synchronous (contrary to NetworkVariable synchronization which seems to be asynchronous).

versed lily
#

synchronous meaning, it waits for code completion before moving forward?

hard creek
#

yes this is what I have observed

#

@versed lily from the doc I just read:
An RPC function typically doesn't execute its body immediately since the function call is a stand-in for a network transmission. Since the host is both a client and a server, local RPCs targeting the host-server or host-client are invoked immediately. As such, avoid nesting RPCs when running in host mode as a ServerRpc method that invokes a ClientRpc method that invokes the same ServerRpc method (and repeat...) can cause a stack overflow.

#

So it is synchronous only when "local"

versed lily
#

Got it. Avoiding nesting RPCs is proving to be a little bit of a challenge but I think that means I need to refactor anyhow.

#

Thanks.

unreal sky
#

why do network rigidbodies desynchronize?

#

i set the rigidbody2d.velocity of a server networkobject, and it just lags about on the client, whereas on the host it works just fine

feral oak
#

Question, with Unity Authentication if you choose to give the player an anonymous login does it give that player the same login every time?

#

Nvm looks like it does, I figured it would. Just wanted to ask.

hasty hazel
#

!!SolgaleoEnjoyer, I think me and you have the same problem. I'm using mirror, and I have this ball object which has a transform on it. My host can interact with the ball's pyshics just fine to knock it around, but my client can barely move the ball and the ball just behaves weirdly with it, almost like their physics won't interact together or something

brittle valley
#

How can i spawn 2 different player prefab using netcode any idea ?

austere yacht
sharp axle
sharp axle
# brittle valley How can i spawn 2 different player prefab using netcode any idea ?

This Unity Multiplayer tutorial will teach you how to create a character selection menu using Unity's Netcode For GameObjects in 2023. For project files access, check out the repository here: https://github.com/DapperDino/Multiplayer-Character-Select
------------------------------------------------------------------------------------------------...

▶ Play video
native moon
#

can you send arrays via RPCs?

sharp axle
# native moon can you send arrays via RPCs?
raven bear
#

Guys is it okay to send an rpc and then send an rpc?

#

Im trying to send data to a client from host when they connect, but the on connect function runs on client. So I was thinking that I can send an rpc to the host, which will then send an rpc back with the data

sharp axle
raven bear
#

`private void OnConnectedToServer()
{
SayHelloServerRpc();
}

[ServerRpc]
public void SayHelloServerRpc()
{
    Debug.Log("Hi Server");
}`

Does anyone know what I did wrong? I'm not seeing any debug on the host

sharp axle
raven bear
#

sorry for being a dumbass but how would I subscribe to OnClientConnectedCallback? I'm kind of new with events and stuff

#

wait nvm

#

I think I figured it out

#

actually yeah I could use some advice

#

NetworkManager.OnClientConnectedCallback +=
Do I put the function I want to use on the right side?

sharp axle
raven bear
#

Yeah I got it working, I needed to subscribe and do the client Id

#

tysm for the help though

boreal zodiac
#

Actually, this is a better place to ask this problem. Very fundamentally, been trying to use ParrelSync and Mirror, and it outright throws errors based on object hashes not matching. I'm working on a game with a lowish player count, high object count, and wondering what workflow I can and should use. Right now its Mirror + ParrelSync, but they don't play nice. (Mirror also hates disabled objects to boot)

Is there something else I should be using to do this?

austere yacht
boreal zodiac
vocal bane
#

Is there a way I can sync the game state to a new client when they join the game? Currently when a new client joins mid game, their game state is unchanged from the original game state.

boreal zodiac
#

I'm beginning to think I'm just going to have to have two computers at my desk (to test multiplayer)

austere yacht
sharp axle
boreal zodiac
#

I'm not sure what could be causing it. I'll probably have to do a complete start-from-scratch build

austere yacht
boreal zodiac
austere yacht
#

maybe try without resilio

#

or really an automatic sync things, git is fine

boreal zodiac
#

I'm not even sure that was added until well after I found the error... hm. I created a multiplayer menu scene in order to start working with Mirror - while I have the HUD starting and connections working, none of the menu objects I created with network behaviors actually work. (they all throw errors when I create them, and none create a synced version on the other side)

boreal zodiac
#

So the original is running host (server+client). the clone jumps in as a client only on localhost. this is all with the provided mirror network HUD. the break is during OnServerAddPlayer. I run the base function to generate network player agents for each party (the player prefab). where things break is the custom function to create a networkbehavior prefab object, LobbyPlayerData.

The client tosses a "spawn scene object not found for A92..etc. make sure that client and server use exactly the same project. This only happens if the hierarchy gets out of sync." and never spawns the lobby objects.

unborn pecan
#

Hey yall I am working on making a game i made into a multiplayer game using photon, I have these "pieces" that i do not want to have an "owner" because it makes moving the pieces on the board really annoying. is there a way i can have network transform object that do not have an owner

boreal zodiac
#

It could be the client isn't getting the prefab for some reason? I have it in the "RegisteredSpawnablePrefabs" list though

#

Do I need to use a different function than Instantiate?

austere yacht
boreal zodiac
#

that seems to be it

#

hm. but it's not enough...

#

I still get that error. Though I'm creating the data objects at least

vocal bane
sharp axle
vocal bane
#

Okay cool thanks.

boreal zodiac
# austere yacht `NetworkServer.Spawn()` after you instantiated the network object on the server

It seems like, for whatever reason, the NetworkManager.Instantiate call is what is causing this error spawn scene object not found for A92EE62..etc..CF. make sure that client and server use exactly the same project. This only happens if the hierarchy gets out of sync.
Could not spawn assetId=0, scene=A92EE62... netId=1

So it seems to be related to the scene, somehow? Or am I misunderstanding?

#

I'm probably spawning the player before the actual prefab list is loaded

#

hm. I'm doing it during OnServerAddPlayer... so I'd have to wait for something on the client and request for the rest of the scene... or something?

solemn haven
#

Please, can you explain can I send RPC calls from ContextBehaviour? And what is difference between it and NetworkBehaviour, where should I use them? Thanks

vocal bane
#

How do I disable the Syncing Time To Clients message in console?

solemn haven
#

what is photonview.isMine equivalent in Fusion? How to check if I am the local player?

sharp axle
forest grotto
#

Can i get some help with Photon Fusion??

#

I need to update the Backfill ticket from Matchmaker to be able to join back/during the game. And i have to add and remove players from the ticket.

#

Now how can i get the UnityPLayerID when im using Fusion. I have a server/client setup. Server script is GameManager and it keeps the ticket updated/Refereshed. Now how can i get the players ID that has joined or left

boreal zodiac
#

Using OnServerReady, but it's still giving that error. It syncs, I just have no idea why it's giving that error first...

#

The issue is definitely with the Instantiate call. I am pulling the prefab from the spawnPrefabs list (on Network Manager) directly. so the prefab has been registered. the call is being done in OnServerReady now, so after the client has loaded the scene

#

ooor is it. hm. commented out the whole block, still getting the error...

boreal zodiac
#

Ah. Additive Scene Loading is still an issue in Mirror?

boreal zodiac
#

I removed additive scene loading, and I'm -still- getting that error

boreal zodiac
#

but only on the player prefab now

raven bear
#

Hey guys, I have a function to launch a projectile

private void LaunchProjectile(double itemDamage, GameObject projectilePrefab, Transform rotationObject, float projectileSpeed, float projectileLifetime) { { GameObject bullet = Instantiate(projectilePrefab, firePoint.position, rotationObject.rotation); bullet.GetComponent<NetworkObject>().Spawn(); Rigidbody2D rb = bullet.GetComponent<Rigidbody2D>(); Projectile projectile = bullet.GetComponent<Projectile>(); projectile.Projectiledamage = itemDamage; projectile.Projectilelifetime = projectileLifetime; rb.AddForce(firePoint.up * projectileSpeed, ForceMode2D.Impulse); } }

This works for host, but when I tried to make a copy of this function for spawning projectiles over a network, I got a strange error

#

anyone have any idea whats causing it? I'm new to rpcs and stuff so I might be missing something obvious

sharp axle
raven bear
#

Ah okay, ty

opaque ember
#

I'm having a problem with photon RPCs it keeps giving me this error and here is my script https://hastebin.com/share/yogevexoga.csharp

woeful cradle
#

there is a size changer in my game, i am using pun 2 and photon voice. im trying to look for a way that i can change the pitch of a users voice for other players to hear?

wide girder
weak plinth
#

I'm currently having an issue where I want to make a NetworkList<T> where T is a custom struct that contains another custom struct as a field. I am able to create a network list of each struct individually, but when I put one inside the other I get this error:

The type 'PlayingCardData' must be a non-nullable value type, along with all fields at any level of nesting, in order to use it as parameter 'T' in the generic type or method 'NetworkList<T>

Anyone know what might be causing this?

#

It even happens if my custom struct contains a unity provided struct, such as FixedString64Bytes

tight elm
#

I am trying to make a Multiplayer game using NetCode, and currently I am trying to implement other clients viewing a client's hand item.

I tried adding a NetworkObject to the GameObject for the ItemHolder (which is on the player's right hand game object), but I still can't really see the ItemHolder's sprite change on the other client when I change it on the main client.

Any possible way to do this?

sharp axle
sharp axle
tight elm
#

and of course then I can just make it position on the player's hand

#

but then that may visual annoyances, no?

#

it wouldn't rotate the way the player hand's rotating

#

and it would look as if it's frozen

sharp axle
tight elm
#

Thank you.

solemn whale
#

I am trying to solve which network service would allow me to solve this architecture diagram. Basically, I am processing a picture (in AWS Lambdas - I don't need help with that) and I need to send a notification to the clients that the picture is processing, and has processed. I think that PubNub is an option but is there a Unity hosted Multiplayer setup that would be better? I was looking at Remote Config but that seems to be more for the game rather than alerting the players. Any help would be appreciated.

opaque ember
#

@wide girder it's grabbing the photon view from this script

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

public class GetScript : MonoBehaviour
{
    public static PhotonView pView;


    private void Update()
    {
        pView = GetComponent<PhotonView>();
    }
}
#

because the photonview is on a prefab

wide girder
#

The script that the rpc is called in needs to be on the same GameObject as a PhotoView.

opaque ember
#

oh

#

but I need it to be on trigger

#

when your hand presses the button

wide girder
#

Need what? The rpc?

opaque ember
#

yes the rpc is called on trigger enter

wide girder
#

Then add a photon view to it?

opaque ember
#

to what?

wide girder
#

To the trigger go

opaque ember
#

so add it to the button?

#

I gtg I'll be back in 6 hours

wide girder
#

Or have a better code structure and call an rpc on the proper object instead.

mystic pelican
#

🔥 Join the multiplayer NGO webinar series! 🔥

Looking to build a small-scale cooperative multiplayer game with Unity?

Then sign up here to join us for this four-part series with our Multiplayer team!

➡️ https://create.unity.com/game-implementation-with-boss-room

We’ll dive into the Boss Room sample to explore building a production-ready multiplayer game with Unity and Netcode for GameObjects.

📆 The four webinar sessions will cover the following topics:

[Feb 16th] Episode 1: Game implementation with Boss Room
[Feb 23rd] Episode 2: Production-readiness, exposing your game to the internet
[March 2nd] Episode 3: Making your game resilient to your players
[March 9th] Episode 4: Our game dev processes

🎥 Sign up to the series once and you'll be added to every session, and receive recordings after the series is over.

dapper plover
#

what happens if my game runs at 30fps but i'm trying to read packets at 60hz?

#

do the extra packets get dropped by the operating system?

#

oh i think the extra packets would get read, like if it's 30fps and 60hz then 2 packets get read each frame

hard creek
#

Hello, I have a client authoritative gameobject. When the object moves and collides a wall, I play a sound. My problem is that the sound is only played by the owner, other clients don't play the sound because OnCollisionEnter is called only on the owner side. So to play the sound on all clients, I would like to call an Rpc to tell to other clients to play sound but "ClientRpc" cannot be call from a client. What is the correct way to handle this use case ?
Currently the only way I can see is, call a servrpc, then the server calls a clientrpc. Seems to be very complicated for this use case.

opaque ember
#

@wide girder I am back on are you able to help me now?

sharp axle
wide girder
raw thorn
#
using System.Collections.Generic;
using Unity.Netcode;
using UnityEngine;

public class PlayerRespawn : NetworkBehaviour
{
    //Put this on the playerParent.


    public override void OnNetworkSpawn()
    {
        PlayerSpawnPoints playerSpawnPoints = FindObjectOfType<PlayerSpawnPoints>();
        if(playerSpawnPoints == null)
        {
            Debug.Log("SpawnObject not found");
        }

        if (IsServer)
        {
            if(playerSpawnPoints != null)
            {
                transform.position = playerSpawnPoints.GetRandomSpawnPoint();
                Debug.Log("Spawned at a random posistion");
            }
        }
        base.OnNetworkSpawn();
    }
}
#

The playerspawnpoints always returns a null, but there's an object with the script on it in the scene.

#

Is this a limitation of OnNetworkSpawn() or anything?

weak plinth
#
  1. are you sure PlayerSpawnPoints object already exists by the time this is called? 2) Is PlayerSpawnPoints a network object?
raw thorn
#

checking that now, to make sure

#

it might be nr1, but I'm not sure on how to fix that.

#
    {
        NetworkManager.Singleton.StartHost();
        NetworkManager.Singleton.SceneManager.LoadScene(gameplaySceneName, LoadSceneMode.Single);
    }```
#

the scene gets loaded after the hosting bit

weak plinth
#

Well you could, for example, create an empty gameobject at the spawn point, then in your OnNetworkSpawn initialize a public transform for it, and set the spawnpoint equal to that gameobject's location

#

That way you'd at least be certain the spawnpoint exists in your scene by the time you're trying to access it

warm pilot
#

if anyone knows fishnet can i have some help with this error code line also fishnet is thw networking thing

NullReferenceException: Object reference not set to an instance of an object
NetworkHudCanvases.Start () (at Assets/FishNet/Example/Scripts/NetworkHudCanvases.cs:149)

weak plinth
#

Or you could spawn the PlayerSpawnPoint in OnServerStarted

raw thorn
#

Alright I'll look that up

#

Thanks for pushing me in the right direction.

weak plinth
#

Glad I could help, hope you get it sorted out

raw thorn
raw thorn
weak plinth
#

Have you also prefabbed the spawn point object and added it to the network prefabs?

raw thorn
weak plinth
# raw thorn No, because when prefabbed I can't change them anymore. Some maps might have 2 s...

Hmm. You can definitely change the properties of prefabbed objects after you spawn them on the server. Like if you spawn a prefabbed PlayerSpawnPoint, you will be able to access it and change its location etc, and spawn more spawns as needed. But perhaps I'm not understanding the architecture of your game properly. In any case that's pretty much all the advice I can offer since I'm pretty much a beginner myself - hopefully you get it working!

raw thorn
hard creek
#

From the docs:
Some collision events aren't fired when using NetworkRigidbody.

On the server all collision and trigger events (such as OnCollisionEnter) will fire as expected and you can access / modify values of the Rigidbody such as velocity.

I think that it is "On the owner" instead of "On the server" right ?

solemn whale
amber trench
sharp axle
forest grotto
#

to use Backfill feature. I have the server do the appeal ticket (ApproveBackfillTicketAsync()) does the server need to be signed in to use this. And if i do this does the player need to sed a backfillTicket or use normal CreateTicket function becouse for some reason i cant get it to work

hard creek
#

@sharp axle Are you sure ? I have a ClientAuthoritative object and the OnCollisionEnter is called on the Owner (client) side and not on the server side.

#

the object is created using: SpawnWithOwnership

sharp axle
hard creek
#

@sharp axle Yes I have a client network transform

sharp axle
hard creek
#

I have an object in an area which triggers an "OnTriggerEnter". Then:

  1. I disable the object (using client rpc)
  2. I set the object position outside of the trigger area (the position is updated by the owner and synchronized by a client network transform)
  3. I enable the object (using client rpc).
    The problem is that, on some clients, "OnTriggerEnter" is called again because the object position has not been updated before the object enable.
    Could you please tell me how to handle this use case ?
#

Any idea @sharp axle ?

sharp axle
forest grotto
#

anyone know why im getting this error when trying to remove player from Backfill ticket??

sharp axle
hard creek
forest grotto
#

um one more thing how do i know if my backfillTicket is working

sharp axle
unreal sky
#

ello good humans (or robots)

#

i am having a hard time syncing a fast-paced object over the network. When I select the interpolate setting, it results in the object
'syncing,' but that only means that it gently floats along the trail of the server, which ruins its movement.

sharp axle
#

a quick and dirty way is to have the clients save their Player ID in a Network Variable.

sharp axle
unreal sky
#

alrighty then

#

i have an idea for that anyway

#

thanks <3

warm pilot
#

i need help with this fishnet error code line fishnet is the network

NullReferenceException: Object reference not set to an instance of an object
NetworkHudCanvases.Start () (at Assets/FishNet/Example/Scripts/NetworkHudCanvases.cs:149)

raw thorn
warm pilot
#

Ok

gray pond
inner forge
#

How good is the new official Network package? I'm talking about the NGO (Netcode for GameObjects). Is it up to date with the Mirror or FishNet features/ease of use/performance wise?

tepid forge
#

Does anyone know if there is a good guide for photon quantum out there? I have searched everywhere and cant seem to find almost anything.

sharp axle
distant mason
#

I have some trouble with the Despawn function. According to the documentation:
"to despawn but not destroy a NetworkObject, you should call NetworkObject.Despawn and pass false as the parameter. Clients will always be notified and will mirror the despawn behavior."

But when I try this the client destroys the game object even if the server called Despawn(false) and the server does not. Is this the intended behavior?

sharp axle
distant mason
sharp axle
distant mason
weak plinth
#

So I'm making a game and I just started with networking
I have world generation, and I am worried that if the player enters a world he will see clients in other worlds instead of the same world he's in.

I am using the Netcode package & Multiplayer Tools package
How would I go about making it so I could only see people in the same world??

forest grotto
weak plinth
#

I have no idea where I'd have to start

#

and I don't know how I would split the server into multiple

forest grotto
sharp axle
#

Syncing generated worlds

forest grotto
#

Since i cant find anything online Im just going to ask here. A little problem i have been having with the backfill tickets and using matchmaker to join back into a running server. I can start the search for a server that spins up a new one but if i try to join once started i cant. I believe that the ticket is being refreshed but adding the player and removing him from the ticket is a bit tricky. Im using Photon Fusion. Once the player joins i call a RPC from a player to the server then the server call a rpc to the player to add him self to the ticket but im getting and error of server.config not found path

plain fern
#

Hi, can anyone help me with spawning items on a spawned player in Netcode. I keep receiving the error {Spawning NetworkObjects with nested NetworkObjects is only supported for scene objects. Child NetworkObjects will not be spawned over the network!}. How would one go about making a networked inventory manager that spawns in networked Items. Any help is greatly appreciated!

queen leaf
#

@boreal wharf How can I create a real-time physics multiplayer game using web-socket?

haughty heart
#

@queen leaf Please don't tag random people for your questions.

sick belfry
#

Hello everyone, I have a weird reason. I am currently using Netcode for GameObjects and Facepunch Transport to make networking for my game. Currently I have a button that is supposed to open the Steam Overlay. But it doesn't seem to work. SHIFT+Tab doesn't work either.

ember kettle
#

Is there a way to do host migration with NGO?

#

I hear it's not supported at all

#

:(

sharp axle
umbral dome
#

Is there a way cleaner way to do update on each frame on a multiplayer using the Unity.Netcode?

    void Update()
    {
        UpdateClientRpc();
        UpdateServerRpc();
    }

    [ClientRpc]
    void UpdateClientRpc()
    {
        
    }

    [ServerRpc]
    void UpdateServerRpc()
    {
        
    }

#

Is update just called on the server or client

#

This question was brought up by this script right there

    private void Update()
    {
        if (!IsOwner) return;
        float x =0f, z = 0f;
        if (Input.GetKey(KeyCode.W)) z = +1f;
        if (Input.GetKey(KeyCode.S)) z = -1f;
        if (Input.GetKey(KeyCode.A)) x = -1f;
        if (Input.GetKey(KeyCode.D)) x = +1f;

        MovePlayerServerRpc(x, z);
    }


    [ServerRpc]
    void MovePlayerServerRpc(float x, float z)
    {
        transform.position += new Vector3(x,0,z) * moveSpeed * Time.deltaTime;
    }

#

If you are the host, MovePlayerServerRpc is called twice per frame

#

And I wouldn't want the server to do the code in the update.

#

The only fix I could think of was to do an other Update method with the [ClientRpc] tag.

crisp zinc
umbral dome
livid wigeon
#

Hi! If i spawn an object and move/rotate it only on the host, does it get synced on clients or do i have to use a Network Transform/Network Variable?

sharp axle
livid wigeon
vocal bane
#

I am trying to make the player move to a new position when it collides with this object.
This script runs on the object the player collides with.

public class OnCollisionMove : NetworkBehaviour
{
    public GameObject NewLocation;
    private void OnTriggerEnter(Collider Player)
    {
        Player.GetComponent<MovePlayer>().SetPlayerTransform(NewLocation.transform.position, NewLocation.transform.rotation);
    }
}

This script runs on the player.

public class MovePlayer : NetworkBehaviour
{
    
    public void SetPlayerTransform(Vector3 Position, Quaternion Rotation)
    {
        GetComponent<Transform>().position = Position;
        GetComponent<Transform>().rotation = Rotation;
    }
}

There are no errors and both prints run and the player moves to the right place for about a frame before snapping back to the original. What am I doing wrong?

sharp axle
vocal bane
sharp axle
#

Or just not use the clientRPC. Only the server can move network transforms

vocal bane
#

It doesn't work with either.

sharp axle
#

In that case you have something else in your server resetting the position

vocal bane
#

I'll check, that would make sense as the player is bounced back even when the code is run directly by the client when using a client network transform.

vocal bane
#

that is run every fixed update

sharp axle
vocal bane
#

I got it working, Just had to disable the player movement script while I run the tp

#

Thanks for your help

novel kettle
#

how to join a host with additive scene loading with 3 scenes, where only 1 has to be synced? I got a core, base and environment scene and only need to sync the environment scene. It keeps additively loading the base scene as well and I'm trying to ignore that scene somehow

sharp axle
novel kettle
sharp axle
woven cliff
#

how do i make a function to set the addres and port of the server to connect to?

sharp axle
versed lily
#

This is mostly a "theory" question: Why can't we send instanced objects (classes) through RPC calls (or, I guess - why can't class instances be serialized)?

forest grotto
sharp axle
versed lily
#

Yeah I guess my question is "is there a reason it's not simple?"

austere yacht
# versed lily Yeah I guess my question is "is there a reason it's not simple?"

There is no straight forward way to ‘simply’ serialize every possible class instance including all its references. Theoretically this could mean that you would have to dump the entire process memory into the RPC message if your stuff is tightly connected. You can technically do it though, it’s just useless to do so (too much data). Consequently what netcode serialization wants you to do is to be specific about what data needs to be sent over the network for your game to function correctly, because no system could possibly infer that automatically. To make netcode simple, you need to architect your data to be simple.

woven cliff
#

can someone help me figure out why thiscode works on host but not client im making my first multiplayer so im very new

        if (!IsOwner) return;

        Camera = GameObject.FindGameObjectWithTag("CM Main Camera").GetComponent<CinemachineVirtualCamera>();
        Camera.Follow = gameObject.transform;
sharp axle
woven cliff
#

It runs on start btw and is a private variable

sharp axle
woven cliff
#

But why would it work on the host and not the client in that case?

unreal sky
#

I have an object who's velocity is manually synced after it is changed on server, but it still desynchronizes. The script takes the server velocity and calls a client rpc to the corresponding client-side object to sync it. However, this doesn't work entirely.

jovial fiber
#

Hey does anyone know if Fishnet is actually usable ?
Ive heard that name before but people were making jokes on its behalf, did that change i googled and it seems like its actually pretty good

olive vessel
#

People were likely making jokes given the aggressive nature of the style of advertising FishNet's creator used

woven cliff
sharp axle
woven cliff
#

one more question how woud i sink a sprite renderers color? cus i have a gray scale character and i want to make it possible to change its color and also can i delay the spawning of the player character to for example make a lobby before you start the game cus i dont want people joining mid game

sharp axle
jovial fiber
olive vessel
#

Best thing you can do is try them both with an open mind and see what you like

jovial fiber
#

yeah right

#

tbh i will skip trough some tutorials on both and i will see if the setup is actually easier for FishNet

#

if the claims are true it should be easier and it automatically should come with client side prediction and other features

sharp axle
jovial fiber
#

isnt the pro paywall like a one time 10$ charge

jovial fiber
#

yeah its one time 12$ and then 2$ for updates to pro

#

thats acceptable

#

12$ for client side prediction and stuff

sharp axle
#

through github its $10/$1

#

still too much in my opinion

jovial fiber
#

I will go with mirror since there is more help for that available, i think thats more important then ease of setup

leaden totem
#

So I am working on netcode. For my host, everything works as it should. For my client, everything from OnMove is ignored. Everything else works for the client. When i tested the if statement below for movement, it worked for both host and client. My question is, why does OnMove not work for my client?

public void OnMove(InputValue movementInput)
    {
        Vector2 movementVector = movementInput.Get<Vector2>();

        movementX = movementVector.x; 
        movementY = movementVector.y;
    }```
___________________________________________________

```cs
if (Input.GetKeyDown(KeyCode.W))
        {
            movementY = Input.GetAxis("Vertical");
        }```
#

Is there something special i need to do with the new input system to get it to work with netcode?

sharp axle
leaden totem
#

ELI5 please

sharp axle
leaden totem
sharp axle
#

The host has server authority. the client does not

leaden totem
#

then why can the host and client both jump?

#
if (Input.GetKeyDown("space") && IsGrounded() && canJump)
        {
            rb.AddForce(Vector3.up * _jumpForce, ForceMode.Impulse);

            canJump = false;
            jumpTimer.Start();    
        }```
#

literally everything works on the client except OnMove()

sharp axle
leaden totem
#

are you referring to my cs using statements?

sharp axle
leaden totem
#

dont see that option in either

sharp axle
leaden totem
forest grotto
#

which one do i deleat/rename??

weak plinth
#

I am making a registration system for my game using Netcode for GameObjects

I happened to just realize that everything is working on the host, but not on the client.

When I attempt to do anything server-side, it doesn't work. When I click register for example, ServerRpc gets called.

and in the ServerRPC void, since it's server-side, it will check the files on the server and respond by for example changing the page for the client.

It's not working though, and I'm not sure why. Have I done something wrong? RPC is pretty confusing tbh
I also tried doing Debug.Log("x"); in the ServerRPC void to test it out, and on the server-side I don't see anything in the console when the client clicks the button that calls ServerRPC

sharp axle
forest grotto
#

so the Fusion one

unreal sky
#

I have an object who's velocity is manually synced after it is changed on server, but it still desynchronizes. The script takes the server velocity and calls a client rpc to the corresponding client-side object to sync it. However, this doesn't work entirely.

sharp axle
#

If you mean Streetpass then what you are looking for is Network Discovery

sharp axle
#

I guess you'd need a direct peer to peer ad hoc network in that case. But that's a security nightmare.

pallid quarry
#

Ive got a question,
so im trying to change scenes using relay
ive got my players in a relay together but how would i get them all to join a scene together?
Thanks 🙂

pallid quarry
#

i figured out how to do it

#

dont worry about my message above

weak plinth
#

I am making a registration system for my game using Netcode for GameObjects

I happened to just realize that everything is working on the host, but not on the client.

When I attempt to do anything server-side, it doesn't work. When I click register for example, ServerRpc gets called.

and in the ServerRPC void, since it's server-side, it will check the files on the server and respond by for example changing the page for the client.

It's not working though, and I'm not sure why. Have I done something wrong? RPC is pretty confusing tbh
I also tried doing Debug.Log("x"); in the ServerRPC void to test it out, and on the server-side I don't see anything in the console when the client clicks the button that calls ServerRPC

alpine pivot
#

So I have this edge case in my head that has been bugging me for a while.
We have a client and a server, the client connects to the server, the server spawns a networked object for the client and invokes a non reliable RPC on that network object.
The client receives the RPC command before the network object spawn command, so when it comes time to invoke that RPC on the client, the client will error out saying that the Entity for this RPC doesn't exist.
How would one tackle this issue?

sharp axle
alpine pivot
sharp axle
alpine pivot
#

Thank you

sick plank
#

For P2P Networking for a Multiplayer/Co-op game where I don't care if someone cheats....

Whats the easiest solution? I've messed around with Mirror in the past, but, if theres something easier I'd gladly look into it.

golden echo
#

Y’all know a way to make a gun it photon

#

With vr

sharp axle
sick plank
sharp axle
sick plank
#

Thats fair. Hmm.
Yeah just trying to gauge the easiest solution for me.

Overall my assumption on how I'll be setting things up:

  • Server controls Enemy/AI and just relays that information to the clients (EG: Other player + Host)
  • Clients (EG: Players, both) just send their controls to the server to relay to others.
  • Clients would control damage dealt/received.

I know this would open up to cheaters, but again, co-op game, so, you're really just ruining the fun for yourself.

#

I assume however, that with Photon, it seems that I'm limited by CCU even when doing P2P. So I think thats out of the question.

fickle aspen
#

Hello everyone! I have a bit weird of a question

Can I use Unity relay, when not all clients use Unity? I'm thinking about a game like Jackbox, where players use phones as controllers.

Can it be done through Unity multiplayer solutions or should I just write my own backend?

#

Basically, what I want:

  1. There's a Unity game running on Desktop that acts both as a server and, khm, screen for the players
  2. There's a lightweb web app optimized for phones that has nothing but a couple of buttons
  3. When a player presses one of the buttons on their phone, a message is sent to the Unity game, that processes this input and updates the game state
  4. Phone clients receive an updated state and use it to display some other buttons, etc
unreal sky
#

I have an object who's velocity is manually synced after it is changed on server, but it still desynchronizes. The script takes the server velocity and calls a client rpc to the corresponding client-side object to sync it. However, this doesn't work entirely.

carmine geyser
#

Hello!
I started using Photon today for multiplayer project, but when I added it to the project. I got an error for it, but I have no idea how it works. And how I can get rid of it. Does anyone know what I should do?

Failed to find entry-points:
System.Exception: Unexpected exception while collecting types in assembly `PhotonRealtime, Version=0.0.0.0, Culture=neutral, PublicKeyToken=null` ---> Mono.Cecil.AssemblyResolutionException: Failed to resolve assembly: 'Photon3Unity3D, Version=4.1.6.17, Culture=neutral, PublicKeyToken=null'
  at Mono.Cecil.BaseAssemblyResolver.Resolve (Mono.Cecil.AssemblyNameReference name, Mono.Cecil.ReaderParameters parameters) [0x00105] in <ebb9e4250ed24cbfa42055e3532ef311>:0 
  at zzzUnity.Burst.CodeGen.AssemblyResolver.Resolve (Mono.Cecil.AssemblyNameReference name) [0x00039] in <a2dd15248a25411e914af2a2c82fb63f>:0 
  at Burst.Compiler.IL.AssemblyLoader.Resolve (Mono.Cecil.AssemblyNameReference name) [0x00079] in <a2dd15248a25411e914af2a2c82fb63f>:0 
  at Mono.Cecil.MetadataResolver.Resolve (Mono.Cecil.TypeReference type) [0x00038] in <ebb9e4250ed24cbfa42055e3532ef311>:0 
  at Mono.Cecil.ModuleDefinition.Resolve (Mono.Cecil.TypeReference type) [0x00006] in <ebb9e4250ed24cbfa42055e3532ef311>:0 
  at Mono.Cecil.TypeReference.Resolve () [0x00006] in <ebb9e4250ed24cbfa42055e3532ef311>:0 
  at Burst.Compiler.IL.Server.EntryPointMethodFinder.CollectGenericTypeInstances (Mono.Cecil.TypeReference type, System.Collections.Generic.List`1[T] types, System.Collections.Generic.HashSet`1[T] visited) [0x0002f] in <a2dd15248a25411e914af2a2c82fb63f>:0 
  at Burst.Compiler.IL.Server.EntryPointMethodFinder.CollectGenericTypeInstances (Mono.Cecil.AssemblyDefinition assembly, System.Collections.Generic.List`1[T] types, System.Collections.Generic.HashSet`1[T] visited) [0x00057] in <a2dd15248a25411e914af2a2c82fb63f>:0 
  at Burst.Compiler.IL.Server.EntryPointMethodFinder.FindEntryPoints (System.String[] rootAssemblyNames, Burst.Compiler.IL.Hashing.CacheRuntime.HashCacheAssemblyStore assemblyStore, Burst.Compiler.IL.AssemblyLoader assemblyLoader, Burst.Compiler.IL.NativeCompilerOptions options, Burst.Compiler.IL.Server.ProfileDelegate profileCallback, System.Boolean includeRootAssemblyReferences, System.Boolean splitTargets, Burst.Compiler.IL.Helpers.DebugLogWriter debugWriter) [0x0019d] in <a2dd15248a25411e914af2a2c82fb63f>:0 
   --- End of inner exception stack trace ---
  at Burst.Compiler.IL.Server.EntryPointMethodFinder.FindEntryPoints (System.String[] rootAssemblyNames, Burst.Compiler.IL.Hashing.CacheRuntime.HashCacheAssemblyStore assemblyStore, Burst.Compiler.IL.AssemblyLoader assemblyLoader, Burst.Compiler.IL.NativeCompilerOptions options, Burst.Compiler.IL.Server.ProfileDelegate profileCallback, System.Boolean includeRootAssemblyReferences, System.Boolean splitTargets, Burst.Compiler.IL.Helpers.DebugLogWriter debugWriter) [0x001d9] in <a2dd15248a25411e914af2a2c82fb63f>:0 
  at Burst.Compiler.IL.Server.FindMethodsJob.Execute (Burst.Compiler.IL.Server.CompilerServerJobExecutionContext context) [0x00133] in <a2dd15248a25411e914af2a2c82fb63f>:0 

While compiling job:
sharp axle
prime lily
#

hi guys on quick question how i can make an rpc affect only me ? example , how the others will be notified that i closed or opened my flash light ?

sharp axle
prime lily
#

I am using photon

muted wolf
#

how can i change the game version on mirror

humble mauve
#

Anyone have an example on how to correctly utilize NetworkList<T>?
As in sure i know how to create one but what is the intended way to change the values of an element structs values? Or do i just need to do a full replace for the member? Seems rather wasteful

sharp axle
#

Syncing physics is a very very hard problem. Ideally all physics is handled by the server and Network Rigidbodies syncs the rest

stiff ridge
#

The Custom Player Property would possibly be my preferred approach, as late joining players also get to know this.

sharp axle
humble mauve
# sharp axle Only changes get sent in a networklist

Just had the bright idea of actually reading it's source code since it's available and didn't seem to be that complicated. Get it now, seems there's a few minor issues with it overall and it doesn't support writing only a delta of a structs changes but the whole struct. So the answer is if i'm not happy with it write my own from the example 🙂

sharp axle
humble mauve
#

One test worth a thousand expert opinions and the like

sharp axle
#

Premature Optimization is the Devil

humble mauve
#

That it is, my only problem with that slogan is that far too many devs seem to have an incredibly loose definition of "Premature" where it means noticing at the last 2weeks before launch their game runs like crap and then failing horribly at optimization. The skill is in identifying what is the correct time in development to test a feature and do the tests in controlled sizes so you don't get fooled by ones own lack of full understanding on how the engine works overall

#

My personal answer has been to do an hour of profiling once a month or so and do an immediate test if you're almost certain "hey this could cost quite a bit" so you don't build other systems to rely on something you have to gut later. That is a time cost aswell, not noticing issues until well after you've committed to them

sharp axle
#

The corollary slogan is "Profile all the things!"

humble mauve
prime lily
fathom spade
#

it wasn't supposed to happen

#

and my prefab is not disactivated

orchid pendant
#

i am using photon pun2 and my bullets are jittering a lot (btw i am using rigibody.velocity)

orchid pendant
fathom spade
warped panther
#

Hello to everyone! I am facing such a problem when using Network Animator. What is the reason of this? I'm pretty sure I'm using the latest version of Netcode. v1.2.0

unreal sky
#

ello
so
how exactly would i make an overarching database for all the players on all the servers
I want like
leaderboards and stuff
kthxbyehavegudday

fathom spade
#

I forgot to add the photon view component to the object

timber blaze
#

Anyone come across this error message before?

It happens when I am testing using Parallel sync, when the client disconnects, the host gets these error messages. The messages continue to spam the console even after the game has exited play mode.

timber blaze
# orchid pendant i am using photon pun2 and my bullets are jittering a lot (btw i am using rigibo...

Kind of hard to tell what's going on in your video, are you firing the bullets in the build and getting jittery performance in the editor?

How are you syncing the position? Using some kind of transform sync? If so, you should look into just spawning the bullets locally on whatever client is firing them, then sending an RPC for everyone else to spawn a bullet too. That way the physics can be simulated locally and will always run as smooth as your game allows it to run

charred abyss
#

Hi, I am trying to decide which networking solution I should use.
Here are some of the key things I'll point out:
I don't want to use photon since it's very limited(from what I saw) and you have to pay for pretty much everything.
I have no experience when it comes to networking whatsoever, this is the very first time I'll actually give it a try.
My goal is to make a self hosted, dedicated server(pretty much like what you have in cs 1.6, community hosted servers that people can join and play on them) and have a separate app just for that.
2 of the main solutions I am considering now are Riptide and FishNet but I really don't know which one I should go with.
I've seen unity's solution but I don't know if it's any good/free.
I am open to all of your suggestions and thanks in advance!

unreal sky
#

It has many useful prebuilt features and also makes it incredibly easy to talk between server and client.

charred abyss
unreal sky
#

A good resource is the Multiplayer Unity Documentation.

charred abyss
#

I'll take a look into it, thanks!

unreal sky
#

Np

#

<3

weak plinth
#

when playing animations on the host's client, it plays it on every other client as well, why is this? I'm using mirror

tiny nymph
#

are there any resources for writing your own transport?

sharp axle
stiff ridge
# prime lily Thanks for the info I worked on a project with too many custom properties and I ...

The problem is usually more generic: Synchronizing too much in an inefficient way. PUN doesn't keep you from using a lot of bandwidth with bad practices, so this can happen.
Values you change somewhat often, should get their own Custom Properties key. So you can change them on their own, not sending all the other values.
If you have a lot of Custom Properties, you a) can set some of them in one SetCustomProperties call and b) want to avoid to set them all in each call. So avoid SetCustomProperties(player.CustomProperties) under all circumstances.
Fusion is better for this, because you can define the game state as networked variables and it will automatically detect changes and only sync those. That is very lean without you taking care of it.

elder orbit
#

can someone help me with setting up my project for unity servers (multiplay)

real crypt
elder orbit
#

I was wanting to use the unity multiplay sdk and their game hosting servers

inner shadow
#

Hey I'm curious if there's any discord specifically for Netcode for Gameobjects? I'm hoping to find separated channels to talk about things since there's so much going on with it and the amount of resources is pretty slim. Thanks

sharp axle
leaden totem
#

Howcome this results in my host jumping and not my client?

#

aka OwnerClientId logs 0 and the host/client jumps, OwnerClientID logs 1 and the client does not jump

sharp axle
leaden totem
#

Yes, I am using Client Network Transform for my player prefab.

I am currently working through codemonkey's netcode tutorial and his explanation of ServerRpc's didnt really lend me a great understanding of it. I am working on a competitive physics esport style game and i want collisions etc verified server-side, so I should be using ServerRpcs's to do just about everything right?

sharp axle
leaden totem
#

will test with reg network transform

hexed dock
#

I'm using photon pun, and I have a dev build, and the standard unity window running, whenever I create a room on one, I can't join the other. I haven't changed any script that is related to joining, but it stopped working. What can I do to fix this?

alpine cape
#

Hi I'm semi new to networking in unity. Is Mirror or Netcode better for smaller scale games? Also which is better to learn for jobs?

austere yacht
#

professionally there is no reason to master any specific library, those skills get old fast. learn fundamentals, be able to custom build your own, based on understanding or the problem-space and the principles behind their solutions, is the best qualification.

charred abyss
#

Hi, I am planning to work on 2 multiplayer projects.
I can't say that I have any experience with networking other than watching quite a few videos so I am looking for other's advice.
Should I use FishNet or Netcode for Game Objects?
The first project is a pretty simple game(imagine bloons td6) where a person hosts a server(prob up to 4 people) and you just play with your friends for fun.
The other game is a bit more serious and I'd like everyone to be able to host a dedicated server.
What I mean by that is that I want to have the game build it self in which you can join servers and then the dedicated server app which you can use to host a server for the game.
I have a bit more detailed questions about that by it self but I can ask that once I am actually building the game.
As for right now, I am just looking for the best networking solution to learn and it doesn't have to be either of the two I mentioned.
I've heard that riptide is pretty good but I haven't seen a lot of tutorials for it.

woven cliff
#

OnCollisionEnter2D dosent work whys that?

#

both object have Edge Colliders, RidgedBodies2d, Network RidgiedBodies2d, Client Network Transform one of the object is a player the other is a network object

sharp axle
sharp axle
woven cliff
sharp axle
woven cliff
sharp axle
woven cliff
#

It's a network object spawned with a serverrpc

woven cliff
sharp axle
#

OnCollisionEnter2D dosent work

charred abyss
# sharp axle They are both fine. I personally use Netcode. It's fairly new and there are not ...

ok, as I said, I am not experienced when it comes to networking so this could be wrong.
From what I've seen, you need to attach prefabs and well everything to your server component on both fishnet and netcode for go.
How would you do that if you had a server as a separate project?
The only thing that comes to my mind is a workaround of just sending for example strings of what to instantiate to a player's game.

elder orbit
#

Anyone have experience with setting up unity servers (multiplay)

sharp axle
charred abyss
unreal sky
#

Heya!
I intend to use PostgreSQL as a database for my multiplayer PVP game for storing persistent data (like kills).
How would I have a Unity server communicate with a PostgreSQL database whilst making sure that players can't access it themselves?

sharp axle
unreal sky
sharp axle
unreal sky
unreal sky
#

well isn't that convienient

#

ty <3

woven kiln
#

Is there a way to remove addressables from dedicated server build?

sharp axle
#

The best option is the one that works for your current project. I know that's a non answer. But the only real difference in most of the networking frameworks are price and advanced built-in features. I use Unity Netcode because Photon ended up being too expensive.

unreal sky
#

are there any ways to differentiate different users aside from their accounts? I am making a game, and if there are cheaters and I ban them, I am worried they'll just make 20 alt accounts. How would I circumvent this?

sharp axle
woven ibex
#

Hallo

gilded rune
#

Is there any way to change a texture of a Network Player in Photon while in a server?

woven ibex
quartz atlas
unreal sky
#

?

sharp axle
opal night
#

UnityWebRequest keeps downloading old data thats like over 30 minutes old. If I ctrl click the url in visual studio, my browser opens and displays new data... i know the data on the remote end is updated but i cant figure out how to get unity to get a fresh copy. I've tried usehttpcontinue = false but it didnt change the behavior.

weak plinth
#

Has anyone got Netcode for Gameobjects working for multiplayer VR using XR Interaction Toolkit?
Just wondering how difficult/buggy it might be to get a basic model viewer app running (2+ ppl using VR on local network) view,/scale/edit a model on a table in front of them on a digital table
Thank you

woven ibex
#

Hallo please how to make fps microgame multiplayer?

woven ibex
#

Emm

#

?

#

How

sharp axle
# weak plinth Has anyone got Netcode for Gameobjects working for multiplayer VR using XR Inter...

The interaction Toolkit is not built for multiplayer at all. You will have a much easier time handling everything manually.
Maybe some some of the newer toolkit updates changed things, but reparenting network objects is a huge hassle
https://docs-multiplayer.unity3d.com/netcode/current/advanced-topics/networkobject-parenting

olive vessel
weak plinth
unreal sky
woven kiln
#

@graceful zephyr do you nanosockets on mac silicon?

#

does anyone uses NanoSockets with mac silicon? m1

olive vessel
#

Doesn't prevent alt accounts

unreal sky
#

so how do they do that?

olive vessel
#

To be quite honest, I believe you're putting the cart firmly before the horse

#

Have you even got a working prototype?

unreal sky
#

ik, just curious

#

a basic one, yes

graceful zephyr
#

i thought i had left unity discord

#

turns out i just put it in a folder

unreal sky
#

im at that phase where im building the database for persistent data

olive vessel
#

I think you're gonna waste a lot of time worrying about something that probably won't happen

#

Easiest way to make people buy an "account", whack it on Steam for ÂŁ20

graceful zephyr
#

making a fun game is the hard part, and the infrastructure is useless without anyway

#

so start with that

woven kiln
graceful zephyr
#

lol

woven kiln
#

You cant just say if you use it on mac silicon m1? im losing days trying to make it work

#

it will take like 5 seconds for u to say this ..

graceful zephyr
#

yes i do every day

#

work on an m1 mac most of the time

#

soon m2 pro

woven kiln
#

thank you

grave sable
#

hey @graceful zephyr , i've compiled the nanosockets library for mac m1 using cmake. Client and server are both up and running, but server doesn't receive any messages from client

#

any idea how to debug?

graceful zephyr
#

okey i dont provide support for anything

#

nanosockets isnt my library

grave sable
#

any steps on how you made it work for m1?

#

can help a great deal

#

did it work out of the box or had to jump through some hoops?

graceful zephyr
#

i dont remember, been using it on M1 mac since M1 came out basically

#

there's no difference to M1 mac to any other platform other than that native code needs to be compiled properly for it

#

also if you're just starting out, just use regular .net sockets

#

no point in using nanosockets or any other lower level abstraction

#

it just makes it harder for you and gets in the way

grave sable
#

can't use it with burst

graceful zephyr
#

u dont need burst lol

woven kiln
#

Can i send raw binary data on unity transport? a byte pointer?

tranquil lake
#

Hey Paco, do you mind if I DM you?

quartz atlas
humble mauve
#

Is there some limitation on when you can call Rpcs? Such as are you allowed to call one in OnNetworkSpawn()?

Reason i'm asking is that i'm getting absolutely irrational behaviour from them in a super simple game where there is only a Host and a Client that both use a RegisterClientServerRpc(MyDataStruct someData) to update a NetworkList<MyDataStruct> myNetworkList field in a shared NetworkObject(as in only one of these exists)
The Host and Client have a different amount of elements in the list (client has 1 extra ghost value).

I'm calling the RegisterClientServerRpc currently in OnNetworkSpawn, the Rpc has requireownership set to false

The Host has correct amount, the NetworkList also seems to run two value updates but that i presume is due to using the Reliable Rpc delivery attribute?

sharp axle
humble mauve
sharp axle
humble mauve
# sharp axle everything spawns on the server/host first, then a packet is sent out to spawn t...

So in plain english you think my issue is that the NetworkList value change is received by the Clients copy of the NetworkBehaviour before it has had time to initialize the NetworkList and as such adding it twice? And this would indeed be due to the code adding an element since it doesn't exist there yet?

If so i think i'll be redesigning that portion of the NetworkList for my own purposes 😄

humble mauve
sharp axle
humble mauve
# sharp axle Check out OnSynchronize if you need things updated before/when they spawn https:...

Thanks once more, yeah i guess my need is exactly that, when stuff spawns i want the fields to be synchronized.

I'll need to update the project for that though but that'll have to wait since i can't currently due to a semi-big bug in the IL2CPP (completely unrelated but blocking upgrade to latest 2021.3 versions, jagged arrays don't work with binary formatter).

But atleast i know how to work around for now and how to simplify once the bug is patched

hard creek
#

Hello, what is the correct way to have the same random number on all clients ?

storm summit
sharp axle
hard creek
#

Thanks for your help guys 🙂

warped panther
#

Hello, I'm using the Steam API and I'm having a problem inviting players.

First, I'm creating a lobby with Steamworks NET. Then, if the lobby is formed, I send a data to the lobby. Then I invite someone using the Steam interface. But when the other party accepts the request, nothing happens. I'm listening to all "GameLobbyJoinRequested_t" and "LobbyEnter_t" callbacks and printing with Debug.Log. But there is never any result.

severe pilot
#

Hey everyone, I'm trying to make a multiplayer game using Networking for Gameobjects. I've created a server object and a client object. I'd like to call a server RTC in the server object from the client object, but I'm struggling to figure out how to get an instance of the server object in my client thonk

quartz atlas
#

i was downloaded the boss room project, reading the code etc.. take my project id, enable relay, lobby, etc and still happen the same error"i have to enable game service in unity" first day training and problems

quartz atlas
# severe pilot

i think you dont have to do in this way, take a look on boss room project

#

rtc you mean RPC? i think all networks solutions are using same names, so when you send a RPC you dont need to search for the client object or i dont understand what you want to do sorry

sharp axle
sharp axle
elder orbit
#

hey i have a question. i'm trying to explain to someone why i cant use netcode for gameobjects with my unity server hosting, because of how netcode gets outscaled. unfortunately i'm not able to articulate it in a way he can understand. maybe you could state why using netcode isn't realistic when setup for server hosting in a way that i can explain to him.

keen plume
#

Hello!
Is there a way to implement video chat on Photon?

sharp axle
quartz atlas
#

should i have installed netcode or something? i. have enabled realy and lobby into my dashboard but still showing "i have to enable this server"...

clever verge
#

Hello

#

I have a NetworkVariable with some data

#

On disconnection, I don't destroy this NetworkBehaviour/Object

#

And on reconnection, the objects spawn again

#

The problem is, if the server updates the NetworkVariable during the clients disconnection phase

#

the value isn't immediately updated

#

on Spawn of the new network object

#

Sometimes the update value comes up, sometimes the update doesnt and its all default values

#

I do not want to add a manual delay of certain seconds before I get the latest state

#

is there a callback for this?

#

Im doing a turn based game, where the game state updates every turn.. so subscribing to OnValueChanged seems unnecesary

#

i just send rpc calls with output data

solemn haven
#

how to sync video over network with photon fusion?

keen plume
sharp axle
sharp axle
solemn haven
#

Thank you)

severe pilot
#

Does anyone know what causes this?

#

I'm trying to call a server RPC to send a simple message. When I create a host it works, but if I try and create a separate build, host on there then create a client in the editor it produces this error

#

I'm using default settings of local host and port 7777

#

They've definitely connected as there are 2 player prefabs

#

nvm I've figured it out

#

it's because I was trying to send the Rpc message too soon after connecting

#

or before they were connected fully ig

#

I do have another question about structure of game logic. Currently what I've done is create a serverGameLogic prefab which is only created on a host/server, and a clientGameLogic which is only created on client. Then I have an intermediatory interfaceGameLogic networkobject which has a reference to the serverLogic on a host/server and a reference to clientLogic on host/client, which executes server and client rpcs. Is there a better way to lay this out or does this work? I'm trying to separate my client and server side

sharp axle
severe pilot
#

it was a server rpc but same thing I think

short vale
#

So I have some Authoritative server questions / opinions that I am wondering if I have the right viewpoint / concepts, etc.

crisp zinc
jade nest
#

I have a multiplayer hockey game, problem now is the player names in the back of the shirt. i have that code line that puts its on the back OnNetworkSpawn() but all players have now my name, how to make all players sync in the server their name ?

ebon temple
#

Hey guys , i have a question, i want to connect photon to my project which have starter assets package in it which means my player have first person controller script my question is will it be possible to connect photon ? and do anyone have a similar project so i can have a look on it and try to do the same steps

stiff ridge
#

Join the Photon Engine discord (via the Photon Dashboard Account page) if there are more questions...

ebon temple
keen plume
#

Hello is there any way to sysc webcam on unity and photon

stiff ridge
weary stag
#

Is there a way to store an Array of GameObjects in a network variable, I already know the answer really but i just dont know what to do

#

I have 4 units per player and need to store a reference to other players units so I can set their materials and stuff

#

nvm sorted it i think 🫡

weary stag
#

i didnt end up sorting it

fading nymph
#

Can someone with experience in using Photon Fusion dm me?

#

I'm fairly new to coding multiplayer and am confused about something that should be simple

#

I guess I could ask it here as well. I'm currently trying to get a variable (just called x) to be synced across devices. When any player presses their mouse button, x should increment by 1 on all devices. I'm having trouble figuring out how to do such a simple thing. Here is my approach so far:

Create a network prefab called MathManager
Create a singleton script MathManager with [Networked] variable x
When the host starts game, spawn a MathManager object in the scene

Is this sufficient to share a variable x with all users?

sharp axle
radiant dome
#

hello everybody,i am creating a multiplayer game using photon,i started to set it up,but it is 2 days that when i build the project photon doesn't work,somebody know how to solve the problem? In the editor all works correctly,just in the build it doesn't work (just if i build for android,the build for pc works)

sterile smelt
# radiant dome hello everybody,i am creating a multiplayer game using photon,i started to set i...

It seems like the issue may be related to the build settings for the project. Since the game works correctly in the editor, but not in the build, it could be an issue with how the game is being packaged for distribution.

One potential solution could be to double-check the build settings and ensure that everything is configured correctly for the intended platform. It's also possible that there are missing or incorrect dependencies that are causing the issue.

Another solution could be to check the Photon documentation and support forums to see if there are any known issues or solutions related to the specific platform and build settings. It may also be helpful to reach out to the Photon support team for further assistance in troubleshooting the issue.

lucid inlet
#

[solved*] can anyone here confirm that a unity 2022.2.5f1 WebGL build using entities and net code 1.0.0.prev-15 has the UNITY_SERVER symbol defined? I am trying to build a client webgl build but unity is adding a UNITY_SERVER symbol when i want a UNITY_CLIENT. there doesn't seem to be a Project Settings > Dots Settings with webgl. how can i make it a client only?
edit: this seems to be a bug related to switching from a dedicated server build to webgl where the Server flag is set? I had an editor script set the subTarget to Player and that seemed to fix it *maybe

short vale
#

So I'm a literal rocket scientist, yet I can't for the life of me figure out unity's netcode. It shouldn't be this hard. I've done the unity multiplayer tutorial, but camera control with custom perspectives based on movement are proving to be difficult. Does anybody have a good tutorial using multiplayer netcode with cameras that aren't simply following behind the player that I can look at?

sharp axle
#

Cameras

radiant dome
# sterile smelt It seems like the issue may be related to the build settings for the project. Si...

all worked 3 days ago,i don't know why i did a build and from than all the buildings stopped to work,the only thing that i can do now is to ask photon assistance.I also asked in the unity3d forum and photon forum for help.https://forum.photonengine.com/discussion/7682/solved-photon-pun-broken-in-build-works-in-editor i also found this thread but it doesn't explain how to solve the problem

Photon Engine

Greetings. We ran into a strange issue today while making builds and it has us stumped.

vernal glen
#

Hello! I am using Netcode for gameobjects and I am trying to display the ping of each player.

public TextMeshProUGUI pingText;

    private float pollingTime = 1f;
    private float time;
    private float frameCount = 0f;


    private NetworkTransport networkTransport;
    private ulong clientId;
    private bool networkSpawned = false;
    public override void OnNetworkSpawn()
    {
        networkTransport = GameObject.Find("NetworkManager").GetComponent<NetworkTransport>();
        clientId = NetworkManager.Singleton.LocalClientId;
        networkSpawned = true;
    }

    // Update is called once per frame
    void Update()
    {
        if (!networkSpawned) return;

        time += Time.unscaledDeltaTime;
        frameCount++;

        if (time >= pollingTime)
        {
            ulong ping = networkTransport.GetCurrentRtt(clientId);
            pingText.text = $"{ping} ms";

            time -= pollingTime;
            frameCount = 0;
        }
    }

This is how i am doing it. The player that hosts the game has 0 ms latency, but when a client connects, it outputs this error:

KeyNotFoundException: The given key '1' was not present in the dictionary.

It references this line ulong ping = networkTransport.GetCurrentRtt(clientId);

coarse carbon
#

Ola, I am learning how to use netcode in Unity 🙂 And I am little bit confused, I know how to make player prefubs and spawn player, but what If I want to do something like GameManager? Script which holding methodes for every player? Bcs for example my script have to pick one random question for players, but when it is just dropped in scene, it will pick one random question for each players. Any idea how to make this script (gameManager) same for all players? 😄

sharp axle
#

Ping

#

GameManager

jovial fiber
#

Does anyone know if Facepunch fixed their p2p ip leak thing in Facepunch.Steamworks ?
I last remember Dani having problems in Crab Game with DDOS attacks cuz of it

hearty vine
#

I need help with photon multiplayer

I need to change the scene but when it changes, the players that were in the other one, still in the new one. Can someone help me?

austere yacht
#

out of date with what?

#

litenetlib is not using any part of unity

elder turtle
#

can someone help me: i have 2 players, 2 photon views, i want the host to have player 1 and photon view 1, and player 2 to have photon view 2, when the second player joins, photon view 1 AND photon view 2 is owned by player 1, i believe this is causing the issue that the second player doesnt move on player 1s screen

#

fixed by transfering owner ship

quartz atlas
neat veldt
#

https://hatebin.com/pundqbysmj

var alloc = await RelayService.Instance.CreateAllocationAsync(lobbyData.MaxPlayers);
```This worked perfectly before but now freezes the editor. It doesn't throw any errors and refactoring to coroutines does not work.
#

This is the console before it crashes

elder turtle
neat veldt
#

by doing nothing and it suddenly working again

#

i love programming

severe pilot
#

I'm working on a don't trust the client basis

#

Is there a better way of laying this out?

#

I don't want to use a network variable because then it will share the role with all clients when they shouldn't know

#

Server knows their role, then when a client should know it will call revealTeam as well as the client it should reveal it to

#

which will then construct the rpcParams and then call the clientRpc

olive pike
#

I have already stumbled onto a problem with unity netcode that im trying very hard to solve but no luck. Im making an fps game and when i host a server and join as a client from a different window, the client works perfectly. When I use the move keys only he moves. But on the host theres a problem. The host moves its body but sees everythig from the POV (camera) of the client so he sees himself from a 3rd person view. Basically im wondering how to tackle with multiple cameras attached to prefabs?

#

Anyone?

ionic rampart
#

I'm making a competitive fps and I can't trust the client for anything. I have learned you apparantly can't send GameObjects in RPC's. How would you then go about having the server move the client if I can't tell the server which client?

#
[ServerRpc]
    private void MoveServerRPC(bool w, bool a, bool s, bool d, GameObject thing)
    {
        Vector3 moveDir = new Vector3(0, 0, 0);
        if (w) moveDir.z = +1f;
        if (s) moveDir.z = -1f;
        if (a) moveDir.x = -1f;
        if (d) moveDir.x = +1f;

        float moveSpeed = 3f;
        thing.transform.position += moveDir * moveSpeed * Time.deltaTime;
    }

Tried this, but I'm not sure what to do when I can't send gameobjects

severe pilot
#

you could send ServerRpcParms?

#

That tells you which client has made the function call

#

I'm not sure if another client can send server rpcs to make it looks like it's been by another client though

#

that's a question I actually wanted to ask here

#

only the owner of the object in question will be able to call it

sharp axle
#

FPS Cameras

sharp axle
ionic rampart
sharp axle
ionic rampart
#

I'm dumb

#

I thought that would change the position of the server, but that's not possible

#

Makes sense, ty!

sharp axle
#

As long as you are using a Network Transform, it will automatically sync

ionic rampart
#

👍

ionic rampart
#

Quick question: Is it necessary to do camera rotation on server using serverRPC or is that fine to do on a client. I don't see any reason to do it on the server

terse swallow
#

Question.... I'm using NetCode for GameObjects. Why can I not add a component to a local client with AddComponent<Camera>()...? When I spawn a player I figured it would be easier to just add a camera to that client instead of trying to disable all the other players cameras.. I can't seam to add anything with the AddCompoment (as far a a client).

short vale
#

So I check isowner in the client a million times and send an RPC call, which only modifies a variable, never the network object, but when the clientRPC comes back isowner is never true. Why would isowner get changed?? :/ anybody else have this issue?

#

debugging the clients POV of the networkmanager, btw

high night
#

Hello, I am doing peer to peer multiplayer via deterministic lockstep.

I have a deterministic ball collision simulation.
I keep them in sync via lockstep. (I mean I am waiting for all the players inputs before stepping the simulation)

The player shoots balls in my game, and if I keep doing the regular lockstep way, there will have to be some latency before the player can see the recently shot ball.

I am looking for a good way to eliminate the latency to shooting balls.

Any ideas?

leaden totem
#

anyone know if upgrading to a higher bandwidth service from my ISP will lessen the impact my neighbor's usage has on my service during peak hours?

ionic rampart
unreal sky
#

how do I make it so clients can change the network variables of their own player but are unable to do so for server-owned or other player-owned objects

#

basically
the player is only allowed to speak in variables

#

how do?

#

and as a side question
can clients forge rpcs that are unknown to the server to cheat?

ionic rampart
unreal sky
leaden totem
ionic rampart
leaden totem
#

any brilliant minds know the answer to my q?

unreal sky
#

networking noob gang

sharp axle
leaden totem
#

the serverRPC does that, right?

ionic rampart
# sharp axle Physics would be handled by the server in that case. Then replicated out to the ...

Speaking of server-side physics, I'm having this weird issue with jumping where you can jump while in the air, only jumps by a very small amount and gravity is super slow. It works fine on the singleplayer version of the scripts, so I'm not sure what the issue is. Could you take a look at the scripts?

Network/server side: https://hatebin.com/wputwqwtzw
Single player: https://hatebin.com/vlqawpjaqm

Almost the exact same, but with the movement code in a ServerRPC in the network script.

sharp axle
sharp axle
#

Server movement

unreal sky
#

god i wish there was more support for client restrictions in unity lmao

ionic rampart
#

How can I do x piece of code whenever a client connects/disconnects? Also, when a client disconnects, will their player prefab be destroyed? And if they are disconnected non-gracefully(for example alt-f4) will their prefab still be deleted?

ionic rampart
sharp axle
# ionic rampart How can I do x piece of code whenever a client connects/disconnects? Also, when ...
unreal sky
#

how do I make it so clients can change the network variables of their own player but are unable to do so for server-owned or other player-owned objects
basically
the player is only allowed to speak in variables
how do?

lapis vapor
#

I have a TCPClient program build that works with an existing third-party server, and I have been attempting to instead swap over to connecting to my own TCPListener server running in Unity. The client seems to be correctly initiating the connection and the server seems to be accepting the connection, but the client's 'on connect' callback never fires. Is there something I'm missing?

#
server
void Start()
        {
            _instance = this;
            Client = new TcpClient();
            Server = new TcpListener(IPAddress.Loopback, 1001);
            Server.Start();
            Server.BeginAcceptTcpClient(new AsyncCallback(onClientConnect), Server);
            networkThread = new Thread(new ThreadStart(Listen));
            networkThread.IsBackground = true;
            networkThread.Start();
        }

        private static void onClientConnect(IAsyncResult ar)
        {
            try
            {
                TcpListener server = (TcpListener)ar.AsyncState;
                Client = server.EndAcceptTcpClient(ar);
                Connection = Client.GetStream();
                Debug.Log("Client connected!");
            }
            catch(Exception e)
            {
                Debug.Log(e);
            }
        }
#
client
...
    Client.BeginConnect(Dns.GetHostAddresses(ServerAddress), ServerPort, new AsyncCallback(onConnect), Client);
        }

        private void onConnect(IAsyncResult result)
        {

            Connection = Client.GetStream();
            networkThread = new Thread(new ThreadStart(ReadTCPConnection));
            networkThread.IsBackground = true;
            networkThread.Start();
            onLoginConnect.Invoke();
        }
#

The server prints out my Log line, and the thread for listening to the connection passes through an if(Client.Connected) check afterwards, but on the client the onClientConnect never fires Pray

#

What makes it more confusing for me is that the client works fine as-is on the third party server

lapis vapor
#

Turns out that swapping to a localhost connection caused an issue with a Unity function being called before the thread context could switch? I ended up just tossing it into a UnityMainThreadDispatcher.Instance().Enqueue() and everything is working as expected. This thread thing was literal non-issue when connecting to the third-party server... strange.

tough frigate
#

Hi, I want to know how IsOwner works. Client is the owner pf the player that network manager instantiate only? or that gameobject is also owned by server?

ionic rampart
#
NetworkManager.Singleton.OnClientConnectedCallback += (ulong id) => DisableOtherCameras("Player");
NetworkManager.Singleton.OnClientDisconnectCallback += (ulong id) => DisableOtherCameras("Player");

void DisableOtherCameras(string tag)
    {
        foreach (GameObject player in GameObject.FindGameObjectsWithTag(tag))
        {
            Camera playerCam = player.GetComponentInChildren<Camera>();
            Debug.Log($"is playerCam null {playerCam == null}");
            if (playerCam != null && playerCam != selfCamera)
            {
                playerCam.gameObject.SetActive(false);
            }
        }
    }

So I have this piece of code, and it works. A little too well. Currently, whenever someone connects/disconnects, all the cameras other than the one of the player gets disabled. And that's fine, that's what I want. Except I just want it to do it locally, not globally as it is doing now. I don't want them to get disabled across the network, as that breaks things for all players. Alternatively, is there a way to set what camera it should render to the screen?

jovial fiber
#

Question about Unitys Netcode, do i have to use unitys paid relay service if i use netcode or can i handle the relay stuff over steam for free ?

olive vessel
#

Well Steam relay is free at point of use, but to put a game on Steam is ÂŁ100

jovial fiber
#

yes but once 100$ is far cheaper then unitys relay service or photons ripoff prices

olive vessel
#

I notice you deleted your Photon rant, probably smart of you to do so

jovial fiber
#

yes

#

but still holds true

olive vessel
#

Your baseless unsubstantiated claims? No

jovial fiber
#

ive just calmed down im not going into that

severe pilot
#

Is there a way to have a null value in a network variable?

#

I basically want a pointer to a client

#

but some times I don't want it to point to any client

jovial fiber
olive vessel
severe pilot
#

currently I'm storing a ulong in a network variable, which means I can't store a negative value to represent not pointing to a client either thonk

olive vessel
#

I suppose ulong.MaxValue would work

severe pilot
#

hmm, good idea

#

thanks

olive vessel
#

It'd be difficult to get there just by clients joining, so it should be aight

severe pilot
#

yeah

#

I plan to have a cap of 10 players too lol

#

so I'd be very surprised if that ever caused a problem

#

I'm guessing ulong.minValue would just be 0

olive vessel
#

Yes

jovial fiber
#

i will look into mirror and NGO

#

and see who has more feature out of the box i need, i think i had a stroke when writing that
I will look into both and see which one has more of the features i need right out of the box

jovial fiber
#

I think NGO might be better regarding peer to peer, with host migration and late joining
Mirror supports none of both out the box, just offers work arounds in their docs

olive vessel
#

Neither support host migration out of the box, but both can do all that?

jovial fiber
olive vessel
#

That is Relay, not NGO

jovial fiber
#

oh

olive vessel
#

They are different products

jovial fiber
#

yeah ive spotted that

#

so yeah both need work arounds

#

i think mirror might be the better choice then

#

just cuz its more established and had more people work with it, there might be more help out there for mirror

olive pike
#

Hi. Whats more beginner friedly/easier to pick up? Photon Fusion, Photon Pun, Fishnet or Netcode for game objects? What would you recommend for someone tryna make a small multiplayer game to mess around in with some friends?

jovial fiber
#

after that its very expensive for what it does

olive vessel
#

20CCU, which is a tonne of players

jovial fiber
#

not really

olive vessel
#

Oh it is

jovial fiber
#

i have more then 20 friends lol

olive vessel
#

Who are all going to play at the same time?

olive pike
#

Yeah I've heard about that. Not planning to exceed 20 ppl. Thanks.

jovial fiber
olive vessel
#

Cloud cuckoo land mate

olive pike
#

Well just tell some of them to piss off for the time being (:

jovial fiber
#

we reach 30+ players on our ttt server sometimes and 17-18 out of them are close friends

olive vessel
#

GMod is far more popular than your game

jovial fiber
#

so yeah we have a ritual of playing games together

#

so yeah i would have about 20 ccu even in the dev time cuz they are hella interested in my game

#

cuz im mad enough to make a multiplayer game lol

#

i mean its over 20 ccu but only occasionally

#

most of the time if its just ramdoms in ttt it hangs about 8-12 players

jovial fiber
#

i dont either, but since its based on a relativly liked game with an unique concept that was only killed by greed i have my hopes up to get atleast 200-400ccu from the playerbase of the old game thats still waiting for something to happen (people promised to make remakes but didnt, cuz they stole assets and got sued lol)

stiff ridge
jovial fiber
#

Which doesnt make it better btw

#

photon is very costly for a managed peer to peer service

#

id rather look into mirror and nat punching if you go public

stiff ridge
#

The 100 CCU subscription is a one time fee for a year and you can get one quite cheap in most Asset Store sales (via PUN 2 Plus, e.g.).

jovial fiber
#

wich is like nah

#

for a public game its like fine i guess

#

but then if you go over 100ccu youre already stuck to photon and then they open their pockets with 125$ a month

stiff ridge
#

Yes, not arguing that it's maybe not fitting for all cases.

jovial fiber
#

yeah if you plan to go "bigger", photon quickly becomes very pricey for just beeing a managed p2p relay

#

even unitys relay service is cheaper

stiff ridge
#

Relay is not the same, you do realize that?

jovial fiber
#

it kinda is, it relays the peer to peer instances over the unity network

#

photon does the same with pun/fusion

stiff ridge
#

No.

jovial fiber
#

yes.

stiff ridge
#

Fusion is doing a lot more.

jovial fiber
#

what exactly

#

if you talking about any of the features on the front page with the lag stuff or client prediction, thats only for the server based fusion, the enterprise solution lol

stiff ridge
#

I guess you know but don't care. Which is fine. You don't need any of what it does, so .. don't use it.
It really depends on what you need / want out of a solution.

jovial fiber
#

the normal shared/premium fusion only uses a relay and its peer 2 peer

stiff ridge
#

Oh, is it?
I have to talk to my colleagues then.

jovial fiber
#

sadly lol

#

its just p2p over a relay and they charge loads for it

olive vessel
#

Well that's simply untrue

jovial fiber
#

Bro did you even look at that picture

#

they even tell it

#

its peer 2 peer with a relay server

olive vessel
#

Yes, but that isn't all it is

#

There's more features out of the box

jovial fiber
#

there cant be more to it lol, thats the way their stuff works, theres no secret in relays or like anything else

#

its peer 2 peer with a relay

olive vessel
#

You're paying for the other features

stiff ridge
#

This is a misunderstanding.
We / Photon just doesn't do hosting. You can export server builds and run them on any machine you like. But Photon doesn't do that.

#

If you want that, Unity's relay and others alike are not going to help either.

jovial fiber
stiff ridge
#

If you are after hosting of dedicated servers .. you'd need some machine, not a relay.

#

why do you advertise it like that then
And where do we do that?

jovial fiber
#

right on the start page

#

you advertise all kind of stuff thats only possible on server-client

stiff ridge
#

None of that says: We host that for you?

jovial fiber
stiff ridge
#

Fusion is doing that but in a host / server executable.

jovial fiber
#

i see that differently

stiff ridge
#

And we are back to: Ok, I won't argue. Fine.

jovial fiber
#

everything looks like youre buying a all in one package

#

so youre paying for something you could have

#

lol

stiff ridge
#

Ok, yes, the latter screenshot is easy to misunderstand, I agree.

jovial fiber
#

everything combined the first advertisement page in combination with the photon cloud pricing

#

yeah its very misleading imo

stiff ridge
#

Sorry about that.

jovial fiber
#

well are you responsible for that ? Apparently, you wrote "We / Photon"

stiff ridge
#

Something that's hard to convey on marketing pages is this: Fusion does everything that is advertised. The matchmaking and relay are online services (always) but the Simulation, Prediction, etc is something that runs in-Unity and we don't host that. Players can run it (very easily) on their machines (hosting the game) or you'd actually need someone to host Unity instances and you'd run dedicated servers.
I will try to convince my colleagues to make this more clear at more places (it is somewhere in the docs).
Thanks for the feedback.

#

Well, I am working on Photon.

jovial fiber
stiff ridge
#

And I think Luke and you just had a misunderstanding. You don't have to run dedicated servers or Enterprise servers. That's absolutely not needed.
You can run a Unity build as server (dedicated or whatever).

jovial fiber
#

but i guess you have to pay for the service as a whole

#

you get way easier networking setup and buch of nice features out of the box, but you have to pay for it

stiff ridge
#

I think what Luke wanted to say is that players connect directly to the Host / Server. This is normal and even if you paid someone to host your server instances, the clients would still attempt to connect directly.

#

Direct connections are often called peer to peer but that's sloppy at best, if you use a host / server, which is in fact the center of all connections and entirely authoritative.

jovial fiber
#

so its as insecure as usual peer 2 peer

#

witch cheaters, luke even confirmed that

stiff ridge
#

What is an actual server?

jovial fiber
#

what

stiff ridge
#

You mean a dedicated server?

jovial fiber
#

yes

#

cuz an player acting like a server isnt like an actual server, just a host in that moment

stiff ridge
#

A machine that you run...
That is a dedicated server. It is also a server you could run at someone's home or at a player. So ...

jovial fiber
#

well yes

stiff ridge
#

Yes, ok.

jovial fiber
#

but your system uses hosts

#

not dedicated servers

#

unless i buy an extra ded server

stiff ridge
#

Fusion can use one or the other.
If needs be, run it on machines dedicated for that.
If security needs that, it's possible.
But yes, we don't host that for the price of the subscription. True. And as said: I have to agree that it's not clear on the pages you quote, so .. point taken.

#

You can host Fusion instances dedicated on basically all services that support Unity instances.
You could even do a mix: Some hosted (by players) and some games are dedicated.

#

Then, to make this clear too: Unity Relay, Epic Online Services or Steam also don't host any of your builds, afaik.

jovial fiber
# olive vessel You're paying for the other features

well yeah its that obv, but its still overpriced imo if you go over 100CCU its 125$+ a month for a system to build your game on, basically a license to use their product, i think just the 95$ a year for all CCU's would be more fair since they arent hosting servers or anything, just the relay server

olive vessel
#

100CCU is a tonne of players, so if you have that many sales you can afford to pay

jovial fiber
#

unity does too, so i already had that put aside

stiff ridge
#

As said: We may be too expensive for what you need / want. As far as real customers are concerned, none went bankrupt because of our fees and most are happy we are constantly working on all the involved systems to improve.
And we don't just relay when it's absolutely necessary. There is permanently a connection to find players, fill rooms, etc.

jovial fiber
olive vessel
#

It's also $7.99

jovial fiber
#

what, zula is free to play

stiff ridge
#

Unless you have a ritual to play the game on a specific time, hitting 300 CCU is in fact quite a bit.

jovial fiber
olive vessel
#

Very bold projection...

jovial fiber
#

with photon we would have to buy the 250$ a month thing, which is highly expensive for a free to play game

jovial fiber
#

free to play games have a higher player count anyways

olive vessel
#

Bold of you to assume they'll come to your game and stay

jovial fiber
#

well

#

there they go play something else

olive vessel
#

Players playing has nothing to do with CCU, you heard it here

jovial fiber
#

it has ?

olive vessel
stiff ridge
#

The CCU are not capped for the monthly-paid plans. You can decide if you want to cap it but it's not capped by default.

jovial fiber
# olive vessel

just not about the ones leaving, but the ones that are trying the game or playing it

#

who cares if they stay if the ccu is still exploding at the gaming time from people wanting to try it out

#

the problem is not the mau, but the burst ccu (1-2 hours i guess)

jovial fiber
stiff ridge
#

Honestly, if your CCU explodes, you have luxury problems. Hosting dedicated Unity instances for every f2p player will be a bigger problem than anything else if you can't run a lot of instances on few machines.

jovial fiber
#

"After your first burst you have 48 hours to upgrade your subscription plan before we, subject to our sole discretion, may cap your number of CCU to the agreed number."

stiff ridge
#

Afaik, we never had to do that. But yes, in theory, this is what we could have to do.

jovial fiber
#

so it is capped but you may exceed it once so you can go a step bigger

stiff ridge
#

Usually, we figure out a plan with the developers.
Having too many players is rarely a problem.
If you can't monetize the game or don't want to, yes. But then do yourself a favor and don't run dedicated machines.

jovial fiber
#

if i bought the 500cuu package

stiff ridge
#

We'd cap your CCUs if your max is 2000 and you pay for 200. Yes, sure.

jovial fiber
#

so i end up on a net negative

stiff ridge
#

Let's cut this short: The pricing doesn't fit for your game.
I am not happy about that but can't help either. It is what it is.
I only wanted to clarify what we do and what we don't and I learned that our marketing and pricing pages are not good enough.

#

Do look into the pricing of actual hosting. Make sure to understand the traffic and performance your game will need when running a dedicated server, because that's going to define your costs.

#

Fusion might still be cost effective for you if you are able to run more instances on fewer machines with less traffic paid for but .. that's just a hunch and may depend on what you do.

jovial fiber
#

im still looking into photon vs mirror with steamworks

#

you explained a lot of stuff i seemed to have misunderstood

#

yet the biggest question stays if i will be able to afford the price with the few microtransactions my game will have

stiff ridge
#

Yes, that's a tricky question. Always.
If you don't mind, our advice (pretty much everyone at Photon thinks like this) is: make a fun game first.
You can make it player hosted (no matter which solution you choose) and figure out how it's being played. You invest time already. If some tool will save you time and costs a reasonable amount, get it. This includes but is surely not limited to a one-time subscription for 100 CCUs, should you use Photon.
If your game is successful, there is usually some way to make the next steps. If it's not played by anyone except friends, then this is what it is.

frank meteor
# jovial fiber

Man wait till you find out people are selling 3D models in the asset store when you could just learn blender and make them yourself.

#

Turns out you can probably do most things yourself for free. You pay for someone else to do em because ideally your time is better spent elsewhere. Yeah, you can set up a p2p networking service for your game for free, but if you are making the hourly rate for game developers it's gonna cost you a whole hell of a lot more than $125 a month to maintain

#

If it's not in your budget then that's fine, but a lot of people just don't want to deal with that at all, and if a sub-four-digit expense on network infrastructure is outside of your budget, chances are slim you'd even need to pay in the first place.

jovial fiber
#

I might have miscalculated if 500 ccu is like 5000dau, then thats 50k different useres monthly aprx, that should easily run in 165$ from our micro transactions to afford photon fusion + chat

stiff ridge
#

CCU * 20 ~= DAU
DAU * 20 ~= MAU
40k MAU are often not more than 100 CCU.
Of course, if you run tournaments, events or release updates the calculation may be off.

jovial fiber
#

Im mostly speculating for the release window

#

Where those numbers arent really accurate

#

There its mostly ccu*4 = dau from what i have seen, since ccu peaks at release windows, but its completly unpredicable what the mau is gonna be

#

Thats my problem

#

How would i handle the masses on release if i have like normally 80-100ccu afterwards, but on release i have 5000ccu cuz marketing worked and ppl want to try out the game theiy heard about since its free

#

But like only 1% of those actually buys something thats in the end maybe 300$

#

I think i like the mirror route more tho since its not pressuring me to earn a certain amount of money to keep the networking alive

#

Self sustaining to say

#

Either by beeing completly "free" (besides my time) to run or by having micro transactions

#

But then again if i use the 1% route its still 20000mau = 200 purchases = atleast 200*4 = 800€

#

Wich i can afford the 165$ with

stiff ridge
#

Give both networking solutions a try.
See if you like either solution better or not. Keep in mind that the first steps can be confusing and don't guarantee you can reach the goal in the end. Just as example: PUN 2 has a tendency to become more complex to reach the best results in the end, while Fusion is a bit more complex initially but should not surprise you later on (to just talk about 2 solutions I know somewhat).
You now know that a 100 CCU one time subscription can get you a long way in terms of MAU. If needs be, you can cut the cost to this price point. So you can decide if you like the solution and if it's worth it to you.

Good luck. I'll be off.