#archived-networking

1 messages · Page 7 of 1

ripe mesa
#

imagine someone (client) editting your game exe, they put runner.spawn everywhere

#

they literally own the room

lusty glade
#

Ah, that make sense

#

Another problem is, OnPlayerJoined doesnt get called on server either on host

ripe mesa
#

join the photon server, the support may be able to help u

#

runner.addCallbacks()

lusty glade
#

shouldnt the callback is automatically registered by the runner?

ripe mesa
#

INetworkRunnerCallbacks, no. the other should be but not sure

lusty glade
#

the callback get's called when the host itself entering the room
but not when client joined the room

ripe mesa
#

is it INetworkRunnerCallbacks or IPlayerJoined ?

lusty glade
#

INetworkRunnerCallbacks

#
public class Runner : MonoBehaviour, INetworkRunnerCallbacks
{
    public void OnPlayerJoined(NetworkRunner runner, PlayerRef player) => Debug.Log("Player Joined");
    public void OnPlayerLeft(NetworkRunner runner, PlayerRef player) => Debug.Log("Player Left");
}```
ripe mesa
#

how do you register the callbacks?

lusty glade
#

Fusion Customer Service?

ripe mesa
#

photon discord server

lusty glade
#

wrong room then 😅

#

cant find it 🤔
there was official one but it's expired

lusty glade
ripe mesa
#

add before the session stars

lusty glade
#
{
    public void OnPlayerJoined(NetworkRunner runner, PlayerRef player) => Debug.Log("Player Joined");
    public void OnPlayerLeft(NetworkRunner runner, PlayerRef player) => Debug.Log("Player Left");
    private void Start()
    {
        if (_runner == null)
        {
            _runner = gameObject.AddComponent<NetworkRunner>();
            _runner.AddCallbacks(this);
            _runner.ProvideInput = true;
            Debug.Log("Runner initiated");
        }
    }    
}```

it still not fired when client join btw
#

🤔 maybe it doesnt joined the correct room

ripe mesa
#

OnPlayerJoined can be called first rather than Start

#

i've sent you a DM btw

lusty glade
ripe mesa
#

yes, it can be called after the OnPlayerJoined

lusty glade
#

Do you mean, that the runner can get destroyed somewhere then recreated again?
The runner Start is called before the player joined the session, so how could it get called after OnPlayerJoined? 🤔

ripe mesa
lusty glade
#

currently on the same scene..
I tried loading other scene but had no luck since only the server able to change scene
so rightnow, the room is in the same scene as the lobby

#

seriously, fusion needs better manual/tutorial. I never have the same problem with pun

ripe mesa
#

show full code

lusty glade
#

which one, the runner or the lobby?

ripe mesa
#

why the you name your behaviour "runner" ?

lusty glade
#

Good question, I'm not sure why I named it that, but I could rename it if you like

sharp axle
mighty whale
#

In NGO if I get component <Player> will that return all game objects on the server with that script? Or just that instance of the client? Or does being server or client change it’s effect?

sharp axle
mighty whale
#

Well what if I only want to find the component of a specific client with NGO

sharp axle
mighty whale
#

For example, each player will have farms, but I only want the farms to affect the player who built them

sharp axle
#

For that I would spawn the farms with client ownership. then your farm script can check isOwner

mighty whale
ember kettle
#

hey quick question, for my fps controller if i wanted to sync the vertical aiming of the client (based on a float value), would it be ok to use a NetworkVariable for that or is that too inefficient and expensive

#

i basically need to sync that value whenever the player aims, which is a lot. i tried a network transform but it didnt work since im using IK for my model and each spine bone would need to be synced

#

right now im using a network variable and it works fine, but im not sure if network variables are designed to be used that way

sharp axle
deft vigil
#

Anyone with experience in working with the Playfab SDK here?

#

Want to make a Facebook and account login possible for syncing with server databases and inviting friends to play with.

daring sable
weak plinth
#

Has anyone managed to get the official FPS controller working with Netcode fully.. My movements work perfectly but not the cameras for each individual user

sharp axle
dapper raven
#

When a player joins a Steam lobby i would like it to change a number. Does anyone know how to see if a player joins a steam lobby?

keen plume
#

Anyone have a 1st person multiplayer using photon that has a chat?

craggy wharf
#

Hello, I have developed a game like Angry birds. The game is played on the internet(webgl) . My question is i want to add dedicated server for my game because of the security . What would you recommend for this? I searched mirror server but it seems difficult , how can i do this in the easiest way ?

weak plinth
#

it works if there is only 1 player if more join it gets weird up

sharp axle
weak plinth
#

mhm Alright that makes sense

weak plinth
#

Does character control not work with network?

#

My character movement works as a Host but not as a Client

#

I am using client network transform

#

When I try to move my character using transform it works

#

but not character controller

sharp axle
weak plinth
#

so what should I use to make the server allow me to move?

sharp axle
#

disable to character controller on the remote players

thin crystal
#

How should I handle server authoritative variables such as player health points?

#

For example if I hit someone with a Ray cast and want to decrease its HP

weak plinth
#

what is the best networking solution for an mmo

olive vessel
mighty whale
#

People be casually talking about making MMO’s

sharp axle
astral nimbus
slim path
#

hey,
im working on a lobby system for a networked game.
1 - I wonder if I could connect (.NET c#) with a database ? to store lobbies and list them on request
2 - if that is not possible, how reliable is a list of dictionaries to handle it ? ... what if 100,000s player were online at the same time, how reliable would that system be ?
also I have an old python based lobby listing system , I wonder if I could host both of them on the same ubuntu server

austere yacht
# slim path hey, im working on a lobby system for a networked game. 1 - I wonder if I coul...

you can talk to a(any) database with c#, the question would rather be what kind of performance you need and to pick a DB accordingly (on disk, vs in-memory), what kind of robustness you need for the data (ACID or not) and whether or not you need scale (sharding, replication, consistency profile). If you don't need persistence, you can do it all without a database using data-structures of your choice, all the built-in data-structures in .NET perform very well under load and at scale, that is what they are made for. Whether the app you build from them is robust, depends on your decisions during development. Typically scaling of an app deals mostly with the nature of distributed architecture (wildly dynamic load, unreliability, consistency, resource congestion, security, ...) more than squeezing the most performance out of any individual component.

edgy fable
#

What is the best way for the client to get his angular velocity from the server when using networked rigidbodies? Currently I'm using a server rpc to set a networked variable, but I feel like this isn't a very good way to be doing it.

hushed coyote
#

Can Unity Netcode for GameObjects handle ~10 players with simulated rigidbodies, animations etc. Evaluating network solutions for a 3D multiplayer shooter (doesn't need extreme accuracy like an FPS would)

austere yacht
hushed coyote
#

And the second question I have is more related to best practice architecture, what's the best way a dedicated server build can communicate with our API? Just send http requests directly from the server? Maybe inject a socket connection?

sharp axle
hushed coyote
willow wren
slim path
austere yacht
tidal prawn
#

Hi, I keep getting this error. The weird part is that it works in 1 scene but not in another. [Netcode] Deferred messages were received for a trigger of type OnSpawn with key 19, but that trigger was not received within within 1 second(s).

#

google isnt really clear on this topic so any help would be apreciated

sharp axle
tidal prawn
#

Ill check it out

hushed coyote
tidal prawn
sharp axle
tidal prawn
#

and is there a fix for that?

sharp axle
tidal prawn
#

yeah thats gonna be hard xD

#

but thnx anyway Ill try my best to fix it

zealous thicket
compact fox
#

I have a game working but have to set up the IP to some laptop and it is inconvenient to demo. I had a free demo of Google Cloud in which it worked to have a dedicated server running all the time that the game just automatically connects to as the IP do not change.

Wanted to ask if there is a method of just having a server with like maybe max 20 players?

#

So that I don't have to demo it with a different IP each time.

#

Like resources where I can just run on some Virtual Machine or some dedicated IP for this? I am not sure what the method would be. I just can't demo with the LAN method much anymore because it takes too long to teach

#

Like I have to teach the players how to connect to the IP and enter the address and such. Opposed to games like Valorant which I assume just have an IP address hardcoded to some larger server farm or something

#

(I only need a server that runs like up to 20 players or something)

spring crane
#

@compact fox Sounds like you could use some free dynamic DNS service if you just need to deal with the IP changing.

sharp axle
dark crown
#

I'm trying to test out some multiplayer fps ideas but I'm running into an issue where whenever the client connects, the host's view takes on the client's perspective, anyone know why this is happening?

#

I'm using the unity networking framework

austere yacht
tidal prawn
#

Hi a bit of a weird question, I got a few scenes that didnt work I copied them fully to new scenes and everything works. Is there something like a netwerk reset or something you need to do for older scenes or? It works so I can continue but this doesnt make any sense

sharp axle
tidal prawn
#

[Netcode] Deferred messages were received for a trigger of type OnSpawn with key 19, but that trigger was not received within within 1 second(s).

#

this one

#

it were just some toggles to enable disable gameobjects

dark crown
austere yacht
cunning egret
#

Using Unity Netcode for Gameobjects, I added a screen that shows my playercount. This turned the component into a NetworkBehaviour, which it wasn't before. Now, when connecting, my component increases 60% in size because of this, because it syncs the size with the client. if a build runs as 1280x720, my editor will appear like this to sync it. How do I disable this?

#

The right variant is what it's supposed to look like, but because of the resolution difference, the left size scales upwards for some reason.

#

I understand that the UI of the host is synced with all clients, but I don't need that here, since I just require the current player count to be updated.

compact fox
#

When is a project ready for "Unity Relay Services"? I was going to just throw the game on there now but realize I haven't really finished all the code for the Client-Server LAN interactions. Currently there is no real win or lose state and no lobbies or main menu. I am modeling it sort of off of Valorant kinda.

#

The game is currently networked and you can interact and PvP, but like the actual game itself isn't that polished and doesn't have like all the game loops done.

#

(Basically, I assume the game should work on LAN before I decide to grab some dedicated server for it. My main issue currently is that I cannot demo it unless I give all players some quick lesson on like IPs and how to connect to LAN.)

#

It will be much easier to demo once I have a dedicated server, but I feel I should first make the core game loops polished and exist first.

sharp axle
sharp axle
compact fox
sharp axle
compact fox
#

Yeah, my laptop can't handle 2 people playing FPS or even Valorant.

#

I can do LAN but the demos requiring me to teach people to enter IP and connect and such

frail sorrel
#

Is the new unity netcode worth using over using Mirror?

austere yacht
#

depends on what your needs are

cunning egret
#

This option exists, but it did not change anything for me when I disabled it.

#

I was wrong, my solution is not possible.

#

So I have to create a whole seperate gameobject just to sync it, because the UI scales weirdly when I turn it into a NetworkBehaviour? Welp

#

Alright so I moved anything related to the NetworkBehaviour into a seperate component that is invisible, and it now works.

#

I would still love to know if I can disable this syncing at all

frail sorrel
#

Probably a very simple question to answer for someone who is familiar with the new netcode, but what is the netcode equivalent of Mirrors NetworkIdentity?

sharp axle
frail sorrel
# sharp axle It's network object

Earlier I would pass the NetworkIdentity of a gameobject as an argument for certain rpc calls, is it possible to just replace this with NetworkObject or do I need to do a roundabout way of passing the NetworkObjectId instead?

sharp axle
frail sorrel
#

So gonna have to rewrite some stuff I guess. It was for the purpose of parenting a spawned gameobject to a previously spawned gameobject. I'll have to pass the network object reference instead?

sharp axle
#

But also parenting network objects gets a bit complicated. I've been using physics fixed joint instead of messing around with that

frail sorrel
#

So for equipment you would rather have it all handled offline through rpc calls instead of having the objects networked? I guess that sounds smarter than what I have been doing tbh lol

#

I see that I can use NetworkObjectReference.TryGet() to get the NetworkObject itself if it comes to that I guess

sharp axle
#

I'm pretty sure you can also just cast it back to a networkobject if you're certain it hasn't been despawned or whatever

cunning egret
#

And with prefab syncing you mean more than just the UI syncing I suppose?

sharp axle
# cunning egret And with prefab syncing you mean more than just the UI syncing I suppose?
compact fox
#

Had a few odd questions about Networking with Unity Relay.

What if suddenly I get more than 50 concurrent users?

Can a user launch some sort of attack that causes many bots to connect at once causing me to be charged lots for data usage and such?

And also wanted to ask about how public this will be? Mainly just worried of the ways people might make me pay money for the data and user amount charges? (And how quick I can cancel if something weird arises?)

#

Just sort of thinking about managing budget for this. Along with what to do for generating revenue. This is just portfolio material for college and career sort of based on Valorant.

sharp axle
compact fox
#

Can Mirror Code be used with Unity Relay? I currently did my LAN in Mirror. I am now working on trying to set up a simple lobby with Relay. Also wanted to ask if there are any really good simple easy to follow videos recommended? I found like a handful and wondering if any in particular are clearer or better. (Or maybe if there is just template example code that already exists, and I can just copy paste the Mirror Code attaching it to it?)

sharp axle
sharp axle
gray pond
spring crane
compact fox
#

I guess it is more just a 'virtual machine' or something to run the server from 24/7?

Currently my game works completely fine with "LAN" if I run use my laptop and have people connect to it.
It also works when people are on different wifi and is like over the internet too.

I had the free month of Google Cloud which was an easy solution because I just ran a virtual machine 24/7 that you connected to because my game hardcoded IP and would always just connect to the IP of that virtual machine.

I guess one solution is to just buy a new laptop or virtual machine or something that can hold an IP that never changes?

#

I feel Unity relay might be too complicated for what I'm trying. I guess I am just looking to get a IP address that doesn't change so that instead of having to type in the IP each type it just automatically connects to that address. A virtual machine works but those cost like 35$ a month or something. There should probably exist one that is free?

#

I dunno how IP Address works anyways, the IP of a laptop changes and it is also hard to keep a laptop on 24/7, while virtual machines can easily be online 24/7.

gray hill
#

I'm having an issue where when the player trys to switch weapons the model only switches with the local player but all the other clients don't see the change happen

sharp axle
gray hill
#

it is still not working

#

the weapons are children of the player and thus have no network object on them

warm mica
#

Guys how can i play animations to other players with photon

#

i have a ui

#

when i click a button i wanna play a animation with photon

gray pond
cold mason
#

Does anyone know if there are any popular games made with Mirror?

haughty heart
untold elbow
ashen mountain
#

Where can I learn about Netcode networking functions and etc? So I can learn more about unity networking overall.. Also- does anyone have a basic template or like something I can like "read/learn" with ?

olive vessel
ashen mountain
exotic geode
ashen mountain
sharp axle
clear sky
#

Hello, I created a game scene with netcode, I would like to find ( a guide maybe ) a way to upload the server build in a linux server and run the game in this server. I f one of you have a clue you can share , thank you and happy hollidays

sharp axle
strange stratus
#

Hi. One question, with steamworks what is the actual difference between a lobby and a server? Because when I try to get all the lobbies I can't get the name but when I try to get the servers I don't know how to set the name of the current one😅

clear sky
#

@sharp axle I did it, but don't know how to upload the build and how can I run this from my dedicated server

sharp axle
keen blade
#

Hello fellow gamedevs! I'm adding a networking functionality for the first time and even though I have a somewhat OK understanding of what networking does and how it does it, I have a few questions.
For starter I'm working on P2P multiplayer with 1 host and 1-3 clients. For the moment I don't really mind anti-cheating or even server correction/client prediction, I'm just trying to get something working with a clean architecture that I can easily modify later.
I've currently solved all the issues I had with the serialization/compression and with the transport layer, and basically all that's still causing me issues it the application logic, i.e. the code architecture, when to do what, which pitfalls to avoid.
Basically I want the host to be authoritative over the clients, which makes me think that the host holds a schema of the game state (i.e. the complete data state of the current lobby/mission), and it should be possible to completely rebuild the lobby/mission from the schema only. Then, clients send actions to the host, which processes them, and then broadcast "patches" to the clients, allowing them to update their schema. So at the connection each client gets the complete schema, and then all the "important" data is sent through reliable packets that only contain deltas of the schema, basically. The other stuff that's less important (for example the enemies behavior) is sent through unreliable packets.
But even with that in mind I'm struggling to see how to properly build an architecture that wouldn't be a nightmare to maintain.
I've look online a lot and found some interesting articles, but most of these resources didn't go enough in detail in my opinion.
If you have anything to share I'd gladly accept your knowledge! Also my main idea might be completely garbage, and if it is please let me know 😉

sharp axle
keen blade
# sharp axle Honestly, I would not stress about maintainability of your first multiplayer gam...

Thanks for the answer 🙂

I'm not looking for something very "frame-dependent" such as fighting game, so no rollback or anything. For now I just want solid P2P (well, more like "dynamic-host-based authoritative P2P", meaning that there is 1 host and 1-3 clients but if the host drops out it's possible for a client to transform into a new host - but this isn't the main point now), with "good enough" transport time. Basically I want a good foundation on which I can then work to implement things such as client prediction/host correction. When the transport time becomes an issue I'll deal with that. But I do want to have "real-time" P2P so not a thing like lockstep P2P.

In short I'm looking for a clean way to decouple as much as possible the networking stuff from the game stuff, while trying to not create too much redundancy because of the P2P nature of the networking (meaning that most entities might end up having two version, one host-side and one client-side).
But most articles I find do not actually show any diagram or any code regarding to the actual processing loop of such networking.
I just took a look at Game Engine Architecture and it barely says anything regarding networking unfortunately (3 pages for both client/server and P2P).

I already have code that makes the multiplayer works, with a lobby system and some packet definitions/handling for notifying the host and broadcasting data to clients, but it's already a mess and the game has almost 0 feature 🥲

#

Also my current code is not very resilient, i.e. some things can go wrong because I don't have very sound interfaces for packets management

sharp axle
#

I feel you. Your approach is also going to depend heavily on which networking framework you using. If you are custom coding everything in raw sockets, then go with God. You are not going find any help with that online.

keen blade
sharp axle
keen blade
#

I see 🙂 This might be good enough for my game since it's only 4 players anyway. I don't really want to integrate Netcode because if I can avoid something made by Unity I'll avoid it lol

#

I mean it's a good opportunity to learn anyway 👍

#

I'll try to find some more resources on the subject

grave ice
#

Does Photon Quantum support self hosting? I can only find documentation referring to self hosting and fusion.

strange stratus
#

One question, does anyone know why when requesting to get the lobby list for a steam game I get different results than others please?

fallow adder
#

has anyone done projectile with data buffer approach in photon fusion I dont understand their sample why all projectiles share one gigantic struct where is that struct even used to run projectile I want to know what I need for bare bones implementation not a whole system bruh

sharp axle
fallow adder
#

yeah you would rather win a lottery than get answer there kekw ty tho

indigo spruce
#

What do you guys think is the best networking solution

#

Or what networking solutions are better than the rest

austere yacht
livid olive
#

in the script on trigger ive made it so the player disconnects but i want them to join or create a room but it doesnt work anyone have any ideas upon fixing it?

terse idol
#

Hi, how can I make other players hear each other's gunshots?

#

I am using photon

indigo spruce
#

Use an RPC

sand sleet
#

im using PUN 2, i wanted to ask if 3 photon views(1 on gun, 1 for movement, 1 for wepon switch) will have a big impact on my performance

candid dagger
# terse idol Hi, how can I make other players hear each other's gunshots?

this is something i did

public AudioSource footstepAudio;

if (Input.GetKey(KeyCode.W))
    {
        if (characterController.isGrounded && characterController.velocity.magnitude > 2 && footstepAudio.isPlaying == false)
        {
            photonView.RPC(nameof(FootstepEffects), RpcTarget.All);
        }
    }

[PunRPC]
void FootstepEffects()
{
    footstepAudio.Play();
}
```also you gotta make sure to have the audio source set as a 3d sound
terse idol
#

how can I call a specific Audio tho, or should I make a function for each audio?

candid dagger
candid dagger
#

np

compact fox
#

What is the cheapest or easiest way to just get something that runs 24/7 and has an IP address that does not change?

Mainly so when demoing my game, I do not need players to type in IP address, and instead can just hardcode the address to connect to. (It is awkward to spend like 20 minutes to get the IP and then have players type in to connect)

indigo spruce
#

whats the difference between kcp and tcp?

austere yacht
sharp axle
tepid wren
#

Hi, everyone can you tell me how many type of protocols have in photons?

compact fox
# sharp axle I guess that would be to call your ISP and ask for a static IP address. The real...

I tried looking up Unity Relay and it seemed too confusing for something simple I am trying to do. I am wondering if there is just something simple? Like the way I currently Demo is by having players enter in the IP into the client connecting button and then the game works. My goal is just to make that IP always the same so I can just hardcode it and not have to have people type it in each demo.

#

Also Unity Relay and Mirror Networking do not seem to be nicely compatibles.

#

Like one solution that I had a while ago was just to get a Virtual Machine or actual Laptop that would be dedicated to running the server 24/7 or something. I am living with my parents and cannot call ISP. My parents are also the type who will not let me touching anything. They are not STEM, they are in life insurance endorsement relating to social media connections job.

#

I guess the solution could just be to have a build and run myself that has the IP hardcoded and just change what it is hardcoded to for each build.

#

I guess even if I buy a server or a laptop it will not working because my parents often turn on and off the internet which changes the IP sometimes frequent.

#

How does Internet even work? I believe my parents have to pay like monthly for it. Is there an 'internet' thing I can buy that is just 'I own it' and can just run it 24/7. I am only looking to hold a maximum of like 10-20 people.

#

One of my friends in college had a Minecraft Server. They apparently 'found it lying in a tech dump' and then were able to just turn it on and off to hold the server, and the server had a consistently same IP.

#

They showed me their server on campus in their dorm was just a pile of like stuff?

marsh musk
#

Can network variables be static, and can they be modified/read outside of their script, like how you would a regular static variable.

fallow adder
#

im looking to learn how to create database save retrieve data from it in unity now I did try some php to test the waters, disgusting language kekW tho watched outdated series what are the options nowadays? Can I use database without going through php? 0 prior experience btw so something easier pls

sharp axle
sharp axle
spring crane
fallow adder
#

Nice thanks pepeLoveKing

mental plover
#

anyone know if facepunch steamworks still has IP leaking issues?

forest willow
#

Hello. Can anyone help?(About TCP/IP)

olive vessel
forest willow
olive vessel
#

TCP is a protocol, don't like it, use UDP

forest willow
olive vessel
#

UDP is different, it's unreliable but that means it's quicker. You can read about the differences online

forest willow
olive vessel
#

What?

forest willow
olive vessel
#

TCP is just a protocol to send packets over the internet

#

If you don't want to use TCP, you can use UDP, if you don't want to play with sockets yourself use a higher level library

#

There are lots of solutions for multiplayer in Unity that do lots of the heavy lifting for you, like Mirror, Netcode for GameObjects and Photon products

forest willow
sharp axle
sharp axle
#

Can't help you there. it different for every router

forest willow
weak plinth
#

Hi,
I am looking into networking solutions. I am working on MOBA like Arena game:
Matchmaking => Fast paced arena dueling (2 to 10 players)

I found several solutions for Networking, I put a lot emphasis to open source code so if some peculiar situation comes I can dive deeper into the code. I found Mirror and reading through documentations I seem to like it.
Are there better solutions that I should be aware of and I missed?

How about hosting it?
I found solutions like Azure PlayFab, Edgegap, etc.
I find Orchestration important part of the solution as I think it's correct solution - "no resources wasted" if I understand it correctly.
What hosting is the best pricing wise and scaling up from ground zero, etc.?
(Putting emphasis on price as I am trying to stay as lean as possible)

Any advice or tips for beginner learning multiplayer game dev from zero?
(I have prior experience in software engineering, web and backend dev, small game dev, etc.)

ripe mesa
sharp axle
# weak plinth Hi, I am looking into networking solutions. I am working on MOBA like Arena game...

You choices for frameworks come down to Photon, Mirror, Fishnet, and Unity's Netcode (for GameObjects or Entities). Differences primarily are out of the box features and pricing.

For backend services, I really like Playfab and Unity's Game Services is very much on par. They only thing it's missing a Friend system, and that I believe is in beta right now.

Learning from zero is the same advice as always, start small. Cut your scope in half. Then cut it in half again. Don't try to make a full game right at the beginning. Start with just connecting a client and host, then moving a cube around, then syncing variables and sending RPCs, then get animations syncing, ect.

austere yacht
# weak plinth Hi, I am looking into networking solutions. I am working on MOBA like Arena game...

if price is a concern, Photon Quantum is a no-go, you can use Mirror but you'd have to build a lot of stuff yourself (basically all the hard stuff you'd need to make it suitable to competitive multiplayer), the same is true for NGO, your only option to move fast rn is Photon Fusion, it has a free tier you can use for development. Beyond that the price is fair. You may stumble over FishNet which promises competitive features but they are also not free and there are no known projects that use it at scale.

On the hosting side, you can develop on PlayFab for free if you are careful and it can get expensive real fast, Unity's free tier is a bit more comfortable as you don't max out your free contingent as easily.

If you want to learn from scratch, prepare for a long journey and best not use any of the mid level frameworks, but learn from them and build a custom system on top of a suitable transport (ENet, KCP, Unity Transport, Photon Transport)

#

Note that syncing some variables and implementing RPCs to work is relatively easy, the problems and difficulty only appears when doing a real project (with complex state) and then again when you try to scale it and your entire network stack needs to be rewritten. It is impossible to forsee all the issues you will have, which is why it takes so long to become competent. Middlewares like NGO speed that process up a bit and eliminate a lot of gotchas that you'd have run into if you were to DIY it all. Nevertheless they come with their own issues based on their nature as generic solutions. Whatever these issues will be depends on your actual journey.

weak plinth
gray pond
azure ember
#

Does anyone know how to isolate a Boolean from other instances of the same script in different players, so only one instance of the bool changes

austere yacht
sharp axle
knotty root
#

can someone explain to me why I would need to use unitys Relay service? I am confused, does the lobby service and Netcode for gameobject service already cover joining players and then syncing data for all players across the network? so whats the point of Relay?

sharp axle
knotty root
#

like im not using anything else except lobby and NGO, and im trying to figure out if i need to use relay

#

well im GOING to use NGO.

sharp axle
terse idol
#

Hi, whenever a player creates a lobby and another player opens the game after creating the lobby they don''t see it. How can I fix this?

    public void CreateRoom()
    {
        if (string.IsNullOrWhiteSpace(creatingRooms.createInput.text)) return;
        
        RoomOptions roomOptions = new RoomOptions(); //Create Room Options variable.
        roomOptions.MaxPlayers = (byte) creatingRooms.maxPlayers;

        
        PhotonNetwork.CreateRoom(creatingRooms.createInput.text, roomOptions, TypedLobby.Default); 
        Debug.Log("Creating Room " + creatingRooms.createInput.text + "...");
    }
ripe mesa
austere leaf
#

has anyone ever had this issue with netcode for go

granite sonnet
#

i want to drop the player in the player prefab ,

normal estuary
#

I am creating an extremely simple game for me and my friends. Is it a good practice in Unity NGO to keep a central "game state"? As in, for example, a dictionary playerId -> playerName that is "shared"? Do people use other more sophisticated ways?

leaden shuttle
#

Hi. I am making a multiplayer game using NetCode with Relay and Lobby and I'm using AuthenticationService.Instance.SignInAnonymouslyAsync(); in the awake method to authenticate anonymously. Whenever I'm running the game on my computer, everything works as intended. But when I send a build of the game to my friend, he gets this error:
[Authentication]: Token has expired.
RequestFailedException: Failed to decode and verify access token.

I have been looking for a fix for about half a month now and I haven't found anything useful. We are pretty desperate at this point and we have even tried installing unity on his pc and writing a short authentication script there. It still didn't work for him. That means that his computer is the problem. There's probably a setting (maybe a firewall rule or something) that he needs to change. I just don't know what it is. Does anyone know how to solve this issue? Thanks.

PS: I have made a thread about this but no one replied

sharp axle
weak plinth
#

Hello everyone does anybody know how i can make a multiplayer game where i can host the lobby on my pc and a random codes genaretes that i can give to other people and they can join me with the lobby code

sand sleet
#
public void JoinGroup(string squadName)
    {
        print("Button Work");
        currentGroup = GameObject.Find(squadName);
        if(currentGroup == null)
        {
            currentGroup = PhotonNetwork.InstantiateRoomObject("PhotonPrefabs/Squad/SquadDefault", transform.position, transform.rotation);
            currentGroup.name = squadName;
            currentGroup.transform.parent = null;
        }
        currentGroup.GetComponent<SquadManager>().squadList.Add(playerLook.gameObject);
    }
    public void LeaveGroup()
    {
        currentGroup.GetComponent<SquadManager>().squadList.Remove(playerLook.gameObject);
        currentGroup = null;
    }


Squad Manager:
public class SquadManager : MonoBehaviour
{
    public List<GameObject> squadList = new List<GameObject>();
}
```how do i sync the squad member list beetwen clients
(similar to battelfield squads) -> pun 2
indigo spruce
#

Would steam networking sockets work without steam?

olive vessel
unreal sky
#

it also seems that the client's inputs do nothing to move the players on host-side, too

terse idol
#

Hi, does anyone what is the best free networking solution to make games?

olive vessel
#

Well if you want player hosted games so you don't have server costs, look into Mirror or Netcode for GameObjects

#

They can both do dedicated servers too

marsh musk
#

How can I save players' names/ids as a network variable, I tried lists and dictionaries, to no avail. (This is Netcode BTW)

sharp axle
#

But it's probably easier to just store them all locally in a dictionary

marsh musk
#

How can I use a local dictionary, and still have it be known to the other players' game instance?

#

@sharp axle If I use a local dictionary, how can it interface with the network to get to the other players

sharp axle
#

If you have the player name stored in your Player class, the OnNetworkSpawn have that player save it's client id and player name to a dictionary on a player manager

marsh musk
#

@sharp axle Aright, i think i understand, have the player manager in the scene already, because every player would have access to it, to put their id/name into it, and every player's I'd/name would be on their prefab. Okay, next question, do variables in the game scene, like attached to an empty game object, sync to the clients (the dictionary in this case), even though it isn't a network variable

sharp axle
#

It won't in this case. Every client will keep its own separate copy of the dictionary

marsh musk
#

Well... Then what case is the one you described to me in the previous message

leaden shuttle
sharp axle
leaden shuttle
normal estuary
sharp axle
normal estuary
#

Lists and variables will only sync when their values change. I didn't know that 😄 I thought they were synced at every sync cycle, which is like 0.2s

sharp axle
#

That would be an insane waste of bandwidth, lol. There is a dirty flag that gets set that triggers an update.

leaden shuttle
sharp axle
leaden shuttle
lone needle
#

Hey so I'm trying to figure out networking but I've run into an issue where the host can move around but the client cannot. I'm following a tutorial and it says to use Client Network Transform to fix this, but that didn't solve the problem for me. I've retried hooking up client network transform at least 5 times but still isn't working. Anyone have a solution?

sharp axle
lone needle
#

I've got a movement script hooked up to the player prefab, should I not have that?

#

It's set as a networkbehaviour and has "if (!IsOwner) return;" to make sure it doesn't move all players together

lone needle
sharp axle
#

That should be fine. Are you using the latest version of NGO 1.2.0? The client network transform has changed a bit in the last few versions

lone needle
#

Yea, it says Netcode for Game Objects 1.2.0

#

There is one thing that didn't work for me and that's the link to the Client Network Transform package. But I got it from the Unity multiplayer doc https://docs-multiplayer.unity3d.com/netcode/current/components/networktransform#clientnetworktransform so I copy and pasted the code of the script

#

tutorial said that copy and pasting the script should work fine but just letting you know

sharp axle
#

Yea. That one should work

lone needle
unreal sky
#

what is the best way to communicate between server and client?

#

rpcs seem interesting, but vulnerable

sharp axle
#

And I guess Custom Messages

unreal sky
#

thx

unreal sky
#

and came up with an idea

#

but i have one more question

#

there is that isServer property (which is for hosts, which are what im using)

#

can that be manipulated by clients

#

if its running on their script?

sharp axle
#

IsServer will be false on clients. The only way to change that would be through something like Cheat Engine to manipulate the variables in memory.

unreal sky
sharp axle
#

Yea. There is no such thing as bullet proof anticheat. You can do things like variable obfuscation, but that just makes it harder not impossible.

austere yacht
unreal sky
#

or wait

#

new idea

#

can't say it publicly

#

lemme see if it makes sense on paper

austere yacht
#

anticheat is about detecting bots, assistive tools and message tampering

unreal sky
#

true

austere yacht
#

I’d say first goal should be to have a game that is worth cheating in.

unreal sky
#

lmao i'll try

austere yacht
#

Or worth playing even.

sharp axle
#

Much like optimization, it's easy to get lost in the anticheat weeds prematurely.

unreal sky
#

heh

#

thx for the clarity

#

@austere yacht @sharp axle have a good rest of ur day <3

inner fulcrum
#

i switched from normcore to photon, so this is what happened when i playtested (the player model is supposed to be in the glass room but it is instead in the sky)

#

can anyone help..?

unreal sky
#

can any server object modify network variables?

sharp axle
inner fulcrum
#

uhhj

#

how

sharp axle
sharp axle
# inner fulcrum how

Dunno, I don't use photon. But there should be a place where you instantiate the player

inner fulcrum
#

oh okay

lunar axle
#

Which solution should I learn

#

Netcode for game objects

#

Or Photon fusion

austere leaf
#

Hey guys, is there any reason why NetworkList<T> wouldn't accept a custom class* that a NetworkVariable<T> would? I've set up a struct which uses INetworkSerializable and System.IEquatable<T> but as soon as I try to implement it as a class it claims it as a nullable type.
*i've gotten it to work with structs but I'm unable to edit the values of a list of structs how I would prefer compared to a class.

#
    public ulong clientId;
    public int fuel;
    public int ore;
    public int carbon;
    public int food;
    public int goods;
    public int victoryPoints;
    public FixedString64Bytes name;

    bool System.IEquatable<Player>.Equals(Player other)
    {
        return (clientId ==  other.clientId) && (name.Equals(other.name));
    }

    void INetworkSerializable.NetworkSerialize<T>(BufferSerializer<T> serializer)
    {
        serializer.SerializeValue(ref clientId);
        serializer.SerializeValue(ref fuel);
        serializer.SerializeValue(ref ore);
        serializer.SerializeValue(ref carbon);
        serializer.SerializeValue(ref food);
        serializer.SerializeValue(ref goods);
        serializer.SerializeValue(ref victoryPoints);
        serializer.SerializeValue(ref name);
    }
}```
#

NetworkList<Player> playerList = new NetworkList<Player>();

final karma
#

I need to use Unity hub for a company project. But unfortunately, they have proxies and a bunch of other network security tools set up. I am not all aware of.

I download Unity Hub 3.4.1 but I cannot login on Unity hub. When I click login, it redirects me to a a white page and nothing happens.

I checked the inspect and it had a link which I clicked hoping to be redirected to Unity. But I still cannot login. I check the log file and it has the following error: "UNABLE_TO_GET_ISSUER_CERT_LOCALLY" or "network error: ("Error: unable to get local issue certificate)".

Does anyone ever experienced this type of behavior ?

#

Hello guys, please let me know if this is not the right channel to post about this topic.

spiral geyser
#

Hi, I need help! I have a weird problem that drives me crazy: I am using Mirror and Parrel Sync. When I run the game (host+client and client) for the first time, everything works fine. However, if I run join the server again without changing anything, my players transforms do not sync for a while. Has anyone got this kind of problem before?

I tried to debug my code for hours to understand why this desynchronization is happening before I realize that there is actually nothing wrong in my code! If I re-launch my Parrel Sync and run the game, everything works smoothly! The most interesting thing is that the animator syncs just fine! Why?? Is this problem related to my code or just Parrel Sync? Should I open an issue on their github or is this a me problem?

I have a short video attached showing this behavior.

sharp axle
sharp axle
sharp axle
rustic pumice
#

Hi, I need help, I'm using netcode for gameobjects and I want the ball to reset it's position when it touches the goal line, The ball has a client network transform, and its in the network manager prefabs thing in the inspector, I tried doing this using a ServerRpc sent from the ball itself but for some reason when the reset postion function activates it resets the position of the player not the ball (???) anyone has ideas why that might happened?

Here's the code the controls the ball:

{
    private void Awake()
    {
        //this happens on trigger enter for the ball
        GoalCheck.Goal += (string s) =>
        {
            ResetPosServerRpc(); //send server rpc to reset postion 
            Debug.Log(s); //show that there was a goal scored
        };
    }

    [ServerRpc]
    public void ResetPosServerRpc(ServerRpcParams serverRpcParams = default)
    {
        var clientId = serverRpcParams.Receive.SenderClientId;
        if (NetworkManager.ConnectedClients.ContainsKey(clientId))
        {
            var client = NetworkManager.ConnectedClients[clientId];
            client.OwnedObjects[0].transform.position = new Vector3(0,0.5f,0);
            client.OwnedObjects[0].GetComponent<Rigidbody>().velocity = Vector3.zero;
        }
    }
}```
sharp axle
rustic pumice
verbal spire
#

Im trying to learn netcode for gameobjects. How do I modify values(velocity) of a rigidbody through the client?

sharp axle
# verbal spire Im trying to learn netcode for gameobjects. How do I modify values(velocity) of ...
verbal spire
#

Thank you. I think I should've been more clear with what my problem is.

I'm trying to add velocity to a network object on the scene. I have the following script attached to the host and the client an I can add velocity to the ball with the host character, but I cannot add velocity to the ball object on the client. I am spawning the ball object like this in OnNetworkSpawn: ball.GetComponent<NetworkObject>().Spawn(); I am not getting any error messages.

I have the network object, network transform and network rigidbody components attached to the ball object.

https://gdl.space/sebirayanu.cpp

rustic pumice
#

why is there disparity for the client position in the client view and the host view (the host one shows it correctly but the client view does not)

the code:

    {
        SetStartPostitions();
        base.OnNetworkSpawn();
    }


    void SetStartPostitions()
    {
        if (!IsOwner) return;
        if (IsHost) SetStartPosServerRpc(new Vector3(0, 1, -19));
        if (IsClient) SetStartPosServerRpc(new Vector3(0, 1, 19));
    }

    [ServerRpc]
    public void SetStartPosServerRpc(Vector3 pos ,ServerRpcParams serverRpcParams = default) 
    {
        var clientId = serverRpcParams.Receive.SenderClientId;
        if (NetworkManager.ConnectedClients.ContainsKey(clientId))
        {
            var client = NetworkManager.ConnectedClients[clientId];
            client.PlayerObject.transform.position = pos;
        }
    }```
sharp axle
#

why is there disparity for the client

floral forum
#

hi guys , I am planning to make a game similar to slither.io or diep.io , can someone guide me what should i use for networking , photon or the new unity multiplayer

sharp axle
verbal spire
#
 [ServerRpc(RequireOwnership = false)]
    private void hitServerRpc()
    {      
        rbBall.velocity = (cam.forward * hitForce);
    }

how do I use the cam.forward in a ServerRPC since the server doesn't know cam.forward?

#

This script is in the client but the cam.forward returns null

indigo spruce
#

What are some scalable networking solutions that can support hundreds of people with dedicated servers (like rust)

sharp axle
shadow monolith
#

Hi guys, I'm creating a MMORPG with Unity Netcode, but I fell in a problem where I can't settup the netcode to work with multi-scenes. I have a plan to creat a servers to each game scene, but this will cost alot of time, anyone have a better idea?

austere leaf
#

Hey guys, me again, still struggling with INetworkSerializable. I appreciate the feedback I got earlier. I decided to try to make a class with a list of other player classes that I've also set up to be serializable. I've verified that I can use the Player class as a NetworkVariable but when I use PlayerList as a NetworkVariable the game runs and everything seems fine but none of the clients are receiving any data. The List is always empty for them. What could be causing that irregularity?

#
    public PlayerList(List<Player> newList) {
        list = newList;
    }
    public PlayerList() {
        list = new List<Player>();
    }
    public List<Player> list = new List<Player>(); 
    public bool Add(Player newPlayer) {
        list.Add(newPlayer);
        return list.Contains(newPlayer);
    }
    public bool Contains(Player testPlayer) {
        return list.Contains(testPlayer);
    }
    
    public int Count { get {return list.Count;} }
    
    public Player this[int i] {
        get {return list[i];}
        set {list[i] = value;}
    }
    void INetworkSerializable.NetworkSerialize<T>(BufferSerializer<T> serializer)
    {
        int count = 0;
        if (serializer.IsWriter) count = Count;
        serializer.SerializeValue(ref count);
        for (int i = 0; i < count; i++) {
            if (serializer.IsReader) list.Add(new Player());
            serializer.SerializeValue(ref this[i].clientId);
            serializer.SerializeValue(ref this[i].fuel);
            serializer.SerializeValue(ref this[i].ore);
            serializer.SerializeValue(ref this[i].carbon);
            serializer.SerializeValue(ref this[i].food);
            serializer.SerializeValue(ref this[i].goods);
            serializer.SerializeValue(ref this[i].victoryPoints);
            serializer.SerializeValue(ref this[i].name);
        }
    }
}```
austere leaf
shadow monolith
#

Thanks, I'll take a look

floral forum
leaden shuttle
solar zephyr
#

I am looking into networking

NetcodeForGameObjects seems great, but if I wanted to, could I export my own dedicated sever? I know a lot of the server files are wrapped up in the client or even shared.

If I went for ENet... Could I re-use C# code between the client and server? It seems foolish to attempt to write the server 100% separate and assume zero overlap code with the client. And it's also very low level. Is it still feasible without all the high level stuff in NetcodeForGameObj?

#

Also open to other networking solutions. I want control, but would only be operating in a small team (< 5 people) so I am not looking for anything ambitious

austere yacht
# solar zephyr I am looking into networking NetcodeForGameObjects seems great, but if I wanted...

if you use NGO your server will be a headless unity app built from the same project, that is the architecture of all the popular frameworks. You can however use the transports standalone (Enet, unity transport, kcp, …) and build your own abstractions and then split the projects. You can also venture into the wild and use things like MagicOnion/gRPC/PhotonServer or a distributed message pipe/protocol framework like SharpMQ that would allow you to do whatever you want and split server/client in as many fragments as you like

solar zephyr
#

NGO?

austere yacht
#

Netcode for GameObjects

solar zephyr
#

ah

austere yacht
#

Btw all the high level stuff in NGO is just basics you’d have to DIY anyway, so unless there is a major issue with how NGO does it, there is no point to doing that

solar zephyr
#

So you wouldn't call NGO's tools a huge crutch at all?
What about the authority stuff or interpolation?

austere yacht
#

A crutch?

#

What interpolation?

solar zephyr
#

something so useful, you couldnt go without it

austere yacht
#

NGO just saves you a year of groundwork

#

All the hard parts like interpolation/prediction/rollback are left for you to develop

#

There is nothing in it that is game/genre specific, which makes it different from photon products

solar zephyr
#

I see. I was thinking about some interpolation code thats done for you in some unity components. Like maybe character controller?
you mentioned the "year" of groundwork done for you. I really should try NGO for myself, but could you give me an idea of how much groundwork is there?

austere yacht
#

Connection management, rpcs, data serialization, network variables, authority, source-gen to make it all convenient to use, basic spawning/replication, basic scene management. Technically you can replace most of those with your own if you need.

solar zephyr
#

source-gen?

austere yacht
#

Yes, required to make an RPC by just sticking an attribute on a method

#

you can send messages manually, write your own serialization and register your own callbacks if you don’t like rpcs

solar zephyr
#

The headless dedicated server export you mentioned earlier
Does it bundle a ton of unnecessary game files along with it? Including client source?

#

Thanks for all the info so far btw

austere yacht
#

You can strip client code with #if IS_CLIENT #endif

#

like any build it bundles everything that is referenced by a scene

solar zephyr
#

Makes sense... mostly normal build just with a different starting point

austere yacht
#

Same starting point

#

Just no graphics/window/renderer is being initialized

#

for a typical small game, this makes it much easier to reason about stuff and to find bugs

#

you can externalize large assets easily with addressables if you need to remove certain large assets from the server build

solar zephyr
#

Very good to know

#

I think that's everything
Thanks 👍

sharp axle
#

@solar zephyr also keep in mind that NGO is still very new. It only went 1.0 a few months ago. So there are few tutorials out there if you are learning from zero. Fortunately most of the major frameworks are designed very similarly and the basic concepts like RPCs and network variables are the same.

tulip aurora
#

Does someone know how much the UTP header size is in bytes ?

sharp axle
unreal sky
#

is there a way to create a network dictionary?

#

ik they got removed

#

but i still wish to use one for data transfer

sharp axle
soft bay
#

hello guys, is there anyone who could consult me regarding using Unity Relay with a non-Unity engine?

soft bay
#

I have read it many times! I do get a successful Join Relay Server response but it gives me 3 different ports and I'm not sure how to actually connect to that IP and port. The Unity example uses additional Singleton/Unity Transport technology that connects players automatically. It's unclear what would be the flow for another engine like Unreal.

olive vessel
#

Singletons aren't a Unity thing. As for the Unity Transport you would use whatever your Networking Solution allows

#

I imagine all their examples are Unity based, you may have to butcher them

soft bay
#

that's fine and thank you so much for responding but in principle, I create a remote server allocation, so I should just be able to connect to it via IP address? I thought it would work similarly to how a service like Hamachi allows you to create a VPN and make a p2p connection. I'm applying the same logic with Unity Relay but that IP just won't open the level, it says

"LogNet: UNetConnection::Close: [UNetConnection] RemoteAddr: 35.232.227.170:7777, Name: IpConnection_11, Driver: PendingNetDriver IpNetDriver_13, IsServer: NO, PC: NULL, Owner: NULL, UniqueId: INVALID, "

olive vessel
#

I've never used Relay and obviously if you're using Unreal the docs might not be the most helpful. You might be better off asking in the Unity Multiplayer Networking Discord pinned to this channel, they have channels for Unity Relay and Lobby etc

soft bay
#

Many thanks for referring me to that group, I'll ask there, too!

sharp axle
soft bay
unreal sky
#

thx anyways tho

subtle onyx
#

I'm having an issue with grabbing Instantiated prefabs (Using OpenXR, and Normcore)

When I instantiate a prefab, Player 2 is unable to grab it, but can physically interact with it.
If its already In the hierarchy, then player 2 can Grab and interact with it.

#

I checked the prefab in the Resource folder and its exactly the same as the one in the hierarchy

sharp axle
subtle onyx
subtle onyx
#

For some reason if you Instantiate a Prefab with RealtimeView during runtime, its UUID and Advanced settings are missing. I dont know why this is happening.

split sonnet
#

i have created a multiplayer game, and i'm facing alot of laggs, i want an expert in game networking to test it and review it for me

#

if anyone is willing it will be much appreciated

candid maple
#
[Package Manager Window] Cannot perform upm operation: Unable to add package [https://github.com/Unity-Technologies/com.unity.multiplayer.samples.coop.git?path=/Packages/com.unity.multiplayer.samples.coop#main ]:
  Error when executing git command. fatal: invalid refspec 'main '
 [NotFound].
UnityEditor.EditorApplication:Internal_CallUpdateFunctions ()

Getting this error when trying to import the package

https://github.com/Unity-Technologies/com.unity.multiplayer.samples.coop.git?path=/Packages/com.unity.multiplayer.samples.coop#main
shadow monolith
#

Hi guys, I've trying to verify if has any servers active before StartClient, I tested a lot of things that I see in forums, but nothing was what I need. Basically this verification will be used for a branch of things, and I really need this verification to the progress of my project. Anyone knows how should I do this?

normal estuary
sharp axle
unreal sky
#

ello
have a question
are the names of player objects on the server in sync with the names of player objects on the client?

wraith osprey
#

I haven’t been able to find information on how exactly Relay and Lobby work together s2s. Any details to direct me?

#

There are a couple blurbs in the docs that vaguely elude to some connection between them but I’m looking for specifics

sharp axle
sharp axle
blissful crescent
#

I have 2 versions of my game right now. One with networking using Photon Fusion, and another with networking using Netcode for GameObjects.

I originally went with Photon Fusion but I wanted to deploy a UWP game on Xbox. I then learn that Photon Fusion does not support UWP. I then decided to rewrite in Netcode for GameObjects, however, I am now running into many issues with UWP on Xbox only with Netcode for GameObjects that I outline here: https://forum.unity.com/threads/issues-with-netcode-for-gameobjects-in-uwp-xbox-only.1381587/
and here: https://github.com/johnpwrs/netcode_for_gameobjects_xbox

So I have 2 questions:

  1. Is a multiplayer UWP game on Xbox a lost cause? It seems to get any real support I need a real developer account able to do native builds for the Xbox.

  2. Considering I can't get either versions to work on UWP for Xbox, I am left with a choice on which branch to continue with. Looking for any insight from anyone with experience with Netcode for GameObjects vs Photon Fusion in production. The game can have up to 10 players in a 5v5 PVP match. No physics. 2d isometric game.

GitHub

Minimal project for debugging UWP Xbox crash when using Netcode for GameObjects - GitHub - johnpwrs/netcode_for_gameobjects_xbox: Minimal project for debugging UWP Xbox crash when using Netcode for...

unreal sky
#

will setting requireownership to false on a serverrpc make the clients unsafe?

#

i have a function that directly sends input to the server

#

but it throws this error:

#

"Only the owner can invoke a ServerRpc that requires ownership!"

sweet flame
#

What Websocket Client should I use in Unity C# ?

#

I read about SignalIR and SocketIO from the Asset Store

#

Coming from Java/Kotlin I have no idea what's a good thing in C#

soft root
#

Is there any good resources for the new netcode framework?

sharp axle
sharp axle
ember kettle
#

hey i got a quick question. right now im trying to parent a weapon to my players hand over the network. if i understand the docs correctly, i can only parent a network object to another network object that was already spawned on the network. the problem is that my player is made up of lots of parented bones and theyre not network objects that were spawned on the network, only the parent player gameobject is. so is it not possible to do this?

#

it looks like this

sharp axle
split sonnet
#

Does anyone know how to use flat buffer with unity to serialize data ???

#

Or protocol buffer ?

sharp axle
candid maple
#

Object picking up is working host side but not client side they have client network transforms but still wont work this is one of the main scripts

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

public class ClickManager : NetworkBehaviour
{
    public delegate void MouseClick();
    public static event MouseClick OnMouseClick;
    public static Vector3 mousePosition;
    public static GameObject selectedObject;
    Vector3 offset;
    void Update()
    {
        if (!IsOwner) return;
        mousePosition = Camera.main.ScreenToWorldPoint(Input.mousePosition);
        if (Input.GetMouseButtonDown(0))
        {
            if(OnMouseClick != null)
            {
                OnMouseClick();
                if (selectedObject)
                {
                    offset = selectedObject.transform.position - mousePosition;
                }
            }
        }
        if (selectedObject)
        {
            selectedObject.transform.position = mousePosition + offset;
        }
        if (Input.GetMouseButtonUp(0) && selectedObject)
        {
            selectedObject = null;
        }
    }
}
sharp axle
cosmic sparrow
#

does anyone here have great knowledge about game servers?

olive vessel
cosmic sparrow
#

How many players can a server handle?

#

If it's an open world

olive vessel
#

How much wood could a woodchuck chuck?

#

Depends on the game, the networking solution, the hardware

cosmic sparrow
#

🙂

#

Ok Thanks

unreal sky
#

does OnNetworkSpawn() get invoked on both server and client side when an object spawns?

unreal sky
#

kk thx

#

<3

forest grotto
#

is there a way to start a server that is on Multiplay from unity with code or request a list of server and if there are non running start one with custom parametars that arent the same as in build config

sharp axle
forest grotto
#

Now works fine with an error here and there but for starts it works

#

I'm trying to get the networking to work so I can make everything else with no thinking of does it connect

meager glacier
#

hi guys, not sure how to structure my game/custom models (using Normcore) with logic in the scene. Basically doing a cooking game and i'm not sure how the logic should be, i have all the logic setup on for single player i.e day start, customers coming in and placing orders, but how or who should be calling this logic, i don't want all users having random customers entering with different orders. Any help would be appreciated.

forest grotto
#

But from me it's have a server side Object that has all the logic for game contoll and just have players make the foor od tasks then when task is finished tell the server side manager smth like that

meager glacier
compact fox
#

do the UNet buttons still work?

#

I am trying to just do this again and it is not working when I do one as "LAN Server Only" and another as the IP Address to connect to. I am wondering if there was some update or deprecated that caused this to change?

#

It works when I type in "localhost" but everything else like with actual IP Address of my laptop does not seem to work.

#

I guess I should start over and try to do this some more supported way? Is there a way to do this in a very simple intuitive method?

#

Am sort of worried if is something deprecated again?

#

I would have some cloud service like Vultr and run the Unity game that I built from there, clicking on that Virtual Machine Cloud Server the "LAN Server Only" and then type in the IP Address of the Virtual Machine on my actual laptop?

#

This is how to testing the across the internet connections?

olive vessel
#

UNet is deprecated

#

It has been replaced by a new official solution, Netcode for GameObjects

compact fox
#

So like, it just does not work anymore and won't work? I am just wondering if I had a game built like this what happens?

#

I do not fully understand Unity and how its networking works. I may try to figure out if I can just do a version myself that won't be deprecated in the future.

#

So the reason it is not working anymore is because it is deprecated? Or should a game built with UNet still work over internet?

olive vessel
#

It would work in whatever state it worked in before it was deprecated, I heard it wasn't very good

#

Should you use it to make a game now? Absolutely not

#

And of course it will still work over the internet, you are hosting the game not any Unity servers. If you are trying to connect to a device on a different network chances are you'll need to open the right ports in the router's firewall

compact fox
#

What do you mean here by 'router'? What is needed for it to work. I am just trying to host the game on a Virtual Machine and then connect to that Virtual Machine's IP with my Laptop

#

I guess it could also be the Virtual Machine being too slow, but the issue occurs if I try typing in my own IP Address on two instances on my computer.

olive vessel
#

Assuming it's not on a different network, the router's firewall will be irrelevant

compact fox
#

That used to work a while ago, but does not seem to now when I swap localhost with my laptop's IP and run the server from my laptop

#

Only thing still working is Localhost.

#

I may just consider starting from scratch again if there are any good tutorials on what is up-to-date and may not be deprecated? Currently the game is not much of a game anyways

#

Right now my goal is sort of just to make a "Valorant Clone" that is not really a Valorant Clone. Like legit, my old game was a networked roll-a-ball.

olive vessel
#

Netcode for GameObjects is Unity's new solution. There are many good community multiplayer solutions like Mirror and Photon

compact fox
#

This is like code wise? Like the [Command] and [ClientRPC] stuff?

#

I am more just wondering about stuff like the NetworkManager and IP Addresses and just getting stuff connected

olive vessel
#

Right? All these solutions use some form of network manager and messaging systems

compact fox
#

Ok. Is there any tutorial that goes over the IP Addresses and uses some sort of Virtual Machine or Server like vultr?

#

(Or what virtual machine to host server is recommended?) Or even using Unity's Relay or other stuff?

olive vessel
#

I have no idea if such tutorials exist because I've never looked

compact fox
#

I found one from Code Monkey, will just be try it

#

Am a bit worried as it is mainly the IP Address stuff that seems finnicky.

solar zephyr
#

I'm networking a competitive (< 20 people/match) building game. If I go ahead with NGO, how do I run multiple matches/instances with a matchmaking system later?

sharp axle
solar zephyr
ember kettle
ember kettle
#

ah ok, thank you

tacit storm
#

Anyone familiar with Playfab integration? The LocalMultiplayerAgent works fine for me when I test locally but when I use my container in a build on playfab I get stuck with "Unhealthy" build status, and it just says "pending heartbeat" for my server. When running the LocalMultiplayerAgent I see the "ProcessHeartbeat" going every second and I can connect with my client build.

sharp axle
ember kettle
sharp axle
ember kettle
#

right now the only way I see to do it is by manually spawning in and parenting each bone so that way I can parent my weapon to the hand bone 😭😭

#

which seems impossible

pale sundial
#

how do set only one camera acting for each player separately instead of using multiple cameras in netcode?

pale sundial
#

bump!🙂

proven flint
#

anyone know how I can improve the NGO network transform interpolation to be more precise?

sharp axle
candid maple
#

Im trying to port forward with mirror to another pc but it wont work

sharp axle
proven flint
#

I'll try but the position threshold is already at 0.001

proven flint
sharp axle
proven flint
#

ok so running without interpolation is perfect as far as how responsive it is but obviously it's very choppy so I want to know if I can bridge that gap by changing values or if I need to use a different interpolation algorithm or some other solution

sharp axle
# proven flint ok so running without interpolation is perfect as far as how responsive it is bu...

Basically this is your starting point for a solution
https://youtu.be/3SILT4-vZWE

In this video, we take a look into implementing client reconciliation so that the client can correct themselves if they predicted the wrong position.

This is part of a series so make sure you follow the rest before looking at this one if you want to follow along.

If you want to talk more or get some help, join our Discord server! Links is in t...

▶ Play video
ember kettle
sharp axle
ember kettle
#

I did already 😭😭

royal cypress
forest grotto
#

can i get some recommendations on matchmaker tutorials for unity gaming services

#

i kinda need to use it but just cant find any tutorials on it

#

and the doc arent that helpful

normal estuary
#

(you might have a gun pickup system)

royal cypress
#

ahhh

#

so your just playing the animation not actually using the bones IN unity?

royal cypress
#

damn rip

normal estuary
royal cypress
#

i spent a hot minute working on some animation stuff

#

might have to go back to the drawing board if i can't use the rigging

#

😭

normal estuary
#

the problem is parenting rather than rigging itself

#

dynamically re-parenting stuff is painful

forest grotto
normal estuary
#

oh lol 😂

#

yeah Unity docs are in a pretty bad spot tbf

sharp axle
forest grotto
sharp axle
forest grotto
#

Where

forest grotto
compact fox
#

What is the easiest way to check if two IP Addresses are connecting to each other properly?

This is mainly to figure out if the issue is something Unity related or if it is router/firewall stuff.

sharp axle
compact fox
#

I think I just figured out it is something related to the router. My game works at school but not at home?

#

I just swapped localhost with my IP Address when I was at school and it ran with the IP Address

#

I guess next test would be to have some friend enter the IP Address on their laptop

#

Or something related to network settings. Entering IP Address at home does not work, but it works at school.

#

Maybe has to do with Windows Settings related to the wifi networks or something?

#

Nevermind, it is still not working. I have a Virtual Machine running and then am trying to type in the IP Address of the Virtual Machine. Having Virtual Machine run one copy and my laptop run another. Goal is to eventually have the Virtual Machine permanently running it 24/7

#

Only difference today is that running two copies on my laptop with one having 'localhost' swapped for my actual IP seems to work now but did not a day ago.

#

I guess I should try to ping the virtual machine from my laptop.

#

If that works it can be assumed the Unity UNet entering IP Address to there should also work.

#

This used to be 'localhost'. Changing it to my actual IP Address for my laptop is now working. But now am trying to do it across different Wifi Networks. Like to a Virtual Machine.

orchid mango
#

Does anyone here have a game launched with Unity Multiplay? I wanted to know if it is session based, and the pricing page (https://unity.com/solutions/gaming-services/pricing) says $800 credit for 6 months, meaning services cost (800/6) about $130/per month. Is that the average cost for devs per month after the $800 credit is finished? Thanks.

Unity

Everything you need to launch, manage, and operate your game – at a fair price. Our products are designed to work for AAA studios, indie developers, and everyone in between.

orchid mango
ember kettle
hard creek
#

Hello, I have attached a callback to NetworkSceneManager and my callback is notified twice.
NetworkManager.SceneManager.OnLoadEventCompleted += OnSceneLoadEventCompletedEvent;
NetworkManager.SceneManager.LoadScene("MyScene", LoadSceneMode.Single);

private void OnSceneLoadEventCompletedEvent(string sceneName, LoadSceneMode loadSceneMode, List<ulong> clientsCompleted, List<ulong> clientsTimedOut) {
Debug.Log("I'm called twice");
}

#

I suppose that this is because i'm on "Host" so I'm client and server, so I get 2 notifications

#

But how to handle that ? I have to ignore one event and I don't know which criteria use to ignore one of the calls.

compact fox
#

Yeah, my game seems to work for entering the IP Address manually if you are on school wifi, but it does not work for the wifi at my home, I am not sure why. Also am wondering about why at the school wifi it did not work across different networks. (Actually, I think I know -- my school wifi has odd security requiring some VPN so I guess it shouldn't work unless that VPN is installed)

#

I think my game is actually working correctly, it is just wifi security and stuff to deal with. The fact that I can enter IP at school on another school computer, but can't do it at home probably has something to do with some setting with the home wifi.

#

Is there any Windows Setting I need to check on or off? Or anything related to router or ISP ?

sweet flame
#

anyone here tried to build custom implementation for player position syncing?

blissful crescent
#

For RPCs, is there a performance difference or recommendation between passing NetworkObjectReference vs networkObjectId and using TryGetValue in the RPC?

#

i've been using NetworkObjectReference but don't see it getting used in Boss Room

sharp axle
blissful crescent
#

perfect! thank you!

royal cypress
ember kettle
weak plinth
#

good rule of thumb to keep the majority of parents at 1,1,1 localscale if you plan to modify the transform of its children

craggy sand
#

Hi! Trying to build dedicated server from DOTS Network Sample and have an error:
Error when processing 'AsyncLoadSceneJob: Cannot find TypeIndex for type hash 5845711394967877851.
has anyone had a similar problem?

swift wraith
#

Does anyone know how to make some sort of lobby system with netcode WITHOUT using UGC (Gaming Services)?

#

Or generally dedicated servers

sharp axle
swift wraith
sharp axle
swift wraith
#

What can I do then (even when not using netcode). I really want to program an online multiplayer game, simple one and wanna expand it. Is there a good, "simple" alternate way?

sharp axle
#

There are other services out there you can use like Azure Playfab. UGS is framework agnostic as well, it will work with anything

stray moth
#

Playflow can also work

swift wraith
#

@stray moth @sharp axle Do you know if I could make a multiplayer with a lobby and dedicated server with them? (Without paying). I mean I could even host the server on my Raspberry pi (at home).

olive vessel
#

Eventually, all things cost money

swift wraith
olive vessel
#

And even that, does in fact cost you money

#

Or is your internet and electricity free?

swift wraith
#

Dude, do you even understand? Those things are things that I currently own and paid for. I just don't want to add another stuff to pay for, if you understand?

#

I used the specs I got for it, just as I want for unity

olive vessel
#

Obviously I understand, I;m not as thick as pig shit

swift wraith
#

Please stop trash talking, it's the wrong channel for that.

olive vessel
#

I imagine all those services mentioned have free tiers, but they will have limits

#

You can of course research them

#

PlayFab might be an option too

swift wraith
#

Might have a look into it.

#

I mean, I am just confused by how databases would work for unity?

mint bloom
swift wraith
#

No ugc.

#

*ugs

sharp axle
swift wraith
#

I really love networking, and just wanted to know some features or programs that would make it "simpler".

sharp axle
#

Not really. It most often boils down to: Simple or Cheap, Choose One

hasty wigeon
#

Hey, has anyone got experience using netcode for GO and/or unity transport with an external non-unity server?

swift wraith
stray moth
#

Ein i know there are some alternatives to NFGO that also uses unity services

sharp axle
hasty wigeon
sharp axle
hasty wigeon
#

That's what I suspected 😞 Oh well

swift wraith
sharp axle
stray moth
#

Been using fishnet,not very complex but very flexible

swift wraith
sweet flame
#

Have you ever built a webserver?

#
  • create a simple one (many frameworks for websocket connections etc. out there)
  • create a managment class that holds player queues in memory
  • resolve those queues into match instances as soon as the match starts

Host the stuff on GCP or AWS or whatever. Dockerize the Server and done

royal cypress
sharp axle
#

Yes, you would need to inherit from NetworkVariableBase

exotic ferry
#

hey, is there a way to disable this debug?

sharp axle
exotic ferry
#

thanks!

blissful crescent
#

forgive me as i realize this isn't the best question, but i'm new to building multiplayer games. in my game i run a lot of character actions using coroutines. spell casting effects, mana regen, hp regen, damage over time, projectiles, etc. while looking at the boss room demo, i notice these actions get queued up and advanced in the update loop.

in the context of multiplayer games (or even non-multiplayer games), is there any reason why coroutines might be a bad choice here? is this a style choice?

sharp axle
compact fox
#

Is it safe to assume that if something works on LAN then once internet is properly set up it should also work over Internet? (Currently the Unity game works connecting 10 laptops all on the same Wifi Network, but does not seem to work with dedicated server still because of weird RDP and "Port" shenanigans along with the IP Address not being trusted by router security or something)

The game mechanics and code wise, like if it works on LAN it should work on "WAN" or over internet? Only thing that needs to be solved is the actual ports and security and stuff? The code of the game for LAN is same as for over Internet? (LAN has to do like Client to Server and Server to Client stuff anyways because one laptop turns into the hosting server in LAN)

sharp axle
naive gazelle
#

Is WebRTC the best way to do multiplayer games for web browsers? For example, games like 2D football.

green vortex
#

i want to know what is the better way (in terms of speed) to setup multiplayer game server , i planned to make it for smartphones/PC platform.

Currently another project in my team use redis with nodejs , so the whole coding on server side will be mostly nodejs

i had also heard firebase on google can do that? and ofc traditional php server with sql to retrieve data

#

let me know if u have better idea , im doing this for my own personal project👍

#

plz give me relatively cheap services or ways to do it lol, i cant afford high end servers that make me bankrupt after few months

wet compass
#

in netcode for gameobjects, does networkvariable on value changed give the last known position to the client or the server as the first value?

primal timber
wet compass
#

yes, have to look further though. To rephrase my question, does networkvariable on value change give the last known Value to the client or the server as first value?

#

i think i solved my question with some testing though, first value is last known value to client since it's the one detecting the change. I was wondering if it worked as some sort of rpc that the server sent with the last value over there but doesn't look like it

primal timber
#

Does anyone understand how to handle a LoadComplete on the client side only? I’m trying to ensure my scene has loaded before I link the MainCamera up to the player prefab.

#

ps: I’m using the 3rd Person template which sets a m_mainCamera var to get the direction to move towards.

#

I have a networkmanager that’s created in a Title scene and buttons to start a Client or a Host.

#

The networkmanager spawns the player prefab before the scene is loaded só Awake etc doesn’t get a reference to the main camera because it does t yet exist?

primal timber
#

Ok I got around this problem, if anyone is ever stuck trying to do the same thing lemme know.

spring crane
forest grotto
#

Im using Unity Multiplay to host my game server. How would i go about making a ucstom configuration Variable. Like serverID. Im using Phoon Fusion and i need to automatily assign a lobby name based on queue from matchmaker

royal cypress
#

honest question, how do you guys feel about netcode for game objects vs fishnetworking?

sharp axle
royal cypress
sharp axle
stray moth
#

Netcode is nice but still very new

spring crane
stray moth
#

Incorrect danny i am far from being toxic

#

Other half im not so sure off

sweet flame
#

I have a rate of 19ms per package. Is that considered good?

exotic ferry
#

hey, i wanna make a game manager object that is the same for every client, how do i do that?

blissful crescent
sharp axle
#

I knew the Dev was pretty outspoken. I did not know about the astroturfing

ember kettle
#

Hey, is it possible to add a network object component to an object and then spawn it in the network, at runtime?

#

im trying to do that but the network manager NetworkPrefabs list is getting in the way

sharp axle
ember kettle
ember kettle
#

ahh okay, thank you

ember kettle
#

another quick thing, right now im trying to spawn something server side using ServerRpc and it works fine on the host, but ofc it doesnt on the client and im not sure why. when it comes to spawning stuff on the server is it automatically synced to clients or do I have to do some ClientRpc for it as well?

#

this is the only spawn logic im using

still hare
#

I am not sure if that's how AddNetworkPrefab is supposed to be used

#

you typically want to be using it on an actual prefab before the game starts

#

I have no idea if what you are doing would cause issues or not but it very well might

#

And if that's only running on the server, the client won't have the prefab added to its own NetworkManager

ember kettle
#

yea this is a weird workaround im trying and so far its working ok

sharp axle
ember kettle
#

this has to do with that armature parenting problem i had earlier. because i need to parent stuff to my right hand bone, i need to make that bone a spawned network object, meaning i have to do that to all the parents before the right hand bone as well (right arm, spine, hips, etc). so right now i iterate through the children and find ones with a tag (the ones that lead to the right hand) and add a network object, spawn it, and reparent it so the player skeleton doesnt break

#

somehow this is actually working so far

#

as hacky as it is

#

i tried all other solutions but this seems to be the only one that works, especially with my setup

#

right now the only thing not working is that the clients dont get the NetworkObject component added to them, i tried a ClientRpc but it didnt work :/

fringe sleet
#

hi, newbie question, i was wondering if it would be possible to use netcode between a VR and a non-VR game? the non-VR application would be some sort of spectator, as the VR one is on an AIO headset

fringe sleet
#

Good to know, thank you

hollow bronze
#

Hello I'm creating a multiplayer car game with Photon PUN2 but getting this error when character creates in server. Its caused by joystick and I can't add canvas to prefab how can I fix this problem?

Is there an code that attaches canvas to character when user joins server?

#

okay i added canvas as a prefab too and now i can add controller to car

#

but car doesn't go for some reason

#

solved the problem by myself

still hare
#

Also, you don't a actually have to parent things to achieve the parenting behavior. The animation rigging package can emulate parenting via components like the multi-parent constraint.

weak plinth
#

Hey guys, I'm having some issues getting my multiplayer movemet set up. I've got a scene where if I'm playing as the host, everything works normally and the player character moves like I would expect, but if I join as a client then the client's movement is really sluggish and jittery. I've figured it's got to do with using Time.deltaTime when updating the position, since removing that makes the client move at "normal" speed and the host instantly zoom off the screen. I don't know how to fix it though so every player would be moving at the same speed. Here's the code, it's really basic:

EDIT: fixed by using a combination of FixedUpdate and fixedDeltaTime and lerping


void Update()
    {
        if (!IsOwner)
        {
            return;
        }
        else
        {
            Vector3 moveDir = new Vector3(0, 0, 0);
            if (Input.GetKey(KeyCode.D))
            {
                Debug.Log("Moving!");
                moveDir.x = +1f;
                
            }
            if (Input.GetKey(KeyCode.A))
            {
                Debug.Log("Moving!");
                moveDir.x = -1f;
            }

            UpdatePositionServerRpc(moveDir, moveSpeed);
        }
        
    }
    [ServerRpc]
    private void UpdatePositionServerRpc(Vector3 moveDir, float moveSpeed) {
        transform.position += moveDir * moveSpeed * Time.deltaTime;
    }
sharp axle
copper wadi
#

When I test the movement with the local server everything is working smoothly and there are no issues. But when I run it on an actual server there is at least a 5 second delay between input and seeing a player move even though the ping with the server is only 12ms. I am using the TCP protocol right now and planning to add the UDP protocol to the networking tool because movement doesn't have to be reliable, but I doubt it would solve the problem.

Does anyone know some things I can try to resolve this issue?

sharp axle
whole wolf
#

What would be the best multiplayer api that allows players to host servers in games? Unity's, Riptide, or Steams API?

forest grotto
#

Is there a way of manually deallocate server when last player leaves, through code. Unity multiplay DGS and Photon Fusion

sharp axle
olive vessel
#

Riptide is a pretty low level networking library isn't it?

ember kettle
# still hare Also, you don't a actually *have* to parent things to achieve the parenting beha...

hmm okay thank you for letting me know. i have tried to "emulate" parenting by having an empty gameobject follow the right hands movements and then parenting it to that, or even using physics based joints to "follow" the right hand, but those break my entire character. what i have going on now may not be conventional or even scalable, but its enough for the small project i have going on and its so close to working. the only thing is that client side bug, and it seems to happen because im not adding the component to the clients

still hare
#

You make it sound like it's not a big deal?

#

Or that it is "simply a bug"... but I am saying that there might—quite literally, be no way to fix it with your current setup

forest grotto
#

do i still need to search for backfill ticket after getting it from Multiplay Payload

zealous breach
#

Hello here, just started to try and implement unity netcode in my tiny game but I'm encountering an issue.
When I start the client (after I started the host in another editor), this error pops up in my console:
Exception: Scene '' couldn't be loaded because it has not been added to the build settings scenes in build list.

I have both pf my scenes in the build settings and in the right order, here is the code for my main menu script, could someone point me in the right direction please ? what's weird is that in the error message, the scene name is empty

    private void OnEnable() {
        //...
        playBtn.clickable.clicked += () =>
        {
            LoadScene("Playground");
        };

        exitBtn.clickable.clicked += () =>
        {
            Application.Quit();
        };

        hostBtn.clickable.clicked += () =>
        {
            NetworkManager.Singleton.StartHost();
            LoadScene("Playground");
        };

        joinBtn.clickable.clicked += () =>
        {
            NetworkManager.Singleton.StartClient();
            LoadScene("Playground");
        };
     }

     private void LoadScene(string sceneName) {
         UnityEngine.SceneManagement.SceneManager.LoadScene(sceneName);
     }
sharp axle
#

example of implementing/using backfill

sharp axle
zealous breach
#

Oh god ok now I see why, so in my Playground scene i'm actually creating another scene dynamically for prediction purposes. Is there a way to tell the NetworkManager not to sync this scene ?

#

Here is the code in my PredictionManager singleton attached to an empty in the Playground scene btw:

        void Start()
        {
            Physics2D.simulationMode = SimulationMode2D.Script;

            currentScene = SceneManager.GetActiveScene();
            currentPhysicsScene = currentScene.GetPhysicsScene2D();

            CreateSceneParameters parameters = new CreateSceneParameters(LocalPhysicsMode.Physics2D);
            predictionScene = SceneManager.CreateScene("Prediction", parameters);
            predictionPhysicsScene = predictionScene.GetPhysicsScene2D();

            copyAllObstacles();
        }
dapper plover
olive vessel
#

If there's no server for the client to join, you get no prefab

dapper plover
#

ah ok. thanks

#

cool how it just works (running server and then client)

zealous breach
#

I guess I'll just do a local fix in the NetworkSceneManager.cs so that is does not try to sync a scene that doesn't have a path

hard creek
#

Hello. When I add a NetworkRigidbody to my object, I cannot move it anymore. To move it I add a Force to the rigidbody. Could you please tell me what is wrong ?

forest grotto
#

Server or host/ what networking??

hard creek
#

Netcode, currently I try the code in single player so "host"

sharp axle
hard creek
#

... ok but I thought that add a network transform managed everything for me. (I mean transform replicated/synchronized on all clients...)

#

So @sharp axle the code that sets a force on the rigidbody must be located in a ServerRpc ? is it ok ?

#

But currently I'm a Host so my client is also my server

#

So @sharp axle currently I test my code without any client. Only the Host. So do you know why my object doesn't move anymore if I add a NetworkRigidbody on it ?

sharp axle
hard creek
#

What code ? The code that add the Force to the rigidbody ?

#

public void StartMove(Vector3 velocity) {
moving = true;
magnitudeThresholdExceeded = false;
body.constraints = RigidbodyConstraints.None;
body.AddForce(velocity, ForceMode.VelocityChange);
}

#

It is in a script attached to the gameObject. This script inherits from MonoBehaviour and not NetworkBehaviour

ember kettle
still hare
#

The data is synced, but not the graphical representation.

#

I ran into all kinds of issues when I first started out. I was trying to create a submarine that would parent players to it when they entered. All hell broke loose. You have to take a different approach

ember kettle
#

right but that graphical representation, how do you get that to follow the hand as if it were being held

still hare
#

The graphical representation can be parented, because it's not a network object.

#

You simply tell all the clients to instantiate a client-side prefab as a child of the hand. You then disable / destroy the "dropped item" object.

ember kettle
still hare
#

You can call RPC functions if the functions reside on a networked object (in a NetworkBehaviour). You can't put RPCs functions onto a normal MonoBehaviour though

ember kettle
#

so when the player picks up a gun for example, they instantiate the gun to their hand. but how is that synced across the server?

#

server rpc to client rpc and then spawn it there?

still hare
#

Some games also just have all the guns as disabled gameobjects under the hand.

#

They then just enable / disable them when needed.

ember kettle
still hare
#

I do not know, I don't think I have ever done it. It probably gives you warnings and things break.

ember kettle
#

ok last thing, im a bit confused on how you would implement the last part of what you said. the whole clients despawning the dropped gun, and spawning it in a specific player. how would you specify the specific player to spawn it under?

#

just with a clientId?

still hare
#

Sure, that's what I use

#

I think NetworkObjects can be serialized over the network, meaning they can be passed as parameters through RPCs

#

so you might be able to use that too

ember kettle
#

yeah with NetworkObjectReference

#

so id use that to despawn the dropped gun on the server, since its a network object. and then instantiate the gun on all clients using a ClientRpc

#

but how would i find the reference of the exact player, using the clientId? theres like a PlayerObject field right? that part im not sure on

sharp axle
#

You can't. Network objects have to be spawned from the server

sharp axle
dapper plover
sharp axle
#

Then it can't be a network behavior

hard creek
#

Ok even NetworkTransform doesn't synchronize the position of my player. Any idea of what can be wrong ?

#

The player transform is updated from another gameObject.

#

My player has a networkobject component, and also a networktransform component

#

the player is created using SpawnWithOwnership from the server

hard creek
#

Can I activate some log or any info to understand what is wrong ? My NetworkManager LogLevel is already at Developer. But I don't have any idea if the networktransform is known by the network manager, if the transform is sent to the client or not, ...

#

From tutorial it is like there is nothing to do "put networkobject and networktransform to your gameobject and it is synchronized" but not in my case 😦

sharp axle
hard creek
#

@sharp axle In fact at start, the server create all the players and then "give" them to the clients using SpawnWithOwnership

#

Then these players create another gameObject (a ball). This is this ball that I want to move.

#

When players create their ball I think that "Instantiate(ballprefab)" is not enough. Probably a network spawn or something like that is required.

sharp axle
hard creek
#

Ok thanks for the info

primal timber
primal timber
primal timber
#

Hi everyone, if anyone is having trouble with:

  1. Using the 3rd person template
  2. Adding a new "menu scene" to select host / server / client
  3. Loading the template's "Playground" scene
  4. Getting movement to work properly

Please let me know

weak plinth
zealous breach
#

Hmm ok kind of a really noob question here:
I have a script called CharacterSpawner that is attached on an empty object in my second scene. From my first scene, I either start a client or a host and load the second one.
How do I make it so when the second scene is loaded, my script can be executed and run functions like OnClientConnected , OnNetworkSpawn etc.. ?

primal timber
zealous breach
#

Aaaah just got It, I should have used NetworkManager.Singleton.SceneManager.LoadScene rather than UnityEngine.SceneManagement.SceneManager.LoadScene

primal timber
#

And also inherit from NetworkBehaviour instead of MonoBehaviour

#

Yes, NetworkManager.SceneManager will trigger the events you want

zealous breach
#

Do you know in which function I should register my callbacks ? Currently I have ```cs
private void Start()
{
if (!IsServer)
{
Destroy(this);
return;
}
NetworkManager.OnClientConnectedCallback += OnClientConnected;
NetworkManager.OnServerStarted += OnServerStarted;
}

    public override void OnNetworkSpawn()
    {
        Debug.Log("OnNetworkSpawn");
        if (IsServer)
        {
        }

        base.OnNetworkSpawn();
    }

    private void OnServerStarted()
    {
        Debug.Log("!!! Server started !!!");
    }
    private void OnClientConnected(ulong clientId)
    {
        Debug.Log("!!! Client connected !!!");
    }

But when the host start I only see the `OnNetworkSpawn` debug log
wet compass
#

netcode question, anyone know if there is a way to have an RPC in a non-networkbehaviour class?

wet compass
zealous breach
#

oh god thanks, I think I should probably wake up before trying to start coding

wet compass
#

it may help if you have some intellisense or autocomplete enabled, it would suggest what I suggested and make you suspicious if its not autocompleting what you intended 😛

zealous breach
#

I do have ahah but somehow it did not trigger any warning

#

Any idea why OnServerStarted is never triggered ? maybe because the event is fired before my scene loaded ?

sharp axle
sharp axle
dapper plover
#

i sat down again and it made sense @primal timber it helped to build and run it and see what the different Server modes did

split sonnet
#

does anyone here know something or two about sockets?????

sharp axle
split sonnet
#

basically i mean i'm facing a lot of lag, packet loss and disconnections

#

and i want someone to help me design the socket buffer read and write size, the number of bytes and outgoing queues

sharp axle
#

lol, yep. thats why I don't deal with them

cunning egret
#

If you have to ask it's probably not a good idea to write this stuff yourself

split sonnet
cunning egret
split sonnet
cunning egret
#

Lol no

#

Like I said, you should be able to write this yourself

#

You set up a base socket, you should be able to set up a simple heartbeat

dapper plover
#

oops

#

does ClientNetworkTransform make speed hacking possible?

#

someone said this on Dec 9 2022
"About this, ClientNetworkTransform is now an utility class listed in the documentation, but it's still not part of Netcode For GameObjects as client-authoritative movement is (in general) an unsafe practice that exposes your game to some types of cheats (I.E: movement hacks)

sharp axle
dapper plover
#

do you know the solution to making inputs on client instant (for FPS game)?

sharp axle
# dapper plover do you know the solution to making inputs on client instant (for FPS game)?

Welcome to this Unity Tutorial where we go over Determinism, Fixed Tick Rate, Client Prediction, and Server Reconciliation. Deterministic Programs and Fixed Tick Rate are more theory but really important to understand in order to implement Client Prediction & Server Reconciliation. I then go into how to code Client Prediction & Server Reconcilia...

▶ Play video
unreal sky
#

how do you get clientids when a client connects
using netcode

dapper plover
#

thanks @sharp axle

#

it's a little hard finding netcode resources

forest grotto
#

is it normal that the server list in unity Multiplay gets deleated if there are no servers started for a day

unreal sky
#

is there a method that is auto-called by unity when a player joins?

dapper plover
#

i read Valorant netcode tick rate is 128.. how is that possible if some people are only at 60fps?

forest grotto
#

thats how fast the server calculates the info and physcs. I think thats what that meand your 60fps is images rendered per second

dapper plover
#

i read client and server have to use the same tick rate for things to be deterministic

forest grotto
#

so how many times a second the server try's to update its self in turn sending all the data to connected players

weak plinth
# dapper plover i read client and server have to use the same tick rate for things to be determi...

You're confusing tick rate and fps. For example when you throw a nade, its a physics update is applied 128 times per second to calculate its trajectory. Then it is rendered on the client at whatever the fps happens to be. This is also why 128 tick and 64 tick servers behave differently - if you calculate the physics half as often, the difference between the tickrates will compound over larger movements like a nade toss or a bullet drop

forest grotto
#

the fps are Frames per second. How many images your computer can render in one second

dapper plover
#

i thought frames per second is both visual FPS and how often Update() was called

weak plinth
#

Correct, Update is called every frame so it's tied to your FPS. For physics calculations you'd want to use FixedUpdate instead, which is called 50 times per second by default and doesn't depend on your FPS.

dapper plover
#

ok i didn't know about FixedUpdate thanks

#

so my statement "i read client and server have to use the same tick rate for things to be deterministic"
is wrong?

dapper plover
#

thanks

sharp axle
#

yea Network tick rate is different from frame rate

unreal sky
#

heya

#

so basically

#

i have a movementscript

#

for netcode players

#

and it works with just 1

#

but when multiple players are online the sytem freezes the players

#

it seems like they try to move but get repeatedly warped back to start position

sharp axle
unreal sky
#

its complicated

#

basically

#

i don't want cheaters

#

so i hav eit so the client sends input to the server

#

through an rpc and a networkvar

#

just the input

#

soooooooo i can't really use those

sharp axle
unreal sky
#

oh kek fr?

#

damn thanks aight

#

ur the network channel's gigachad lmao

#

you dropped this 👑

unreal sky
#

which would you guys say is better

#

netcode or steamworks

#

idk which to use

#

i'm a bit into netcode, but nowhere near far enough that quitting would be a massive loss of progress

sharp axle
unreal sky
#

i don't want to be bound to valve

#

buuuuut it is more financially sound for the time being

sharp axle
#

Steamworks is not a networking framework. even if you want to use it, You'll still need Mirror, NGO, or Fishnet or whatever

unreal sky
#

oh

#

welp

#

thats good to hear

#

makes it easier to choose lmao

wet compass
#

whats going on in networkbehaviour.onnetworkspawn and onnetworkdespawn? Docs seem to make sure to call base.onnetworkdespawn when overriding it but not onnetworkspawn and i cant figure out whats going on in those methods in the base class

#

(using netcode)

forest grotto
#

@sharp axle can i use matchmaker teams to dynamicly change collor of player

steel flume
#

hello

#

fixed the movement of the player and npc system in my game
currently its sending the position every frame
we send position every second
its sends it every server tick
60 times a seconds or something like that
depends on current server performance
for every player & npc
When you see 10 NPC or Player you will get like 500 networkmessages per second
foreach player
10 players
5000k per second
how can I fix this so that there is no load on the server

sharp axle
sharp axle
ember kettle
#

how can i exclude a certain client from a client rpc?

ember kettle
#

so would i send a ServerRpc, then a ClientRpc with the senderId as a parameter, and then in the client rpc return if the senderId equals owner client id?

#

ok i just checked isowner and returned and that worked for what i had to do

unreal sky
#

how do i differentiate player objects?

#

they all have the same name

#

and idk how to get client id from just the player object

unreal sky
#

nvm i found smthn

lone cedar
#

Yo

#

I think I want to do partnership with an artist for assets in game

weak plinth
#

I'm having this weird issue where I can't call a ServerRpc from OnCollisionEnter, but the same Rpc works just fine if I call it from Update or whatever. Am I missing something? Should I handle collisions another way?

#

I know that the OnCollisionEnter() itself triggers just fine, it just won't execute any ServerRpcs inside it

sharp axle
hard creek
#

Hello. I have a server that spawns a NetworkObject "A" and a NetworkObject "B". When A is enabled it must enable "B" and when "A" is disabled it must disable "B". ("A" is not a parent of "B"). What is a correct way to initialize a scene with this feature working on all clients ?

#

Somewhere, on client side, there must be a mechanism to tell A what is the B object that it should "manage"

#

I'm not sure that I explained correctly my problem.

#

In fact when A and B spawned by the server, appear on a client side, there are not "linked", A doesn't know that B is the object that it should enable/disable.

#

Additionally the server can spawn several couples "A"/"B"

sharp axle
hard creek
#

@sharp axle thanks for the answer, I will handle this use case using a manager class and RPCs 🙂

#

Another question. When the server spawn an NetworkObject containing a NetworkVariable.

  1. If I set the NetworkVariable value and then I call spawn I get a warning: "NetworkVariable is written to, but doesn't know its NetworkBehaviour yet. Are you modifying a NetworkVariable before the NetworkObject is spawned?" but the variable got the correct value on client side.
  2. If I set the NetworkVariable value just after spawn call, I don't have the warning but the variable it is not updated with the correct value on client side.
    So what is the correct way to do that ?
sharp axle
slow marsh
#

Hi I just implemented a basic movement system to my netcode multiplayer game and used Server RPCs for that and when I test it I have an huge input delay. Any ideas where that came from and how to fix that?

sharp axle
zenith crescent
#

anyone?

torn coral
#

Ooop just found this channel- I haven’t used Unity in like a decade what updates/packs do they have to do like a small server? Ie i put up a server and a few friends can have logins to the game?

candid maple
zenith crescent
#

https://hastebin.com/meqiqokaju.csharp
can someone help me im making a multiplayer prop hunt game, and i made this script to copy a object u click on and instantiate it at the player and set parent yadeedoo, but theres a problem when theres more then just the host in the server,
for every client that joins another object spawns but without the parenting or size changes the rest of the script makes, and im very confused any ideas? heres image:

hot venture
#

Hello, is there anyone who can help my problem with Photon Network ?

[PunRPC]
    public void SpawnTelli()
    {           
        PhotonNetwork.Instantiate("MIRANA", spawnPoints[spawnBolgesi].position, Quaternion.identity, 0, null);      
    }
wide girder
zenith crescent
#

can someone help with my problem been up for 9 hours trying to fix it

wide girder
zenith crescent
#

at the bottom of the hastebin is the size and position but the parenting i was leaving to being local because the player has the transforms so once its a child wont it work?

#

@wide girder

wide girder
zenith crescent
#

in the game it works though, the player has the gameobject moving with them without networking the parenting

#

everything but it making a second object when instantiating the object

#

and only when theres a 2nd client connected

#

and it will make 3 extra ones if theres 3 people in the server

#

ive tried many ways different instantiating methods, networking the parent etc. i have no clue why its running the script over each client and spawning the object

wide girder
wide girder
#

You must understand that Photon instantiate already instantiates an object that is synced between the clients. Basically it calls instantiation on each of the clients. If you call it on each client, each one would create a new object for all the clients.

zenith crescent
#

how would make it instantiate only on the main client but still get updated by the others?

#

because if i add the photonView.IsMine it messes up other networking things and just doesnt show up on the other clients

wide girder
zenith crescent
#

one thing ive never tried is checking if its mine before instantiatiing and networking the parenting too

wide girder
zenith crescent
#

putting the parenting code into a rpc

#

yes it does need to own it

#

so what should i do to make it work properly because only putting the ismine makes it not show up on any client

wide girder
#

For starters, maybe try to explain what you want to achieve step by step, because it's not entirely clear to me.

zenith crescent
#

when you click on a object it check the tag and if its correct it will make a copy and instantiate it, and turn off the player model, basically turning the player into the same object they clicked, so prop hunt

wide girder
#

Okay. So something like this?

  • destroy the player object
  • transfer ownership of the clicked object to the player
zenith crescent
#

more like disable it because i need it to be reenabled whenever
and make a copy of the object and make the player that.

#

so you walk up to a cube and click it and u become a cube too

wide girder
#

Okay, I see.

zenith crescent
#

and every client should see it but it dont

#

closest i got was it makes a instantiation on every client but it does work mostly

wide girder
#

So first, you should be using Photon.Instantiate to spawn the cube. It should be called only on the client that clicked the object.

zenith crescent
#

okok

#

when i do that it spawns the object on the other players screens too but it doesnt parent to the player i think i tried it before

#

started learning photon like 2 days ago so im a little bad at it

wide girder
#

Then after instantiating it, you can call an RPC that would parent the newly instantiated object to the corresponding player. That RPC needs to be called on all the clients

zenith crescent
#

okay and the position change and scale change should be called with a rpc still?

#

nvm that just made a object reference not set and the players turned invisible

slow marsh
sharp axle
#

Input lag

unreal sky
#

heya
so i was experimenting with basic server-side movement and noticed that, even though the objects (are supposed to) move at a constant speed, they appear floaty and on ice as if i'm using physics objects or velocity (which im not). However, this only applies to clients other than the localclient, which is odd since i haven't implemented client-side prediction

#

is there any reason for why such floaty movement would occur?

sharp axle
unreal sky
unreal sky
torn coral
#

Hope everyone is having a great day

#

What’s the best place to get started with building a player lobby/local network that friends can login to?

sharp axle
torn coral
onyx stone
#

why do i get this

spring crane
woven kiln
#

Does anyone has this problem with unity transport?

#

it is using .Count() as a method

#

i already have the com.unity.collections installed on the right version

#

maybe this is the problem?

onyx stone
forest grotto
#

Im guessing that matchmaker is broken currently. on the fact i cant join a game and there is a red warning in the dashboard;