#archived-networking

1 messages · Page 103 of 1

spring crane
#

Check to make sure you aren't passing nulls around

weak plinth
#

i am not... i am sure of it

#

the method is supposed to destroy a game object but it isn't idk why

compact wigeon
#

I wanna change the region by pressing a button

#

But I first need to disconnect from the old region and connect to the new one

#

And so on if I want to connect to other

spring crane
#

Maybe you can follow the code to see what exactly leads up to the null

weak plinth
#

sure

compact wigeon
#

Any idea on how to fix this, danny?

spring crane
#

Fix what exactly? Are you sure disconnecting requires you to be a masterclient?

compact wigeon
#

Thats what the error tells me

spring crane
#

What are you calling?

weak plinth
#

the method is used in an event

compact wigeon
#

"Only the master client can do this"

spring crane
#

That syntax doesn't look right, but any reason to use that over Disconnect?

compact wigeon
#

Idk

#

A guy on a thread made this script

#

And said it works

spring crane
#

Not seeing references to CloseConnection?

compact wigeon
#

When I hover over the CloseConnection it tells me why it doesnt work

#

Its in gray color

spring crane
#

Share it with the rest of us

compact wigeon
#

Yep

#

Here

spring crane
#

You are assigning a region to a CloseConnection method?

#

Might wanna double check the suggestion on the forum

compact wigeon
#

But is the code that guy made good?

spring crane
#

Oh wait, comparing

#

Well mostly focusing on what you currently have

weak plinth
#

i think my current debugging question for the code i posted above is this : "in the game scene which is running, there's more than one controller (prefab), I want to change the team then use the die method ... (the die method works as follow : destroy the game object, then check what team it is in and based on that instantiate the prefab... i could post it if you want ) "... so my question is would I need a photon view to do it?

spring crane
#

Comparing the return value of CloseConnection to a region doesn't make a lot of sense

#

@weak plinth Yea there is a decent chance network remove requires a photonview

weak plinth
#

I didn't use networkremove ... i used photonnetwork.destroy

spring crane
#

Destroying networked objects works only if they got created with PhotonNetwork.Instantiate().

#

Are they Photon instantiated?

weak plinth
#

yes

spring crane
#

Where are you calling it?

compact wigeon
#

@spring crane I added the code and it gived me an error in unity when pressing a button to change region

#

Warning message: ConnectToRegion() failed. Can only connect while in state 'Disconnected'. Current state: Connected
UnityEngine.Debug:LogWarning (object)

weak plinth
#

event*

spring crane
#

Are you possibly trying to destroy the same object multiple times?

#

What are those Die methods doing?

#

@compact wigeon Well the issue seems pretty clear. Did you actually execute the disconnect line?

compact wigeon
#

well, its in the code

#
  public override void OnConnected()
    {
        base.OnConnected();

        if (shouldChangeRegion)
            shouldChangeRegion = false;
    }
weak plinth
#

public void Die()
        {
            playerManager.DieAndRespawn();
        }
spring crane
#

.. What does DieAndRespawn do?

#

Do all 3 lead to that?

compact wigeon
weak plinth
#

yes same function in different prefabs

#
public void DieAndRespawn()
        {
            PhotonNetwork.Destroy(controller);
            CreateController();
        }

void CreateController()
        {
            Transform spawnPoint = J3aJ3y.GhostPlayers.GameScene.SpawnManager.instance.GetSpawnPoint();



            PhotonTeam currentTeam = PhotonNetwork.LocalPlayer.GetPhotonTeam();

            //2-4 player .... 1-3 ghost
            if(currentTeam == null)
            {
                controller = PhotonNetwork.Instantiate(Path.Combine("Photon Prefabs/3 Spectator", "Spec Camera"),                          spawnPoint.position, spawnPoint.rotation, 0, new object[] { PV.ViewID });
            }
            else if (currentTeam.Code == 1)
            {
                controller = PhotonNetwork.Instantiate(Path.Combine("Photon Prefabs/5 Ghost/Ghost Prefab/", "Ghost"),                      spawnPoint.position, spawnPoint.rotation, 0, new object[] { PV.ViewID });
            }
}

spring crane
#
                        gameObject.GetComponent<GhostCode>()?.Die();
                        gameObject.GetComponent<Anotherc>()?.Die();```
So there is some potential to call the Destroy method several times
weak plinth
spring crane
#

Yea. Maybe add a log to DieAndRespawn method to make sure that is the case

#

@compact wigeon Just because the line is there doesn't mean some other line isn't preventing it from running. Make sure you are actually calling disconnect.

weak plinth
#

I just the the photonview.RPC

compact wigeon
#

how would you call it?

weak plinth
#

it is working BUT AFTER I DO IT 2 TIMES

#

like i have to change the team 2 times for it to work

#

any ideas why that's happening

olive vessel
compact wigeon
#

Yeah

#

I added PhotonNetwork.Disconnect(); in the start method

#

Maybe its working

#

Not working

olive vessel
#

That should Disconnect you from Photon's servers

spring crane
#

There might be a delay

compact wigeon
#

Not working

olive vessel
#

Log something in OnDisconnected

#

Because that will fire when you successfully Disconnect

compact wigeon
#

Ok

#

Before or after the if statement?

olive vessel
#

Dealer's choice, but not inside it

compact wigeon
#

Alright

#

Its not sending anything

weak plinth
#

guys I have found the cause of the problem... but i need help with it

#

the photon teams that i made are getting reset

#

when transitioning from the first scene to the game scene

#

or should i put a dont destroy on load?

#

that problem is solved but the main problem is sitll there

#

and I have one last question if you dont mind... If I suddenly close the run game mode (play), I get an error that the photon view is still in use and i sitll am acessing it, of course in the app, if it closes it is like a crash so there'd be no error HOWEVER just to be on the safe side, can I handle that error??

crimson moat
#

What's the best way to handle peer-to-peer networking?
With Photon, forum posts claim to be able to achieve p2p, but everything on their website advertises servers, and requires you to select server locations, and concurrent user plans, making me think that it would be limited by those servers.
Mirror is another one, but requires downgrading to at least 2019 version.
From anyone's experience, Is it worth using either of these, or is there a better option?

spring crane
#

@crimson moat What do you exactly mean by peer to peer?
Various options include:
Player hosted servers (Mirror)
Peer to peer over relay (PUN)
Pure peer to peer where 20% of your customers can't connect due to network firewalls

olive vessel
#

Mirror requires downgrading? Since when?

crimson moat
#

because free is 20 max iirc

#

if mirror is just player hosted servers, that would also require firewall stuff, right?

spring crane
#

They don't provide relay servers for free

#

Yea, but users that are willing to setup dedicated servers can generally figure out the port forwarding part

crimson moat
#

ahhhhh despair

spring crane
#

Mirror works best with Unity 2019 LTS.
Mirror generally works with all newer LTS versions too (i.e. 2020 LTS).
A lot of people ask us if Mirror is compatible with Unity 2021.0.1.preview or similar.
Unity's LTS versions are barely stable enough. We do not recommend running multiplayer servers with anything that's not LTS.
https://mirror-networking.gitbook.io/docs/general/recommended-unity-version

crimson moat
#

so none of those would be ideal

#

does something like Steam's networking with NAT punchthrough use servers?

#

I'm assuming it does

#

and I wouldn't want to be locked to steam anyways

#

maybe I'll just stick with paid servers, none of these seem good

spring crane
#

Yea the NAT punchthrough is the thing that fails for some % of people

crimson moat
#

oh right

#

are there any others that do that besides steam? i'd like to check that out too

#

that's the only one I think would be an option beside just regular servers

#

I didn't expect that I'd have to go through all of this to get 2-4 players playing a party game online

spring crane
#

For a not-so-serious project I would probably go for player hosted dedicated servers, since that allows all sorts of fun

#

For a casual party game just go for PUN

crimson moat
#

ok thanks

#

honestly I don't even know how to set up my ports lol, last time i remember it being a nightmare

spring crane
#

Or Fusion depending on the gameplay

#

Well you don't have to deal with that with PUNs hosting

crimson moat
#

a fusion of things? or is fusion a networking solution

spring crane
#

Photon Fusion

crimson moat
#

ok ill look at whatever that is

spring crane
#

It should help a lot if you need higher quality networking features

grand widget
#

Is there any easy explanations/documents how to sync objects and movements with PUN?

weak plinth
spring crane
#

I believe beta builds are out now

gleaming prawn
#

Yes, public beta started around 1 month ago

#

You can download from the website (fusion docs section), and create the free app ids for testing

wispy oar
#

how do you show a list of the rooms hosted on the server with mlapi? anyone got any ideas?

formal tangle
#

how does the UNET ack system work?

gray pond
formal tangle
#

how are the acks merged into the bitfield?

weak plinth
#

i keep getting a error can not instantiate before the client joined/created a room. state peercreated

spring crane
#

Don't create network objects before joining a room.

valid plaza
#

Hi, I'm making an online chess game. When I added Photon fun 2, Figure a shape and changed position with the first player, it changed and the second player could not change position. How to get the second player to change position. Do I need to put a checkmark somewhere to make the statuette publicly available?

wispy oar
#

anyone have any ideas on how to fix this, or whats causing the issue?

weak plinth
#

im getting a photon error of the player controlling the other player when the 2nd joins

ivory coral
#

I know I'm not making a game with Unity, but I'm trying to make a phone app where you can select a time and day on a calendar and schedule a meeting with someone. I already have the information that is inputted to be be processed and sent to the person, but I need a calendar system for the app. So if Person A picks a day and time, then Person B can't do that time and day. I was thinking that I would need some kind of server to go about this, but not sure where to look into for this kind of thing. Yes, I know I could be using other things to make this but I'm most comfortable with Unity and already have most things done with this project. Any help would be greatly appreciated, thank you.

icy thorn
#

Yeah, you are going to need a server. I think the easiest approach would be to have a central server that clients would send the picked calendar date to. If the date is free, a "success" response is sent back and the date is marked as invalid. If the date has been marked as invalid, a "failure" response is sent back

#

Peer-to-peer isnt really an option here, because it could lead to different people picking the same dates, before you manage to sync the data across all devices

#

Plus, if you want to do peer to peer across the internet, you still need a central server for client discovery

ivory coral
#

I was also thinking about maybe using Google Excel sheets as another method

ivory coral
#

let me explain my reasoning LMAO

#

It was just a thought

#

but

icy thorn
#

You can just write another app, like a c# core console projecg, and include the same networking library you use in your unity app. Alternatively, use a blank unity app instead of a console project

#

If you want to DIY it, its literally just a TCP socket thats listening and accepting clients, then handling each client in a read-write loop

ivory coral
#

maybe you could read from a file that gets what days have been chosen and then block them out. if you choose a day then it adds it to the list and updates. idk lmaoooooo

icy thorn
#

If you write your own server app, you can use a real database, instead of excel

ivory coral
#

lmao I guessing the excel thing could work hm????? dogkek

icy thorn
#

Yes, it could

#

But, using a database is better

#

The reason why is that it allows you a more structured way of storig data than just a list written to a file

#

It allows you to search the marked days more efficiebtly, by day or by user

#

You can extend it easily and keep a single file around, making it easy to backup

#

Theres no reason to not use a database

#

If you wsnt to keep a copy clientside, then feel free to use a simple file

#

But on the server, you should be using a real databasd

ivory coral
#

Hm databases just sound better lol. I'll have to figure out how to do all this stuff

icy thorn
#

You can look at EF Core, which is the database interaction solution for .net core afaik

#

It allows you to connect to pretty much any db i think

#

So you can stsrt off with s simppe db provider (such as sqlite) and move to bigger ones later (ms sql server)

#

Its just a nuget package that you have to ibstall, its really not bad

#

I applogise for my atrocious spelling btw. Mobile typing isnt my strong suit

ivory coral
#

hm alrighty. I'll try that. Do you happen to have any tutorials links to any of this? Also its all good, I could understand everything

icy thorn
#

I personally used the MS docs. Just search "ef core microsoft docs" and it should be one of the first links

#

I would folloe the quickstart guide in the docs

#

It should tell you how to connect to a db and define a model (basically, define what the stored data looks like)

#

All you should need is a single model class for storing which dates are taken, and by which user

#

I dont know of any good video tutorials, i didnt use them so cant vouch for them

#

Im sure if you just search "ef core .net" in yt you can find something

ivory coral
#

Much appreciated, thanks again for the help

icy thorn
#

Npnp

boreal crescent
#

Hello, would anyone be able to help me out with a Photon issue? I'm kinda new to multiplayer programming, and I can't for the life of me figure out something seemingly simple lol

olive vessel
boreal crescent
# olive vessel Posting actual details about any issues will get them attention much faster, don...

Well, it's kinda a long description and I didn't want to bog up the discord haha, I'm using the Ready Player Me plugin to load in avatars from the built-in webview, it doesn't allow instantiating with PhotonNetwork.Instantiate, it works with a callback, so I have to call the spawn avatar method with an RPC and from there, i'm instanating the holder for the player, with photonnetwork.instantiate, and then trying to assign the avatar's parent to the holder, but it's not working out.

#

I'm hazy on how to assign an object to a single parent on all players, I tried using the photon view instance ID to get a reference to it, but it wasn't working, so at the moment, I attached a script to the avatar that searches the scene by name, and I'm naming each holder "Player" plus the PhotonNetwork.LocalPlayer.ActorNumber for the holder and assigns it as a parent, but it's still assigning both avatars to player 1 at the moment.

frosty crystal
#

Hello.

#

everybody!

#

I am learning AWS now. We can use AWS services from Unity with packages directly.
But for instance, if a website? How do they use this? Do they need to use API Gateway? Or Can they import the SDK exactly like us?

desert cedar
#

I don't really know multiplayer too well, but just looking for a general idea for now: what would be the best way to be able to see the screens of multiple mobile VR headsets on a PC? Having either a few onscreen at once in a split-screen view, or just being able to cycle through them one at a time. Would something like sending one eye's camera view to a rendertexture and sending that to a host computer work? Or would there have to be a full multiplayer implementation for it to work smoothly?

boreal crescent
# desert cedar I don't really know multiplayer too well, but just looking for a general idea fo...

You don't need to send visuals, that's very costly. Instead you can just sync everything else. I only really know Photon, but if you use photon you can just add Photon Transform View components to every object and position and rotation and scale will be synced without any extra work. And if you're saying you want to view from the other player's headsets, you can just access their camera directly.

desert cedar
boreal crescent
icy thorn
#

What specifically in AWS

#

Because afaik thats a very broad term

frosty crystal
#

dynamo, storage

#

cognito

#

user will get authentication, reach the dynamodb tables and find the proper location of the Assets, and will download these assets from storage @icy thorn

icy thorn
#

Are you using some framework for your website?

frosty crystal
#

react will be using.

#

I'm making the unity side.

icy thorn
#

Oh ok

frosty crystal
#

one collague is responsible for react.

icy thorn
#

I thought you wanted to know more sbout tje website part

#

My bad

frosty crystal
#

no, just we are trying to find a good practice. if we use SDK, then we will implement our backends

#

there will be different backends. but making it with API level-code, make sense but much work.

#

I could not decide...

#

@icy thorn

icy thorn
#

You really dont have to ping me again

#

I dont have too much experience with react

frosty crystal
#

Thanks

icy thorn
#

Would something like that help?

mighty rampart
wispy oar
#

and all the animation parameters are checked

teal obsidian
#

So I've been stuck on this for a few days now: This wheel script that I'm using absolutely does not like to be reconciliated

#

if anyone has any guesses as to why, please ping me. I've been on this problem for days and I'm getting nowhere

#

The physics go all wonky and get completely fucked when I have reconciliation on using this script, and the car refuses to turn at all

mighty rampart
# wispy oar i have network object, network transform, and network animations components on i...

You should isolate between animator and network transform issues as this could be either.
I would 1. Disable network transform (breaking movement temporarily) and see if animation issues continue.

1a. if they do continue then debug your animation triggers and make sure the clients are getting the triggers by running the client in the unity IDE so you can see the debug for them.

1b. if the issues go away it is the network transform settings vs movement code.

Feel free to DM if desired.

quaint oxide
#

Does anyone know if there is a simple P2P networking solution for the 2021.1+ build of Unity? I need to use it for their fix to the "Pixel Perfect Camera (Experimental)" for URP. But, I'm hesitant to use a non-LTS version of Unity for a complex game project -- AFAIK Mirror (what I was going to learn today) is only compatible with 2019/2020 LTS.

I don't really know where to begin with MLAPI or if it's compatible with non-LTS. If it is, are there other big risks with going non-LTS?

gray pond
quaint oxide
#

Oh so, theoretically if theres nothing wrong with, say, 2021.1.15 - then I have nothing to worry about

#

In terms of Mirror specifically

gray pond
#

P2P is a whole other issue, since Mirror is server-client model. Even if a player is acting as server/host, they'll need to port-forward / set firewall or you'll need a public relay

quaint oxide
#

So if Mirror uses client-server its not actually P2P then?

gray pond
#

Right. Jump over to Mirror's discord and we can discuss further - I don't spend much time in this one (one support venue is plenty 🙂 )

quaint oxide
#

Let me find it, thanks!

gray pond
#

asset store has the link

daring whale
#

im doing some networking so does anyone know how to get the ipv4 adress using c#

#

i found it lol

using //unity stuff
using System.Net;

//code
void Start(){
  string hostName = Dns.GetHostName();
  string ip = Dns.GetHostByName(hostName).AddressList[0].ToString();
}
frosty crystal
#

Hello.

#

when should people select an EC2 server over Normal Backend?

limpid sky
#

Hello! I've recently updated my photon project to 2020.3.14f1 and now I cant press anything because of this error: Operation LeaveLobby (228) not called because client is not connected or not ready yet, client state: ConnectedToMasterServer

#

No clue what happened at all

#

It worked perfectly fine before the upgrade

spring crane
#

@limpid sky What do you mean by press anything? UI elements?

limpid sky
#

Yeah

#

Buttons that contain the join room/create room

spring crane
#

EventSystem provides a detailed debug info in the inspector if you aren't using the new input system

#

Could see if UI is detecting anything

limpid sky
#

In the inspector?

#

Hmm I'll see if it shows anything

limpid sky
#

fixed the problem, thank you!

river meteor
#

I have problem with porting my moving platforms from singleplayer to multiplayer. All movement for players is working great but when player stands on rotating platform nothing happens and I don't know how to handle it. In SP I had code like this cs private void OnTriggerStay(Collider other) { other.transform.RotateAround(transform.position, Vector3.up, 5 * speed * Time.deltaTime); } how can I get it to work on multiplayer

(PUN)

river meteor
#

okey I discovered I cant change players position via transform.position = new Vector

weak plinth
#

I need help with the PUN instantiate function with custom data.. I used it to send only 1 data before... now i want to know how to use it to send more than one... and that's without using OnPhotonInstantiate cause I have a class I inherited from before... any help?

frosty crystal
#

Hello.

#

What approach would be better,through API or SDK, if my application won't share its backend with any other applications?

#

I have two options, either using AWS LAMBDA and API GATEWAY, or just DYNAMODB package for unity.

#

I really need to be guided. thank you

frigid delta
#

Sdk is the way to go if you aren't just hitting exposed api GW endpoints with http requests

plush flint
#

[Unity MLAPI] does anybody know how to get a component from instantiated network object? This only works on a server.

    [ServerRpc]
    private void SpawnGrenadeServerRpc()
    {
        // Instantiate grenade network object
        NetworkObject grenade = Instantiate(Grenade, mortarBarrel.position, Quaternion.identity);
        // Set ownership to player for game statistics
        grenade.SpawnWithOwnership(OwnerClientId);
        // Launch grenade
        grenade.GetComponent<Grenade>().launchGrenade(mortarBarrel.forward * grenadeLaunchSpeed);
    }
half olive
#

hello, i have an issue with mlapi, i am using a host and join button in scene 1 and the playground in scene 2, however i cannot see player 1 when i join the playground but when player 2 joins i can see him. but player 2 cant see himself

#

like this

plush flint
plush flint
#

After I call .launchGrenade() method from ServerRpc, this method correctly logs given velocity as well as owner's client id, yet .AddForce() is triggered only when host si using this ServerRpc, in the case of a client function only correctly logs velocity and id, but .AddForce() is not triggered.. I don't understand.

SCRIPT N.1
    [ServerRpc]
    private void SpawnGrenadeServerRpc()
    {
        // Instantiate grenade network object
        NetworkObject grenade = Instantiate(Grenade, mortarBarrel.position, Quaternion.identity);
        // Set ownership to player for game statistics
        grenade.SpawnWithOwnership(OwnerClientId);
        // Launch grenade
        grenade.GetComponent<Grenade>().launchGrenade(mortarBarrel.forward * grenadeLaunchSpeed);
    }

SCRIPT N.2
    public void launchGrenade(Vector3 force)
    {
        Debug.Log(force);
        Debug.Log(gameObject.GetComponent<NetworkObject>().OwnerClientId);
        RB.AddForce(force);
    }
ivory coral
#

Hello, so I can make a database using SQLite by following this guide: https://medium.com/@rizasif92/sqlite-and-unity-how-to-do-it-right-31991712190
My question is how would I put this database online? I get that databases can hold the data for me and I can read from them, but how can I save this database somewhere so my app can read from it and that everyone who is using my app will have the same data? Or maybe I'm not understanding how to properly use a database for a unity game. Anyone have any tutorial links they can send my way?

humble socket
#

I'm pretty stuck on setting up my network project. Is there anyone that can PM me, and help me hash my problem out? I've been banging my head for months/going through tutorials that are not exactly helping my problem. I don't think what I'm doing is very complicated, just a bit heavy with deeper concepts that I need verification and another push in the right direction...

prisma ingot
#

Is playfab grt?

#

Cause i need more then 20 ccu

#

for free

half olive
#

Why is no one responding in here

verbal lodge
# half olive Why is no one responding in here

There's an MLAPI specific Discord (see pinned messages in this channel). You might find more people who can help you out there. Regarding your issue, I'd need some more information to be able to help, how are you spawning the players?

frosty crystal
half olive
frigid delta
frigid delta
# ivory coral Hello, so I can make a database using SQLite by following this guide: https://me...

That’s a guide on how to run a local db. It sounds like your goal is to have some shared online database, like a high scores table. For that you’re going to want to host a database online using some service like mongodb, heroku or fire base or http://dreamlo.com/ then make HTTP requests to add or delete or read items from it.

brave perch
#

So i never touched networking before and i was wondering, what it's the easiest solution i can learn? (MLAPI or old ones?)

oak yacht
#

How can I live stream recorded audioclip data from the microphone to my server? I've looked into doing chunked transfer, but UnityWebRequests doesn't seem to support me modifying it after it was sent. Originally I was thinking I could potentially attach a stream of some kind, but now I'm not so sure.

Is there a way to do it with rest? Should I look into sockets or grpc instead?

austere yacht
# oak yacht How can I live stream recorded audioclip data from the microphone to my server? ...

You cant/shouldn't stream AV over http to a "webserver" (depending on what you mean by that... guessing since you mention UnityWebRequest). There is always System.Net.Sockets... https://docs.microsoft.com/en-us/dotnet/api/system.net.sockets?view=net-5.0 Other than that... SaaS with SDKs, or some library might exist depending on your needs. As an alternative to UnityWebRequest you can use System.Net.Http https://docs.microsoft.com/en-us/dotnet/api/system.net.http.httpclient?view=netstandard-2.0, which gives you full control

oak yacht
# austere yacht You cant/shouldn't stream AV over http to a "webserver" (depending on what you m...

Part of what appealed so nicely to me is that I can handle incoming request streams super nicely on my node server using busboy parsing of the multi-part form data:

app.post("/conversation", (req, res) => {
    let busboy = new Busboy({ headers: req.headers });
    let transcription;

    busboy.on("file", async (fieldname, file, filename, encoding, mimetype) => {
        if (fieldname == "audio") {
            transcription = await transcribe(file);

             ~~ other stuff, eventually returns a audio buffer ~~
        }
    });

    return req.pipe(busboy);
});```

which allows me to work directly with streams (file is a stream in this case) and to transcribe the audio content I'm receiving more quickly. I was hoping there was a way I could extend that concept even further by having the POST request sent out early, and appending the microphone input bytes as I receive them
austere yacht
#

thats a different kind of stream than what you might want to use for AV streaming

oak yacht
#

greater context of what I'm working on:

Working on a side project to use GPT3 in video games for non-player characters:

https://youtu.be/cjGeeb0QkAE

my flow essentially is
1.) record voice
2.) stream voice to google speech-to-text
3.) take text result, add to gpt3 prompt, and send to gpt3
4.) take gpt3 response, and send to google text-to-speech api
5.) play audio result back to user

#

trying to turn the beginning of that flow into

Stream microphone input from unity -> Backend Node Server -> Google Transcription API

austere yacht
#

you're just uploading files then, thats not "streaming"

oak yacht
#

I'm not sure I understand the difference

#

It processes the data as it receives it, not after it's compiled it together

austere yacht
#

the difference is in how big the chunks are and how live/responsive the service should be

oak yacht
#

to my understanding the tcp/ip connection made between the client and the server can be modified after it's sent, unitywebrequest doesn't support it though

#

my idea was to stream the microphone data into this request, which my server is equipped to process as it goes

austere yacht
#

That's not what tcp/ip is good at, but in a prototype it might work.

#

those streams really are meant for reporting on transfer progress of larger messages

#

also the compute-performance-requirements of that flow are gonna be extreme

oak yacht
#

Didn't realize this but all the methods I thought I could use of carrying this out, http, sockets, or grpc, are all based on tcp

austere yacht
#

sockets (as a concept) aren't bound to any particular protocol. Only an instance is.

oak yacht
#

oh gotcha

#

been meaning to do this for a while now, but if I've kinda hit a dead-end with my http/rest implemention, kind of thinking of implementing this with gRPC

oak yacht
# austere yacht That's not what tcp/ip is good at, but in a prototype it might work.

https://stackoverflow.com/questions/566462/upload-files-with-httpwebrequest-multipart-form-data

found this stack overflow, in it they use GetRequestStream() which opens a connection to the server. Couldn't I mimic it but then stream microphone data into the request as I get it?

spring merlin
#

hello everyone I am trying to figure out how to set a gameobject active using photon in unity but I cannot figure it out I have looked it up and cant find anything, does anyone know how to do it?

hardy hamlet
#

Does anyone have experience with photon voice and audio sources, I seem to be having a problem with something called audio frames and it's stopping my voice chat from working

hardy hamlet
#

This is the error im getting

icy thorn
# oak yacht been meaning to do this for a while now, but if I've kinda hit a dead-end with m...

Why are you trying to impose additional latency and overhead? As Anikki says, sockets arent protocol specific. If you want to do something custom, with specific latency and bandwidth requirements (which i assume the audio streaming is), then your best bet is to try to hand roll an implementation.

UDP has better latency, but you would have to packetise the stream into chunks. Also, its unreliable, so you might miss packets and have to resend them.

TCP is stream based, so you coukd send a continuous stream of data. It can suffer from latency issues, but when just trying to upliad an audio stream this isnt an issue

You should take a look at the System.Net Sockets. The Send and SendTo methods are what you want.

oak yacht
#

Goal is to have as minimum latency and overhead as possible, and if UDP is the best way to do it then I'll look into it

icy thorn
#

How long is your audio processing going to take? How largr are the audio chunks you are sending

#

It could be possible that you dont have to care. That a simple upload will br enough

#

You might be able to get away with sending the audio, listening for the text, sending the text, and listening for the response, all over tcp

#

You say your voice is being sent

#

Would players voices be sent?

#

Or is this just a side project, and not a game prototype?

#

Do google provide anything other than REST endpoints for their services? Same question fkr gpt3? Or are you going to be running a local inetance of it?

#

(I forget if they made gpt3 public or not)

oak yacht
# icy thorn How long is your audio processing going to take? How largr are the audio chunks ...

Haven't profiled it. Player uploads complete .wav file to server, that audio's file stream gets sent to google's speech-to-text via their gRPC api, text is received back and sent to GPT3, and then the text result is sent to google's speech-to-text api, before sending the audio buffer back to the payer.

You're right in that I might be barking up the wrong tree though. I already have a working implementation using normal POST https://www.youtube.com/watch?v=QrmjSw7rCA8, and the time savings from switching to a fully streaming setup might be minimal compared to the actual compute time of gpt3 and more specifically the voice synethizer. Might be best to keep working solution and focus on speed optimization later.

icy thorn
#

Yeah, "premature optimisation id the root of all evil", etc

#

That looks reaply cool so far! Gj

oak yacht
# icy thorn Yeah, "premature optimisation id the root of all evil", etc

Starting to feel the pain of that. Spent the day experimenting with different approaches to speed it up to try and get it to as real time as possible, but I'm starting to think, just anecdotally, that the biggest time spent is on the text-to-speech api. Might spend tomorrow profiling all of this, rather than trying to perfectly optimize everything

icy thorn
#

But yeah the lag in between you talking and the npc responding is probably due in large part to gpt3

#

Also speech to text

#

Profiling is very important

oak yacht
#

Watching the server logs, the response is pretty quick, so it might not be text-to-speech or gpt3

icy thorn
#

How does the node server work?

frosty crystal
#

There will be Unity application, and two React application will use the same backend.

#

But I insisted my friend to use SDK instead of using HTTP and lambda things since it is easy to implement and wont share our backend to anybody.

#

And why do you think it is unsafe to use SDK? We do not put any code in it but the id pool id and the hostedUI link.

quick cairn
#

Hi, I have an api (created with python/flask) and this sets a session when the user logs in, in a normal browser this works and the session is respected across different api routes. Does unity have something similar that keeps the session like a browser does?

frosty crystal
#

Hello.

#

In DynamoDB, can I make restaurant table as "restaurant city = partition key" and " restaurant name = sort key"

#

Does it make sense? Or what shuld I do

frosty crystal
#
        public async Task<Token> GetTokenForNextTime(string refreshCode)
        {
            Debug.Log("refresh key ile token alınacak.");
            string text;
            do {
                Debug.Log(refreshCode);
                var request = new HTTPRequest(new Uri(GeneralConsts.USER_POOL_DOMAIN), HTTPMethods.Post);
                request.AddHeader("Content-Type", "application/x-www-form-urlencoded");
                request.AddField("client_id", GeneralConsts.CLIENT_ID);
                request.AddField("grant_type", "refresh_token");
                request.AddField("refresh_token", refreshCode);
                request.Send();
                text = await request.GetAsStringAsync();
                Debug.Log("refresh key ile token ALINDI.");
            } while (text == null);

            return JsonConvert.DeserializeObject<Token>(text);
        }```
#

Hello this gives me throwfornonsuccess. do you see anything unusual?

#

AWS cognito

analog frost
#

there is any way to remove code from the client build but keep it in the server build? like database things

analog frost
#

I think it is not secure to let it stay in the client considering decompilation

#

anyone have a clue? it's also hard to have separated projects, considering most of things gotta be synced to make the game work

#

the client could connect to an API to send/request data? yes but it gonna be more slowly for sure

I think this approach is the corret one tho
maybe I'll make a ZMQ server to handle the database

#

anyone have a suggestions?

brazen canyon
#

add a custom scripting define like #if SERVER @analog frost

analog frost
#

In C# you can use a CONDITIONAL attribute which is a more clean, less error-prone way of stripping out functions

#

looks like it delete

brazen canyon
#

it will be completely removed

#

you can confirm by using something like DNSpy on your built assembly

analog frost
random matrix
#

why is networking so undocumented? how do people do this?? i just wanna use steam servers but i literally cant find anything regarding it

#

im trying to use photon but its not telling me anything regarding using steam servers, they want me to use their servers and pay i guess?

#

the ones i do find seem to be direct player to player connections, which isn't what i want

#

can i use photon voice with mirror?

verbal lodge
#

You cannot use steam servers with your own games.
You can use Steamworks (Steamworks.Net / Facepunch) to use steam networking for p2p connections via the steam relay.
You can probably use Photon Voice with any networking solution but not sure about that one.

random matrix
#

wait wdym, when steam servers go down games made with unity also go down (scp secret lab for example)

#

and that game uses mirror

#

is that what steam relay is?

#

when players connect over steam?

verbal lodge
#

SCP just uses the steam relay afaik.

random matrix
#

oh alright

#

i just want players to be able to play without having to port forward, like a phasmophobia style menu/lobby

cunning sluice
#

With Photon 2, I'm using a Photon Transform View for a cube being transferred across players in VR, but for some reason the cube will constantly shake and be a little delayed

#

Is there a better way to send the position of the cube across the network that will be more accurate?

random matrix
#

does the cube have any rigidbody or anything on it?

random matrix
#

that is probably why

cunning sluice
#

Should I have it be kinematic while it's grabbed?

random matrix
#

yeah i would

cunning sluice
#

Alright I'll try that out

#

is there a preference for the movement type? Right now I have it on instantaneous

random matrix
#

idk ive never used pun successfully

cunning sluice
#

xD

random matrix
#

that was just my guess for the reason

cunning sluice
#

right now I have room listing and other stuff going on, so it's just the interactions that are giving me trouble lol

#

I'll let you know how it goes

random matrix
#

im trying to figure out how to make a server list in mirror rn

#

ive never done networking right

#

and i just took on a super ambitious project

cunning sluice
#

I followed the VR tutorial, since I'm doing it in VR, but it seems like the process is basically the same for non vr

#

eventually I'll have to make this PC compatible

random matrix
#

im working with vr for the first time

cunning sluice
#

so then non vr users can run it

random matrix
#

bruh mine is gonna be vr and pc cross platform

cunning sluice
#

pog

random matrix
#

and ive never done networking or vr before

#

so im sorta dead rn

cunning sluice
#

networking is new to me too

random matrix
#

how did you get a room list?

#

im on mirror but it might be a similar process

cunning sluice
#

well for photon, it updates on the RoomListUpdate

#

so everytime a room updates

#

it'll store the List of Rooms to a script, and then store that info in another list

#

and then I just go through the list and instantiate a ui for each room

#

accessing the info in each one

random matrix
#

o

#

i cant even figure out how to like

#

get open rooms

#

and if i do figure it out i wont have any way to test

#

and dont have any friends that would help me test

cunning sluice
#

yeah I have to like use my quest

#

and then hit play in unity and look at the scene view

#

this is what manages the room list for me

#

and then RoomListing is a class I made that sets the info

#

I made this following a tutorial, but it's getting called in this event

#

OnRoomListUpdate will happen everytime rooms update

#

So if someone makes a new room, this is automatically called

#

or if a room closes, etc

#

originally I was going to use Mirror because I bought a Udemy course on it, but then I decided to use pun2 instead

random matrix
#

i was the opposite

#

i started with pun2 but couldnt find anything at all about steam support

#

like joining via steam and stuff

#

so i just gave up and switched to mirror

#

dapper dino had a pretty good tutorial on it

#

but he didnt go over making a room list afaik

cunning sluice
#

So for pun2 and steam, don't they have their own SDKs?

#

So basically you'd just use the list from the Steam SDK and their own stuff for things like friends list etc

#

but then for the multiplayer part you would just have the players connect to the servers using pun2

#

I'm not really sure, I didn't even know steam had an sdk until I googled it a sec ago lol

#

this guy maybe solved the issue?

random matrix
#

o i dont mean steamvr

#

i mean like

#

steam relay connections

#

and steam authentication and stuff

#

but

#

i just switched to mirror and ive made some progress

#

im just making a simple main menu rn

cunning sluice
#

what project are you working on?

random matrix
#

its a game about storm chasing

#

lemme compress a vid i took for my friends a couple minutes ago

#

thats my menu rn

#

im gonna put a world canvas on that monitor for the actual ui

random matrix
#

@cunning sluice if you decide to use the steamworks api i figured it out

#

painfully

#
    protected Callback<LobbyMatchList_t> lobbyListRequested;
    private const string HostAddressKey = "HostAddress";

    void Start()
    {
        lobbyListRequested = Callback<LobbyMatchList_t>.Create(onLobbyList);
        SteamMatchmaking.RequestLobbyList();
    }
    private void onLobbyList(LobbyMatchList_t callback) {
        int lobbiesMatching = unchecked((int)callback.m_nLobbiesMatching);
        List<CSteamID> ids = new List<CSteamID>();
        
        for(int i = 1; i <= lobbiesMatching; i++) {
            ids.Add(SteamMatchmaking.GetLobbyByIndex(i));
            Debug.LogWarning(SteamMatchmaking.GetLobbyData(SteamMatchmaking.GetLobbyByIndex(i), HostAddressKey));
        }
    }```
analog frost
analog frost
gilded jay
#

for a multiplayer card game service, could someone recommend what to use for the networking aspect

upper scarab
#

how do i make a player to player connection? rn i only have it player1 to server to player2, which is slow (using udp )

grave ice
#

Mirror and Photon are two other great soultions for Unity @gilded jay

grave ice
upper scarab
#

i decided to try and use udp hole punching method

pseudo bronze
cunning sluice
#

In Photon2 I'm having an issue where the cube being passed from player to player in VR is laggy, any fixes?

#

Currently using Photon Transform View, I've tried parenting it to the controllers, and turning in kinematic when it's picked up and so far it hasn't helped

analog frost
#

photon 2 isnt a thing

#

you mean pun 2?

random matrix
#

if anyone would like to stomp on me feel free to, i just spent 3 hours debugging why i couldnt see my lobby when it was just set to private

crimson patrol
#

What is the best package for developing multiplayer games in unity? I have a sound knowledge about programming and backend development but not about unity. Please suggest 🙂

cunning sluice
#

I had just assumed pun 2 = photon 2 lol

cunning sluice
#

I thought it stood for photon unity network 2 or something

#

I'm probably wrong haha

random matrix
#

thats exactly what it stands for

#

not sure why they care so much

cunning sluice
#

oh

#

yeah I just say Photon 2 because it sounds a lot better than Pun 2

frosty crystal
#

Hello. this question is regarding AWS dynamoDB
I have a restaurant app my question is
My primary key consists of "RESTAURANT CITY" as "PARTITION KEY" and "RESTAURANT NAME" as sort key
is this good practice?

frosty crystal
#

2.Question. I have a JWT ID TOKEN. But how can I decode it? Which library?

mighty rampart
random matrix
#

source: am using mirror

wraith monolith
fervent badger
#

Am using pun2

#

Does public override void OnRoomListUpdate(List<RoomInfo> roomList)

#

Not work anymore?

#

I am using Photon.Pun

#

And the behaiour is MonoBehaviourPunCallbacks

#

And if not pls tell me the right syntax

random matrix
#

cant have children objects networkef

spring crane
gentle mirage
#

The last unity net demo used photon realtime for transport, which is what all photon products use for backend transport more or less

fervent badger
gentle mirage
#

I gotcha fam

#

Wat the problem is

#

Oh

gentle mirage
#

I actually have an asset soon to be release to handle this

#

However there are still ways (aka see astroids demo or pun cockpit)

#
public override void OnRoomListUpdate(List<RoomInfo> roomList)
	{
		foreach(Transform trans in roomListContent)
		{
			Destroy(trans.gameObject);
		}

		for(int i = 0; i < roomList.Count; i++)
		{
			if(roomList[i].RemovedFromList)
				continue;
			Instantiate(roomListItemPrefab, roomListContent).GetComponent<RoomListItem>().SetUp(roomList[i]);
		}
	}
fervent badger
#

Thank you

cunning sluice
fervent badger
#

Huh...

cunning sluice
#

It'll only update on their client if they're in a lobby

fervent badger
#

Yea i did

#

Though

#

Theres an error

#

Ur missing thing one

#

That means its not a part of Photon.Pun

river meteor
#

I wanna make in my fps project "dying mechanic", but I don't know if I should destroy players prefab or just reset values and teleport to spawn point. Which is good way to handle something like that?

fervent badger
spring crane
#

@river meteor The question is pretty similar to should I pool or not. Pooling is a neat way to get rid of the Destroy and Instantiate cycle, but does require implementing some sort of reset to all component state. Whether you think it's worth it is up to you.

#

I don't think the networking side cares too much assuming you don't have some large initial syncs for whatever reason, since the streamed data probably overshadows those relatively rare events.

gentle mirage
gentle mirage
# fervent badger Ye bruh it actually works u just need to include using Photon.Realtime

bruh i posted a method not a clas lol, but yes, likely may require realtime import. BIG NOTE FOR PEOPLE USING PHOTON: DONT NAME YOUR GOD DAMN PLAYER CLASS 'PLAYER' LITERALLY ANYTHING ELSE IS GREAT JUST NOT PLAYER (this had me bent over like a prison pinata for like 6 months figuring out why my game would like, only work depending on the phases of the moon (aka c sharp just like, casting shit one way or the other)

olive vessel
#

I mean, it likely would have whined about ambiguity between your Player class and theirs, you could just fully qualify it like Photon.Realtime.Player myPlayer ...

#

Not sure of the exact namespace for theirs

gentle mirage
#

but it didn't

#

it is evil

olive vessel
#

Is your IDE configured?

gentle mirage
#

of course, in fact both rider and vs i used, in fact, i even used rider in linux

#

its not htat

#

its that

#

you can import photon.pun

#

which doesn't include photon.realtime.player

#

but photon.pun.rpc for example can take a parameter of type player

#

in fact, a lot of photon.pun namespace stuff uses photon.realtime.player

#

so its just goes to c sharp JIT hell i guess

#

but considering the solution (right click -> refactor/rename -> Player -> PlayerScript) i'd say risk to reward, especially considering i'm not the only one who had this issue, is prolly worth it

#

also, if player class inheretes monobehaviorpun, it now has photonView, which has photonView.Owner, which is type Photon.Realtime.Player, yet you only import photon.pun

haughty osprey
#

I'm trying to create a steam network thing with mirror i have an issue that when i load my lobby scene from my menu scene the network manager just... dissapears? (in the lobby scene) I have checked all of my DontDestroyOnLoad objects and none of them have a duplicate NetworkManager because i know that duplicates cause errors, nothing sticks out in console either.

gentle mirage
#

whats your like, transport layer or am i dum and steam does this now?

haughty osprey
#

FizzySteamworks

gentle mirage
#

oh huh never heard of thta i gotta look it up

haughty osprey
#

lmao

gentle mirage
#

so its pure p2p, and you gotta port forward and all that

#

thats the one nice part of say, photon realtime for transport, since it uses a relay, IPs are masked and it has like, trusted in all but secure business environment punchthrough

#

plus you can implement your own relay and put minimal (or maximal) logic on it

#

yea i dont know anything on this i cant help you i can only suggest other stuff that doesn't help you at all lol

fervent badger
#

RIP

#

6 month

#

Cuz

#

U couldn't think of anything other shit than player

gentle mirage
#

no, i didn't think since i was using that namespace it was causing any issues but eventually i said f it and magically, intermittent errors went away, then i started participating in the photon forums/discord more and at least 2 other people had weired issues, i suggested that, and they said it fixed it

#

the ide/assembler should get mad at you, and so should unity, but it didn't

wary gull
#

Hey, I'm looking to learn Unity development over the next few years and I've done several basic tutorials, I roughly know my way around the editor, and I've done .Net development for years, so Unity is taking a hobby to the next level.
That said, I'm looking to create a base Multiplayer First-Person-Viewpoint framework using MLAPI to support 64 player connections to a server. The problem I have is that when I connect more than one client, the camera shifts. I've separated the prefab entities so each client's input moves only their entity, but ownership of that entity and the camera still reside with the server.

My question here is simply;

  • Why does MLAPI do this by standard? What scenario would require new players to join and overwrite existing viewpoints? And, on that topic, how do I stop the default spawn prefab process via Network Object so that I can do it myself properly?
wary gull
#

Anyone?

verbal lodge
#

Are you deactivating the cameras on all the player objects of which the client is not the owner of?

#

Ownership of a player object does not reside with the server with MLAPI but with the owner client.

wary gull
verbal lodge
#

What do you mean by spawning multiple clients.

wary gull
#

I create multiple client windows from the build and one server.

#

Input to move the objects is fine.

#

Cameras just don’t work

verbal lodge
#

Can you share your code for input and cameras?

wary gull
#

Give me 5, I’ll need to reopen the project.

verbal lodge
#

Yeah that code looks fine. I'd need the one on your player object

wary gull
#

Then this is my very basic game manager doing nothing really except providing a gui for the server to show its the server, and then the bit at the bottom is my frustration trying to find a way to get it working:
https://paste.ofcode.org/5K29NSLw3cFmfNL8rZfKG2

verbal lodge
#

That should give you an exception. A client cannot spawn a network object

#

Only the server can

#

So SetupClient isn't really doing anything here right. Your player object is just the default player object which MLAPI spawns.

wary gull
#

The bit at the bottom marks as setup complete when the server runs it anyway, it doesn't actually do anything. I basically tried just about anything I can think of to get the camera to work... i.e. prefab the camera, marking every object under the prefab as a network object, and then not, having an empty as the prefab which contains the rest, and not

wary gull
#

not client ownership

verbal lodge
#

So for the camera replace Start with override NetworkStart and it will work. This is a UX issue which we have in MLAPI. Ownership is not defined yet in Awake/Start

wary gull
#

is that it?

#

Do all my objects under my prefab have to be listed as NetworkObjects?

plush flint
#

As far as I'm aware only parent object should have NetworkObject component

wary gull
#

Unfortunately it hasn't changed the camera issue, but strangely I am now seeing the ownership field update for the client connection to "2" for the second client on the prefab item.

#

This looks correct, right?

plush flint
#

Don't know If I can be of any help, but I have 1 player prefab that has Camera as child and a script attached to it, inside of that script in Start function I just do this:

    void Start()
    {
        if (!IsOwner) return;

        PlayerCamera.SetActive(true);
        spawnCharacter(Vector3.zero);
    }

And everything works fine with me, what is strange after reading this conversation between you two 😄

wary gull
#

@plush flint If you spawn multiple clients to connect to the server though, do the cameras remain independent of one another?

plush flint
#

Yes everything works fine, just tested it with multiple clients

wary gull
#

and where have you attached that script above, and what type is it? MonoBehaviour / NetworkBehaviour?

plush flint
#

NetworkBehaviour, its basically just a prefab that has camera as a child

wary gull
#

lol exactly the same setup I have

plush flint
#

so the parent is the one with the script

wary gull
#

yet every new camera that gets created in my framework, it jumps the servers and the clients to the newly created camera, even when the camera still shows as disabled in the heirarchy when its spawned

verbal lodge
#

You really should not use Start

#

There is no guarantee that it works. Use NetworkStart for network behaviours

plush flint
#

Oh okey, thanks a lot

wary gull
#

I'm so lost with this. I just can't understand where this is going wrong. The tutorials really aren't very helpful in setting up a multiplayer game when this is a fundamental issue right out of the blocks 😦

plush flint
#

This is basically my editor window with host and 1 client, clients camera is disabled, you have it the same way? I use ParrelSync so I can have 2 editors open for easy debugging.

wary gull
#

Maybe I'm just wrong... do you disable the component by unticking it in the explorer?

#

This bit, right?

plush flint
#

Clicking that checkbox will disable/enable the component

#

I'm disabling the whole camera gameobject but that should be of any difference

wary gull
#

Maybe that's where I'm going wrong.

plush flint
#

btw I'm very new to all networking stuff and ParrelSync package helps so much with allowing me having 2 editors open and seeing whats exactly going on there, its also faster than always creating builds. So maybe you could try it if you want it should help a bunch

#

You could just manually disabling camera components on clients editor and see whats going on there

wary gull
#

Nah, still doesn't work disabling the entire camera gameobject

plush flint
#

just to be sure, the networkobject prefab that you are spawning, it initially has camera gameobject disabled right?

#

and you only enable it when it's the owner

wary gull
#

See this is what's so confusing... take a look at this, this is the second client to join in to the server:

#

Here's the prefab, the camera is DISABLED!

#

Yet, its the active view for that client, the other client, AND the server.

#

yep, this is the full prefab:

plush flint
#

The first picture where it says isOwner: false, it also says isOwnedByServer: false so who owns that gameobject? 😄

wary gull
#

this is what's entirely baffling to me lol... all I'm doing is specifying the game to run from the build via command line, without any arguments.

#

OwnerID 3 is the correct ID too... its the 2nd player to join

plush flint
#

If my calculations are right, the second player should have ownerID 3

#

yeah, so that's really confusing 😄

#

From editor you connect as a client, and from one of the builds as host right?

wary gull
#

Aye, the build hosts it, then I connect from the editor, then connect from the build

#

I've spent 14 hours looking at this now, and it's insanely frustrating that it just doesn't do what it's supposed to do 😐

plush flint
#

Well at that point, I would probably open DapperDino's channel, view video where he is spawning players, copy the whole thing, check if it works and if yes, implement it into my project, if not I would probably start crying

spring crane
#

Doesn't MLAPI have samples available?

wary gull
spring crane
wary gull
#

Yes

spring crane
#

That's not MLAPI

wary gull
#

Explains why I couldn't find any references to it... It's linked on the MLAPI page though as a showcase for MLAPI

spring crane
wary gull
#

IDK, I can't remember where I found it. Either way, it wasn't too helpful to understand it, and all of the tutorials on that one you just linked haven't helped, they've essentially got me into this situation where cameras are never unique, and instantiating doesn't work correctly. The only thing I've changed really is the prefab that's used, and the inputmanager with a keyhandler to accept wasd inputs

spring crane
#

FPSSample does use Unity's transport layer, which is basically the lower level component for the higher level part, like MLAPI and Mirror, which implement several transport layers.

#

Most packages have samples listed for it in the package manager

wary gull
#

I'm not seeing any:

spring crane
#

Might have something to do with being a git package

#

Still not on the package manager natively? 🤨

wary gull
#

nope, not on the current 2021.1 release either. I'm on 2020.3 though

spring crane
#

Oh MLAPI is still v 0.1.0? The heck y'all doing? Pick a networking framework that at least thinks it's ready for use 😄

wary gull
#

Other networking frameworks have limitations with hosting, usage, or concurrent player counts

spring crane
#

Did you check Mirror?

#

There are more than ExitGames and Unity in this space 😄

wary gull
#

I think I did check mirror out, isn't that the one that cannot be used for cloud gaming?

spring crane
#

What do you mean by that?

wary gull
#

something I read somewhere that with certain multiplayer networkings you can't use your solution for cloud-gaming without breaching Unity's ToS... which is why I was looking at MLAPI because its owned by Unity

spring crane
#

Oh the SpatialOS thing

wary gull
#

Ah yeah, that's the one... they used mirror network framework right?

spring crane
#

It doesn't affect developers running their own servers for their own game.
(I'm not a lawyer, this isn't legal advice 😄 )

#

SpatialOS is their own thing that provides hosting for other games. There was a licensing dispute there

wary gull
#

Aye, but they also had a multiplayer FPS framework which used mirror for networking

#

and then a few short days afterwards, the whole dispute kicked off

spring crane
#

Kinda doubt they were using Mirror

wary gull
#

I'll give it a shot and see if I can get at least a step further ahead than with MLAPI anyway

spring crane
verbal lodge
#

The "Spatial OS thing" had nothing to do with Mirror. If you are creating a game with Unity, you can use cloud hosting solutions to host a Unity server without breaking ToS.

limber holly
#

I have a problem with Photon: when a second player enter the game, I have a second player 1 instantiated too

#

and a second problem, when I try to connect to Photon with the game build and the unity Game test, players don't seems to be in the same room

spring crane
spring crane
limber holly
#

thanks for answer, no player in the scene, just instantiate

wary gull
#

@spring crane Mirror did in about 15 minutes what MLAPI took me 15 hours of troubleshooting couldn't fix.. thanks 👍

prisma ingot
#

Im not sure if i should start with mirror or photon pun 2

#

can anyone help

limber holly
#

I know you can find lot of tutorials with PUN 2

analog frost
#

anyone in here ever made a game using server authority mode?
where you have a master server that spawn new rooms for the players?

wary gull
tawdry star
#

How does server / client tick rate work?
Do you need to sync the current tick for the client and server?

opaque briar
#

Hey, i want to make a Multiplayer game which only contains UI which send data between the Players. Is Mirror good for this or did you know a better Solution.

glass rain
#

where should i start learning networking with mirror

olive vessel
#

DapperDino and First Gear Games have some useful tutorials on Mirror on YouTube

patent fog
#

Then the youtube tutorials :)

wary gull
#

I'm not sure if this is a "general" coding question, or a "networking" question... but from a performance perspective, is it better working with classes attached to GameObjects that can then be synced to the server, or using network variables?

weak plinth
#

Hey guys! I was wondering if there are any good TCP/UDP client and server solutions. I want the client and the server in a different project. I've seen some attempts on this problem, but ive only stumbled upon on barely OOP code with insane ammount of public fields with no getters and setters. Thanks in advance.

maiden marsh
weak plinth
#

❤️ this looks something i was looking for

keen mirage
#

how can this translate this into url in unity? doing this id = 4 doesnt seem to work

cobalt python
#

HI, gyus! Question about PUN. I have a problem with destroying go. I have gloves prefab that contains 2 child: leftglove and right glove. Gloves prefab is set to mainGloveContainer and left and right to theirs containers accordingly, so there are 3 containers total. When i try to PhotonNetwork.Destroy left and right glove i have an error on other client:

#

It seems that photon tries to destroy main glove go as its id is 1008. But it has been already destroyed

spring crane
#

I would really double check what is being destroyed, since PN.Destroy doesn't seem to be travelling to parent objects looking for a PhotonView and viewid mismatch seems unlikely.

cobalt python
#

thanks

quick cairn
#

Hi, i have a question. In TCPclients, Byte[] bytes = new Byte[4096]; <-- specifically, this line... what does that do exactly? I have a large (variable size) of a packet that comes in from the server as a json object. Is that byte size limiting me from getting the whole json object?

#

or does that simply split the packets in 4096 byte chunks and they get reconstructed by the client?

river meteor
#

there is limitations for PhotonViews components and RPC calls? (PUN)

icy thorn
#

So either theres chunking

#

Or it can only deal with fixed size packets

quick cairn
#

so can i guess my next question would be, how can i not set it and let it figure out on its own?

icy thorn
#

If you have a variable size packet, you need to allocate a fixed size buffer for the header (which must have the length of tbe data segment) and thrn you can collect the whole packet

#

If you dont want a header, you should store every chunk, and append to a single list or somethin

#

Only stop appending and try to read the packet when an 'end-of-packet' is reached

#

What that specifically is depends on how you send packets

#

And you run into the issue that you will be blocking until the entire buffer is filled, which could contain 1 byte of the current packet, then 4095 bytes of a new packet

#

I would suggest going for the |size| . . . data . . . | approach, as its much easier

#

Are you doing networking yourself?

icy thorn
quick cairn
#

i see

#

i'm basically doing an irc client in unity

icy thorn
#

You must know how much data to read, especially using tcp, because otherwise you risk blocking

quick cairn
#

and the channel history, it sends it at the beginning of joining a channel

#

and that's a big packet of variable size

icy thorn
#

You can set nonblocking, but that raises exceptions, which is slow

#

Are you willing to send custom, binary packets? Or do you only want to send json?

#

Are you willing to use sockets, or do you want to use TcpClient and friends

#

I would suggest going for TcpClient, and creating a custom packet structure. Send an int, with the packet size, then send all the bytes of your json string.

#

On the other end, read the size, then read that many bytes into an appropriate buffer

#

so what you could do is:

// receiving data
byte[] headerBuffer = new byte[4]; // buffer size = sizeof(int)
int headerBytesRead = conn.Receive(headerBuffer); // this is for a socket, ymmv
ReadOnlySpan<byte> headerSpan = headerBuffer
int bodyBytes = MemoryMarshal.Read<int>(headerSpan);
byte[] bodyBuffer = new byte[bodyBytes]; // this can be pooled to avoid allocation
int bodyBytesRead = conn.Receive(bodyBuffer); // again, this is for a socket
string payload = Encoding.UTF8.GetString(bodyBuffer); // the encoding can be whatever you want
// do something with the payload

// sending data
string payload = "..."; // get this somehow
byte[] bodyBuffer = Encoding.UTF8.GetBytes(payload); // encoding here must match previous encoding
int bodyBytes = bodyBuffer.Length;
byte[] headerBuffer = new byte[4]; // again, sizeof(int)
Span<byte> headerSpan = headerBuffer;
MemoryMarshal.Write(headerSpan, ref bodyBytes);
int headerBytesWritten = conn.Send(headerBuffer);
int bodyBytesWritten = conn.Send(bodyBuffer);
#

note that for both cases, you have to handle conn.Send() and conn.Read() returning a number less than the total bytes you need to handle

#

for that, you might want to use the following loop:

private bool TryRead(Socket conn, byte[] buffer) {
  int read = 0, toRead = buffer.Length;

  do {
    int readNow = conn.Receive(buffer, read, toRead - read, SocketFlags.None);

    if (readNow == 0) // error condition, connection closed on other end
      return false;

    read += readNow;
  } while (read < toRead);

  return true;
}
#

the TrySend version is very similar:

private bool TrySend(Socket conn, byte[] buffer) {
  int written = 0, toWrite = buffer.Length;

  do {
    int writtenNow = conn.Send(buffer, written, toWrite - written, SocketFlags.None);

    if (writtenNow == 0) // again, error
      return false;

    written += writtenNow;
  } while (written < toWrite);

  return true;
}
#

if you want to do your own networking, this is an ok starting point

#

but i would recommend you dont

#

when using TcpClient, a lot of this headache goes away

#

you would still have to setup some kind of packet structure, but you have to think less about errors

#

also, to handle channel history, just keep it on the client

#

append to a local file, with a history file per channel the user is in

#

have the option to delete the history file

#

that way your server is lighter, and uses less bandwidth

#

@quick cairn did i scare you off? :^)

quick cairn
#

the only problem with that, is the the channel history will keep updating even when you're logged off

#

so at some point, when you login, you still need to fetch all the history

icy thorn
#

True

#

I forgot aboit that facepalm

quick cairn
#

worst comes to worst, i'll get rid of channel history, in my case it's not really that important\

#

i was more concerned with the size of each message sent

#

about that 4096 bytes

quick cairn
#

thank you for your input i really appreciate it

wary gull
#

I’m totally just going to bury my head in the sand and just hope the default networking stuff works 🤪

steady crater
#

Hello,can somebody help me? I use mirror for networking. How i can fix problem when all players see from host camera? Now i make camera.depth = -10 and disable audio listener if not local player, but i think exists so smart ways ( i cant destroy camera if not local player because player selected item is child of camera)

olive vessel
#

Disable the camera if it's not the local player? Simple as it gets

steady crater
olive vessel
#

?

#

The Camera component has a selected item?

steady crater
# olive vessel ?

GameObject with camera and camera control script have a selected item in child ( if i move camera, selected item will be move too)

olive vessel
#

Yeah when I said disable the Camera, I meant the actual component called Camera

steady crater
olive vessel
#

Did you just ghost ping me?

meager zephyr
#

Has anyone ever worked with UNet's Network Discovery's broadcast data? I'd like to use the broadcast data to transmit specific metadata using delimiters to clients searching for joinable servers, such as current server population.

However I realize that broadcast data needs to be set before hosting a server, and cannot be changed while the server is being hosted (I may be mistaken here). So this makes broadcast data useless for updating current server metadata to searching clients.

Is there a workaround for this, or perhaps I am mistaken? New to multiplayer with UNet/Mirror. Any help would be greatly appreciated. Thanks!

violet anvil
#

anyone know a good netorking totorial that would work for an openworld game (a dedicated server)

teal obsidian
icy thorn
#

Yeah, you dont say

#

Originally, i suggest using binary

#

But, if someone wants to get started using json its not an issue

#

And the question was about the packet structure, not the fastest way to transfer data

#

All it would take to convert a packet that uses json, to a packet that uses a custom binary structure, would be to add a new field to the packet header for the "packet type". Then have an enum for all of the different packets you send, and write the correct enun value into the packet header. Then write the individual fields of the packet, and read them in the same order

#
// you can use a different backing type if you have more or less types, to save a byte or two in the packet header. the default is int
enum PacketType : short{
  MessagePacket,
  HistoryPacket,
  // add more types
}

// receiving data
byte[] headerBuffer = new byte[6]; // buffer size = sizeof(int) + sizeof(short)
int headerBytesRead = conn.Receive(headerBuffer); // this is for a socket, ymmv
ReadOnlySpan<byte> headerSpan = headerBuffer
int bodyBytes = MemoryMarshal.Read<int>(headerSpan.Slice(0, sizeof(int)));
PacketType packetType = (PacketType)MemoryMarshal.Read<short>(headerSpan.Slice(sizeof(int), sizeof(short)));
byte[] bodyBuffer = new byte[bodyBytes]; // this can be pooled to avoid allocation
int bodyBytesRead = conn.Receive(bodyBuffer); // again, this is for a socket
ReadOnlySpan<byte> bodySpan = bodyBuffer;
// do something with the packet
switch (packetType) {
  case PacketType.MessagePacket:
    // a message packet could look like |user id|utf8 message| 
    int userId = MemoryMarshal.Read<int>(bodySpan.Slice(0,sizeof(int)));
    string userMessage = Encoding.UTF8.GetString(bodySpan.Slice(sizeof(int))); // get remaining bytes
    // do something with tbe user id and message
    break;
}
#

Sending packets is very similar, except that you write the header into the buffer, and you write fields into the body buffer at different offsets

languid marten
#

Hello can someone help me make a sql multiplayer game the game is built just dont have the multiplayer fully working

olive vessel
#

A SQL Multiplayer game?

#

Is it about creating tables and avoiding SQL Injection?

robust sandal
#

Hello, I am very unexperienced with Photon/PUN/Networking and have been following a tutorial series by Welton King, everything has been working perfectly with photon until we made a room list function, players can see other players rooms, the names and players connected to the room but when joining the rooms players cant see eachother nor can they see any other functions that should be called through RPC's, any help?

#

Ive tried skipping the whole room list functionality and just making a join create button immidietly but that still doesnt work, something messed up when trying to make the room list thingy, if there arent any problems here it might have to do with PUN regions?

karmic kayak
#

hi i'm using GameSparks for an online quiz game, i fixed every things and works fine in preview mode but when go in live mode i get this error in Unity console

GS: System.NullReferenceException: Object reference not set to an instance of an object

also this is the line that this happening :

soalatlist = _message.ScriptData.GetGSDataList("soalatList");
grave ice
#

game sparks isnt supported anymore

#

its dead in the water

#

no tweets or updates for over 12 months

livid valley
#

How do I go one about making a peer to peer unity game

#

There seems to be no tutorial about it that I can find

olive vessel
#

Mirror? MLAPI?

#

Tonnes of tutorials for those networking solutions

livid valley
#

Wait wait wait

#

They're peer to peer?

olive vessel
#

Clients can connect to a hosting client yes

#

Might require port forwarding or punch through

#

@languid marten Quite why you decided to DM me I have no idea, that is in contravention of the #📖┃code-of-conduct

olive vessel
languid marten
olive vessel
#

BTBG creates a simple series about using Unity, PHP and SQL to store and retrieve player data

languid marten
#

That video is how I did it but I have a different type of database then them because my site is designed to be like roblox

olive vessel
#

I'm familiar with their site, though I have no idea how the backend works

languid marten
green tide
#

Am I getting this right? If I want an enemy to shoot at a player, the player has to tell the server to spawn this projectile?

near cairn
#

Say what library would you recommend for LAN stuff and dedicated servers?

#

Should I just make a custom implementation?

#

Never tried it in C# how long would you reckon it'd take?

icy thorn
#

have you done it before?

#

if youve implemented it before, not too long

#

dedicated servers arent that hard (with tcp at least; the ping can be bad, but on average its ok)

#

tcp for slower games, udp for fast paced games

#

LAN is a bit annoying

#

peer-to-peer could be fun, but difficult

#

it depends on your scope

#

theres obviously photon and mirror and the other one (ML?)

#

usually, i would say use photon?

gleaming prawn
#

If willing to use photon, just go for fusion

ancient iris
#

how would i create a prefab for my third person player if i have like seperate camera for it, im using cinemachine

#

like it's not a child of the player

#

so how would i make it respawnable with camera

high night
#

@ancient iris spawn without camera

#

if character is local character, then it can use the camera
otherwise, that character doesn't touch the camera

ancient iris
#

so if i create a prefab of the player, and spawn in, how do i make it so both players get the same properties of the camera but two different camera for each prefab

high night
#

there is just one camera on each client

#

and local character controls it

ancient iris
#

Yea so what would i do

#

Just spawn it in

#

Without camera?\

high night
#

//spawns without camera

if(isLocalPlayerOrSomething){
UseCamera(camera.main);
}

ancient iris
#

so where would i put this if state ment

high night
#

it works for anything

#

if local player, you use the camera the way you wanna use it

#

like in update or something

#

if not, you don't touch the camera

#

so there is just one character moving the camera and its the local players character
@ancient iris

ancient iris
#

one last question

#

if i have an animation (dodge right animation) that moves me to the right, whenever i dont use root motion it just gets stuck in that position and the camwera doesnt move with it, but if i use root motion it slides back the original positiom, how would i make it so it plays and the camera moves with it

#

like a dodge right

high night
#

i don't ever use root motion

#

i have movement logic/collision/physics in character parent

#

and i have an animated character under it

#

for dodge, i'd play the animation and move the capsule myself trying to sync it to animation as close as possible

#

and camera just always follows the capsule
@ancient iris

#

if you try to design your character in a logic in a way that it can work without the animation logic, it will be more sustainable and helpful in many cases

ancient iris
high night
#

so i suggest not letting character logic know about animation logic or animation
animation logic knows character logic but not the other way around

high night
ancient iris
#

i see

#

wait so

high night
#

no root motion in animator

ancient iris
#

heres the problem

#

i have a empty game object called player then as a child i have my actual player (the prefab i got online)

#

and my animations are in the actual prefab

high night
#

and it translates when you roll

#

right?

ancient iris
#

yea

#

its really weird

#

it like goes in circles

high night
#

and thats your issue

ancient iris
#

that gets wider

#

and the camera doesnt move with it

high night
#

i said that i suggest not using root motion

#

thats because your visual character moves and camera follows the parent

#

@ancient iris just disable the animated character

#

add a mesh filter/renderer to your character parent

#

implement the roll that way

#

just a capsule doing a fast move

#

and then worry about syncing the animation

ancient iris
#

if i remove root motion my feet sink into the the ground

high night
#

you got feet IK?

ancient iris
#

ok wait it's fine

#

ill j re do my thing

#

but ty for the help

high night
#

my tip is

ancient iris
#

im new to this

#

unity

high night
#

make it work with just a capsule and then use/sync the animation

ancient iris
#

ah

#

yea

#

imma try

#

doing

#

first person

#

and using a capsule instead

high night
#

you will sync the capsule part, you will not sync the animation part
animation part will be reproduced locally

#

character logic will not ever know about animators name or your animated body

ancient iris
#

imma try to recreate a first person sword game

high night
#

fighting games require good netcode

ancient iris
#

yea

high night
#

predictive you know

ancient iris
#

i would just position the camera do the models head

#

and then child it?

high night
#

no

#

camera wont be childed

#

just make it follow via code

#

in update or late update

#

you will also have some more issues with your fixed update/update syncronizations

#

you will probably have stutters

#

but we can talk about that later when you get there

ancient iris
#

got it

#

ok

#

thanks for all ur help

high night
#

np

ancient iris
#

is it fine if i dm u if i have any questions later

high night
#

fine

ancient iris
#

LOL ok i wont bug u

near cairn
#

@icy thornThanks for a reply, doesn't Proton utilize a single dedicated server that you setup though?

icy thorn
#

theres cloud options and self-hosted options for Photon iirc

#

you would have to check

#

what you should do depends on what you want to do

#

if you want to learn how it works internally, implement your own

#

if you want to learn how it works in a practical sense, and then ship something, use a 3rd party solution

near cairn
#

Alright

#

Thanks for advice I'll look into it

icy thorn
#

np

river meteor
#

I made flashlight, I networked it over network properly and Im turning it off/on by spotlight.enable value, everything works but on another client I can't see the light, I don't know where is the problem, any ideas?

steady crater
#

I use mirror. How i can destroy item for all players? I i write like that, if client destroy item host dont see that.

spark sleet
lusty tiger
#

If I'm making a Peer 2 Peer game using Steamworks I would only need to replicate absolutely necessary things, like player location, rotation, health, what weapon they're holding, monster/enemy locations, rotation, and health. And things like what's in their inventory don't necessarily need to be replicated correct?

#

I could take player location changes and play animations locally without having to send from one peer to the other which animation exactly they are playing, inventory wouldn't be a big deal as long as whatever the player is holding or using is being replicated I would assume?

spare ridge
#

Has anyone experience using MLAPI?

ancient iris
#

hi im using photon and when the player connect the camera individually is working but whenver i move it controllers the other player, not my player, anyone know the problem, btw i used if view.IsMine

keen mirage
#

is it possible to pass a form-data to PUT Request in unity?

robust sandal
#

Hello, I am very unexperienced with Photon/PUN/Networking and have been following a tutorial series by Welton King, everything has been working perfectly with photon until we made a room list function, players can see other players rooms, the names and players connected to the room but when joining the rooms players cant see eachother nor can they see any other functions that should be called through RPC's, any help?

#

Ive tried skipping the whole room list functionality and just making a join create button immidietly but that still doesnt work, something messed up when trying to make the room list thingy, if there arent any problems here it might have to do with PUN regions?

spring crane
#

PUN ships with samples that have a lobby

river meteor
robust sandal
#

Im sorry, i dont really understand what youre saying

#

How do I use what u just said and fix the script? @river meteor

river meteor
#

did you check if your variable t_roomName is the same as room name while creation?

night cargo
#

hey internet can anybody help me with my movement

high night
#

paste your question

night cargo
#

i have some problems with my movement
im working on online game]
and i launch two instances of a game and when i press wasd both characters move

#

using photon

#

the code:

high night
#

there should be some boolean that tells that character belongs to the local client

#

if that boolean is true, only then you do the input

#

@night cargo
there are more details to this
you should just follow a tutorial

#

its easier that way

steady crater
#

Hello everyone! Can somebody tell me why objects dont destroy? I got error : "Trying to send command for object without authority"

night cargo
#

can u sent tutorial link plz

high night
night cargo
#

can documentation help me?

high night
#

well, theres some stuff about the setup

#

and object authorities

#

and spawning "player" objects

#

which is like the entry point for a player to send any command to server

#

you'd be better off seeing a tutorial imo
@night cargo

night cargo
high night
#

i would wanna get my hands on a minimal, working example and understand it.

i thought tutorials are helpful for that
just my opinion

high night
#

you might wanna put that function in players script

steady crater
high night
#

you shouldnt need to call command on server
@steady crater

#

if its server doing the destroy, just make the server call the destroying function

#

no commands

#

or you mean to make client call command for server to do the destroy

#

is this a client initiated destroy?

steady crater
#

yes

high night
#

just move the function to authorized player object?

#

and call it there?

steady crater
#

this object dont spawned by player, its object exists from game start , nobody have a authority on this object , only server can destroy it if i think right

high night
#

you could have like a DamageThing() command in player script

#

youd call that on local clients character

#

and that would make the server destroy the object without authority issues

night cargo
#

@high night can i put it like this

#

private void Update()

#

if (photonView.IsMine == false && PhotonNetwork.IsConnected == true)
{
return;
}

high night
#

i am sorry its been a long time i used photon

and since these are one time stuff i dont remember anything at all

#

if you follow a video tut, you should get some nice copy paste material to get you going immidiently
@night cargo

#

some capsules shooting at other capsules

#

thats the classic

night cargo
#

i couldnt find anything;(

high night
#

One of the more important features of Photon you'll find yourself using more often, called "RPC (Remote Procedure Calls)". Today we'll be taking a look at this, and how it differs from direct data sending/receiving. An alternative to this is also available, called "Raise Event".

Be sure to join the discord server for any sort of help, I'm dece...

▶ Play video
#

this is where i learnt

#

the series i mean

#

this is vid 4
you start from first one

#

2 years old so i guess its fine?

#

if you use pun2 though maybe look for a pun2 one

#

i like that its a fast paced one
doesnt go into unnecessary stuff

river meteor
#

But you must first specify photonview of your player object

#

Each photon view have unique ID

#

For ex private PhotonView PV = GetComponent<PhotonView>():

spark sleet
#

Hey, pretty new to networking, I'm using Mirror.

#

If I want to tell if I'm the host I need to store the first client, right, since host is just the server without a client?

gray pond
robust sandal
river meteor
#

Are instantiating players by PhotonNetwork.Instantinate?

robust sandal
#

Not sure, i can maybe check later but everything worked completely fine until i tried following the room creation tutorials in a video series ive been following

#

Something messed up around ep 43 - 44 - 45 https://youtu.be/u_mhGhXTbjs?list=PL6PsTmPNvw0eZirNDjO8dL0Y6X0ZFGaMt if that helps anything

Hey chumps! In this video I will show you how I added a room list to our fps game!!
It's gonna take a good mixture of UI and Photon callbacks to get the job done!

Join our Discord: https://discord.gg/vrErfxa
Catch up on Github: https://github.com/Kawaiisun/SimpleHostile

BFXR: https://www.bfxr.net/
Piskel App: https://www.piskelapp.com/
Audaci...

▶ Play video
river meteor
robust sandal
#

Bro that's so smart why didn't I think of that

river meteor
#

Or they are instantiated locally

robust sandal
spiral lark
#

anyone able to help me trouble shoot an issue ive been having with my game. im using photon btw. just @ me or dm me if you could help me out

river meteor
#

what does StartGame(); function do?

robust sandal
#

Its all the way down at the bottom of the script

#

idk how to send code

river meteor
#

but you dont instatinate the players in any place

#

you must do playerobjects as prefabs, then put these prefabs into Resources folder and then in StartGame function or OnJoinRoom use PhotonNetwork.Instatinate

cunning sluice
#

So for Pun2 I added a OnOwnerChange to a script, and a targetcallback in the awake and destroy but it still doesn't work

#

Is there something else I need to have it receive the event for when the objects owner changes?

ancient iris
#

my camera is a child of my fps controller

river meteor
#

tip: ```cs
void Update()
{
if(!view.IsMine)
return;

        isGrounded = Physics.CheckSphere(groundCheck.position, groundDistance, groundMask);


        if (isGrounded && velocity.y < 0)
        {
            velocity.y = -2f;
        }

        float x = Input.GetAxis("Horizontal");
        float z = Input.GetAxis("Vertical");

        Vector3 move = transform.right * x + transform.forward * z;

        controller.Move(move * movementSpeed * Time.deltaTime);

        velocity.y += gravity * Time.deltaTime;

        controller.Move(velocity * Time.deltaTime);

    
} ``` this would be simpler to use in future
#

but I don't why controls are swapped

#

did you instantinated players by PhotonNetwork.Instantiate?

ancient iris
#

and also i did instantiate it, ```using System.Collections;
using System.Collections.Generic;
using UnityEngine;
using Photon.Pun;

public class SpawnPlayers : MonoBehaviour
{
public GameObject playerPrefab;

public float minX;
public float maxX;
public float minY;
public float maxY; 

private void Start()
{
    Vector2 randomPosition = new Vector2(Random.Range(minX, maxX), Random.Range(minY, maxY));
    PhotonNetwork.Instantiate(playerPrefab.name, randomPosition, Quaternion.identity);
}

}```

river meteor
#

you can try but I shouldnt change anything

ancient iris
#

like the camera works but the im controlling the other player instead of my player

#

idk why

river meteor
#

try add to your player script ```cs
public static GameObject LocalPlayer;

void Awake(){
if (PV.IsMine)
{
// Change YourPlayerClass with your player controller class
YourPlayerClass.LocalPlayer = this.gameObject;
}
}```

ancient iris
river meteor
#

yea it can be to movement script

#

then in your SpawnPlayers class

#

add condition

#
    private void Start()
    {
        if(YourPlayerClass.LocalPlayer == null) {
        Vector2 randomPosition = new Vector2(Random.Range(minX, maxX), Random.Range(minY, maxY));
        PhotonNetwork.Instantiate(playerPrefab.name, randomPosition, Quaternion.identity);
        }
    } ```
ancient iris
#

in this case

river meteor
#

As it the name says classname of player

#

What is your player movement class?

ancient iris
#

MovementScript?

#

Or am i dumb

river meteor
#

So replace YourPlayerClass with MovementScript

ancient iris
#

Im confused

river meteor
#

yep

ancient iris
#

Yea

#

ok

ancient iris
#

@river meteor when i tried ur thing i couldve move at all

#

and i got this error

river meteor
#

What line 27 is?

ancient iris
#

ill re do then

weary forge
#

Anyone with photon experience

#

What are the main differences between bolt and PUN

#

What would fit best for a small scale multiplayer game with low costs (preferably non)

cunning sluice
#

So for Pun2 I added a OnOwnerChange to a script, and a targetcallback in the awake and destroy but it still doesn't work
Is there something else I need to have it receive the event for when the objects owner changes?

#

Could it be I'm not inheriting from the right class?

weak plinth
#

anyone can solve bugs in photon? dm me

stone goblet
#

MLAPI - The type or namespace name 'NetworkBehaviour' could not be found (are you missing a using directive or an assembly reference?)

olive vessel
stone goblet
#

and MLAPI networkvariable

olive vessel
#

Ok, NetworkBehaviour is from MLAPI, so add that namespace

stone goblet
#

when i enter the unity link it just does nothing

#

i do it through manifest

#

this correcly?

olive vessel
#

Ok, you still need the MLAPI namespace for NetworkBehaviour

#

Alongside MLAPI.NetworkVariables for network vars

#

And MLAPI.Messaging for RPCs

#

So if you can import the latter two, I don't see why you can't import the former