#archived-networking

1 messages · Page 101 of 1

high night
#

@sweet mason I don't know much about photon actually, i never had used those fancy stuff

#

You just gotta make sure you are sending the i mean

#

One might get confused with local data when dealing with this stuff

sweet mason
#

Well, thank you very much. I'll then do some more research to make sure I'm sending the data.😇

alpine badger
#

I think i might use photon but i will also probably use tom welands C# tutorial/ Sockets

#

I cant wait till fusion releases

vale marlin
#

hey, im using the free photon unity thing, and got it set up so that i can create and join rooms. I made it so that whenever you create a room/join one, a start button needs to be pressed to instantiate the player prefab. and it works, but the player sees the other player floating slightly above the spawn and syncing eachothers animations but not movement despite me adding a photon transform and animator view component to the player prefab

pls help

candid tundra
#

Has anyone had success with AWS Gamelift using their Realtime Servers? I've got a simple test setup and I'm able to connect to a GameSession but my Unity Client can't receive any messages from the server (server log shows the client can successfully send to the server). Client logs indicate that the UDP connection doesn't seem to be connecting, but no obvious reason why (I seem to be choosing a correctly open port in the range recommended in the AWS documentation). What's odd is it was working for a while before it stopped working, and I don't think I've changed anything. Just wondering if anyone else has experienced this.

frosty crystal
#

Hello.
How can I get all the documents in a collection?
Here I had to use Type to Equal but I do not want to use equalization.

#
        {
            dishes = new List<EatableBaseClass>();
            Query capitalQuery = db.Collection("restaurants").Document("RedRest").Collection("menu").WhereEqualTo("Type", "Kebap");
            capitalQuery.GetSnapshotAsync().ContinueWithOnMainThread(task => {
                QuerySnapshot capitalQuerySnapshot = task.Result;
                foreach (DocumentSnapshot documentSnapshot in capitalQuerySnapshot.Documents) {
                    dishes.Add(documentSnapshot.ConvertTo<Dish>());
                }
            });
        }```
#

I want to download all the documents belonging to "menu" collection by one by

grave ice
#

Photon has a cloud hosting solution with it and offers some products that differ from Mirror/MLAPI. But PUN2 is free and Self Hosted Server is really cheap.

candid tundra
smoky crest
#

trying to understand networking for crossplatform input

#

how do i obtain players IP address in this instance?

#

seems to like this slightly more

cobalt python
#

Hello! what is the best online engine for begginers and a fps game like among us?

zinc gulch
#

How to change server at FPS Sample?

cursive field
#

Hi guys, I'm using mirror, but when the player spawns he flies away into the sky, I can't send the code here because it's too long, help me pleasee

olive vessel
#

Well that is unhelpful, try putting the code in a paste site and linking here

grave ice
grave ice
cursive field
#

@olive vessel Good idea, I'll do this

#

The problem is that that when the player spawns it flies up

grave ice
#

can you try setting the rb velocity to 0 on start @cursive field

#

We can confirm this is not an issue with your moving script and maybe some weird spawning behavior.

cursive field
#

ok, i'll try but i can confirm it because it was working before adding networking to it

#

@grave ice what do you mean with rigidbody velocity?

#

in the script?

grave ice
#

Player controller line 11 you have a rigid body

cursive field
#

okok

grave ice
#

So use rb.velocity, for example @cursive field

cursive field
#

yeah okok

#

Ok I've added this line to the start "rb.velocity = new Vector3(0, 0, 0);" but nothing changed

#

wait can i call you on Discord to show you a thing with screen sharing?

#

@grave ice

grave ice
grave ice
cursive field
#

Ok

grave ice
#

I'm not too familiar with 3D movement but I'd recommend looking up "unity 3D move scripts"

cursive field
#

But the script was working

#

it stopped when I added multiplayer

grave ice
cursive field
#

So it will surely be a networking problem

regal delta
#

anyone do any dedicated server / multi client architecture setups here? I'm working on one that uses the SignalR libraries

candid tundra
regal delta
#

I just want some advice on abstract implementation. I have a setup where clients will be running a "thin client" like Unity app--let's say for mobile right now. The mobile device then connects to a server using SignalR and uses a Hub to make remote calls on the server (requesting authoritative data). The server should log it and send back JSON data to the client. Right now I have a demo that does this, but it's such a big thing to look at (SignalR, WebSockets) that I'm afraid of making a mistake that will be a security issue. How should I implement secure sessions using SignalR?

covert haven
#

Can someone tell me the difference between photon realtime, pun and bolt?

#

Which one is the best for like a competitive-type fps game?

#

also no peer-to-peer

candid tundra
regal delta
#

yeah right now I'm just using a self signed for localhost testing, I plan on doing that exact thing though. I'll just go for it with a TLS connection and see what happens

#

Has anyone used that plugin by chance?

loud yew
#

I've noticed a lot of people saying MLAPI is in development and probably not the best networking solution for commercial use. When it is fully developed will it be the standard? I'm trying to choose a solution for hobby projects with the purpose of learning/building a portfolio and am curious what path to go down

regal delta
# loud yew I've noticed a lot of people saying MLAPI is in development and probably not the...

That was a decision I faced early on. By it's design, MLAPI will never be a good solution for multiplayer when you want a dedicated, authoritative server that runs completely different code than what runs on the clients. MLAPI and other client hosted solutions run the same code on each client as on the server (so that a player becomes a host) and then focuses on permissions from there. What happens when a malicious player becomes a host breaks the entire system apart.

#

so now I'm into the weeds with using a web development framework for a video game because the engine doesn't provide an option that I want, but that's just me being picky I guess

loud yew
#

Thats a great article thank you, mirror has the same downfalls? read your edit

spring crane
#

Aren't most of them primarily dedicated server solutions?

#

PUN stands out as being primarily peer to peer over relay and actually one designed for host migration

regal delta
#

By default, most people will be running the same build on a client as they would on the server. This is not really a viable commercial solution, unless you're making a game where that's ok, like minecraft. In my mind, I wouldn't want a client to even have a binary of server code on it. I need something that is more secure.

#

Luke Unity is a project lead on this--he's comin in with the best info

verbal lodge
regal delta
#

don't you still have to run tons of checks everywhere to see if the the RPC is being called by a client or server?

spring crane
#

Yea I think viewing them more as something similar to Minecraft or Source games, where yes, the clients often ship with the necessary stuff to be a host, but you don't necessarily run them in a configuration where the host is changing and you have the option to run them as dedicated servers.

verbal lodge
#

MLAPI has a very clear distinction of server and client code. For instance a ServerRPC will always be run on the server.

regal delta
#

is it just that it's easiest to do it that way?

verbal lodge
#

You can still build dedicated servers by having the server and client code in the same project/scene. This is fairly commonly done if your server side code needs access to engine features such as physics.

#

If you are afraid of cheaters you can also strip server code from your client builds by using the #UNITY_SERVER compile define.

loud yew
regal delta
#

arg that just seems like a LOT of if statement defines

#

what I have done in the past is build a second project in Unity that is the server, that has completely separate code, and use a socket connection to communicate back and forth between client and server

#

that way the server has access to all Unity engine stuff and the code running on the client isn't the same as the server

#

but then I realized for my specific application that I don't need it on my server--but that's irrelevant haha

verbal lodge
#

Yeah I wish we would better support that pattern with MLAPI. I think we can get there though. In theory you can already do that with MLAPI there is just a lot of undocumented things which can go wrong.

regal delta
spring crane
#

Can't you technically revert to sending network messages and ignoring the features of the library?

#

Not exactly sure if there are a lot of benefits at that point though 😄

#

First party serialization support?

verbal lodge
#

There are also other smaller features you could still use like ConectionApproval. But yeah at that point you can just use a low level transport library like the Unity Transport Package.

loud yew
#

Hmm so is Unity Transport and Netcode/DOTS as a whole the future? Seems like what I should be working with Nevermind, it obviously is. Time to jump in the rabbit hole

verbal lodge
#

MLAPI, UTP and DOTS Netcode will all be part of our multiplayer stack. Each of them fills a different role:
UTP: Either for simple games or advanced teams with netcode expertise, allows you to build your own high level solution.
MLAPI: The netcode solution we provide for the GameObject/MonoBehaviour space.
DOTS Netcode: The netcode solution we provide for DOTS ECS.

candid tundra
hasty condor
#

Is anyone getting this error when they build their project?

ArgumentException: Value does not fall within the expected range.
  at System.Net.Sockets.Socket.SetSocketOption (System.Net.Sockets.SocketOptionLevel optionLevel, System.Net.Sockets.SocketOptionName optionName, System.Int32 optionValue) [0x00000] in <00000000000000000000000000000000>:0 
somber sable
#

any PUN2 experts please dm me. I need help

grave ice
#

@somber sable you really should just ask it here

stiff ridge
stiff ridge
#

Or just ask.

teal obsidian
#

@high night You wrote your own netcode for your game right? About how often are your client predictions wrong from the server?

I'm using the default character controller component from unity and every few seconds my client is off from the server by about 0.001

#

not a lot ik, but it's on the same computer and I was under the impression that it was supposed to be deterministic on the same machine

#

just curious as to what values you're getting

high night
#

@teal obsidian I don't check for prediction errors like that, i just put the client 1 secont ahead of the server as if client had 1 second of latency, so there would be 1 second of predictions. And i try to make sure it stays stable like that.

#

I just send states back from server for each tick

#

And client just rollbacks everytime assuming as if whole prediction was off (i didn't care about average case, i think worst case is what matters here)

#

I don't think you'd be able to rollback unity's default character controller very nicely because i think it holds some states that we don't have access to

#

Maybe not, i just skimmed over it and decided i would go with a rigidbody controller instead to not have those kinds of issues

#

@teal obsidian The reason your character control rollback is not deterministic is most likely these unhandled internal states in the character controller.

viral minnow
#

I'm making a multiplayer game rn and I'm at the part where I'm handling movement. Is it ok for performance to send a packet to each player for every entity movement or do I need to put multiple movements into one packet?

high night
#

@viral minnow I believe if you use syncvars or streams, they should be optimized nicely

viral minnow
#

umm. I have no idea what syncvars are. Also I'm using java for my server

high night
#

They should have a send rate you specify, i believe they are packed into one packet at each step

viral minnow
#

client is unity tho

high night
#

I see, i'd think about packaging them then

#

There sure are some packet overhead

viral minnow
#

how big should the packages be?

high night
#

I had asked this question before somewhere i think
I'd remember it should be good if your bandwidth is below 100kbps

#

that makes 10 kp per packet if you send at 10 hz

viral minnow
#

for the entire server?

#

ohh for the packet?

high night
#

for 1 client

viral minnow
#

oh

#

ok good then

high night
#

I think you should be below that anyways

#

10hz send rate adds to the latency indirectly though

viral minnow
#

one movement packet is like 8 bytes so it's probably ok

high night
#

If you wanna build some crispy action game, you'd need faster send rate

viral minnow
#

I'm planning on using same tick rate as minecraft

#

so 20

#

it should be ok imo

high night
#

I'd be okay with 10 i think

#

I had made a game with 9hz send rate

#

Which was the default value i think

#

Wasn't so bad, well it was bad because of my netcode

viral minnow
#

umm maybe I'll try 10 then

#

can just switch to higher later

high night
#

yeah

viral minnow
#

why 100kbsps btw?

high night
#

Thats just the value that i head in my head, i dunno where it comes from. I remember talking about that in some discord channel

viral minnow
#

oh ok

#

thanks!

high night
#

np

gleaming prawn
#

these are spot on

high night
#

However, packets of 576 bytes or less are guaranteed to traverse the IP network without getting fragmented (which means you will have fewer dropped packets).
@viral minnow
I read something like this

#

So smaller is better

viral minnow
#

ok thanks

#

that was helpful

high night
#

np

dense hedge
#

the IPv6-specified MTU (1280 bytes) should be universally supported

regal delta
# loud yew ~~Hmm so is Unity Transport and Netcode/DOTS as a whole the future? Seems like w...

I feel like there's a lot of buzzwords around choosing frameworks. I think DOTS will be the eventual "holy grail" path people will want to take for their games if they want dedicated multiplayer server and multiple clients connecting to it--if Unity pursues that as an option. If you do want hosting ability built into your game, then you should go with MLAPI. Otherwise, make your own since it looks like a viable dedicated server solution is not coming anytime soon, and putting in potentially hundreds of #UNITY_SERVER statements seems pretty painful.

somber sable
hasty condor
stiff ridge
#

Within the same LTS version, you can upgrade to newer builds.

hasty condor
#

Ok, thanks

teal obsidian
#

anxiety starts to build up when I see miscalculations like this and it makes me feel like I'm doing something wrong. That's my reason for asking people about their experiences with this.

candid tundra
#

It's totally normal for the predicted vs server state to differ slightly, there's tons of possible reasons. If it's not disruptive to your game play you're fine. It's better to focus on handling when things go wrong properly then trying to prevent them.

timber lava
#
        {
            foreach (Transform o in this.GetComponentsInChildren<Transform>(true))
            {
                o.gameObject.layer = LayerMask.NameToLayer("Hands");
            }
        }```
#

using Mirror

#

does anyone know why this if statement is never true?

#

input is a network behaviour that lies on the parent of the player prefab

#

this code is being called on a child gameobject

grave ice
timber lava
#

yes i get that

#

but it is indeed my local player

#

in fact on the input class, i use isLocalPlayer to check for input and it works fine

loud yew
#

I'm working through the Getting Started with MLAPI tutorial and was thinking about how you all test out your projects. Do you build everytime and setup a host and multiple clients or is there a way to do it within the editor?

timber lava
#

i figured out my issue btw. it actually had to do with the fact that i was calling my code in Awake. i suppose server side stuff is also initialized in awake, so that was causing a conflict with isLocalPlayer not being assigned yet

#

changing it to Start worked

verbal gorge
#

I'm looking for a way to save player progress, and sync two clients together.

For the player progress, it sounds like I'd need to setup a database, with a login, register and password reset system.

Once I have that up and running, I'd use the logged in player_id to match two clients together?

In order to connect and sync the clients to one another I'd want to use mlapi?.

I'm very new to Unity in general, and was wondering if anyone could recommend any resources / tutorials for me to look through?

I understand this is probably way out of my depth for my first ever project, but I need to learn somehow. xD

high night
#

@verbal gorge Networking solutions give you ways to call RPCs on remote client or server with remote parameters
That's how the communication works

#

You can handle figure out your own serialization and send byte arrays in those rpcs

#

I haven't used mlapi yet, it looks like it has some nice stuff to make the serialization easier

#

I'd look for a bare minimum tutorial to get started with, at least that's what i back then

#

I had followed a tutorial with player capsules shooting projectiles and synced health

#

If you want to have players host on their own p2p style, you might be better off with photon, or figure out mlapi to work with steam or some other relay system, or use steamworks transport in mirror.

loud yew
#

https://www.youtube.com/watch?v=4Mf81GdEDU8&t=562s
This series has been helping me a lot, it doesnt cover saving player data but it does go through connection approval, RPCs, and syncing network variables @verbal gorge

This Unity Multiplayer tutorial will teach you all about the new official Unity multiplayer solution and how to get it set up quickly in your own project!

Multiplayer Course: https://www.udemy.com/course/unity-multiplayer/
----------------...

▶ Play video
high night
#

Does mlapi have some stuff about rollback?

#

What are these in the mlapi docs?

verbal lodge
#

MLAPI has no prediction/rollback feature currently.

high night
#

I see, thanks

verbal lodge
#

That doc page is just a glossary which explains some common netcode terms.

high night
#

I see yeah, i didn't pay attention to the title, my bad.

grave ice
#

I have a deterministic lockstep model working, and I need to send a simulation state for when a player joins late.....

#

I can either send the entire map state over the network, or I can send a complete input history and have the client simulate back up-to-speed

#

Does it not make sense to use lockstep and sometimes send the sim state? It feels illegal 🤣

gleaming prawn
#

late joins you should send a compressed snapshot

floral turtle
gleaming prawn
#

that's just technical dept @floral turtle

#

oh, lets not spend time creating a proper serialization, lets just send the input history...

#

That works for joins at and close to the start.,.. but with a long running game, it's not a good approach

#

It's considered a weakness of the model (if snapshots are not implemented)

#

I can tell you from experience with several several customers...
Since we introduced automatic snapshots in quantum, not questions are asked...:)

floral turtle
#

yes, I cant imagine any modern deterministic games would do that. Since even if you are forward only I assume most modern determ games build out a snapshot system for checksums

#

but I find it a nice property of determinism that you can do things like rejoin with inputs. Shows how elegant the system is

#

even if you wouldnt use it in a practical sense

grave ice
grave ice
floral turtle
#

erick would know the process best

#

^ 😄

gleaming prawn
#

But that's more like an overkill protection against accidental determinism bugs left by the dev

#

We have ONE customer doing that... It's always possible

grave ice
#

I imagine its more relevant to realtime games, turnbased lockstep dont need to worry about checksums always matching

gleaming prawn
#

And it's useful for development

#

We have that in quantum, together with a frame-state dump+diff tool...

#

So that's super useful during development to spot where you make a mistake

grave ice
grave ice
#

I'm doing basically what TrueSync did, which is FixedMath (C# fixed math) on top of an existing physics engine

#

Thank you guys for your advice @gleaming prawn @floral turtle

gleaming prawn
#

I was the original developer of TrueSync btw

strong axle
#

I am trying to make a multiplayer game with Photon Pun
When i instantiate a attack prefab. the player who didnt create it oul get ths error
Ev Destroy Failed.Could not find PhotonView with instantiation 1005.
I am using this to destroy the object

            if (gameObject.GetComponent<PhotonView>().IsMine)
            {
                PhotonNetwork.Destroy(gameObject);
            }
grave ice
grave ice
#

is it dumb to send anything other than longs for FixedMath?

#

fixed math's raw values are longs so those are safe to send

gleaming prawn
#

this is not a problem

#

If you convert form float directly from the machine that is sending that as input

#

So not sure what your question is... If you know what you are doing, this would not be a problem

#

If you convert from float to FP inside the SIMULATION, then you are screwed

#

You can't do that...

wraith flame
#

does anybody have even a single clue how to use the eos sdk

inland dome
#

Hey, can anyone help me with a question? (I am still pretty new to networking) I am creating a 2 players multiplayer game, one hosts and the other joins, I am using Mirror to do it. But I can't figure out how to make my friend connect in remote, because all I had done at this point was using localhost to connect to myself using Mirror built-in network GUI. Do I need to set up a dedicated server for remote connections or is there a simpler method? (For now I just want to test the game with my friend, so even if there is a simple way even if it's not practical in a real published game, that will also do)

olive vessel
#

If you are hosting as a client, he uses your public IPv4 and you need to port forward

candid tundra
#

Not specific to Unity, but wondering if there's a simpler way to get all players to handle an event at the same "wall time" in a P2P, client authoritative setup. My current thought:

  • Elect a 'leader'
  • All non-leaders synchronize clocks with the 'leader' (Something NTP like, send current time, get a response with the sent time and the leader time at receive time, factor in round trip/2 to your offset)
  • Leader sends a 'handle this event at x my time'
  • Non-leaders can translate x leader time into y local time, and trigger the event then
grave ice
#

I imagine conversions are only an issue if conversions are indeed not deterministic, which the developer stated he is unable to find out.

#

But I'm going to to avoid floats and just use longs to be careful

gleaming prawn
#

And you do not need to send fp or long as imput, these are too big

#

Send packed bits

dense hedge
candid tundra
#

I was imagining using Time.time, are you suggesting tick count instead because it's more reliably consistently incremented across clients?

grave ice
#

I convert a few floats to FPs to construct physics objects in the sim

grave ice
#

so my approach should be good right?

loud yew
#

is it possible to get MLAPI.Relay up and running on a local machine and would I just have to open the relay port on my router?

livid junco
#

I need a simple library to make peer to peer multiplayer game. Any recommendations?
Needs to be fast and easy to implement.
The game will be simple, i just need to send like player position, and like 5 integers over network.
Everything i found its server based network.

floral turtle
#

@livid junco by p2p do you mean where players themselves act as a server ("host" or "listen server") or like an actual p2p network?

gleaming prawn
grave ice
#

@gleaming prawn thats not entirely true with FixedMath (the library) but I understand your point

#

thank you btw

gleaming prawn
#

I’m just telling you the principles. I wrote two deterministic libraries which were/are used by dozens of released games… so I have a bit of experience on the topic.

grave ice
grave ice
#

for example with TrueSync/Quantum, do you have each client convert and build the world separately but identically? Or you start off with a single snapshot

gleaming prawn
#

If they build from floats it would differ

#

You either pre-bake the worlds saving in fp in the build, or you build procedurally from fp, or as last resort you let one machine creates and pass the initial snapshot

azure oracle
#

How to get a count of available rooms in pun 2? And what is the differences between photon server 4 and 5?

weak plinth
#

Hey 🙂 i have a problem with my current game... the players in my online game should have the ability to place walls ingame and for some reason only the host can place walls properly (with properly rotation), but for some reason the player who joins the lobby, cant place walls with a rotation... here's my code about placing and rotating walls:

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

public class WallPlacing : MonoBehaviourPunCallbacks
{
    public GameObject wallPrefab;
    bool isInstantiated = false;

    
    PhotonView view;
    void Start()
    {   //get the photon view component
        view = GetComponent<PhotonView>();
    }

    
    // Update is called once per frame
    void Update()
    {
        if (view.IsMine)
        {
            if (Input.GetKeyDown(KeyCode.LeftControl))
            {
                view.RPC(nameof(PlaceWall), RpcTarget.All, Camera.main.ScreenToWorldPoint(Input.mousePosition));
                
                //view.RPC(nameof(RotateWall), RpcTarget.All  );
            }
        }
    }

    //place a wall at cursos pos
    [PunRPC]
    void PlaceWall(Vector3 position)
    {
        GameObject wall = PhotonNetwork.InstantiateRoomObject(wallPrefab.name, new Vector3(position.x, position.y, 0), Quaternion.identity);
        var dir = Input.mousePosition - Camera.main.WorldToScreenPoint(wall.transform.position);
        var angle = Mathf.Atan2(dir.x, dir.y) * Mathf.Rad2Deg;
        wall.transform.rotation = Quaternion.AngleAxis(angle, Vector3.forward);
        //wall = PhotonNetwork.InstantiateRoomObject(wallPrefab.name, new Vector3(position.x, position.y, 0), Quaternion.identity);
        //RotateWall(PhotonNetwork.InstantiateRoomObject(wallPrefab.name, new Vector3(position.x, position.y, 0), Quaternion.identity));
    }
}

In the video you can see what i mean...
thank you for your help and your time 🙂

grave ice
#

in my product, however, I have gotten deterministic results everytime while building from floats

#

Since FixedMath's conversions are deterministic except in cases of overflow, and the developer still hasn't confirmed its not-deterministic.

For my case, I can keep my setup and add an initial checksum comparison to send sim if needed. A better setup will be avoiding using floats and will use longs instead...thank you so much for the advice! Really appreciate it @gleaming prawn

verbal lodge
#

FixedMath has no deterministic float conversion. It's just a regular 31.32 fixed point implementation. You might get deterministic results on the same machine but you won't get it across different hardware.

grave ice
#

In fact, the developer says the behavior can be made deterministic if you enforce a min-max for casts, or by throwing an OverflowException (using the "checked" keyword)

verbal lodge
#

a single division or multiplication should yield the same result across any compliant implementation of the floating point standard.
According to my knowledge this is not true. And can easily be debunked with a Unity build on PC + Android.

#

The IEEE floating point standard does define how floats are represented in memory. Different CPU manufactures still use different methods to perform operations on those floats.

grave ice
#

There is a paper that proves that that question is correct (read top answer)

verbal lodge
#

This paper talks about truncation of doubles to float. It does not talk about floating point determinism across platforms.

grave ice
verbal lodge
#

The comment in issue 23 is correct.

#

The problem is how you obtain the float in the first place.

#

float foo = 5f will not give you a cross platform deterministic value.

grave ice
#

Doesn't the developer in issue 23 state these conversions are fully deterministic (minus the one issue he points out) ?

verbal lodge
#

He states that his way of converting an existing float to long (by multiplying) is deterministic.

grave ice
grave ice
verbal lodge
#

Well actually after reading issue 23 again. The developer is just wrong.

verbal lodge
#

the float is multiplied by an integer constant (this is floating point multiplication)
This is not determinstic

#

He makes assumptions about how the CPU does floating point multiplication. He might be right, he might be wrong. Depends on the hardware.

grave ice
#

His comment though "The multiplication must be deterministic because the constant is a power of two (so it amounts to incrementing the exponent on the result)."

#

thank you so much for the help btw @verbal lodge

verbal lodge
#

All I can recommend is really to test on all the hardware you plan to release. Don't assume because it is deterministic on one machine that it will also be on others.

grave ice
#

That being said, I'll still include an initial chcksum comparison and send a snapshot if needed

#

again thank you

ocean condor
#

can anyone help me with Containerised servers through Docker? I get an error saying that the image doesn't exist, but I dont know where to make it

#

Please ping btw :)

upper mica
#

Hey guys!
Has anyone encountered the exception "ArgumentOutOfRangeException: 'capacity' must be greater than zero." while using NetworkList with a custom serialized object in MLAPI?
It happens as the client attempts to join a hosted lobby.

weak plinth
#

whats the best networking solution for a small game, one thats only for my friends? i was looking into mirror and photon and i also heard about the new mlapi, which should i use?

olive vessel
#

Photon's nice because you can avoid port forwarding and all that jazz

#

Plus if it's only small and for your friends, I doubt you'd go over the 20CCU

weak plinth
#

what about the new mlapi one

#

by nity

#

unity*

olive vessel
#

It's a cool thing, but like Mirror requires hosting or P2P

spring crane
#

@weak plinth Definitely PUN. Easiest API I've seen and the server is already running

weak plinth
olive vessel
#

Yeah

weak plinth
#

ah

olive vessel
#

Whereas as Danny says, PUN does the heavy lifting

weak plinth
#

ok

#

what about bolt?

#

photon bolt

spring crane
#

I wouldn't bother unless you are aiming for higher quality networking, like solid lag compensation and hit reg

weak plinth
#

alright

#

thanks

#

wait

#

does pun have support with webgl?

spring crane
#

Yes

weak plinth
#

ok ty

spring crane
#

In fact I'm not sure what other Photon products work on WebGL 🤔

#

Well apart from realtime, which is a base for all(?) Photon gameplay stuff

pseudo drift
#

Is it a bad idea to use animation events in a multiplayer game? specifically for an MMORPG? Im using a spherecast at the moment during attack animations

spring crane
#

It was fine until I turned on animation culling and pushed to prod 😄

dusky vigil
#

For a first time making a network game would you suggest MLAPI or PUN?

gleaming prawn
#

Fusion

#

Just released as a successor to Pun and Bolt (which will continue to be supported, but won't receive new features, etc)

patent fog
#

Fusion is out ? Nice !

robust cypress
#

When I do PhotonNetwork.LoadLevel(); A first time on the MasterClient it loads for everyone, but when I try to reload the game with LoadLevel on master Again just loads on the master client and nothing for the others

robust cypress
#

If you need more details ask idk where to even start lookin

stiff ridge
robust cypress
#

Thank you, sad that feature isn't there, I've seen you a lot on the forums everytime I look for photon answers btw, It's like meeting a celebrity

stiff ridge
#

Naaa, it's not but thanks all the same 🙂

robust cypress
#

is the tiger named tobi ?

stiff ridge
#

That's Hobbes from Calvin and Hobbes.

kind pawn
#

i have this test case where I'm pulling an image from a url and applying it to a raw image I have in scene. It works in the editor however when I build webgl and run in browser locally I am getting CORS error and I can't understand why as I've added every header I can think of. I've also added a golang script to run this with proper headers as well but I still can't figure what I am missing?

faint plaza
#

Is it worth it for a smaller game to have a dedicated server basically for the sole reason of stopping (some) cheating (editing xp + currency) and preventing/increasing the difficulty of piracy?

timber lava
#

probably not

#

depends how small

lost kraken
#

Hey, anyone!

Is there a way to toggle Cloud Diagnostic through script?
I want to query the players before allowing crash reports and such to be sent automatically.

But I don't find anything in the API or on the web

quaint fiber
#

Does anyone know how to make a multiroom game in Unity, similar to games like Habbo Hotel with one server with many "rooms"

#

I thought of making a general server which create seperate Unity "server" instances but I guess this would cause problems with ports and the like

quaint fiber
#

hmm

#

I'm working with MLAPI atm

spring crane
#

You probably wouldn't wanna use Photon for a game like that anyway, apart from maybe Realtime? If you wanna use Unity for the server, you should be able split things to some extent, like using separate PhysicsScenes and setting up camera culling. With logic you obviously have to take care to split them in a way where data isn't shared between them uncontrollably

#

Spinning up Unity instances for each individual player is indeed probably not ideal

grave ice
#

you may as well just run the server on unity at that point too lol

charred mason
#

Hi all,

I want to call an AWS lambda function from my client (that will obviously be distributed to players). Is it best practice to create an IAM role that only has access to call that lambda function, and embed those keys in my code? Or what is the best way to do this?

grave ice
#

I'm really not sure, but aren't Lambdas publicly facing rest endpoints? And those permissions determine access to other AWS services (and maybe access to that lambda too)?

#
edgy void
#

Is UnityEngine.Networking UNet? I'm confuzzled

rough grotto
edgy void
#

Ah. I'm trying to conceptualize a custom networking solution.

cobalt python
#

Hello! I am using PUN and have a question. There is an object in the scene Sword. Player can pick up it and make a new parent WeaponContainer so sword position and rigidbody is no longer needed to be sync as it is attached to a player. I change ownership of the sword but i need other player to know that there is a new parent object for this sword (a player's weaponcontainer). how can i implement it? with rpc i guess..

dusk glacier
#

Hello! 🙂
I am investigating an issue with TLS on https requests to a webapp that is hosted on Netlify. The requests were working fine until last week, now I am getting SSL connection errors with requests to any website that is hosted on Netlify.app (I tested our application and multiple open-source ones).
My first guess is that Netlify changed their certificates and as Unity relies on the operating system to validate the certificate issuers, those new certificates would not be validated correctly until the OS was updated. I implemented a custom certificate validation, but it wasn't even being called. Then I ported my UnityWebRequest calls to HttpClient to see if I could get better exception/logs and got this:
TlsException: Handshake failed - error code: UNITYTLS_INTERNAL_ERROR, verify result: UNITYTLS_X509VERIFY_NOT_DONE
Looks like it is failing even before the certificate validation is done. All the pages that I tested have valid certificates and work fine on the browser.
It is quite easy to reproduce. With an empty project, I wrote a simple get request to https://hugo-theme-even.netlify.app/index.xml (first result for Netlify.app on GitHub) and the same error happened
Do you have any idea?

quaint fiber
spring crane
#

I assumed you were referring to the challenge of hosting server authoritative instances that may just have few players on each of them

lyric osprey
#

How would one go about syncing bone movement over a network?

#

spineBone.transform.eulerAngles = playerMovement.playerCamera.transform.eulerAngles + new Vector3(0, spineOffset.y, -spineOffset.z); only works on the client, the rotation doesn't appear on anyone else's screen. it's inside of the if (hasAuthority) then statement

crisp prairie
#

hey, does someone know if Physics.Raycast is deterministic? - given the case: i move my sphere colliders that shall be hitted by the Raycast, with deterministic code.

robust cypress
#
public class ServerList : MonoBehaviourPunCallbacks
{
    public static List<RoomInfo> Rooms = null;
    public override void OnRoomListUpdate(List<RoomInfo> roomList)
    {
        Debug.Log("sqddzqz");
        Rooms = roomList;
    }
}

Why does this never get called even though I connect and create a room

#

or is there a better solution to get all the rooms available

winged geyser
#

I'm using Ruffles from TwoTenPVP for rUDP so I can use a headless DGS (in fact, the DGS is completely non-Unity).

Is this approach on the client going to be performant? Singleton NetworkManager game object:

        private void Update()
        {
            if (!Connected && !ConnectionInProgress)
            {
                StartConnection(); //calls RuffleSocket.NetworkManager.Connect()
            }
            else if (!Connected && ConnectionInProgress)
            {
                PollConnectionAttempt(); // polls the RuffleSocket for Ruffles.Core.NetworkEventType.Connect and marks the connection attempt as successful
            }
            else
            {
                PollServer(); // does mostly everything else by calling RuffleSocket.NetworkManager.Poll() and routing or invoking the messages accordingly
            }
        }
#

(I was struggling to get an async/await approach to work)

grave ice
robust cypress
#

Since one has to use OnRoomListUpdate to get a list of the rooms, does that mean that if player A creates a room while player B's app isnt running then Player B wont be able to get a list unless a room is modified

buoyant tusk
#

how to disable that

dire condor
#

Hey wanted to ask if anyone knew of a tutorial or guide/docos/information for how to set up a matchmaker (utilising unity and mirror)? The server hosting is strait forward and loads of tutorials on that, but I couldn't find anything on the matchmaker or game controller side. Don' t want to use steam because I want it to be playable on android as well.

grave ice
rough grotto
dire condor
dire condor
gleaming prawn
#

They have zero relation to each other

soft palm
#

Does anyone knows the best approach on getting players standing on a moving platforms working with client side prediction?
I currently have to following options:
-Disable the client prediction on a moving platform and let the server take over the movement calculations.
-Predict the moving platforms on clients as well and let the client predict their movement on the platform.

winged geyser
#

Any thoughts/advice/starting google search queries/etc for structuring my network messages? Ideally they're binary or somewhat obfuscated, compact, secure (ie - not BinarySerialized), and extensible (so I can add features/messaging to the data structure over time).

#

(I would love to not pack/unpack my own messages)

dense hedge
# soft palm Does anyone knows the best approach on getting players standing on a moving plat...

There is no clean way to handle players on moving platforms when you're juggling two timeframes.
Think about the case with three objects: you (the local player), the platform, and a remote player standing on it.
Disabling clients' local input prediction isn't generally gonna fly, so realistically you have three options:
A) Predict yourself. Interpolate the platform and the remote player.
B) Predict yourself and the platform. Interpolate the remote player.
C) Predict all three objects.

#

Without doing weird hacky shit, A and B have problems at low server send rates.
If you do A, you'll mistime jumping on/off the platform.
If you do B, remote players will lag behind the platform, and sometimes just be floating in air.
In either case, lag compensation will break completely once you're standing on the platform. Fixing that would involve re-parenting everyone to the platform while they're "on" it.
C is the only clean solution, where you predict everything. You'd have to send the remote player's inputs along with the state data tho or you'll badly mispredict their movement.

#

This problem generally applies to any kind of shared physics object. It's why Apex doesn't even have elevators or moving platforms, just ropes and ziplines.

#

Rocket League does C, but that'd be too expensive for larger games.

winged geyser
winged geyser
# winged geyser Has anyone used ``MessagePack`` for Unity and got the code generation working? <...

Nevermind.. digging through the issues in his github repo, I found a workaround that worked - force the dotnet version to 3.1.x. I also fixed a bug - the class you want to serialize has to be public (obviously).

[MessagePackObject]
public class ISGMessage // won't work without the public keyword.
{
    [Key(0)]
    public string MessageName { get; set; }

    [Key(1)]
    public string MessageContents { get; set; }
}
frosty crystal
#

Hello. I am using Firebase and want to write a linq expression to retrieve data from the noSql server. This code is an example for Entity framework

#

Do we have kinda solution for it?
I mean when I call this "GetAll" function from outside of this class, I will put some expressions and this expression will be my query.
Or I should just pass a firebase query as paramater?

Thank you in advence.

soft palm
#

@dense hedge thanks a lot for the in depth explaination!
I will test out the 3 solutions you have provided, and hopefully can get away with option A or B because predicting remote clients is going to be a bit expensive for my type of game.

spring yoke
#

should i use MLAPI or Mirror for a multiplayer fps

#

and can both of them integrate with steam

soft palm
#

I would chose mirror, which also supports a steam networking transport layer

empty cradle
#

hello, I am having issues with MLAPI that I can't quite get over with. My client calls a ServerRPC which seems to work, but then in that ServerRPC I attempt to spawn a projectile (because I assume I am in the server), but it says Only server can spawn NetworkObjects on the log... Any help?

verbal lodge
#

Does this log appear on the server or the client?

empty cradle
#

It appears only on the client

#

The server is a host

verbal lodge
#

Is your RPC on a NetworkBehaviour? Is that NetworkBehaviour on a GameObject with a NetworkObject component on it?

empty cradle
#

I thought it was, but it wasn't after all!

#

I wish they threw a log when you try to call an RPC and this scenario happens... even a warning one

#

Thank you, I'll try now

frosty crystal
#
        {
            List<Restaurant> restaurants = new List<Restaurant>();
            Query allCitiesQuery = FirebaseFirestore.DefaultInstance.Collection("restaurants");
            allCitiesQuery.GetSnapshotAsync().ContinueWithOnMainThread(task => {
                QuerySnapshot allRestaurantsQuerySnapshoot = task.Result;
                foreach (DocumentSnapshot documentSnapshot in allRestaurantsQuerySnapshoot.Documents) {
                    if (documentSnapshot.Exists) {
                        Restaurant doc = documentSnapshot.ConvertTo<Restaurant>();
                        restaurants.Add(doc);
                    }
                }
            });
            return restaurants;
        }``` Hello. I am almost going crazy. this fucking function does not return this "restaurant" list
#

I got "0"

#

Debug.Log(restaurants.Count) = 0 If I call this function from outside of this foreach, I got "0"

#

do you have any idea?

candid tundra
winged geyser
#

I'm already using MessagePack over protobuf. I have some concerns, though, about using a binary serialization framework due to the security issues.. I'm not sure how I'm going to overcome that or if I'm going to "best effort it" until some point in the future where someone blows up my server and I have to switch over to JSON/XML 🙂

#

Sorry - I didn't mean to say "i'm already using X" in a negative way - just meant more that I reviewed protobuf but I think I like MP better (since it can support nullable types)

#

I'm not exactly sure how I want to structure my serialized class though.. maybe something like

public class ISGMessage
{
  public MessageType ISGMessageType;
  public string? MessageString;
  public int? MessageInt;
  ... etc ...
  public enum MessageType 
  {
    ClientMovePlayer,
    ClientStartMission,
    ServerSendPlayerState,
    ServerSendReward,
    ServerSendMissionCompleteDetails,
  }
}
candid tundra
#

I'm not sure about messagepack but I'm reasonably sure protobufs don't have the same deserialization security problems .nets basic deserialize does

winged geyser
#

hm .. i'll review that

#

my understanding is any binary de/serialization has security issues

candid tundra
winged geyser
#

Although maybe the above structure is... stupid because it tries to generalize an ISGMessage.. maybe I should subclass messages based on the type (and things they need) and the parent just has the MessageType enum and no other details (or maybe something like timestamp/client id/etc) and have the subclassed messages have the details they need

candid tundra
#

I've done something similar using protobufs where you would have an ISGMessage with the common fields, the a "oneof" with the types of specific messages. Sorry can't help with message pack but used protos a ton in my day job

#

How would subclassing work with the deserialization, I guess deserialize it as the base class, then inspect the message type to determine the specific type to deserialize it as again.

#

I guess the equivalent would be yeah to have a type enum then a bunch of fields, one per specific message with the specific contents (ClientMovePlayer etc). So you always deserialize to a ISGMessage and then from the message type field you know which specific message field is populated.

empty night
#

how easy or hard would it be to integrate something like pun 2 in to an existing project that is still early in dev stages?

#

not caring how hard it could be really ill put the work in

winged geyser
#

like:

public class ISGMessage
{
  public MessageType Type;
  public byte[] Message;
  public enum MessageType
  {
    ClientMovePlayer,
    .. etc ..
  }
}

public class ClientMovePlayerMessage
{
    ... stuff ...
}

... prep a message for sending ...

ClientMovePlayerMessage ClientMovePlayerMessage = new ClientMovePlayerMessage { ... };
ISGMessage ISGMessage = new ISGMessage { Type = MessageType.ClientMovePlayer, Message = MessagePackSerializer.Serialize(ClientMovePlayerMessage) };
byte[] networkMessage = MessagePackSerializer.Serialize(ISGMessage);

.. send networkMessage to server ...


.. on the server ..

byte[] incomingMessage = ServerEvent.Data;
ISGMessage ISGMessage = MessagePackSerializer.Deserialize<ISGMessage(incomingMessage);
.. if ISGMessage.Type == MessageType.ClientMovePlayer ..
ClientMovePlayerMessage ClientMovePlayerMessage = MessagePackSerializer.Deserialize<ClientMovePlayerMessage>(ISGMessage.Message);

#

this could work

#

(that was also a lot of code to write in discord directly lol)

winged geyser
#

this is really good.

candid tundra
#

I think you could just do something like:


public class ISGMessage
{
  public MessageType Type;
  public enum MessageType
  {
    ClientMovePlayer,
    .. etc ..
  }

  public ClientMovePlayerMessage movePlayerMessage;
  public ClientStartPlayerMessage startPlayerMessage;
  ... etc ...
}
#

then you just deserialize it to ISGMessage and you know with field with the message is populated from the message type

#

but I suppose I'm not sure how message pack would pack unset fields, I'm assuming it would be very little, if any, overhead

#

but your approach would work too

winged geyser
#

if i did the above I'd use nullable fields, since messagepack can handle that easily (with no overhead)

#

ie,

public ClientMovePlayerMessage? movePlayerMessage;

candid tundra
#

yeah, makes sense

winged geyser
#

but I don't know if I like the idea of sending a monolithic ISGMessage object .. might make debugging hard

#

if there's a dedicated ClientMovePlayer class then i can probably do some validation inside of that class

#

like once it hits the server and is unpacked, validate it

candid tundra
#

you can do that either way, just one you have an opaque blob of bytes in the ISGMessage until you explicitly deserialize it into the type

#

and the other you just have one layer of serialization/deserialization

winged geyser
#

aye

#

i wonder if there's any performance implications for de/serializing something twice .. i'm assuming there is

#

i also don't know yet if de/serializing works from OS to OS - ie, if the client is on mac and the server is windows, if an "int" will always deserialize the same way.. i haven't got that far yet in my documentation/source diving

#

in any case thank you for being a sounding board in the design of this 🙂 i'll let you know how it pans out

winged geyser
candid tundra
#

np, good luck! cross-OS should be fine except for floating points which the platform themselves might handle slightly differently

winged geyser
#

I just realized that deserializing-to-json becomes a pain in the ass if i have to double-deserialize it

#

ISGMessage will be kind of a big class but I think that in practice, most members are going to be null anyway

#

i'm gonna test it out tho

candid tundra
#

the other option is if your transport mechanism has different channels where you can only send known messages of one type to

#

like you could do that approach but have a ClientMsg (messages created by the client) and a ServerMsg (created by the server), to break it up a bit

winged geyser
#

yeah.. i want to keep ISGMessage.cs in sync though, will be a maintenance nightmare if they're different .. both sides need to be aware of both messages anyway

#

unfortunately the nullable approach doesn't work - the nulls come across in the stream

#
    [MessagePackObject]
    public class ISGMessage
    {
        [Key(0)]
        public MessageType Type { get; set; }

        [Key(1)] public int? theInt1;
... etc ... 
        [Key(15)] public int? theInt15;
    }
}

when it hits the server, the payload looks like this (converted to JSON):

ISG in JSON: [0,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null]
#

that means that if i were to put nullable reference types in ISGMessage, as the game grew and there became more and more message types, a single message would get more and more bloated

#

too bad.. i'll try the "double-serialization" approach with the subclassed messages and see how it goes

candid tundra
#

Is it bigger on the wire?

#

The number of bytes

winged geyser
#

yeah

#

the double deserialization works pretty well

#

very small transport

#

although i'm embarassed to say I'm going back through some really relatively beginner OOP stuff since in practice i rarely override/abstract things, but this is a pretty ideal case for it

#

I think this is right?

#

the idea being I create the message elsewhere in my application in one line, like this:

#
  SendNetworkMessage(new ClientSendNameMessage("test").GetMessage()); //SendNetworkmessage takes an ISGMessage as a parameter
#

heh, nope, doesn't work, the ISGMessageTemplate tries to serialize "this" (being the parent, not the child) and fails since it's not marked as serializeable

#

I was hoping to avoid copying and pasting the GetMessage function in hundreds of classes but ... can't wrap my head around how not to do that

teal obsidian
#

@dense hedge Regarding predicting on a moving object, if you just parent the player to the object on both the server and the client, wouldn't that allow for smooth predicted movement regardless?

#

the position for every tick that the server sends to the client, would probably have to be local/relative to the moving platform though, right?

teal obsidian
#

and your garbage collector will cause lagspikes every few seconds depending on the size of the data

#

I know first hand from using that library

frosty crystal
#
        {
            return GetAllSync().Result;
        }
        private async Task<List<Restaurant>> GetAllSync()
        {
            List<Restaurant> restaurants = new List<Restaurant>();
            Query allRestaurantQuery = FirebaseFirestore.DefaultInstance.Collection("restaurants");
            QuerySnapshot allRestaurantsSnapshot = await allRestaurantQuery.GetSnapshotAsync();
            foreach (DocumentSnapshot snapshot in allRestaurantsSnapshot) {
                Restaurant rest = snapshot.ConvertTo<Restaurant>();
                restaurants.Add(rest);
            }

            return restaurants;
        }``` 
Hello. Please help me out about this. I spend a lot of time and going crazy.
When I call the  GetAll, Unity freezes.
How can I solve

Thank you in advenge
dense hedge
# teal obsidian <@!143102494849892352> Regarding predicting on a moving object, if you just pare...

No, re-parenting doesn't fix anything.
If you don't predict the platform, then when you try to jump on it on your client you can mistime it and fall because the platform is in the past. It'll be in a different spot when the server does the same tick. The server would have to like lag compensate your movement.
If you do predict the platform, you have to handle its transition from interpolated to predicted (and back) to address the same issue, unless you want to predict every moving platform in the level at all times. Similarly, the remote player will look off if you don't do anything about.

#

Re-parenting is only part of fixing lag compensation, which breaks when you're on the moving platform too.

#

Imagine standing on an elevator that is rising quickly and shooting at another remote player also standing on it. By default, your movement isn't rewound but theirs is, so naive lag comp will make you miss.

#

Re-parenting just lets you get "rewound" with the platform, but knowing when to re-parent and un-parent you isn't trivial, unlike a vehicle.

dense hedge
#

Basically, avoid moving platforms if you can't afford to predict everything (client auth also can avoid this problem completely but yeah). But if you just gotta have them no matter what, predicting the platform (for as long as you're on it) and special-casing the remote player's avatar on the client so it collides properly is probably the least painful way to go. May also need to do some special-case stuff on the server too, idk.

winged geyser
#

@teal obsidian What serialization framework do you recommend? (I keep getting drawn towards protobuf)

stray bronze
#

I'm trying to do a bit of network programming and I'm feeling lost. I'm trying to sync deltaTime across all players every 2 second, but value is not synced. I'm using MIrror. Here's the code:

using UnityEngine;
using Mirror;
using System.Collections;

[RequireComponent(typeof(NetworkIdentity))]
public class DeltaTime : NetworkBehaviour
{
    [SyncVar(hook = nameof(OnDeltaTimeChanged))]
    private float _deltaTime;

    internal void Start()
    {
        if (!isClient) return;
        StartCoroutine(OnUpdate());
    }

    void Action()
    {
        float deltaTime = Time.deltaTime;
        CmdSetDeltaTime(deltaTime);
    }

    IEnumerator OnUpdate()
    {
        while (true)
        {
            Action();
            yield return new WaitForSeconds(2f);
        }
    }

    [Command]
    private void CmdSetDeltaTime(float deltaTime)
    {
        _deltaTime = deltaTime;
    }

    private void OnDeltaTimeChanged(float old, float newValue)
    {
        _deltaTime = newValue;
    }

    internal void OnGUI()
    {
        if (!isLocalPlayer) return;
        var position = new Rect(0, 0, 2000, 50);
        GUI.Label(position, $"My: {_deltaTime.ToString()}, Default: {Time.deltaTime}");
    }
}
#

And here the result:

#

The _deltaTime isn't synced properly, it's different for each client. I can't understand why

#

Can someone give me a hint on why the _deltaTime isn't synced?

cobalt python
#

hey guys, anyone here?

candid tundra
teal obsidian
#

unity does some weird shit when serializing floats through binarywriter though, so you'll have to write your own function to do that

#
        {
            uint TmpValue = *(uint *)&value;
            _buffer[0] = (byte) TmpValue;
            _buffer[1] = (byte) (TmpValue >> 8);
            _buffer[2] = (byte) (TmpValue >> 16);
            _buffer[3] = (byte) (TmpValue >> 24);
            OutStream.Write(_buffer, 0, 4);
        }``` Which looks something like this
#

straight from one of microsoft's built-in functions

#

when using messagepack though, you might be able to serialize and deserialize into a struct, that might not allocate any garbage

#

I haven't tried it though

teal obsidian
#

you can also stand on the moving cargo ship and walk around and jump around on it, do combat on it, without glitching around

#

the clients also don't predict any of the vehicles, and just get the interpolation data from the server, so I'm not sure how you could be predicting the helicopter while standing inside of it

frosty crystal
#

Hello.

#

I am trying to get all the documents that belong to a collection and returning them as a List<Custom>

#

but I get "0"

#

because of the async operations, that I supposed to use.

#

But my class inherits from an interface. So, I can not add the keyword "async" into signature.

#

I do not know what I am supposed to do

#

Can you please help me, I will buy you a coke? or a cup of tea 🙂

#

really 🙂

grand widget
#

hey, does anyone know how to sync a ball so that it runs smooth for both clients (rn the nonmasterclient has buggy movement)

gleaming prawn
#

it affects lag comp a bit...

dense hedge
gleaming prawn
gleaming prawn
grand widget
gleaming prawn
#

new netcode SDK by photon, successor to Pun+Bolt

#

can do full physics prediction on Unity

grand widget
#

just by default?

gleaming prawn
#

like this:

#

the Hello Fusion sample is a physics sandbox

grand widget
#

do I have to change my current settings with pun only?

gleaming prawn
#

server authoritative with full client side prediction

gleaming prawn
#

It*s all new

#

but there are similarities (there's a document pointing the concept mapping between them)

grand widget
#

okay, I will look into it (in the hope that it will help me :D)

gleaming prawn
#

notice both PUN and Bolt are legacy SDKs, that will only receive bug fixes... Fusion is the new one that scales much much better and will be improved upon.

winged geyser
# teal obsidian when using messagepack though, you might be able to serialize and deserialize in...

I moved them over to structs.. after your message this morning I read up on a lot of the performance issues and the other claims that the version 2 is much more performant in terms of GC/alloc than before. I'll keep my code loosely coupled though so I can migrate to some other framework (ie - protobuf or C# native de/serialization) in the future. For now I think I'm going to keep it though - mostly from a "knowledge investment" standpoint.. I spent a great deal of time learning this shit, I'm not going to throw it away yet. 🙂

#
using MessagePack;

namespace KaimiraGames.ISG
{
    [MessagePackObject]
    public struct ClientSendName
    {
        [Key(0)] public ISGMessage.MessageType Type { get => ISGMessage.MessageType.ClientSendName; }
        [Key(1)] public string Name;

        public ClientSendName(string Name)
        {
            this.Name = Name;
        }
    }
}```
#

the above is a pretty lightweight example, but it serializes nicely (compact) and my internal interface to create and send them is super light:

#
            SendNetworkMessage(new ISGMessage(new ClientSendName("Bob")));
#

(ISGMessage is the message wrapper that only contains the type of message and the serialized message itself)

teal obsidian
#

I'm not sure if they do lag compensation either since every bullet is a rigidbody

#

I could be massively wrong though

dense hedge
#

AFAIK lag comp does not have to treat raycasts and projectiles differently.

teal obsidian
#

ah

dense hedge
#

so it shouldn't matter

#

There are only two ways to consider the moving platform problem.
You've got two timeframes and only one platform.

#

like it only becomes a problem when you, the local player, also want to stand on it

#

if you're just shooting from afar at someone standing on the platform, that's all good, they're both interpolated from your POV

teal obsidian
#

right, but rust has a massive moving boat, that players can pvp on

#

I'd just like to know how they do that

#

maybe the local player and server position are always off by a little bit?

#

and reconciliation just corrects it?

dense hedge
#

if the boat itself moves in like a big circle than that's trivial to predict

teal obsidian
#

what about player driven helis like the video I linked

#

its gotta just be parenting and letting reconciliation correct it

#

I dont see any other logical way

dense hedge
#

parenting just changes the coordinate system, why would that influence reconciliation?

teal obsidian
#

yeah I'm not sure

spring yoke
#

If I want to have server authoritative movement would I move all the movement code to the server and have the client just send inputs over

teal obsidian
#

assuming you're predicting on clientside

spring yoke
#

I have a component from mirror that automatically syncs my rigid body but I can have it only accept calls from server so if I send inputs to move on the server I’d assume that this component will sync the rigid body of the client

teal obsidian
#

yeah I think mirror might handle all that stuff for you. never used it before

dense hedge
# teal obsidian yeah I'm not sure

some notion of re-parenting is "needed" for shooting stuff out of the helicopter, so that lag comp can spawn bullets in the correct position, but it doesn't help the timeframe paradox

#

oh I see now, if you re-parent, the idea is that your position on the helicopter is stable

teal obsidian
#

yes

#

so when you jump, you still move with the heli, or the boat you're standing on

#

then you just reference the local coordinates

#

of the heli/boat

#

when dealing with reconciliation events

#

that makes sense to me

#

maybe @gleaming prawn can give his input when he's available

#

tldr for erick: we're discussing how you would handle standing on a moving platform with server authority and predictive clients

#

idk if you would even need to use local coordinates. maybe you could just use global coordinates. I have no idea

dense hedge
#

I think the question is "what does re-parenting not fix?" It won't fix the initial transition to board the helicopter/platform.

teal obsidian
#

well the client can still move freely even when parented to something

#

so I'm not sure what you're asking

dense hedge
#

how do you when to (un)parent the player to the helicopter?

teal obsidian
#

probably have an invisible collider in that cargo area

#

a box

#

detects when players are "in" the cargo area

#

maybe raycast the floor

dense hedge
#

sure, trigger volumes would be the go-to, I'm just trying to think about how this interaction plays out in your local view, the server's view, and say, the pilot's view.

teal obsidian
#

yeah I have no clue. Hopefully erick can give us some further insight

#

I haven't played much with the helicopters in rust, but from what I have seen in-game, the transition is extremely smooth

dense hedge
#

either your movement onto the helicopter is lag-compensated somehow or you start predicting the helicopter from further away than just the cargo area

#

or it's client auth

teal obsidian
#

definitely not client auth, rust is competitive

#

the helicopters are also not predicted in any way

frosty crystal
#

Hello. I wonder which one is a good practice?
Instead of writing bunch of query, I will get whole firestore document and turn them into object and loop and find what I want.

#

Is it a good practice?

#

Or should I write queries for all the needs

faint plaza
#

Im trying to make a multiplayer game using Mirror, and I want players to have a primary and secondary slot for weapons that they can drop/pickup from the ground throughout my map. I say Mirror's official way of doing it on their guide, but it doesn't seem like a good idea to add to an enum and a switch every time I make a new weapon. Is there a way to just hold a networked weapon object without having to have specific behaviors based on what you're holding? Because their solution breaks the open/closed principle, right?

frosty crystal
#

Fyre I thought you were writing an answer so I expected 🙂

teal obsidian
#

I also don't know if rust is lag compensated either. If I'm truly familiar with how lag compensation works, it would add a huge load to the server

#

the projectiles are shot locally on the clientside, and then the server shoots and the client doesn't see his projectiles from the server

#

only the client ones he shot

dense hedge
dense hedge
#

which could be like a difference of 5m or something

#

your timing would be way off unless the server did something to compensate or you start predicting the heli much earlier

#

but the heli speed might be super slow and not matter idk

teal obsidian
#

I'm still not sure if that would even be a problem in the first place, since you can still freely move onboard the helicopter right? What you're saying would be a problem if you became the helicopter pilot

dense hedge
#

no?

#

can the helicopter pilot even see the passengers?

teal obsidian
#

yes

dense hedge
#

getting on the helicopter while it's at rest seems easy, sure

gleaming prawn
#

Sorry, time to go to bed here.

teal obsidian
#

no problem

gleaming prawn
#

There are several ways to make this look correct

#

Look… you need to loose something in relation to lag comp (if they even use it)

#

But to look correct, a few ways. I just did a few experiments related to this yesterday, unfortunately it is a private video for some customers.

#

So I’m afraid I can’t help much

#

Look at the battlefield article

teal obsidian
#

let's just say rust doesn't use lag comp, to make it simple, and because I truly don't think they do lag comp

gleaming prawn
#

@dense hedge do you have the link for it?

teal obsidian
#

interesting, I'll have a look

dense hedge
#

so I think

#

Once you're on the helicopter, re-parenting can keep you on it and have lag comp work out nicely if you have it, but getting onto a moving platform is always going to be painful if it's already in motion.

gleaming prawn
#

Ye this one, thanks

#

This is one of the hardest problems to solve…:)

teal obsidian
#

lag comp requires you to rewind time in the same way that you do reconciliation right?

dense hedge
#

no

teal obsidian
#

ah

#

havent implemented it yet, so I wouldn't know

grave ice
dense hedge
#

¯_(ツ)_/¯

teal obsidian
#

I don't think erick works for rust

#

we just have to guess

grave ice
gleaming prawn
#

But I know the options and what you loose with each. But it’s a bit complicated to explain, as it all starts by having a tick system in the first place (Burt does have one)

teal obsidian
#

mine uses fixedupdate though, so I'm not sure if it's AAA quality

gleaming prawn
#

I have not played rust, so I’m not sure which compromises they opt for (assuming they are really server auth). And if they do lag comp (which I believe they do, every serious shooter has in one way or another), they gotta be loosing something

teal obsidian
#

yeah i actually think they do have some form of lag comp. Just found something on it digging through their twitter posts

dense hedge
teal obsidian
#

I'm not sure if this is right, but on a really basic level of lag comp, you would just spawn the projectile at a different spot on the server?

#

based on ping time?

gleaming prawn
#

No

dense hedge
#

uh, don't use rtt

#

just send the interpolation info

gleaming prawn
#

That is not it

#

I’ve explained lag comp even in my public videos

gleaming prawn
#

You have to have that, lol

#

A proper snapshot interpolation

dense hedge
gleaming prawn
#

If you do, it’s the start

#

Notice what you are describing is fusion, overwatch and valorant style… there are other solutions

#

Like CS, etc

grave ice
gleaming prawn
#

No

dense hedge
#

CS just has a fixed 100ms interp delay right? Based on measured ping, CS server estimates client's view.

gleaming prawn
grave ice
gleaming prawn
#

It is different, it rollback@movement on server

#

For input integration

gleaming prawn
#

But not in all others, although the principles are always similar

dense hedge
teal obsidian
#

that sounds fairly complicated to incorporate

gleaming prawn
#

I mean, you don’t have something like I’m predicting tick 8 in CS, I believe you have a time-ahead actually

teal obsidian
#

Joy got me confused, when I asked about rewinding time, you said that doesn't happen, but I'm reading a bunch of articles about lag comp and they all talk about rewinding?

dense hedge
#

lol sorry

dense hedge
teal obsidian
#

yeah I was gonna say rolling back every time someone shoots, might decimate server performance

#

if you have a ton of players

dense hedge
#

no doubt, you could probably align to the nearest tick and batch them, but yeah

gleaming prawn
#

Rollback on server is expensive

#

Not good

dense hedge
#

pretty sure the second way you can test all projectiles at once

teal obsidian
#

with physics projectiles, you're already aiming ahead of the player

#

so I'm contemplating just not even doing lag comp

#

I don't know

dense hedge
#

it's needed for consistency

#

otherwise the lead ahead amount would vary based on your ping

#

so if you send the interpolation info to the server, the server can tag each spawned projectile with a tick offset, say 4.5, which would mean "test against colliders as they were 4.5 ticks ago"

teal obsidian
#

hmm alright

dense hedge
#

like for doing this collision detection, time is like a fourth spatial dimension

teal obsidian
#

but I would only tell it to test, when the projectile hits something?

#

or every tick that the projectile is airborne?

dense hedge
#

the projectile is airborne until it hits something, right?

#

and you don't know if it hits something without testing

teal obsidian
#

right

frosty crystal
#

Hello. I wonder which one is a good practice?
Instead of writing bunch of query, I will get whole firestore document and turn them into object and loop and find what I want.
Thank you guys!

dense hedge
#

you'd put all this historical collider data in some broad-phase acceleration structure (e.g. BVH)
the tick offset is essentially a 4th spatial dimension (X, Y, Z, and now "distance into the past")
you'd test against the top-level hierarchies (basically the overall bounding box of each object that fits all its positions in time) and then interpolate during the narrow-phase

teal obsidian
#

So maybe for every player, I could have a bunch of invisible "ghost players" attached to them, which are at the position of like the last 3 ticks or so of that player's position

#

and just check projectiles for those based on ping time or something?

dense hedge
#

using ping will have inaccuracies, but how many past collider (and maybe animation) states to store depends on the upper limit you're willing to compensate

teal obsidian
#

so I'm in the right area-ish of understanding this?

dense hedge
#

idk lol

teal obsidian
#

lmao

#

but yeah I see what you're saying, just save collider data for past ticks

#

that makes sense I suppose, assuming I'm thinking about it the right way

#

those "ghost players" I'm talking about would only be relevent to the server, and would be triggers that would only interact with bullets

#

and would just hold the position value of the player for the last tick, 2 ticks ago, 3 ticks ago, etc so the projectile could actually hit it, if it needed to

#

idk maybe I'm just spewing gibberish

dense hedge
#

communication is hard lol
old collider data that only projectiles are tested against on the server is definitely the right summary

teal obsidian
#

alright then, I think we're on the same page 🤣

#

the projectile is still always spawned in the same place on the server right? At the end of the guns exact barrel?

dense hedge
#

if you do it this way, the server will spawn the projectile at end of the barrel, yeah
AFAIK the "compromise" is that where the projectile appears to be is "decoupled" from the old collider data it's actually being tested against

#

for most projectiles, it'll probably look close enough tho

#

might be possible to visually correct for that actually, idk

cobalt python
#

Hello! I am using Pun. Can i pass custom class in RPC as argument?
like this:

itemPV.RPC("SetItem", RpcTarget.AllBuffered, item);

Item Example:

Item item = new Item { itemType = item.itemType, amount = 1 };
spring crane
empty cradle
#

Hello there I have a query about MLAPI.

I am trying to shoot a projectile spawning it from the server. The way I am doing it, the projectile is a prefab that I have included inside of the Network Prefabs list, and after I instantiate it, I call the Spawn() method on its NetworkObject component.

However, I do a few things to the projectile before I spawn it, for instance changing the velocity, drag, angular drag, etc, in its Rigidbody properties. Not only that, the projectile has a component written by me where I make sure its collider stops registering collision with the player character. The projectile's prefab has its collider disabled so that I get time to initialize it after I locally spawn it but before I actually enable it to move and collide, essentially.

#

What is the better approach using MLAPI to make sure the projectile and all of its properties (even what is enabled, what isn't, and how should collision be handled= get synced when I do .Spawn() ?

half willow
#

Anyone with experience with Unity Headless(server build), for a 2d multiplayer game with practically only player moves and move checks is it costly to maintain?

grave hornet
candid tundra
grave hornet
#

why does this work

                PhotonNetwork.Instantiate(
jumpParticleEffect.name,
groundCheck.position,
Quaternion.identity);
#

but not this

GameObject pellet = PhotonNetwork.Instantiate(
floopySnapPrefab.name,
shotPos.position,
Quaternion.identity);
short sage
#

does anyone know how to make behaviour based on an update function networked via mlapi?
im struggling here
i thought i might be able to just put the behaviour into a server/client rpc and call it every frame on the update function
that doesnt work though it seems

short sage
#

to be a little more exact

#

im instantiating a bullet which works fine on both server/client

#

but in the bullet script the update method is what "moves" the bullet

#

and that part doesnt work

opal topaz
#

Hello ^^ I'm having this wonderful error kind of out of no where... this results in players not being able to see and interact with each other online (only the local player controller prefab is instantiated)

#

any idea where this could come from ?

ionic panther
#

Hello there,
I'm working on a multiplayer game with MLAPI and I'd like to add a custom handler to spawn/destroy my objects over the network. The goal is to plug myself on the Zenject plugin to auto-inject my services and use Zenject's pooling system as well.
I see that MLAPI has changed its custom-spawning API between 0.1.0 and develop and I'm considering switching to develop to avoid having to change everything later. Does this seem like a good idea? If I want to do that, do I have to remove the 0.1.0 plugin and install the new one by modifying the git url, or is there a way to upgrade?

orchid mortar
#

hey im using mirror and i cant connect on another pc. localhost is working

olive vessel
#

Have you port forwarded?

orchid mortar
#

So the server application is running on my server which is a mini pc. i have port forwarded the standard port 7777 for udp and tcp

#

its in the same network so it should also work without port forwarding

olive vessel
#

You said localhost is working fine, so what's the issue then?

orchid mortar
#

So, I can start 2 games and connect on my pc (localhost) but i cant start 1 game on my server and connect from my pc over ip

olive vessel
#

You used the correct ip and port?

orchid mortar
#

yeah

olive vessel
#

Tried disabling the firewall?

orchid mortar
#

wait lemme check but i think its disabled

#

yeah diasbled on both still not working

#

do i have to change anything in the network manager?

olive vessel
#

Presumably you changed the connect address

orchid mortar
#

i only have a network address option is that what u mean?

#

its set to localhoast

olive vessel
#

Yeah that's it

#

Well localhost is the computer you're on

#

So naturally, it won't work for other PCs on your network

orchid mortar
#

yeah but when i host a server on my mini-pc and put in the mini pcs ip it should work shouldnt it?

#

or do i have to change it to the servers ip and make an extra build?

olive vessel
#

If you put in the correct IP, then it should work

orchid mortar
#

so the server ip?

olive vessel
#

Yes, the IP you wish to connect to

orchid mortar
#

okay and use that on both builds?

olive vessel
#

Well, when you're hosting the connection address is irrelevant

#

The client needs it though

orchid mortar
#

but isnt it enough to enter it in the hud?

#

when connevting

olive vessel
#

Yes

#

You just need to use the correct IP

orchid mortar
#

oh yeah i was talking about the network address field in the network manager component

#

just using the ip doesnt work

#

Maybe I can show it to you in a screenshare or sth?

olive vessel
#

Screenshot the network manager

orchid mortar
#

here it is

olive vessel
#

I guess you could try putting the server IP in the network address field, just to be sure

orchid mortar
#

and use that build on both devices? or just the server?

olive vessel
#

The client needs to know where to connect, whether you use it on the server is totally irrelevant

orchid mortar
#

i actually give the information to the client by typing in the ip here

#

in the game hud

orchid mortar
# orchid mortar

the network address field here is just what is being filled in here first

olive vessel
#

Then idk why it isn't working really

#

Do you get any errors?

orchid mortar
#

nope

olive vessel
#

Then it should work fine

orchid mortar
#

hmm weird

#

wait

#

i think its kinda working

#

when there is no server running on localhost and i try to connect i get errors but when i try to connect to the server which is running i only get a timeout

#

so i think its not like hes not finding the server

#

is kcp transport correct?

olive vessel
#

Yeah it should work

orchid mortar
#

could it be the port?

olive vessel
#

Are the ports the same?

orchid mortar
#

ye

olive vessel
#

As you said, you don't need forwarding to make an internal connection

orchid mortar
#

hmm

opal topaz
#

Hello ^^
I'm using PUN2 and I'm trying to add a return to menu button, but I'm having some trouble, PhotonNetwork.LeaveRoom(); and PhotonNetwork.LoadLevel(0); won't cut it, I get a strange error :/
I can go back to the menus and everything seems fine in the menus, but when I try to launch a game, it doesn't instantiate a player and gives the scene camera view

orchid mortar
#

tho i'm getting a timeout

#

do i need to use AWS?

olive vessel
#

No, that's just a server like any other

lean mauve
#

Is there any good tutorials on incremental games with playfab?

teal obsidian
#

Anyone in here ever tried predicting wheel collider cars with rollback?

frosty crystal
#

Hello. I have written some back end in the unity with Firebase. and I want to write an API and publish it as web api. but do not know where to start

#

Is unity a good for writing API (ASP.Net)

#

or should we just write all back-end in .net?

#

and create a WebAPI project inside the solution?

opal topaz
analog shoal
#

I cannot syn shooting time and character rotation. For example, a remote player or remote bot shot at the player then rotates towards the player
Transform data and shot data are sent from server to clients as snapshots in fixed time.

Snapshot-> TransformData,ShotData,etc.

I compute interpolation time and interpolate rotation and position and after that run shooting action but it does not solve the problem.
I think the problem is about ordering packets
For example first packet 1, packet 3 and finally packet 2 are received. Suppose in packet 2 shooting happens

stiff ridge
#

It's sadly a bit tricky to help here, as this depends on your game logic...

opal topaz
#

And I just noticed you are everywhere related to photon !

#

Thanks for the help ^^

stiff ridge
#

Glad you found it!!
Yes, it had to be something like that. Often setup of prefabs and scenes are as important as the actual code on components.
You are welcome.

jovial fiber
#

Which database to Save Leve, Wins/Losses or Money ?
I need to decide if i should use PostgreSQL, MySQL or some other Database.
I will soley use it to save a Players Level, Money and stuff like K/D & W/L

#

It should work with C# as that is what i know and Unity uses

ornate zinc
jovial fiber
#

needs to be safe

ornate zinc
# jovial fiber needs to be safe

Oh alrighty, than I would just go with some headless cms and use endpoints to feed in the data and sync with it, dealing with tokens and so on. I am using directus today a lot, its headless and just fun to work with, but my app is heavily content based. Also worked with plesk for data, but not a big fan of it.

jovial fiber
#

Ive heard plenty of times that MySQL should be enough

#

but i should worst case test it

#

and if its not good enough im directed towards directus

#

so youre the second one confirming directus

ornate zinc
#

Always balance out crazy tech with the users you gonna have on the game, no need for crazy anti cheat thing if the game might have only some dozen users for example.

jovial fiber
#

problem is directus is 100% js

#

and has no C# implementation

ornate zinc
#

you just make webcalls to enter the endpoints of directus

jovial fiber
#

so id have to convert it to js webcalls, which is a bottleneck

#

does it accept Linq webcalls ???

#

pretty sure its just JS

#

not C#

ornate zinc
#

I guess you might be able to do whatever you need to

jovial fiber
#

ohh linq.js

#

ok

#

i still dont know js

#

is the problem

#

xD

#

it should be ok with C# Linq or C# calls

ornate zinc
#

Im out for today, keep us updated what you tested 🙂 js and c# is like super easy to compare and adapt from my pov

jovial fiber
#

so directus aint working i guess

jovial fiber
#

lol

#

JavaScript is a prototype-based language, C# is Object-oriented

#

JS actually confuses me

ornate zinc
#

You do you 😉

pastel marten
#

Hi, I'm making a 3d online multiplayer game(I'm using photon, PUN 2, for networking) but I'm having a problem, when I run two clients on my pc, they connect into one room without any ishues, but when I tried the game with a friend, our clients didn't connect, can someone please help me solve this?

ornate zinc
pastel marten
#

I suspect, that my main menu script causes this ishue to happen, I'll send that in tomorrow, because It's pretty late where I live right now

calm hinge
#

okay, help

#

if a localplayer has a variable how do i synchronize that across every client?

spring crane
#

@calm hinge Send a packet that contains the change and the ID of the object 😛

calm hinge
#

yeah but

#

how

spring crane
#

Happen to be using some sort of networking library?

calm hinge
#

mirror

spring crane
calm hinge
#

i tried a SyncVar and it's only half working

spring crane
#

Note:

Data is not synchronized in the opposite direction - from remote clients to the server. To do this, you need to use Commands.

calm hinge
#

for whatever reason commands don't seem to be working properly

spring crane
#

Make sure to read the documentation for them in case you are missing something. Probably wanna hop on the Mirror discord for more help.

calm hinge
#

alright

#

from what i gather i need to use a [Command] to tell the server about the change

#

but then i need the server to tell every other client about the change

#

that's where i'm stuck, i'm not really sure how to make that happen without setting up dedicated functions for every single variable i want to communicate between clients

spring crane
#

Sounds like you could use one of those SyncVars for the second part?

weak plinth
#

when i'm trying to send a variable from one player to the rest, the variable only shows for the local player even though it's sent through an RPC

umbral geyser
#

@weak plinth don't you have to send it through a serverRpc

#

Of you want to update it for all?
(No clue tbh still new to it) 🤣

weak plinth
#

Yeah that’s alright, I just trailed and errored the everloving heck out of it and it managed to work

#

Thank you anyway tho

umbral geyser
#

And have it as something that's a networkVariable of some sort that will change for everyone

pastel marten
pastel marten
chrome halo
#

I've heard that Server Authority, Client side prediction. In a physics game is a bad idea? Is that true? Should I have it be client authority?

floral turtle
# chrome halo I've heard that Server Authority, Client side prediction. In a physics game is ...

you can do CSP for physics based based. Photon's engine Quantum is entirely built around doing prediction for everything in the scene, including physics.

physX is not great for prediction, since it is not designed for it. But depending on the project it may work for you. Fusion is a new tool in beta from photon that allows for prediction of physX rigidbodies (and any other kind of networked object)

gleaming prawn
#

Also important to mention Rocket League is all built around that concept...

#

So it's not a bad idea, just hard to execute well.

ancient cypress
#

Isn't there a way to stream audio/video from my streaming server into unity? The VideoPlayer included can only play videos like mp4 hosted somewhere but no realtime streaming HLS / RTMP, the assets in the store are outdated / bad review / very expensive etc .....

ornate zinc
ancient cypress
#

it supports URLs, and it works if I have an mp4 file somewhere. but I have live-streaming server with RTS / RTMP protocol and this does not work

#

for example i live-stream my desktop / gameplay and wan't this as stream in the game

#

not a "static" mp4 file somewhere

ornate zinc
#

Ohh got you, static but on the server, sorry, missed that part, hm, never done that, sorry, there seem to be some plugins out there

dry ibex
#

Photon question: every time the player dies, I call this code

#

string key = PhotonNetwork.CurrentRoom.CustomProperties[PHOTON_VAR_TEAM_DEATHCOUNT + teamPhotonID].ToString();
int deaths = int.Parse(key);
deaths++;
Hashtable hash = new Hashtable();
hash.Add(key, deaths);
PhotonNetwork.CurrentRoom.SetCustomProperties(hash);

#

but the value is zero every time, how come?

ornate zinc
#

Did you debug all values to check if you get the right ones?

dry ibex
#

Uh, now I see I'm using key as a value and as a key

#

ok works now, sorry for the false alarm

cobalt python
#

Hello! I am using PUN. Is OnOwnershipTransfered callback is called when any transfer occurs in the scene? so its not connected to the script and i dont need to duplicate this callback

stiff ridge
cobalt python
stiff ridge
#

The alternative is to implement IOnPhotonViewControllerChange for callbacks from a specific PhotonView. You'd have to photonView.AddCallback(...) and photonView.RemoveCallback(...) per view.

willow lark
#

i am using mlapi for my multiplayer game however when i start the server or client my players arent spawning in

willow lark
#

nvm i was opening the wrong build so that is why it didnt open

#

however now im getting a different error

ornate zinc
#

something with your GFX

willow lark
#

can you rephrase it?

ornate zinc
#

Whats your ggraphics card?

willow lark
#

amd radeon graphics

#

let me check exactly

ornate zinc
#

There seem to be some issue with it, as it does not seem to find, recognize it? never seen that error before, just reading from it

willow lark
#

should i try to reinstall its drivers?

#

it was working fine a bit ago

ornate zinc
#

Yeah maybe jsut a false system thing, close everything, update the driver, try again

willow lark
#

doesnt seem to be the case should i ask it on a different channel?

#

it works fine in the unity editor now

#

but i cant open it

#

i cant build and run it*

willow lark
ornate zinc
#

Oh well yes, that def does not have any gfx card 😄

willow lark
chrome wagon
#

how do you spawn a object in mlapi on client

#

it says only the server can spawn a object

willow lark
chrome wagon
#

a little bit

willow lark
#

this is the one im following

#

let me send you a video as well

#

This is part 2 of the series covering basic multiplayer in Unity3d using MLAPI.
Full Playlist HERE:
https://www.youtube.com/playlist?list=PLbxeTux6kwSAseRmJeCyvkANHsI16PoM6

In this part we make a simple First Person Controller from scratch and add the components and code that it needs to work across the network.
This includes the how and why we...

▶ Play video
#

im following both

#

video part is clearer since you can see how to do it

chrome wagon
#

so i should folow this video series?

willow lark
#

its very basic stuff i just typed unity mlapi on youtube

#

and found this

#

but you can probably find more stuff for mlapi too

chrome wagon
#

ok

#

ty

willow lark
#

if anyone has a better series please do share it with us

#

the servers' character camera is disabled even though i am disabling all of the other hosts' camera. Works fine with the client side character but not with the server

#

in here i handle the player character controller getter in the start function

#

i should probably encapsulate the double jump and the movement but ill do it when i actually get it to work 😆

olive vessel
#

What do you mean, that is how it works?

weak plinth
#

any way to make that the host can host a server and other players can join with the ip of the host

willow lark
#

camera of second player is attached to the first player. The server client doesn't spawn a player. If anyone could check the code please do inform me if you know how to fix it. I am using cinemachine with mlapi. Here is the code: https://hastepaste.com/view/wHh9f

olive vessel
#

If you're asking how to do networking in general, that is too broad a question for this channel, and some self-lead research would be needed

weak plinth
olive vessel
#

I've no idea what you're on about

#

If you have a client, they can join a host by IP if the host has port forwarded

weak plinth
#

like the host creates a server with a custom id and everyone can join the host using the id

#

like without port forwarding

olive vessel
#

Well that would require some sort of server list, where said custom ID can be matched with the host and their IP

#

That is where you'd need a relay server or punch through

weak plinth
#

can i do it with mlapi

olive vessel
#

You'd need to look into that

#

I remember seeing some sort of Relay options, not sure how you'd utilise them

weak plinth
#

is there any way to host a server on a hosts pc?

olive vessel
#

Yes...

weak plinth
#

how

olive vessel
#

Go and do some research into it

#

NetworkManager.Singleton.StartHost()

weak plinth
#

i been looking for that

olive vessel
#

Then you have not been looking well enough

#

There's the MLAPI docs

weak plinth
#

time to study it lol

willow lark
regal delta
#

anyone got any news tidbits on DOTS networking updates?

cobalt python
#

Hi! A question about pun: if I place some objects in the scene, next player that joines has his own again on that place (duplicate it), how can I avoid it?

#

Scenesync is true

ancient cypress
#

I made multiplayer game with clients and dedicated server and this works nice for windows but webGL version doesn't connect to server? i need networkmanager to use sockets or something?

#

and the exact page in unity manual i am looking for is not available??

spring crane
#

@ancient cypress My understanding is that WebSockets are broken in MLAPI atm. I would ask in the MLAPI server.

hexed hatch
#

i just made a game using MLAPI but it works only on my machine (localhost)
how can others play it online? games like csgo,muck u can just host a server by a click and others can join u

spring crane
#

@hexed hatch CSGO private lobbies are most likely using Valve's servers. Server hosting generally requires port forwarding or relaying

#

Odds are starting a dedicated CSGO server isn't going to work out of the box

willow lark
dire condor
#

Hey guys, quick Q; what would be the "correct way" to start server on the networkManager on scene load? If I do it from Awake on a gameobject in that scene, the NetworkManager.singleton.StartServer(); the singleton here == null

hexed hatch
#

i think its not hosted from valve dedicated server

olive vessel
#

No, but it is definitely relayed over their servers

#

Or you'd have to port forward

weak plinth
#

how do i get islocalplayer mouse position

olive vessel
#

Well the script getting the mouse position will always get that instance's mouse position...

#

You would use IsLocalPlayer in somewhere like Start or Awake to disable the component if this is not the local player

weak plinth
#

like i got the local mouse position but the object of the other mouse position is rotating to the first mouse position

olive vessel
#

Then both objects have that script enabled for each client

#

Client A should have Client B's object's mouse script disabled, and vice versa

#

You could also use a check before any form of movement if you need to keep the component enabled

weak plinth
#

like i want the both clients rotate there object to there mouse position

#

do i need to do seprate scripts for mouse rotation

olive vessel
#

No, lets take this from the perspective of client A

#

So on client A, we have two objects, client A's player, and client B's player

#

On B's player, we want to disable the component causing that rotation (or hide the rotation behind a check like IsLocalPlayer)

#

Because the NetworkTransform should handle the updating of B's rotation for client A's game

weak plinth
#

i still dont understand how can i make that the a client rotates there mouse position and b rotate to there mouse position

olive vessel
#

Well rotating a player to a mouse pos is a well documented thing, Google it

weak plinth
#

it rotates both of the objects not one

olive vessel
#

Did you do what I said?

#

Where Client B's script is disabled in Client A's game?

weak plinth
#

im trying to figure it out how to do it

olive vessel
#

Well, in the NetworkStart function, check if this is the local player, if not disable the component

#

Or, if you need to keep the component enabled for a network var. Wrap all the logic inside an if which checks if this is the local player

carmine ether
#

Hey friends, I was working on "cleaning" my project, and I didn't think I touched the network code, but probably messed up some scene data, but regardless, when I go from the main menu area to a lobby, it always claims I'm not the master client, even though there are no other players in the player list. I'm h oping that someone will say, "Ohhhh, did you forget X you silly goose?"

#

It was working a few commits ago, and I forgot to test intermediarily.

#

PS: This is PUN

carmine ether
#

I just logged every callback in my GameManager and isMasterClient is always false

olive vessel
#

MLAPI or Mirror

carmine ether
#

I think I got it

ionic panther
#

What would be the proper way of cross-initializing my objects with MLAPI, when I have fields that I just want to initialize when the object is created and have no need to track later? I could use NetworkVariables with callbacks but it seems a bit overkill for something that will just be set once. Is it a good idea to use RPCs for this type of things? I'm doing a RTS-style game where you cannot join mid-game.
One of the reasons I ask is that RPCs seem to not be called when I just spawned my objects, I guess the network is maybe not initialized at that point yet or something, I'm wondering if it's worth pursuing in that direction, even if it seems a bit cumbersome to add OnValueChanged callbacks on all the fields that'll just be set once.

verbal lodge
#

If you are sure that you need no late join you can use RPCs. Make sure you call them in NetworkStart and not in Start or Awake

granite canopy
#

Is MLAPI usable? Use: Multiplayer game with two teams.

wispy oar
#

Is there documentation yet or a guide on how to set up client hosted network for a small game using unities mlapi?

ruby rain
#

how do I get my "AppID" for the XboxServices.Config file in the Xbox Live unity plugin?

torn lily
#

Hey guys, I was fiddling around with a few different networking solutions (MLAPI, Photon namely) while doing 3d stuff but is there any difference in how they each perform in a 2d environment?

#

or are there any other solutions that are best fitted for 2d networking?

versed rock
#

Hi guys, question about a relay server.
I have a Relay server, with all clients connects to this server, and the relay server make that all messages of every client are replciated to another. Any know any example/github repo for see how manage the broadcast to another clients?

random crown
#

Hey, so i'm wondering if anyone can help me with a question. So I'm using Photon and I have this item in my game that my players can catch off the ground. If the player goes to it and interacts with it it will disappear and i wanted to have it respawn somewhere else. The way i was thinking to do this was to just have a photon view inside the gameobject and then call a RPC function that would tell the respawn coordinates and instantiate a new gameobject with the item prefab, but then i remembered that the prefab uses a photon view and now the logic is all jumbled up in my head.

What exactly spawns what in these conditions? Is the server respawning the object or is each player because the RPC function is running for each player. Does it mean they are different instances for each player? How can i spawn the thing and have the object be the same for both with the same photon view?

If anyone can clarify this to me i'd be grateful because my head is up in water from trying to figure this out as i haven't fully understood photon yet and the documentation seems to be a bit confusing to me

ionic panther