#archived-networking

1 messages · Page 11 of 1

sharp axle
#

The easiest way would be to send a Vector3 for the position and a Color for the material in a RPC

trail python
#

Hello, I am completely new to networking and followed a short little tutorial on fishnet. I am having an issue though. I am using Character Controller Pro for my player physics. I'm not sure if that could be contributing to the issue. But anyway, I'm not seeing the other play object moving around on each client. I do have the NetworkTransform component on the objects.

kind sundial
#

I see also that you’re trying to make a multiplayer FPS, there’s an official multiplayer FPS demo project: https://youtu.be/UtQFkJnxDMM

rocky bramble
#

Do you know any good resources on data serialization? Binary protocol formats, floating decimal numbers, fixed, fixed point arithmetic? By the way, is it possible to use winsockets in unity?

woven kiln
#

@graceful zephyr Hey man, can photon fusion do a souls like combat with stagger and local prediction? Is it viable?

#

Even at like 200ms ping

graceful zephyr
#

But if it works out at high ping or not depends on you and your code, not fusion

#

You can predict as many ms into the future as you want, but if that works performance wise and gameplay wise is on your end not fusions

woven kiln
#

But things like a stun where you are locally predicting you moved to the right but you were stunned 200ms earlier. Is it viable on photon fusion? assuming i`m doing the code the right way

#

" If your character moves client-side thinking everything is okay and an enemy has stuns it in the meantime, that enemy will have stunned your character earlier on a different version of the world from the one you're seeing"
this is from unity page about networking

sharp axle
#

You would just see the character snap back to where it was stunned

woven kiln
#

A stagger (mini stun) happens on nearly every tick, every 2s a snap back ...

sharp axle
#

Of course it's viable. But very few games will survive 200ms ping for very long

graceful zephyr
#

@woven kiln yes fusion can do this type of prediction

#

And it will correct itself automatically on mispredixiciton

storm summit
#

stunning is tricky to look good with client prediction.
if you pair stun with knockback you can sort of fudge it and smooth it out.

Say you are stunned and knockedback by the server for 2s.
0.5s later the client recieves this message. The client has 1.5s to do the knockback from where you incorrectly are to the stun spot, rather than doing the usual reconciliation which would've snapped you.

Of course if you recieved the message after the entire stun duratioin has ended you'll jsut get the usual.

woven kiln
storm summit
#

Yeah, the faster your gameplay/worse your ping the more off it'll look for sure. Definitely a can of worms!

woven kiln
#

Is there any game that is doing it at 200ms+?

#

with success

#

New world is the closest but not at 200ms

remote tartan
#

Sorry for the crosspost; not sure if the question fits here better:
I'm building an app on iOS that needs to communicate with the Unity Editor (a custom editorwindow). I need to be able to send files from the editor to the app and vice versa. I also want to do some RPCs from the editor to the app.
What's the best way to go here? I came across the Telepathy library which makes it easy to set up a connection and send arbitrary byte arrays over tcp, but I'm not quite sure how I would figure out what file I'm sending/receiving (a header, probably?).
Or is it a good idea to run a small http server on the app and use UnityWebRequest for sending files?

ionic wind
#

Hey, so I got this working and the server changes the color for the player however, whenever a new player connects the old states that are present on the already connected players aren't applied to the new player's unity instance. Do I need another RPC onconnect to sync the data?

sharp axle
ionic wind
sharp axle
ionic wind
#

(FirstPIcture) I have this state in my multiplayer game where I have set the colour of objects to two distinct colors.

(SecondPicture) I connect a new client to the server and it won't sync back the colors.

austere yacht
sharp axle
ionic wind
#

I am assuming that the host/server internally maintains a list of its connected clients, do I need to trigger a Server RPC which will inturn fire a Client RPC only for the new connected client?

ionic wind
sand talon
#

i am trying to pass the Player class instance who sent the RPC along side with it, why is it returning an error?

#

The LocalPlayer and Networked player both inherit a Player class, wich is where the rotation is happening, plus i'm testing this in a room with only myself inside... it should work tho!

#

playerSync is a class dedicated for rpc calls etc

#

that's whats inside there!

#

It also gives this error if i make Player a Player class instead of LocalPlayer and attach the LocalPlayer class!

gleaming knoll
#

Hi everyone. I am developing a multiplayer game and I need to store the player's name upon connection to the game. Should I be creating a custom NetworkManager class that inherits NetworkManager and override things or is there an easier way to do this?

bold wagon
sharp axle
gleaming knoll
sharp axle
signal crown
#

I want to implement a "last man standing" multiplayer game (similar to Crab Game), and I was looking at Unity Relay. However I'm having a bit of trouble understanding the costs associated with it.
I want a game with about 20 people in the lobby etc, and wanted it to be p2p so I don't have to pay for any servers (i.e. the game is run on the player hosting the game's PC). I moved from Photon to Netcode thinking it could be done for free but from what I see, I would need Unity Relay to achieve this. And for Unity Relay, I see that it's 50 Concurrent Users with $0.16 per additional user.
Based off my understanding, in an unrealistic scenario, I have 20k people playing this at once, that's $3,200 a month which is $38,400 a year. And I have no intentions of commercialising this game.
Am I correct in this understanding? And/Or is there a free alternative where I don't have to pay anything to achieve this? I hope I'm making sense
Thanks

neat veldt
#

But 50 CCU is more than you think

#

Having 20k CCU puts you in the top 40 steam games for some perspective

signal crown
#

I would say it's a definite possibility given the intentions of it, I don't anticipate it being any more than 200 people at the most, but I'm not really sure tbh. If 50 CCU is 50 players, and a 20 player maximum lobby, there's 2.5 games that can be run at full capacity

#

500 CCU for free would be great but I have a sneaky suspicion Unity wouldn't have that as an option lmao

tough path
#

i want to send an information to the server from my client and server should send that value to other clients. i use network variables for that value but i don't know how can i make this transfer process. do i need serverpc or clientrpc or both?

neat veldt
#

I can't site my sources but I heard somewhere that 50 CCU is about equal to 10k copies sales. If you're selling 10k, those costs probably don't matter compared to marketing and production costs. Otherwise NAT Punchthrough is free if you're willing to implement it. Also P2P sounds like a bad option for you. What if the host gets elmininated? IIRC netcode doesn't support host transferring yet.

#

@signal crown

neat veldt
tough path
#

[Netcode] NetworkPrefab "Player" has child NetworkObject(s) but they will not be spawned across the network (unsupported NetworkPrefab setup)
does anyone know how can i get rid of this thing?

ionic wind
#

Hey, I am trying to modify a NetworkVariable however I was encountering the following error: Client is not allowed to write to this NetworkVariable so I switched to Server RPCs and then tried calling the ServerRPC to modify this network variable but now I am getting this error: Only the owner can invoke a ServerRpc that requires ownership!

dapper hull
#

So I have been learning about the basics of networking and just saw the new Counterstrike "getting rid of tick rate" announcement and it threw me for a loop on what i thought I was understanding. Do people know what's going on under the hood to "eliminate tick rate"? Is the idea is clients are sending packets with timestamps and then the server is prioritizing them within physics ticks (i.e. the source2 equivalent of fixedupdate)? How does that not end up giving exploitable trust to the client?

I realize I'm essentially asking about Source2 in a Unity forum, but I assume the concepts of networking are fairly universal, and I'd love to implement something like that if it's doable. Do they just have after the fact packet analysis to figure out if someone is spoofing timestamps (e.g. x percentage of packets being towards the the front of an expected normal distribution of packet times within a tick)? Some other form of anticheat? Is there just something I fundamentally don't understand about what this means? Thanks for any help!

#

Actually I guess it'd be a uniform distribution, but I digress

neat veldt
tough path
neat veldt
#

Put the networkobject in the root object of the prefab (the top parent)

neat veldt
sharp axle
sharp axle
ionic wind
neat veldt
#

It's not

spring crane
#

I believe newer versions are?

neat veldt
#

I remember seeing it on their roadmap a couple of days ago

ionic wind
#

Unity Transport is not currently supported in WebGL. NetworkDriver will likely not work as intended I recall someone telling me it was.

neat veldt
spring crane
ionic wind
spring crane
#

Wait, is 2.0.0 older than 1.0.0?

#

This is documentation for Unity Multiplayer Networking 2.0.0, which may be a previous or preview version.
For up-to-date documentation, see the latest version (1.0.0).

#

Or is that coming up just because it's in preview

neat veldt
#

It seems it's supported, but the server/host cannot be on WebGL

ionic wind
spring crane
#

Make sure you have the correct versions

ionic wind
#

Correct versions of what? Unity Transport?

spring crane
#

I would start there

ionic wind
#

I have used the same version for both host and webgl instance

#

I literally exported the game after implementing a basic project.

spring crane
#

I meant versions that are new enough to have WebGL support

ionic wind
#

Oh what, if that's the case how will i revert to older versions?!

sharp axle
ionic wind
#

I am using 1.3.0. Okay here is what I am doing:

  1. I am hosting a server using my Unity Editor (which is also a client) the target ip is 127.0.0.1 and port is 7777.
  2. I am trying to connect to the host setup in point 1 using WebGL client.
sharp axle
ionic wind
#

Oh my god, the versions are just confusing 🤦‍♂️

sharp axle
#

You might mean Transport? You would need 2.0 version of that

sharp axle
#

You have to add it by name and specify the version number

ionic wind
sharp axle
sharp axle
ionic wind
#

Yes.

sharp axle
sharp axle
#

But it's averaged out over the full month

ionic wind
#

2022.2.12 to be specific

signal crown
#

So if for example I load up the "server" for 1 week of the month, then 500 people play it, then the rest of the month I have the "server" down/off, I wouldn't reach the 50 CCU average?

sharp axle
signal crown
#

Ohh ok, thanks 🙂 Do you happen to know anything about the Steam framework? Dunno what it's called but apparently it's free (minus the upfront cost to publish the game etc)

ionic wind
#

It did add the library for me however my WebGL build takes years, is there a way to fix that as well (Although this is not related to this channel)?

stuck flume
#

hey, noobish question, would it be possible to control my vr multiplayer gameplay via something like a webapp that is connected to photon pun? is this possible? Like I want a vr game lobby where one player is on the pc and can control certain aspects of the game...

lucid inlet
#

Anyone know what could cause my spawn point in my Server build to be different from where it spawns in the Editor? its not setting it to a random value, its a fixed value that works in editor but its different on my server. Seems like a deep underlying issue i'm having.

In my enter server system i set the position:

   commandBuffer.SetComponent(player, LocalTransform.FromPosition(new float3 (7, 2, 5)));

but in the server build its (0,0,0)

sharp axle
stuck flume
sharp axle
sand talon
#

how can i network a method like transform.RotateAround() on a player instance?

sand talon
sharp axle
sand talon
stuck flume
sand talon
# sharp axle You can run it in an RPC

it kinda works for the local player, but it looks offset for a player that joins after i have been orbitting around an object with it... should it be buffered or nah?

#

nvm, fixed it... partially!

radiant dome
#

hello guys,i am using photon voice2,i set up the project but when there are 2 people in a room just the master-client can speak while the other player no,is this normal or it is a bug?

sharp axle
radiant dome
#

ok thanks

tough path
#

is there any way to make networkvariable<int> value null?, ikr it says non-nullable type

sharp axle
tough path
sharp axle
tough path
lapis valley
#

Hey guys, I’m kind of OOTL (havent been devving in a while). What do people use nowadays to handle networking? I’m running 2021.3.4f1

#

Im pretty well acquainted with Mirror, but maybe theres something more “trendy” now :)

sharp axle
lapis valley
#

Gotcha, thanks!

silent bramble
#

Hey

#

Any devs in here who do multi-player games ? I need help with something

#

How do I sync an object between client and server?

sharp axle
silent bramble
sharp axle
ember kettle
#

hey, how would i be able to target an RPC to a specific client?

sharp axle
ember kettle
#

unity ngo lol

ember kettle
#

so right now I'm trying to spawn in a network object as a player, but for some reason it only works when I pass in the host id

#

doesn't work for the clients

#

I'm doing this in a server rpc

inland pier
#

what is better using steam for multiplayer or unity netcode

half anvil
#
 [Command]
void SpawnObject()
{
    // Spawn object on the server

    RpcSpawnObject();
}

[ClientRpc]
void RpcSpawnObject()
{
    // Spawn object on all clients
}
#

why would you do something like this ?

#

I mean call the rpcSpawnObject in a command function ?

#

ping me

#

i understand almost every basic except from this

sharp axle
sharp axle
silent bramble
#

How do I find out what network framework a game is using ?

olive vessel
#

Google it, ask the devs

ember kettle
#

the variable I pass in for the clientId is the ownerClientId of the player

sharp axle
rustic hare
#

I just started using mirror and fizzy steamworks and cant find out why one client can instantiate a bullet and see it but other clients wont see it, can anyone help ```public class Shoot : NetworkBehaviour
{
public PlayerMovement pm;
bool bananaHeld;
public Rigidbody2D banana;
public GameObject player;
public float throwPower;
[HideInInspector] public Rigidbody2D thrownBanana;

// Start is called before the first frame update
void Start()
{
    bananaHeld = true;
}

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

    if (Input.GetKeyDown(pm.ThrowButton) && bananaHeld == true)
        Throw();

    if (thrownBanana)
    { Debug.Log(""); } else {
        Debug.Log("");
    }
}
[Server]
[ClientRpc]
[Command]
private void Throw()
{
    thrownBanana = Instantiate(banana, transform.position, transform.rotation);
    if (pm.movement.x == 0 && pm.movement.y == 0)
    {
        thrownBanana.velocity = new Vector2(player.transform.localScale.x, 0) * throwPower;
    }
    else if (pm.movement.x != 0 || pm.movement.y != 0)
    {
        thrownBanana.velocity = pm.movement * throwPower;
    }
    thrownBanana.GetComponent<Bananarang>().target = player.transform;
    bananaHeld = false;
}
private void OnTriggerEnter2D(Collider2D collision)
{
    if (collision.gameObject.GetComponent<Rigidbody2D>() == thrownBanana && thrownBanana.GetComponent<Bananarang>().canReturn)
    {
        bananaHeld = true;
        Destroy(thrownBanana.gameObject);
    }
}

}```

hazy galleon
#

hey so im coding a grenade for my game and everything is working exept for calling damage. Im using an RPC to call damage over the network and im a bit of a beginner to rpc's so if anyone could help that would be great. heres the strand: https://hatebin.com/ifjzhbbyzm

ember kettle
#

😭😭

#

so that means that the clientId variable is correct, its just that it's not spawning in the playerobject for the clients for some reason

#

(btw I named the player objects player0, player1, player2, etc, based on what client they are)

patent coyote
#

I was wondering if anyone here has used mirror and do you suggest it?

sharp axle
sharp axle
patent coyote
ember kettle
#

rn what I'm doing is calling a server rpc to damage a certain player when the player object is shot

sharp axle
patent coyote
#

Therefore, Mirror would be the way to convert does services into a usable library?

sharp axle
sharp axle
ember kettle
#

so should I just change the network variable on the server rpc and then on the client have the on changed callback

sharp axle
ember kettle
#

hmmm

sharp axle
#

The health should be server authoritative. When the server registers a hit, it will adjust the relevant HP.

#

The clients can use the OnValueChanged callback to update any UI

ember kettle
#

ah got it

#

the only confusion I have left is how to change the correct clients health network variable. right now I have it so the player that shoots another client sends the rpc

#

not the actual client being shot

#

so doing senderClientId would return the shooter, not who was shot

sharp axle
ember kettle
sharp axle
hazy galleon
#

hey so i am calling damage from a grenade and its working exept its not calling damage through the rpc can someone please help?

sharp axle
hazy galleon
#

the thing is shooting and decreasing health works its just im having trouble calling the pun rpc when the overlap sphere touches the player

#

so I just need help with fixing one line of code

hazy galleon
sharp axle
hazy galleon
#

ok

hazy galleon
sharp axle
hazy galleon
#

ok

little violet
#

Does anyone know how to fix this error. When I tried increasing the Queue Size, the network objects don't register which gives more errors.

#

errors that occur once I increase the Queue Size (the prefabs are registered in network manager)

sharp axle
candid dagger
#

can someone tell me why other players cant see the weapons i have equipped?

if (Input.GetKeyDown(KeyCode.Alpha1))
    photonView.RPC(nameof(EquipSnowball), RpcTarget.All); 

[PunRPC]
void EquipSnowball()
{
    snowballOverlay.SetActive(true);
    katanaOverlay.SetActive(false);
    mLauncherOverlay.SetActive(false);
}

the input.getkeydown is in update btw
and update checks if photonview.ismine

spring void
sharp axle
slim gate
#

Hello. I'm fairly new to networking and am currently using fishnet.

One problem i have is that the lag between clients are noticeable. I heard lag compensation fixes this but I don't want to upgrade to fishnet pro.

Are there other techniques i could use to reduce lag between clients?

naive egret
#

Hello, voice chat is quieter in some places, but in the centre of the map, it is really loud? How do I fix this? I use Photon VR Voice

half anvil
#

lets say there is a function that needs to be run by the server and we are running it without the server attribute what happens then ? How does the unity know that this function needs to run on server is it because of server attribute only that unity knows that this function is running on server or something else ?

sharp axle
sharp axle
half anvil
#

Also when we want client to give a message to all the other clients we put a clientrpc in a command function how does that work does the client tell the server to run the function on the server and then server run the function which affects all the clients ?

half anvil
#

what happen without server attribute

sharp axle
half anvil
half anvil
#

I am talking about mirror

sharp axle
# half anvil I am talking about mirror

You'll need to read the mirror docs about how it does RPCs. But for the most part functions will run where they are called. It will run on both clients and server. Then you will need to check if its the server or not after its called

viscid vessel
#

so i have a custom class that is serialized and a networkvariable

#

it does update on the client that its changed

#

but it doesnt sync on the other client

#

any ideas why it happens

nocturne vapor
#

Do you update the variable in a serverrpc?

viscid vessel
#

or if i update it on the host

#
        // todo: set AddNextBotToSessionList(long modId = 0)
        public void AddNextBotToSessionList(long modId = 2883082)
        {
            // todo: check if client is master/host client!

            try
            {
                NetworkHandler.Instance.globalData.Value = new GlobalData
                {
                    nextBotModIds = NetworkHandler.Instance.globalData.Value.nextBotModIds.Concat(new[] { modId }).ToArray(),
                };
            }
            catch (Exception e)
            {
                Logger.Error($"Error while trying to add a new nextbot to session list! More info: {e}");
                return;
            }
            
            Logger.Info($"Successfully added nextbot:(Mod Id) {modId} to the list!");
        }
#

this is the code that changes the networkvariable

nocturne vapor
#

Ok I have found something, the default creating of a network variable only allows for the server to change the value. Scroll down in the docs to permission

viscid vessel
#

is that the first client that joins

nocturne vapor
#

From the docs

public NetworkVariable(T value = default, 
NetworkVariableReadPermission readPerm = NetworkVariableReadPermission.Everyone, 
NetworkVariableWritePermission writePerm = NetworkVariableWritePermission.Server);
#

You could change it to everyone as well

viscid vessel
#

i think i am gonna try a rpc

#

send it to server

nocturne vapor
#

Yea but you want to change it, if I understood correctly, so write perms need to be set to everyone too

viscid vessel
#

server and owner

nocturne vapor
#

Oh right, I'm a bit tired, sorry
I actually don't know

#

I think it is the client, which initiates it, but not sure

viscid vessel
viscid vessel
#

thx for the help tho

oblique sandal
#

Can we use rigidbody based characters for our game that uses Netcode

sharp axle
oblique sandal
#

What do you think about Fishnet

#

Ive seen online that it offers support foor rigidbody characters out of the box

sharp axle
sharp axle
oblique sandal
#

I'm completely new to networking and it seems like a physics based multiplayer game was a bad idea 😅

#

I've posted a yt link in #archived-works-in-progress showing a clip of the kind of game I wanted to make. Is that possible at all or just outright impossible for a newbie

sharp axle
oblique sandal
#

I see

viscid vessel
sharp axle
nocturne vapor
# oblique sandal I've posted a yt link in <#502171560359100437> showing a clip of the kind of gam...

It honestly depends on how good you are with docs, all the physics interaction can be handled through network transforms, the movement off the player has to be client authoritive tho
From my experience, which granted is not a lot, most of it works pretty much out of the box, with netcoee for gameobjects, once you got network objects, network transforms and most importantly player movement setup

But wouldn't recommend such a complex system as a first project, start a new one, get familiar with netcode and after that come back to the project

#

The important part is, that every omving object, which is nearly everything in your scene, needs to have a NetworkObject and NetworkTransform component, after that you need to register the network prefab of them in the server manager.
Then the physics should pretty much work

sharp axle
#

It will be fine as long as players don't collide with each other. That's when shit gets wonky.

viscid vessel
sharp axle
unique wing
#

Hey so im making a game and i try to add multiplayer but it wont show up in my assets, what does this mean? And how do i fix it?

sharp axle
unique wing
#

so i tried using Pun 2 wich is also multiplayer but it said the same thing

#

@sharp axle What do you mean by Which networking library am i trying to use?

#

@green tusk Could you help me?

sharp axle
unique wing
#

Yea im trying to install from package manager

#

i'll send a picture of what i see

#

[Package Manager Window] Cannot perform upm operation: Cannot fetch authorization code. User access token is expired or invalid. You may need to sign out and sign in again. [Unknown]. I just copy and pasted that but thats what its saying now

sharp axle
unique wing
#

Nope I'm logged in

sharp axle
unique wing
#

Ok it worked thanks!

steep veldt
#

Sorry if this too vague or rudimentary but I've watched a lot of videos and read a lot of docs. Whats the best approach to sync clients joining a session in progress? The issue I'm currently facing is all the network objects that have been destroyed are frozen in place at the place they were destroyed at before the client joined. I'm using a ClientRpc as well as a ServerRpc to return objects back to the pool. There's also some other weirdness happening on the client but I'll tackle that next. In the screenshot you can see frozen missles left over from the host(on the left) on the client(right).

viscid vessel
#

Thx

#

After i am done with sleepijg

weak plinth
#

I am using Photon Fusion for my multiplayer game and I am having an issue where the second player who joins the game is unable to move. The first player is able to move without any problems. Both players are able to join the game and spawn correctly, but the second player cannot move their character. I have checked that both players have control of their respective objects and have also checked that the inputs are being sent correctly. Is there something specific that needs to be done in Photon Fusion to enable movement for the second player? Any help or suggestions would be greatly appreciated.

viscid vessel
#

netcode for gameobjects btw

#

oh wait

#

it didnt capture right side

#

and yes ive maked sure both sides hvae their objects spawned

viscid vessel
#

well

#

i found the issue

#

the networkhandler i wrote

#

it doesnt sync

#

[Netcode] NetworkPrefab hash was not found! In-Scene placed NetworkObject soft synchronization failure for Hash: 704349611!

#

i get this error

#

but i dont know why it happens and how to fix it

viscid vessel
#

can someone please help

#

this stupid error is giving me headaches

#

i am trying to fix it for 3 hours now

viscid vessel
#

oh

#

i found out it has to do with dontdestroyonload

#

why tho

obsidian jasper
#

hey guys, I'm using Unity.Netcode and having a bit of a struggle with syncing an object position. Here is the problem. I have a physical object (with rigidbody) and the ownership is on the host. The client takes ownership and moves the object then gives back ownership to host and the object should keep moving by the inertia. But in the moment of giving back the ownership to host the object stops and and jerks a little bit back. How do I fix it?

sharp axle
# weak plinth .

You might have better luck if you ask on the Photon discord. Check the pinned message here

gleaming knoll
#

I need help understanding something in Netcode for GameObjects. The NetworkManager has a property called Enable Scene Management, which is responsible for synchronizing scenes. Does this mean that if I have a multiplayer game where I want clients to go into scenes separately I have to turn this off?

sharp axle
gleaming knoll
sharp axle
leaden totem
#

I am talking with a few people on fiverr to hire someone to implement multiplayer in my game. I am curious what the going rate for this type of work should be? I don't want to get ripped off.

#

This is the game. What is a reasonable price to pay a fiverr developer to take this and make it multiplayer?

sharp axle
leaden totem
#

thanks im not here for opinions i just want to know what a fair price would be to implement photon multiplayer

haughty heart
#

Country of origin and experience level would dictate the going hourly rate. You would need a senior experienced developer to make a multiplayer game.

leaden totem
#

so the job itself doesnt have a price?

haughty heart
#

No of course not

#

Sure, you can set one, but you'd have to get estimations on how long someone would think it would take them and use an hourly rate to calculate it.

leaden totem
#

ok. give me an idea of how many hours it would take say, yourself, to do this job and what your hourly is

haughty heart
#

But the amount of work to create, especially a multiplayer game, would be a full time job. So you'd need to be paying full time hours/salary amount if you hope to get it done in any reasonable amount of time.

leaden totem
#

everyone on fiverr just wants to "know my budget" so they can fuck me over against my consent

haughty heart
#

I don't know what your game is, you've shown nothing about it other than some movement. You haven't shared any details about the overall scope and how multiplayer would work.

#

First of all, we don't need rape jokes here. Secondly, fiverr is for small time jobs at best.

leaden totem
leaden totem
#

shee the only thing i came here for - a number - is the only thing i didnt get

#

got plenty of opinions tho

haughty heart
#

It takes work to sit down and calculate a number, nobody unless interested in having to work for you, is going to do that.

#

There are many questions to ask, because, again, it's not just "what's exactly in the video but multiplayer" that needs answering.

leaden totem
#

alright do me a favor and just give me an estimation of how many hours it could take a skilled unity networking person to take this game with basically one 500 line script running everything, and make it so that 1-8 people can be in the same space and do whats in the video

austere yacht
leaden totem
austere yacht
#

no, you can technically make it multiplayer with very little effort

#

you could also turn it into rocket league, for an additional $10mill

leaden totem
#

im going for more of a Slapshot:Rebound quality

austere yacht
#

i can't judge the quality of that

#

the point is, however much money you give someone, they will use it up

leaden totem
#

duh thats why im here trying not to get ripped off

austere yacht
#

it depends on the productivity and skill of the person what you get for that money

#

this is not a rip off

#

its how software development works

#

so you pick a person you know who can do it, give them the time they need, define reviews every 1-2 weeks to check progress/quality and steer their efforts based on that

#

all projects will have to figure out whats required along the way, there is no perfect upfront plan, spec or estimate

#

this is commonly referred to as "agile"

leaden totem
#

yeah im kinda concerned that if i take someone up on fiverr they'll keep asking for more and i wont end up actually getting what i set out to obtain

#

or some variation of that

austere yacht
#

thats a reasonable concern with any contractor

#

you could use toptal instead (considerably more expensive though)

leaden totem
#

what is?

austere yacht
#

thats fiverr for real developers

leaden totem
#

good to know

austere yacht
#

on fiverr etc. you'd only find developers that can't get onto toptal & co.

leaden totem
#

At the end of the day i just wanna take the shitty game mechanics i made and have a few friends be able to connect to the same host or server and play around with the mechanics.

#

not really trying to drop 10k to putz around with some friends

austere yacht
#

understandable

leaden totem
#

i'd throw a grand at it if i knew i was gonna get what i wanted

austere yacht
#

there is a good chance someone on fiverr can do it, but the whole context of the gig-economy on fiverr and your brief makes it a quite volatile situation

austere yacht
#

guaranteed outcomes are usually created by repeating the same thing many times (not possible with a custom job like yours) or by giving the project a large enough budget that one mistake won't cripple the project and leave either you with nothing or the contractor with an unprofitable job.

#

technically someone could just install netcode, sync all transforms and call it a day, thats doable in a day

leaden totem
#

i got halfway there on my own with netcode

#

but im really inexperienced

austere yacht
#

i'd bet most fiverr people will only do the minimum to check your boxes

leaden totem
#

thats the vibe for sure

austere yacht
#

overall fiverr is a race to the bottom, i'd not expect you to be happy with the experience unless you are very flexible with your expectations

oak flower
austere yacht
#

its much better for stuff where the outcome can be clearly defined quantitatively and qualitatively

leaden totem
#

thanks for confirming my worst case scenario

#

i might have to tell the boys the game is off 😦

#

Photon and Netcode are different ways to do the same thing ya?

oak flower
#

@leaden totem This is not related to the channel

#

If you want to chit chat use the channel I pointed to

#

Or go to DMs

leaden totem
oak flower
leaden totem
oak flower
#

@leaden totem Do a basic research before asking. Then ask a proper informed question.

steep veldt
#

Whats the best approach to sync clients joining a session in progress? The issue I'm currently facing is all the network objects that have been destroyed are frozen in place at the place they were destroyed at before the client joined. I'm using a ClientRpc as well as a ServerRpc to return objects back to the pool. There's also some other weirdness happening on the client but I'll tackle that next. In the screenshot you can see frozen missles left over from the host(on the left) on the client(right).

sharp axle
steep veldt
normal peak
#

should i use photon fusion or netcode for game objects for a fast paced fps game

sharp axle
steep veldt
wooden mesa
#

additionally the docs are quite good so far

leaden totem
#

Should i use photon quantum or netcode for a competitive physics based ball game

sharp axle
austere yacht
steep veldt
#

I will say it seems like Netcode for GameObjects struggles with solutions to physics. I've been trying to find a solution to having the client game object have control of it's player object while retaining rigidbody physics interaction. Adding a Client Network Transform removes its physics and a Network Transform keeps the physics but loses player control. I believe the right solution to my game would be to give the client access to its Network Transform, since it's supposedly possible. Any help appreciated 🙂

austere yacht
#

the easiest way is to sync physics is to have clients interpolate the physics sim results they receive from the server as changes to transforms

#

physics in a non-authoritative netcode setup are a mess

steep veldt
austere yacht
#

if you want lag compensation it all gets very complicated

#

but you can do some basic prediction just based on the inferred velocity of the transforms on clients, this will be quite inaccurate depending on the actual lag you want to compensate for, usually you'll have this just to have smooth motion on your transforms

#

its not suitable for competitive games, but often sufficient for cooperative stuff or anything that doesn't require aiming at moving targets

steep veldt
# austere yacht your server runs the physics and updates the transforms of the relevant objects,...

That is helpful, thanks. I haven't really gotten to the point of addressing lag(it hasn't been a problem testing locally via ParrelSync but don't doubt it will need to be addressed), I just want my client to be able to push around other object floating in space like the host is. So you're saying the only solution is to add something like a ServerRpc on client collision to and do something like .AddForce? I've just been looking into a server based approach

austere yacht
sharp axle
steep veldt
austere yacht
#

its all quite simple once you've fully thought through and understood how the information flows from client to server and back

steep veldt
austere yacht
#

there are very few general rules to follow

austere yacht
steep veldt
sharp axle
#

Dots Physics is still in preview in any case

austere yacht
#

if you make something based on what i described and see the limitations you will be in a much better place to dive into DOTS stuff

steep veldt
#

I'm all about that hard-learning

austere yacht
#

thats a good attitude

#

but DOTS can turn you off hard

sharp axle
#

Keep physics interactions as simple as possible. Avoid player collisions if at all possible

steep veldt
livid wigeon
#

Hi, how do I free the allocation of a player in relay if they disconnect? For example, if player 2 joins it has ClientId: 1, if it closes the game and rejoins now has ClientId: 2. How do I avoid this? I'm using anonymous login btw

sharp axle
livid wigeon
sharp axle
# livid wigeon oof if that's the case I have some serious refactor to do lol

You can see a bit on how the Boss Room handles reconnection here
https://docs-multiplayer.unity3d.com/netcode/current/advanced-topics/reconnecting-mid-game

livid wigeon
#

Thanks!

sharp parcel
#

I have some test code here, which is supposed to spawn a player when they connect as a client, but when a new prefab is created, the new one has 'isLocalPlayer' and 'isOwner' checked (on the host). Would anybody happen to know why this is?

sharp axle
sharp parcel
sharp axle
sharp parcel
sharp parcel
#

thank you

wooden mesa
#

With netcode for game objects, if I don't specify any guards such as isOwner, isClient, or isServer the code runs on both the client and server, correct?

wooden mesa
sharp parcel
sharp parcel
wooden mesa
sharp axle
lusty moat
#

does anyone know any Pun tutorials on how to add teams to my game and also how to create a death log?

sharp axle
sharp axle
sharp parcel
#

does anybody know the difference between SpawnAsPlayerObject and SpawnWithOwnership? When should each be used?

sharp axle
wooden mesa
#

So i have the basis for a physics based multiplayer game, and my current setup is server authorative (client calls a server rpc to send its inputs and server determines positions of clients and sends that back out)

I'm interested in adding latency prediction to my clients to make the inputs more responsive. Would I just use simple guards like

if (IsServer) {
  //do server side calculations
}

if (IsClient) {
  //do client side predictions and lerp towards server predictions
}

or is there a more pragmatic / unity way to do this?

#

I'd also like to maintain authority on the server

sharp axle
# wooden mesa So i have the basis for a physics based multiplayer game, and my current setup i...

That's actually the opposite of prediction. That will always have you playing catch up to the Server.
This is a short video explaining the basics
https://www.youtube.com/watch?v=TFLD9HWOc2k

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
little sorrel
#

what does this error mean RPC method 'RPC_CreateController(Boolean)' not found on object with PhotonView 1. Implement as non-static. Apply [PunRPC]. Components on children are not found. Return type must be void or IEnumerator (if you enable RunRpcCoroutines). RPCs are a one-way message.
code:

    void RPC_CreateController()
    {
        PhotonNetwork.Destroy(controller);
        controller.SetActive(false);
        spectate = false;
        Player player = PhotonNetwork.LocalPlayer; // or replace with the desired player object
        object teamObj = player.CustomProperties[TEAM_PROPERTY_KEY];
        int team = (int)teamObj;
        Transform spawnpoint = SpawnManager.Instance.GetSpawnPoint(team);
        if (player.CustomProperties.ContainsKey(TEAM_PROPERTY_KEY))
        {
            if (team == 0) {
                controller = PhotonNetwork.Instantiate(Path.Combine("PhotonPrefabs", "NeonContainer"), spawnpoint.position, spawnpoint.rotation, 0, new object[] {pv.ViewID });
            } else if (team == 1) {
                controller = PhotonNetwork.Instantiate(Path.Combine("PhotonPrefabs", "JettContainer"), spawnpoint.position, spawnpoint.rotation, 0, new object[] {pv.ViewID });
            } else {
                Debug.LogError("Erorr: No team assigned");
            }
        }
        SpectateCam();  
    }```
RPC call:
``photonView.RPC("RPC_CreateController", RpcTarget.All, false);``
half anvil
#

what should I select when choosing rigid body target 2d in mirror when i click on the circle the are no options

#

its ok i figured it out

half anvil
#
using System.Collections;
using System.Collections.Generic;
using UnityEngine;
using Mirror;

public class PlayerMovement : NetworkBehaviour
{
    public float speed = 5.0f;
    public GameObject playerPrefab;

    private Rigidbody2D rb;

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

        // Enable the player's rigidbody when it becomes the local player
        rb = GetComponent<Rigidbody2D>();
        

    }

    void Update()
    {
        Debug.Log(rb);
        if (!isLocalPlayer ) return;

        float y = Input.GetAxis("Vertical") * speed * Time.deltaTime;

        Vector3 movement = new Vector3(0, y, 0);

        rb.MovePosition(rb.position + new Vector2(0, movement.y));
    }


    


}


#

why isnt the player moving ?

#

when I debug.log(rb) it does give the value of rigid body

solemn haven
#

Photon Fusion:
Hello, how to sync NPC's movement, animation on the network? I can do one in Host's simulation but I want it to be the same everywhere and if player(client) lefts/joins, it should be synced. and when client joins late and I spawn it on my local simulation, what should I set to spawn point?
And how to spawn using Runner.Spawn?
or this should be done only host side

twin grove
twin grove
#

Cannot resolve symbol 'LobbyEventCallbacks' - this method is outdated, what can be used instead? in 1.0.3 it is not

sharp axle
wooden mesa
#

Is there some sort of way to create client-side only variables and server-side variables without making a seperate class?

im thinking something along the lines of

public class SharedNetObject: NetworkBehaviour
{
    //shared vars
    private int sharedVar = 0;
    
    //client vars
    #if IsClient
    private int clientVar = 0;
    #endif

    //server vars
    #if IsServer
    private int serverVar = 0;
    #endif
}

I understand the above example won't work as IsClient and IsServer are runtime variables and not compile time, but I'm wondering if it would be possible to get some sort of similar functionality as the above (ideally using compiletime constants, however runtime is fine too)

#

I know that you could do something like

#
public class SharedNetObject: NetworkBehaviour
{
    //shared vars
    private int sharedVar = 0;
    
    //client vars
    private int? clientVar = null;

    //server vars
    private int? serverVar = null;

    void Start() {
      if (IsClient) clientVar = 0;
      if (IsServer) serverVar = 0;
    }
}
#

however this is a bit messy, and ideally I don't need to make clientVar and serverVar nullable

#

I'd like to mention that for my use case I don't care about IsHost as my setup will always be
client <-> dedicated server

#

(but the above could be easily modified to support IsHost)

#

Keep in mind, this is not the same thing as network variables as I don't need synchronization between these two

novel kettle
#

how to avoid a serverrpc and a clientrpc that modify a player's stats from both being executed on the host, giving them the stat modification twice? I'd like to avoid using if (isHost) return; everywhere...

sharp axle
wooden mesa
# sharp axle You can use compiler defines separate out code if need be

yeah im thinking either compiler defines and pass them as a compilation flag or something (idk how compiler defines work yet but that sounds like something they should be able to do)

Or I'm thinking of creating some annotations to simplify the whole nullable pattern

[ServerVar] int serverInt = 0
[ClientVar] int clientInt = 0

if you try to get or set the serverInt while on the client it will do nothing

#

and I don't have to write annoying getters / setters for every var

sharp axle
novel kettle
#

well i need the client to be able to read their own stats, that's why i use the serverrpc + clientrpc strategy

sharp axle
wooden mesa
novel kettle
#

alright. gonna have to figure out how to do that with my non serializable class

wooden mesa
novel kettle
#

BigInteger

wooden mesa
#

just wondering do you actually need BigInteger

#

do you have numbers larger than INT_MAX64

novel kettle
#

yes, but I can convert it to / from a string

wooden mesa
#

also you can't use a double or something?

#

do you NEED integer level precision?

novel kettle
#

yes.

#

thanks for the tip, I'll rework the stats modification system

narrow mason
#

hello

#

i create game with mirror, but when I host my game camera works good

#

but when I connect client

#

hosted client camera change to new client camera

#

Any help will be appreciated.

steep veldt
narrow mason
#

No

#

when I host game

#

player is created camera works fine

#

but when i connect another client

#

first client camera changes to second client camera

#

(to new camera)

steep veldt
#

Do you have an "IsOwner" check?

sharp axle
#

You will need to make sure that only the local player has control of the camera

#

there should only be one camera in the scene

narrow mason
steep veldt
#

add "if (!IsOwner) return;" before assigning the camera so the clients aren't running scripts for other clients

sharp axle
#

Unity expects there to be only one camera in the scene. the last camera added becomes the active main camera

sharp axle
#

don't spawn a 2nd camera. or just disable it on remote players

narrow mason
#

that doesnt work

wooden mesa
#

Has anyone used c# compiler directives with RPC's?

#
        //client rpc for receiving state from server
        [ClientRpc(Delivery = RpcDelivery.Unreliable)]
        private void PlayerStateClientRpc(ulong sourceNetworkObjectId, StatePayload state)
        {
            #if IS_CLIENT
            latestServerState = state;      
            #endif
        }
        
        //server rpc for sending input to server
        [ServerRpc(Delivery = RpcDelivery.Unreliable)]
        private void PlayerInputServerRpc(ulong sourceNetworkObjectId, InputPayload input)
        {
            #if IS_SERVER
            inputQueue.Enqueue(input);
            #endif
        }
#

I successfully defined IS_CLIENT and IS_SERVER, thats not the problem

#

I'm just wondering if they can still be called from the other end, even if they are missing a body

#

for example, server calls PlayerStateClientRpc, the server is not aware of the implementation (body) of the function, but it knows the signature.
However on the client it is totally aware of the implementation.

#

Looks like it works, my bug was elsewhere

plain arrow
sharp axle
steep veldt
sharp axle
sweet flame
#

I am using Unity Multiplay and just deployed my server and started a test allocation. However after ~ 3 minutes the server crashes with the following log output:

Caught fatal signal - signo:11 code:0 errno:0 addr:(nil)
Obtained 13 stack frames.
#0  0x007fbf5cf23420 in funlockfile
#1  0x007fbf5cdfa23f in clock_nanosleep
#2  0x007fbf5cdffec7 in nanosleep
#3  0x007fbf5dd1c851 in std::_Rb_tree<void const*, void const*, std::_Identity<void const*>, std::less<void const*>, std::allocator<void const*> >::_M_erase(std::_Rb_tree_node<void const*>*)
#4  0x007fbf5dbedb13 in int* std::_V2::__rotate<int*>(int*, int*, int*, std::random_access_iterator_tag)
#5  0x007fbf5dbedbda in int* std::_V2::__rotate<int*>(int*, int*, int*, std::random_access_iterator_tag)
#6  0x007fbf5dc41e17 in int* std::_V2::__rotate<int*>(int*, int*, int*, std::random_access_iterator_tag)
#7  0x007fbf5dc3b1c7 in int* std::_V2::__rotate<int*>(int*, int*, int*, std::random_access_iterator_tag)
#8  0x007fbf5dc3b182 in int* std::_V2::__rotate<int*>(int*, int*, int*, std::random_access_iterator_tag)
#9  0x007fbf5dc3b46c in int* std::_V2::__rotate<int*>(int*, int*, int*, std::random_access_iterator_tag)
#10 0x007fbf5de62fd7 in PlayerMain(int, char**)
#11 0x007fbf5cd41083 in __libc_start_main
#12 0x00564ede580029 in (Unknown)
Executing Unity Signal Handler

In the screenshots you can see the events happening on Multiplay. An idea what is happening? Is it Multiplay related or solely the server build is whacky?

I normally build a macOS dedicated server locally and test it. There are no issues with that. However for Multiplay I have to generate a Linux build. Therefore I can't tell if it behaves differently on my local machine :/

I checked my logfile for any exceptions happening. But it looks clean. I have no idea what the source of the problem is.

sharp axle
oblique sandal
#

Sup

#

I have a few questions regarding Unity Networking

#

How good is it at handling rigidbodies

#

My players use a rigidbody controller and theres a lot of physics in my game so I'm kinda worried about dis

sharp axle
oblique sandal
#
Failed to find entry-points:
System.Exception: Unexpected exception while collecting types in assembly `Unity.Netcode.Editor.CodeGen, Version=0.0.0.0, Culture=neutral, PublicKeyToken=null` ---> Mono.Cecil.AssemblyResolutionException: Failed to resolve assembly: 'Mono.Cecil, Version=0.10.0.0, Culture=neutral, PublicKeyToken=50cebf1cceb9d05e'
  at Mono.Cecil.BaseAssemblyResolver.Resolve (Mono.Cecil.AssemblyNameReference name, Mono.Cecil.ReaderParameters parameters) [0x00105] in <ebb9e4250ed24cbfa42055e3532ef311>:0 
  at zzzUnity.Burst.CodeGen.AssemblyResolver.Resolve (Mono.Cecil.AssemblyNameReference name) [0x00039] in <a2dd15248a25411e914af2a2c82fb63f>:0 
  at Burst.Compiler.IL.AssemblyLoader.Resolve (Mono.Cecil.AssemblyNameReference name) [0x00079] in <a2dd15248a25411e914af2a2c82fb63f>:0 
  at Mono.Cecil.MetadataResolver.Resolve (Mono.Cecil.TypeReference type) [0x00038] in <ebb9e4250ed24cbfa42055e3532ef311>:0 
  at Mono.Cecil.ModuleDefinition.Resolve (Mono.Cecil.TypeReference type) [0x00006] in <ebb9e4250ed24cbfa42055e3532ef311>:0 
  at Mono.Cecil.TypeReference.Resolve () [0x00006] in <ebb9e4250ed24cbfa42055e3532ef311>:0 
  at Burst.Compiler.IL.Server.EntryPointMethodFinder.CollectGenericTypeInstances (Mono.Cecil.TypeReference type, System.Collections.Generic.List`1[T] types, System.Collections.Generic.HashSet`1[T] visited) [0x0002f] in <a2dd15248a25411e914af2a2c82fb63f>:0 


#

Whats this

#

I see this when I import NetCode

sharp axle
oblique sandal
#

and Burst Compiler is Up to Date as well

#

I get

The type or namespace name 'Netcode' does not exist in the namespace 'Unity' (are you missing an assembly reference?)

Even with NGO installed

sharp axle
oblique sandal
#

Yep The issue was with burst compiler

#

This solved it for me

sweet flame
sharp axle
steep veldt
#

Do Client's need to initialize network object pools? I call an initialize when host joins

sharp axle
# steep veldt Do Client's need to initialize network object pools? I call an initialize when h...

If you are using the one from the docs, it will initialize when it spawns in the scene for the clients
https://docs-multiplayer.unity3d.com/netcode/current/advanced-topics/object-pooling

steep veldt
#

So here's this. Client right, host left. I haven't set up explosions on the client yet, that's fine. I'd like to address the missile clearly not making contact on the client before despawning. (the server is triggering the despawn). Im using netcode for gameobjects and don't really want to add any other multiplayer api's. Off to bed for me, will check back in the morning if anyone can point me in the right direction. Obviously getting some rudimentary network stuff but I'm a noob.

ionic wind
sharp axle
ionic wind
#

I removed the 2D package however it seems like Collections is a core package

sharp axle
quaint sierra
#

@covert haven if the game requires voice, it may end up costing you money at the start of development. Then you'll have to hope eventually the players start generating the revenue to hopefully catch up with the expenses.

Like I said though, most players will use discord, especially for a game like phasmaphobia

ionic wind
covert haven
# quaint sierra <@340834001805770762> if the game requires voice, it may end up costing you mone...

Actually believe it or not, many players like to use the voice chat in the Phasmophobia because it kinda destroy the exprience if you dont use it xD, but yes I understand that it would cost money to start the game which is okay. The problem is I'm only worried what if it doesnt generate much and the game is left with only few players, then I would have to close the servers cause I just cannot keep them up forever, but I would feel bad for the players that are there, but I mean

#

If 500 CCU would cost me around $200 per month

#

And the game price is around $15 I guess that

#

For the game to reach 500 CCU there would have to be at least 10x the sales of the CCU value

#

Right xD?

sharp axle
quaint sierra
# covert haven And the game price is around $15 I guess that

You would need at least 13 sales a month to cover the cost of Photon. If you believe you can do at least that, maybe it would be the best option. There would be things to consider too; how many platforms will the game support, how will you manage your store front (SEO), etc.

Just remember though, it's better to add new features when a game gets more popularity than it is to remove features from current players.

covert haven
quaint sierra
# sharp axle Turns out microtransactions are not just developer greed

That is a 100% true statement. It's really not always greed. Depending on the popularity of the game and how much work they actually put into them, it's usually just to fund the game. Most game developers are just passionate about the hobby, like you or me. Most are like everybody else.

covert haven
sharp axle
quaint sierra
covert haven
#

Thank you for the tips!

quaint sierra
dark jasper
#

balls

covert haven
dark jasper
covert haven
covert haven
#

But can't say much right now

quaint sierra
dark jasper
covert haven
covert haven
quaint sierra
covert haven
dark jasper
quaint sierra
# dark jasper support@vulcron.com

I would say the support email, but that is used for support tickets haha. Already enough of those as it is sadok . Account restoration for old players coming back though UnityChanThumbsUp

dark jasper
#

and he doesnt check dms for some reason why is that tho @quaint sierra

quaint sierra
dark jasper
quaint sierra
dark jasper
#

tru tru

spring crane
#

Even web ads cover the Photon bill

wooden mesa
#

Are there downsides to increasing the tickrate to large amounts (apart from unnecessary bandwidth)?

#

Lets say 1000TPS or even 10kTPS

#

Modern networking interface can easily handle this amount of packets if not many more

#

Sure this excludes players from the lower end of the spectrum, but I'm just speaking hypothetically.

slim scarab
#

is anyone a expert with networking , i never done it by myself , but i want to do it on my survival game

wooden mesa
#

Asking if someone is an "expert with networking" is not a productive question.

#

However, I'm sure there are plenty of experts on this discord and the internet in general.

craggy garden
#

Whats the current free solution for Unity Netcode relay? Seems like Unity has their own Relay service but charges through the moon.

sharp axle
spiral lark
#

hey everyone! I am making a 2 player game. One player I would like to be the host and the other player connects to the host. can I make this happen without it costing me money?

nova linden
#

how do you use the networkobject.trysetparent functioon from unity netcode ? it always gives me an error that it is a group method

sharp axle
# nova linden how do you use the networkobject.trysetparent functioon from unity netcode ? it ...
GitHub

A collection of smaller bite-size samples to educate in isolation features of Netcode for GamesObjects and related technologies. - com.unity.multiplayer.samples.bitesize/ServerPlayerMove.cs at d37c...

nocturne vapor
#

hi, how can I spawn a object across the network and have it attached to teh amateur of the character?
unity tells me it can only be spawned as a child of a network object, when I try to make the mount point a network object it tells me nesting is not allowed

#

I need to attach a weapon here, but how

nocturne vapor
#

ok I might have a solution, can someone tell me if this is stupid, I just spawn the axe, with a client network transform and set the position and rotation on the client site

#

not sure how I could do it otherwise, because the unity doc way of just spawn everything seperatly and join them together, is quite unaceptable for a skeleton xD

sharp axle
nocturne vapor
#

Does this allow for a non networkobject to be a parent?

#

I mean there is noway I can make the entire chain to network objects, so I'm kinda lost on how to attach something to my skeleton

sharp axle
nocturne vapor
#

good I will try that, if my next attempt doesn't work, I figured why attach it to the hand, if I can create a gamobject which follows that and uses that as a parent. It's far simpler

sharp axle
nocturne vapor
#

damn that was simple

#

it works, like first try

spiral lark
sharp axle
spiral lark
#

okay perfect

spiral lark
sharp axle
steep veldt
#

Major shot in the dark here but; The bullets in my game are being spawned as game objects from a NetworkObjectPool, they fire fine for about 30 seconds but then they stop spawning in for the client. They're still visible for the host though. No errors.

sharp axle
steep veldt
# sharp axle Are you despawning them as well?

returning them to the pool edit: Came up with a solution. You have to call NetworkObject.despawn() for the object to be considered inactive by the network object pool. Thanks a ton for pointing me in the right direction

nocturne vapor
#

that said putting it on steam makes a lot of sense even if you just want to publish it f2p, since being able to upload it on steam and give keys to people makes it alot easier to find people to play test with

novel kettle
#

I have a NetworkList with a struct that I cannot seem to sync with my client. Adding items to it with a serverrpc that's called from the client does not add a new item, except when the player is the host. When a client connects to the host, it can actually see the populated NetworkList of the host, but can't request to add anything to their own list, because that causes nothing to happen. Any ideas why?

#

The 'AddItemToList' serverrpc calls a clientrpc in which the client debugs the length of the list at the moment for testing purposes. The list is populated when the client connects. If the client is a host it works fine...

karmic quail
#

What Unity + Mirror networking version is the most stable or widely used?

#

Usually I use a LTS version of Unity just cause I don't want to deal with any funny unexpected issues

nocturne vapor
novel kettle
nocturne vapor
#

so the code actually get's executed, but nothing get's added?

novel kettle
#

the clientrpc that is called from the serverrpc even gets invoked

#

but nothing is added. Not even on the server

nocturne vapor
#

Oh I can't help you then, I struggle with netcode my self xD

novel kettle
#

okay no worries. Let's hope someone else can because this issue left me speechless

sand talon
#

how could i sync values under a room? something as simple as an int, that gets synced to every player when joining? i have been sitting on this for days now and can't figure it out!

limber holly
#

hello, do you know if UnityWebRequest is a good way tosave datas for my Multiplayer game ?

nocturne vapor
steep veldt
novel kettle
cunning sphinx
#

does netcode for gameobjects have any way of making someone else the host in the event the host disconnects?

#

i saw a post from march 2022 saying NGO doesnt have host migration but cant find anything more recent to see if that's still true or its been added

sharp axle
#

Issue with Network List

sharp axle
sharp axle
patent slate
#

Anyone knows if animation layers work with Netcode for GameObjects (NGO)?

I have a Animator Controller with 3 layers, 1st for movement only, the other 2 are the same, attack combo layers, but they use different Avatar Masks if the character is moving or not.
Thing is, the layers are not working when I change the mask weight when using NGO.

I tried debugging changing to a near identical Animator Controller, except this one has just 1 layer with everything the other 2 layers have inside, and no Avatar mask is used. It works like a charm, but obviously the animations and the experience is nowhere near the same.

I'm using a client based animation sync approach with:

protected override bool OnIsServerAuthoritative()
{
    return false;
}

And managing the animator parameters locally on each client. The only NetworkAnimator call I make is to .SetTrigger, as the documentation says.
With only that, layers don't work, and I'm not getting any logging either.
As I mentioned earlier, when I change to a single layer approach, everything works as expected.

So, anyone knows if they work with NGO?

sand talon
sharp axle
# sand talon photon

Photon has netvars you can use or you can save things to the Room's custom data

sharp axle
sharp axle
sand talon
#

uff,,, okay, thanks!

patent slate
patent slate
sharp axle
nocturne vapor
#

If we allready are by network variable or clientRpc, what is the advantages of using a NetworkVariable over a rpc, you need to do both from the server side, so are they just interchangable, if all you want to do is sync values?

sharp axle
nocturne vapor
#

That makes sense, thank you

patent slate
#

@sharp axle It worked! Thank you for your suggestion!

cunning sphinx
#

with NGO are there any issues replacing non-host players who leave with an AI player?

sharp axle
mighty whale
#

So I am currently building a multiplayer city builder using NGO, currently to update all players resources, I iterate through each player each second, and tell the clients of each what to change their GUI to be. This seems incredible inefficient at scale, how would you guys do it?

austere yacht
sharp axle
half anvil
#

what happen when a client calls function that is meant to be called by the server but is not protected by the server attribute ?

#

what happens in that case ?

nocturne vapor
# half anvil what happen when a client calls function that is meant to be called by the serv...

It gets executed locally but not om the server side, which could mess up the syncronisation.

For example, lets suppose we have those two easy functions:

TossCoin() {
SendResultsClientRpc("head");
}

[ClientRpc]
SendResultsClientRpc(string res){}

If you cal it from the server in a serverrpc for example everything gets executed as it should, if you called coinToss from a client instead, nothing will happen, because a client cannot trigger a clientrpc, if you instead would run call it on the host, it would work, since the host is the server and a client, so you get funky buggs and that's just a simple example

#

So tl;dr: it depends on what the server function was supposed to do, how bad the screw up would be

#

General rule of thumb, for what I'm doing: if it is supposed to run on the server, just make it a serverrpc and it will run on the server regardless of where you call it from, if you are allowed to call it (ownership properties)

half anvil
rugged obsidian
#

Hi I need a little help I am adding multiplayer to my 2D platformer game using Photon and it all works fin until a second player joins the game/lobby then the camera I (or another person) sees from is not on the Player Object that they control why is that? here's my code and tutorial

#

The second tutorial in my online multiplayer unity game series. In this we will look at how to create and join game lobbies/servers and how to add player movement.

Photon engine - https://www.photonengine.com/
Multiplayer episode 1 - https://youtu.be/nmPukdOsYQA
Player movement tutorial - https://youtu.be/YcJ8q8hEKm8
Animation tutorial - https:...

▶ Play video
#

thats my tutorial

nocturne vapor
nocturne vapor
# rugged obsidian Hi I need a little help I am adding multiplayer to my 2D platformer game using P...

have you deactivated the camera in the prefab?
you could also use this instead:

private void Awake()
    {
        if (photonView.isMine == true)
        {
            PlayerCamrea.SetActive(true);
            PlayerNameText.text = PhotonNetwork.playerName;
        }
        else
        {
            PlayerCamrea.SetActive(false);
            PlayerNameText.text = photonView.owner.name;
            PlayerNameText.color = Color.red;
        }
    }

this will make sure, that the camera is deactivated, if it is not the local player, I just added one line to your code

rugged obsidian
nocturne vapor
#

if that doesn't work, I have no idea, I assume it could be, that you just forgot to deactivate the camera, happes to me all the time, when I change something

rugged obsidian
nocturne vapor
#

3 months? damn you are patient, I would have probably just scraped everything and redone everything from scratch with another tutorial xD
and no problem, have fun further developing

rugged obsidian
calm frost
#

Hello, I'm at a loss. I'm trying to follow a tutorial on how to set up multiplayer through Unity's netcode, but the tutorial is having an easier time by having the networkmanager create the player prefabs which I have to handle myself. I can get it working on the host's side through:

PlayerNetworkController clone = Instantiate(playerNetwork).GetComponent<PlayerNetworkController>();
 PlayerNetworkController.instance = clone;
clone.GetComponent<NetworkObject>().Spawn();

But I'm getting errors when doing it on the client side because Spawn() seems to be something you can only do on the host's/server's side. Now I'm finding contradicting information, some people say you should be using ServerRpc so I made a method with the same code using [ServerRpc] and I'm not getting the error that only the server can do it anymore but the prefab is still not being created. And then there is also https://docs-multiplayer.unity3d.com/netcode/current/basics/networkobject/index.html which talks about using methods like GetComponent<NetworkObject>().SpawnAsPlayerObject(clientId);
What am I missing here?

#

I tried doing it with the latter but it's also not working (and I don't understand what that method is for in the first place)

oblique sandal
#

Hey

#

Ive seen so many resources for NGO

#

Not even close to any other solution

#

But ive also hear thay its only for small party games

#

And wont work for a fast paced shooter

#

How true is this

calm frost
#

I've made some progress. The 2nd player can join in now and will see the 1st player (server host) moving, but for some reason the prefab of the client doesn't get spawned.

if (PlayerNetworkController.instance == null)
{
    Debug.Log("Player does not exists.");
    if (IsServer)
    {
        Debug.Log("Is server. Creating server player");
        SpawnPlayerServerRpc(0);
    } else {
        Debug.Log("Is not server. Creating client player");
        SpawnPlayerServerRpc(1);
    }
} else {
    Debug.Log("Player already exists.");
}

Any reason why? It reaches the part where it says "Is not server." but it just won't spawn the client player object

#
[ServerRpc(RequireOwnership = false)]
public void SpawnPlayerServerRpc(ulong clientId)
{
    Debug.Log("Spawning player with id: " + clientId);
    GameObject newPlayer;
    newPlayer = (GameObject)Instantiate(playerNetwork);

    NetworkObject netObj = newPlayer.GetComponent<NetworkObject>();
    newPlayer.SetActive(true);
    netObj.SpawnAsPlayerObject(clientId, true);
}
austere yacht
# oblique sandal But ive also hear thay its only for small party games

This just means if you want to use it for more you need to be prepared to extend it with the required functionality. It’s design is not inherently limiting it to small games. For competitive games you usually have to do so much extra work on top of what ngo (or any library) provides that it makes little sense to market it as a solution for that, but you can still use it as a framework to get there.

sharp axle
sharp axle
radiant dome
#

Hello guys,i am creating a game about Air Hockey and i am using photon PUN2 to do it,to syncronize the position of the disk between the 2 players i did something like this: The owernship of the disk at the start is of the master client than everytime that the players hit the disk with their controller the owernship is passed. I implemented this but i tryed a game with a friend and the position of the disk is not "syncronized" between the 2 players. My question is,do you think that exist a better solution?

sharp axle
calm frost
#

unless the networking has specific issues with singleton player prefabs

sharp axle
calm frost
#

the player controller just contains methods to move around the player, but I was playing around and created an empty game object without any script but the network ones attached to it and it still doesn't spawn it

#

there must be some other issue

#

I got an idea from reading the forums, someone was talking about callbacks and making sure you aren't trying to spawn an object when the connection hasn't been fully established yet

#

so maybe that's it

#

I don't know, maybe it's just something you're supposed to know on your own, maybe it is mentioned somewhere... but I think it's also weird not having this somewhere in the Unity docs mentioned when not using the NetworkManager's built in prefab spawning from the inspector

#

it seems like that thing is doing a lot in the background which you have to do and make sure on your own when doing it in code instead

#

the only thing I found out is the stuff about assigning clientIds etc. but I'm still not sure what else it does exactly

sand talon
#

How do i get custom room properties?

brisk bluff
#
using System;
using System.Collections;
using System.Collections.Generic;
using Unity.Netcode;
using UnityEngine;

public class Player : NetworkBehaviour
{
    [NonSerialized] public float speed = 10;
    
    private Rigidbody rb;
    
    public override void OnNetworkSpawn()
    {
        if (!IsOwner)
        {
            Destroy(this);
        }
        else
        {
            NetworkSetPositionServerRpc();
        }
    }

    [ServerRpc]
    public void NetworkSetPositionServerRpc()
    {
        transform.position = new Vector3(-10, 7, -28);
    }
    
    void Start()
    {
        rb = GetComponent<Rigidbody>();
    }

    // Update is called once per frame
    void Update()
    {
        float x = Input.GetAxis("Horizontal");
        float z = Input.GetAxis("Vertical");
        rb.velocity = new Vector3(x, 0, z) * speed;
    }
}

The host moves both players and the other client cannot do anything

calm frost
sharp axle
brisk bluff
sharp axle
brisk bluff
#

ahh ic

sand talon
cunning sphinx
#

i watched code monkey's 6 hour tutorial on NGO recently and recall in some spots he'll use something else in place of Awake for network objects, but cant recall where in the video he was doing that or why. any chance someone knows? guess i need to rewatch 😄

cunning sphinx
#

i think OnNetworkSpawn is what i was thinking of

spiral lark
#

has anyone used epic online services here? was it good? i'm gonna make a multiplayer 2player coop game using peer to peer networking to hopefully cost me nothing

sharp axle
mighty whale
obtuse kelp
brisk bluff
#
using System.Collections;
using System.Collections.Generic;
using Unity.Netcode;
using UnityEngine;

public class Player : NetworkBehaviour
{
    [NonSerialized] public float speed = 10;
    [NonSerialized] private NetworkVariable<Vector3> velocity = new(writePerm: NetworkVariableWritePermission.Owner);
    
    private Rigidbody rb;
    
    public override void OnNetworkSpawn()
    {
        if (IsOwner)
        {
            NetworkSetPositionServerRpc();
        }
    }

    [ServerRpc]
    public void NetworkSetPositionServerRpc()
    {
        transform.position = new Vector3(-10, 7, -28);
        velocity.Value = Vector3.zero;
    }
    
    void Start()
    {
        rb = GetComponent<Rigidbody>();
    }

    // Update is called once per frame
    void Update()
    {
        if (IsOwner)
        {
            float x = Input.GetAxis("Horizontal");
            float z = Input.GetAxis("Vertical");
            Vector3 value = new Vector3(x, 0, z) * speed;
            velocity.Value = value;
            rb.velocity = value;
        }
        else
        {
            rb.velocity = velocity.Value;
        }
        
    }
}

Why is the clients movement pretty laggy?

#

as playing as the client the movement has a noticeable delay

fallen plaza
#

Hi guys, anyone knows about Mirror? Will It be affected by UNet deprecating?

olive vessel
#

Obviously not as UNet was deprecated like 4 years ago

weak plinth
#

hey i have network transform script on player prefab and i turned on position and rotation but it's only transforming rotation

#

it transforms the rotation from host to client

charred bough
#

Hi I have a question, when client connects to relay, background UI gets smaller, so player icons look small, what is causing this?

sharp axle
sand talon
#

the method AddPlayerN() isn't being executed on players if they aren't someone with actor ID 1... if i play this in the editor it makes me wait 3 seconds as intended, but for every player i build and then make connect, it just doesn`t go anyfurther then the LogError() any idea why?

spiral lark
#

and its a turn based game so latency due to peer to peer isnt an issue

mighty whale
sharp axle
#

Netcode is free. The unity relay service has a free tier of under an avg 50 ccu/mo.

brisk bluff
steep sparrow
#

When storing data (player stats; only has to be updated when game round is over) on a databank server like mysql for example and Im having players from each region, like europe , asia, na etc.. Do I need servers in these each region and sync them together or can I just host servers in 1 region because In my usecase, a short latency isnt required? Please tag me in your answer that I'll get notified. Thanks!

sharp axle
brisk bluff
#

I mean you are saying that but why the velocity only being managed by the server

sharp axle
brisk bluff
#

client is only moving because I am setting the velocity NetworkVariable

steep sparrow
brisk bluff
#

the problem is (afaik) that the velocity is being fully managed by the server, if I don't use a network variable here then the client will refuse to move at all, can I not use velocity in this scenario? I am using a Networked Transform if that changes anything

steep sparrow
brisk bluff
#

hmm maybe I need a network Rigidbody? I'll try it idk why i didn't try it previousl

#

also what would be the theory behind network prediction? Would I just make it so that if the servers variable of the position is very different from the players then it changes it back to the server position??

steep sparrow
# brisk bluff the problem is (afaik) that the velocity is being fully managed by the server, i...

I remember watching this video, it might help you get a better view on network delays and how to avoid high delays
https://www.youtube.com/watch?v=eQt7TwCr6ao

I finally decided to tackle some of the more complex issues I was having with multiplayer, and this is how it went...

Next devlog: https://youtu.be/cYLnVp1ngwA
Pirate game playlist: https://www.youtube.com/playlist?list=PLXkn83W0QkfmQI9lUzi--TxJaOFYIN7Q4

⎯⎯⎯⎯⎯⎯

More about client prediction & reconciliation: https://www.gabrielgambetta.com/cli...

▶ Play video
brisk bluff
#

alright I'll watch it

steep sparrow
#

its very entertaining and educational

sharp axle
sharp axle
brisk bluff
#

how can I use the built in Network scripts to achieve this though? Unity has a Network Rigidbody component but it doesn't have any type of Serializable properties or even public properties I can change

steep sparrow
sharp axle
brisk bluff
#

so can I even use velocity for something like this?

#

because it's just gonna be delayed on the client right?

#

and the client only cares about the velocity on the server (from what I can tell)

sharp axle
steep sparrow
sharp axle
brisk bluff
#

alright, thanks for your help

wispy locust
#

In Unity Mirror, is there a convenient Method I can call from the Server whenever a new Client connects? It looks like there was a legacy OnServerConnect(...) which was retired some time ago.

Alternatively, I'm open to suggestions on how to initialize a Dictionary from Server --> Client immediately when new clients connect. If I can't find a Method like the retired OnServerConnect(...) then my backup plan is to use OnStartClient() to send a [Command] to the server to echo back a [TargetRpc] with the Dictionary ... but that all sounds very clunky.

potent parrot
#

Am I supposed to use the beta version 2023.1.0b10 or the alpha 2023.2.0a8 of unity to use com.unity.multiplayer.playmode? or will the LTS versions work aswell?

austere yacht
scarlet panther
#

Hello

It is my first time using NetworkList (https://docs-multiplayer.unity3d.com/netcode/current/basics/networkvariable/index.html), it states in the documentation that if both permissions "write" and "read" are set to "owner" that server can still read and write to NetworkVariable, I am not sure if the same applies to NetworkList (but I would hope so).

Anyway, in my scenario something is wrong, as when i run the game as "server" and try to remove something from network list, it returns m error: "InvalidOperationException: Client is not allowed to write to this NetworkList". I placed debug before the removal and I can see that the permissions are for owner and it runs on server, so I am not sure what is wrong.

The code for the whole class is here: https://hastebin.com/share/apocugohag.csharp

Can anyone help me?

From my point of view it seems that the statement about ownership for NetworkVariable is not true for Networklist

sharp axle
scarlet panther
#

I thought so

inland trellis
#

I need help solving errors

graceful zephyr
#

extremely over complicated

inland trellis
sharp axle
potent parrot
# sharp axle Any version 2023 should work

2023 is beta right? im using 2021.3 just so its a stable release without any errors that I will not find the source of, since the error might be caused by the beta version

graceful zephyr
#

But this really ain’t a good example of how to do CSP

graceful zephyr
#

i watched the entire tutorial now, yeah this is.... uh.. dont do this

ancient mist
#

I'm very new to networking, and I was wondering how using Photon one would calculate server-side changes. Such as, if I have an AI with random movement, I can't just calculate the random movement on each client, otherwise it will not be synced.

graceful zephyr
ancient mist
#

I'm using Photon PUN plugin for Unity

graceful zephyr
#

PUN doesnt have a server

ancient mist
#

Does that mean I am unable to do what I wanted, or do I have to find a third tool, or should I stick with a static world?

graceful zephyr
#

you can have the master client act as a server

ancient mist
#

Ohh

#

Would I check for view == 0 to see if the client is the master client then?

normal peak
#

I am using netcode for gameobjects for a fps game the player doesn't controll the same camera from which he is moving

ancient mist
#

I haven't finished a multiplayer game before, so I'm trying to start with fairly small goals.

graceful zephyr
#

@ancient mist check our support discord

ancient mist
#

Are you permitted to link me to it?

normal peak
#

yes

mighty whale
#

What are you asking then?

normal peak
#

i don't know how to fix it

mighty whale
#

Fix what?

graceful zephyr
normal peak
#

the player should control the same camera as the character he is moving

graceful zephyr
#

just google photon engine discord or something

mighty whale
graceful zephyr
#

it'll come up

ancient mist
normal peak
#

i am moving another character and seeing from another characters prespective

graceful zephyr
#

@normal peak just assign the camera to the local players object

#

can be done in a script on the camera, just find the local players object

#

done

normal peak
#

how do i do that exactly

mighty whale
graceful zephyr
#

FindAllObjectsOfType<MyPlayerScript>

#

and loop trhough them

#

or that yes

mighty whale
#

How would you go through creating server authoritative resource management for a city builder, just out of curiosity? I currently use two separate gameobjects one is a server object that does simulation and another for visuals

graceful zephyr
#

¯_(ツ)_/¯

#

there's no answer to that question really

#

it's like asking how would you build a car

normal peak
#

here is the original camera code can you show me where to implement using System.Collections;
using System.Collections.Generic;
using UnityEngine;
using Unity.Netcode;

public class CameraMovement : NetworkBehaviour
{
public float mouseSensitivity = 100f;
public Transform playerBody;
float xRotation = 0f;

// Start is called before the first frame update
void Start()
{
    Cursor.lockState = CursorLockMode.Locked;
}

// Update is called once per frame
void Update()
{
    if (!IsOwner) {
        return;
    }
    float MouseX = Input.GetAxis("Mouse X") * mouseSensitivity * Time.deltaTime;
    float MouseY = Input.GetAxis("Mouse Y") * mouseSensitivity * Time.deltaTime;

    xRotation -= MouseY;
    xRotation = Mathf.Clamp(xRotation, -90f, 90f);

    transform.localRotation = Quaternion.Euler(xRotation, 0f, 0f);
    playerBody.Rotate(Vector3.up * MouseX);
}

}

sharp axle
graceful zephyr
sharp axle
graceful zephyr
#

ah

fading nymph
#

Hello friends I have a multiplayer game with a dedicated server build and I'd like the server to be able to handle certain inputs. Specifically, I have a desktop thats running a simulation, and the phones are using that simulation data to display stuff on screen. I want the desktop to be able to pause the simulation with an input (doesn't matter what the input is, can be a button on screen, can be a keyboard press) but can't figure out how to do that with a dedicated server build. Is this possible?

sharp axle
weak plinth
cunning sphinx
#

with network for game objects, what's the best way to sync up UI elements? im making a game lobby and have the logic in place for players readying up using a ServerRpc. i tried creating a function that sets the buttons visuals based on ready status, and then calling that in a ClientRpc which is called at the end of the ServerRpc but it doesnt appear to be doing anything. sometimes i get it to work on the host but not the clients

cunning sphinx
#

the dictionary i was checking to configure the objects only had values on the server, not the clients. all good now 😄

plucky ravine
#

I wanted to add multiplayer to my project, but I'm not sure what service I should use. Looking at netcode, photon, and mirror currently. Any suggestions? (Feel free to ping)
-4 Players
-P2P Only
-Unity 2021

brisk bluff
#

does anyone know what Dani used for Crab Game? Photon?https://store.steampowered.com/app/1782210/Crab_Game/

Crab Game is a First-Person Multiplayer game where you fight for the ultimate cash price in different minigames based on children's games, until only one player is left to claim it all. Definitely not based on any online streaming pop culture korean tv shows, as that would get me in legal trouble, so we're certainly not doing that.Features Up to...

▶ Play video
normal peak
#

here is the original camera code can you show me where to implement using System.Collections;
using System.Collections.Generic;
using UnityEngine;
using Unity.Netcode;

public class CameraMovement : NetworkBehaviour
{
public float mouseSensitivity = 100f;
public Transform playerBody;
float xRotation = 0f;

// Start is called before the first frame update
void Start()
{
    Cursor.lockState = CursorLockMode.Locked;
}

// Update is called once per frame
void Update()
{
    if (!IsOwner) {
        return;
    }
    float MouseX = Input.GetAxis("Mouse X") * mouseSensitivity * Time.deltaTime;
    float MouseY = Input.GetAxis("Mouse Y") * mouseSensitivity * Time.deltaTime;

    xRotation -= MouseY;
    xRotation = Mathf.Clamp(xRotation, -90f, 90f);

    transform.localRotation = Quaternion.Euler(xRotation, 0f, 0f);
    playerBody.Rotate(Vector3.up * MouseX);
}

}

pallid mulch
charred bough
#

How I can sync coroutines to client?

sharp axle
charred bough
#

Thanks

brisk bluff
sharp axle
brisk bluff
sharp axle
#

As far as I know, you can use any network framework with them. Unity Netcode and Mirror both have custom Transports. I'm not sure about Photon

brisk bluff
sharp axle
#

It's fine. It's been around forever. It's listed in the pinned message here

pallid mulch
brisk bluff
#

impossible to write prediction? sounds pretty bad then idk

pallid mulch
static ginkgo
#

I am making a 2 player card game but I cant comprehend how to make it online. Its going to be on mobile which I have figured out. but cant figure out how to assign host to player 1 and client to player 2. the board is shared and both people can manipulate it. both players draw from the same deck.

nocturne vapor
#

Reason for what I'm recommending: costs
You need some kind of possibility for your players to play, expecting them to open ports is not an option. Relay, unity's own system for handeling p2p stuff, will be costly I think, don't know the exact prices, but I'd be amazed if it would be cheaper than just renting a linux server and doing it on your own

static ginkgo
#

I dont know the depth of either option but this is soley so me and wifey can play sequence and phase 10 without actual cards lol. I thought this would be easier to implement than keeping the childern from losing the cards in between the times we wanted to play. no, google play store does not have either game in play store with real online. just fake ai pretending to be real people

#

Im fine with setting up my pc as the server but idk long term having to turn it on and run the server before getting on my phone to play the game? that doesnt actually sound too annoying I guess

nocturne vapor
#

Oh I see, that makes stuff a bit simpler
Depending if you need to play from work or just playing at home a casual game it could be as easy as just having a raspberrypi sitting around somewhere in your house just managing your game state, since you don't really need a complex lobby system

#

Here is what I'd recommend, for private purposes, since it only needs to work and not be the besr:
-program an api to handle the game state, player hand and so on
-Grab an old phone or a rpi and put your own programmed api on it
-in unity just handle everything with http requests to sync it

static ginkgo
#

I have a pi thats not being used. but Im fine running an ubuntu mirror vm or just setting it up on my windows pc.

#

I dont want to ask you for help but can you just give me some things to google to make this happen?

nocturne vapor
#

It's a super simple system
You could do p2p as well, but I don't know how that works on phones, you would need to have some kind of input field for the ip and port and you need to implement some sort of game saving, it has its pros and cons. I'd go for a client server architecture, but that's because I'm used to it
If you want p2p read the docs of your transport and networking system for this
If you want to go the client server way:
-Just google how to make an api with python or whatever language you are comfortable with, python is just super portable
-learn how to integrate a db into this (sqlite works great for such small systems)
-checkout how to do http requests in unity to sync your game

#

I've always used flask for my small projects, it is super simple to setup

nocturne vapor
static ginkgo
#

..... I actually know how to work with api with python on presetup api from other websites already and deal with sql on a daily. so really I need to just look into how to setup server client. I use django as my home automation server

graceful zephyr
static ginkgo
#

I guess im just missing a piece of the puzzle to make any of this makes sence lol.

graceful zephyr
#

or like friendly competitive

static ginkgo
#

@graceful zephyr competitve

graceful zephyr
#

if it's a serious competitive card game you need a dedicated server and standalone simulation and all kinds of shit

#

to make it feasible to deploy

#

a competitive card game, as in a proper achitectue for it, is quite hard to make

static ginkgo
#

@graceful zephyr basicly connect 4/ bingo but with 2 decks of playing cards

graceful zephyr
#

for a non-comeptitive game... just make it deterministic

#

okey so when i say competitive card game

#

i mean like hearthstone lol

nocturne vapor
static ginkgo
#

oh haha no no. more like comlex uno

graceful zephyr
#

just make it deterministic then

#

super easy to network and implement for a simple card game

nocturne vapor
graceful zephyr
#

and can run on basically any type of networking

#

p2p, client-server, relay, etc.

#

w/e u want

nocturne vapor
#

That's why I just recommended the client server architecture, because it is the easiest to get into, in my experience and you could do it fairly complex if you are willing to put in the time for writing a good backend, it isolates the network part from the game part

static ginkgo
#

Im looking into server way, seems simpler and If I was to expand this would be the way for that too

#

but im not creating a new game, just stealing whats already existing just dumbly

nocturne vapor
#

Good luck and have fun playing with your wife

plucky ravine
#

Any recommendations on places to learn netcode? YouTube?

static ginkgo
#

Im in the same boat. I have went down a giant rabbit hole and it really seems like there is no standard practice. every video they set up everything completely different. @plucky ravine

sharp axle
brisk bluff
#

so if I go photon route I have to pay in the end right?

#

like I won't be able to let players atleast host local games and invite people to those?

#

Not sure what to do at this point

nocturne vapor
#

I have commenred this under the code monkey video as well, he wants to do tutorials for this too

nocturne vapor
# plucky ravine Any recommendations on places to learn netcode? YouTube?

The docs and to an extend chatgpt. The last one won't give you good code (because there are too many netcode versions and it gets confused) but you can talk about what you are trying to achieve, what problems you encounter and it gives you some informations or ideas you didn't have. So the chatgpt route is more when you allready set it up and are a couple hundred lines into development

dull girder
#

Hey, I'm testing out Netcode for gameobjects with a host/client setup.

Once the client connects, I'm having the host instantiate a bunch of units (and "Spawn" them on network). It's working fine but on the client end, all the animations and skills etc. are not showing up, the only thing that's syncing is the Transform pos and rot

I already added all prefabs to netwrok prefab list, and network animtaors to all prefabs with animators

Any pointers as to why this might b happening? Thx!

#

nvm ^ figured this out should've read the docs

#

need to reference NetworkAnimator for setting triggers

sharp axle
# brisk bluff Not sure what to do at this point

You can use any other network framework. There are links in the pinned message for few of them. Servers and bandwidth are not free so someone has to pay for things at some point. Steam and Epic both have relay services that they subsidize.

brisk bluff
sharp axle
brisk bluff
#

Hmm ic

graceful zephyr
#

usually all 3 are used/possible

terse idol
#

Hi, if let's say in a couple of years photon goes out of service. Is there a way to recover my games and be able to play them if they're only online?

#

other than backing up the source code of course.

graceful zephyr
#

You usually need all 3, or at least the first two, for any live game @brisk bluff

#

Lately it's been more and more popular to only use Relay connections to protect privacy of each player

brisk bluff
#

What service would I be using in that scenario though? Does it matter? Am I creating my own?

graceful zephyr
#

the issue with NAT punching is that you actually connect the players together, which can be a security risk (both in terms of hacking but also in terms of people getting doxed/found irl)

#

@brisk bluff We provide cross-engine/platform compatible relay (Photon)

sharp axle
#

Unity, Steam, and Epic all have relay services available as well.

late prairie
#

How does netcode for gameobjects handle receiving RPCs out of order? Does it use timestamps? Does anything go on behind the Scenes to fix the timeline?

sharp axle
cunning sphinx
#

i was following along with a tutorial that had the players spawn via this line of code in a ConnectionApprovalCallback

connectionApprovalResponse.CreatePlayerObject = true;

id like them to spawn a little later though when the game actually starts and not in the lobby. what's an easy way to go about doing that?

sharp axle
wispy locust
#
public class ConstructableElement : NetworkBehaviour
{
    //...
}

public class WorldTiles : NetworkBehaviour
{
    private readonly SyncDictionary<(int, int), ConstructableElement> roomMatrix = new SyncDictionary<(int, int), ConstructableElement>();
    //...
}

public static class CustomReadWriteFunctions
{
    public static void WriteTuple2Int(this NetworkWriter writer, (int, int) value)
    {
        writer.WriteInt(value.Item1);
        writer.WriteInt(value.Item2);
    }

    public static (int, int) ReadTuple2Int(this NetworkReader reader)
    {
        return (reader.ReadInt(), reader.ReadInt());
    }
}

I'm working with the Mirror Library: Whenever I introduce a NEW client, that client receives all of the roomMatrix SyncDictionary ... however, all Values (type ConstructableElement ) are null. The Keys of type (int, int) synchronized correctly.

Any idea what's going on? Do I need a custom read/write for the ConstructableElement, even though it inherits NetworkBehaviour?

sharp axle
full holly
#

public class spawnRes : MonoBehaviourPunCallbacks
{
  if (PhotonNetwork.LocalPlayer.ActorNumber == 1)
        {
            GameObject sco = PhotonNetwork.Instantiate(Score.name,new Vector3(0f,0f,0f),Quaternion.identity);
            GameObject go = PhotonNetwork.Instantiate(Dice.name,new Vector3(0f,650f,0f),Quaternion.identity);
            sco.transform.SetParent(Canvas.transform, false);
            go.transform.SetParent(Canvas.transform, false);
        }
        else
        {
            GameObject sco = PhotonNetwork.Instantiate(Score.name,new Vector3(100f,0f,0f),Quaternion.identity);
            GameObject go = PhotonNetwork.Instantiate(Dice.name,new Vector3(0f,650f,0f),Quaternion.identity);
            sco.transform.SetParent(Canvas.transform, false);
            go.transform.SetParent(Canvas.transform, false);
        }
        
            
    }```
#

when two players are joining. they can only see their own instantiated objects
and cant see each others
what is the problem?
i have added a photon view component along with a photon transform view component to the prefabs of the instantiated objects

weak plinth
#

is there a way to connect two projects together like two clients? i am in this scenario because i am trying to run a server on my android version and join on my pc version (both are different projects)

I am using mirror.

wispy locust
weak plinth
#

about that

#

i will try doing it the other way around

normal peak
#

how can i change the camera code to only control the local players camera

#

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

public class CameraController : NetworkBehaviour
{
public float mouseSensitivity = 100f;
public Transform playerBody;
float xRotation = 0f;

// Start is called before the first frame update
void Start()
{
    Cursor.lockState = CursorLockMode.Locked;
}

// Update is called once per frame
void Update()
{
    float MouseX = Input.GetAxis("Mouse X") * mouseSensitivity * Time.deltaTime;
    float MouseY = Input.GetAxis("Mouse Y") * mouseSensitivity * Time.deltaTime;

    xRotation -= MouseY;
    xRotation = Mathf.Clamp(xRotation, -90f, 90f);

    transform.localRotation = Quaternion.Euler(xRotation, 0f, 0f);
    playerBody.Rotate(Vector3.up * MouseX);
}

}

spark sleet
spark sleet
#

Really struggling with this one. (Using mirror) I've got an outdoors scene and a workshop scene. Every player can access the workshop scene on their own computer with a freeflight camera. It is completely not networked, so every workshop scene is stored only on a player's computer, and the player can switch between the networked outdoors scene, and the local workshop scene at will. The clients are no problem, I'm using scene based interest management, so I unload the outdoors scene and load in the workshop scene, and the network manager handles the rest. The host is the problem. I can't unload the outdoors scene, because then clients in the outdoors scene will just be left in an empty void while the host is in the workshop scene. I can't just additively load the new scene either, because then the players and objects from the outdoors appears in the workshop scene. What should I start looking for to handle this?

normal peak
#

The name 'isLocalPlayer' does not exist in the current context

empty night
#

Does anyone happen to know of some good refrence material for using the newer input system with ngo?

spark sleet
graceful zephyr
#

And then disable the server side render on the scene the server isn’t in

spark sleet
#

Alright, thank you. Was looking into physics scenes, but aam still doing research

pearl oasis
#

I am trying to get a first-person game started, but I run into an issue when running into netcode for gameobjects.
Whenever I start in the editor as a host, the game runs fine, but when I open the game in a new editor and connect as a client, the game that was connected as host switches to a new camera, and I can look around with that camera, while the other "player" moves

#

I should be looking with the one on top of the ground, but the camera switches to the player prefab that is in the ground

#

I suspect that this is a problem with the fact that both prefabs have a camera child, but how can I make it so that I only see out of the original player prefab?

#

This is what the game looks like when only the host is active

#

I can walk around through the player in circled in red, but I only look around through the player in blue, I circled the prefabs in the hierarchy according to their colors too. The client at the bottom-right is functioning as intended.

#

Why is this happening?

bronze eagle
#

I can't hear people in my game while using photon vr can someone help me?

sharp axle
oak flower
#

@bronze eagle Please remove all the messages you've cross-posted in all other channels

bronze eagle
#

ok

rocky bramble
#

Is it better to have many small parallel connections to one client transmitting relatively small structures or rather one connection which transmits one huge structure? I know that in case of large number of cennctions i can starve all sockets in pool

sharp axle
austere yacht
rocky bramble
#

And what about serialization/deserialization of packets? Im not sure if its worth to put in another thread, but in this case i would need put it in some thread safe data structure like thread safe dict or queue based on mutex

austere yacht
rocky bramble
#

i mean, i want to make it asynchronous to avoid i/o waits. I guess it would be better to use some stackless coroutines than plain threads

austere yacht
#

as i said, put it onto another thread if that is a concern

#

but dont parallelise it

rocky bramble
#

oh got it

#

but wait a sec i have no innfluence on cpu affinity

#

how to be sure that cpu wont parallelise it by itself?

austere yacht
#

depending on the project/use-case its a good idea to keep servers single threaded and rather have many of them (horizontal scaling) vs parallelizing one server and having it scale vertically

austere yacht
rocky bramble
#

yeah, but you said to put it to another thread to avoid i/o waits

#

both from network and disk(or memory pages)

austere yacht
#

yes, so if you want to have some more control, make it all single threaded

#

and have the OS deal with the allocation of cores to processes

rocky bramble
#

whether it won't affect responsiveness for multiple clients at the same time? Coz of rare context switches

austere yacht
#

there is no context switching if you have single threaded servers run on their dedicated cores

#

the only contention is over the IO resources

#

which is something you have to test and see

rocky bramble
#

okey got it , so it would be these best to run it in single thread but in coroutines

austere yacht
#

you can use threads, just not ones implemented to run in parallel

rocky bramble
#

okey so it should run on one single core of cpu. Thanks for help

austere yacht
#

if you want to scale horizontally, yes

rocky bramble
#

hmm yeah, i think it would be the best option but, im kinda scared about pid starvation

#

also if i want to conteneraize it there is additional overhead from container runtime

austere yacht
#

you can hibernate instances and reuse them

rocky bramble
#

but i would need supervisor in this case

austere yacht
#

the cost of a hypervisor / containers is well worth it over the hassle of setting that stuff up on bare metal

pearl oasis
austere yacht
rocky bramble
#

@austere yacht you mean to scale it vertically by adding more resources (ram, disks)? Horizontally scalling requires also some loadbalancer that also adds additional overhead

#

If you are puttin everything on one machine then everything communicates in same process memory space sometimes by ipc

austere yacht
rocky bramble
#

oh got it ,after receiving "connection id" it will always route to specific server

austere yacht
#

its a dynamic bi-directional data stream

rocky bramble
#

btw can i ask can you recommend me some good resoucres to learn about game server architectures?(server-clinet ,p2p, event based, poll based etc)

#

when I search on google I only get crap articles from the medium

austere yacht
#

realtime game networking is very obscure, there are no "how to" guides

#

its all based on you understanding the fundamental principles and being smart/creative yourself

#

and hardly anyone is "smart" or "knowledgeable" enough to handle it all on their own

rocky bramble
#

But I guess there must be some foundation like the basics of server architecture or examples of binary protocols

austere yacht
rocky bramble
#

Packet serialization/deserialziation, handling connection, retrying policy, etc

austere yacht
#

you can glean a lot from looking at how NGO/Mirror or even an Unreal Actor are implemented

austere yacht
#

or another great resource is everything about ZeroMQ