#archived-networking
1 messages · Page 106 of 1
cya
someone help
PV.RPC("RPC_Die", RpcTarget.All);``` you are not passing parameter ```msg``` here
which you have in RPC declaration
so it must look like cs PV.RPC("RPC_Die", RpcTarget.All, "message");
or given that you set the string inside the method, just remove the parameter
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)
Well, that's just a regular variable?
They'll only sync if they are NetworkVariables
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
ok
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
ok
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...
this was the tutorial i was following, but for some reason the project clone package didnt seem to work
Some resources to share:
https://github.com/DennisCorvers/NanoUNet
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
its really hard to convert a game to multiplayer when you started it singleplayer
Yes it's pretty hard some singleplayer patterns don't easily translate to multiplayer.
More resources:
https://github.com/DennisCorvers/UnityNet
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?
@verbal lodge well i dont care that much, game is easy, mechanics are already wroten so i can just rewrite them, but i will need some help
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
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
so, what i understand on multiplayer is
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
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
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
so the player doesnt dmg the enemy?
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
so basically, both local and host check for collisions?
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
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)
i guess the boxes need an identity
so you just load the level
right?
only the ones that are moved by AI
i do
if a local player destroys it
a player can destroy a box
you send that message back to the host
and other players must see it
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
i mean, i understand what u are doing. I just dont know how to code it
depends on what you are using for networking
Mirror (?)
local client hitbox breaks something > message to host > dispatch to everyone
again, i understand that workflow xD i just dont know how to code it
do you have networking setup
where everyone is in a session or room
then you send messages in that
mmm.... once again, i understand what u are saying, i just dont know how to code it
i said mirror
can you link it
how far along are you with this
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
like 0
but i wanted player host/client mode
it does everything
fine, i will download it
i made this with PUN
Play minigames with up to 6 players in this online minigame multiplayer game!Connect up with your friends or strangers as you battle it out to find a champion!All minigames are free to play, so get a friend or 5, what are you waiting for?Unique Gameplay – With minigames spanning across dozens of genres, there is a minigame for every taste for th...
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 ...
Coming Soon to Early Access
a mariokart? fine, i guess it will be similar
there u have boxes that a player takes and disapear for the rest of ppl
thats a similar mechanic i want
yeah okey, let me get photon
it has a lot of tutorials if you get stuck and i am not around
Welcome to this new tutorial series on creating multiplayer video games in Unity using the Photon 2 PUN plugin. For this lesson, we will show you how to download, install and set up the Photon 2 plugin in your Unity projects. Before you follow along with any of the other lessons in this tutorial series, you must complete this video. We will be p...
etc
let me check its restrictions
from memory its fine until you have more than 20 players
at a time
i will have 4 max players so
yeah its on the network tho
so you can have 5 games max
at once
full of 4 ppl
on the free version
Remember, to fill 20 CCU you need a tonne of MAU, like, a hell of a lot
a group of 4 friends wanna play, and 1 acts as a host
which is fine for an early acccess game
i should not have restriction
you can pay for more after that
you will see its not a big deal
and you wont reach it
but, can u read me pls?
and if you do the monetisation will cancel out the cost
The issue with a player hosting, is the need for port forwarding unless you use a relay service or punchthrough
if i am the host, 3 more players can join me
yeah thats 4 ccu
Only if you port forward
so you can have 5 games going at once
They aren't going on about Photon atm
No, you're not reading
scroll up
They are asking for a player to host
o_O
yeah on photon mate
Really? Because they don't seem keen on Photon
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
Except you instantly railroaded them with Photon, rather than describing the differences
feel free to provide a better solution
Mirror with Steam P2P
than something that has wordwide back bone
MLAPI with Steam P2P
and does that just integrate with unity
MLAPI is Unity's new networking solution
Mirror is the continuation and improvement of old UNet
They seem to want a player to be able to host for friends
Which is what Mirror and MLAPI allow
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
no you connect to the master server
so you can join games
i am telling you how it works
and i asked if this could be done and u said u can do anything
but i dont want a master server
players join rooms
i want a player to be both the host and the client
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
well, not that bad idea if minecraft works like that
Interestingly, Minecraft uses TCP
but player is host and client
i know, but thats not my problem
i am just saying how i want the multiplayer of my game to work
Unless they use a relay service like Steam or Epic
yeah and thats all pun is
unless you want to mess around with a lot of low level shit i recommend photon pun
like i said super friends party uses it
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
yeah people dont really get the limit
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 $$$
I believe I read somewhere, that Phasmophobia uses Photon
Photon Unity Networking framework for realtime multiplayer games and applications with no punchthrough issues. Export to all Unity supported platforms, no matter what Unity license you have!
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
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 🤷♂️
does mirror even integrate
i mean, i trust u if u say so, but if photon is not what i need i wont use it
into unity
i am giving you the easiest method for multiplayer mate
and if your game makes it you just pay more
not for the multiplayer i want
what a host with clients
What does that even mean?
thats all multiplayer
components etc
does it have good tutorials
Yes actually, check out Dapper Dino
i think mirror will be more useful than photon, since u are telling me photon cant do what i need
ok well
check out both
on youtube
and see what you think you would like to use better
Dapper Dino even has tutorials about Mirror + Steam if you want to use Steam
welsh will give you some mirror tutorials
No chance, Google
pfft
I'm not your search engine, I gave you a name
everyone uses pun so its not a fight
Sweeping untrue statement
can google that for sure
a multiplayer game where someone hosts and clients join?
Methinks Aaron does marketing for Photon
that is just multiplayer mate
yes. So there will be no limits. Each person can be a host
yeah
can photon do this?
yes
the limit is the players in the system
if u have 20 at once on free they will tell u
okey. i think even a pentium 4 can handle 4 players max at once
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 $$$
yeah, if i had $$$ i wont be making the game, others would for me
and if you think you are going to have more than 25 games going at once
i would question urself
thats what CCU means
there can be 1M ppl hosting a lobby at the same time
a multiplayer agent connects
and it wont matter
he wants to join a game
cuz each person is its own host
he joins the game
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!
there are 3 games of 4 players already
he joins the game of his friend, given the ip, for example
not a random game
again....
@olive vessel pls can u explain aaron what i mean? idk how to explain myself better
dude just trust me man
i dont see why will there be a limit
...
dude, stop writting 1 second pls. just read me, i will try to explain the best i can
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
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...
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
nvm, thanks for ur time
maybe mirror will be free master serveR?
i guess u are not even trying to understand me
dude, i dont wanna make a multiplayer like u did. It seems for u only exists ur way
and no xd
do you want to do it like half life and counter strike?
well no because what you are saying is how super friends party invite works
someone hosts sends out invite code
no, cuz u are saying i can only have 5 games at max
everyone joins
unless you pay
asdjkfnkñasdjf
i give up
which is fre
20 games at once of 5 players on 100 ccu
which is 95 usd
beyond that you pay per player
cents
sorry but i wont try to explain u again what i want
ok well i hope you figure it out 🙂
is ur turn to read me
i have thousands of players dude
If you guys have finished arguing
i dont think u r get it
gratz
what question
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!
thx
what do you use?
pun?
doesn't it work the same way?
forget Mirror
where do you upload your server side?
or: how dangerous is to open a port in my router?
one of the people running your unity game is the host
and you dont need to open a port because it talks to a master server
that talks to everyone else
i know how it works
so u just host
but i am asking where you upload you rhost
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
but this dedicated server is somewhere on the internet
for those two yes
that is what i ask xD
what do you use for a dedicated server?
and this is seriously expensive
damn
i dont i make the local player host
and invite his friends
to his computers
version of events
dedicated servers require actual servers somwhere
to private com,puters?
yeah
how do you do that without opening a port?
free?
that facilitates this information transfer
up to 20 players at the same time
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
👌
do you know about port forwarding?
i would do that, not the players
need to host like an azure .net core app that facilitates it
u cant open the ports for other players
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
I would open it on my router, not on others xD
like i said its just super beyond basic networking for unity
has nothing to do with unity actually
but others needs to open them too
if you want to host it needs to be open or discovered
i know, i just want an online server/host, and a dedicated one is too expensive xD
not really, I think they just have my public ip and port and their pc can connect
nah what you do is you make players host their own game on their computer and invite their friends mate
and each one can have 20 players invited you say?
but that is with pun
its just 20 players max at any one time
and you can up that to 100
with a simple pay
and then make it infinite
its not game based
that makes more sense xD
👍
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!
cool
yeah the free version is enough probably even for early access
you just arent going to hit the limits
Never claimed to be a Mirror expert, just wanted to describe the other options rather than ramming Photon down the fella's throat
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.
Don't use UNet, it is deprecated
Mirror is a continuation and improvement of UNet (By the communty). MLAPI is Unity's new solution
well im not all too good with unity and im just trying to learn and start by watching brackeys tut for unet
Don't start by watching videos for an old, deprecated system. That's shooting yourself in the foot
well is there tutorials for this mirror you speak of
Hundreds
im down for whatever aslong as i can have someone teach me, and who do you recommend
link me if you like
Dapper Dino has some good tutorials for Mirror
im starting a completely fresh porject to learn the fundamentals
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
ok, i thought i needed to like do coding for all kinds of stuff as i add it, am i right or wrong?
Getting two builds connected and having working movement isn't that hard, because Mirror has a component called NetworkTransform
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
Yeah only C# now
alright
well thanks alot for all the help my friend, i wish you the best on your projects
I'm just banging my head against the desk rn, also doing networking
@olive vessel have u ever made a multiplayer game with mirror?
I've dabbled with Mirror yes
so, could u guide me through multiplayering a game?
I really don't have time to be a tutor
im a bit lost and the only tutos i found on youtube is about a card game
uh
mmm f then
I just linked 23 Mirror tutorials, not related to card games at all
@olive vessel ah the glory of coding am i right?
Such fun, all the pain is self-inflicted
where are them?
Scroll up
ah thanks
But the satisfaction when you fix it is impeccable
@olive vesselso do i just add the networkTransform to a player prefab and it works?
That will allow the movement to be synced, but it does not allow movement, you must script that
so for me to see it client to client id have to script it
also what is this hes using at 0:50
🌐 Get the Mega Bundle worth over $1000 for 90% off at https://assetstore.unity.com/mega-bundles/grow-your-skills?aid=1100l9uzi&utm_source=aff
❤️ Using this Affiliate Link helps support the channel
Join Our Community: https://student.dapper...
idk what this control thing is and none of his previous tutorials had anything to do with movement
Well no, it's a Mirror tutorial not a movement one
You can script movement however you'd like
he didnt explain how he networked it at all though :/
Using the NetworkTransform
atleast for me he didnt
ok so i have to script the movement myself but the networktransform makes it go through the network
Hang fire I'm watching it and he literally goes through the movement code
i already have a player controller though
do i just need to add the networktransform script?
Ok so you use that, and add a NetworkTransform and NetworkIdentity to the player prefab
and im done?
ok
You might notice some wacky results, that's fine we will sort it
@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?
I would definitely do it in another project, so that if you mess up badly you have the original singleplayer game
okey
Then you can just copy bits you need over to the multiplayer project
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
😄
Yeah exactly, spawning any entities like bullets or in your case I assume bombs, is a little different for a networked game
okey
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 😂
Well did you setup the NetworkManager correctly?
idk what happened tbh, i restarted unity with the same project and it fixed itself
failed to connect on 2nd client
Could be many reasons
Did you start hosting on the first, did you connect to the right address?
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
im very familiar with how servers work
So did you follow those steps?
indeed
give me a second im doing what console says atm
yea its just failing to connect for some reason
Any console output?
So presumably, you have a build and the Editor, and are trying to get them connected?
it is the same
sometimes unity fucks
You set the address in the Transport?
Oh you must set it on the NetworkManager then
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
Is there a firewall issue?
Yeah that's fine
Oh you just disable them all completely
same with antivirus
Safety first, I guess?
i dont use antivirus or firewall
😬
dont ask
I guess you could try adding in the Offline and Online scenes
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
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
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
im just exhausted
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
use mirror @weak plinth
thanks ill check it out
This Unity Mirror tutorial will teach you how to create your own multiplayer game. For project files access, check out my GitHub here: https://github.com/DapperDino/
Multiplayer Course: https://www.udemy.com/course/unity-multiplayer/
-----...
this may help
tysm
this is my code for my player controller script
Pastebin.com is the number one paste tool since 2002. Pastebin is a website where you can store text online for a set period of time.
@weak plinth my bad that was for my issue with my script XD
no problem im not new to unity anyways so i just write my own movement script
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
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
this is the camera movement
with mouse
thanks
no problem
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
yeah it checks it
like
if (cameraCanMove && !isLocalPlayer)
u can try doing this : put all the code in one if statement which is if(isLocalPlayer)
{
code
}
put all the code from the update function inside that if(isLocalPlayer)
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
bruh imma just dm you
k
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!
Gamelift, Playfab are some options I guess
can a server run multiple scenes at once or do i need multiple instances?
Using mirror if that matters
This might be of use to you
thank you
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
will be useful in the future for sure, not exactly what I was looking for, but thank you.
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
Ahh yeah
is possible to use mirror and 2020 lts or only 2019 and 2018 lts work
I'm sure it will work on 2020
thx
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
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
it isnt "based" on unet but unet is one of the trasports that can be used, it for now is just 1 of the 2 default options
scrolling down here shows some other options
https://github.com/Unity-Technologies/multiplayer-community-contributions
Anyone know how to fix missing hostpolicy.dll? Dotnet 2.1.5
Yep and there's work in progress to replace the UNet transport with our new Unity transport package.
Because realistically, the health needs to be some sort of networked variable
The damage should be a command, which you invoke on the server
I imagine there would be yes
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
GameObjects and Colliders won't magically sync your fields
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...
SRCoder is a good one, the principles are the same but the syntax can be quite different
the only thing from this tutorial i see i did differently is this
NetworkVariableInt health = new NetworkVariableInt(100);
which isnt working for Mirror
Mirror has something like SyncVars
Mirror uses [SyncVar] attributes on regular fields
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
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
What's the difference between command and RPC?
does Command command the server to do stuff from the client?
Yes, commands are sent from client to server.
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 ❤️
Networking is hard
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().
nvm, me being idiot once again
Deja vu that's what that is
Someone asked me the same question in another Discord
Like, 4 minutes ago
😄
Pesky null references
things happen
how would u set the collider of the object so it doesnt get stucked?
like, a capsule collider?
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?
Thank you!
what is punching exactly?
It allows one client to connect to another via IP without having the host to open ports on their router.
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?
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
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?
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 😄
It looks like it works like you assumed. Casting the int seemed to do the trick.
Thanks!
hi guys, can someone explain me what are commands, rpcs and how to use them?
with mirror
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
Probably wanna send the input instead of polling the input on the server
If i wanna give my player movement an animation, using mirror i need to give a normal animator component and network animator?
for animations yes, and make sure to check client authority
yeah, i gave it, ty
got it working?
yeah, but there is a bit of delay
like... idk, i cant measure, but lets see < 500 ms
well thats how i did it, i can link you the tutorial i followed
sure
Mixamo: https://www.mixamo.com/
Network Animator Docs: https://mirror-networking.com/docs/Articles/Components/NetworkAnimator.html
Multiplayer Course: https://www.udemy.com/course/unity-multiplayer/
----------------------------------------...
watching right now
well, that guy has less lagg than me
should i change someone on the network manager or transport or something?
i couldnt tell you as im very new to all this stuff myself
it works fine for me, i dont know exactly what the issue could be
whats your tick rate set to on networkmanager
on the netwrok animator?
30
if that doesnt help thats the best i have for ya
ok, maybe someone else may be able to help
okey i reduced send interval
from the transform
and much better
from 0.05 to 0.01
fixed 🙂
awesome 😄
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?
Action is from System, not Mirror
oh.
So, are you missing a using directive?
thank you
yeah, it was this
thanks a lot.
hey guys is there a networking solution that i can use to make the players host their own servers/rooms (for around 10 people)
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
How about you do the simple solution I posted hours ago, and just find by tag in the player?
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)
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
The non local player does not need to know about it
Similar to how you disable movement scripts on non local players
ye, i know, but still, i wanna learn other ways
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
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
and what a coward removing the emoji so mods cant see u reacted with it xd
Who's the one flooding their question out?
again, grow up. Blocked
Damn entertainment at its best👍
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?
No I’m just joking 🙃
I know, I didn't mean it for you 🙂
Oh ok never mind then😣
I can try to give you some pointers tomorrow if you like. I'm damn new with Mirror but I managed to get my 64x64 tilemap working today, but I have no idea if it's done "the right way" 😄
where should i start if i want my physics game to work online
someone?
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?
You just create a dedicated server build of your project by ticking the server build box in the build settings.
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
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
Got it, I’ll mull that all over. Thanks!
hey guys is there a networking solution that i can use to make the players host their own servers/rooms (for around 10 people)
Most Unity networking solutions allow for that.
thanks
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.
There's no built in way but there are tools like parrelsync: https://github.com/VeriorPies/ParrelSync
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)
I dunno if Mirror docs goes through lobbies, but that's a topic I feel you will find a lot of tutorials online. On Youtube for example
thanks for the message, i've looked online, I've found videos on lobbies, but none on showing ALL available lobbies, like they have in the popular game Among Us, (where they show all lobbies available to join)
Well that's just having a list of Lobbies, the Steam transport of Mirror can take care of all that for you
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.
can anyone help me with this photon issue im getting?
this is the error im getting
and this is line 50
I can show you how I create rooms
oh ok
and didnt assign GameId
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
guys whenever i join a lobby it says "no camera's rendering" even tho i have a camera component attached to the player
Is there one in the scene that is enabled?
yes
there was
im replacing it now
with a static camera
this is my player instantiation script in case its necessary
How did you confirm that the camera was there?
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
In hierarchy/inspector
what do i do in the inspector?
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
you basicly mean "enable the object"?
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
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
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
Do you guys know how to use playfab cloud scripts to make two way friend requests?
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
Can Get request have a body in Unity?
technically you could have get with body, but why?
trying to add body in get but idk how
what are you planning on doing with a body on get?
how do i make my players spawn items using mirror?
what should go on server command, what on rpc, etc?¿
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.
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
hi
As for quantum @woeful badge we even have a complete RTS sample you can start from (with dynamic flow field group path finding, etc)
@gleaming prawn
Thank you very much for the useful information.
I will definitely be looking into Quantum this afternoon.
@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.
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.
@gleaming prawn
That would be amazing if possible 😄
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!
there is NetworkSpawnManager.GetPlayerNetworkObject(clientId) while that is not directly related to the NetworkTransform, i think you should be able to get all necessary information from the playerobject?
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 
https://docs-multiplayer.unity3d.com/docs/getting-started/about-mlapi
Unity MLAPI is a mid-level networking library built for the Unity game engine to abstract networking. This allows developers to focus on the game rather than low level protocols and networking frameworks. All this is provided for free under the permissive MIT Licence by Unity and the MLAPI collaborators. MLAPI is open source with no attached cos...
You are looking at the right place. What kind of documentation were you looking for and could not find?
I guess it would be regarding the spawning and how I would access the data of a object which has the NetworkObject components attached to it, as I was asking about in the "paragraph" above 😛
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.
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
You are fully right there's really no need to synchronize bullet translations like that.
Right, so if I still keep my players as PlayerObjects with the NetworkTransform components, is there a way for my bullets on the local client to be aware of the other PlayerObjects?
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.
Alright thanks
following all the steps and It wont let me add the player prefab 😦
Omg just had to stretch the window XD
hi
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
Not sure if I read this correctly, but is it true that MLAPI doesn´t track objects that aren´t created using prefabs?
You mean just objects in the scene? MLAPI does "track" them as long as they have a NetworkObject component on them.
Yeah; I meant that, I guess I was just confused what this means
The second sentence in that tip is incorrect.
I see, thanks for clearing it up!