#archived-networking

1 messages · Page 118 of 1

pliant sundial
#

You can also do it your way, there are always many ways to achieve something.

#

It should be that you spawn a camera once only, then the camera follows the local player

#

If you spawn a camera separately you can put a script on it that finds the local player and sets the target

frigid briar
#

only one camera but what about the new player prefabs that spawn in

frigid briar
pliant sundial
pliant sundial
frigid briar
#

alr

mortal patio
#

Hi, all! I'm trying to use MLAPI to create a separate project in which I can send a message to a client (one of multiple) to execute a specific function. Most of the MLAPI examples I've found go into how to create a connection between two instances of the same project, does anyone know a good example of creating a separate host project?

Also open to alternatives, as long as they work for Unity 2019 and cross platform (Android VR headsets, with the messages being sent from a Windows laptop)

uneven mural
#

Hey guys, new to multiplayer.
I was wondering if anyone had a good tutorial to start with. I'm making a 4vs1 player game and I was wondering what the best workflow would be. First make the 5 players with each there scripts, models, animations,... and then script multiplayer
or first script multiplayer and then make the 5 players?
I was thinking of using steamwork.net since I want to put the game on steam.

feral oak
uneven mural
#

Or one of which you think gives a good workflow/is a good way of making multiplayer happen within steam

feral oak
uneven mural
feral oak
uneven mural
feral oak
uneven mural
#

Oké, thanks man

feral oak
viral minnow
#

Hello. I'm making my own game server and the way movement works is: client sends which direction its moving towards and then server calculates where the player moved. How could I handle server-side wall collisions with this method?

frigid briar
pliant sundial
frigid briar
#

u mean like if(view.ismine) under camera script too or just in input

pliant sundial
# uneven mural yeah i've seen the Mirror one, which would you recommend?

Mirror supports steamwork p2p multiplayer btw. Steamworks is only sending messages from A to B, nothing else, so to use it for multiplayer you need a higher layer like mirror on top of it.
NGO also supports steamworks multiplayer.
Mirror and NGO are both good options if you release on steam. Photon works great, but you pay for the relay vs paying nothing if you use steamworks.

pliant sundial
pliant sundial
uneven mural
#

So... I was following a tutorial for Mirror with fizzysteamworks and accidentally installed both v4.4.1 and v5.0.1 from fizzysteamworks in my unity project. I also installed the regular steamworks.net in it...
Did I screw up already?

#

Because I'm already getting an error and not the same steps as the one in the tutorial

pliant sundial
#

Installing steamwork.net separately is required in newer versions of fizzy steamworks

pliant sundial
#

If you update an asset always delete the old version first as unity is really bad with updating

#

For example if the new version deleted a file then when you update the file will not be deleted from the old version

uneven mural
#

I was following this one

#

In this video I will be showing you how to get your unity project set up. How to host lobbies and how other people can join them. In the next episodes I will be going over how to display users, sync movement, create character cosmetics and much more. So make sure your subscribed to not miss out. :)

------Tutorial Links------
Mirror: https://ass...

▶ Play video
pliant sundial
#

The error might indicate either a forgotten using statement or a problem with asmdef files

uneven mural
#

I don't have that one in my network manager

#

a few other things that are different also

#

Oh

#

transport needs to be Mirror tho

pliant sundial
frigid briar
# pliant sundial Everywhere where you have input

it doesnt work tho i put it under inputs. also which photon components does my camera need under the char prefab? like photon view. etc or does my camera folllow script need any photon codes or smt?

pliant sundial
uneven mural
#

Oh so instead of the Mirror networkmanager KCP transport she uses fizzy steamworks script as transport. I tried to add that component but my unity can't find it for some reason

pliant sundial
uneven mural
#

the class cannot be found

pliant sundial
#

"make sure there are no compile errors"

#

Unity will only compile the class after you cleared all errors, it never compiled it before so it cant find it

uneven mural
#

and then start the tutorial step by step again

#

Ok

#

no more errors

#

now let's try this again xD

weak plinth
#

what method i must override in netcode that i can spawn custom objects , server and client side

wintry granite
#

Do you guys recommend using mirror + steamworks?

glass steeple
#

yes

#

actually 7 of 9 dentists recommend this very same thing

blazing raven
#

Hello guys Im making a multiplayer game. Does someone know why an RPC function is not getting called on the master client and only on the other clients. Im using Photon Network for multiplayer and i cant really understand why because the rest works fine.

opal perch
#

Hello everyone, Im working on designing a course for networking from scratch (TCP,UDP,Steamworks)
I'm looking for 20 or so people to do some market research with , Around 15-20 minutes, Over the phone or discord.
If you're willing to get on the line with me to do some quick market research please PM me.
Much appreciated in advance.

glass steeple
opal perch
#

Im trying to find the best things to put in the course and its best to do a 2 way communication , I can ask more clarifying questions if need be.

tranquil pollen
#

something that I've been curious about with steamsockets is if you use their protocol and their physical transport for routing since its free, is there a risk that steam might stop free access to their backbone?

velvet sonnet
#

does Unity Netcode have a way to talk to web servers?

#

I need to send information to my Apache server to get stuff from a DB

#

or do I need to use UnityEngine.Networking for that? I'd rather just use Netcode if it's easy

pliant sundial
pliant sundial
glossy zenith
#

is there a way to see all online players name in photon, and when someone disconnect that online players list updates too

verbal lodge
open valve
#

I've been playing around with Netcode for Gameobjects using UTP transport. I did the HelloWorld example. Everything is very much understandable and I'm loving the documentation. I later added a coroutine that pings the server using a RPC method and then server pings back - to measure the RTT. And I am getting around 40ms latency on a **locally **connected client, 3ms on host. (Server tick rate is 60hz)

#

This seems a bit high to me

#

Anyone have any ideas on why is it so high?

weak plinth
#

Hello guys

#

a follow this tutorial

#

but i need help for create the select player box

#

i try since 3 days

#

and i dont I'm not advancing

#

i have created the same script like him

#

but i dont kknow what he used for do his menu

#

he say horizontal layout

#

but when i put it

#

is that

#

and him

#

I need help :ccc

hushed violet
#

How do I make a game object that connects between 2 game instances through the photon network

glacial totem
glacial totem
#

I don’t know a lot about Unity’s and I’m a C# guy

open valve
#

If you mean HttpClient, I think it doesn't work on WebGL, while UnityWebRequest works. And UnityWebRequest is more optimized for unity (for use with coroutines, or downloading assets, converting data to unity resources easily...) - HttpClient is usually used in async/await workloads which is not really optimal for Unity. Then again - it's been a long time since I used this in Unity, so things might have changed.

open valve
#

I built a dedicated server and put it on one of my servers that is around 26ms away from my PC in terms of latency. Ran the game again and connected to it - clients again had around 40ms RTT - same as I had locally. Even though this time there was around 26ms extra overhead.

#

My guess is the buffering/batching going on in the background of Netcode, but how can I modify this? I tried changing buffer sizes but seemingly had no effect on latency.

velvet sonnet
#

Ok, I'm confused about Netcode's RPC. I'm calling ServerRpc from the Client and get this error:
"ServerRpc calls are only allowed to be invoked by the owner of the Network Object".

I'm assuming this means only the Server is allowed to call ServerRpc functions. But, aren't ServerRpc functions supposed to be invoked by clients? What's the point of forcing me to specify "RequireOwnership=false" on ServerRpc?

https://webcache.googleusercontent.com/search?q=cache:LWgVjPSvxgoJ:https://docs-multiplayer.unity3d.com/docs/advanced-topics/message-system/serverrpc/index.html+&cd=2&hl=en&ct=clnk&gl=us&client=firefox-b-1-d

glass steeple
glass steeple
#

In that case you don't need the flag

#

It's safer to require ownershio by default

velvet sonnet
#

So you're saying the ServerRpc functions can only be called by the owner (default would be Server as owner of ServerRpc). But I can also specify different Clients to be owners of the ServerRpc?

So essentially, I am able to make a whitelist of who is allowed to invoke ServerRpc?

glass steeple
#

Yes, a client can be the owner of an network object

#

Then that client can call the serverrpc without the flag

#

But as I understand there can only be one owner

velvet sonnet
#

Got it, thanks a lot! So kind of like.... a built in firewall, only realllly limited 😄

If a Client owns the ServerRpc, would the Server still have access over the ServerRpc?

glass steeple
#

I don't think it would make sense to call a server rpc from a server?

velvet sonnet
#

Oh, sorry. I mean, would the server be able to change the owner of the ServerRpc

glass steeple
#

Anyways, you can't own an rpc, you can own the object

#

I think the server always has the authority to change ownership but idk

velvet sonnet
#

Ok thanks. I'll have to learn what an Object is 😄

glass steeple
#

It's the class on which you put an rpc

#

The rpc is the function

#

You call that function on an object

weak plinth
#

Hello someone can help me to implement a multiplayer menu for select the car ?

oak flower
#

@weak plinth It's an incomplete question that no one can answer, not a request.

weak plinth
#

who i can choose the car befor the game

#

four player

#

and all player choose the car what he want to play

oak flower
#

Don't tag people not in conversation with you.
And this would depend on how you are implementing multiplayer. There are tutorials which can help you with that.

lean onyx
#

How complex is it to setup GitHub to build new server (I use Mirror) at end of every commit? does it need any special effort and day of work or can I get it done with github actions (never used before)

#

I have VPS with Ubuntu

lean onyx
#

Ah Unity cloud costs money

mortal patio
#

I have a VR game running on an Android device (VIVE Focus 3) and want to share a screen to a tablet, as well as have the option to trigger certain functions on the headset (like resetting a level, skipping certain objectives, etc.). I asked an intern of mine to research this and he came up with Mirror, but it seems like his implementation causes a lot of lag on the tablet, since it seems like it's running the actual game instead of just being a separate project that shows a screenshare

Does anyone have any tips on how to achieve this functionality by communicating between two separate projects?

pliant sundial
lean onyx
#

Oh cool

pliant sundial
# mortal patio I have a VR game running on an Android device (VIVE Focus 3) and want to share a...

Correct, mirror would just run the same game, in fact you dont even need unity on the tablet to make this work. You can just make it a small native app which would run really well, then in the game and app you open a socket to connect to each other. To send the screen you would want to use some existing video encoding technique to reduce the bandwidth required for streaming the video. Then on the tablet you can just take that stream and display it. For the functions simply open a second socket on a different port and connect it too, then just communicate over this one, easiest way (not the most performant, but in your case thats totally fine as your events you send are not sent frequently) is to send json objects as strings, and then just deserialize them on the other end. Then depending on what data is in the object you do something.

mortal patio
#

Sounds like a plan! Awesome, thank you

green reef
#

Anyone have this issue before when Host/Join (doing local testing and it worked fine a couple days ago)

KeyNotFoundException: The given key '60' was not present in the dictionary.
System.Collections.Generic.Dictionary`2[TKey,TValue].get_Item (TKey key) (at <6073cf49ed704e958b8a66d540dea948>:0)
Unity.Netcode.NetworkManager.TransportIdToClientId (System.UInt64 transportId) (at Library/PackageCache/com.unity.netcode.gameobjects@1.0.0-pre.6/Runtime/Core/NetworkManager.cs:1340)

green reef
humble crow
#

I would like to implement a trading system on my game, but i dont have any idea how to do it, and i didnt find any tutorials about, could someone help me?

opal perch
#

If it's just trading you need you might be able to use http.

humble crow
#

For example i want to trade items from my inventory but no documentation founded

high night
#

@humble crow Looks like playfab has a trade system

#

If you have all your inventory managed in playfab

humble crow
#

yea i saw but supports only item to item,only doesnt support item for curency or anything like that

#

or something like a in game market like an auction system

viral minnow
#

what are good general ideas to synchronize server and client?

pliant sundial
velvet sonnet
#

are NetworkManager.Singleton.LocalClientId's "secure" enough to identify who I should send data to?

#

I'm Debug.Logging the values, and I expected a long number since it's type ulong, but it's literally just 1,2,3,4,5, etc depending on how many test clients I have connected.

Wouldn't it be easy for someone to memory-edit their ClientID and receive someone else's data?

mortal horizon
#

ie. changing your id on your machine will not propogate that change to the server

velvet sonnet
#

Ok, thanks. I didn't know the ClientID/connection info was stored server-side. I thought the Server just asked each Client whether or not their ClientID was "this number" and trusted it based on the response.

mortal horizon
#

the server is the one who controls all of that data

velvet sonnet
#

Gotcha, thanks. It's all handled under the hood 🙂

mortal horizon
#

yes, it is all handled in MLAPI/Netcode transport layer

surreal seal
#

Anione that know how to use Scoreboard with photon can help me?

#

Im trying to apply this tutorial but i found some difficulties

#

Download SnakeCubed here
Android: https://play.google.com/store/apps/details?id=com.InfoGamer.SnakeCubed
iOS: https://itunes.apple.com/us/app/snake-3/id1408921148?ls=1&mt=8

For this lesson, we will teach you how to create a scoreboard that can be synchronized across the network in your Unity, Photon games. This scoreboard has a resort function ...

▶ Play video
#

at point 6.26 for example i don know what means the .PS.

#

in the script

covert anvil
#

Hey there, I'm using Photon 2.0 to create a game and the RoomListUpdate() callback isn't working when a room is deleted (All players left the room.) Anybody know what the issue is?

#

😭

covert anvil
#

<@&502884371011731486> Phishing?

weak plinth
covert anvil
weak plinth
#

no fr ,

covert anvil
#

either way, your account needs to go.

rocky bramble
#

Are there any real benefits in containerization the game server instead of just virtualization (kvm)?

pliant sundial
velvet sonnet
#

so lets say I have a ServerRpc that takes some info, then responds a result back to the ClientID that invoked it.

From what I'm reading, there's no way for the ServerRpc itself to obtain the ClientID from the Client that invoked it; the Client must pass its own ClientID to the ServerRpc. So the only way for a ServerRpc to respond is to use the ClientID sent by the Client.

Couldn't the Client just falsify its own ClientID, and the ServerRpc would send a potentially bad response to that wrong ClientID?

For example, Client 1 sends ServerRpc a command to log out, and that he is Client 10 (but he is actually client 1). ServerRpc trusts this, and tells Client10 to disconnect.

Is there any way for ServerRpc to detect and prevent this?

rocky bramble
#

@pliant sundial But what about security? Is not easier to jailbreak from container(cgroup/namespace) than kernel instance handled by native hypervisor?

pliant sundial
rocky bramble
#

yeah, you are right about this one

quaint moon
restive mesa
#

Hello all.... I have a question. So, I have netcode working with basic movement. but I need to use NavMeshAgent for movement. What is best way to do that? I have the NetworkVariable for position defined and is updating from Host to client but client position isn't updating from client to host/server. How do I go about updating NavMeshAgent on server? Or should I just send the click position to the server and then sync it back to client and let client do navmesh work? Well client not allowed to write network variable.

#

Maybe I should set the code for agent.SetDestination() as ClientRPC call, send click to server and then server can call the clientRpc for setdestination? But if I do that, I have to set the NetworkVariable position in client code in Update() and that removes the anti-cheat reason for running on server

restive mesa
#

?

sullen ferry
#

Good afternoon! I’m trying put the photon engine in my game and I would like to have a camera follow the players. I have an idea of try to put a script attached in my player prefab, but I don’t know how I can do that. If someone can help me out I appreciate.

restive mesa
#

Just reread that. I'll try again when I get home lol

restive mesa
# sullen ferry Good afternoon! I’m trying put the photon engine in my game and I would like to ...

Ok, so I don't think you mean one camera to view all the players at once and zoom in/out (have done this before). I think I read too much in second time I read this. I'm not familiar with Photon but it's based on Unities networking and should still be pretty simple. Main Camera for each networked instance would be independant should can simply done like I first mentioned (at least it should work).

#

YOu could have a cameracontroller script like this attached to the camera

#

public Transform target = null;
[SerializeField] private Vector3 m_Offset = new Vector3();
[SerializeField] private float m_Pitch = 0.75f;

private void LateUpdate()
{
    transform.position = target.position - m_Offset;
    transform.LookAt(target.position + Vector3.up * m_Pitch);
#

Then in your script on the player, when the player is instantiated and enabled, in OnAwake you should be able to do something like this

restive mesa
covert anvil
#

lol I just realised this group is full questions and no answers.

olive vessel
#

That's because networking isn't really an easy thing, and the latest camera follow question probably could have gone in another code channel

glacial totem
#

This channel isn't even networking tbh lol

zealous vapor
#

guys, let say I just split my build
headless linux and the webgl client
you think it's possible to host it through cpanel ?

#

sorry for a 5 grade question T_T

surreal seal
#

Anione can help me how to instantiate a gameObject using photon but just for the master client?
I mean just one object for the room not one for each player

tulip gorge
#

can someone help im trying to instantiate this using photon its part of a list

#

but i end up with this error

green reef
#

Could someone give a brief explanation of the difference of:
Listen Endpoint
vs.
Server Endpoint
Trying to figure out why clients cannot connect to host when using this:
GetComponent<UnityTransport>().ConnectionData.Address = ipAddress;

#

There isn't really documentation explaining variables and their uses. Should the client be using *.Address or *.ServerListenAddress to connect to the servers address?(Yes ports are forwarded)

surreal seal
#

@zealous vapor framework?

#

im using photon 2 free

#

asset

#

photon free version

#

here my script for the object instantiation

#

but its not working

#

its instantiating for all the players and not just for the room

manic jay
#

Photon has a unique (or weird) architecture. It needs a server to work but you don't code the server. The server is for authentication, matchmaking and other stuff.

#

So basically there's no object that's "just for the room"

#

Each object is associated with some client in that room, and instantiated for all users. The controller of it is responsible for updating its data.

#

If you use InstantiateRoomObject it simply means the object's lifetime is associated with the room (i.e. it doesn't have a player as its owner and won't be destroyed when any player leaves the room). What doesn't change is that there will still be a client (by default the master) that controls this object, and it will be instantiated for all players.

surreal seal
#

@manic jay got it

green reef
#

Man, 5 hours and nothin...

gray hill
#

if I want my game to work over the internet It will have to be portforwarded right?

quaint moon
#

Among other things

gray hill
quaint moon
#

I use dedicated servers so idk

pliant sundial
glass steeple
#

Are you really using p2p?

#

You kinda shouldn't

pliant sundial
glass steeple
#

Yes

regal karma
#

Hi! Maybe someone could help, I'll first explain what I'm trying to achieve:

  • I have multiple iPads running my Unity app
  • imagine the app as a Canvas with a bunch of UI elements (text, images, pinch zoom images, nested scrollviews, videos, audios, etc.)
  • I need to implement a "Teacher – Student" concept ("Host/Client" for networking)
  • the app view should be identical on Host & Client
  • host interacts with any of the UI elements — Clients see the changes reflected on their iPads. Clients do not have any controls, so it's basically a situation of the Host mirroring the screen to all Clients
jade hinge
#

i need help finding a way to get input from a client effecting one pefabe and not all using facepunch

glass steeple
regal karma
#

and here are the ways I thought to implement it:

  1. some external software like TeamViewer, but there probably isn't such a solution to scale to 20-40 iPads reliably enough, with reliable graphics quality
  2. implement each Client's UI element's controller via commands from Host (e.g. scroll to x,y; pinch-zoom to pos, zoomLevel), which is sadly a ton of work
  3. some kind of nested networked object structure, which would "just" synchronise the whole UI hierarchy from Host to Clients — this would be nice, but it seems netcode/mirror/others(?) don't support nested network objects
glass steeple
#

have you tried Zoom?

regal karma
#

have you tried Zoom?
tbh did not think about it till lately, I just assumed it's a major network/battery killer for the iPads
but realistically, compared to the difficulty of implementing other options — I will look into it more

glass steeple
#

you can also look at how people stream ipads on twitch

regal karma
#

thanks, I'll try it. The whole thing is LAN only, but might be a plus, if I can host some local Zoom/Jitsi Server for it

#

sometimes an external point of view helps 🙂

dry iron
#

Do you guys have any idea on how to fix RPC method not found error?

glass steeple
#

show code

green reef
#

Trying to figure out why clients cannot connect to host when using this:
GetComponent<UnityTransport>().ConnectionData.Address = ipAddress;
GetComponent<UnityTransport>().ConnectionData.ServerListenAddress= ipAddress;

There isn't really documentation explaining variables and their uses. Should the client be using *.Address or *.ServerListenAddress to connect to the servers address?(Yes ports are forwarded)

glass steeple
#

where si that

glass steeple
dry iron
green reef
glass steeple
#

no

#

the opposite

#

.Addrss is the address of the server, you set it on the clients

#

.ServerListenAddress is also the address of the server but you set it on the server

green reef
#

So technically leave it alone on the server as it should be, but set the ipv4 for the server in .address?

#

If this is the case, I tried that and could not connect using that either

#

That's what sent me down a rabbit hole trying to figure out how this new UnityTransport works

mortal horizon
green reef
mortal horizon
green reef
#

Ok, which makes it function just like the old NetworkManager. The issue is it didn't work that way either. I triple checked that the port was forwarded and all.

mortal horizon
#

might need to check the ports again 🤣

#

Or firewall maybe

green reef
#

So strange /: Well thanks @mortal horizon I will take another whack at it tonight after work.

mortal horizon
#

yeah i cant imagine whats going wrong for you, setting .address to the servers ip for client works for me

green reef
#

Oh side note, should ServerListenAddress be blank or callbackloop 127.0.0.1?

mortal horizon
#

if its blank it'll get set to localhost

#

which is fine

green reef
#

Ok, I just remember reading somebodys bug report on an older version of UnityTransport stating it wasn't working correctly, but it probably has been fixed

mortal horizon
#

Idk anything about that, i'm using the latest release, i never messed with older versions

glass steeple
#

@green reef are both devices on the same local network?

green reef
#

Ahh, ok just gotta mess with it, thank you very much, I might message you tonight when I get a chance to mess with it

green reef
glass steeple
#

are you using local or public ip?

mortal horizon
#

if they are on the same local network, you need to use private ip

green reef
#

public ipv4

glass steeple
#

public ip will probably not work from local network

#

yeah that's probably your issue

green reef
#

Weird...worked back on 5.x, why does this netcode feel worse than the old one xD

glass steeple
#

it depends on your network setup, but in most case it won't work

glass steeple
#

it depends on the way your network is configured

mortal horizon
green reef
#

My old project had no problems connecting with public ip4 while on same network as the computer hosting, but I will try private just in case

#

Doubt lmfao

#

fact

glass steeple
#

well like I said, this is completely unrelated to the netcode

green reef
#

Gotta get the Unity Netcode API on a wikipedia style format so we can get documentation xD

mortal horizon
#

Yeah, in any case, it doesnt matter what networking you are using, if there is some weird network setup that allows for what you described, its unrelated to netcode

mortal horizon
dry iron
#

can someone help me with this?

glass steeple
dry iron
glass steeple
#

where is that code?

dry iron
#

in the playermovement script

#

attached to the Player

glass steeple
#

and you are sure that object has that component on it?

#

you should probably check

dry iron
#

it does, it has the playermovement + the photon view on it

glass steeple
#

why not check?

#

in the code

dry iron
#

ohhhh, it doesn't because I made it destroys itself if the photon view isn't mine

#

I'm such an idiot

glass steeple
#

;)

#

happens to the best of us

#

Just remember to always check your assumptions!

restive mesa
#

Hello all.... I have a question. So, I have netcode working with basic movement. but I need to use NavMeshAgent for movement. What is best way to do that? I have the NetworkVariable for position defined and is updating from Host to client but client position isn't updating from client to host/server. How do I go about updating NavMeshAgent on server? Or should I just send the click position to the server and then sync it back to client and let client do navmesh work? Well client not allowed to write network variable.
Maybe I should set the code for agent.SetDestination() as ClientRPC call, send click to server and then server can call the clientRpc for setdestination? But if I do that, I have to set the NetworkVariable position in client code in Update() and that removes the anti-cheat reason for running on server

glass steeple
#

I would have something like a function "RequestMovement" or something like that that you call on the server from the client

#

and you pass where you'd want the thing to go

#

and the server would check if it's valid, etc

#

then you can compute the path and send it to the client(s)

weak plinth
#

Hello, I'm trying to use the Netcode for GameObjetcs package but when I add it the following error appears: Library\Package\com.unity.netcode.gameobjects@1.0.0-pre7\Runtime\NetworkVariable\Collections\NetworkList.cs(357,47): error CS0117: 'NativeArrayExtensions' does not contain a definition for 'IndexOf'. Already have Collections package installed but doesn't seem to fix it and haven't found that error googling, any ideas?

glass steeple
weak plinth
#

the typo is because I have unity on other pc and copied the error by hand, the code itself is all from the unity github

glass steeple
#

oof

#

how did you install it?

#

what's your unity version?

weak plinth
#

unity version is 2020.3.24 and installed it via git URL

#

got to install it successfully on other project, so maybe is any kind of conflict with other packages?

green reef
restive mesa
green reef
#

Its it solely dependant on navmesh or is it situational?

#

Also in theory the map should be the same and thus the navmesh logic should be similar soo it should only desync a by latency + how long it takes each clients cpu to process the nav path

restive mesa
#

Top down arpg style so mostly navmexh

green reef
#

so worst case is up to 1 second of desync is my rough estimate

restive mesa
#

It really doesn't take long, right now everything is just simple capsule and flat plane. Problem is, you can't sync client position to server, only from server to client

#

Even if i try to set the Network Sync variable in the client code, it throws error that it's not allowed

green reef
#

if it is action rpg you can write a custom movement that
if(raycast path to click point has nothing in the way)
then walk there while syncing position over net.
else
turn off position sync while navigating to position and send click position over net

restive mesa
#

which really is kind of what I want, I just can't figure out how to either tell server to run navmesh or allow it to get sync from client

#

Oh wait, yeah I could sent ServerRpc function call to server telling the server what the clients current pos should be based on clients navmesh

#

during update and server can update the position networkvar

#

so it's updated on server and other clients

#

I do sent the PointClicked destination to the server

#

so I could use that to do any verification

#

THe server calls ClientRPC now to send the click dest and run navmesh

#

bam

green reef
#

pretty much sending the pointclicked over server would be the lightest on netcode and just use logic on client side to make up the difference

restive mesa
#

Dang, thanks that helps!

green reef
#

Haha good luck!

velvet sonnet
green reef
#

@mortal horizon I finally got a chance to try what you said and I am having no luck

#

I've tried both public ip with portforward, I've tried private ip. I've tried setting the address via .connectiondata.address, Ive tried .setconnectiondata(address,port), nothing connects, nothing gives an error message.

green reef
pliant sundial
craggy wagon
#

hello! just getting into networking using Photon,
i set up a room create/join join system with a room list and all and it was working fine yesterday, now however for some reason the roomlist is not getting updated when someone creates/removes a room and i have no idea why

craggy wagon
#

nvm, figured it out. i was clearing the roomlist accidentally

restive mesa
#

Ok, weird issue. Using netcode. I setup basic plan, and capsule for player with navmesh and such. Everything works fine networked, using host and client over two+ instances. I have a biped character I put in and setup exactly like the capsule. MOved to prefabs in networkmanager. I start host and it works and animates. However, when client connects, the players ARE there, but you can't see them. You can see yourself on the host instance, but not the other player. On the client instance, you can't see either model. It has to be something with the character. I tried another biped character and minus the fact that the mats are all purple, the character shows up on both and moves but no animations (haven't rigged any animation stuff on it yet). What would cause a networked character to be invisible

green reef
green reef
hardy citrus
#

I have a small question, Im quite new to Netcode

How do I sync spawned objects when a player joins?

I have a script that check if i am the host, and then instantiates objects, also every prefab has a network transform and network object

restive mesa
#

Yes, I even created a new lowpoly char real quick, tired and setup idle and run anim. Imported and setup and I can see the char on both ends server/host and client

#

I'm convinced it's somethign with that particular model, but what and why only networked? lol

#

only things I don't have working with the new lowpoly model is animations syncing

green reef
#

Double check that you have a Network Object component attached?

#

If you see host and client I think its more of a animator/script references issue

restive mesa
#

Yeah I do. it's weird. I'm going to delete that char and maybe recreate/export. hopefully the issue doesn't come back. I'll just work with this new char and get animations synching for now

#

and that was an easy fix. Forgot to inherit networkbehaviour on my animation controller script.

green reef
#

Why does this not work to connect?

restive mesa
green reef
restive mesa
#

What ip is in the Workaround script?

#

could have a typo like comma instead of period or space in it (i.e., 127.0,0.1)

green reef
#

Workaround script is just a side component because for some reason NetworkManager cannot store reference to a TMP_InputText

#

@restive mesa have you managed to connect two seperate computers using the new Unity Netcode. Not just locally via 127.0.0.1

#

Because 127.0.0.1 works fine, but as soon as you try to use the netcode in a way the users will, the connection just gets lost in space

tulip gorge
#

how do i sync a function for say health using photon

olive vessel
restive mesa
green reef
#

I have the ports forwarded, I do not understand why it does not connect then...

restive mesa
#

also, if they are not on the same network (home-wifi for example) make sure the ips are routable, try to ping one device from the other and vice versa

#

same network?

green reef
#

I will try a ping test...it just sucks because I only get 2 hours a night to troubleshoot this then have to wait until day to talk to you guys

restive mesa
#

Even if you have windows firewall turned off, you still may have to go into Advanced Firewall Settings and add an allow for the open ports

#

yeah I know how that goes.... finally these days I get more time but... yeah I totally understand

green reef
#

My issue is that I did all of this and it works on my old unity project 5.x, but does not work here.

restive mesa
#

netcode?

#

I didn't think netcode worked on older versions

green reef
#

5.x had an older netcode, not the same as now. So its frustrating to see this "new" code not work

restive mesa
#

i think it's the UNet and the new netcode is part of the DOTS system

green reef
#

it doesn't but I am saying its not on the firewall or port forwarding side

restive mesa
#

you build the project and copy files to other pc?

green reef
#

yep

restive mesa
#

I ask that because I used to code server on one pc and clients on another... PITA

#

which version of Unity are you on now?

green reef
#

2021.2.19f1

restive mesa
#

ok, that's next up from me, I'm about to upgrade to that I think this weekend. How did you install the netcode?

#

the github repo?

green reef
#

yea, add new package via github from packagemanager

#

Version 1.0.0-pre.7

restive mesa
#

man... that wouldn't work for me lol... probably because I'm on crappy inet

green reef
#

inet?

restive mesa
#

internet

green reef
#

Oh, you couldn't import it through git?

restive mesa
#

no I tried a couple times and said fine, I'll just download from github

#

Have you tried a "Clean" Build?

green reef
#

This IS a clean build lol

restive mesa
#

well sorry, what i mean is, when you Build the project in Unity, there's an option to "Clean" build it

#

What I would do if it was me as next step, download this

green reef
#

Ill check build settings.. never heard of that

#

Don't see anything like that

restive mesa
green reef
#

o

restive mesa
#

But if I was in your place, I would download this and try one of the projects in it, just see if it works by default and connects

#

Just open the testproject inside there and build it and see if it connects between the two pcs

green reef
#

testproject?

restive mesa
#

Add that testproject folder to your UnityHub projects and if that works, then something weird in your project. if it doesn't, then something with the computers network wise

green reef
#

@restive mesa if by some chance this is still not working by this weekend, could I bother you and share my screen for a troubleshoot session?

#

We can probably also figure out your character network code/animation problem

#

Besides the fact that client cannot connect to host on my project, everything works

#

Like a perfect house, with the door welded shut

restive mesa
#

Yeah sure thing

#

PM me anytime

green reef
#

Awesome! Rare to see anyone else who does netcode and actually helps lol usually it falls on dead ears in chats like these

restive mesa
#

got my animations syncing now, realized I needed to set animation state using NetworkVariable enum

#

lol

#

yeah, it's sad most of the "Discord" helps for a lot of channels I"m in are dead.

#

it's usually the Cryptos that are active but are infested with scammer

green reef
#

lmfao yea I stopped messing with crypto last year when I realized the only ones into it were the same friends that would always go scamming in runescape as kids

#

I loaded up testproject, and it uses Unet Transport instead of Unity Transport, could the issue lay in the transport I am using?

#

I can't REALLY test it until I get home, currently on a secured network with no access to port forwarding xD

restive mesa
#

Could be

#

lol yeah some of the crypto is sketchy, it's a lot researching what is good and what isn't and knowing to ignore all the scammers lol

gray hill
#

Is a nat punch through or relay better for a p2p server

green reef
#

A nat punchthrough requires a relay to coordinate the punchthrough

#

If you know the dynamics behind it then nat punchthroughs are nice, but it seems easier to just explain to people how to port forward

spring crane
cosmic flare
#

guys noob question but is PUN 2 still the easiest for multiplayer stuff rn?

restive mesa
#

idk much about PUN or mirror or others, but I will say the netcode that unity has is nice. If you want something easy you can use Riptide but if you want someone else to host and manage your lobbies, matchmaking, etc, there's a few options but to me pun looks better

cosmic flare
#

say if i want only for the player to move around and sync their character properties (name, level, etc) is netcode enough?

gray hill
restive mesa
restive mesa
gray hill
restive mesa
#

It's best unless you put in something require some changes. Just notify the user if you want to not worry about relays

#

Like Minecraft, until recently, was difficult to get working to some because of different network/firewall configs so there were instructions on how to get it to work

gray hill
#

ok

#

thanks

restive mesa
#

And actually, Unity's Relay is in Beta at least through december and is free until then

green reef
#

I recommend going with a NetworkVariable because it will automatically sync the value when someone connects late

restive mesa
#

You're welcome!

green reef
#

@restive mesa I think I may have found the issue, check your project... are you using Unet Transport OR Unity Transport?

pliant sundial
# gray hill why doesn't NAT punch-through workfor all clients

A NAT translates your public IP:Port to a private IP:Port. Most consumer NATs will assign for each private IP:Port the same public IP:Port, this is what at least one of the 2 people that want to connect needs to have. This is because a STUN server will first find both public IP's that correspond to the players with the games port, then a TURN server (relay) is used to tell each person the other persons public IP's. Players then connect to each other at the same time.
NAT will never let packets through it doesnt have a route for, but if a player sends a packet out it will create a NAT route, so if both players connect out it will open their NATs and they will be able to connect which is called NAT punch through. Full cone NATs, Restricted cone NATs and Port restricted NATs all fulfill this basic requirement.

Industry grade NATs and some customer NATs use symmetric NATs which will choose different public IP's for the same private IP if the destination is different. So when the STUN server checks the public IP it sees IP A, but when the other person wants to connect the NAT will use public IP B for him and will fail. If both persons have such a NAT they wont be able to connect, when one of them has a more open NAT then a connection can still be made. Also all mobile networks use such a NAT, which means if you plan on making a mobile game NAT punch will always fail.

green reef
#

Ultimately there is no way around needing relay OR you can do what I do and slave an old gaming pc as a Dedicated Server

pliant sundial
#

Also sometimes you dont want nat punch since it leaks IPs. So in competitive games you want to avoid it, but then most competitive games use dedicated servers anyway

green reef
#

Unity Relay doesn't support it because it is 100% gauged to be a service they can sell the developers

#

I think they would succeed more if they spent less time trying to come up with ways to squeeze new developers and spent more time building those developers up so they have more people reaching that $100k mark and they can start collecting their 10%...That was the original draw to this game engine for me, all the other headaches it brings makes me sometimes regret not picking UE. But it is spilled milk and I do not have enough time to learn a new engine so its basically do this until I can't then quit for me xD

#

Been trying to get into bigger companies that hire Unity game devs but apparently 6 years of experience still ain't enough to get that callback hahahah

weak plinth
#

Who know great PUN2 ?

restive mesa
#

I just totally ditched that character model. I think something went wrong on the import or export. I was just trying to use one I had so I can have visual biped animation to make sure that was working multiplayer

proper delta
#

Hello, I heard that it is possible to visualize .GEXF files using unity for data visualization. Does anyone have experience with this?

green reef
#

@restive mesa So the issue with my project is that <UnityTransport> DOES NOT WORK. I swapped back to <UNetTransport> and it works again, multiplayer between computers works good again. I found it because the testproject worked and I tried swapping testproject to Unity Transport and it stopped working.

restive mesa
#

Ok, and I think that's because the UnityTransport is for relay only

#

Just realized that last night when I implemented unity relay service

green reef
#

They DO NOT state that anywhere x,D

#

I wasted a whole ass week figuring that out

restive mesa
#

lol... yeah docs are lacking. I've seen worse though LOL

#

Dumb question. With Netcode and a NetworkManager in the scene with NetworkManager script attached, how do I specify spawn location of the player?

green reef
#

Hmm, theres a couple ways

#

first way is to just let them spawn and immediately move them to where you want them via script

#

the second is to override onserveraddplayer or whatever the function is called

#

but the second method may or may not work depending on how much changed since 5.x

#

I imagine it still works though

mortal horizon
restive mesa
#

I think I just need to bite the bullet and extend networkmanager or something

#

WEll.... not every player will use same prefab anyways so I will have to manually spawn regardless

hardy stag
#

Hello guys how much does multiplayer feature cost in unity?

regal delta
#

your soul

green reef
green reef
#

or else you are throwing money in the wind

hardy stag
#

like if I have 1000 players would I have to pay anything?

#

I was doing some reasearch apparently there was something called HLAPI but its dead now in unity it used to be free, but now no longer exists?

unique current
#

Trying out Netcode for gameobjects, but hitting a hiccup immediately:
IsLocalPlayer
is returning false on the local player object that spawns when a client connects to the server

green reef
#

That object is in the Player Prefab slot in Network Manager AND has network object attached?

unique current
#

Yes

#

Although maybe the prefab is screwed up, I'll make sure

green reef
#

Try that and make sure the script calling IsLocalPlayer has using Unity.netcode

#

AND it needs to be a :NetworkBehavior script

#

unless you are doing GetComponent<NetworkObject>().IsLocalPlayer

#

another way to verify is while it runs in editor, click the object and look through the network object component in the inspector

unique current
#

So I looked and the object does have the network object component and is in the player prefab spot, but when it's spawned it's not the local player

unique current
#

@green reef any ideas?

green reef
#

@unique current Brief explanation of player connection script

#

any ties that might be interupting?

unique current
#

This is the connection script, start client is called when I click a ui button

#

This is the player connection script

#

I should be able to see Hi when it spawns

green reef
#

Change NetworkManager.Singleton.StartServer() to NetworkManager.Singleton.StartHost()

unique current
#

Is that all localplayer is for?

#

Does it not work for the player object of a client connected to a server?

green reef
#

No, but startserver will start as a server but not spawn that instance a player character

unique current
#

Oh yeah, I'm starting a server and connecting to it

green reef
#

if you starthost then it will start the server and spawn you a character on that instance

unique current
#

The player object is spawning

green reef
#

is the editor the server or the client?

unique current
#

The editor is the client

green reef
#

is the player in the spawnable prefabs list as well?

unique current
#

No, does it need to be in both?

#

It seems to be spawning fine

green reef
#

On older versions no, but this one has given me some grief xD give that a quick try

unique current
#

nope

green reef
#

lets see your network manager in the inspector

unique current
green reef
#

thats super weird, ok well try to change it to starthost then examin both characters that are made in the editor

#

see if one suddenly becomes islocalplayer or not

unique current
#

MY GOD

#

I found the issue

#

delete the conversation

#

hide the evidence

#

I labeled the buttons wrong

green reef
#

How was a player being made at all then?

#

was that just a prefab sitting in the scene?

unique current
#

Well the server still spawns the player prefabs

spring crane
#

You generally can't send references over the network. You can refer to networked objects by their PhotonView view ID, which you can convert to a reference with PhotonView.Find.

dry iron
spring crane
dry iron
spring crane
#

Pretty much, but you don't need to unless they actually need to be referred over the network (or use photonview centric networking features, like RPCs)

dry iron
#

alright. thank you

weak plinth
#

Hey! How would I sync a script/variables in the script to all players in a game? sort of make a server script if its possible, dont know exactly how this all works tho.

weak plinth
#

Hello everybody. I've been seeking an Artist that is capable of creating characters in Lowpoly/Polygon style, If you are able to refer me to one, or you are one, please shoot me a DM on twitter, or ping me in the chat, DMs and friendrequests are disabled since hackers are on the rise, my apologies.

weak plinth
#

Anyone knows how to connect to mysql in unity and use it?

weak plinth
#

ok i added the mysql.data.dll for mono (5.2.7) and it works :]

weak plinth
#

Who know great PUN2 ?

#

Photon

#

i need help

#

For do a multiplayer selection of player

restive mesa
#

Dang it... anyone with Netcode instantiate the Client's Player PRefab manually?

#

Using the SpawnAsPlayerObject instead of Spawn and I've tried so many combos

#

I have the prefab in the gamemanager script which inherits from NetworkBehaviour. I've tied to the NetworkManager.Singleton.OnClientConnected and the Prefab is also listed in the NetworkManager

#

But I keep getting this error

#

KeyNotFoundException: The given key 'male_c1nc (UnityEngine.GameObject)' was not present in the dictionary.

#

I have tried just running with no tags. I've set it as ClientRpc and I've set it as ServerRpc and it either doesn't do anything or I get the error

#

nm

#

Figured that part out, but it doesn't spawn my playerprefab

weak plinth
#

This Chanel dont work

#

I have a problem since one month no people reply

#

Who know great PUN2 ?
Photon
i need help
For do a multiplayer selection of player

green reef
#

Then to have a player put into a specific object, spawn them in as a generic object and have the server spawn the object you really want them using. From there re-assign them to that object

#

I dont remember the function off the top of my head, but there is a function that will move the players control from the generic object to the new object.

#

I typically use the generic object as a character select screen then delete it once player has selected

mighty fossil
#

hey devs! what's the best way to sync physics using Mirror? I'm making a coop game for 2 players, so it's just host lobby & join lobby. Do I need to make physics calc on server only, like dedicated server thing? Is it even possible in Mirror? What's the best way to sync physics?

#

also, I have a few physics objects that players can interact with. So, 2 players can interact with a single object.

weak plinth
#

Guys do you know how can i créate a lobby for sélection player with PUN2 ?

#

Where i can choose a car

restive mesa
restive mesa
# green reef add this to network manager spawnable prefab list

I have the prefab there, and the docs said if I use that, it will replace what they spawn with. I like the idea of maybe a capsule or something (or even empty object) then replace. Just need to figure out how to get the replace to work. It seems (according to Unity Docs) that the SpawnAsPlayerObject is supposed to remove the initial object and transfer control to the new object, but it doesn't so something is missing

weak plinth
#

What do you use for multi player

restive mesa
#

Netcode

restive mesa
# green reef add this to network manager spawnable prefab list

Ok top of the fact it doesn't spawn. And weird thing is, I built it and ran separate instance just to see what would happen. When player 2 connects, unity gives error that object had already been spawned, even though there were NONE of them in hierarchy

#

If I hook up a button in gui to spawn, it spawns the object but original stays and both are controlled.

#

I'm trying to instantiate and spawn in OnClientConnectedCallback and didn't spawn

#

I have an idea how to get around it but what does unity expect of us? Where and when SHOULD I spawn manually? Nothing in docs I've found.

#

Idk what the problem is, but these days, companies absolutely suck at documenting

quaint moon
#

Or show the current code that doesn’t work

restive mesa
#

To manually spawn player prefab

#

I think what I'll have to do is spawn an empty GO initially, then SpawnAsPlayerObject. Nothing else seems to work well

#

According to Unity docs, when I call SpawnAsPlayerObject with a button press, it supposed to "replace" the original playergo with the new one. But original stays and can control both. Not bothered too much about that as I can probably just destroy that original but I'm confused as to what Unity is expecting us to do, it's not clear.

#

is that how I SHOULD do it? Is there more to it than the "Just call SpawnAsPlayerObject instead of Spawn" that is in the docs?

quaint moon
#

MLAPI isn’t complete which is why I use mirror

#

I can’t find documentation on SpawnAsPlayerObject so it’s hard to help

#

But I don’t believe SpawnAsPlayerObject replaces the old one

restive mesa
#

Yeah, I'm lucky to have found it

#

I do see now a note below that that original will still exist

quaint moon
#

If it’s similar to mirror there’s a method called ReplacePlayerForConnection?

restive mesa
#

It's probably similar to that

quaint moon
#

Check what methods start with Replace

restive mesa
#

in fact since Mirror is built off of unity's code, it probably implements something like that

quaint moon
#

First off though, can I see you’re code and the error you get in the console if any?

#

You are using parrelsync to test?

restive mesa
#

Well originally, I gues s I should say, I was trying to call in OnClientConnectedCallback which would not spawn anything

quaint moon
#

Are you using parrel sync?

restive mesa
#

which is why I was posting to begin with, but it looks like even in their BossRoom sample, they are creating an Empty GO and then spawning new.

#

Sorry, not sure what that is

#

Trying to figure out waht all they are doing to spawn (and how) in boss room... just a lot of f'n crap to go through as usual with Unity. Put out "Sample" project with 5,000,000,000 lines of code scattered across 2,000 files

#

lol

quaint moon
restive mesa
#

asset store?

quaint moon
#

Also, sounds like you should just switch to mirror

quaint moon
restive mesa
#

I don't want to use mirror as I will have servers setup not just for games but other stuff not to mention blockchain integration. It's a bit comlex and I've tried to use mirror once before and just wasn't robust enough. I dont' want to try to hack around their code

#

parrel sync? or parallel sync?

quaint moon
#

Yes

#

You’re crazy if you think Unet will solve any of the problems you had with mirror

restive mesa
#

Ok, that looks pretty cool

quaint moon
#

You can’t even spawn a player… Fishnet has a lower level networking solution if you need that but I don’t think MLAPI is for you

restive mesa
#

Netcode, not focusing on MLAPI

#

I thought mlapi was going away anyways? or maybe just beta, I can't remember

quaint moon
#

Idek what it’s called these days

#

They change the name once a week

restive mesa
#

yeah it's crazy

quaint moon
#

What exactly are you worried about that mirror won’t be able to handle?

#

Maybe I could let you know if it would actually be a hinderance

restive mesa
#

I don't want to be paying for a service if I have servers already in place I'm paying for.

olive vessel
#

Netcode for GameObjects is the new name for MLAPI, UNet is the name of a transport for NGO and also is the name of the old multiplayer HLAPI which is deprecated

mortal horizon
#

I would recommend mirror. everything you are having trouble with NGO, mirror can do pretty easily. also like apex mentioned, theres no pricing model, its the same as NGO

mortal horizon
#

While I do appreciate the direction ngo is headed, I'm not sure that it's ready to be used

#

(If you are planning on releasing a game soon)

weak plinth
#

Anyone know photon please

jade glacier
#

I am one of the devs at Photon. @weak plinth Though for photon questions you may want to hop on the Photon discord.

jade glacier
#

yeah, discord links in this channel are blocked. PM'd you the link.

oak flower
#

Discord links are also pinned in this channel.

jade glacier
#

Ah yeah, Photon's link is in the pins. Thanks @oak flower

glacial totem
#

Maybe I’m just being a snob but I wish it was an enforced rule that Photon questions are rerouted to the Photon discord…

#

This channel has no actual networking talk, just questions about premade assets. 🥺

jade glacier
#

The talks were not specific to photon products, but more just general networking concepts.

#

Most talk though is typically related to a specific product, be in NGO (MLAPI), Pun, Fusion, or Mirror related. Not sure that is avoidable.

untold notch
#

hey! is anyone here familiar with the normcore multiplayer stuff, theres an issue where when the first player joins they get there view for there person, but when a second player joins, the first player is forced to see through the second players view

kind sundial
#

**(1) Using Netcode for GameObjects, is there a way to add/register Network Prefabs to the Network Manager from a script?

(2) Also, is there a way to reference Network Manager's Network Prefab list?**

#

I'm trying to create a general spawn function to spawn any Network Prefab, and I thought it would be easier if I created my own list of Network Prefabs, or at least was able to reference Network Manager's list.

dry iron
#

guys, I made an RPC function in the player himself which allows him to get inside of a something that has a Photonview but it seems that when another client join the game I cannot call that rpc function no more. Do you guys have any idea how to solve this?

worn wolf
#

Anyone got a video or blog post that goes over multiplayer game administration? More specifically, what kind of features you'd need on an administration panel (i.e., managing players and inventories, game events, etc.) and how to go about implementing them. Doesn't necessarily have to be made with Unity, I'm assuming a lot of them would be web-based from what I've seen in other games.

split sonnet
#

photon pun player disconnects when the mobile screen turn off ??

#

how can i fix that??

mortal horizon
split sonnet
weak plinth
#

I've switched to using sending inputs to server instead of position but i have a problem because on the server the position doesnt match clientside then
it gets more and more off
using charactercontroller.move on both ends
what i send is :
w a s d : bool for each
camera y rotation : float
What am i missing? D:

weak plinth
#

oh maybe because the packet when i change inputs arrives late.. :|

gray pond
weak plinth
#

nice

restive mesa
weak plinth
#

also how do i send keys only if my walking depends on camera forward and right vectors

violet edge
#

Anyone have any tips on substepping multiplayer networked physics in Unity? So far the best solution I’ve implemented is putting each player in their own physics scene, but that requires a lot of weird workarounds for collision detection.

pliant sundial
weak plinth
pliant sundial
# weak plinth if i send the move vector instead like the dir in controller.Move(dir) i get mo...

Floats can't represent all values, you can read about it here:
https://www.geeksforgeeks.org/why-floating-point-values-do-not-represent-exact-value/#:~:text=The floating-point numbers serve,with a minimum tolerance value.

Since they cant represent all values it sometimes has to round to the closest value it can represent. This rounding is not standardized on different CPU's. So the result is different between x86 and x64, it will be different between Intel and AMD chips, it can even give different results between 2 cpu generations.

weak plinth
#

Also I'm running it on the same machine in the same unity version

#

server and client i mean

#

wow ok but still on same pc running side by side?

pliant sundial
# weak plinth wow ok but still on same pc running side by side?

Editor might compile your game as a debug build while the actual build is compiled as release build. In release builds the compiler will do some optimizations, e.g. it could reorder math code, reordering floating point math can mean that it will also give a different rounding result.

weak plinth
#

im running both in the editor tho 🥴

pliant sundial
#

If you want it to be deterministic you would need to use fixed points representing positions and then recreate all unity systems from scratch using fixed points instead of floats. But instead of that it would probably best to use Quantum https://www.photonengine.com/quantum
In Quantum they already replaced all unity systems like physics with their own implementation that uses fixed points.

weak plinth
#

quantum isnt cheap

#

im using darkrift rn

pliant sundial
#

Quantum is getting a free tier soon that everyone can use

weak plinth
#

who says im trying to recreate

#

im trying to figure things out

weak plinth
pliant sundial
# weak plinth and what about this case

My guess is your timing is off. You need to turn off the physics simulation and then you can simulate on the physics engine manually in fixed time steps. Now you need to apply each clients inputs in the exact same simulation tick in all game builds. So if client sends input for tick 60 then on the server you need to also run it on tick 60. And if you figured all that out then you still cant use physics because PhysX will return different results each time you run it, even on the same device in the same build.

weak plinth
#

oh wow

#

how does that happen tho i wonder

#

physx doing some randomisation on floats? 😂

pliant sundial
#

So its not only a rounding problem

weak plinth
#

ok thanks so i think i will use this and just correct the clientside if it gets far off

#

i dont need deterministic i guess

#

also how did they solve the issue with the floats and physx stuff? they use integers and their own physics? talking about quantum

pliant sundial
# weak plinth ok thanks so i think i will use this and just correct the clientside if it gets ...

Thats how most games do it, its called CSP (client side prediction). Client sends input to server, server has full authority over the clients position and sends the current position to the client. To hide the lag the client predicts its position, so after sending input it will move according to the input. Then when the server sends the position it will correct its position if it was wrong.

pliant sundial
weak plinth
#

should the server send back to the client his position every time the player did an input?

weak plinth
#

but i think quantum is overkill for my project

pliant sundial
weak plinth
#

so i need like an id for each input?

#

im talking about wasd movement in a third person game btw

pliant sundial
weak plinth
#

the thing is, movement is based on the camera's forward and right vectors, so i would have to send the players camera rotation as well? or just the player moving his mouse aka camera rotation as inputs, but then wouldnt it be different for every player depending on their mouse how much their camera moves?

pliant sundial
# weak plinth im talking about wasd movement in a third person game btw

What CSP usually does is that the position it receives is in the past, so resetting would teleport the player back, so it will save its last positions, when servers position for tick 10 arrived it will look in its past positions for position at tick 10. If its different then it will reset to the servers position, but then also rerun the next few ticks inside a single frame to catch up again so that you dont show the client past positions.

weak plinth
#

yea i kind of understand csp

#

thanks for the link

#

but i dont see it talk about rotations

#

in there it assumes you can only do wasd and jump inputs but what about turning the camera to aim... its a fps as he says and thats what ppl do..

#

move camera and thus wasd needs to be interpreted accordingly

pliant sundial
weak plinth
#
public class Input{
  public bool w,a,s,d;
  public float cameraY;
}


#

kinda like that?

weak plinth
#

im gonna use this instead for now

public class MoveDir{
  public Vector2 dir;
}
violet edge
#

If you wanna save some bandwidth you can keep your bool inputs in an enumerated array and then compress that array into a single int representing the whole keyboard state

weak plinth
#

more precisely mouse movement as in turning camera

violet edge
#

You still need to send a float for your rotation, but your serialized user input class could contain these compressed representations of input

#

Advantage here being you can unpack the individual key binds on the server, which you might need depending on the complexity of your gameplay

mortal horizon
spring crane
cedar condor
#

Assets/Plugins/Photon Unity Networking/Plugins/PhotonNetwork/LoadbalancingPeer.cs
help please

stiff ridge
nova tree
#

I'm trying to build boss rooms on unity 2021.3.0f1 ('couse i want to start my next project on that unity version and want to test everything there), getting error - error CS0012: The type 'NativeHashMap<,>' is defined in an assembly that is not referenced. You must add a reference to assembly 'Unity.Collections, Version=0.0.0.0, Culture=neutral, PublicKeyToken=null'.
tried to solve it with installing package unity.collections with 2 methods, with this link - https://github.com/needle-mirror/com.unity.collections and writing com.unity.cellections in add package with name..., both of them installed package, but game still cant be built, is there anything i can do about it, or i just have to download unity version game is made for?

glacial totem
#

It’s absolutely doable.

#

State rollback and resync

formal mango
#

Hey guys. I am having issues with building my game. This issue keeps popping up, and wouldn't build my game

mint tusk
#

how do i give the object athority?

cedar condor
split sonnet
#

hey, i'm using photon pun and i'm looking for a way to make the last person in the room the winner

#

i tried if(photonnetwork.playerlist.length==1) then make that player the winner

#

but it doesnt work since if a player joins the room for the first time it will also becoms the winner

#

i want a way to make sure more than one player joined the room then if from that list they leave and one left they become the winner ??

#

anyone know how ca i achive that

sudden hamlet
#

What networking solution is peer to peer other than the depricated built in one?

spring crane
#

PUN is peer to peer over relay, which I imagine the built-in was too.

sudden hamlet
#

Thank you! I'll look into it.

stiff ridge
cedar condor
#

:d

cunning sluice
#

Hi there, I'm using Photon 2 and my OnRoomListUpdate is receiving a list with count 0, anyone have an idea why? Thanks!

misty wharf
#

hey i tried using lan hosting. it says client connected but i cannot see any players. why could this be

olive vessel
#

Can you be more specific? Networking solution, any errors, player prefab

tame pendant
tame pendant
split sonnet
#

so this condition will become true as long as two player joined even if one of them leaves

#

then in my winner method i said if the condition is true and if the player list= 1 ( means players have left or died) then make that last player the winner

#

but i have a problem

#

if the last person who is left is the master server then nothing happen, i have no idea why

#

the other player can become the winner perfectly but it never happens for the master, very strange

limpid plaza
#

im making an online fps game, but cant find a networking solution, if u have any ideas pls inform me

tame pendant
split sonnet
#

it is very very strange, because when i print the player list it tells me there is only one player in the room, but the condition for having two players in the room also becomes true

#

In my years of coding this is my first time to face something like that

limpid plaza
#

anyone has an opinion on which networking i should use?

oak flower
#

You can visit their discords and ask around first hand what are their strong points. Links are pinned here top right.

limpid plaza
#

👍

solemn haven
#

Hello. how to deserialize json array in unity? I tried wrapper class but it didnt work. Now Im trying with NewtonSoft, help, please? Im getting error when trying this

high night
#

@solemn haven it probably doesn't match the format

#

Try with something simpler

#

Or even better

#

Serialize the ShrineLvlData[]

#

See the format

#

Might spot some mistakes

solemn haven
#

Json looks like this

high night
#

Hmm looks allright

#

There are some fields that don't match but that should be find, they just wouldn't be mapped

#

@solemn haven Try doing List<ShrineLvlData>

#

instead of ShrineLvlData[]

solemn haven
#

ok2m

uneven hawk
#

Hey guys 🙂 So I want to start making some kind of multiplayer game where you can send stuff like trains, planes and ships to eachother, have a guild, etc. but I don't know if I should go with the Unity Networking System or PUN2 or even something else I haven't heard of

#

Oh I also have to say I'd like to have it working with WebGL

high night
#

@uneven hawk So it's like travian?

#

No realtime interaction between players?

#

If that's the case you probably wouldn't wanna have a realtime server

#

Which also means no unity in the server

uneven hawk
#

Yeah kinda. You can send a train to someone which has a time until it comes back and at around half that time it arrives at the player you send it to and can be served

#

That's it

#

Wanna have a chat tho

#

If that changes anything

high night
#

So you need a database
You need requests
And you need some scheduled events like trains arriving

#

You can use a managed third party service for chatting

#

I think you could find and adapt a chat api

#

I don't know how hard that would be but probably much easier than creating or hosting it on your own

uneven hawk
#

So I know that PUN2 i.e. has a method kind that is used to synch a method in a room

high night
#

rpcs and commands you mean

uneven hawk
#

Yes

high night
#

Well pun is for realtime stuff

#

You don't need all the complexity that pun and unity brings here imo

#

I wouldn't say Unity and pun are a good option for the type of game you wanna build

uneven hawk
#

Well at some point I want to have events, quests, etc.

high night
#

You can use unity in client though

#

Thats totally fine

#

But I'd like to say that the server doesn't need unity for these types of stuff

high night
#

In server

#

You'd want everything to happen on serverside

#

Client would just query the quests and their state

#

Just for displaying

#

There are also ways for a http backend to send events to the client

#

For the event stuff you want

uneven hawk
#

The thing is that I don't own a server nor can get one currently and so I have to stick with client based stuff (for now it's just for me and friends so no cheating)

#

So everything would be saved on PC or maybe even cloud if I do that and just want the players to communicate

high night
#

You could find a managed database server

#

And a function app

#

function apps have free tiers

uneven hawk
#

What's a function app?

high night
#

It might be easier than you think

#

AWS lambda

uneven hawk
#

Yeah maybe

high night
#

Azure cloud functions

#

They just process requests

#

You should also have some stuff for authentication

#

We let the playfab handle authentiation

#

Every request passes through playfab and its guarantied to be coming from an authorized client

#

I just haven't used a database yet

#

But I'm sure there are free tiers for managed database servers

#

In some cloud or some third party api

uneven hawk
#

I am rly thankful for your help but that's a lot you throw at me there 😅 For the beginning I just want to connect the players and save stuff locally

#

Since I never rly worked with something else than PUN2 and I only did it once for a chess study project

#

Also what about privacy policy if I use stuff like AWS, Playfab and managed databases?

high night
#

privacy policy? hm

#

well you just pay money to azure/aws

#

if you pass some quatas

#

which are kinda hard to fill

uneven hawk
#

what are quatas

high night
#

you gotta check them out

#

I don't think it'll ever be of an issue

#

It will be free for your needs

#

If you surpass those quatas money wont be an issue for you anyways

#

Cloud functions are very cheap because no resource is allocated for you that you aren't actively using @uneven hawk

#

Its not like a virtual machine or anything

uneven hawk
#

How do cloud functions work exactly? I mean I know that it is code run on a cloud but I don't understand more of it haha

high night
#

you have connection string

#

a long string thats supposed to be secret

#

you use that to call the function

#

its an http call

#

somewhere far away a supercomputer allocates an instance of your app

#

or picks one in the pool

#

the instance runs your code and responds to your request

#

more people you have requesting, more instances get allocated

#

and you get paid per request after the free quota is surpassed

uneven hawk
#

Guess you mean charged

#

Paid would be cool

#

x)

high night
#

ah yes:D

uneven hawk
#

Just quick: Are you german?

high night
#

nope why

uneven hawk
#

Would make things easier haha

high night
#

ah

uneven hawk
#

ok nvm

#

I mean my english isn't that bad but that stuff is completely new to me and hard to understand

high night
#

im turkish

uneven hawk
#

Okay and how exactly would I use those cloud functions?

#

Like for sending trains or something

high night
#

I use them through playfab

#

playfab knows the secret connection strings

#

calls them for the behalf of users

#

You could probably also look for an authentication service

#

You need some sort of a gateway like that

#

But from there on though,

#

Behind the gateway, all your services can communicate via secret connection strings

uneven hawk
#

So let's say P1 wants to send a train to P2.

  • P1 selects P2 in a list (let's say it's a Friendlist)
  • P1 selects the train he wants to send and clicks send
  • Now P1 as client connects via auth gateway and is fine to proceed

How would it go any further? If I understand you correctly now a cloud function could be called but to do what? How does it tell P2 "Hey you got a train on your map that's arriving in X minutes"?

#

Btw. could I use Unity Authentication (currently in beta) for auth? @high night

high night
#

You should be able to query trains arriving to your town etc

high night
uneven hawk
#

Ah ok. Might just check it out then

#

The auth service is just to make sure you're a real user who is making the call, right?

#

And to identify you so the functions can tell who is sending the train

high night
uneven hawk
#

Hm~ I thought that there is no need to save the incoming stuff for a player in a DB but I just noticed that I have to because otherwise they would be gone after disconnecting lol

high night
#

Yeah

#

@uneven hawk Cloud functions dont store any data

#

Not like your realtime game

#

You follow some constraints like this, you might as well have made an infinitely scalable game in the end

high night
#

If you do things right, your game will be able to server infinite customers

#

Because everything is on cloud

uneven hawk
high night
#

And assuming you are not creating any chokepoints

uneven hawk
#

What you mean by chokepoints?

high night
#

Like if there's one row of data

#

That all the players need to read/write

#

That'd be a chokepoint

uneven hawk
#

Ah because of waiting for others to complete

#

Like a bottleneck

high night
#

And that'd prevent your system from being scalable

#

Yeah

uneven hawk
#

Hm~ A friend just told me about UGS right now which has Authentication and even Cloud Code

#

And Cloudsaves

#

This sounds like what I need

high night
#

That could do I'd think

#

sounds like playfab

#

might still need another database though

#

their userdata might not be enough for some stuff

uneven hawk
#

Well that shouldn't be the problem in the end

#

But could be enough for now to playtest since I just wanna play with some friends at the start to test things out before going live

uneven hawk
#

@high night So just make sure I understand the concept:

  • Sending a train to a player ads it to your "Sent trains" data and to their "Arriving trains" data in the database

How to tell a player to update their list now if I don't want to do it every few seconds? You said something about an event or something but how would I send this event to only a single player and how to even send it if they're not connected in realtime?

high night
#

@uneven hawk Try to avoid updates

#

keep a sent time

#

check current time and do logic when client polls

#

keeping the data in two places is also not very nice

#

but i dont know how you'd avoid that without a real database

#

there are probably some ways to avoid it, i'd try to think a bit further

#

to avoid data duplication

uneven hawk
#

Would you instead have a list of all active trains with "sent from" and "sent to"?

#

And how would a player receive updates of their incoming trains list if they shouldn't do updates?

#

I mean.. if they stay at the list the list HAS to update once in a while

#

And since some trains might have an arriving time of lets say 2min they at least should update once in a minute

high night
#

clients can poll once a minute
@uneven hawk

#

while they poll maybe you could do the logic

#

letting that process start the control flow

#

or there can be an event system

#

and scheduled events

#

for when trains arrive

#

your backend could invoke something on client side

#

but thats some advanced stuff

#

I don't know much on these topics yet

uneven hawk
#

Same

#

I gonna stick with polling once in a minute

high night
#

Things can be made millions of different ways really

uneven hawk
#

true

high night
#

Its all archiecture and design

#

thats what makes the system design hard

uneven hawk
#

Why again would I use Cloud Code? Can't I just do Reads and Writes clientside?

#

At least for the sending and checking for new planes part

#

@high night

#

Or would you put that into cloud code as well and just use HUD stuff clientside?

high night
#

you shouldn't access database directly on client @uneven hawk

#

that'd be a security problem

uneven hawk
#

Oh okay

high night
#

and it'd make things hard for you

uneven hawk
#

Why?

high night
#

you'd want you business logic to be seperated from database access anyways

#

you should have one function to send a train

#

from baseA, to baseB, with supplies[]

#

one function to get all "train"s coming towards given base

#

one function to get trains going outwards from given base

#

that'd just be for data access

#

nothing else

#

just to read and write some records

uneven hawk
#

But serverside

#

?

high night
#

and then you'll have the functions that do business

#

both the data access and business should be at server side

uneven hawk
high night
#

client should only have access to this:
SendTrain(target player)
PollOutgoingTrains()
PollIncomingTrains()

#

Or just SendTrain and PollTrains

#

Business logic is how your trains operate

#

They should drop off resources etc

#

business layer access database through data access layer

uneven hawk
high night
#

Poll train is for recieving the data on trains

#

then client can update visuals with the recieved data

#

SendTrain wouldn't return anything

#

just a success or error msg

#

@uneven hawk you can check out some on layered architecture

#

view -> controller -> service -> dao -> database

uneven hawk
#

So on client side would be a method ServeTrain() which calls the corresponding cloud method and receives the data and then update visuals?

high night
#

ServeTrain sounds like it wants to do some business

#

You cant depend on client to do business

#

if i get it correctly

#

Client should not be responsible of the state of the game

#

It only does rendering and sends commands

uneven hawk
#

Well it works like this:

  • P1 sends train to P2
  • P2 sees incoming trains in a list
  • P2 can now tell a train that is arriving to drive into the station
  • P2 can click on a button on the train to tell it it's being served
  • Serving means it adds stuff to the inventory and shows some animation
  • Train now automatically drives away and is not longer listed
  • If a train isn't served in time it gets deleted from the list that shows trains for P2
uneven hawk
#

@high night ❤️ 🙂

high night
#

Kinda busy right now @uneven hawk
You look like you got a plan

#

Just keep the clients access simple

uneven hawk
#

Alrighty

#

Thank you so much

high night
#

no probs good luck

uneven hawk
#

thanks

uneven basin
#

Hey folks, I am making an ASP.Net API to work with Unity and wanted to know what datatype I should have my API return. Is there a specific one like JSON or Ok results or is it dealer's choice and you have to adjust your code on the Unity end. (I'm hoping this is the right channel for this question haha) Thanks in advance!

#

I plan on using UnityWebRequest to communicate with my API

winged geyser
# uneven basin I plan on using UnityWebRequest to communicate with my API

Dealer's choice, pretty much. JSON'll be a little bloaty, perhaps, depending on what your game looks like, but it has the advantage of being easy to read (for humans). You could pack it with something like protobuf or MessagePack (which is what I use), which has the advantage of being agnostic of Unity and extremely small - I have some pretty large data models with a complex data hierarchy, and they pack down pretty nicely. But, obviously, in doing that you're not going to be able to read your messages, so you'll have to unpack them and explore them either using reconstituting the objects and using a debugger or converting them to JSON anyway.

uneven basin
# winged geyser Dealer's choice, pretty much. JSON'll be a little bloaty, perhaps, depending on ...

Thanks for the response! That makes a lot of sense from what I currently know of Unity. This is a small project with small models, so it seems like JSON won't cause too many headaches then. For context, I'm making an API to do a dark souls message system in a simple Unity3d app that is just a space to put them in and a camera. Unless there is something more to the bloat of JSON it seems like my best bet.

winged geyser
#

when you say "message system", what do you mean?

#

The only reason I ask is if you're thinking about messages as "aim my character to orientation 15,15,15" or "start moving forward" or "end moving forward" then those messages are going to be really large

#

(like if the client needs to send them 30 times per second)

uneven basin
# winged geyser The only reason I ask is if you're thinking about messages as "aim my character ...

Oh man, that would be a lot of data haha. I meant the Dark Souls text messages that players leave for one another. My Unity app will be a 3d space with a cube where each message is at that, when hovered over with mouse, shows the message. A persistent message than can be seen on multiple computers at once. So the data the client is grabbing and sending would be tracking the message, user, and coordinates of the cube.

winged geyser
#

Ah, yeah, JSON is totally adequate for that

#

Neat little idea, too

uneven basin
# winged geyser Neat little idea, too

Thanks! I can't say it's entirely mine. Someone from another developer discord helped me out with it. I'm in a full stack bootcamp and wanted to have a personal back-end project I could do as a game dev oriented portfolio piece.

winged geyser
#

Cool, best of luck. The part part for projects like these honestly is the .. knowledge and configuration.. once you sorta figure it out, the implementation is often the easy part

#

(he says as he randomly smashes microsoft azure portal buttons frustratedly)

uneven basin
winged geyser
#

heh, yup, well, all those kinds of questions are pretty well answered in the code-XX channels

#

I used GMS back in the day.. whew can't believe how far I got with that software

uneven basin
#

It's honestly a really strong engine. It is capable of a loooot of stuff. Really tragic that it hasn't gotten as much traction as Unity because I think they both have a place and are good for development.

winged geyser
#

Yeah.. I mean, I like it too but I can't help but feel the scripting environment is really too simple.. I was just banging my head on trying to do stuff and in retrospect (after like 3 years in unity) GMMS looks like visual basic to me now

uneven basin
#

Won't disagree with that, but I think the simplicity is a strength even if it is definitely not for everyone (or every project). That said, the documentation is insanely good.

#

Once again, thanks for the help! Spent a looot of time last night digging around online.

cunning sluice
#

The room also has IsVisible set to true

#

I also made sure that the OnRoomListUpdate is being called

dry iron
#

do you guys know what kind of rpc that fires in a specific client between the others? like adding listener to a specific clients but not to the others

stiff ridge
dry iron
rotund terrace
#

If it’s Mirror, there’s only one TargetRpc and it takes a parameter of type NetworkConnection which specifies which client receives the message

dry iron
#

I'm talking about photon pun

cunning sluice
#

here I have the gameversion set

#

In the PhotonServerSettings I have the app version and region set

#

I figured it out

#

It was indeed connecting me to a different region on the Quest 2 Build

cunning sluice
#

Thank you for the help!

grim merlin
#

Guys who have ever used PUN: please tell me, in the simplest possible language, what does the [PunRPC] attribute mean? I can't find anything understandable on the Internet