#archived-networking

1 messages · Page 120 of 1

quaint moon
#

So that’s exactly what’s happening

weak plinth
#

ill just have to get used to the fact that server code is writen in the same scripts then

quaint moon
#

Without even thinking about it

#

You can also do that same thing with mirror, but commands are the simplified version

weak plinth
#

idk, server and client code in the same scripts is really throwing me off haha

quaint moon
#

Basically when you call CmdShootgun() it sends a ShootgunNetworkMessage{} and then that message gets handled by CmdShootGun

weak plinth
#

and do commands need to have the [command] attribute ?

quaint moon
#

YES

weak plinth
#

ok

quaint moon
#

Alternatively you can use NetworkServer.Registerhandler

#

Which is what your used to

weak plinth
#

but if i want my colleagues to understand whats happening it would be best practices to use commands?

quaint moon
#

Yes

#

Handlers have their place

weak plinth
#

alright, i thank you for pointing me in the right direction

#

@quaint moon sorry, last question. when calling a command, wouldnt every client in the game execute the command that was called since each player has the script with the command in it? like if player 1 calls the shoot command, wouldnt player 2,3,4 also execute the CmdShoot method? is that what hasAuthority is for?

#

sorry for that question being everywhere, im starting to finally understand how this all works, but need clarifying on that little bit

knotty kernel
#

To all the PUN wizards out there I have a question. I am trying to instantiate a LoadBalancingClient to access lobbies while I am in a photon room. I am having trouble with getting the connection to work though, it keeps getting hung up in the ConnectingToNameServer State. Does anyone have any advice on that process?

quaint moon
odd ginkgo
#

Hi does anyone have some knowledge about communication/networks? I have an App I want to use in unity for my scientific paper, but I cannot seem to get a handshake going (pairing my phone app with unity). I got it to work with Unreal engine, but for my paper I prefer using Unity. So ports and ip adress should all be correct, maybe I am missing something. It's this here:

https://www.youtube.com/watch?v=SldHuy6OnIw

They provided a demo and all the scripts and a guide with step by step on their page, but once i just have to go on the app and press tap to pair the devices, it just fails and nothing happens. Would greatly appreciate some help. Thanks!

This video demonstrates our AI technology running on an iPhone X and paired with the Unreal Engine and Unity 3D to animate an avatar and provide motion controller input.

Our software is currently available for testing by developers in our free open beta, and for licensing from January 2022.

Learn more and contact us at www.poseai.co.uk.

0:0...

▶ Play video
austere yacht
sand comet
#

Hi! general question, how to get into the "scene view" while being on client side?
because if I click on build and run there is no way to get in scene view, and in editor if I click on play im playing as mater client

i'd just like to debug how to get navmesh working on client side, atm I dont even know if clients have one or no, because it seems their agents cant move, as if there was none

pale pumice
#

hi for mirror, is it normal for the NetworkManager.OnStopClient to NOT be fired when NetworkManager.StopClient is called? because mine isnt

#

it is only fired on StopHost

sand comet
sacred spoke
#

(Photon PUN) can someone send me resources or tutorials on HOW to make lag compensators? I cannot find any worthwhile ones anywhere

limber holly
#

hello, I am working on a basic multiplayer game, I wondered if player UI elements ( health bar, map, inventory etc... ) parts of my Player GameObject or in the scene ? thanks and sorry if this is a bad question

pale pumice
#

hi all, I have a question, I have a dictionary of <string, NetworkconnectionToClient> on my network manager, on the playerprefabs onStart(), I made the clients add themselves in the dictionary. So I tried making a command/RPC to find a specific NetworkConnectionToClient and activate its UI. I dont get any compiler errors but a ton of errors in my unity console. Could anyone help? thanks!

    public void CmdSendNudge()
    {
        NetworkConnectionToClient conn;
        networkManager.playersDictionary.TryGetValue(nameInputFieldForNudge.text,out conn);
        //Debug.Log(conn);
        RpcSendNudge(conn);
    }

    [TargetRpc]
    void RpcSendNudge(NetworkConnectionToClient conn)
    {
        conn.identity.gameObject.GetComponent<PlayerPrefab>().friendRequestPanel.SetActive(true);
    }```
zinc ravine
#

Anyone want to make the argument as to why Mirror may be better than photon? Photon user here. Just curious.

#

And does anyone have any good courses for steam multiplayer?

olive vessel
#

I found DapperDino's videos on Steam and Mirror very helpful

#

As for why Mirror might be "better", it's all down to personal needs and preference

olive vessel
#

No, you need to actually ask a question to get help

olive vessel
#

Ah I didn't see it past the mountain of code

#

Consider using pastes

frosty crystal
#

Hello Folk!

#

Is it acceptable to use appsettings.json file in the Web API as a kind of database? I mean I have some variables (key values) and want to put them into a json file in the project.
Thanks

frosty crystal
#

The other question is : which approach is more consistent?
1: Making a WEB API is getting triggered by Azure Watch (every 2 minutes)
2: Making Serverless Azure Function to execute the DB works. (every 2 minutes)

zealous thicket
#

hi, i've a problem with photon pun. like in the video, when i input the player, other player animations, and positions are not synchronized. how can i fix this ?

limber holly
#

you need 2 PUN components: photon animation view + photon transform view

#

On my side I have a problem for understand something:

#

my playerStatut UI is override each time a player enter the scene :/

#

don't understand why other UI are just ok

olive vessel
limber holly
#

Ok I go for it

#

it's better thank you

ripe comet
#

is anyone familiar with photon for vr?

#

specifically getting a network player (speaker and name tag) to follow my main XR Rig

stiff ridge
rich nova
#

Looking for a good tutuorial for setting up a multi player fall guys style game - X amount of rounds, random level selection for each round and upto 8 players for example

#

No lobbies, just throw each joining player into a new game if no capacity in any waiting rooms etc

olive vessel
#

Why don't you search for information on each of those things, and pull together your new knowledge to apply it to your game

quaint moon
#

Now you do

rich nova
#

@quaint moon 👍

#

Just really wanted a tutorial on setting up networking and player spawning using photon fusion to be fair and how to go about creating/joining rooms

somber drum
#

Plenty of samples available detailing these things on the photon website

zealous thicket
#

i wanna ask, why my photon always detect master room player ? for example in photon view only detected master room player.

zealous thicket
cedar condor
#

help me :)

stiff ridge
# cedar condor help me :)

This looks as if you are using PUN Classic? It does not necessarily support the Unity Editor version you are using as it's outdated.
Use at least PUN 2 or better look into Fusion.

stiff ridge
stiff ridge
grave zephyr
#

Hey guys Im using Photon pun and I have a problem with syncing animator.SetIK I use OnAnimatorIK but it works only on start and then stop syncing how can I fix it??

#
private void OnAnimatorIK(int layerIndex)
    {
        var rightHand = _switching.CurrentThrdpWeapon.RightHand;
        var leftHand = _switching.CurrentThrdpWeapon.LeftHand;

        _thrdpAnimator.SetIKPositionWeight(AvatarIKGoal.RightHand, 1);
        _thrdpAnimator.SetIKPositionWeight(AvatarIKGoal.LeftHand, 1);
        _thrdpAnimator.SetIKRotationWeight(AvatarIKGoal.RightHand, 1);
        _thrdpAnimator.SetIKRotationWeight(AvatarIKGoal.LeftHand, 1);


        _thrdpAnimator.SetIKPosition(AvatarIKGoal.RightHand, rightHand.position);
        _thrdpAnimator.SetIKPosition(AvatarIKGoal.LeftHand, leftHand.position);
        _thrdpAnimator.SetIKRotation(AvatarIKGoal.RightHand, rightHand.rotation);
        _thrdpAnimator.SetIKRotation(AvatarIKGoal.LeftHand, leftHand.rotation);
    }```
split sonnet
#

hey unity fellas, i want to know if it's possible to add a networking solution (photon, .Net multiplayer, nakama and mirror) to a project that is already made? for example i have this board game project in hand it's player by two players, it's turn based can i add networking solution, creating sessions and synch data at this stage?? or the whole project has to be created from scratch for this porpuse?

full holly
weak plinth
#

Do we have no choice but to use Newtonsoft Json when Parsing JSON classes in C# and we encounter an unexpected JSON Property with an unclassified name as such cs [JsonProperty("sdk3-manda")] public string Sdk3Manda { get; set; }
?

It doesn't bother me as much, but if it can be done in anyway within Unity's built-in JSON parser, that'd be much more convenient!

glass timber
#

Can anyone point me in the direction of the quickest way to networking? I want to put it in before anything else. I really only need to see where each-other is facing and sync animations/physics, no damage or anything.

glass timber
#

Is fishnet a good solution for a simple first person project?

sharp knoll
glass timber
full holly
#
    {
        photonView.RPC("Launch",RpcTarget.All);//
    } 
    [PunRPC]
    void Launch()
    {
      if(photonView.IsMine)
      {    
        Debug.Log("working");
        Physics.gravity = Vector3.up * gravity;
        ball.useGravity = true;
      }
    }```
#

launch function not working

stiff ridge
stiff ridge
# full holly launch function not working

Start() will call the RPC on any client that has this script running. So all clients call Launch() on all clients. Likely, none of them will do anything, as only the controlling player reacts (checking IsMine)...

zealous thicket
#

I wanna ask, why this is not syncronize. I'm using photon pun for it and i already add photon view, photon transform view and photon animator view

full holly
stiff ridge
#

All clients, which have this script will call Start(). All of them will also call the RPC. This is networked, so everyone will Launch().
Only inside of Launch(), you check if "this" client controls the PhotonView (IsMine).

stiff ridge
zealous thicket
#

i read the tutorial but I still can't solve the problem

stiff ridge
zealous thicket
# stiff ridge Networked objects (with a PhotonView) should be instantiated with PN.Instantiate...

i already do that, like this

public class PlayerSpawner : MonoBehaviour
{
    public GameObject[] playerPrefabs;
    public Transform[] spawnPoints;
    private void Awake()
    {
        PhotonNetwork.CurrentRoom.IsOpen = false;

        Transform spawnPoint = spawnPoints[PhotonNetwork.LocalPlayer.ActorNumber - 1];
        GameObject playerToSpawn = playerPrefabs[PlayerPrefs.GetInt("playerAvatar")];
        GameObject currentPlayer = PhotonNetwork.Instantiate(playerToSpawn.name, spawnPoint.position, Quaternion.identity);
    }

}

#

or am i wrong ?

stiff ridge
#

Looks fine. But (e.g.) I don't know who is running this script and when. So .. could still be an issue. Hard to say without knowing the hierarchy, etc.

#

In the end, I would recommend to just try from scratch in a simple experiment project.
The script ConnectAndJoinRandom gets you into a room really quick, so you can test instantiation and control scripts in no time, without a bigger project around it. Just bare bones. What you do there, applies to a bigger project, so you can re-check what you did there.

rich nova
#

Has anyone setup Photon Fusion usng the new Unity Input System and managed to get movement data to OnInput without using Input.GetKey("w") as the documents are basically useless unless your game is using keys only and wasd by default

#

I'm not using a character controller ( another exectation of the documents )

spring crane
mortal horizon
glass timber
south otter
#

actaully going insane trying to find a way to make a net core standalone multiplayer server for unity with net core

#

been looking for days

#

and can support websocket connection

#

if anyone knows of a solution id be really happy

glass timber
#

my player script has zero errors and Ive watched back the whole thing before that point 3 times now making sure I have all the same components and settings

#

of course when I type all this, I just click stop client and client again and it magically works fine somehow

#

thankyou discord I guess?

solar canyon
#

Hello everyone, I'm facing issue where I want to assign color for player pre-entering the room and apply it on the renderer. Currently, I'm using PUN2, with PunCallbacks I used OnJoinedRoom to call my function to assign color which basically set custom properties for player with a material name. Then, on the player prefab I have a component which is apply the player custom property material on the body. The thing is it is assign colors for players properly but each player see different colors from the other players. Like everyone has its own networking for coloring

#

Currently, I fixed the problem of randomness colors and everyone having their own colors. But I'm facing a problem that my player component doesn't recognize any of the Custom Properties I have assigned unless if the player rejoin the lobby

#

It is more like the local player can not read the other player custom properties to apply it on their materials. Unless if they leave/rejoins

#

Got it fixed by using "OnPlayerPropertiesUpdate"

maiden sentinel
#

does Photon RPC support Structs

#

i don't think so, I think I have to manually serialize it, but I have no clue how to

#

if I had to make a struct the definition would be: cs struct Collectable { int ID; Vector2 position; int TypeIndex; }

static comet
# maiden sentinel if I had to make a struct the definition would be: ```cs struct Collectable { ...
rich nova
#

Thanks @mortal horizon - I'll take another look

mortal horizon
#

malzbier linked it

narrow cloak
#

im getting this warning

shut night
#

Hello all, looking for some advise for multiplayer. Do people here generally prefer PUN or Mirror when building a client server model multiplayer game?

maiden sentinel
spring crane
shut night
#

5player horror game. The server builds a randomly generated map and sends to clients. Clients have to escape before monster kills them. 2D

#

I’ve been working with mirror a lot having hell of a time with server generated maps

vocal trail
#

GameObject bulletHole = PhotonNetwork.Instantiate(AssetDatabase.GetAssetPath(gunStat.bullet).Replace("Assets/Resources/", "").Replace(".prefab", ""), hit.point, Quaternion.FromToRotation(Vector3.up, hit.normal)) as GameObject; this doesnt work in a build because UnityEditor doesnt exist in builds, is there a wya to fix this without having to manually type out the path to increase workflow?

ornate lion
#

Are there any comparison articles/videos on Netcode for Gameobjects vs Photon Fusion? We made a pun2 prototype which we now want to take into full production but we are not sure the best way to go... The main requirement will be voice chat and many players. No competitive, 'twitch' gameplay so high levels of lag are ok to an extent

vocal trail
#

anyone?

marble gull
#

So this is for later reference, making a battle royale and I have 2 questions.

1: I am going to use steam servers but how can I make auto matchmaking and the match to end like a normal br(last man standing)

  1. How can I make character selection, so you get to pick your character every match start?
maiden sentinel
#

hey! How can I send a RPC to a specific player if I have their Photon View?

#

or ID

steel gyro
#

What is the best option for multiplayer in unity without a framework

#

for a 2d game with playermovement

#

with 15 clients max on each server

#

I was thinking about WebSockets but recently I read about Hazel and it seems better as it uses UDP

high night
#

@steel gyro Could use enet maybe?

steel gyro
#

enet?

#

u mean unet?

high night
#

It's a low level networking library

#

I think it's what photon products are built with

dry jewel
#

yo, i need help with fixing multiplayer

#

if there's 2 players, they do controll their own camera but controll the movement of the other

#

making an fps game, i do have the (Photonview.IsMine) on the character movement script, and the photon transform View Classic and synchronized the positions

mortal horizon
steel gyro
narrow cloak
#

im having issues with my script with a warning about it needing to be auth ```cs
using System.Collections;
using System.Collections.Generic;
using UnityEngine;
using Mirror;
public class Gun : NetworkBehaviour
{

public GameObject bulletPrefab;
public GameObject BulletSpawnPoint;
// Start is called before the first frame update
void Start()
{
    
}


[Command]
void CmdFire()
{
    // This [Command] code is run on the server!

    // create the bullet object locally
    var bullet = (GameObject)Instantiate(
         bulletPrefab, transform.forward,Quaternion.identity);

    bullet.GetComponent<Rigidbody>().velocity = transform.position * 4;

    // spawn the bullet on the clients
    NetworkServer.Spawn(bullet);

    // when the bullet is destroyed on the server it will automaticaly be destroyed on clients
    Destroy(bullet, 2.0f);
   
}
// Update is called once per frame
void Update()
{

    Debug.Log(isLocalPlayer);
    if (isLocalPlayer == true) { return; }

    if (Input.GetMouseButtonDown(0))
    {
        CmdFire();
        Debug.Log("Shooting");
    }
    
}

}

#

im using mirror

olive vessel
#

It should return when we're not the local player

rain urchin
#

Hello, i can't understand it from the documentation, Does anyone now how to push this from Photon working?

public void OnPhotonSerializeView(PhotonStream stream, PhotonMessageInfo info)```
spring crane
wide girder
#

Wow. Photon just really dropped down in my eyes.
Why would you not let me get a list of all the rooms(including full rooms)?🤦‍♂️

spring crane
wide girder
#

Yep. It only lists rooms that are joinable, i.e. not full.

#

And according to their support it's "by design", but i feel like it's a bad design.😅

stiff ridge
# wide girder Wow. Photon just really dropped down in my eyes. Why would you not let me get a ...

Simple: You create a game that's successful and end up with 10k+ rooms. Clients try to get the list, download forever, get updates and feel really sluggish, eating someone's mobile data.
Most players enjoy the game itself, not the room listing.
Of course, we are aware that there is something missing, if you look closely. I know what you mean. If it's really important, you can do your own matchmaking and combine that with Photon (the clients would join/create games depending on your own rules)...

wide girder
#

Sure. You don't need to make it list all the rooms by default, but you could still leave it as an option. There are games with lower room count or those that are fine with waiting for a list of rooms. I've yet to see a game that has 10k rooms let alone one that uses photon.

And sure, I can use my own matchmaking, but then what's the point in using photon at all?

#

Or is there a way to connect clients bypassing the lobby/room system of photon?

stiff ridge
#

I've yet to see a game that has 10k rooms let alone one that uses photon.
Then you're not looking close enough 😉
Hint: Not all games announce they are using Photon..

#

Or is there a way to connect clients bypassing the lobby/room system of photon?
Yes. That's what I meant. Your matchmaking just has to assign a room name (region, etc) and the clients can use that to meet in-Photon, which does the synchronization.

wide girder
#

How would I implement something like that? Can I get other players info without them joining a room?

stiff ridge
#

The clients would contact your service to do the matchmaking. Whatever is needed to implement it, needs to be sent by the clients or (better) you have a backend which provides such data (e.g. skill, etc).

#

There are the WebHooks in Photon, which can call your service when rooms get created, fill, empty and get removed, so your backend / matchmaking service can get updates from Photon about existing rooms.
Cache as much as needed and provide a list of rooms to clients on demand or any way you like.

#

To be fair, that's quite some effort. But if matchmaking is essential .. anything is possible.

#

We've got a tournament system, which does this for Photon games.

#

We've done tournaments with several thousand players.

wide girder
#

Well, for now we're just going to hack our way through with adding 1 additional player slot and treat it as a full room when it's the only one left. Doesn't feel right though. I feel like an API shouldn't limit the user just because of assumptions like "that's for users sake". I can see more reason to list full rooms than not to. Anyways. That was just a small runt, so let's not take it too far.

stiff ridge
#

I agree: More flexibility would be nice for sure.
I think there is a solution to your case. DM me (I can't reach out to you), if you like.

ruby gorge
#

Is anyone here familiar with photon engine and would know why I can connect locally, but my friend isn’t able to connect to my game/room?

stiff ridge
stiff ridge
wide girder
ruby gorge
stiff ridge
#

You need an AppId, yes. The version can be blank but it would be better if you just use some version.

#

Unless your clients make up a UserID and send it as auth values, the UserID will be unique (a guid assigned by the server).

open surge
#

i was told to get here

ornate lion
#

Are there any comparison articles/videos on Netcode for Gameobjects vs Photon Fusion? We made a pun2 prototype which we now want to take into full production but we are not sure the best way to go... The main requirement will be voice chat and many players. No competitive, 'twitch' gameplay so high levels of lag are ok to an extent

zinc ravine
#

PUN2 Dev. here. I've been switching over from PUN2 to fusion. I'm attempting to have a user create a server that switches scene to the proper sandbox environment. How do I make Fusion switch to the Sandbox scene when creating the game? In addition, OnPlayerJoined never gets called- but the "Started a server!" log gets called. Maybe I'm approaching creating the server wrong. Is their only supposed to be one network runner per session? Thanks.


        NetworkRunner nR = gameObject.AddComponent<NetworkRunner>();        //Add network runner.
        nR.ProvideInput = false;                              //Allow user input.

        StartGameArgs sGA = new StartGameArgs() {
            GameMode = gM,                                                          //Gamemode?
            SessionName = serverName,                                               //Server name.
            Scene = SceneManager.GetSceneByName("Sandbox").buildIndex,              //Sandbox scene.
            SceneManager = gameObject.AddComponent<NetworkSceneManagerDefault>(),   //Scene manager?
            PlayerCount = maxPlayers                                                //Max players.
        };

        await nR.StartGame(sGA);
        print("Started a server!");
    }```
stiff ridge
stiff ridge
open surge
#

thanks

open surge
#

im using photon for a flight sim microgame
and the camera is included in the player prefab , stuff works great
but when player 2 join the lobby , player 1 camera become the same as player 2

open surge
acoustic sapphire
#

It will still explain why the ownership of your camera is wrong.

open surge
open surge
#

ididnt get it well...

#

so i need to have a camera in scene ? idk how to setup it

acoustic sapphire
open surge
#

i think ineed to see a video that have stuff showen up in unity not just texts

acoustic sapphire
#

Well good luck with that 👍

open surge
#

as far as i understood , have a main camera and player prefab

#

attach cameraworks script to both of them

#

error

ruby gorge
#

so using Photon, does any object I create in the game need to be spawned in via code with PhotonNetwork.Instantiate or is there a way to get objects that you just place in your scene normally to also move around for all players? Just giving objects in your scene the photon transform view classic / photon view components isn't enough right? It needs to be first Instantiated?

ruby gorge
left nest
#

Hello everyone

I'm using UnityWebRequest to send data to the server, data here includes strings and Images, it works well on some images while for some reason it returns

<html>
<head><title>413 Request Entity Too Large</title></head>
<body>
<center><h1>413 Request Entity Too Large</h1></center>
<hr><center>(Ubuntu)</center>
</body>
</html>

I've also tried post man and it worked fine there without any issue but gives me errors in unity, please what do I need to do, this is my code

public IEnumerator DetailsUpdate(string url, Texture2D display_pic, DetailUpdate detailUpdate)
    {
        var form = new WWWForm();

        if (detailUpdate.email != null)
        {
            form.AddField("email", detailUpdate.email);
        }
        if (detailUpdate.address != null)
        {
            form.AddField("address", detailUpdate.address);
        }
        if (detailUpdate.phone != null)
        {
            form.AddField("phone", detailUpdate.phone);
        }
        if (detailUpdate.fullname != null)
        {
            form.AddField("fullname", detailUpdate.fullname);
        }
        if (detailUpdate.dob != null)
        {
            form.AddField("dob", detailUpdate.dob);
        }
        if (display_pic != null)
        {
            var bytes = display_pic.EncodeToPNG();
            form.AddBinaryData("display_picture", bytes);
        }

        using (UnityWebRequest www = UnityWebRequest.Post(url,form))
        {
            www.method = "PUT";

            UImanager.Instance.Loading.InstantShow();

            yield return www.SendWebRequest();

            if (www.isNetworkError)
            {
                UImanager.Instance.Loading.InstantHide();
            }
            else
            {
                if (www.isDone)
                {
                    UImanager.Instance.Loading.InstantHide();
                }
            }
        }
    }
austere yacht
left nest
#
<html>
<head><title>413 Request Entity Too Large</title></head>
<body>
<center><h1>413 Request Entity Too Large</h1></center>
<hr><center>(Ubuntu)</center>
</body>
</html>
#

this is the error

#

@austere yacht

austere yacht
# left nest this is the error

A 413 HTTP error code occurs when the size of a client's request exceeds the server's file size limit. This typically happens when a client attempts to upload a large file to a web server

#

--> make your files smaller

#

--> increase the upload limit on the server

left nest
#

okay thanks alot

mint lance
#

hi everyone,

im having an issue using photon where everything works fine when only one player in the scene, but players stop moving once the second player connected to the same scene (could see each other but cant do anything else), im nt sure what is the problem

maiden sentinel
#

what would be the best way to send a request to everyone expecting a reply of type Vector2? 2 RPCs?

#

can you do PhotonNetwork.transform.position?

weak plinth
#

Hello i use Steam Networking to show the username and pfp in the canvas

#

The name works but the pfp dont

#

Any ideas?

olive vessel
# weak plinth

You're gonna need to show the code you use to get the image

stiff ridge
stiff ridge
maiden sentinel
trail parrot
#

Hi all
If i still wanna make use of gpu for compute shaders in server build, is it possible?

Or gotta NOT have -nographics but turn off every graphics related manually?

fleet aurora
#

Any idea why photon doesn't have reference to pun?

austere yacht
stiff ridge
#

Any idea why photon doesn't have reference to pun?
It's still easy to find, as far as I know. Where did you look?
But yes, we would suggest to have a look at Fusion if you start a new project now.

vale vessel
#

Do we pay for networking services? If yes, how much (cheapest)

olive vessel
#

Depends on the service, and what you want

cursive condor
#

I'm getting unity error CS0501 when I try use ConnevtUsingSettings

#

Using photon pun 2

#

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

public class ConnectToServer : MonoBehaviour
{
static bool ConnectUsingSettings();
}`

#

Error CS0501 'ConnectToServer.ConnectUsingSettings()' must declare a body because it is not marked abstract, extern, or partial Assembly-CSharp

cursive condor
#

How and what do I do for that tho

#

I'm new to photon and scripting in general

quaint moon
#

Brackets

#

With code in it

#

Tell it what to do

#

All you did was name a function

cursive condor
#

That's all the tutorial I followed said to do

trail parrot
#

Hi all, this is kinda borderline to a game design question:
Is it possible to blur the line between instance room based Mp and central server persistence?

austere yacht
trail parrot
#

My question's actually a bit more specific but i'll get to that next time

#

Another question, i happen to need GPU on server side
The cheapest GPU server i can find on Vultr is $90
Is there like a... cheaper alternative?
It's not like i'm using it for mining or super rendering or ML, i'm using Crest and the collision testing uses compute shaders

high night
#

When nearing the chunk borders

trail parrot
#

Oh no sry, not trying to do sophisticated runtime loading in between game servers like that

#

I'm just using fusion, which has shared mode which is not server auth
Originally i'm only doing server auth, but maybe can have a "less serious" client auth type of game too

But i want these room based client auth games to still be "connected" to the server auth server somehow

WoW with instanced dungeon is like this, except that dungeon session is also server auth bcoz, well, they can't be cheating in the dungeon

#

So i guess something 1 directional: what happens in the server auth "main server" still replicates in the casual client auth room sessions, somehow..
Just wondering if anyone got ideas in what ways this can be interesting

high night
#

The server could maybe do a validation after a player hosted session ends?

#

Some simple checks maybe

#

Looking at the game state and inputs over time

#

But I'm not talking about re-simulating the session entirely

#

If the game was deterministic, random players could validate eachother via resimulating the whole session perhaps
like in the background

austere yacht
weak plinth
#

`using System Collections

weak plinth
#

Which networking solution to you recommend if the goal is to make a game like Valheim/Rust/Minecraft/V Rising?

Were people can host their own servers on their PC or rent a server from one of those server hosting websites.

I am looking for a networking solution that allows me to run a decentralised game that I can share the client but allow users as much freedom to run their own servers as possible.

stone sigil
weak plinth
near haven
#
    public void LeaveLobby()
    {
        PhotonNetwork.LeaveRoom();
    }

    // public override void OnLeftRoom()
    // {
    //     Debug.Log("Player left the room!");
    //     roomMenu.SetActive(true);
    //     gameObject.SetActive(false);
    // }

Even though the code below is commented out, a part of it is run, specifically "roomMenu.SetActive(true);"
If i uncomment it, the function never ever gets called. I'm in total confusion. All other overrides worked fine till now until this one. I searched through my entire code for possible sources of the bug but there is no trace

#

And the "roomMenu.SetActive(true);" is the only thing that happens everytime, and there are only 2 places with this line of code.

#

nvm i figured the bug

weak plinth
#

Can I disable the infinite drag when adjusting the value on Unity inspector and viewport control? I often connect to my desktop remotely but when using Unity with it and when my cursor reach the border of the screen, it gets crazy increasing the value like more than 3000.
I’ve been looking for the option for more than an hour. Ngl It’s making me crazy.

olive vessel
#

I said actually ask a question

#

Nobody wants to have to ask you what you need, you're best off being straight up about the problem

sturdy shoal
#

but im using normcore multiplayer and theres a problem in realtime + vr player that says Prefab has missing scripts. Open Prefab to fix the issue. how do i fix???

olive vessel
#

Open the prefab by double clicking it and remove or replace any missing scripts

dense ravine
#

hi there, i am trying to find a tuturial on how to manage players. as in how to whrite code to work in multiplayer (i already know how to setup server linking ect)

#

anyone have a suggestion?

#

photon)

dense ravine
#

nevermind, found somthing

covert gull
#

Are photon voice and PUN2 (or Photon Fusion) charged separately? Do you pay per service? Or do you just pay per app for Photon cloud?
If I did the $95 one time charge for 12 months for example, would that get me photon voice and also networking through either PUN2 or Fusion? Or would I have to pay $190?

oak flower
#

Their server is pinned in this channel you could ask directly.

weak plinth
#

for a moba game what should i use?

zealous thicket
#

guys, i've a problem when i used PhotonView.RPC. I want to sync data player each other but it didn't work at all. i attached this code on each player.

dense ravine
#

OK I NEED HELP! i have it set up so i have 2 players.. it works.. both can move arround. but it doent look in the right direction when i look arround.. like the other player caracter follows the rotation of you... but that is not visable from the other perspective. how can i fix this?

errant panther
#

is better photon or mirror

dense ravine
#

most of the ppl use photon

zealous thicket
#

idk, maybe it doesn't work with you, but just try it.

austere yacht
#

you need to ask specific questions to get help here

weak plinth
#

Looking for photon server expert!

#

Please DM me

olive vessel
#

Or you can just ask a question properly, or you can go to Photon's Discord

#

Both of those methods would likely garner faster answers

weak plinth
#

can you give me invite url, please.

stiff ridge
placid stream
#

Hi guys i dont really understand how to restart game with all clients do you guys know ??

#

if(PhotonNetwork.IsMasterClient)

#

{

#

PhotonNetwork.AutomaticallySyncScene = true;

#

PhotonNetwork.LoadLevel("Game");

#

}

#

but it dont work idk

spring crane
#

Use a code bin site. The bot has become upset with code.

placid stream
#

where

#

??

#

i dont have that

spring crane
placid stream
#

sorry

#

i dont see link where wait i am going to press all

#

wait

#

its not working ;D

#

bruh

spring crane
#

You copy the link to chat.

placid stream
#
https://hatebin.com/kcujdwkofw
#

not working

#

;D

placid stream
#

Hi guys i dont really understand how to restart game with all clients do you guys know ??

hollow adder
#

Hello ! i'm trying to connect my game to my dedicated server running on my computer in local via UnityEngine.networking but i can't find how to get it any ideas why ?

hollow adder
#

what should i use then ?

#

i've been searching for solutions but it's the only one i found

olive vessel
#

Well UNet is deprecated, the new Unity solution is Netcode for GameObjects, but there's Mirror and various Photon products too

hollow adder
#

ok i'll look into it

#

thanks

olive vessel
#

I quite like Mirror atm

hollow adder
oak flower
#

@hollow adder For networking it makes very little difference.

hollow adder
#

once i've cloned the Netcode repo what should i do ?

#

because i've tried adding it to unity packages

#

but it doesn't find it

olive vessel
#

Are you on a supported editor version?

hollow adder
#

good question i'm on Unity 2021.3.4f1

olive vessel
#

Yeah that's fine

#

You can add it by Git URL in the Package Manager

hollow adder
#

i'm on ubuntu

hollow adder
olive vessel
#

No Console messages?

#

Apparently 2021.3 isn't supported but .2 is, I imagine this is irrelevant in reality

hollow adder
#

i got error searching for packages

olive vessel
#

What does it say?

hollow adder
olive vessel
#

Oh look, their GitHub says different to their docs site, so 2021.3 is supported

olive vessel
hollow adder
#

yep

#

sorry for the poor quality ahah

olive vessel
#

Are you signed into Hub?

hollow adder
#

yep

#

signed through unity ?

placid stream
#

i am stuck with this like 2 days when we start game yes and we die that master client press restart and PhotonNetwork.LoadLevel(2); but other client dont load idk why ?

#

can anyone help me pls

full mango
placid stream
#

yes

#

but it dont work idk why

steel belfry
#

Best networking soulution for an fps GO

olive vessel
#

"Best" is relative

amber void
#

i followed a tutorial to install mirror and everything works fine except for one thing. whenever i join as a client on my cloned window, it auto moves my character on my original window as well. but for me to fix it, i have to manually go into the hierarchy, select my main cam attached to my player, and switch the display port from 1 to 2

#

anyone know how to fix this issue and make the display auto update after another player joins?

olive vessel
#

Generally, the local player should have their camera and movement scripts etc enabled, and then the other player's objects on their client should have those things disabled

amber void
#

how so i check if thats alr set to true?

olive vessel
#

So on player 1's computer, player 1's camera and movement is on, but player 2's are both off

#

NetworkBehaviour has a IsLocalPlayer property

amber void
olive vessel
#

On player 1's computer, yes we want those things disabled

steel belfry
olive vessel
#

Player 1 shouldn't be able to control player 2

olive vessel
steel belfry
#

k

olive vessel
#

Player 2's movement on player 1's computer would be done through their NetworkTransform

amber void
olive vessel
#

You should check if this is the local player before allowing them to change the position, yes

#

You could just put a guard clause at the start of your Update method

amber void
#

ok thx ill try and look for a tutorial on how to do that!

oak flower
steel belfry
#

do yall think photon is good for fps games

olive vessel
#

Photon Fusion probably

full mango
placid stream
#

Yes when master press

nocturne aspen
#

ok here thanks

#

DefaultPool failed to load "Enemy". Make sure it's in a "Resources" folder. Or use a custom IPunPrefabPool.
help please

olive vessel
#

Well tbh, PUN is now sort of their legacy system isn't it

#

They do say new projects should be using Fusion

nocturne aspen
#

ok

nocturne aspen
#

please

#

DefaultPool failed to load "Enemy". Make sure it's in a "Resources" folder. Or use a custom IPunPrefabPool.

placid stream
#

how it works

#

k

steel crow
#

Yoo! I trying to follow the hello world tutorial on the netcode page on unity´s website and the part when you need to assign your your prefab to default player prefab doesn´t work because the checkbox doesn´t exist on the component

simple hull
#

hello anyone is there

#

i am making archer multiplayer game

#

and i don't know how to syncronise arrow on both player side

#

if you can help me then please help

#

i can share code

dark finch
#

Just track the transform properties on both sides.

dense ravine
#

hi there, i am learning networking in unity.. but i cant seem to find a lot about Photon Pun.. is there a different networking option that is easyer to learn? and is someone willing to help me for a bit?

spring folio
#

All the main 3 systems for multiplayer are very very similar, Unet vs Pun vs Mirror, they all use the same kind of logic, I don't think there is an easier version of that

#

Mirror is maybe the most accessible, kindof

dense ravine
spring folio
spring folio
#

also i don't know your level on unity or c#, but if you're a beginner, i would recommend not making game with multiplayer yet

dense ravine
#

but you might be right...... i am just sad, i had such a nice idea

spring folio
#

once you'll get more experienced you'll be able to it, don't worry

dense ravine
#

ah ok, thats nice to know

#

is it ok that i add you as friend? you seem cool.

olive vessel
#

I think it important to note, that the new Unity official solution is Netcode for GameObjects. UNet has been deprecated for years

dense ravine
olive vessel
#

UNet should not be used, it is deprecated

#

The new solution is Netcode for GameObjects

dense ravine
olive vessel
#

It's not hard fella

#

Netcode for GameObjects has replaced UNet

dense ravine
#

is it easier than Photon PUN?

olive vessel
#

That's a matter of perspective, I find Mirror easier out of all the solutions

#

But it totally depends on you, and what you need from it

dense ravine
#

ok

#

but i cant find a video on like what the difference is between all of them, so i dont know wich one to choose

olive vessel
#

You can look at them all individually and compare them yourself

dense ravine
#

yeah but even if i searched what is photon used for, or like info photon pun, and all the others, cant find much on it

olive vessel
#

And to be honest, Photon PUN shouldn't be used for new projects, they are replacing it with Photon Fusion

dense ravine
#

or i am jsut searching wrong

olive vessel
#

PUN is now described as legacy

dense ravine
#

what is the difference between fusion and pun?

#

what is legacy?

olive vessel
#

That is on the Photon site

dense ravine
#

sorry

#

ok ill look into it later

tame pendant
#

I need help with photon voice . I can’t hear everyone only one person

fallen finch
#

Hello. So I'm currently trying to get Plastic SCM working with Unity but any time I try to create a cloud repository I get this error:

#

Does anyone have any advice on how I might fix this?

steel belfry
#

if anyones know fish networking i would apericeat if u coudl help me out with smth

noble bison
#

do you guys recommend fusion or mirror for a team deathmatch-styled fps game?

nocturne aspen
#

this all code does not belongs to me except photon codes

#

i have connected photon to the game and can bale to show players in scene with photonNetwork

#

now the problem is how should i sync the attack of player

#

means

#

when 1st player attacks to another then weapon should show same in both player scene. and also to move camera with that

nocturne aspen
#

😢

stray raven
#

Fusion or mirror?

nocturne aspen
#

but for sure not fusion

#

i'm using pun2

eternal frigate
#

hey, im just wondering how to install the new unity netcode for gameobjects package. When i follow the install instructions, it provides me with a test project which does not wish to load. I am wondering if there is a direct way to download just the netcode for gameobjects package. thanks

pliant sundial
nocturne aspen
#

why??

#

is pun and fusion is same??

#

😢

nocturne aspen
#

@pliant sundial

pliant sundial
nocturne aspen
narrow cloak
sand sleet
#

is there a way to make people host by themselves on PUN 2 or do you just have to keep adding CCU?

stray raven
pliant sundial
spring crane
spice nest
#

Hi Guys,

I stumbled across a problem with Unitys Lobby and Relay system.

I managed to implement creating and joining a lobby but when I try to get the allocation data I get a bad request "invalid schema or decoding failure".
Does someone have a clue where I can do some further investigation to fix it?
Code:
allocation = await Relay.Instance.JoinAllocationAsync(_lobbyCode);
The lobbyCode is the same I use to join the lobby.

stray raven
#

Does it really matter which networking I use? I'm choosing between Fusion, Mirror and Fishnet

rotund bramble
#

Hi guys, i am new with game dev, and i am beginner with programming too. I have a 2d game with Photon Networking. I have rooms, which spawn enemies and close doors after entering. The enemies target a random player. In multiplayer they attack sometimes different player. How can i deal with aggro in multiplayer?

ripe crystal
#

oke guys im trying to do onclick function
if photon is connected to master and joined lobby it just activates and disactivates gameobjects
if not it connects and do somethings
here is the script to better undestand

but it just says like this in the console log

plucky quartz
#

hello, so i am trying desperately to make unity netcode work with my movement controller. right now i have an issue where the client will not identify as a local player when i am using it. does anyone know how to fix this issue? i am running both instances on one pc. heres some screenshots. thanks in advance

the editor is running as a client at the moment

nocturne aspen
#

what tf i just wrote a code here and it just got disappeared

#

seriously

#

??

spring folio
#

its a bug, use pastebin

nocturne aspen
#

ok

sand sleet
#

how do i properly instantiate the bullet on all clients and server, and than delete when it hits something?

#

(PUN 2)

simple hull
proud atlas
#

Hey everyone, I got an issue that I need some help with, I'm using Photon PUN 2 for my PONG ripoff game

#

I wanna get the first player to create the match to load into the game, then the second player who joins gets instantiated, I'm at a loss on how I would do this in code

wide girder
proud atlas
#

Yeah I did, I figured I'd use something with TransferOwnership?

#

I'm really new to networking and gamedev in general

past garnet
#

Hi there, i didn't do any networking a since 2 years, which solution is the best at the moment, or which should take a look at?

spring crane
past garnet
spring crane
#

Photon Fusion and Quantum are probably what you want to look into.

past garnet
spring crane
past garnet
#

great thank you!

sand sleet
#

need help with deleting a bullet with RPC

#

no matter how hard i try, it keeps not deleting

rotund bramble
#

Hi guys! im working on a multiplayer top down 2d shooter game. I have a line (see below) is there any way to skip the firePointPos.right? Cause i use RPC to pass things to the host, but i can't send a whole object and i am new and i don't know how can i handle this.

rb.AddForce(firePointPos.right * bulletForce, ForceMode2D.Impulse);
spring crane
glacial totem
#

@cedar epoch would need more communication for game servers to validate stuff

cedar epoch
#

How do you manage the server connections? through a database?

glacial totem
#

my game servers talk to the matchmaking server too

cedar epoch
#

I'll likely use something like LiteNetLib for the matchmaking server

glacial totem
#

to tell it it's online

#

and has room for players

cedar epoch
#

do you use a static IP address for the matchmaking server? That's the one thing I haven't really looked into yet is how to find the matchmaking server

glacial totem
#

game server starts up, connects to the matchmaking server, and then sends a GameInfo packet ever 15 seconds with some info like player count, fully qualified DNS name, and IP

#

I use Azure's FQDN

#

<container instance name>.mycustomdns.azure.io

#

i can rely on that by only knowing the name of the server

#

But the server's also report their current IP address

#

from Azure

cedar epoch
#

ah ok I see

glacial totem
#

i basically get the server name from the game server (which Azure supplies to the server using the container command line)

#

then i use that server name to cross reference Azure's Data

#

kind of confusing tbh

#

but Azure starts the server with -servername "name"

cedar epoch
#

Im sure it will make sense once I get to that point

glacial totem
#

and then the server grabs that argument and sends it to matchmaking

#

then matchmaking takes that name and finds the Container with that name in the list

#

and grabs more metadata

cedar epoch
#

what kind of authentication do you use to verify that you're a valid client?

glacial totem
#

on the game server side?

#

to validate an actual client is connecting?

cedar epoch
#

I suppose so, yeah

glacial totem
#

i don't yet

#

but Steam would be taking care of that with AuthTickets

#

it's not really a problem anyways

cedar epoch
#

ah ok you're going through steam

glacial totem
#

clients only send input

#

so they can't really cheat or cause problems

#

someone would need to write something super sophisticated to read the game server info and reply with the right packets

cedar epoch
#

yeah, server-authoritive models are imo much better

glacial totem
#

that would have to also simulate the correct input

#

yeah i love that about it

cedar epoch
glacial totem
#

exactly!

cedar epoch
#

pretty much how you make bots/AI

glacial totem
#

yeah so by all means go for it

#

if someone wants to

cedar epoch
#

I think RL does something similar when you play with/against bots

#

Thanks for your input @glacial totem it makes things a bit easier once I get to that point 👍

glacial totem
#

@cedar epoch i've spent a good amount of the last 3 years teach myself game networking from the RL GDC talks

#

so reach out about shit if you got questions

#

i love talking about what I've learned

#

This was the last little game jam i was working on

#

basically all my game jams are physics sports games on top of this networking "engine" I've developed over the 3 years

cedar epoch
glacial totem
#

this has some actual networked gameplay lol

cedar epoch
glacial totem
cedar epoch
glacial totem
#

VR would never work with client side prediction physics imo

#

the movements are too fast to reliably predict

#

you need a game like RL where the game feels fast but all the movements are a small distance over time

#

that's the challenge with physics predictions

cedar epoch
#

maybe what you could do is make it partial VR, like the inputs are keyboard/controller, but head movement is tracked by the headset

glacial totem
#

ever play Boneworks?

cedar epoch
cedar epoch
glacial totem
#

it would need to be like that but slowed down even more

#

where it punishes you for moving too quick

#

in Boneworks if you lift something heavy you need to act it out and act like it's heavy haha

#

so this game you would need to act like slow motion?

#

idk

#

haha

cedar epoch
#

yeah boneworks is probably a good base for future realism of VR imo

#

given how everything is free-range with no constraints like, weight

#

you could be hulk but the game doesnt know that xD

ruby gorge
#

Hey guys, I have a small 2 player multiplayer game set up that sends both players into a room once two people are finding a match, was wondering if anyone could tell me how from there I could have the server randomly select one of them to be the starting player

(or do anything that requires the server to do something and send it to all players, really, but specifically that)

velvet sonnet
#

does anyone know if Netcode's NetworkManager.Singleton.ConnectedClients automatically purges Client ID keys that are disconnected? Or does it need to be done manually?

hardy citrus
#

Im trying to sync a transform, I cant get it to work,
It's not possible to use the ClientNetworkTransform on spawned gameobjects? I cant manage to get them work,

What is the easiest way to sync a player picking up a object without change the parent,

I want each player to pick up a cube and all other players can see the movement, NetworkTransform with continous position update is the only solution?

naive geode
#

hey I'm building multiplayer chess game and I want to select random players with each other at the start of the game. how can I do it
like one player is me and other player will be randomly online selected player

stiff ridge
#

You could do random matchmaking, before the players get into a session/room ...
Which networking solution do you use?

naive geode
#

I don't know much about multiplayer as it will be my first multiplayer game

#

so which networking is good and how I will do random matchmaking

naive geode
hardy citrus
#

How do you use the networkobject change owner, and also can i use the localclientid for this? Clientid did not work

hardy citrus
#

Or is it wrong to use clientnetworktransform on a block that can be moved by everyone?

bold stag
#

I've got an issue with my multiplayer game i'm working on. My cinemachine camera seems to follow the wrong character and I would need to do an: if (view.IsMine) but there is nowhere to put that code for it so I need help.

oak flower
#

@bold stag Cleanup your extra cross-posts.

solar loom
#

hello, I have been having some trouble installing MLAPI. When I follow the unity guide (https://docs-multiplayer.unity3d.com/netcode/current/migration/install) it installs a test project, but i wish to be able to create my own projects, and I don't know how to add the necessary packages to the new project. Could i get some help with this issue?

keen plover
#

I am creating multiplayer 2D game and I have camera that follows player.How can I make it so when two players are in scene that camera follows each player.

austere yacht
keen plover
austere yacht
#

photon should help you figure out which one it is

#

idk how photon PUN works in detail but as a matter of principle it is what you have to do

keen plover
#

I dont know how to do it

keen plover
#

@austere yacht

#

Pls can you write what should it look like

#

PLEASE

patent fog
#

I don't use Photon products and I found it in a dozen of seconds

patent fog
#

good luck, have fun

past garnet
#

can someone tell me what i'm missing, i checked out Unity Relay services and its says it would need the UTP (Unity Transport) to work, but relay is engine agnostic, but seems that UTP is private at git and docs are not very full of infos, how could i implement the UTP in my acual networking Solution? Docs are confusing in this point.

upbeat haven
#

I'm assuming this is the right chat to ask, but could you use unity web request to download mp3 files or get a url to play music?

spring crane
#

I imagine Netcode for GameObjects would be an example implementation of Unity Transport, if nothing else.

regal delta
spring crane
regal delta
#

Nope you'd have to roll your own hosting solution.

#

Maybe worth looking into building out some sort of integration for that though

dense ravine
#

can someone PLEASE help me with this, i want to choose a Hunter (lets say impostor) and i need all the player scripts to know if MY player is hunter or not.. i have found a video on how to make among us and saw a piece of where he chose the impostor.. but i cant seem to recreate it. i just dont know what im typing, i have tried the photon documentation but still didnt manage to come up with somthing. please help me and explain what to do.. and also explain a bit what i am typing so i understand and can learn from it...

#

If you want you can DM me... its a bit easyer than the server

#

using Photon Pun btw

tidal hinge
late wagon
#

they're stacking on eachother

#

if anyone is online to help, photonengine isn't replicating my position coords, any help is appreciated

prisma imp
#

Guys, in cloud firestore, is it a good idea to put top 1-10k players in 1 document, then 10001-20000 in 1 document, then 20001-30001 in 1 document and so on, so that the read count is small so that it won't cost so much ? Will that work ?

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

public class Abilities : MonoBehaviourPun, IPunObservable
{
    public bool[] global; 
    public PlayerController controller;
    public int id;
    public static Abilities instance;
    public int[] ids;
    [SerializeField]
    private PhotonView photonView, target;

    private void Awake()
    {
        photonView = this.gameObject.GetComponent<PhotonView>();
        if(photonView.IsMine)
        controller = this.GetComponent<PlayerController>();
        instance = this;
    }

    public void init()
    {
        //Invoke("ability" + id.ToString(), 0f);
        if (global[id - 1])
        {
            photonView.RPC("ability" + id.ToString(), RpcTarget.All);
        }
        else
        {   
            if(target != null)
            photonView.RPC("ability" + id.ToString(), RpcTarget.All, photonView.ViewID, target.ViewID);
        }
    }

    [PunRPC]
    private void ability6(int sender, int _target)//int _target)
    {
        if(photonView.IsMine)
        {

            if (photonView.ViewID == _target)
            {
                Debug.LogError("REC");

                //if (_target == this.GetComponent<PhotonView>().ViewID)
                {

                }
            }
            if (photonView.ViewID == sender)
            {
                Debug.LogError("SND");
            }
        }
    }

    public void OnPhotonSerializeView(PhotonStream stream, PhotonMessageInfo info)
    {
        
    }
}
#

so that's my code on short

#

I got more instances of this script

#

one for each player

#

the problem is that when I call ability6 it only calls one method (which is attached to the same player) on every side

#

@spring crane got any idea ?

austere yacht
#

do not ping people (especially mods) that are not in conversation with you

weak plinth
#

uh he was I think

#

but we moved to this channel

austere yacht
#

you might have mistaken his response for an offer to help

weak plinth
#

maybe

#

I said I think

#

oh nvm

#

I got an idea

#

DONE IT

#
    private void ability6(int sender, int _target)//int _target)
    {
        if(photonView.IsMine)
        {
            if (photonView.ViewID == _target)
            {
                Debug.LogError("REC");
                {
                }
            }
            if (photonView.ViewID == sender)
            {
                Debug.LogError("SND");
            }
        }
        else
        {
            PhotonView.Find(_target).gameObject.GetComponent<Abilities>().ability6(sender, _target);
        }
    }
#

ILY ALL

#

:D

brave bronze
#

I'm trying to make a lobby for the players to wait until 1 player joins the same room. if I try to join the room with 2 different devices, then it only saids there is 1 person in it. (cause the 2 players stay in the lobby instead of going to the game.)

Can anyone help me?

using System.Collections;
using System.Collections.Generic;
using UnityEngine;
using UnityEngine.UI;
using Photon.Pun;
using TMPro;
using UnityEngine.SceneManagement;

public class WaitingForPlayers : MonoBehaviour
{
    public TextMeshProUGUI amountOfPlayersText;
    public TextMeshProUGUI RoomCodeText;
    private int NewPlayer = 0;

    // Start is called before the first frame update
    void Start()
    {
        RoomCodeText.text = "Room Code: " + PlayerPrefs.GetString("JoinCode");
    }

    // Update is called once per frame
    void Update()
    {
        if (PhotonNetwork.CountOfPlayersOnMaster == 1)
        {
            amountOfPlayersText.text = "Waiting for friend (1/2)";
            NewPlayer = 1;
        }
        else if (PhotonNetwork.CountOfPlayersOnMaster == 2)
        {
            amountOfPlayersText.text = "Waiting for friend (2/2)";
            NewPlayer = 2;
        }
        else if (PhotonNetwork.CountOfPlayersOnMaster > 2)
        {
            NewPlayer = 3;
        }
        if (NewPlayer == 2)
        {
            PhotonNetwork.LoadLevel("ClassicMMode");
        }
        if (NewPlayer > 2)
        {
            SceneManager.LoadScene("Menu");
        }
    }
}

stiff ridge
#

Imo, you don't have to worry about this. The usual path is to just create a room and wait in that, until someone joins.
You can still show some lobby / wait screen until that happens, so there is no difference for the user but it simplifies your workflow.

#

CountOfPlayersOnMaster is updated lazily, so it's not highly up to date anyways.

keen plover
#

Guys this is my player script and I have change skin menu where on button you change skin but when I change skin only I can see my skin changed and other players cannot. How can I fix that? Pls help! Here is script: https://hastepaste.com/view/ToqcZl0CZ

brave bronze
brave bronze
#

alright I fixed that problem already. it works now.

#

now i got 2 more problems

gritty olive
#

I'm currently making an online game with Photon. How can I check if a Room with an ID does already exist? Pls Ping for awnsers thx

gritty olive
#

nobody an idea?

brave bronze
gritty olive
#

How do I check for Error Messages?

brave bronze
# gritty olive How do I check for Error Messages?

you could try to create a textBox that pops up after a fiew seconds. Normally if the room name exists, you won't be able to create the room. (the button just doesn't work). so the box will pop up and tell the player to choose a new name or checking internet connection (if it would have delay.)

If the room doesn't exist, then you will create and join it automaticly, the textBox would still pop up in the lobby, but then the player is already in the game. (so he wouldn't see it)

#

@gritty olive

#

this is how I would fix it, but you can do it on another way if you know a better one

odd apex
#

idk if this is the right place to ask this but how can I keep my fps camera from clipping the head of the player? Is there a way to make the mesh invisible for just the fps camera? I looked it up and some people say I can use isLocalPlayer to check and disable the mesh for the client. I don't know anything about networking so I would appreciate some help!

naive geode
#

i got this erro when other player joins

#

Autoconnected Player "Autoconnected Player" NullReferenceException: Object reference not set to an instance of an object.

#

also my host and client is not syncing with each other during play ... i added photon view and photon transform view in both player

#

then also they are syncing and working

#

what can I do.. I'm noob at this

cedar epoch
#

@glacial totem I'm thinking about switching to LiteNetLib.... Mirror is nice and all, but it's kinda slow. Plus, the HLAPI isn't that big of an improvement over LLAPI of LiteNetLib. Also, LiteNetLib has an HLAPI called LiteNetLibManager that looks very similar to Mirror.

glacial totem
#

I’ve only used LiteNetLib so I can’t compare, but it’s feels like any other TCP or UDP library for C#

#

I like it a lot

#

And it’s extremely fast

cedar epoch
#

do you use the manager or nah?

glacial totem
#

I don’t believe so?

#

Also I know 7 Days To Die is a popular game on Steam that uses LiteNetLib

cedar epoch
#

yeah I didnt know that till looking at LitNetLib

#

IMO it would be better if I switched, because then I can control what everything does, especially since I need to connect to a match-making server that wouldn't be Mirror base

glacial totem
#

Yeah the flexibility and control is what I desired the most

#

I’ve done plenty of client/server code before I got into Unity so it was already extremely familiar

cedar epoch
#

The way I see it is the client will have a seperate Unity scene then the server. In that scene would be a bunch of scripts that just listen for server events.

glacial totem
#

My client and server use the same scenes and everything since they run identical code

#

The only difference is some minor stuff for client side prediction and rollbacks on the client’s end

#

The only thing the server sends is the last game state of all players and the ball

#

And then events like replay starts and goals

cedar epoch
#

is the script that's on both the server and client the same component, or do you have one for server and client separately?

cedar epoch
glacial totem
#

Not at the moment but they all involved the same concept lol

#

Players and a ball or puck

#

All interacting with physics

cedar epoch
#

Still havent gotten my reconciliation script working yet haha

#

I drifted off into making a replay system I forgot what the primary goal was

glacial totem
#

Reconciliation is the tough part haha

#

Because you need a good way to be able to calculate and sync client and server time

#

Knowing that client time should always be in the future

cedar epoch
#

yeah for me that's the part I haven't quite solved yet

glacial totem
#

The server has a concept of a queue of inputs waiting for each player

#

If the server sends the queue’s count, the client then has a lot of good info to use

#

The queue should be full of only future tick input, so if the queue is small, the client needs to move further into the future to get ahead

#

If the queue is too large, the client needs to slow down because at that point it’s just adding unnecessary delay

cedar epoch
#

ah ok that compensates for a drop in latency

#

or a rise

glacial totem
#

RL uses this model in 2 ways

#

And actually let’s you switch between them

#

One model is like I described, and the other model is the same except the server explicitly speeds up or slows down the client by duplicating or dropping inputs

#

Instead of the client defecting it itself

cedar epoch
#

yeah, 2-3% game slowdown CSTS

glacial totem
#

Yeah I believe my model is CSTS

#

I can’t remember which they default to at this point

#

Because they were attempting to change it

cedar epoch
#

CSTS is the preferred if you have shitty internet

#

STS is the same as CSTS, but without the slowdown

glacial totem
#

Okay maybe I should look at trying to implement STS instead in the future

#

Unless I’m wrong and I actually have STS implemented

#

I have to research more

cedar epoch
#

Yeah idk exactly all the details. I could be wrong about STS having no slowdown

#

I do know CSTS is recommended over STS or default if you have bad internet

glacial totem
#

Ahhh so legacy is the one where they just duplicate or skip inputs

#

Where as CSTS and STD are the same concept of the client running faster or slower

cedar epoch
#

yeah thats what I figured

glacial totem
#

Just whether the client is the one detecting or or whether the server is explicitly telling it to

#

So I believe I do CSTS then and that it sounds like it’s a good model to have

cedar epoch
#

yeah, plus you can always add more models if you feel like it

#

in RL I think I use CSTS, but I need to switch it

#

the random slowdowns throw me off sometimes

#

@glacial totem thanks for mentioning the input buffer count on the server end, didn't think of it. that actually might be what I need to get the reconciliation working

glacial totem
#

Also for what it’s worth, I reconcile on every server state packet

#

No matter what lol

cedar epoch
#

so basically every physics update?

glacial totem
#

Yeah

#

I used to have error detection

#

But the truth is that it’s off enough every tick

#

That it’s more reliable to just correct every time

#

Worst case is extra CPU cycles just to arrive at the same place

cedar epoch
#

so you reconcile every physics update regardless?

glacial totem
#

yup

#

not every physics update

#

every time i have a game server packet to process

cedar epoch
#

yeah that's what I ment sorry

glacial totem
#

which is half of my physics tickrate

cedar epoch
#

How many objects do you correct for? every client present on the users end or just his client?

glacial totem
#

for all physics objects

#

all players and ball

#

client should ALWAYS end up at the same position if they aren't interacting with other players

#

because the client has its own inputs already to replay

#

and the ball interactions is 100% predictible

#

other players are what are impossible to predict

cedar epoch
#

makes sense

tidal hinge
late wagon
tidal hinge
#

How???? (Sorry I’m just, Very, new to this kind of thing)

cedar epoch
#

@glacial totem just to clarify, the FirstPeer from the net manager is effectively the server peer on the client?

#

Currently making a few scripts to handle networking in LiteNetLib. Messaging, Rpc, and Commands are being worked on as of now

#

kinda doing what mirror does and use attributes to populate their commands and Rpc methods. Only difference is you invoke them with the name or a hash code of the method

glacial totem
#

I don’t use any RPC tbh so I’m not sure about that @cedar epoch

#

The client should have a single peer, which is the server of course

#

And the server should have a list of peers, which are all the clients

tacit stratus
#

Hey guys, been getting into Netcode for GameObjects recently and noticed a weird issue. On the docs for reparenting over the network it has the diagram where you have the main player object then a networkObject on the hands that way you are able to parent networkobjects to those hands. However in practice it throws a "You can't have multiple networkObjects on a nested prefab". So how would I go about spawning in a sword and correctly parenting it to the player's hand?

austere yacht
gritty olive
#

https://www.youtube.com/watch?v=QG3VIUFcif0&t=468s I made a Twitch chat game with this tutorial. In Editor an as exe it works just fine, but when I tried to upload it as html it gave me this error message. Does anybody know how to fix?

We will look at how to connect your game to Twitch chat so they can play it, like in Twitch plays, or affect it like they cna add power ups or create enemies, etc.

Previous Tutorial
https://youtu.be/tdkdRguH_dE

(づ ̄ ³ ̄)づ ~(˘▾˘~)

TWITCH ( ͡° ͜ʖ ͡°)
https://www.twitch.tv/PabloMakes

TWITTER (ಥ﹏ಥ)
https://twitter.com/PabloMakes

#unity ...

▶ Play video
tidal hinge
cedar epoch
# glacial totem I don’t use any RPC tbh so I’m not sure about that <@209095082735960064>

yeah I actually decided to just keep it clean and use exclusively messages. It is however simplified down by just having an attribute with a message lookup table you can use. Otherwise, you just send a message to the client(s) by message name using a delegate signature. I strictly use byte[], so serialization is mandatory on both message ends regardless (no auto-serialization like some APIs do because it can get slow at times from all that boxing)

#

I also limit to unmanaged types, or pre-converted byte[] for stuff like strings.

brittle bone
#

is anyone aware of any good tutorials for setting up server authoritative movement with rigidbody controlled players using netcode for gameobjects?

keen plover
haughty heart
#

As you've been told twice already, you need to show your code and implementation. How is anyone going to even guess where to begin.

haughty heart
#

It means explaining how you did it.

grand relic
#

My problem is i added the code of killing and respawning and i put the tag enemy on the cube and i tested it on a cube and worked perfect fine i added the tag enemy on my player nothing happened? everything works completely find i just need to know how to be able to make the player die
heres my code

using System.Collections;
using System.Collections.Generic;
using UnityEngine;

public class NewBehaviourScript : MonoBehaviour
{
public Transform respawnPoint;

private void OnTriggerEnter(Collider other)
{
if (other.gameObject.CompareTag("Enemy"))
{
other.transform.position = new Vector3(-22, 2, 10);
}
}
}

olive vessel
grand relic
grand relic
olive vessel
#

Yes it's rather crucial that the class and file name match

grand relic
#

now thats not the problem anymore we got the script we made colliders

#

its just not workinh

#

borked can maybe explain the problems

#

if u would like

worldly mirage
#

Something breaks when @grand relic Tries to run the game in the editor, it only works when you build it out which makes it very difficult to debug

#

I recommended starting in a new scene and trying to get some controls working with keyboard and mouse

grand relic
#

yea ik

#

but we added colliders and triggers and the scripts but when we test it still dosent work

#

plus im very dumb on text i understand in talks so thats gonna be a problem...

worldly mirage
#

You've gotta move from trying to get it done to trying to learn. Otherwise you'll be too stressed to do anything.

grand relic
#

yea ik but this has marks and my mom is very strict with marks

worldly mirage
#

Here's what you can do:
Make a numbered list of everything you've done,
and everything you've learned doing the things you've done

#

Even if you can't get it ultimately working like you'd hoped, you can present this to your teacher and any reasonable teach will give you a decent grade

grand relic
#

well my teacher isnt rreasonabal at all

#

shes always mad..

tacit stratus
austere yacht
tacit stratus
wide girder
#

What makes you think there's such a method available to override?🤔

unkempt meteor
#

@wide girder it doesn't even call OnJoinedRoom

#

I'm also working with something that makes you able to join a game, if you're a party owner, and therefore I have to keep a dictionary of players and party names, to map the party to the owner. How do I make this list appear the same, with the same values, for everyone on the network?

wide girder
unkempt meteor
unkempt meteor
wide girder
unkempt meteor
wide girder
#

Well, hard to say anything without any details.

unkempt meteor
#

also I have a couple functions that I use throughout the game, such as CreateParty, JoinParty and LeaveParty, however these are all in a PartyManager script, and I have my player in the dontdestroyonload scene. Therefore I must have two partymanager gameobjects with the partymanager script attached to them, in both of the scenes, in order for me to be able to execute those party functions from both my player's wrist UI (in the DontDestroyOnLoad scene) and from physical buttons on the ground (in the main scene)

#

How should i tackle that without using two of the PartyManager scripts/gameobjects?

wide girder
#

Just use the one that's DDOL.🤷‍♂️

#

No need for 2.

unkempt meteor
#

but idk how to access that from the actual scene

#

especially not on a button, where I have to have the component directly linked there

wide girder
#

Use a proxy script for the button. It shouldn't be referencing something far away anyway. There are many ways to reference an object in your loaded scenes. If you don't know how to do that, I think it's a bit early for networking.

unkempt meteor
#

ok

austere yacht
gritty olive
#

I am using a Streamwriter to make a Twitch Chatgame and in Editor and as .exe it works as intended, but the webgl version doesn't work. Does anybody know why, and how to fix?

#

Pls Ping for answers thanks

wintry bluff
#

i read about using mirror and EOS how do i do that?

#

it sounds pretty interesting

unkempt meteor
#

I'm using Photon Engine, and when I try to join a party that I know exists, it tells me that the party does not exist, and won't do anything when I press the button to join. I found this out by using the OnJoinRoomFailed() function. Would anyone know why this could be? I can share my script if necessary

cunning egret
#

So if you use UDP that might be the problem

gritty olive
#

I think I use tcp

#

yes I use a TcpClient

#

Maybee itch.io blocks internet communication?

cunning egret
#

Usually you would be informed about that in some way

#

Does your network tab give you any information about blocking connections or something?

gritty olive
#

Only development Console

spring crane
# gritty olive yes I use a `TcpClient`

That most likely won't work out of the box. Afaik you need to send the packets over JS with WebSockets. You don't need to implement this if you get a browser compatible network transport. Unity WebSocket libraries should handle this for you.

gritty olive
#

ok thx

#

So I just need the right library? Sorry, I don't 100% understand what you mean...

verbal coral
#

hello, i'm working on netcode right now, all the tutorials I found are on host client. I need server client. I am currently using the host client with the third person character in standard asset without any problems. but when I do the same test with the server client, the client cannot move the player even though it sees its own object and player object.
I'm so sorry for my bad english I hope was able to explain my problemFeelsBirthdayMan

#

I can't control the character on client, but I can walk the server-side character, the client just spectating own player character

sick sable
#

Hi there, I'm planning on programming a mobile experience that will have very little and simple gameplay but will need to support 50k live concurrent devices. The game will just synced across the devices and maybe some simple gestures/taps will update some graphics and animations on the screen. Anyone familiar with working with that many concurrent live players? What kind of technical things do I need to think about? Any suggestions for solutions - will Photon (Fusion?) be best or is there something else to consider? Thank you!

wide girder
sick sable
patent fog
sly pawn
#

I made a node.js server that makes a multiplayer game. It works flawlessly and has been tested with 2 windows and 2 Linux PCs, but when I tried with a iMac, it couldn’t connect. I tried hosting the server on it, and replacing ip with localhost, but it had the same problem (timeout). When they put in the url in chrome, it worked. Do Macs have some guard against in safe webpages with web requests in unity, or do unity web request just not work with macs, and if so is there an alternative

knotty horizon
#

Hello everyone, I watched the lessons in this playlist (https://www.youtube.com/playlist?list=PLI9CK8e_e3MeDv8K1vi0FosBV4dKmcOo3 ), I've done everything, everything works. But I noticed that it is useless to disconnect on the server, it says "A user with such a key already exists". I tried to do something about it, but nothing really works, please can someone help... Here is the code:

static class GameManager
    {
        public static Dictionary<int, Player> playerList = new Dictionary<int, Player>();
        public static float playerSpeed = 0.1F;

        public static void JoinGame(int connectionID, Player player)
        {
            NetworkSend.InstantiateNetworkPlayer(connectionID, player);
        }

        public static void CreatePlayer(int connectionID)
        {
            Player player = new Player()
            {
                connectionID = connectionID,
                inGame = true
            };

            playerList.Add(connectionID, player);
            Console.WriteLine("Player '{0}' has been added to the game!", connectionID);
            JoinGame(connectionID, player);
        }
    }


internal static void DisconnectionPlayer(int connectionID)
        {
            for (int i=1; i<GameManager.playerList.Count; i++)
            {
                if (GameManager.playerList[i] != null)
                {
                    if (GameManager.playerList[i].connectionID == connectionID)
                    {
                        GameManager.playerList.Remove(i);
                    }
                }
            }
        }
neon horizon
#

does anyone have any resources on how to connect a database to a unity project and keep it safe, a lot of instruction is weak on security

sly pawn
#

I doubt there is a tutorial for unity, so u might want to look for a tutorial outside of unity

wide girder
#

Also, unless you're worried about hackers or keep the database on the client side, it should be secure enough without any additional manipulations.

charred bough
#

Hi guys, i’m trying to install cloud code package but my package manager doesn’t show it when I search for it can anyone help

knotty horizon
charred bough
floral tusk
#

Hey, I have a simple question. My game has three teams: Team 1, Team 2 and Monsters (computer). I am creating now Units for Team 1 and Team 2 (AI), which will fight between each other (like in Dota or LoL). What is the best way to make teams?

spring crane
olive vessel
#

It's a good way of doing it yes

floral tusk
#

thanks

astral path
#

I'm following this Photon tutorial, they use PUN Classic, does it matter if I use PUN 2 Classic?
Or should it be the same version?

#

I did start using PUN 2 and got these errors

#

Is that because I'm not using the other version?

spring crane
astral path
thorny wasp
#

what is a good way to store multiplayer data, (I am using Photon)

wide girder
#

Define "multiplayer data"

thorny wasp
#

so I want to make a game like rpg

#

I just want to store data such as levels, items, locations etc

dark finch
#

The quick way: Playfab. The expensive way: expensive kits from the asset store. The best way: Create your own react/angular web API.

thorny wasp
#

hmm

#

so there is no simple sollution... well ok

#

Ill look into the last one

austere yacht
# thorny wasp what is a good way to store multiplayer data, (I am using Photon)

The answer is always PlayFab (or similar services) unless you have a dedicated team and the actual need to build a custom backend. If its for an MMO, just stop doing it and make a realistic project. The challenge is not in making it work for 10 players, its making it secure and scale to 100s of players and more. With PlayFab (et al) this scaling is taken care of.

thorny wasp
#

Well it's mmolike

#

Just with friends of 20 ish

austere yacht
#

it either is or isnt an MMO

thorny wasp
#

Ok isn't?

#

I thought mmo was just multiplayer rpg

austere yacht
#

no

thorny wasp
#

Oh

#

Then just multiplayer game

austere yacht
#

--> Massively <-- multiplayer

thorny wasp
#

Which includes storing data sorry

austere yacht
#

mmo often implies persitent world

thorny wasp
#

It's a casual game

austere yacht
#

thats a genre

thorny wasp
#

Yea

#

But I want to save player data and location of building

#

Since they can build stuff

#

Kinda like class of clans type game but rpg

austere yacht
#

you do want to run this on a dedicated server?

thorny wasp
#

Hmm

#

Does it cost money?

austere yacht
#

yes

thorny wasp
#

Maybe not then

#

Just something with photon because I heard it's free

austere yacht
#

then you just store all the persistence stuff on the host computer

#

no need for cloud storage, no point even

thorny wasp
#

Oh ok

austere yacht
#

just save the game state like a normal savegame

#

but save automatically at short intervals

thorny wasp
#

If I do host computer will I need my PC running 24/7

austere yacht
#

yes

thorny wasp
austere yacht
#

that would then be a dedicated server

thorny wasp
#

Could I store data using photon?

austere yacht
#

btw: you personal PC running 24/7 for a game is also -not free-

austere yacht
thorny wasp
austere yacht
#

you would only need "cloud" storage, separate from the server-application's computer, if you have multiple servers

austere yacht
thorny wasp
#

Hmm... Well I'm actually very new to these networking terms sorry

thorny wasp
austere yacht
#

binary does not make it safe

thorny wasp
#

Ah

austere yacht
#

also you don't need safety if its for "friends"

thorny wasp
#

Well online friends

#

So trustworthy I'm not 100% sure

austere yacht
#

its not about stealing money from your bank, its about cheating in the game

#

if you need to prevent cheating, your project will be way more complicated

thorny wasp
#

Ah

#

I see

#

I might do the local file

#

While slowly researching about the more complict method

#

But I think for now the local file will work.

#

So I have a map I guess, and they can spawn houses etc, but when they log off / quit application the building also disappears. How would I be able to keep it, if I'm storing data using local file?

austere yacht
# thorny wasp So I have a map I guess, and they can spawn houses etc, but when they log off / ...

you spawn that stuff on the server, while the server runs it will stay there, if they log back in, it'll still be loaded and available to them (you need to implement that ofc), only if the server shuts down you loose the stuff that was spawned and exists only in memory, which is when you need to save the state of it to persistent storage (a file on disk), so you can load it back when restarting the server.

#

mind you, this is a lot of work, if you aren't experienced in how all these pieces are implemented and how they work together i'd do a few toy projects focusing on the individual elements before working on a full game

thorny wasp
#

But I was wondering where to start

#

And what to learn

austere yacht
#

i'd work on learning the multiplayer sync first

#

persistence later

thorny wasp
#

Yea, I just wanted to make sure it was possible

austere yacht
#

definitely possible

thorny wasp
#

Using photon. Etc

austere yacht
#

photon is not a factor

#

also, photon is a company, not a product

thorny wasp
#

Ah

austere yacht
#

if you say "photon" you could be referring to anything they offer

thorny wasp
#

Oh I see

austere yacht
#

if you mean PUN, idk really why people still use that

thorny wasp
austere yacht
#

it never was good

thorny wasp
#

Is there any alternative free?

austere yacht
#

Netcode for GameObjects, Mirror and Photon Fusion would all be free for your use-case

thorny wasp
austere yacht
#

there is no "their"

#

its all you

thorny wasp
#

Oh

#

So when I add a safe button is won't save on their storage but instead mine?

#

Is that why my PC needs to be oh 24/7?

austere yacht
#

the only thing photon gives you in terms of service is a "relay" server that you can use to route messages through to avoid issues with local networking and discovery of other players

austere yacht
thorny wasp
#

Oh like when I mean their storage i mean the players' storage

austere yacht
#

thats for you to decide in the code you write

thorny wasp
#

Ah ok

#

Handy

austere yacht
#

as i said, if you don't care about cheating, you can just have players store their state locally

thorny wasp
#

Alr

austere yacht
#

really, for a private, casual game with friends, you can just skip most of the things that are complicated about "public" multiplayer games

thorny wasp
#

So correct me if I'm wrong but

  1. My PC needs to be on 24/7
  2. All file will be stored on my PC.
austere yacht
#

that is an option, yes

thorny wasp
#

Ok

#

It's the PC not on 24 7 more complicated/expensive?

austere yacht
#

no

thorny wasp
#

Oh

austere yacht
#

you should aim at restarting your server every 12 hours

#

even if its supposed to run 24/7

#

if you can restart it, that makes it much easier to fix issues caused by long up-time

#

also lets you ignore a lot of problems only caused by long up-times

thorny wasp
#

Ok

austere yacht
#

typical MMOs restart their servers once every day or more often

thorny wasp
#

What do you mean by server

#

As in PUN or my PC

austere yacht
#

no

#

you should maybe figure out what PUN actually is

thorny wasp
#

Yea that may be a good starting point

austere yacht
#

"server" refers to a machine(computer) that runs an .exe of your game that "clients" i.e. other machines aka. your players can connect to.

#

that "connection"-bit is what PUN is for

#

and only that

thorny wasp
#

Oh

#

So how would I restart my "server"

austere yacht
#

alt + f4 and double-click on the .exe

#

or something more elegant you handle with custom code

thorny wasp
#

And I should close my game

#

But would that still much everyone out?

austere yacht
#

technically "terminate all the processes involved in running the game and start them again"

thorny wasp
#

Just my side?

austere yacht
thorny wasp
#

Because even if my game is not running can't other people still be in it?

austere yacht
thorny wasp
#

Why is that the case? My game is the same as everyone else's?

austere yacht
#

because the server handles all the sync/communication

thorny wasp
#

When you mean game you mean the "build and run" things?

austere yacht
#

yes

thorny wasp
#

Yea

austere yacht
#

clients/players are connected to a server, NOT to each other

thorny wasp
#

And if I send that to everyone else

#

They'll have the same copy

austere yacht
#

only the server can send stuff to other clients

#

peer to peer networking, where everyone is connected to everyone else, without a server, does not (really) exist in multiplayer gaming outside extremely advanced middlewares you do not have access to

thorny wasp
#

Sorry I'm not getting it.
So for example player A has the game. And starts it will connect to the game using PUN. Player B also joins.

If player A closes application and restart, wouldn't Player B still be in the game and connected with PUN. Meaning that it can still interact with other people?

austere yacht
#

connected to what?

#

PUN does not connect to anything outside the applications running on your player's PCs

thorny wasp
#

Ok

austere yacht
#

you do not join a "game"

#

this is only an abstract concept

#

a way to talk about it

thorny wasp
#

So to restart server I need to close my game file

#

But how would that effect other players?

austere yacht
#

you need to make sure you actually understand how applications/computers work

#

you don't close a game file

#

you terminate a process ("close a running application")

thorny wasp
#

But since other player has the game couldn't they start it up

#

What's the difference between my game and everyone else's game?

#

How come if my game close it effects other people

austere yacht
#

what exactly do you mean by "game" here?

thorny wasp
#

The build and run system

#

It creates a file

#

Or application should I say

#

Don't I send that application to other people

#

So they can also connect?

austere yacht
#

if your "game" is the master/server and you shut down, in the ordinary case, that would eject all players, but depending on how you implemented everything, it could just make any other player the master/server

thorny wasp
#

Oh

#

How do I make it so I'm the master?

austere yacht
#

depends on your networking library and custom code

thorny wasp
#

I see

#

Ok

#

Thanks so I'll need to search that up

austere yacht
#

just understand this: if you use PUN, you will remain confused and never learn how multiplayer networking is actually supposed to work

thorny wasp
#

What should I use/ learn instead?

austere yacht
#

PUN is easy to get stuff running for a prototype or small scale experience with firends but it is very limited in what it can do

thorny wasp
#

That is hopefully free

austere yacht
#

and most concepts people talk about in regard to multiplayer are not supported by it

thorny wasp
#

Hmm ok