#archived-networking

1 messages · Page 77 of 1

spring crane
#

Well gotta sort out that collision problem

weak plinth
#

the collision does occur, i just want to find the colliding player

#

but the way i do it only happens locally

spring crane
#

Unity provides collision events

weak plinth
#

i know

#

but the way i do it only happens locally

#

@spring crane

spring crane
#

Yea you don't get physics with naive state transfer

weak plinth
#

so what do you suggest i do

spring crane
#

Quick fix could be using triggers slightly larger than their real collision geometry

weak plinth
#

collisions do occur

spring crane
#

Could also have the local clients broadcast when they collide with relevant colliders

weak plinth
#

im trying to figure out what col.gameobject is through the server

spring crane
#

Oh just send the gameobject as a param if it has photonview attached

weak plinth
#

how do i do that?

spring crane
#

First example shows how to send 2 strings

#

You can just pass GameObjects in that have photonviews attached to them.

weak plinth
#

i still don't understand

spring crane
#

You wanna send col.gameObject with the RPC, right?

weak plinth
#

yes

spring crane
#

Compare your RPC params with the chat example

#

The extra params on the call map to the PunRPC's params

weak plinth
spring crane
#

That is part of it, yes

weak plinth
#

so where would i put it here: photonView.RPC("addkill", RpcTarget.All);

#

i think i figured it out

#

i get these errors

spring crane
#

@weak plinth Does the GameObject have photonview attached?

#

The one you are trying to send

weak plinth
#

Yes it does

#

it’s another player

spring crane
#

Pretty sure PUN would automatically convert it to some ID 🤔

#

Alternatively you probably can grab the ID from the photonview yourself, send that and then get the photonview on the other side from some collection in PUN with the ID

weak plinth
#

oh

#

so what do you think I should do? This is really confusing 😅

spring crane
#

First post on the thread has the solution

#

You can't reasonably send GameObjects over the network, but you can some ID representing it on all clients

#

The ID part is handled by the PhotonView component

tropic creek
#

does photon cost money for online multiplayer? I am a little confused because a lot of people told me it doesn't but here it sais different, ping me if you know the answer. thanks

lunar sage
#

i need someone to help me test the multiplayer download link:

graceful zephyr
#

@tropic creek yes it costs based on ccu

lunar sage
#

nvm it didnt work for him becuz of regions

high girder
#

Anyone familiar with async sockets? I'm banging my head against the wall here.

#

I've just copied code from a unity test project to a stand alone .net core app.

#

When running in the net core app, the code works fine and it connects to the server and transmits the data, but when running the code in unity, it doesn't connect.

#

the code is identical in both

#

and I've checked the firewall isnt blocking unity

#

in unity, the connection is driven by pressing a UI button. It is only when you stop playing that the server shows the attempt to connect.

#

but there is no data

#

Relevant code...

    {
        AttemptingToConnect = true;
        try
        {
            Debug.Log("Attempting to connect to " + address + ":" + port.ToString());
            var IP = IPAddress.Parse(address);
            socket.NoDelay = true;
            socket.Blocking = false;
            SocketAsyncEventArgs e = new SocketAsyncEventArgs();
            e.RemoteEndPoint = new IPEndPoint(IP, port);
            var data = GetLoginBytes(Username, Password);
            e.SetBuffer(data, 0, data.Length);
            e.Completed += SAEAConnect_Completed;
            if (socket.ConnectAsync(e) == false)
            {
                Debug.Log("Connect completed synchronously");
                SAEAConnect_Completed(null, e);
            }
            Debug.Log("End of Connection Attempt");

        }
        catch {
            Debug.Log("Error connecting.");
        }
    }

    private void SAEAConnect_Completed(object sender, SocketAsyncEventArgs e)
    {
        Debug.Log("Entering Connect Complete");
        if(e.SocketError == SocketError.Success)
        {
            Debug.Log("Connect Success");
            IsConnected = true;
        }
        AttemptingToConnect = false;
    }```
#

Unity says it has connected. but the server doesnt show that a connection attempt was made

high girder
#

anyone any ideas?

high girder
#

Seems there is a bug in unity/mono runtime.

#

I made a second button that sends data

#

as soon as you press it the server registers the connection attempt

#

but the data sent with the connection attempt is never received, only the data sent from the 2nd button

#

The .Net API says this....

#

"Optionally, a buffer may be provided which will atomically be sent on the socket after the ConnectAsync method succeeds. In this case, the SocketAsyncEventArgs.Buffer property needs to be set to the buffer containing the data to send and the SocketAsyncEventArgs.Count property needs to be set to the number of bytes of data to send from the buffer. Once a connection is established, this buffer of data is sent."

#

for the connectasync method

sly fable
#

@spring crane i want the server to save tho

#

like the changes they make to the multiplyer world to be permanent for that server

graceful zephyr
#

@high girder SocketAsyncEventArgs works in unity

#

But there’s numerous bugs and caveats iirc

high girder
#

this seems to be one

#

it is working now

#

but data is not sent when accepting

#

when connecting*

#

only afterwards with sends

graceful zephyr
#

Idk I don’t use tcp sockets much

slim ridge
#

async is weird, try threads

graceful zephyr
#

Asynchronous stuff in unity is really crap

#

Tbh

high girder
#
    {
        netClient.Connect("127.0.0.1", 26000, "testuser", "Test321");
    }

    public void SendData()
    {
        var data = netClient.GetLoginBytes("senduser", "test123");
        netClient.SendData(data);
    }```
#

as you can see, I never receive the connect user and pass, only the subsequent send

graceful zephyr
#

Sending data in a connection request should not be possible

high girder
#

as i pointed out, the net api says "Optionally, a buffer may be provided which will atomically be sent on the socket after the ConnectAsync method succeeds."

graceful zephyr
#

Yeah so mono probably doesn’t do this

high girder
#

thats what i figured

graceful zephyr
#

And I’d agree with mono here

#

But if the api is what it is of course they should comply with it

high girder
#

i dont know enough about TCP to know if data can/cant be sent when a connection is being negotiated

graceful zephyr
#

Can’t

high girder
#

hmm,

graceful zephyr
#

What .net is doing is sending it after completing the connection

#

Which is just word

high girder
#

yeah

#

the net api doesnt say it is with the accept, only that it is "atomically" sent afterwards

#

whatever that means

#

i still find it very odd that the server doesn't show a connection attempt until data is sent.

#

almost like unity is holding off from establishing the connection

spring crane
#

@sly fable You need to provide more requirements to get useful answers

sly fable
#

@spring crane like if they make a change to the landscape inside the game server i want that change permanent even if someone else logs onto the server

#

i dont want the server to reset

graceful zephyr
#

@sly fable that is a lot of work

#

like A LOT

sly fable
#

couldn't i just keep a dedicated server running and then if i do want to shut it down just save the servers state or sum

spring crane
#

Yes

sly fable
#

u guys have any resources i could look at to try to accomplish that?

#

ive been looking around but havent rly found anything that good yet

graceful zephyr
#

yeah but that description

spring crane
#

You can do it the same you implement saving in the singleplayer games you make before doing networked games 8-)

graceful zephyr
#

"have the server running then just save it when i shut down"

#

is like someone saying: "just build the house"

#

in explanation of what needs to be done to build a house

#

like..

sly fable
#

i wouldnt be shutting it down often

#

id want it running long periods of time

graceful zephyr
#

yeah unity doesnt really... do that

#

without leaking memory and being a generally unstable POS

#

i dont know anyone which keeps a unity instance running for days on end

spring crane
#

Just have the world end every 7 hours 8-)

high girder
#

@graceful zephyr seems data can be sent on the ACK of the TCP connection establishment. When i run my code on .net core and look at the packets in wireshark, the TCP ACK packet contains the data. When the exact same code is run in unity, the data isn't there and never gets sent.

sly fable
#

well resets every few hours wouldnt be an issue i just assumed saving everything and then reopening the server in its previous state would be more work on unity than just leaving it open

#

there would be like a ton of moving parts to it essentially wouldnt it be hard to try to save all those values?

spring crane
#

It would be easier if it really were an option

#

Apart from systems in Unity probably not handling being alive for extended periods of time gracefully, how would you handle updates?

sly fable
#

i would have the server shutdown during updates

#

its a webgl build so the site im using it on id update the webgl then reopen the server

weak plinth
#

Wondering the difference between Photon Bolt, Realtime and Photon Server. Currently looking to swap out our authorative solution with a HLAPI solution. Wondering what the best product would be for realtime games, done authoratively with options of self hosting the servers

#

And if going with bolt, offers the option to self host later on

marsh bison
#

How can I put a rotation corresponding to transform.up (of the gameObject that is instantiating the new object) into PhotonNetwork.Instantiate? I tried Quaternion.FromToRotation and LookRotation, but the only Quaternion that I could get to work was Quaternion.identity.

tropic creek
#

Hi, I want to test something with my game can someone help me? thanks

marsh bison
#

@tropic creek For most testing, you can make a build (command b on mac) which lets you play both in the build and in the game display window.

weak plinth
#

Can anyone play a mirror example game with me so I know how to connect to other people online?

#

WE can play

#

do you have already it setup?

#

cuz I want to know how mirror works too

#

@weak plinth

shrewd glen
#

You'll want to integrate some sort of database like sql. Not sure how detailed you'd want terrain changes to be. Minecraft will be a lot easier than say EQNext. And I would stay away from webgl @sly fable

sly fable
#

why would i want to stay away from webgl? @shrewd glen

#

i guess the performance isnt that good

shrewd glen
#

Well its a lot of "my opinion" lol. Use whatever you are comfortable with.

sly fable
#

id be down for either i just wanted something people could play without downloading

#

but do you think itd be easier to make a somewhat large world in a multiplayer atmosphere without webgl?

shrewd glen
#

Are you talking an mmo? And no matter how you slice it, the user will have to download your content.

vagrant raven
#

does anyone know the most efficient way to publish multiplayer webgl builds to an io domain?

#

I own a domain and ssl but what sites are most commonly used for web hosting and database?

topaz swallow
#

Hey Guys what do you think its the best Player Controller technique for top down player movement in multiplayer with photon PUN

weak plinth
#

Can anyone help me connecting to people online with a Unity networked game?

#

There may be some kind of port forwarding issue or something

topaz swallow
#

@weak plinth I do not reccomand UNET because it will be removed after some time

weak plinth
#

I am using Mirror

stone gate
#

well, if you want to play online multiplayer and not lan, you have to port forward or buy a server

weak plinth
#

isn't unet going to come back in the future though? I heard something about unity planning to come with a new network solution in the near future

#

@stone gate oh I didn't really know that. Are there any guides on that?

stone gate
#

tbh im also pretty new to unity networking. i only have minecraft multiplayer knowledge xD. but i dont know how to do it. i just think thats what you have to do @weak plinth

graceful zephyr
#

@weak plinth no unet is abandoned and dead

#

It was a bad library to begin with and the libraries that molded themselves after it in the wake of it being abandoned are not much better

stone gate
#

he said hes using mirror

#

i also use mirror

graceful zephyr
#

It has all of the same problems as unet did originally

#

Architecture wise

stone gate
#

yea, but mirror have fixed some problems i think so

gleaming prawn
#

Fixed (some/most) bugs, and added a few convenience features AFAIK.

#

Issues that existed due to the original approach/architecture being bad to begin with are not "fix-able". You either do it right or you do not.

sand lotus
#

I would suggest going with photon bolt

weak plinth
#

how do i send a photon id through an rpc and trigger a function on another gameobject with photon view based on its id?

stiff ridge
#

Why not call the RPC on the object you want to call the method on??

weak plinth
#

because what im trying to do is
player 1 collides with player 2
player 2 dies if health is 0
player 1 gets a point

#

but i dont know how to make player 1 get the point that isnt local only

stiff ridge
#

You can use Custom Player Properties for scores. There are a few extension methods for that. See PunPlayerScores.cs.

#

You have to decide, who detects that player 1 gets the point. Either it's player 1 or player 2, who sets the score. Both should know about the collision, in best case.
If you use physics (as in bouncing off one another), you should be aware that lag can be quite hard to hide. Just detecting collisions is easier.

weak plinth
#

player 2 detects the collision and gets the health taken away, but then i cant change the variable for player1

#

because i dont know how to access its script through photon

#

considering it's through collision

stiff ridge
#

You got the PhotonViews which are in the collision. Each view knows the Controller, which is a Player object. For that, you can set the score.

weak plinth
#

so do i get the colliding players photonview? and change the variable from there?

#

so far i have colplayer.GetComponent<PhotonView>(). how do i get the variable from here?
@stiff ridge

#

Hello,
has anyone used gRPC to communicate from a unity WebGL client to a server?
by default gRPC is not available on webgl builds and crashes build due to System.Threading. is any way to combine WebRTC with gRPC server or somethign?

weak plinth
stiff ridge
#

@weak plinth, the collision should give you 2 objects, which collide. the object of the player who gets a point, should have a PhotonView and that, has the Controller property, which is said player.

#

The custom type not found exception happens, when you attempt to send something that PUN does not know how to serialize (and send). Depends on what you use as parameters and as part of the message you want to send.

weak plinth
#

Oh

#

I’m about to head off for a bit but I’ll try it tomorrow, thanks

weak plinth
#

can anyone help test my game?

viscid tree
#

need some help here

#

went into firewall and allowed it for both private and public networks

#

also tried reinstalling unity

#

by deleting it and reinstalling it

#

and the problems presists

gleaming prawn
#

This has not to do with multiplayer/networking (which this channel is about)

#

This is related to Unity support on package manager...

#

@viscid tree

viscid tree
#

Im sorry

gleaming prawn
vagrant raven
#

does anyone know the most efficient way to publish multiplayer webgl builds to an io domain?
I own a domain and ssl but what sites are most commonly used for web hosting and database?

gleaming prawn
#

What do you mean most efficient way to publish?

#

I mean, the games (webGL) would run on the client's Browser... So for the hosting company where you store the WebGL build, it doesn't change a dime if the game is MP or not

#

It just transfers the HTML+JS+data from host to client browser (via HTTP)

#

That's it...

#

The game being multiplayer means you need to have something else (not the WebGL hosting solution) to solve your multiplayer question (which is a different problem)

#

Maybe you should be more specific with your question...

slim ridge
#

aws/google cloud/heroku/etc...

vagrant raven
#

@slim ridge thank you

earnest oxide
#

how can i set up p2p multiplayer using mirror without port forwarding?

weak plinth
#

hello its me again, how do find col.gameobject and change one of it's variables through RPC?

#

if i get its id and send it through a different rpc it doesnt work

spring crane
#

Post the RPC you are trying to call

weak plinth
#

hold on i've improved it

#

it decided to fix itself, thanks anyway

celest bane
#

I am using Unet anyone that coyld help me spawning prefabs, if I spawn prefabs they only spawn on the client they are spawned on

jade glacier
#

The Mirror guys are your best bet for Unet support, though you will likely want to migrate to Mirror.

marsh bison
#

I downloaded PUN 2 two months ago. Should I get the update? I fear that if I update it will no longer work.

jade glacier
#

A lot has changed, but you should try to keep up when possible. @marsh bison

#

Just commit your git before you try.

sturdy mountain
#

Someone mentioned that it was possible to upload code to Photon for server authoritative games. I can't see how to do it without having to contact someone....

jade glacier
#

I think you might be thinking of server plugins

#

they are basically C# scripts that the server can run to process events and messages and such.

gleaming prawn
#

in quantum you can also run the simulation on the photon server

sly fable
#

@shrewd glen i guess it would qualify as an mmo

oak flower
#

@knotty ocean Don't cross-post

knotty ocean
#

What's that mean cross post?

oak flower
#

Pick one appropriate channel to post in don't spam across the server.

knotty ocean
#

Ahhh

#

I neu

#

Ok I just need help

#

We're do you think it need s to be?

#

It's kinda more network be and physics deal not sure

#

Ok I will delete em and just leave one! Not sure if help will happen be any way honestly! Jus my experience so far with discord community thing

#

Thx

#

Thanks Gyes, Im better off search youtube or google for assistanc! Thats how I learned this stuff anyway! Nice Community and thanks for the invite bey

elder reef
hollow dove
#

Hello, how do I sync over network the changes in minecraft-like terrain (based on blocks), with worlds generated by seeds?

For example if player breaks a "block" and such

gleaming prawn
#

1 - You could use a deterministic algorithm to generate the same terrain (sharing just the seed) across game clients (the same blocks would get the same values, ids, etc)
2 - If it#s slow paced enough, then it would suffice to send the block ID that got destroyed (naive basic approach)

hollow dove
#

Yeah I was thinking about 1)

but how do I send changes too? like if bunch of blocks are broken after generation by player?

gleaming prawn
#

with 2

#

what I described is what you can do as a solution

#

IF you use 1 for generation, you can use 2 for communication (assuming changes are not super frequent)

#

If you want to go havok with this, you need a predict/rollback deterministic simulation...

#

That's what I do on a daily basis...

weak plinth
#

what's this mean

jade glacier
#

That your rpc name or arguments don't match your invoke most likely

hot totem
#

Hey, one quick question. Ive done py/js and a bit of java projects. My eye recently fell on unity to do something fun as a project. Im following some tutorials online to get the hang of the unity-UI. Now for the question: Ive read up on multiplayer and Ive seen in the unity-manual that its possible to convert a sp game to an mp game. I mean is that really possible ? Because reading up it seems like just adjusting the scripts or am I missing a crucial part?

#

I dont plan to convert full game or something. Just want to make something like a techdemo I can build upon then. Is it better to just start with mp in mind or flesh it out somehow in sp and then convert it

gleaming prawn
#

unity-manual that its possible to convert a sp game to an mp game.
No. At least not without a LOT of work. And even in that case it would probably turn out as a shitty online game.

#

BUT

#

You are new to unity, so first do something SP.

#

Don't venture into MP as your first project

#

Then later on, try another MP project

#

Starting as MP... But take your time

hot totem
#

Hm ok, thought turn based and d2 wouldnt be so hard, but well

gleaming prawn
#

MP is at least 10x harder to do...

#

turn-based does make a few considerations more relaxed, on the timing

#

But does not exactly make it simpler to implement...

hot totem
#

alrightyyy sp it is then

weak plinth
#

even if the photon id of the colplayerlocal is the same as col.gameobject, it still happens anyway

#

and it also won't destroy itself

sand lotus
#

Show spawn projectile function

hollow dove
#

Ah makes sense right! @gleaming prawn

Last thing I am wondering, how would you generate things based on random number generator like ore veins and tree and tree leaves? so they look random. Do I use noise and seeds? or do I do it the same way I do block changes syncing?

sand lotus
#

Do they have to be same across clients and server?

#

What you could do is multiple approaches

#

You could take a random with the same seed across all devices

#

And iteration should be in the same order

#

Generating a terrain across devices is hard to make it deterministic

#

For sure never use floats

#

Possibly pre generate a random generated lookup table of integer values

#

Possibly send from server

#

And generate from there only using integer operations

#

I gave up on this myself because the generated terrain was always slightly different between devices

#

Now I just store the heightmap splat map etc. Lossless compressed

#

And let server generate a terrain. It can freely use floats and whatever terrain tools. And the resulting random terrain is stored and send over

#

Important is also identification

#

You talked about blocks

#

Making sure block 5000 is the same across devices is also hard

#

Unless they iterate over the generation exactly the same

#

As example I found that most unity commands like getcomponentsinchildren

#

Are not same across devices

#

Not even same on the same computer between game starts

#

This is because unity shifts things around in memory to optimize it

#

So any list results are going to be in random order

#

Determism is very very hard stuff

#

Deterministic physics especially

#

I would not recommend anyone to try to do this themselves unless they know what they are doing

#

I would suggest you to look into photon quantum

#

They have it all

#

It's not free but for sure worth it

gleaming prawn
#

@hollow dove I'd use a deterministic RNG sequence, with the same key over the clients...

#

same way as the blocks

#

I think there's no point in clients having different looks for the trees (unless you explicitly want that). And you can just use the same technique

gleaming prawn
#

I'm one of the developers of Photon Quantum @sand lotus

#

A simple Deterministic RNG to generate exactly the same sequence of Integers (to create terrains and trees equal in several clients) is trivial stuff...

#

Not a problem at all.

#

I've used this approach countless times in the past (long before quantum).

#

AFAIK, even the Unity RNG is deterministic given the same initial Key (needs confirmation)

slim ridge
#

@weak plinth Rate Limiting is a good API feature if database is involved. It protects from running too many expensive queries too quickly.
Basically if you receive requests too fast from the same source respond with rate limited error and use an exponential backoff so that legitimate clients can recover from it.

spring crane
#

Maybe your own servers should be the only authority on spawning and despawning items

barren fossil
#

hello, could someone help me about getting an image from a php file and setting it as a texture in Unity? Thank you so much.

tepid gull
#

Hey I have this problem where things that I try to Spawn don’t spawn. Like I have 2 instances of the game that are connected, and they both are supposed to spawn spaceships that the players put together. The server host player’s ship appears on both screens, but the other player’s ship does not. Any idea what may be wrong?

#

heres a video showing it

#

pls help ive been trying to fix this for 2 days

jade glacier
#

Be sure to indicate the library you are using, and show your relevant code.

knotty timber
#

Hi all can anyone tell me when Its only setting the parent of one of the game objects (createWeapon(weaponItem,leftBlaster) ??

#

so basically it spawns the 2 weapons, but only sets the parent of 1

#

So if I comment out 1 blaster, it will set the parent dosn't matter which one I choose. It will only do one

slim ridge
#

perhaps because both weapon have the same name

weak plinth
#

looks like you're getting the same item and reparenting it

knotty timber
#

any ideas how to fix without changing name? I need to use the same gameobject and spawn it in 2 different locations

weak plinth
#

I don't use photon, is there a type of entityID that you can use instead of name?

slim ridge
#

first try changing the name and see if that's the actual issue

#

if it is the issue, i'd just tack on "left" or "right" onto the name

knotty timber
#

ok

tepid gull
#

(using the in-built unity networking) Hey I have this problem where things that I try to Spawn don’t spawn. Like I have 2 instances of the game that are connected, and they both are supposed to spawn spaceships that the players put together. The server host player’s ship appears on both screens, but the other player’s ship does not. Any idea what may be wrong? Ive been working on this problem for 2 days so any insight would be greatly appreciated. thanks!

Heres a video of the problem in action:
https://imgur.com/Glyl6hz

And heres my code:
https://hatebin.com/secoseiurf this is the code for the dotted boxes you see in the video, they spawn the blocks when the "Start" button is pressed. Because they dont have network identity (and cant due to being children of something that does) they tell the Player Prefab (script 2) to spawn the blocks instead of doing it themselves. I have tried moving things around so that they themselves call the Spawn() function but it did not change anything.

https://hatebin.com/mpqzjadbvr this is the code for the Player Prefab, which assigns blocks to the dotted boxes among other things such as controlling components after they are placed. The line that will likely be of most interest is at the very end, the CmdSpawnObject() function.

Thank you!

knotty timber
#

still same issue

#

@weak plinth the is a photon ID

#

@slim ridge yeah I cahnged the name same issue

weak plinth
#

instead of gameobject name in the RPC, send photon view id

#

then childObject = PhotonView.find(id)

knotty timber
#

ok

#

@weak plinth dam trying to get the id dunno how to write it. lol

weak plinth
#

@knotty timber
in createWeapon, do weaponObject.GetComponent<PhotonView>().ViewID

knotty timber
#

ok

#

@weak plinth I set this up wrong as well

#

public void ParentWeapon(string child, string parent)
{
Debug.Log("Adding Weapon: " + child + ": to :" + parent);
GameObject childObject = PhotonView.Find(id);
GameObject parentObject = GameObject.Find(parent);

    childObject.transform.parent = parentObject.transform;
}
jade glacier
#

Keep in mind you don't need to send the viewId of who is sending the rpc, it's intrinsic.

knotty timber
#

ok so whats a better way of writing this?

#

I put that snippet in here

weak plinth
#

@knotty timber
change to public void ParentWeapon(int id, string parent)

knotty timber
#

@weak plinth sick dude

#

just a lttle tweak and it worked

weak plinth
#

good to hear

knotty timber
#

ty @weak plinth

#

@weak plinth if you want to see my space sim game send me a pm buddy

tepid gull
#

(using the in-built unity networking) Hey I have this problem where things that I try to Spawn don’t spawn. Like I have 2 instances of the game that are connected, and they both are supposed to spawn spaceships that the players put together. The server host player’s ship appears on both screens, but the other player’s ship does not. Any idea what may be wrong? Ive been working on this problem for 2 days so any insight would be greatly appreciated. thanks!

Heres a video of the problem in action:
https://imgur.com/Glyl6hz

And heres my code:
https://hatebin.com/secoseiurf this is the code for the dotted boxes you see in the video, they spawn the blocks when the "Start" button is pressed. Because they dont have network identity (and cant due to being children of something that does) they tell the Player Prefab (script 2) to spawn the blocks instead of doing it themselves. I have tried moving things around so that they themselves call the Spawn() function but it did not change anything.

https://hatebin.com/mpqzjadbvr this is the code for the Player Prefab, which assigns blocks to the dotted boxes among other things such as controlling components after they are placed. The line that will likely be of most interest is at the very end, the CmdSpawnObject() function.

Thank you!

graceful zephyr
#

@tepid gull UNET is broken, buggy, abandoned and old.

#

don't use it.

tepid gull
#

What should I use instead? I’m pretty new to all this networking stuff

graceful zephyr
#

Mirror

tepid gull
#

Ok I’ll give it a try, thanks!

weak plinth
#

i tested it and colplayerlocal is always 0, even though i change it in the rpc

#

any ideas?

tepid gull
#

I just started using mirror and i am a little confused by this error i just encountered. I am adjusting old code to work with mirror and this happened: (See Image 1). The error tells me i need to have a network identity when i clearly do (see image 2). Furthermore, the scripts in the mirror examples do not use "using UnityEngine.Networking" at the top so i thought "oh maybe it thinks i need the UNET network identity instead of the mirror network identuty because im using this thing at the top of my code" but removing it causes the script to not work entirely, saying that "Assets\Scripts\Network\NetworkMasterScript.cs(7,36): error CS0246: The type or namespace name 'NetworkBehaviour' could not be found (are you missing a using directive or an assembly reference?)"

so im just a little confused about this, any insight would be greatly appricieated. thank you!

code that Im using
https://hatebin.com/qlsqqevyle

example of the mirror in-built examples not using the "using unityEngine.Networking":
https://hatebin.com/zqedqhtdpg

undone spear
#

What should I do to begin with networking in unity? I literally know nothing about it

#

I need to make some multi user aspects of an app I'm making

#

and I don't know where to start

#

is there a video series or tutorials I can look at?

#

I don't know what to look for

jade glacier
#

Mirror and Photon Pun2 are were most people start.

undone spear
#

So how do I start using those

#

i mean what's a good tutorial series to use one of those

#

I guess I could google it

elder reef
#

Are there any platforms you guys know of that will allow my to easily run a server stress-test multiple clients? I already wrote a simple script that simulates a player connection, authentication, and movement packets, etc. I just need to get it onto a bunch of machines and run it. I've had so many issues getting my AWS account setup so that's out of the question, it's been locked and pending approval for 6 months.

tepid gull
#

Assets\PlayerObjectScript.cs(6,35): error CS0246: The type or namespace name 'NetworkBehaviour' could not be found (are you missing a using directive or an assembly reference?)

#

??

#

how can i use mirror when i cant use NetworkBehaviour?

#

pls help

elder reef
#

Do you have using Mirror; at the top?

#

Also, Mirror has a huge discord that will help you out with anything mirror related.

#

@tepid gull

tepid gull
#

i will try this thank you

#

and i will also check out that discord server

weak plinth
#

any ideas how left 4 dead networking works with so many zombies?

#

How feasible is it to make your own network code in comparison to using Mirror or Photon? Because I feel like Mirror, while probably good, takes a lot of time to figure out how to do specific stuff by yourself

gleaming prawn
#

How feasible is it to make your own network code
I'll rephrase the question to early 2010s:
How feasible is it to make my own engine compared to using Unity?

#

Possible, yes...

#

Makes sense? Only if your plan is to create a netcode library (not a game), and you have A LOT of time to spare on it.

#

Don't underestimate how much work it is to build a proper netcode library... I'm one of the developers of Photon Quantum. We've been working on it for almost 4 years.
We started with 2 developers (fholm, lead dev/inventor + me).
Now we're a team of 12 (just for quantum, not other stuff we use from photon to build it - 5 just for the core library) and we always have new features to add, always.

weak plinth
#

true but then again you are making a general purpose networking game library

#

I just need my game to work

gleaming prawn
#

It will still be daunting...:)

weak plinth
#

yeah probably

gleaming prawn
#

These libraries are made to make your game work.

#

Any of them. I'm not pushing for any of our products

#

Depending on what you are doing, Mirror has a great community, and is easy to use as well (same can be said for PUN2)

weak plinth
#

but I find myself asking a lot of help on Mirror how to do this how to do that because while people do end up helping, it's sometimes a lot of waiting until someone answers

gleaming prawn
#

How experienced are you?

weak plinth
#

And not everything is clear from the documentation. It's great to follow a specific tutorial from a video or something and have it working but figuring out stuff myself is a lot harder

#

I have 2-3 years of programming experience but I'm new to networking

gleaming prawn
#

I'd say don't do it then

#

Take your time

#

Have you finished a single player game before?

weak plinth
#

yes several

gleaming prawn
#

One that you launched, other people have played and liked

#

Then could be the right time to try a multiplayer one, ye

#

JHust start with something very very simple

weak plinth
#

no I haven't released a succesful singleplayer game yet, but I've finished about a dozen SP projects and published two minigames

#

I want my game to be multiplayer tho

gleaming prawn
#

Please, do not start with MMO/Survival/Brawler|Fighting Game, etc... These are (in its own ways) the most challenging (and not fun to do)

#

Go for it (MP), just don't start with anything too challenging

#

You said you finished a dozen SP, published 2 of them

#

If you start trying with half a dozen mini MP games, one at a time (try Mirror, try PUN, etc), you'll learn a lot, and will figure many things.

weak plinth
#

PUN is photon?

gleaming prawn
#

Same path you probably took to write these 12 SPs

#

ye

#

just for prototyping, use the free stuff

#

PUN2, Photon Bolt (they all have free)

weak plinth
#

ok

gleaming prawn
#

Mirror (fully free for the lib)

#

I bet your first SP games were not something like The Last if Us, right?

weak plinth
#

nope

#

although my first SP project was actually pretty good for my first but it did take me the longest time aswell

gleaming prawn
#

I can't answer for Mirror, also do not know what kind of question you have asked

#

Normally people answer better when you have a very clear technical question (showing you already know how to do things properly, but faced a genuine design-decision to be chosen, etc)

weak plinth
#

ok thanks

weak plinth
#

@gleaming prawn hey, do you know how could left 4 dead handles many zombies in multiplayer?

#

4 players but like 50-100 zombie NPC

slim ridge
#

probably determinism

#

or really good compression :S

gleaming prawn
#

really good compression AFAIK

#

AND scoping

#

AND scheduling

jade glacier
#

I also wonder how in agreement clients are with zombie hordes, and how much slop is allowed since its coop.

elder reef
#

I'm severely doubting determinism. You're not going to have many problems with 50-100 Networked NPCs.

#

You just need to make sure you're not spamming update packets every frame for every npc.

#

A single packet per frame containing only relevant information for the npcs that need to be updated is all you need.

#

I say "packet" loosely, as I still call streamed data in TCP packets even though they're not.

#

Also depending on your game scale and positional relevance, you can lower a Vector3 (position) into just 6 bytes while still supporting decimal positions to the thousandths.

#

@weak plinth

#

Definitely the wrong channel, :P.

weak plinth
#

100 zombies 20 states/sec for vec3 position + 1 byte for yaw. doesn't sound like much even before compression

elder reef
#

It's a little more in-depth than that, but yeah, it's not a lot.

#

But using most of these out-of-the-box solutions your game/client/server would likely explode.

#

At 100 zombies you could milk that down into being either 3 bytes or 9 bytes each including rotation, position, and animation. That'd give you between 300-900bytes of data per message including X(1-2) bytes for an opcode header. That will result in ~5.8KB - ~17.6KB in data per second at 20hz. Before compression.

#

You could play it on dial-up! 😮

#

Okay, not really [But maybe on a 56K modem]. But it's pretty low consumption.

#

Note: I didn't calculate TCP Header size here, but it'd only add 400 bytes total.

graceful zephyr
#

The main benefit of determinism isn't reduction in bandwidth, in some cases (with a lot of clients) it can even use more bandwidth (although this is rare).

#

The main benefit is how fucking simple it is to build a deterministic networked game

#

@elder reef

elder reef
#

Determinism is a simple concept for sure, but execution isn't as black and white especially when you start talking about physics.

graceful zephyr
#

huh

weak plinth
#

didn't you make quantum?

elder reef
#

Let me rephrase.

graceful zephyr
#

@weak plinth yes im the original inventor/lead on it, team is rather big now tho

elder reef
#

I'm coming from the point of view of the average developer that will only ever use built-in Unity tools.

weak plinth
#

ah thought I recognized. gj nice to see it growing, last I saw was few years ago when it was very early on

elder reef
#

Last I saw Quantum it had a price-tag/month more expensive than my car for a single-developer license. Lol.

graceful zephyr
#

So?

#

i never mentioned quantum once lol, someone else did

#

FWIW your estimation on bandwidth for 100 zombies is off by a lot

elder reef
#

Yeah? Could you explain? Definitely don't want to be sharing false info.

graceful zephyr
#

how ur going to pack in position, rotation, object id, animation state, etc. into 3 bytes i have no idea

#

so obviously it's off

#

didnt' even need to read the rest

elder reef
#

My estimation was based on a single player receiving information for the zombies in a single packet.

#

Ah, object id. Whoops.

graceful zephyr
#

also assuming u need more than pos+rot+anim state

#

that is very little data to build game logic out of

elder reef
#

I was being minimalistic following the directive of the conversation that only mentioned position + yaw. Using a flag you can determine if the position needs to be updated, there's no reason to add the position to the buffer if it doesn't need to be modified on the client.

graceful zephyr
#

object id is usually ~8 bytes and can't be encoded in a lossy encoding

elder reef
#

I definitely overlooked determining which object the update was for, I can't ignore that.

graceful zephyr
#

so say ur looking at, minimum 12 bytes per zombie or something like that

#

1.2kb x 20 second

#

for just that data, nothing else

#

it's not feasible

#

anyway, useless argument

#

¯_(ツ)_/¯

elder reef
#

DOH. I see what my dumbass did.

#

I did bit/byte conversion on the byte, lol.

#

Whoops

#

Just out of curiosity, what would you consider a feasible amount of bandwidth for 100 networked on-screen entities?

graceful zephyr
#

depends on what ur building

#

if its ONLY those 100 no other gameplay

#

fine yeah

#

u can get away with 1.2kb x 20

#

but 20 is a pretty low packet rate by todays standard

elder reef
#

Completely agree. I'm only asking to optimize my own implementations as I'm doing the best I can without much guidance. Lets say for example, it's COD Zombies. Non-Deterministic. 30hz. 100 Zombies. 1 Player. Zombies have a position, yaw, and animationId (keeping it simple).

graceful zephyr
#

yeah but they ahve way more than that

#

its not a valid cases

#

have WAY more networked data than just pos/yaw/one anim id

elder reef
#

Sure, but by taking your example I can add the additional data to those entities and calculate.

#

I've never played zombies, but I assume they have quite a bit of stuff going for them. Health, Speed (for interpolation, maybe?), Zombie Type are just a few I can assume exist.

graceful zephyr
#

long since i played it ¯_(ツ)_/¯

elder reef
#

I'm more-or-less just looking for a baseline to compare against, lol. Even if it's just a MMOG where everyone can do nothing but walk around.

graceful zephyr
#

there is no baseline

slim ridge
#

unh tss unh tss un tss womp womp

weak plinth
#

Currently looking at Unity multiplayer options, and Photon Bolt comes up a lot in terms of a feature packed option. What's the performance like terms of maximum player count in a player authorative setting (Assuming it varies quite a bit depending on tick and send rate)?

graceful zephyr
#

@weak plinth built for around 32-40 players max, comes with a lot of baked functionality yes

weak plinth
#

I assume that number goes up with less state to be observed, using events instead of state for stuff and lower tick rates?

graceful zephyr
#

im also the original author of Photon Bolt so im biased

weak plinth
#

Perfect person to ask then, if you don't mind 😅

graceful zephyr
#

im busy with other stuff

weak plinth
#

Haven't given Mirror a go, would you say it's worth checking out in terms of higher CCUs in one instance? Heard quite a bit about it's instabillity, but being able to have higher "player" counts

elder reef
#

I've used mirror in the past and it was quite easy to setup and get going.

#

There's a massive community surrounding the library also.

weak plinth
#

Seems like there's a ton of breaking changes constantly 😅

elder reef
#

Yeah...

graceful zephyr
#

wouldn't touch mirror with a 10 foot pole

elder reef
#

That's a thing that definitely happens.

graceful zephyr
#

dependes a bit on what ur doing tho

#

like is it a hobby thing

#

fine w/e doesnt matter

#

if u actually gonna launch a game that u need to be commercially viable

#

then look elsewhere than mirror

weak plinth
#

Compensation between scope and performance. Don't want to spend 2 years developing my own low level layer to work with the game, but also don't want to go at a loss in terms of player count just for ease of use.

elder reef
#

What are your goals for the game, that's the real question.

weak plinth
#

To be released for sure 😅

elder reef
#

That's not what I meant. I mean like, what type of game are you trying to create, will it be player or server authoritative, and how many players do you need to have on a single server? Can players be split between multiple servers via some sort of node system? etc.

weak plinth
#

Single world, server authorative, and I'd say around 80-120 players per instance

graceful zephyr
#

first MP project?

#

say goodbye to ever finishing that as your first mutliplayer project, hell say goodbye to ever finishing that ever, in the history of the world, by yourself.

weak plinth
#

No, done my own layer before done with Dark Rift, with client prediction and reconciliation but it takes too long and most fixes revolve around the network layer rather than the game itself

#

Own transport layer for the game just seems to be overscoped...

graceful zephyr
#

the game u want to build

elder reef
#

Prediction and Reconciliation with mirror already destroys the NetworkTransform and NetworkAnimator components that they have, however there is an Experimental component that makes it less of a hassle.

graceful zephyr
#

is not possible to build yourself

weak plinth
#

I'm not by myself luckily 😅 With 6 others in different areas

#

2 programmers where one is myself, 2 environment artists and 2 character artists. Still small

graceful zephyr
#

bolt was not build for 80+ players

#

mirror is shit for this

elder reef
#

Personally, I wouldn't go with mirror if you want that many players either.

graceful zephyr
#

all other netorking tech for unity is not doable with this

#

u have to build custom for this

#

nothing exists today that can do it for you

#

for unity

weak plinth
#

yeah... Gut feeling tells me to keep developing on that networking layer. Just curious if there were any solutions for that "type" of game

#

RIP uLink

#

Already have animations synced, player positions rotations everything, done interpolation myself from scratch

#

Just takes time unfortunately

#

Well, cheers for the info fholm. I'll have a chat with my right brain (other programmer) and see where it goes. Seems like own layer is the most "mature" solution

sand lotus
#

yeah if you want to make any real game you have no option here

#

either make it yourself

#

or use photon Quantum

#

But don't base your own thing on something bad

#

like don't use mirror

#

will just be shooting in your own foot

#

dont use unet

#

even worse

weak plinth
#

Not at all based around anything at the moment 😅

sand lotus
#

dont use the new unity multiplayer package, its horrible

#

Possibly the best you can do is build everything from scratch on UDP sockets

weak plinth
#

Player sends input and adds it to own buffer -> Tick Happens and all players move, including yourself locally -> Your local predicted client is a invisible ghost with the character controller on it, you interpolate to that "ghost" over time -> Other clients info is received and interpolated to

sand lotus
#

but if you have to use some kind of transport, you could opt to use Enet, its working well

weak plinth
#

ENet does look quite juicy, but it adds more work compared to DarkRift where serialization/deserialization is built in

#

Everything is built on a abstraction layer so I could swap it out later - but more work

sand lotus
#

but darkrift is hot garbage

#

especially the things you mention are terrible

weak plinth
#

In which sense? 😅 Quite nice to work with

sand lotus
#

haha

#

isen't darkrift even using TCP for reliablity?

weak plinth
#

Yes, but only using TCP for events

sand lotus
#

oh god

#

🤣

#

Please move away from that as soon as you are able

weak plinth
#

Know TCP isn't quite known for its use in realtime games 😛

sand lotus
#

Using both UDP and TCP traffic on the same pipe is like idiotical stupid

#

basically TCP traffic will push out all UDP traffic as soon as the going starts to get going

#

Besides the implementation of the rest is shite at best

#

and probably peforms bad

weak plinth
#

Well, tbh the performance is quite good atleast from our community stress tests, everything considered

#

but then most of our packets are not TCP, player serialization for new connections and sound events are the only things restricted to it

sand lotus
#

I woulden't hold my hand/game in the fire for that

weak plinth
#

but I have no doubt that ENet is quite good, just more work

sand lotus
#

You are stuck on serialization for it?

weak plinth
#

Somewhat yes, I know that might seem silly

sand lotus
#

Try this for serialization

#

Bitbuffer class there and it's friends

weak plinth
#

Oh I see, that doesn't look quite bad tbh, has a example that DarkRift uses a lot which is to identify what ID each packet has

#

Might give it a shot once I have time... but general consensus seem to be that all HLAPI solutions are out of the window

#

completely

sand lotus
#

yes

#

for sure

#

darkrift too

weak plinth
#

👀

elder reef
#

MMONET When

weak plinth
#

Well, might swap out dark rift when the time is needed - No small task to do so and ensure it works to the same extent

sand lotus
#

thats the pain you get when you jump on some random networking tech you find on the unity forums

#

but from the description you gave you are able to implement some networking concepts

#

so why you are using such software is beyond my understanding 😄

jade glacier
#

Be sure in stress testing to add packetloss

#

Then you will really meet your net code

weak plinth
#

Quite well surprisingly, we had NA players on from EU

#

I don't have tools setup like clumsy to test yet

#

And vincenzo, the right tool at the time

#

Had I known other tools I'd had used them at the time 🙂

jade glacier
#

Test for packeloss asap

#

If things break, you will have a lot of rework to do

sand lotus
#

guess his internet died 😄

weak plinth
#

yeah classic triple discord message 😂

jade glacier
#

packetloss ironically 🙂

weak plinth
#

Mine is quite laggy as well at the moment, seems to take 2-3 seconds for the messages to be sent

#

Discord in general seems to be laggy.

#

What timing 😂

sand lotus
#

that is TCP networking for you

jade glacier
#

not lag though, that breaks things in a different way than loss

sand lotus
#

lol

weak plinth
#

👀

#

👀

jade glacier
#

not lag though, that breaks things in a different way than loss

elder reef
#

What the hell is happening.

#

Discord is having a stroke.

jade glacier
#

I lost my whole internet there I think

#

FB also wouldn't refresh at the same time

elder reef
#

Discord went down completely for like 2 minutes it seemed

#

Unrelated, but do any of you know of any good websocket stress testing tools?

#

Other than just spamming connections & data.

knotty timber
#

anyone know how to rotate a game object to face a target game object in photon?

stiff ridge
#

just like you'd do in Unity in general.

weak plinth
#

Anybody familiar with ENet that knows if there's a way to get the buffer out without using CopyTo. Rather not create a middle man byte array between the serializer and the packet received

weak charm
#

anyone know where i would go to learn unity networking?

#

i already have knowledge on the basics of networking that aren't engine specific

#

i've made node.js and gamemaker:studio game servers

#

and gamemaker:studio game clients

#

but never unity server or client

weak plinth
#

avoid UNET docs, look at third party solutions like photon. you can also roll your own with any udp library

graceful zephyr
#

@weak charm Nate is right above, all the built in stuff in unity is broken atm

weak charm
#

i heard from a friend that unet was deprecated, so thankfully i have avoided it

#

what are the pros and cons of photon?

#

i have heard of it before, and i know someone who has used it

slim ridge
#

@weak plinth i never used ENet, but I get that done using MemoryStream and BinaryReader/Writer. ArrayPool could also help

weak plinth
#

More so howto get the direct buffer out of Packet 😅 .

slim ridge
#

I guess you could use ArrayPool and CopyTo

weak plinth
#

I'll play around with it, thank you so much for the response Micken 🙂

jolly dew
#

Anyone have experience with unity https requests generating this error?
Curl error 51: Cert verify failed: UNITYTLS_X509VERIFY_FLAG_NOT_TRUSTED

slim ridge
#

unity needs the whole chain, or your chain is out of order

jolly dew
#

Chain?

weak charm
#

for anyone who might be wondering, i ended up not going with photon, as my friend who's working on the game suggested we try mirror

#

and i think it's pretty good

slim ridge
#

To use SSL you need to supply a certificate.

jolly dew
#

Does the cert need to be public, and in the code as a string?

slim ridge
#

i dont know what you called to produce that error

jolly dew
#

Code used.

using System.Collections;
using UnityEngine;
using UnityEngine.Networking;
using UnityEngine.UI;

public class Main : MonoBehaviour
{
    public AudioSource music;

    // Start is called before the first frame update
    void Start()
    {
        StartCoroutine(PlayTTS());
    }

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

    IEnumerator PlayTTS()
    {
        UnityWebRequest req = UnityWebRequestMultimedia.GetAudioClip("https://www.whirlwindproduction.com/01-01-%20Scars.wav", AudioType.WAV);
        req.certificateHandler = new AcceptAllCertificatesSignedWithASpecificKeyPublicKey();

        ((DownloadHandlerAudioClip)req.downloadHandler).streamAudio = true;

        yield return req.SendWebRequest();
        if (req.isNetworkError)
        {
            Debug.Log(req.error);
        }
        else
        {
            music.clip = DownloadHandlerAudioClip.GetContent(req);
        }
    }

}
using UnityEngine.Networking;
using System.Security.Cryptography.X509Certificates;

// Based on https://www.owasp.org/index.php/Certificate_and_Public_Key_Pinning#.Net
class AcceptAllCertificatesSignedWithASpecificKeyPublicKey : CertificateHandler
{

    // Encoded RSAPublicKey
    private static string PUB_KEY = "mypublickey";
    protected override bool ValidateCertificate(byte[] certificateData)
    {
        X509Certificate2 certificate = new X509Certificate2(certificateData);
        string pk = certificate.GetPublicKeyString();
        System.Console.WriteLine(pk);
        if (pk.ToLower().Equals(PUB_KEY.ToLower()))
            return true;
        return false;
    }
}```
#

Looking through it now, looks like
private static string PUB_KEY = "mypublickey";
should have my public key in it

#

Does that sound right?

slim ridge
#

mypublickey should be an actual key

jolly dew
#

yeah, like

string PUB_KEY = "3082010A0282010100C2EF9" +
                                                 "5EAC983CEFC1416C91629E1" + 
                                                 "C83641CBE4F4349DEDF4B61" +
                                                 "DEBB86399B23FE6B5FCC166" +
                                                 "0477FADF1ED1F6489D3C356" +
                                                 "B635A26E999B0BC2C82C076" + 
                                                 "ABD8EF966FC0CB0C3456382" +
                                                 "F7E8909B4E29908B24F6446" +
                                                 "72F6DC0A762C0B28B44A206" +
                                                 "35A86AB5DF037BFDFFB2ADC" +
                                                 "68CCEB7260211D05307475F" +
                                                 "5EE27D38740D899FA8C2FC0" +
                                                 "830D35A1B4D69016D127344" +
                                                 "FD9D17EB4F593374A8969AE" +
                                                 "8676FFE06CFE7EB9CAE1DE1" +
                                                 "DC2AAB9A2A2D4B32D2767DC" +
                                                 "4EA554B8D3F5327514FA8D6" +
                                                 "40BCB61C7D57AE6CC591A95" +
                                                 "D4D9CB60B3A6F02AB575351" +
                                                 "CED9412B8441AD2A3BF7DA2" +
                                                 "D0349747D141421993FC8E2" +
                                                 "DB051C6A22217E3269CCE81" +
                                                 "2632E26AA053F26D69DB23B" +
                                                 "50203010001";

Note, not my key and was online as an example so probably not valid

slim ridge
#

you tried setting certificatehandler to null?

jolly dew
#

no

weak plinth
#

I don't think I ever had to use a certhandler for https webrequests

#

is that something new?

surreal silo
slim ridge
#

you have a gameobject with a script component and the script asset has been deleted or does not compile

knotty timber
#

Hi all looking for a c# networking programmer to join me working on my space sim game hobby. I have done a lot of work and have tried to implement photon but not sure its the right system to use. I can code a little but I am a 3D modeller so I am making all the 3D content. Only Pm me if your interested in this long term project and have a keen interest in crypto currency because I want to implement this later.

weak plinth
#

Are there any good guides on how to start with a dedicated server for Unity projects? I'm working with Mirror

frank meteor
#

Just a quick general question: Is there an asset or extension for easily implementing GGPO/Rollback netcode? Or would I be better off making my own?

graceful zephyr
#

@frank meteor only one that exists for Unity is Photon Quantum

weak plinth
#

does anyone know whats going on?

weak plinth
#

Should be the same as setting up any other dedicated server

frank meteor
#

@graceful zephyr I will look into that, thanks

jade glacier
#

You will want to join the Mirror discord if you are using Mirror and you are new to networking. @weak plinth

north grotto
#

Has anyone used normcore here? I have added in my own avatar. It all shows up fine in the editor and standalone build but I am controlling both players. I think I need to write something about localplayer so I only control the player in the client that I am using but I'm not sure how to implement this. Help would be greatly appreciated!

graceful zephyr
#

normcore is a fashion trend isnt it?

sand lotus
#

I never heard about it but google gave me this

#
gleaming prawn
#

I tried it...

#

Ultra-interpolated with their basic demo already

#

It's like a simplified PUN (with all the caveats when you simplify things) with some room-batching going on...

#

That's last time I checked

north grotto
#

ahh. I switched over to PUN now as the tutorials are so much better I think. What solution is everyone else using?

fair cosmos
#

Me miRRoR nEtWoRkInG!

sharp cradle
#

Hiho! Has any1 used SocketWeaverSDK? Is it any good?

#

@here

slim ridge
#

no, but it appears they have their own discord

oblique fog
#

I got a webserver that acts as an API for my unity clients. The Unity clients connect to the API via websocket. Everything works great.
Now, I would like the webserver to be responsible for knowing if the MatchMaker.ListMatches has a certain room active. Instead of having each client poll the unity's matchmaking service, I want the webserver to do it, and then it will let the clients know the state via socket connections.

Is there a way for me to make calls (like REST, or ajax, etc) from the webserver to Unity's match making server mm.unet.unity3d.com to find matches? If so, where can I find the reference?

oblique fog
#

I found out that their internal coding sends a POST request to the match making followed by /json/reply/ListMatchRequest with Accept=application/json header. It sends the data in the form of a WWWForm

wwwform.AddField("version", Request.currentVersion);
        wwwform.AddField("projectId", Application.cloudProjectId);
        wwwform.AddField("sourceId", Utility.GetSourceID().ToString());
        wwwform.AddField("accessTokenString", 0);
        wwwform.AddField("domain", req.domain);
        wwwform.AddField("pageSize", req.pageSize);
        wwwform.AddField("pageNum", req.pageNum);
        wwwform.AddField("nameFilter", req.nameFilter);
        wwwform.AddField("filterOutPrivateMatches", req.filterOutPrivateMatches.ToString());
        wwwform.AddField("eloScore", req.eloScore.ToString());
        wwwform.headers["Accept"] = "application/json";

So I tried to replicate this with Postman, but connection keeps getting refused. I'm assuming that there is a little more than that to it. Either needs some authorization or has to be the proper User-Agent?

slim ridge
#

yes, a POST request most likely does require credentials

#

try wwwform.headers["withCredentials"] = true;

oblique fog
#

@slim ridge What would the actual header formatting be of the withCredentails. Would it be With-Credentials ?

slim ridge
#

i dont know

oblique fog
#

Yeah I tried all kinds of ways. Didn't work.

slim ridge
#

don't they have some kind of support?

oblique fog
#

I don't know where I need to ask this...

formal moth
#

Hey all, fairly new to unity. Do most people use some separate HTTP client that i'm not aware of? Or are most people just using UnityWebRequests?

#

this is for just simple REST queries

oblique fog
#

well, before I implemented websocket setup, I used C# native HttpClient to send POST requests to my webserver API. Unity handles it quite well. I can't remember, but when I first build my app, I was trying to implement UnityWebRequest, but I recall running into a wall...I think something to do with it not playing well with C# async/await protocols. Again, I don't remember exactly, it was a while ago.

#

I do believe I have some of that old code somewhere stashed, haven't done code sanitizing just yet, as I am still in the middle of restructuring the networking architecture of my app to utilize the websocket implementation, and leaving behind the HttpClient/REST protocols.

#

If you want to see a simple example of the HttpClient usage, let me know.

formal moth
#

sure thatd be good to know

oblique fog
#

Where would you like the code posted? I'll search for it now.

#

Here is a snippet from it:

        public async Task<Response> Post (string url, Dictionary<string, string> payload)
        {
            FormUrlEncodedContent content = new FormUrlEncodedContent(payload);
            HttpResponseMessage response = await client.PostAsync(ParseUrl(url), content);
            return await Response.Create(response);
        }
#

I can send you the full script. It includes the Response class. It also includes a User class that has like SignIn Create methods that utilize this snippet, if you want a more broader picture.

formal moth
#

damn im surprised theres not the equivalent of axios in c# / unity

oblique fog
#

Yeah, but you can write you own (basic one) really quickly. That's kind of what I started doing with my script. But again, I hit the abort button on it now since I'm switching to socket protocol.

#

In the script you would use the Post like so:

var response = await server.Post("user/create", payload);
if (response.ok)
{
  // means the server returned a 200 code
}
gleaming prawn
#

@oblique fog you know unity deprecated unet, right?

#

And that don't give any support anymore...

#

You should seriously try an alternative like mirror or commercial tools

weak plinth
#

what are the commercial tools?

gleaming prawn
#

All the products from Photon (Realtime, Quantum, PUN2, Bolt), steamworks (just basic transport layer)- Also (I cannot talk about them because have not used much) normcore, improbable, darkrift, forge, and others...

weak plinth
#

how do i sync up a sprite through photon pun 2? i save the skin name as a playerpref and load it at the beginning of a match but that'll only work for local players.

weak plinth
#

i tried fixing it with custom properties but players turn invisible

stiff ridge
#

You can set a custom property with a string key and any (serializable) datatype.
You have to use SetCustomProperties() of the Player or Room. Don't modify the cached value like you did in that screenshot.
Use something along these lines:
PhotonNetwork.LocalPlayer.SetCustomProperties(new Hashtable() { { "skin", skinString } });

Per Player, you can then access the value and show everyone's skin.

undone sigil
#

@formal moth @oblique fog don't use HttpClient in unity cause it gives an exception saying "ReadDone1" for 10% of players when using TlS

weak plinth
#

@stiff ridge which one was modifying the cached value?

#

this is really new to me

#
PhotonNetwork.LocalPlayer.CustomProperties = _SkinCustomProperties;
_SkinCustomProperties["skin"] = PlayerPrefs.getstring("skin");

you want to replace that with

PhotonNetwork.LocalPlayer.SetCustomProperties(new Hashtable() { { "skin", skinString } });
#

alright

#

@weak plinth

#

at the top of your code put ```cs
using Hashtable = ExitGames.Client.Photon.Hashtable;

#

okayt

#

like this?

#

nah it doesnt work

#

players appear invisible @weak plinth

#

wwhat?

#

no i want skins to appear in general, someone else managed to do it with custom properties

#

but i cant make any sense of it

#

there isn't any problem, you call SetCustomProperties > the server recieves this and sends to clients > clients get OnPlayerPropertiesUpdate invoked and you set skin there

#

but why are players invisible then?

#

because you aren't setting the skin in OnPlayerPropertiesUpdate

#

so what do i do?

#

@weak plinth

#

that doesnt change anythingm

#

virtual method means you have to override it, so you put your code in whatever manager class implements MonoBehaviourPunCallbacks

#

???

#

i dont understand

#

the skin isn't changed during gameplay

#

this code isnt working either

#

@weak plinth

weak plinth
#

2400 photon views is a lot

#

do you know why players are still invisible

#

yes because you are getting player.CustomProperties["skin"] before the value is set

#

where do i put it?

#

what do i put where

#

you mean the playerpref?

jade glacier
#

2400 views is going to be testing the limits of just about any system. The initial RPCs alone might be enough to trigger a disconnect.

#

I changed MAX_VIEW_IDS To 1000

That is the default value. @weak plinth

weak plinth
#

Anyone got any ideas? I’m still stumped

gleaming prawn
#

local multiplayer does not tzransfer around anything...

#

of course it works...:)

slim ridge
#

not that i have any idea what a photon view is, but couldn't you handle all 10000 pickups with one view?

oblique fog
#

@gleaming prawn Yeah I know they deprecated it. I actually had to refer to older unity version docs to find their NetworkManager. The switch to Mirror is on my roadmap, but first I gotta fix some more immediate things. Do you know if JUST the api will be deleted in future release, or will the mm.unet.unity3d.com server also be taken down?

gleaming prawn
#

I have no relation to Unity, so I can't answer.

#

BUT, if it was MY game... I'd run away from UNet like a gazelle from a Lion

#

ASAP

oblique fog
#

lol thanks for the advice.

#

While I have you on here. Can I ask just how much of a difference would it be (and learning curve) to swap out unet for mirror?

#

And the only reason I am using unet is simply because of their free 20 CCUs. Does Mirror provide a free tier to start with?

slim ridge
#

photon has similar plan

weak plinth
#

Photon and UNET have cloud services, I don't think Mirror does since it's just an open source project replicating UNET's code

oblique fog
#

Oh thanks guys. I already made mistake implementing unet, I would definitely like to make the right decision before I start restructuring. So basically I need something small, free to start, enough to at least hold 20+ ccu without forking over a dime just yet. Need to see how the app goes first.

slim ridge
#

shouldn't a photon view be able to handle any number of unique objects?
All you really need is 1 message to tell clients where they are, and one whenever somebody picks one up.

weak plinth
#

I'm not sure of the scale. In UNET hlapi if you had thousands of network views it would serialize them all in one frame and send it out

jade glacier
#

Regardless of the library you go with, I would abstract yourself from the library as much as possible and respect the layers of the API.

#

For example, serialize your net entities yourself - so if you change libraries later, your code for serializing and deserializing your "stuff" remains unchanged.

#

That means learning how to read and write byte[] yourself.

#

But once you do that, you are not at the mercy of your libraries.

jade glacier
#

Pun2 has some checks for changed observables on the fly to avoid deserialization errors, but I wouldn't go testing the limits of that. You typically don't want to be messing with your serialization path after instantiation.

tropic creek
#

Hi everyone, hope you are having a great day. I need someone to make me low poly 3d model(character in free) ping me if you can

jade glacier
#

Not that kind of networking

spring crane
#

@oblique fog You don't necessarily have to do a lot of restructuring when moving to Mirror from UNet. Mirror itself isn't paid and they don't provide game server hosting afaik.

#

You can hold 20 CCU for free if you host it on your computer 😄

oblique fog
#

No, I need it to be hosted somewhere online...actually...can I use my webserver as a match making host? Meaning can I simply "move" from mm to my webserver, or does this mean I would have to code my own server from scratch?

gleaming prawn
#

Matchmaking you could use your stuff (finding from scratch), but mirror does not come with standard relays, etc... For the actual game servers you need hosting orchestration, etc...

oblique fog
#

Oh wait a minute, all I need to take care of is match making, the actual gameobject movements and animations are all handled by the Multiplayer HLAPI system like NetworkTransfrom, NetworkAnimator, etc right?
For some reason, I was assuming that the mm was responsible for relaying that as well, not just hosting a room...Or am I misunderstanding this?

jade glacier
#

Matchmaking is a server that lets clients find game servers.

oblique fog
#

I'm aware of that. My question is who does that actual synchronization between the clients and the host? Is it the host machine itself? Or is it the matchmaking cloud server?

rotund pilot
#

I also had to change all the occurances of the project name cos my project name starts with a lower case letter

oblique fog
#

You had an abstract method in GhostSendSystem<T> script that you have not declared in your DoggoballGhostSendSystem script. Declare it and the error will disappear.

rotund pilot
#

this is the entities code btw

oblique fog
#

If you're using VS, just put cursor over the underlined DoggoballGhostSendSystem press ALT+ENTER and ENTER

rotund pilot
#

I didn't write this

#

it started throwing errors when I updated

#

aight hopefully that doesnt break anything

oblique fog
#

Add this to that script:

protected override bool IsEnabled() { }
rotund pilot
#

ye

#

thank you for the help

#

I was also trying to get a basic basic multiplayer solution going

#

using the low level api

#

but I was having weird issues

#

I'll have to explain it in a moment tho

#

is World.All the same as what was World.AllWorlds

#

that's throwing errors too

#

man now I gotta find documentation

#

uhh

#

They're not the same data type

#

idk what do to about that

#

can you put World.NoAllocReadOnlyCollection<World> in a foreach loop

#

oh I gotta update Burst, hopefully that will fix it

#

nope that did nothing

weak plinth
#

still having a but of trouble with customproperties from yesterday, how would i get a string from playerprefs and use it to give each player a different skin based off of the string?

gleaming prawn
#

@oblique fog matchmaking is JUST:

  • find a game for me, here's the game server...
#

communication between game client and game server it self is either (assuming you are using a client-server architecture in which the server is a unity instance - this is not the only way to do games, you can have servers running other software not unity, etc):

  • direct IP connection (assuming you are hosting/orchestrating your servers somewhere).
  • relayed connection using another service (assuming your players are hosting the games ont heir machines)
  • or port-forwarding (don't) or punch through (STUN), so clients can attempt direct connection to the player hosts (only works about 85% of the time in avg, so needs to be combined with the above, unless you are fine with your players bashing your reviews due to the game not working).
#

I assume Mirror has some integration with a relay service (no idea, but I expect they implemented this with something, otherwise it's dead in water) AND some punch through capabilities (you will need to host a server to manage the signaling for the STUN process - although the reflexive address detection can be done for free with google STUN servers, the signaling has to be done with custom servers- you could use your own stuff - has to be implemented).

#

Maybe mirror has ALL that somehow simplified for you, but you'd have to ask in their own Discord...

#

But these are all different things:

  • game server (examples: in case of mirror or photon bolt, a unity instance... in case of quantum, a photon server)
  • hosting of game servers (gamelift, multiplay, AWS for unity instances - if server is a service, like photon, hosted by the service provider itself)
  • matchmaking
  • relay
  • punch-through (freely available STUN servers + custom signaling servers)
  • player profile management
#

Some services/companies combine these into packages, etc...

#

When going for Mirror, there's no company behind it, so everything above you need to (if required):

  • get servers/APIs from somebody (AWS? Google? Heroku?) and pay for it accordingly
  • implement the missing pieces as well (no service will be 100% complete TBH).
#

Hope this is useful... Ye, if you just want to have a LAN-based game, no online... Stock Mirror will work as it is, I think...

fair cosmos
#

there is hidden 2 transports for mirror

#

one is udp(dark rift) and one i didnt know

#

both have Relays

jade glacier
#

Mirror's architecture isn't going to play well with a true relay

#

Since mirror is built around a Unity-based server as the hub... A relay will create a very strange set of problems. Typically for a relay environment, the relay is the server... just a very dumb one, and it acts as the traffic hub. But for Mirror all traffic needs to go through the Mirror host/server.

tropic kestrel
#

any webgl expert around? please message me

gleaming prawn
#

@jade glacier for client-server (where server is an engine instance), relay is always a fallback... You should try punch as much as possible

jade glacier
#

Yeah, for a dedicated server that isn't the relay, that fallback is very much a worse case scenerio

gleaming prawn
#

ye

jade glacier
#

Mirror games with the kind of latency that could produce, I could see being very disappointing for devs to see in action. It will make a real mess.

jade glacier
#

Best to ask in the Mirror discord. But sounds like you are asking about a SyncVar

#

Either a SyncVar with a hook, or an RPC depending on if this value is something you consider to be a state, or an action.

haughty trench
#

Hello everyone!
First of all, I am not very experienced with networking so my questions may be stupid. Sorry for that.
I am starting a new project and we have some goals:

  • be able to handle around 50-100 users in the same area/scene
  • be able to have a huge amount of CCUs
  • latency is not a concern, we can have 1-2s of latency and still be good
    I am trying out new solutions that I didnt know about like Mirror or MLAPI. I am pretty sure that a single Mirror server cannot handle like 800k+ CCUs. So the point must be to scale horizontally at some point. The way I see it (with my newbie eyes) is that new mirror servers are started on the fly and (custom?) load balancers are putted ahead those servers, allowing a huge number of CCUs.
    I know Mirror has another tool called Booster - I am also wondering if it can be used as a load balancer - need to try this.
    My questions are :
  • is my approach correct?
  • if you have experienced with Mirror, do you see any limitations/bottlenecks?
  • do you have any other recommendation?

I read (on the MLAPI website...) that Mirror has a poor memory management and was not very optimized (because of UNet) - but on the other hand it seems to be the go-to library when talking about networking so I'm kind off confused.

Thanks for your time.

gleaming prawn
#
  • do you have any other recommendation?
    Your description looks like you are trying to do what NO game have ever done... For a reason. (I mean, 100 players in the same close area, and still support 2s of RTT)
#

Recommendation: start with something much much much simpler

#

Unless you are talking about something like very very slow paced...

#

but on the other hand it seems to be the go-to library when talking about networking so I'm kind off confused.
Where did you see that? There are several other options. Mirror is "free"...:)

#

Mirror/Bolt/PUN (neither of these) would even currently scale to more than around 50 players or so (with decent, production-ready performance)

#

So, there are many thing starting wrong, I'd say

haughty trench
#

First of all, thanks for your answer of course !

Where did you see that? There are several other options. Mirror is "free"...:)
@gleaming prawn
Maybe I didnt search enough but when searching for a networking library, Mirror had a lot of results, more than any other library.
So just for my knowledge, when you have to handle a lot of users, we usually make your own solutions that may be very specific for your needs?
Btw I didnt thought enough when I was talking about 2s of RTT - just realized how little that is.

gleaming prawn
#

that's actually HIGH

#

Normally games are only playable with Pings up to around 250/300ms, then performance becomes unplayble... For fast paced action game

#

some players don't even bother to play a game above 100ms ping

#

Mobile it's normally necessary for the game to play well to a higher range (up to 300ms, lets say)

#

we usually make your own solutions that may be very specific for your needs?
No, you NORMALLY do not make the game...:)

#

Most studios and teams do what is easier, simpler (and still profitable)

#

Notice that the only games currently handling > 100 players in what is a single "game" qualify practically as MMO

#

And then you are talking about a super tiered solution, not something you buy off the shelf (or develop quickly)

#

If you want to stay in the 2-64 range, then you have off the shelf options available

#

100 players with UE in a single game, yeah, possible, but to get proper performance out of that is A LOT of work, and you will still pay your kidneys with server costs...:)

#

Notice Apex Legends went for 60 (at least originally, I'm not following the game), not 100... Guess what...:)

haughty trench
#

and just to be sure to understand you correctly, you are talking about 2-64 users in the same room. What about CCUs across different rooms ? - let's say I limit my room to around 40-50 users. But still want to be able to manage a lot of rooms. Do you think that with the proper infrastructure, some libraries bought off from the shell could handle that? Because in the end, the purpose of the tool I may end up using is just to handle one room (let's say less than 64 players)

gleaming prawn
#

What about CCUs across different rooms
That is not a performance problem

#

THat's just a billing problem/solution...:)

#

When you say ROOM, you are not talking aout Mirror then

#

Mirror: client-server API, in which each server is a unity instance

#

So you need to HOST these servers (and pay for them). Unless you want the clients to host, etc

#

When you talk about Rooms, normally you are talking about relay-based libraries, like PUN2, etc

#

To clarify: I'm one of the developers of Photon Quantum (which does handle 32-64 players fine)

#

But it's a different kind of beast

haughty trench
#

(I am slow to react because I am googling some stuff like PUN2 first - btw I really appreciate your help. Thanks a lot! - and I didnt knew about Photon Quantum but it seems amazing!)

#

So to sum up it's mostly a billing problem because of the ridiculous amount of servers I will need to have. Also if I want to have "per room server" approach, I should use PUN2 instead of Mirror because it'll run on a dedicated server instead of being a Unity instance which is more efficient.

gleaming prawn
#

it's a trade of as well

#

PUN2 is client authoritative, meaning there is little hacking protection (many many games have no problems with this TBH)

haughty trench
#

another (stupid) question: does being on mobile change anything about what we were talking about? Of course you are more dependent on the network quality, you may miss packages etc.. but from PUN2 point of view it doesnt matters right/

gleaming prawn
#

well

#

it does because the game client is much LESS capable of handling package rates, visible objects

#

Mobile you normally shoot for much less...

#

Although you can see games like BattleLands Royale (quantum, 32 players per game)

weak plinth
#

Anyone has experience building a login screen with API/token calls?

weak plinth
#

using JWT

weak plinth
#

I need someone who would help with my game with networking

#

Pay is gonna be Revenue share

jade glacier
#

@hallow fractal Just ping questions here

#

Before SNS will work on your thing, you will need to disable your movement script, and you will want to try to get your controller code simulating in FixedUpdate (though that is easier said than done).

#

Not using SNS and just using PUN2, you can do your own reparenting without the mount system of SNS. Just be aware that until the next Pun release is out, that vanilla transform syncs in Pun sync in world space only.

#

To jump on the train you ideally want your syncs to be local, and to reparent your player to the platform... that will keep it from floating behind.

hallow fractal
#

Soo what i have to do is use if view is mine on the train controller that moves the train, than try to implement the controller codes on fiexed update for better sync

jade glacier
#

Only if you are moving to SNS and you want the smoother interpolation

#

Pun syncs are time based and you will get jitter a bit no matter what

#

They aren't really meant for production.

#

Setting the Animator to update physics made a huge difference in the smoothness of SNS transform/animator

hallow fractal
#

Woow really, i didn't thought i could fix it or make kt better

#

I always thought that my transformer vieet is average good

jade glacier
#

The sync was very glitchy as the project arrived, its good now.

hallow fractal
#

Never thought much of the animation or tranform, i only wanted it working

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

public class FallowTarget : MonoBehaviourPunCallbacks
{

    public Transform target;
    public float Speed = 5;
    public float delayToStart = 2;

    bool start;

    void Start(){
        if(delayToStart > 0){
            start = false;
            StartCoroutine(startFallow());
        }else{
            start = true;
        }

    }

    IEnumerator startFallow() {
         yield return new WaitForSeconds(delayToStart);
         start = true;
    }

    void FixedUpdate ()
    {
        if (photonView.IsMine)
        {
            if (start == false)
                return;


            if (target != null)
            {

                Vector3 dir = (target.position - transform.position).normalized * (Speed * Time.deltaTime);
                transform.position += dir;

                if (dir == Vector3.zero)
                    dir = transform.forward;

                transform.rotation = Quaternion.LookRotation(dir);

            }
        }
    }
}
jade glacier
#

For the train?

hallow fractal
#

thats the one script thats moves the train

jade glacier
#

It will play jerky locally, but that makes it friendly for networking.

hallow fractal
#

soo is it better

jade glacier
#

The ideal script simulates in Fixed, and lerps in Update

#

Better for the clients, locally that will jitter

#

Nothing is a simple answer, everything just exposes the complexity of what is going on here unfortunately.

hallow fractal
#
using System.Collections.Generic;
using UnityEngine;

public class FallowTarget : MonoBehaviour {

    public Transform target;
    public float Speed = 5;
    public float delayToStart = 2;

    bool start;

    void Start(){
        if(delayToStart > 0){
            start = false;
            StartCoroutine(startFallow());
        }else{
            start = true;
        }

    }

    IEnumerator startFallow() {
         yield return new WaitForSeconds(delayToStart);
         start = true;
    }

    void Update () {
        if(start == false)
            return;


        if (target != null) {

            Vector3 dir = (target.position - transform.position).normalized * (Speed * Time.deltaTime);
            transform.position += dir;
            
            if(dir == Vector3.zero)
                dir = transform.forward;
                
            transform.rotation = Quaternion.LookRotation (dir);
            
        }
    }
}```
#

this how it was it before

jade glacier
#

I know. you changed it from rendering smoothly on the owner, to networking smoothly. But the owner now is not interpolating.

#

proper handling for games and networking is to simulate in Fixed, and interpolate in Update

hallow fractal
#

have to understand the meaning of interpolate first xD

jade glacier
#

That is more a basics of game dev and Unity topic really

hallow fractal
#

does it mean the not so importat things?

jade glacier
#

I honestly don't know how to even start answering that question, or what that question even is.

hallow fractal
#

no, but english isnt really my first language, and never got contact with that word

jade glacier
#

It is the same meaning and context as how PhysX deals with simulation and interpolation

#

Why does your train have two photon views?

hallow fractal
#

i remember thats how it worked for me, but also didnt remove the other one

jade glacier
#

LOL, I am trying to fix up your scene, but I'm running into too many weird things to get through this.

hallow fractal
#

i literlly forgot to remove that part, but i remember that someone said each vagon needs it own photon view

#

not sure really

jade glacier
#

I'm not sure either.

#

It really feels like you are just kind of trial and error throwing stuff at your problems here. I think you are in a bit over your head with this train thing.

hallow fractal
#

but in this case the mother and the child have each a photonviw soo thats a mistake

#

yeah thats true, i just want to make really that train finaly work

#

it took some time now, and i tried soo many stuff now

jade glacier
#

I would strongly suggest avoiding all of this complexity on your first try.

#

You have nested objects, reparenting, 3rd party controllers... all thrown in - on top of not being super well versed yet in the basics of the timings involved in simulation and interpolation. This is going to be a long hard project.

hallow fractal
#

yeah i really need to stop with this train thing now

jade glacier
#

Avoid 3rd party assets altogether for your starting stuff, outside of a basic character controller if need be.

#

Asset dumps do not end well with networking.

hallow fractal
#

yep i got it to realize that on a hard way 😅

#

well anyway, is just better if i get rid of the tain for a while now ahaah

jade glacier
#

Please do 🙂

hallow fractal
#

yep ahah, being obsessed with trains and trying to implement it on a game and that a networking one without any knowlage whatsoever is really a bad thing

#

i thing anyone will go through this and realize that yours skills arent enough to achive something without learning first

#

@jade glacier but thanks anyway, you were really a help for me ☺️

slim ridge
#

Anyone here used FlatBuffers?
I'm trying to decide whether to use them or create a method of serialization specific to my game.

graceful zephyr
#

flat buffers are not for network serialization @slim ridge

#

they are meant for on disk storage and sequential reads

slim ridge
#

ok, what about protocol buffers?

graceful zephyr
#

Not good either

#

@slim ridge

#

Almost no compression, adds a lot of meta data etc

#

Not good

slim ridge
#

ok, thanks!

undone sigil
#

@graceful zephyr and what do you think about MessagePack?

graceful zephyr
#

Same problem

#

As protobuff

jade glacier
#

@sand lotus pulled together some really good packing tools.

humble socket
#

Hello, I am stuck on how to solve this problem. It might be really simple I just don't know what I need to focus on in order to fix it. Basically I want both Client and Server to view the same pokemon. The pokemon are ScriptableObjects, and I'm trying to create a Multiplayer environment/game.

jade glacier
#

I would start before any of that by doing the tutorials for some of the major libraries people use for this. Mirror, Pun2 and Bolt are the most common libraries. @humble socket

humble socket
#

You would recommend learning the libraries rather than the core unity multiplayer engine?

#

What library would you recommend I focus on for this project? Or whats your favorite? @jade glacier

#

I think Mirror looks like the most reasonable framework to learn

jade glacier
#

Mirror and Pun2 are where people usually start.

#

Favorite is Quantum, but that isn't for hobbyists or people learning networking.

#

If you go with Mirror, be sure to join their Discord.

#

Though I recommend trying tutorials for all of them, since your goal right now is to get familiar with the landscape of networking.

#

They have different use cases and pros/cons.

jade glacier
#

Bolt is the only complete stack of the three. Pun2 and Mirror are more just message wrappers and net entity managers.

humble socket
#

Is Quantum and Bolt part of the Photon libraries? It looks like most of these libraries except mirror are related to Photon lol

jade glacier
#

yeah, Pun2, Bolt and Quantum are all Exit products.

humble socket
#

okay cool

#

Right now my main goal its to get a simple Multiplayer game running, so something like Mirror might make things easier for me to grasp.

#

But I'm just really stuck on the purpose of Scriptable Objects in a Multiplayer environment. I don't know if learning Mirror will answer this question.

#

But maybe it will give me another idea or a better way of doing what I'm trying to do.

jade glacier
#

Don't try to make a real game in your first few tries.

#

Make throwaway garbage. Your first attempts will be complete trash. Just try out the different engines and learn the language of networking.... then think about an actual game for real.

#

SOs are not going to play nice with any of the libraries. They typically are all tied to MonoBehaviours

#

which is why you really should just do the tutorials first

#

if you try to do some wackado thing they aren't meant to do, you are going to spend weeks mired in unsolvable problems.

slim ridge
#

ScriptableObjects have no place in multiplayer.
They're more of a configuration for behaviors that are treated as an asset

humble socket
#

its just so weird that people would recommend SO's in local mode, but multiplayer they become completely different

jade glacier
#

Thus why you need to do tutorials

#

it won't seem weird once you understand the libraries

#

don't overthink this.

#

Just do the tutorials

humble socket
#

cause like in simple terms, my game as a non-multiplayer game, works perfectly with SO's, but when i conver tit to multiplayer, it becomes a whole different project

jade glacier
#

The networking highway is littered with guys in these channels who kick the tires of libraries for months before writing anything. Just do the tutorials.

#

It is also littered with people who just wanted to convert their single player games to MP. Rarely works out well.

humble socket
#

You'd think that would be an easy refactor, but its NOT!

#

Multiplayer and SinglePlayer are completely different

jade glacier
#

Nope, not at all.

humble socket
#

Well then maybe I'm just using SO's incorrectly

#

Well I'll do some Mirror tutorials, and see if anything clicks, hopefully then I'll be able to determine what needs to be done about my SO problem

spring crane
#

I assume he meant not at all easy...

humble socket
#

oh okay, yeah I agree with that haha

jade glacier
#

I would start by joining the Mirror discord, they respond much quicker there and other users are in there who also can answer questions. @fading mason

fading mason
#

ive done that

#

my post has been up for liek 30mins

jade glacier
#

its early morning on west coast USA

fading mason
#

yh probably

jade glacier
#

Discord isn't a helpline, you are at the mercy of who is on, and feels your question is answerable or worth answering

fading mason
#

yeah i know i just put posts up while im working on code incase its something stupid i missed

jade glacier
#

yeah, posting code is good

fading mason
#

Hello! I'm using mirror make a multiplayer game. I'm just making the chat however I'm having a problem where when the client/host inputs a message and clicks enter the text isn't inputted to the text chat it is just highlighted. I'm doing it where i have a player prefab (just for now) and it has a canvas which holds a text chat (where your or another clients message will be displayed) and an Input field (where the player inputs the message). It could be something in a script or maybe I've put the UI wrong any ideas? ping me Thanks! code: https://hatebin.com/rlhezlealb

austere kiln
#

I'm using PUN

I've a map (a unity scene), from which players can choose a particular area, each area will be online multiplayer (like GTA Online), in these areas people can run around and see other players too. From within these areas players can choose to play particular games (likes Chess, for eg), where there will be a match making and the game will start. How I go about making this? Currently, I have a "Launcher" GameObject in my scene. So when the map scene loads the scene makes connection with the Photon Server and gets it connected. Then, when a player clicks on a area, lets say Area A, I FindOrCreate a room with the same name and then load the Area A scene using Photon. But the problem I'm facing is, is whenever a new player joins the room a brand new scene gets created for all the players who are already in the scene, and then every one gets teleported back to 0,0,0 (the spawn location), and all the character meshes collide and its a human fireworks. What am I doing wrong?

jade glacier
#

Pun isn't really designed for what I think you are describing

#

It sounds like you are trying to build matchmaking into your rooms...for mini games?

#

Or does all of this selecting an area and a game happen as part of just the join/create room process while still connected to the master server?

#

The details of your problem are impossible to say without having it narrowed down to a segment of code where the bug is occuring.

austere kiln
#

Matchmaking for mini games, yes. Tho those match making takes place in another scene. My script is very simple, as soon as someone clicks on AreaA, it checks of a room by AreaA exists or not. If it does it joins it and if it doesn't it makes one and joins it. Then AreaA scene is loaded

#

I'll send the code 1 sec

#
public class Launcher : MonoBehaviourPunCallbacks
{
    public GameObject loadHorrorLand;
    public GameObject loading;
    public byte maxPlayersPerRoom;
    RoomOptions options;
    private string sceneToLoad;

    void Awake()
    {
        loadSceneButton.SetActive(false);
        PhotonNetwork.AutomaticallySyncScene = true;
        if (!PhotonNetwork.IsConnected)
        {
            PhotonNetwork.GameVersion = "1";
            PhotonNetwork.ConnectUsingSettings();
            options = new RoomOptions() { MaxPlayers = maxPlayersPerRoom };
        }
        else
        {
            loading.SetActive(false);
            loadHorrorLand.SetActive(true);
        }
    }

    public override void OnConnectedToMaster()
    {
        loading.SetActive(false);
        loadHorrorLand.SetActive(true);
    }

    public override void OnDisconnected(DisconnectCause cause)
    {
        
    }

    public void joinHorrorLand()
    {
        loading.SetActive(true);
        sceneToLoad = "HorrorLand";
        PhotonNetwork.JoinOrCreateRoom("HorrorLand", options, TypedLobby.Default);
    }

    public override void OnJoinedRoom()
    {
        //.....
        else if (roomToLoad == "HorrorLand")
        {
            PhotonNetwork.LoadLevel("HorrorLand");
        }
    }
}
#

public void joinHorrorLand() is called when HorrorLand is pressed on in the map

#

Upon opening the scene this gets triggered

#
public class GameManager : MonoBehaviourPunCallbacks
{
    public GameObject playerPrefab;
    public static GameManager Instance;

    public override void OnLeftRoom()
    {
        SceneManager.LoadScene("MainMenu");
    }

    public override void OnPlayerEnteredRoom(Player other)
    {
        Debug.LogFormat("Entered Room");
    }

    public override void OnPlayerLeftRoom(Player other)
    {
        Debug.LogFormat("Left Room");
    }

    public void LeaveRoom()
    {
        PhotonNetwork.LeaveRoom();
    }

    private void Start()
    {
        Instance = this;
        PhotonNetwork.Instantiate(this.playerPrefab.name, new Vector3(0f, 1f, 0f), Quaternion.identity, 0);
    }
}
oblique fog
#

@gleaming prawn Hey thanks for the clarification! That was very helpful!

#

I did some research and decided to go with the Photon Unity Networking solution. It's really awesome, documentation is above and beyond. It has match making services, as well as server-client synchronization. Much more efficient communication between clients than Unity's HLAPI. It also gives you 20 CCUs for free to use. Anyways, all around it's awesome, and it even comes even more features than HLAPI can provide. I also like the way they interface with MonoBehavior. So all in all, that is my choice 😉

spring crane
#

Look into how you are going to deal with cheating and what power each client has on the network if that is important to you

frank drum
#

hi, i want to start a project with networking for me and my friends to play party games together, can someone point me towards resources for learning how to connect computers from different networks together? I have some experience using socket networking, and have connected multiple devices on the same network, but I have no idea how to go about connecting computers from different places together. any help would be greatly appreciated! I'd also like to have a free solution, as a soon to be college student.

spring crane
#

Seems like PUN would work great in your case. The API is very convenient, you get matchmaking and you can freeload on their free tier assuming you don't have more than 20 friends playing at once 😛

frank drum
#

sounds awesome, are there any tutorials i can follow?

#

nevermind i found one

spring crane
#

Make sure it's PUN2

frank drum
#

so this works by sending data from the users to photon's servers, and then back, correct?

spring crane
#

Yes. peer to peer over relay

frank drum
#

alright thanks!

weak plinth
#

is there any tutorials/documentation/tips you can give me to help players join different maps and load the correct map with the correct room?

austere kiln
#

Isn't PUN supposed to assign a Master Client by itself if the master client leaves? By for me, if the master client leaves the room, everyone else also leaves the room