#archived-networking

1 messages · Page 106 of 1

modern drift
#

imma go to bed, cya around

covert plank
#

cya

keen plover
fervent hazel
#

hello

#

i have a qustion

#

how can i set online mode

olive vessel
#

We're gonna need more specifics

#

Online mode of what?

keen plover
river meteor
#

which you have in RPC declaration

#

so it must look like cs PV.RPC("RPC_Die", RpcTarget.All, "message");

sand dirge
#

or given that you set the string inside the method, just remove the parameter

sterile gulch
#

hey, how can i have separate variables for each client using mlapi?

#

or simply having the same variable not being synced to the other clients (being kept local)

olive vessel
#

Well, that's just a regular variable?

#

They'll only sync if they are NetworkVariables

sterile gulch
#

my bad, had to go inactive for a bit.
here's how the variable is declared

public class RaceManagerPlayer : NetworkBehaviour
{
    public static int laps;
    [...]
}

the class needs to be NetworkBehaviour because of the rest of the code ( if(IsLocalPlayer) is used)

#
public class CheckpointManager : MonoBehaviour
{
    public int checkpoint;

    private void OnTriggerEnter(Collider other)
    {
        if (RaceManagerPlayer.laps == -1)
        {
            RaceManagerPlayer.laps = 0;
        }

        if (RaceManagerPlayer.currentCheckpoint == 3 && checkpoint == 0)
        {
            RaceManagerPlayer.laps++;
        }

        if (RaceManagerPlayer.nextCheckpoint == checkpoint)
        {
            RaceManagerPlayer.currentCheckpoint = checkpoint;
            RaceManagerPlayer.nextCheckpoint = (checkpoint + 1) % 4;
        }
    }
}

the only other script that changes the lapsvariable

olive vessel
#

Well, I would definitely not make it static

#

Recipe for disaster

sterile gulch
#

ok

olive vessel
#

That does mean you'll need an actual reference to the Instance of that script

#

But if it's static, all Instances share one value

sterile gulch
#

ok

chrome rock
#

hi all, i was trying to learn MLAPI and have recently downloaded a package for unity project clone. (https://github.com/hwaet/UnityProjectCloner). However, when I tried opening my clone project, nothing comes out. Is there any other alternative way where i can open multiple windows other than using this package?

#

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
#

this was the tutorial i was following, but for some reason the project clone package didnt seem to work

weak plinth
weak plinth
#

hi, can someone help me using mirror? i have already my game working for 1 single player but i would like to add player host/client multiplayer with mirror, and i am a bit lost

modern drift
#

its really hard to convert a game to multiplayer when you started it singleplayer

verbal lodge
#

Yes it's pretty hard some singleplayer patterns don't easily translate to multiplayer.

weak plinth
spare loom
#

I have been assigned the job of developing a LAN networking solution for a VR project for an experience park. We aim to support 64-96 simultaneously clients. The system needs to replicate a great deal of server-side physics over the local network, there will be A LOT of data transfer. A quick reading around online tells me that the default .Net sockets lib is quite slow for this purpose. What would the best solution be to this problem?

weak plinth
short island
#

You need to consider multiplayer from the start even if its mostly singleplayer

#

the serialization of non local host entities and their positions etc isnt something you can add at the end realistically

#

for instance if an enemy is host controlled

#

but needs to have client effects like casting a spell

#

the ability to visibly cast the spell and apply the effect need to be written differently than they would in singleplayer

#

any dual single player / multiplayer game is basically written in a multiplayer way

weak plinth
#

there are no enemies

#

i just built the mechanics of the game

short island
#

ok well you need to consider

#

how you are going to signal

#

to other computers

#

what is going on

#

so you dont run the AI on every computer clearly

#

you run it on the host

#

and then the problems that creates on how you translate that to other pc

weak plinth
#

so, what i understand on multiplayer is

short island
#

so for multiplayer anyone who isnt the host

#

the only thing they do is control their character

#

and display what the host says is true

weak plinth
#

each player, locally, lets say the wanna execute a function. Then they do it locally, the server notice, and shows that on the rest of players

short island
#

yes so you need a distiniction between

#

what is just a visible thing

#

and an actual result

#

on a client a spell is just a particle effect and shit

#

on the host it actually does damage and checks

#

and sends the result to players

#

on healthbars etc

weak plinth
#

so the player doesnt dmg the enemy?

short island
#

so a non host

#

checks the local hitboxes

#

and tells the host

#

that they hit it

#

and the host decides if that is ok and does the health calculations

#

and sends it back

#

you need 1 computer to know all the stats

weak plinth
#

so basically, both local and host check for collisions?

short island
#

yes the local client tells the host when its attacks hit a hit box

#

and the host sends back how much damage that did etc

#

to everyone in the game

#

like updates the actual hitpoints of the thing

#

that way multiple players can hit it

#

and be in sync

weak plinth
#

okey, so, for my case, i have a grid, a tilemap, as my scenario

#

and it has walls (with colliders) and boxes (objects that can be destroyed)

short island
#

anything that isnt dynamic

#

doesnt need to be synced

weak plinth
#

i guess the boxes need an identity

short island
#

so you just load the level

weak plinth
#

right?

short island
weak plinth
#

wdym with moved by ai?

#

boxes wont move

#

but they can be destroyed

short island
#

so if they wont move

#

you dont need extra

weak plinth
#

i do

short island
#

if a local player destroys it

weak plinth
#

a player can destroy a box

short island
#

you send that message back to the host

weak plinth
#

and other players must see it

short island
#

and he sends that to everyone

#

you can cheat and destroy it instantly on the local client that destroyed it

#

to avoid latency

#

and then send the message to the host that box id xxx needs to be destroyed

#

and replay that on everyone

#

i do this for "destructibles"

#

i think thats what you mean

weak plinth
#

i mean, i understand what u are doing. I just dont know how to code it

short island
#

depends on what you are using for networking

weak plinth
#

Mirror (?)

short island
#

local client hitbox breaks something > message to host > dispatch to everyone

weak plinth
#

again, i understand that workflow xD i just dont know how to code it

short island
#

do you have networking setup

#

where everyone is in a session or room

#

then you send messages in that

weak plinth
#

mmm.... once again, i understand what u are saying, i just dont know how to code it

short island
#

do you have a networking solution yet or not

#

like PUN photon or PUN realtime

weak plinth
#

i said mirror

short island
#

can you link it

weak plinth
#

do u recommend another one?

short island
#

how far along are you with this

weak plinth
#

i asked and they said this was easy, but if u are more familiar with another one, and u could help me, i can use another one

weak plinth
short island
#

lol yeah use pun

#

pun photon is the easiest

weak plinth
#

but i wanted player host/client mode

short island
#

and you upgrade to realtime

#

when you want to be advanced

short island
weak plinth
#

fine, i will download it

short island
#

i made this with PUN

#

and this is in realtime

#

RaidEnter story-centric raids by yourself, or with friends. Level up, Collect loot, get rewards, and summon more power after a successful raid.Open WorldDominate the open world in a time where nations are at war, find hidden dungeons and discover quests with epic rewards.Deep BuildsSacrifice your summoned heroes to gift their abilities to other ...

Release Date

Coming Soon to Early Access

▶ Play video
weak plinth
#

a mariokart? fine, i guess it will be similar

short island
#

eh you join rooms

#

and play a game with other ppl right

#

its all the same

weak plinth
#

there u have boxes that a player takes and disapear for the rest of ppl

#

thats a similar mechanic i want

short island
#

yeah u can see

#

in the gameplay video

weak plinth
#

yeah okey, let me get photon

short island
#

it has a lot of tutorials if you get stuck and i am not around

#

etc

weak plinth
#

tyvm

#

the free version is enough?

short island
#

let me check its restrictions

#

from memory its fine until you have more than 20 players

#

at a time

weak plinth
#

i will have 4 max players so

short island
#

yeah its on the network tho

#

so you can have 5 games max

#

at once

#

full of 4 ppl

#

on the free version

weak plinth
#

mmm

#

i wanna make a multiplayer like

olive vessel
#

Remember, to fill 20 CCU you need a tonne of MAU, like, a hell of a lot

weak plinth
#

a group of 4 friends wanna play, and 1 acts as a host

short island
#

when you uprade to pro for 95 usd

#

you will have 100 ccu

short island
#

which is fine for an early acccess game

weak plinth
#

i should not have restriction

short island
#

you can pay for more after that

#

you will see its not a big deal

#

and you wont reach it

weak plinth
#

but, can u read me pls?

short island
#

and if you do the monetisation will cancel out the cost

olive vessel
#

The issue with a player hosting, is the need for port forwarding unless you use a relay service or punchthrough

weak plinth
#

if i am the host, 3 more players can join me

short island
olive vessel
#

Only if you port forward

short island
#

so you can have 5 games going at once

weak plinth
#

but if u are the host, another 3 can join u

#

and so on

short island
#

dont need to port forward for phooton

#

they nat punch through for you

olive vessel
short island
#

they are

#

because i told them to use photon

olive vessel
#

No, you're not reading

short island
#

scroll up

olive vessel
#

They are asking for a player to host

short island
#

o_O

olive vessel
short island
#

yeah on photon mate

olive vessel
#

Really? Because they don't seem keen on Photon

short island
#

he said he was downloading it

#

o_O

olive vessel
short island
#

i mean if i explained the alternative

#

like you were

#

its a no brainer

#

people have a problem for pay for what they use

#

but in reality they dont pass 100 ccu

#

and if they did they are monetizing it

#

while photon offer a global network

olive vessel
#

Except you instantly railroaded them with Photon, rather than describing the differences

short island
#

feel free to provide a better solution

olive vessel
#

Mirror with Steam P2P

short island
#

than something that has wordwide back bone

olive vessel
#

MLAPI with Steam P2P

short island
#

and does that just integrate with unity

olive vessel
#

MLAPI is Unity's new networking solution

#

Mirror is the continuation and improvement of old UNet

short island
#

if its better i am happy for that recommendation

#

link some mirror tutorials

olive vessel
#

They seem to want a player to be able to host for friends

#

Which is what Mirror and MLAPI allow

short island
#

that is all network solutions tbh

#

host and clients

#

lol

weak plinth
#

like, if i am the host, u said i can have max 20 connections

#

but if u are host

#

why would we share max connections?

#

makes no sense

short island
#

no you connect to the master server

weak plinth
#

i am my own server, u are ur server

#

no

short island
#

so you can join games

weak plinth
#

thats not what i said

#

i said player host/client

short island
#

i am telling you how it works

weak plinth
#

and i asked if this could be done and u said u can do anything

short island
#

the master server facilitates rooms

#

players host rooms

weak plinth
#

but i dont want a master server

short island
#

players join rooms

weak plinth
#

i want a player to be both the host and the client

short island
#

so with a master server

#

there is a player that is the host

#

it just all goes through the faster master server

#

to other players

#

you actually hosting on your computer

#

and sending to other PC

#

as a host is a bad idea

#

you just send to the master server and the master server sends to everyone else

weak plinth
#

well, not that bad idea if minecraft works like that

olive vessel
#

Interestingly, Minecraft uses TCP

weak plinth
#

but player is host and client

short island
#

it is superior if the host has good setup and everyone is close to them

#

like LAN

weak plinth
#

i know, but thats not my problem

short island
#

often not the case

#

and also

#

you get

#

firewall problems

#

like welsh said

weak plinth
#

i am just saying how i want the multiplayer of my game to work

olive vessel
#

Unless they use a relay service like Steam or Epic

short island
#

yeah and thats all pun is

short island
#

like i said super friends party uses it

olive vessel
#

In PUN's defence, you won't hit 100 CCU until you get well over 1k downloads, I always forget the numbers for CCU/DAU/MAU

short island
#

basically if you buy pro

#

you wont cap your ccu

#

unless you make it

#

and if you make it

#

it wont matter

#

cos you have $$$

olive vessel
#

I believe I read somewhere, that Phasmophobia uses Photon

short island
#

damn they should have had some quality control on that list

#

😂

#

584,918 developers make Photon the world's #1 independent cross-platform network engine. Developers range from the smallest outfits to global giants.

#

i will let them know heroes raid is pun realtime

#

they have infrastructure you wont have man

#

like 20 countries all over the world

olive vessel
#

At the end of the day, it's whatever you feel most comfortable using, if you want to use Mirror then go for it. They all do the same shit just a bit differently

#

Photon does a bit more for you than Mirror, but if that doesn't matter then 🤷‍♂️

short island
#

does mirror even integrate

weak plinth
short island
#

into unity

short island
short island
#

and if your game makes it you just pay more

weak plinth
short island
#

what a host with clients

olive vessel
short island
#

thats all multiplayer

short island
olive vessel
#

It's a package you download

#

It has a lot of components

short island
#

does it have good tutorials

olive vessel
#

Yes actually, check out Dapper Dino

weak plinth
#

i think mirror will be more useful than photon, since u are telling me photon cant do what i need

short island
#

ok well

#

check out both

#

on youtube

#

and see what you think you would like to use better

olive vessel
#

Dapper Dino even has tutorials about Mirror + Steam if you want to use Steam

short island
#

welsh will give you some mirror tutorials

olive vessel
short island
#

pfft

olive vessel
#

I'm not your search engine, I gave you a name

short island
#

everyone uses pun so its not a fight

olive vessel
#

Sweeping untrue statement

short island
#

can google that for sure

weak plinth
#

not being rude, but do u understand what i want aaron?

#

maybe im not explaining

short island
olive vessel
#

Methinks Aaron does marketing for Photon

short island
#

that is just multiplayer mate

weak plinth
#

yes. So there will be no limits. Each person can be a host

short island
#

yeah

weak plinth
#

can photon do this?

short island
#

yes

#

the limit is the players in the system

#

if u have 20 at once on free they will tell u

weak plinth
#

okey. i think even a pentium 4 can handle 4 players max at once

short island
#

if u pay a little and have more than 100 at once

#

they will tell u

#

and there is no actual limit

#

if you have $$$

weak plinth
#

yeah, if i had $$$ i wont be making the game, others would for me

short island
#

and if you think you are going to have more than 25 games going at once

#

i would question urself

weak plinth
#

again...

#

i dont understand

#

why u are atalking about 25 games at once

short island
#

thats what CCU means

weak plinth
#

there can be 1M ppl hosting a lobby at the same time

short island
#

a multiplayer agent connects

weak plinth
#

and it wont matter

short island
#

he wants to join a game

weak plinth
#

cuz each person is its own host

short island
#

he joins the game

lyric plover
#

Hello everyone! I want to develop a multiplayer game using Mirror, but I don't know where to upload the server side. Is there anywhere free (or low cost) where I can host the server? Or do I have to open a port on my router if I want it free? (is open a port a good or bad idea? Thanks!

short island
#

there are 3 games of 4 players already

weak plinth
#

not a random game

short island
#

all it means is

#

not more than 100 ppl

weak plinth
#

again....

short island
#

be playing multiplayer at once

#

in total

weak plinth
#

@olive vessel pls can u explain aaron what i mean? idk how to explain myself better

short island
#

dude just trust me man

weak plinth
#

i dont see why will there be a limit

short island
#

you arent going to clear that

#

the limit is your wallet

weak plinth
#

...

short island
#

you are using a service

#

that has servers in 30 countries over the world

weak plinth
#

dude, stop writting 1 second pls. just read me, i will try to explain the best i can

short island
#

and everyone uses the nearest

#

for lowest latency

weak plinth
#

I want a multiplayer where ppl connect to 1 specific id, lets say IP, which is unique. There can be 1 million players creating a lobby, since there are 1 million ips on the world. So if my friend wanna join me, i will tell him my ip, and he will connect to my lobby

#

there is no limit

short island
#

you cant connect to a specific ip without an isp level nat punch through

#

which will require a third party server regardless

#

Hole punching (or sometimes punch-through) is a technique in computer networking for establishing a direct connection between two parties in which one or both are behind firewalls or behind routers that use network address translation (NAT). To punch a hole, each client connects to an unrestricted third-party server that temporarily stores exter...

weak plinth
#

yeah, the third party thing is mirror or photon or whatever

#

on minecraft, u need the minecraft server

#

to create a server itself

#

and then ppl join ur ip

short island
#

you either pay

#

for a quality master server

#

or get it for free

weak plinth
#

nvm, thanks for ur time

short island
#

maybe mirror will be free master serveR?

weak plinth
#

i guess u are not even trying to understand me

short island
#

dude i have released twomultiplayer games

#

dont be like that

weak plinth
#

dude, i dont wanna make a multiplayer like u did. It seems for u only exists ur way

#

and no xd

short island
#

do you want to do it like half life and counter strike?

weak plinth
#

i am telling u what i want, and u are telling me other things

#

this is a dead point

short island
#

well no because what you are saying is how super friends party invite works

#

someone hosts sends out invite code

weak plinth
#

no, cuz u are saying i can only have 5 games at max

short island
#

everyone joins

weak plinth
#

and no XD

#

because each person is a server

short island
weak plinth
#

asdjkfnkñasdjf

short island
#

5 games at once

#

on 20 ccu

weak plinth
#

i give up

short island
#

which is fre

#

20 games at once of 5 players on 100 ccu

#

which is 95 usd

#

beyond that you pay per player

#

cents

weak plinth
#

sorry but i wont try to explain u again what i want

short island
#

ok well i hope you figure it out 🙂

weak plinth
#

is ur turn to read me

short island
#

i have thousands of players dude

lyric plover
#

If you guys have finished arguing

short island
#

i dont think u r get it

weak plinth
#

gratz

lyric plover
#

can anyone reply me xD

#

pls

short island
lyric plover
#

Hello everyone! I want to develop a multiplayer game using Mirror, but I don't know where to upload the server side. Is there anywhere free (or low cost) where I can host the server? Or do I have to open a port on my router if I want it free? (is open a port a good or bad idea? Thanks!

lyric plover
short island
#

oh @olive vessel is the mirror expert

#

never touched it myself

lyric plover
#

what do you use?

#

pun?

#

doesn't it work the same way?

#

forget Mirror

#

where do you upload your server side?

short island
#

dont need a server for pun

#

you have a host

lyric plover
#

or: how dangerous is to open a port in my router?

short island
#

one of the people running your unity game is the host

lyric plover
#

yes

#

that is what i mean

short island
#

and you dont need to open a port because it talks to a master server

#

that talks to everyone else

lyric plover
#

i know how it works

short island
#

so u just host

lyric plover
#

but i am asking where you upload you rhost

short island
#

dont need to

#

if you want like a dota style

#

or counter strike style

#

they have solutions for that

#

those two use a dedicated server

#

that handle games

#

rather than one of the players handling the game

lyric plover
#

but this dedicated server is somewhere on the internet

short island
#

for those two yes

lyric plover
#

that is what i ask xD

short island
#

otherwise its just the hosts computer

#

ok well if you really want a dedicated host

lyric plover
#

what do you use for a dedicated server?

short island
#

and this is seriously expensive

lyric plover
#

damn

short island
#

and invite his friends

#

to his computers

#

version of events

#

dedicated servers require actual servers somwhere

lyric plover
#

to private com,puters?

short island
#

yeah

lyric plover
#

how do you do that without opening a port?

short island
#

because with PUN

#

it has a master server

lyric plover
#

free?

short island
#

that facilitates this information transfer

short island
lyric plover
#

ah

#

ok

short island
#

otherwise you need to nat punch through

#

you can host your own server online

#

and do that if you want

#

but that is too complicated for chat

lyric plover
#

i understand

#

thanks!

short island
#

👌

lyric plover
#

do you know about port forwarding?

short island
#

yeah but you cant expect any player to do that for you

#

they just want it to work

lyric plover
#

i would do that, not the players

short island
#

need to host like an azure .net core app that facilitates it

weak plinth
#

u cant open the ports for other players

short island
#

oh if you have a dynamic dns that points to your local home

#

and want to do the nat punch through for them

#

you can

lyric plover
short island
#

like i said its just super beyond basic networking for unity

#

has nothing to do with unity actually

weak plinth
#

but others needs to open them too

short island
#

if you want to host it needs to be open or discovered

lyric plover
short island
#

can be discovered through a nat punch through server

#

that u can host yourself

lyric plover
short island
#

nah what you do is you make players host their own game on their computer and invite their friends mate

lyric plover
#

but that is with pun

short island
#

and you can up that to 100

#

with a simple pay

#

and then make it infinite

#

its not game based

lyric plover
short island
#

yeah

#

its nothing to do with games or anthing

lyric plover
#

yes yes

#

i know

short island
#

👍

lyric plover
#

i want to make a multiplayer game and i just dont know how

#

but i know how to use unity with mirror

#

even can learn pun if needed

#

thanks!

short island
#

cool

#

yeah the free version is enough probably even for early access

#

you just arent going to hit the limits

olive vessel
short island
#

Yeah that’s good

#

Use what you like the most

neon wedge
#

how do i install the NetworkManager from unity's uNet, i can't seem to find it and i can't add it as a component either.

olive vessel
#

Don't use UNet, it is deprecated

#

Mirror is a continuation and improvement of UNet (By the communty). MLAPI is Unity's new solution

neon wedge
#

well im not all too good with unity and im just trying to learn and start by watching brackeys tut for unet

olive vessel
#

Don't start by watching videos for an old, deprecated system. That's shooting yourself in the foot

neon wedge
#

well is there tutorials for this mirror you speak of

olive vessel
#

Hundreds

neon wedge
#

im down for whatever aslong as i can have someone teach me, and who do you recommend

#

link me if you like

olive vessel
#

Dapper Dino has some good tutorials for Mirror

neon wedge
#

im starting a completely fresh porject to learn the fundamentals

olive vessel
#

That's 23 Mirror tutorials by him

neon wedge
#

this will work for 3d games too yea?

#

im seeing ping pong 2d atm lmao

olive vessel
#

That has nowt to do with it

#

Mirror is the solution you use for moving data around etc, nothing to do with visuals really

#

2D or 3D is your choice

neon wedge
#

ok, i thought i needed to like do coding for all kinds of stuff as i add it, am i right or wrong?

olive vessel
#

There will be a lot of new programming involved

#

Don't think multiplayer is easy

neon wedge
#

great something i suck at 😄

#

oh trust me i dont

olive vessel
#

Getting two builds connected and having working movement isn't that hard, because Mirror has a component called NetworkTransform

neon wedge
#

ive spent alot of time trying to learn how to code myself, many years, and i still suck, but im self tought i just copied and pasted and changed stuff until i figured things out, it doesnt help im always trying different languages either

#

unity is now just c# right? years ago i used to use JS

olive vessel
#

Yeah only C# now

neon wedge
#

alright

#

well thanks alot for all the help my friend, i wish you the best on your projects

olive vessel
#

I'm just banging my head against the desk rn, also doing networking

weak plinth
#

@olive vessel have u ever made a multiplayer game with mirror?

olive vessel
#

I've dabbled with Mirror yes

weak plinth
#

so, could u guide me through multiplayering a game?

olive vessel
#

I really don't have time to be a tutor

weak plinth
#

im a bit lost and the only tutos i found on youtube is about a card game

#

uh

#

mmm f then

olive vessel
#

I just linked 23 Mirror tutorials, not related to card games at all

neon wedge
#

@olive vessel ah the glory of coding am i right?

olive vessel
#

Such fun, all the pain is self-inflicted

olive vessel
#

Scroll up

weak plinth
#

ah thanks

neon wedge
#

But the satisfaction when you fix it is impeccable

neon wedge
#

@olive vesselso do i just add the networkTransform to a player prefab and it works?

olive vessel
#

That will allow the movement to be synced, but it does not allow movement, you must script that

neon wedge
#

so for me to see it client to client id have to script it

#

also what is this hes using at 0:50

#

idk what this control thing is and none of his previous tutorials had anything to do with movement

olive vessel
#

Well no, it's a Mirror tutorial not a movement one

#

You can script movement however you'd like

neon wedge
#

he didnt explain how he networked it at all though :/

olive vessel
#

Using the NetworkTransform

neon wedge
#

atleast for me he didnt

#

ok so i have to script the movement myself but the networktransform makes it go through the network

olive vessel
#

Hang fire I'm watching it and he literally goes through the movement code

neon wedge
#

i already have a player controller though

#

do i just need to add the networktransform script?

olive vessel
#

Ok so you use that, and add a NetworkTransform and NetworkIdentity to the player prefab

neon wedge
#

and im done?

olive vessel
#

Kinda

#

Give that lot a go first

neon wedge
#

ok

olive vessel
#

You might notice some wacky results, that's fine we will sort it

weak plinth
#

@olive vesselif my game is a bomberman-like game, and i wanna add multiplayer, but i have all mechanics already coded, should i start a new proyect using Mirror from the beggining or should i modify my current code?

olive vessel
#

I would definitely do it in another project, so that if you mess up badly you have the original singleplayer game

weak plinth
#

okey

olive vessel
#

Then you can just copy bits you need over to the multiplayer project

weak plinth
#

yeah, i was thinking the same

#

thanks

#

and this way i can go step by step

#

first syncing 2 players, then restricting them to the tilemap, etc

#

😄

olive vessel
#

Yeah exactly, spawning any entities like bullets or in your case I assume bombs, is a little different for a networked game

weak plinth
#

okey

neon wedge
#

yea it wonked out on me alright, all my scripts just screwed themselves and everything turned pink

#

all i did was hit the play button 😂

olive vessel
#

Well did you setup the NetworkManager correctly?

neon wedge
#

idk what happened tbh, i restarted unity with the same project and it fixed itself

#

failed to connect on 2nd client

olive vessel
#

Could be many reasons

#

Did you start hosting on the first, did you connect to the right address?

neon wedge
#

can i show you what im doing?

#

like stream it

#

you dont have to talk

olive vessel
#

Unfortunately not, but it's not hard to show via screenshots

#

Client one should start hosting (being a client and the server) then Client two should start as a client, with the connection address set to "localhost" if they're on the same PC

neon wedge
#

im very familiar with how servers work

olive vessel
#

So did you follow those steps?

neon wedge
#

indeed

#

give me a second im doing what console says atm

#

yea its just failing to connect for some reason

olive vessel
#

Any console output?

neon wedge
#

their both the same

#

all it gives me

olive vessel
#

So presumably, you have a build and the Editor, and are trying to get them connected?

neon wedge
#

indeed

#

on my localhost/127.0.0.1

weak plinth
#

maybe try with parrel sync

#

should be the same but idk

#

or make a new build

neon wedge
#

it is the same

weak plinth
#

sometimes unity fucks

olive vessel
#

You set the address in the Transport?

neon wedge
#

ive rebuilt it multiple times

#

i worked out a few kinks but im stuck here

olive vessel
#

Oh you must set it on the NetworkManager then

neon wedge
#

localhost works

#

ive tried 127.0.0.1 aswell

olive vessel
#

It works?

#

So what doesn't work?

neon wedge
#

nope

#

fails too

#

it just times out

#

cant connect to lan

#

im also using an original prefab for the player that it spawns in when i start the server

#

so its not blocking me

#

yes i know the spawn points are empty but it works with this

olive vessel
#

Is there a firewall issue?

neon wedge
olive vessel
#

Yeah that's fine

neon wedge
#

the firewall thing would be odd

#

🙂

olive vessel
#

Oh you just disable them all completely

neon wedge
#

same with antivirus

olive vessel
#

Safety first, I guess?

neon wedge
#

i dont use antivirus or firewall

olive vessel
#

😬

neon wedge
#

dont ask

olive vessel
#

I guess you could try adding in the Offline and Online scenes

neon wedge
#

its for a reason though

#

eh why would that stop me from connecting though

olive vessel
#

Or you could just not try it

#

It was a mere suggestion

neon wedge
#

i watched the tutorial and he said i dont need those

#

of the guy you sent me

olive vessel
#

¯_(ツ)_/¯

#

Try a different Transport

#

Like Telepathy

neon wedge
#

now its spamming me with this

#

idk why

#

now it works but im controlling 2 characters with the one client

#

other one is buggy and barely does anything

olive vessel
#

Yes good

#

So client X has two players in the scene, they both have the movement script therefore they both take his input.

#

This is where in your movement script, you need to do checks to see if this is the local player, before allowing input

neon wedge
#

great, i dont know how to do that lmao

#

anyways thanks youve helped me enough i guess ill just keep trying

#

i dont wanna annoy you all day XD

olive vessel
#

Dw about it

#

My day is already, well off track compared to my plans

neon wedge
#

im just exhausted

neon wedge
#

ok i got the movement part fixed, now its just the camera

#

but idk how to do this one

weak plinth
#

Hey guys im new to networking, so can someone please suggest a networking solution for a fps game where people would create their own lobbies

neon wedge
#

use mirror @weak plinth

weak plinth
neon wedge
#

this may help

weak plinth
#

tysm

neon wedge
#

this is my code for my player controller script

#

@weak plinth my bad that was for my issue with my script XD

weak plinth
#

no problem im not new to unity anyways so i just write my own movement script

neon wedge
#

do you see mouse movement in there anywhere

#

thats what im looking for

#

im kinda new but i cant find shit there

#

only for like actual movement not aiming

#

@weak plinth

weak plinth
#

i will try to find now

#
if (cameraCanMove)
        {
            yaw = transform.localEulerAngles.y + Input.GetAxis("Mouse X") * mouseSensitivity;
 
            if (!invertCamera)
            {
                pitch -= mouseSensitivity * Input.GetAxis("Mouse Y");
            }
            else
            {
                // Inverted Y
                pitch += mouseSensitivity * Input.GetAxis("Mouse Y");
            }
 
            // Clamp pitch between lookAngle
            pitch = Mathf.Clamp(pitch, -maxLookAngle, maxLookAngle);
 
            transform.localEulerAngles = new Vector3(0, yaw, 0);
            playerCamera.transform.localEulerAngles = new Vector3(pitch, 0, 0);
        }
#

this should be it

#

wait

#

did u want for the mouse movement for the camera or u controll ur player with mouse

neon wedge
#

for aiming

#

fps

weak plinth
#

with mouse

neon wedge
#

thanks

weak plinth
#

no problem

neon wedge
#

thats all i need i think

#

although

#

im a bit thrown off

#

does it not check for this before doing the functions

#

or do i need to add it to the if cameracanmove statement

weak plinth
#

yeah it checks it

neon wedge
#

like
if (cameraCanMove && !isLocalPlayer)

weak plinth
#

u can try doing this : put all the code in one if statement which is if(isLocalPlayer)
{
code
}

neon wedge
#

idk what you mean

#

oh nvm

#

i see

weak plinth
#

put all the code from the update function inside that if(isLocalPlayer)

neon wedge
#

like this you mean

weak plinth
#

yeah but all the code from the update function and remove the ! from isLocalPlayer and remove the return part

#

and do that in the fixed update function too

neon wedge
#

so the if before the void update then?

#

i didnt know thats a thing 😂

weak plinth
#

no

#

in the void

neon wedge
#

bruh imma just dm you

weak plinth
#

k

lyric plover
#

Where I can host a multiplayer game using Mirror? Is there any low-cost dedicated server? Or somewhere free/cheap for a few people? The other option is to do port-forwarding a port on my router and use my PC as a host, but idk if it is a good option. Opinions? Thanks!

full mango
#

Gamelift, Playfab are some options I guess

covert plank
#

can a server run multiple scenes at once or do i need multiple instances?
Using mirror if that matters

covert plank
olive vessel
#

People connect to one server, and then when put into a match you give each "room" a GUID

#

AFAIK they can all be in the same scene, but can only see those with the matching GUID

covert plank
#

I have the network discovery on one scene which is the main menu, but my issue is when the server starts it goes to the online scene which is the game scene, so people using the network discovery as client dont see the server anymore

#

im super new to this so im probably doing something wrong

olive vessel
#

Ahh yeah

kind coyote
#

is possible to use mirror and 2020 lts or only 2019 and 2018 lts work

olive vessel
#

I'm sure it will work on 2020

kind coyote
#

thx

lyric osprey
#

Currently using a small script I have to load prefabs and store them in a cache

#

so they dont have to constantly be retrieved

#

but im trying to figure out a method of networking to the client that it needs to be registered

#

because ClientScene.RegisterPrefab can only be called inside of a non-static method

#

Meaning that the script has to exist on an object somewhere

fast spoke
#

wanted to ask you guys, what's the point of releasing MLAPI if it's based on UNet network transport?
UNet is deprecated, Unity is slowly switching to ECS, and now they're releasing a mature networking system which relies both in old tech in game object handling and on network handling

sand dirge
fast spoke
#

ohh

#

that's interesting

hexed sorrel
#

Anyone know how to fix missing hostpolicy.dll? Dotnet 2.1.5

verbal lodge
neon wedge
#

does anyone know why my character isnt taking damage server sided just client sided?

olive vessel
#

Because realistically, the health needs to be some sort of networked variable

#

The damage should be a command, which you invoke on the server

neon wedge
#

im confused

#

any tuts on that?

olive vessel
#

I imagine there would be yes

neon wedge
#

i feel like it would be easier to do it with game objects and colliders but i dont think thats good for performance is it

olive vessel
#

GameObjects and Colliders won't magically sync your fields

whole swift
# neon wedge any tuts on that?

https://www.youtube.com/watch?v=JZUsvYvWNl8 might help you a bit to the right direction. It's not for Mirror, it's for MLAPI but I believe the general principle is the same.

In this video we'll be using NetworkVariables to synchronize the player health across the network.
NetworkVariables are pretty powerful and help abstract a lot of the work needed to make a multiplayer game work. The default behavior is that the server (eg. inside a ServerRPC) makes changes to the variable and they are propagated down to all con...

▶ Play video
olive vessel
#

SRCoder is a good one, the principles are the same but the syntax can be quite different

neon wedge
#

the only thing from this tutorial i see i did differently is this
NetworkVariableInt health = new NetworkVariableInt(100);

#

which isnt working for Mirror

whole swift
#

Mirror has something like SyncVars

olive vessel
#

Mirror uses [SyncVar] attributes on regular fields

neon wedge
#

ok

#

thanks

olive vessel
#

You know, Mirror's docs are very good

neon wedge
#

im new to mirror, kinda familiar with unity, and very begginner at scripting (alot of time, just never actually learned what stuff is called or what it actually does, kinda just guess and try stuff)

#

all i need is a hint to what im looking for

#

im sorry if im a bother

olive vessel
#

To be more specific

neon wedge
#

plus i havent coded in 2 years so itdoesnt really help, i feel like ive forgotten everything

#

nah i dont that i was just explaining

#

i understood when you said syncvars

whole swift
#

You also want to familiarize yourself with the RPC's...

neon wedge
#

ok will check into that aswell

#

thanks

inland sand
#

What's the difference between command and RPC?

neon wedge
#

does Command command the server to do stuff from the client?

whole swift
#

Yes, commands are sent from client to server.

neon wedge
#

dope, cause i was wondering why it was all working right on the server and not the client, XD

#

thanks for all this help guys ❤️

inland sand
#

Networking is hard

weak plinth
#

Send command attempted while NetworkClient is not ready.

#

do u know what is this?

whole swift
#

I'm not familiar with Mirror but the documentation hints that this has to do with the scene loading and client states. Server should mark the clients not ready with NetworkServer.SetAllClientsNotReady() before loading the new scene and after loading the clients can be set ready with either ClientScene.Ready() or by server using NetworkServer.SetClientReady().

weak plinth
#

nvm, me being idiot once again

olive vessel
#

Someone asked me the same question in another Discord

#

Like, 4 minutes ago

whole swift
#

😄

weak plinth
#

i was trying to move with rigidbody and rigidbody was null

#

easy

olive vessel
#

Pesky null references

weak plinth
#

things happen

#

how would u set the collider of the object so it doesnt get stucked?

#

like, a capsule collider?

fair mango
#

In MLAPI, is there a way to get around having your players set up port forwarding if they wanna be the server/host?

#

Is there maybe, some widely used open port that I could utilize, to avoid that?

verbal lodge
#

You either have to use a relay based transport or NAT punching.

fair mango
#

Thank you!

weak plinth
verbal lodge
#

It allows one client to connect to another via IP without having the host to open ports on their router.

weak plinth
#

aaaah

#

thanks

whole swift
#

How do we exactly use these?

#

I have quite a big network variable which should be sent once after the scene has loaded. I would need to send it reliably and fragmented. How can I tell in a script that a network variable should be sent fragmented?

sand dirge
#

a networkvariable constructor takes a networksettings object, where you can set the networkchannel, (i assume) you just use the id you see in the inspector there

whole swift
#

I assumed something similar myself, but the SendNetworkChannel settings is of type NetworkChannel - as in one of the

    {
        Internal,
        TimeSync,
        ReliableRpc,
        UnreliableRpc,
        SyncChannel,
        DefaultMessage,
        PositionUpdate,
        AnimationUpdate,
        NavAgentState,
        NavAgentCorrection,
        ChannelUnused, // <<-- must be present, and must be last
    };```
#

So I wonder if I have to use NetworkWriter/NetworkReader instead of NetworkVariables to achieve this?

sand dirge
#

its all assumptions whether its works that way but nothing stops you from casting an int to the enum

#

i would have assumed custom channels to start at 11 with 11 entries in the enum but hey 😄

whole swift
#

Thanks!

weak plinth
#

hi guys, can someone explain me what are commands, rpcs and how to use them?

#

with mirror

weak plinth
#

so, a client send commands

#

and server sends rpcs to the clients?

#

so, can u tell me if this is the way?

#
    private void FixedUpdate()
    {
        if (!hasAuthority) return;
        CmdMove();
    }

    [Command]
    void CmdMove()
    {
        RpcMove();
    }

    [Server]
    void RpcMove()
    {
        _move();
        rb2d.MovePosition(rb2d.position + move_v);
    }

    void _move()
    {
        speed_x = Input.GetAxisRaw("Horizontal");
        speed_y = Input.GetAxisRaw("Vertical");
        move_v = new Vector2(speed_x, speed_y).normalized * speed * Time.fixedDeltaTime;
    }```
#

idk, i saw it on a example about moving, but a bit confused

spring crane
#

Probably wanna send the input instead of polling the input on the server

weak plinth
#

If i wanna give my player movement an animation, using mirror i need to give a normal animator component and network animator?

neon wedge
weak plinth
#

yeah, i gave it, ty

neon wedge
weak plinth
#

yeah, but there is a bit of delay

#

like... idk, i cant measure, but lets see < 500 ms

neon wedge
#

well thats how i did it, i can link you the tutorial i followed

weak plinth
#

sure

weak plinth
#

watching right now

#

well, that guy has less lagg than me

#

should i change someone on the network manager or transport or something?

neon wedge
#

i couldnt tell you as im very new to all this stuff myself

weak plinth
#

okey, thanks anyway

#

i did the same as on the video xD

neon wedge
#

it works fine for me, i dont know exactly what the issue could be

#

whats your tick rate set to on networkmanager

weak plinth
#

on the netwrok animator?

neon wedge
#

no

#

networkmanager

weak plinth
#

30

neon wedge
#

try changing it to 64

#

and then try it

weak plinth
#

trying, one sec

neon wedge
#

if that doesnt help thats the best i have for ya

weak plinth
#

nothing, same delay

#

okey, thanks anyway 😄

neon wedge
#

this is my network animator

weak plinth
#

yeah i mean, the animator hasnt much to change

#

i have same values there

neon wedge
#

ok, maybe someone else may be able to help

weak plinth
#

okey i reduced send interval

#

from the transform

#

and much better

#

from 0.05 to 0.01

#

fixed 🙂

neon wedge
#

awesome 😄

digital falcon
#

Hey hey, very quick question

#

was figuring out a text chat from a tutorial

#

im getting this issue

#

i'm using Mirror and it's up to date

#

what do i do?

olive vessel
#

Action is from System, not Mirror

digital falcon
#

oh.

olive vessel
#

So, are you missing a using directive?

digital falcon
#

thank you

digital falcon
#

thanks a lot.

weak plinth
#

hey guys is there a networking solution that i can use to make the players host their own servers/rooms (for around 10 people)

weak plinth
#

hi. I was trying to override the spawn method from Mirror, but i dont know how. All i want is to pass to the player a reference of a tilemap the Network manager can have

olive vessel
#

How about you do the simple solution I posted hours ago, and just find by tag in the player?

weak plinth
#

i can Find it if there are no other ways, but since the tilemap is gonna be there, i think it is unnecesary to find the map 4 times (1 per player)

olive vessel
#

You say that, but it's one Find

#

It's also FindByTag, so not as bad

weak plinth
#

mmm? if the find goes on the player prefab, everyplayer will look for it

#

i know there is also the find by tag, but i wanna know other ways, tbh

olive vessel
#

The non local player does not need to know about it

#

Similar to how you disable movement scripts on non local players

weak plinth
#

ye, i know, but still, i wanna learn other ways

olive vessel
#

Back to Google for you then

#

We've given you FindByTag, Custom Spawning, central GameManager

#

At some point you'll have to not be stubborn and pick one

weak plinth
#

yes, and i am picking one. if u dont wanna help dont, but stop flooding, my question gets lost

#

wow, what an asshole, grow up

weak plinth
#

and what a coward removing the emoji so mods cant see u reacted with it xd

olive vessel
#

Who's the one flooding their question out?

weak plinth
#

again, grow up. Blocked

jolly wadi
whole swift
#

It's not about being an asshole, it's just about trying to get people learn instead of giving the solutions right away. You do know that coding services do cost, right?

jolly wadi
#

No I’m just joking 🙃

whole swift
#

I know, I didn't mean it for you 🙂

jolly wadi
#

Oh ok never mind then😣

whole swift
jaunty burrow
#

where should i start if i want my physics game to work online

strange vessel
#

Dumb question, but having trouble finding answers online: if I wanted to build a dedicated server for my MLAPI enabled project and wanted to Lee the code in its own project, what would be the right/best way to set up the project? Another Unity project with a headless server build? Or could I host the MLAPI server code in say a .Net console app?

verbal lodge
#

You just create a dedicated server build of your project by ticking the server build box in the build settings.

strange vessel
#

Yeah, that’s what I’m currently doing. I’m wondering if there were any best practices for code splitting/multiple projects for client and server more specifically

patent fog
#

You can split but it can become a nightmare to maintain.

#

Another way is to use pre-processor directives to include code only for one build

strange vessel
#

Got it, I’ll mull that all over. Thanks!

weak plinth
#

hey guys is there a networking solution that i can use to make the players host their own servers/rooms (for around 10 people)

verbal lodge
#

Most Unity networking solutions allow for that.

weak plinth
#

thanks

weak plinth
#

Is there any way to open multiple game viewports in play mode like you would in Unreal?

#

That's honestly the #1 barrier for me right now, making rapid iteration practically impossible.

verbal lodge
shadow bridge
#

I'm using mirror and I'm want to create a lobby system that shows all lobbies available to join. (By showing the IP address, or a set name, it doesn't really matter) using Mirror. Can someone point me in the right direction by showing some code, or showing me documentation that addresses this (I can't find anything online)

patent fog
shadow bridge
olive vessel
#

Well that's just having a list of Lobbies, the Steam transport of Mirror can take care of all that for you

jolly wadi
#

Hey guys I am messing around with friend request and party invites with photon and playfab but this comment is directed to photon. When I try to send a private message to someone with the party invite it says that the recipient is a null reference exception. If you want to see my code I will send to you on your request. Thanks in advance.

weak plinth
#

i want to setup an online multiplayer over my aws website

#

how would i go about that

obsidian remnant
#

can anyone help me with this photon issue im getting?

#

this is the error im getting

#

and this is line 50

grand widget
obsidian remnant
#

i fixed the issue

#

i was being stupid

grand widget
#

oh ok

obsidian remnant
#

and didnt assign GameId

thorn musk
#

hey , I've started using mirror , and had some trouble syncing UI across players
basically ive created a Deathscreen (IMG) which activates the object , it will activate on the host but not on client

obsidian remnant
#

guys whenever i join a lobby it says "no camera's rendering" even tho i have a camera component attached to the player

spring crane
obsidian remnant
#

yes

#

there was

#

im replacing it now

#

with a static camera

#

this is my player instantiation script in case its necessary

spring crane
#

How did you confirm that the camera was there?

obsidian remnant
#

how do i do it?

#

this is my first time working with multiplayer

spring crane
#

Don't say that there was a camera if you don't have a way to validate it 😄

#

Seeing a enabled camera in the editor works

obsidian remnant
#

how do i do that?

#

how can i validate my camera??

spring crane
#

In hierarchy/inspector

obsidian remnant
#

what do i do in the inspector?

spring crane
#

Multiplayer game development is going to be rough if you don't know how to debug these things 😄

#

See if the enabled checkmark is true and that the gameobject isn't greyed out (inactive due to it or one of its parents being inactive)

#

On a scene object

obsidian remnant
spring crane
#

Basically yes, but there are multiple factors to that

#

Component is not enabled if the gameobject isn't active

#

gameobject isn't enabled if the parent gameobject isn't active

split zenith
#

hey everyone , I can't seem to get how interest groups work in photon, can someone help me

#

I know that with PhotonNetwork.SetInterestGroup() you can set which interest group you wanna receive info from

#

but I don't understand what photonView.group does and what SetSendingEnabled() does

#

I've been trying to search examples online but I haven't found any

#

and the documentation isn't really clear either

cobalt python
#

Hi guys! qestion about pun. Can you help me with some sync. I store player's nickname in NPC's dictionary<Quest.QuestType, string> where string is player's nickname. So i want other players to see that a specific quest was taken. Here how i do this localy:

 void Update()
    {     
        if (Input.GetKeyDown(KeyCode.E))
        {
            photonView.RPC("ChooseQuest", RpcTarget.All, Quest.QuestType.KillSkeletons);
        }
    }
  
    [PunRPC]
    public void ChooseQuest(Quest.QuestType questType)
    {
        if (questDict.ContainsKey(questType))
        {
            if (questDict[questType] == null)
                questDict[questType] = PhotonNetwork.LocalPlayer.NickName;          
            
            Quest quest = new Quest { questType = questType };

            StringBuilder builder = new StringBuilder();
            builder.Append(quest.GetQuestName()).AppendLine();
            builder.Append(quest.GetQuestInfo().text).AppendLine();
            builder.Append("<color=#3FA400>").Append(questDict[questType]).Append("</color>").AppendLine();

            questTemplate.GetComponent<TextMeshProUGUI>().text = builder.ToString();
        }
    }
#

so i have quest info with my nick. But when other player press E, he sees his own nick, as it is not sync

jolly wadi
#

Do you guys know how to use playfab cloud scripts to make two way friend requests?

lyric osprey
#

What's an easy way of separating [Client] void Start {} from [Server] void Start {}

#

So I can have them both do different things on the start function

keen mirage
#

Can Get request have a body in Unity?

ornate zinc
keen mirage
ornate zinc
#

what are you planning on doing with a body on get?

weak plinth
#

how do i make my players spawn items using mirror?

#

what should go on server command, what on rpc, etc?¿

woeful badge
#

Quick question.
What networking platform would you recommend for a RTS game? (Star Craft, Age of Empires, etc.)
I've used Photon PUN 2 and Bolt, but not sure if either of these are suitable for a RTS.

Looking forward to your perspectives.

gleaming prawn
#

Disclaimer: I work for Photon, and I am one of the core developers of Quantum and Fusion.
Photon Quantum is the only mature solution that is built with the technique that is used by basically every RTS, which is determinism.
Alternatively, you can look for open source lockstep solutions around. There are a few basic ones that you can take a look at (but they don't come with navigation, physics like quantum, you'd have to build your own)...
In any case, be aware that for an RTS game, because you need determinism, and NOTHING in unity is deterministic, you will write the game logic totally decoupled from it, and Unity will be "just" a view

azure yarrow
#

hi

gleaming prawn
#

As for quantum @woeful badge we even have a complete RTS sample you can start from (with dynamic flow field group path finding, etc)

woeful badge
#

@gleaming prawn
Thank you very much for the useful information.
I will definitely be looking into Quantum this afternoon.

woeful badge
#

@gleaming prawn
Quantum looks amazing.
It's unfortunately very steep for a an indie startup like myself 😅
I will have a look at other "lockstep" solutions first and see what I can do there.

gleaming prawn
#

yes, of course. Notice we're preparing more affordable ways to use quantum.

#

Hopefully there will be even a free tier at some point, like the other products.

woeful badge
#

@gleaming prawn
That would be amazing if possible 😄

cerulean crescent
#

Not sure if I'm thinking about this the wrong way or not, but I'll attempt to explain my situation (Unity multiplayer MLAPI).

So, I'm using the NetworkTransform component for the players in my game to synchronize translation across all the client.
This makes me assume that there should be a way for the local client to be aware where the other clients are located (I want the bounds for hitboxes).

All I want to do on the local client is fire bullets, and have the bullets removed + generate a "hit" effect
Whilst on the server I will do the same but actually register the removal of health of the client that was hit.

However, I can't seem to find the option to gain access to the other clients.
I've tried the NetworkManager.Singleton.ConnectedClientsList but that only seems to work for the server, which seems fine since the data about the clients and everything should be managed by the server.

But I feel like there should be a way for me to get some form of information regarding the other clients? I mean they're all spawned and moved around by the NetworkTransform afterall, so any form of tips would be great.

Am I thinking about this wrong? Should I not be acting out the shooting and hit registration at all on the clientside? I feel like if I don't, it would cause the bullets to appear slightly after whenever the server receives the RPC.

To clarify: I Instantiate bullets on both the server and the clients. The bullets moving on the client is purely for visual and fills no other purpose than feeling responsive for the user playing, whilst the instantiated bullets on the server are actually filling the purpose of decreasing enemy health if hit etc

Thanks!

sand dirge
cerulean crescent
# sand dirge there is `NetworkSpawnManager.GetPlayerNetworkObject(clientId)` while that is no...

I'll try it. I feel like there isn't enough documentation about the various parts of the newer MLAPI documentation, or am I looking in the wrong place Hmm
https://docs-multiplayer.unity3d.com/docs/getting-started/about-mlapi

verbal lodge
cerulean crescent
verbal lodge
#

About your message above

  • NetworkManager.Singleton.ConnectedClientsList is only progagated on the server
  • You can only spawn a NetworkObject on the server. You don't need to instantiate something on the client MLAPI will automatically do that when you spawn the object on the server.
#

If you want to have separate bullets on the client/server you could do that but then they wouldn't be networkobject with a NetworkTransform.

cerulean crescent
# verbal lodge If you want to have separate bullets on the client/server you could do that but ...

Yeah that's the thing. I feel like it would be unnecessary to synchronize every translation of every bullet in my game, as I feel it'd be enough with a destination coordinate and let the client do the translation locally, as I assume that would save a great amount of resources? Or do you think it wouldn't be an issue. I'm new to the whole networking part of Unity, so I'm still testing the waters

verbal lodge
#

You are fully right there's really no need to synchronize bullet translations like that.

cerulean crescent
verbal lodge
#

Yes the other player objects should be present as GameObject. If you add a collider/rigidbody to them your bullets should be able to collide with them etc.

jolly lagoon
#

following all the steps and It wont let me add the player prefab 😦

#

Omg just had to stretch the window XD

odd kite
#

hi

odd kite
#

Hi how can I make it display for everyone in unity?

#

Now as same variable it only show on console

#

I use script to check if killname from killfeed == client name mean he kill someone

#

so if that true will add some kill

#

like this

#

and keep variable in playermanager so if they die they still can get old killcount

#

after all it work on console

#

but it cannot display on ui

odd kite
#

but death variable work

jolly wadi
# odd kite

Why in the console does the kill count go to 1 then back to 0?

boreal scarab
#

Not sure if I read this correctly, but is it true that MLAPI doesn´t track objects that aren´t created using prefabs?

verbal lodge
#

You mean just objects in the scene? MLAPI does "track" them as long as they have a NetworkObject component on them.

boreal scarab
verbal lodge
#

The second sentence in that tip is incorrect.

boreal scarab