#archived-networking
1 messages ยท Page 112 of 1
And several other people understand the principles really well (you know these guys)
exactly
Can you do a video of those ragdolls colliding with each other
Thats fine
So won't represent the most challenging parts
gif got too big...
let me try to resize
a bit small, but collisions work normally
It's ragdolls, so goofy regardless
but one is host, other is a client doing prediction and reconciliation
Tested here for several minutes
2.) update wheel collider values to server values: friction, slip, etc
3.) physics sync transforms
4.) run through inputs until at present time, physics.simulate at end of each input tick```
this is what I'm doing.
sounds correct
Except I never even tried wheel colliders
I believe you can not fully reset them
I'd do a custom wheel collider
oh, ok ok
ye, makes sense
but could be something more fundamental, like tick alignment not matching, etc
your reset/resim loop sounds correct
but this is a very hard problem to do right
So any small off-by-1 mistake plays havoc...
here I'm gonna paste a screenshot of something, one sec
the top part is the car gliding on wheel colliders
and then the collision happens with the terrain and it just messes everything up
Sorry, I can't help that much, you know.
I know, just venting my anger
๐
This is the last thing I could think of... That maybe I'm using some of the wrong settings
then again, they're the default ones :/
sometimes, enabling enhanced determinism helps a bit
it's off there
But should not make MUCH different
yeah I just switched it off for a test, it's been on for as long as I can remember
ye
@tender mothPlease let me know if you get yours working properly
Hi how could i learn networking in mirror and tnx โค๏ธ
By reading
Mirror and other networking frameworks have examples for Unity.
By looking on Udemy for great tutorials
I just started learning Mirror and I can't figure out how to set up the camera for players joining the host.
if(target == null)
{
if(GameObject.Find("Player"))
{
target = GameObject.Find("Player").transform;
offset = transform.position - target.position;
}
}
if(target != null)
{
Vector3 targetCamPos = target.position + offset;
transform.position = Vector3.Lerp(transform.position, targetCamPos, smoothing * Time.deltaTime);
}
This works on the host but not anyone else.
What happens?
When another player spawns, their camera spawns at the default position which is the same place of the host's camera but it doesn't move.
@tender moth@blissful kayak I stand corrected. It looks like physx is 100% possible to roll back, I was simply resetting my state wrong
Hi
Hi guys issue is that I cannot see my player in game view in unity photon can only see on scene view and only one player only so some tell me the solution
Hello everybody, currently I'm trying to implement a server room, so I wanted to implement the players being listed in the room by using the NetworkManager callbacks but when someone joins the host, nothing is logged to the console. Any clues what I might be missing, I'm feeling a bit lost here, I'll try again tomorrow.
Hey guys.. I've asked this in #archived-code-advanced, but I think this channel would be more appropriate: Do you have a good networking lib to recommend?
mirror is good
Yeah, I ended up choosing it
Having a tough time migrating my game though.. I should have done this much earlier
[ServerRpc]
private void RequestInitServerRpc()
{
var ownerId = OwnerClientId;
var vehicle = Instantiate(testVehiclePrefab);
var netObject = vehicle.GetComponent<NetworkObject>();
netObject.SpawnWithOwnership(ownerId);
_clientControllables.Add(vehicle.GetComponent<ClientControllable>());
var rpcParams = new ClientRpcParams
{
Send = new ClientRpcSendParams
{
TargetClientIds = new[] {ownerId}
}
};
ReferenceControllableClientRpc(netObject.NetworkObjectId, rpcParams);
}
[ClientRpc]
private void ReferenceControllableClientRpc(ulong objectId, ClientRpcParams rpcParams)
{
var netObject = NetworkManager.SpawnManager.SpawnedObjects[objectId];
if (netObject == null)
{
throw new ArgumentException("No object with ID " + objectId + " is spawned.");
}
var controllable = netObject.GetComponent<ClientControllable>();
if (netObject == null)
{
throw new ArgumentException("Object with ID " + objectId + " has no ClientControllable component.");
}
_clientControllables.Add(controllable);
}
Does this order ensure that a client has a spawned object when the reference Rpc is sent?
Order:
ServerRpc -> Spawns NetworkObject
ServerRpc -> Send ClientRpc with id
ClientRpc -> References NetworkObject locally
How would I go about doing this, using Mirror? I need to enable the camera locally, after spawning it from a function on the server. I keep getting
UnassignedReferenceException: The variable cam of PlayerController has not been assigned.
You probably need to assign the cam variable of the PlayerController script in the inspector.
UnityEngine.GameObject.GetComponent[T] () (at <a0ef933b1aa54b668801ea864e4204fe>:0)
PlayerController.Start () (at Assets/Scripts/Player/PlayerController.cs:37)
on the client, although it works fine on the host
I thought about making it return cam, but Mirror doesn't let you do that, and I can't pass CmdSpawnCam a reference to my connection, because Mirror again doesn't let you pass connections
dont network cameras
What if I want a spectator view that shares their camera?
have a camera follow script that can dynamically change targets
So Mirror just doesn't support sharing views?
not sure what you mean
I want players to spectate others, by just looking straight through their camera. When the spectated player moves their view, the view of the spectating player moves
Actually, I guess in that case I could just share inputs, huh?
just change the camera follow target to whoever you want to spectate
none of that needs to be networked at all
Yeah, I'm not great at explaining this
We're not too fond of that concept anyway, so it's not a huge problem
How can I prevent the client from attempting to run server functions?
[Server] function 'System.Void DamageScript::Awake()' called when server was not active
UnityEngine.Debug:LogWarning (object)
DamageScript:Awake () (at Assets/Scripts/NPCs/Enemies/DamageScript.cs:20)
UnityEngine.Object:Instantiate<UnityEngine.GameObject> (UnityEngine.GameObject,UnityEngine.Vector3,UnityEngine.Quaternion)
PlayerController:Update () (at Assets/Scripts/Player/PlayerController.cs:57)
It makes sense I get the error, and I can just suppress it using ServerCallback, but how can I prevent it from attempting to run it at all? (Using Mirror)
Odds are you can't easily (and probably shouldn't) block the Awake from running, but you can probably add some check in there to do nothing if it isn't running as server.
I'd still get the error in that case. The awake doesn't actually run on the client, only attempts to run it before being stopped because it's not the server
Is this where I can ask questions about Mirror?
This is pretty much just a visual issue and I can hide it using ServerCallback, but I feel like I should prevent that entirely on the client. Maybe Mirror has a way to only have a script on the server?
Yeah, or it has its own server you can find in its documentation if you want more specialized help
Okay I'm new to Mirror so I don't understand much. I'm trying to just have the localPlayer shoot on mouse click instead of all players. I can't use !isLocalPlayer because I used it on my movement script because of an error that says that the Prefab has multiple identities.
I'm also trying to sync the shooting on the screen and I haven't gotten that working either. I think I'm supposed to use Command but I get an error that says that it dosen't have authority.
I think that's difficult (without adding and removing components at runtime) due to just how Awake works and not being able to decide that on a gameobject level
@swift epoch @cosmic dove i would recommend asking in mirror discord your questions, we are more active there and they will most likely get answered faster
๐ I'm a member there, but I tend to find myself asking here just due to the convenience. I'll try to ask there more often
Oh I think I posted my question in the Wrong Channel before. I don't have a problem, just a question on strange behaviour:
I am trying to send a http get request via the System.Net implementation of HttpWebRequest via my Unity Application on an android device to my local server. The server is reachable and a manual request via the browser works as expected, the request doesn't work from my application (only on android, desktop works fine).
I managed to get the request working, but I encountered the strangest behaviour I've seen in a while. As my example did not work with the default System.Net package I tried the Unity Get Request suggested here: https://docs.unity3d.com/ScriptReference/Networking.UnityWebRequest.Get.html which worked. I then tried my other solution with the default system net request and surprisingly it worked, too. I experimented a little bit and whenever I added the Unity Method definition from the docs WITHOUT EVER USING IT, my code works just fine. But as soon as I removed the definition it stopped working again. Got anybody an idea wtf just happens here, I am very curious?
I am creating my first online game and I have some questions about when it comes to anti cheat. So should i just make the movement code all client side and just trust the client and have good performance. Or just send the Input to the sever and let the server compute my movement and move me but the I found that you are having more latency. or you need to do a combination of both and send the input to the the server and predict the outcoume, move and then check if tthe prediction is correct to move the player or not. Or should i not even worry about cheaters
If it's your first game don't worry about it
Unless you don't mind putting in all the extra time and get little return on investment over it
i dont mind putting in extra time because I am all learning networking so I think its better to learn it the right way and get used to it
just do client auth for your first networked game like @shut yarrow said, you will probably get overwhelmed and confused with server auth practices (reconciliation, prediction, etc) the first time around and it will be nothing but headaches
I see thanks
@vast apex NL?
haha ja
Cool!
How did you know?
Well if you are interested and have some time lets DM I like to know what you're working on
Your name ๐
yh ofc that sounds great
ah yes, SS-Standartenfรผhrer Hans Landa, de Nederlander.
๐
hey, i don't know much about unity servers and networking. when making a game that for example needs space for lots of clients on the server, where would i look for one? Does Unity provide big servers or do i need to host a dedicated server elsewhere?
what type of space? RAM, disk space, network traffic?
in general, Unity does not provide anything, there are some other third parties that will relay (forward) traffic from one client to another, if you have a "central place" that needs to process things, you would need a dedicated server.
hm ok thank you man
Just FYI, Unity does have a Relay Service now. As well as a Lobby Service. Multiplay is Unity's service for hosting dedicated servers.
how many clients can it hold at once?
Dunno about multiplay. But the relay peer to peer service is capped at 10 players per match
But in any case if you are trying to go massively multiplayer then you are gonna have a bad time
oh! Cool, I didn't hear about that one. I get confused now and then with Unity because they rename things now and then and the names don't always very clearly reflect the service imo.
They are all still in beta. But its part of the new Unity Game Services they just launched last month
Hi everyone, did anybody have performance issues with netcode too? I had really bad delay when playing in LAN. I wonder if this is an issue of the package being in still in beta.
So I switched to mirror and everything is fine now concerning the delay.
But I got another issue now. And this one is really strange. It looks like I am colliding with a clone of myself at the center of the map now. I can't find any object there, but the collision method is called with the other collider being the player itself.
I also bounce back, as if I really collided. This occurred when I switched to mirror. That's is why I am writing it here.
@shell halo try asking in mirrors discord. You may need to provide more info
has anyone done or know how to do the photon PUN tutorial cause i'm stuck on one of the steps
What step?
2- lobby UI The Connection Progress
I just don't know where to put the code new to code in to edit the launcher with out breaking it
That is what i'm to I'm just having trouble to find out where to put that code in to edit the launcher.
It says where to put things on each step
ok
If I want to start some action on all clients (Footstep sounds play in example)
I should send rpc to server
And from server to all clients?
Or I can make it better
I think footsteps should be done locally on each client. But generally, yea. If you want to broadcast an explosion or something to all clients, it has to come from the server
Hey guys, my team creates an ARPG called Last Epoch which is a Diablo-like and we're looking to hire a full time network developer. Do you have any suggestions where we may post the job outside of sites like Indeed and Linkedin? Where do you folks frequent? ๐
@wheat socket what networking are you using
Some networking discords have job posting channels for them
Is there networking system that would work on steam and other platforms/mobile
Most popular networking solutions seem to be trying to target as many Unity platforms as possible
is unity networking free?
depends on where you get it from some are free and have limited things you can do with them
You want something that is free I would go with photon engine
Global cross platform multiplayer game backend as a service (SaaS, Cloud) for synchronous and asynchronous games and applications. SDKs are available for android, iOS, .NET., Mac OS, Unity 3D, Windows, Unreal Engine, HTML5 and others.
here is website if you want to have a look at it
I'm having trouble with this code sending to a room http://pastie.org/p/16IOjG7MPFUaOoglTTNefd http://pastie.org/p/3oLwlEzojDZckgEQZZoqnx
I can give the other coding components if you need them
can someone recommend me a good google cloud save tutorial ? ( Android)
can anyone recommend me cheaper networking than photon?
im building a turn based game
firebase can be used too, but more work right?
yes but that would be risky, in case it turn off
if my plan goes well, i might have too many players
I jest, yeah Google and Amazon both have some free tiers, and scale easily after that, they don't offer game specific services as far as I know
But consider this, disclaimer, I'm not affiliated with proton, but if you hit the tier that it's not free anymore, you're still making money because you're a success
yeah i definitely understand, but not in my country
my currency is very low
so photon is costly
ahh yeah i never considered that!
yeah unfortunatelly ๐
try moving to switserland in that case
haha I also speak a bit of French, but i'm not Swiss, I just used it for the stable currency
backed by vaults full of gold!
i see, my currency lose value every minute... TRY
convince Erdogan to join the EU ๐
i would talk too much about him but dont want to spam here haha
2023 he will be gone
True sorry I got distracted! Let us know how Firebase goes! Because I'm currently hosting from home for real haha (dedicated server though, but still)
sure, thanks for help! another question, how many ccu u can host from home?
was it ccu tho, concurrent player
my speed is 100 dl, 5 ul ๐
very limited upload speed
Well my i'm hosting more of a "master" server, it only helps people punch LAN and connect peer to peer. So no real game traffic goes through my connection.
just the connection making process
ohh.... i can do that too... are u using mirror for that?
all custom
that would take soo much time, wouldn't?
it's very easy actually
do you know any documentation?
yes many unfortunately because I had so many issues figuring it out, and in the end i was just mixing two sockets
try searching this channel for nat punching
Could some give some ideas about how to achieve the following, say I have a unity scene, now I want someone sitting beside me on a laptop, so they are on the same network. So I want the person on the laptop to say be able to see a plan of my scene. Now say the person on the laptop wants to add some gameobject, move it around or change lighting etc.. now Iโve created a simple example using Netcode. But I donโt think this is the right approach, I think it would be better to have some kind of stream open, like fire base. So on a website say I have a button, add gameobject, I click on a button, updates firebase which in turn adds the object to the scene ? Any pointer?
(my server code for example is only 140 lines in NodeJS)
that sounds great
any security problem?
idk what it could be but thinking that firebase and photon already secure
Sorry are you talking to me ?
(no me)
no me too
Oh ok lol
was reading your message tho
so weaglf, my thing was, I wanted to roll a custom UDP implementation for the hobby programming aspect of it, so yeah, it's going to have loads of problems with security, although once I get the first hacker to play my game I'll be very happy to call my game a success
i did not understand but are you talking about development process? so github? i might be completely misunderstood you tho.
No sorry thatโs not what I mean
haha i understand, thanks for the help ubdead, good luck with your game! im back to coding now ๐
I would say you are on the right track!
browser -> TCP (http posts) -> firebase -> UDP -> proton client
something like that?
Why would I need photon client ?
So using Firebase opens a stream and listens for changes, right?
I'm no expert on Firebase, but as long as you get a IP and port that a socket is able to listen on, yes
now that I re-read your message, I think actually you might actually be fine doing a TCP implementation if it's all happening on the same network
and things are not super fast
well you know, i'd actually recommend talking to somebody that has experience with Firebase
I think you're looking for this though https://firebase.google.com/docs/cloud-messaging/server#choose
oh wow wait they have a page for unity even cool
https://firebase.google.com/docs/cloud-messaging/unity/client
What's a good design pattern to follow when writing a dedicated game server for an already existing game? The game uses nothing but TCP.
is "DOTS netcode" and "netcode for gameobjects" the same thing?
They are not. DOTS is a new WIP way of building stuff in Unity (https://unity.com/dots). You are most likely working with GameObjects, so use Netcode for GameObjects.
thanks for that. It's very ambitious of Unity to be working on 2 netcode projects simultaneously, both still in their early stages.
Well the delays in ECS has probably allowed them to focus on the version of NetCode that is most likely going to be used by 90% of users for the next few years ๐
I'm having trouble with this code sending to a room http://pastie.org/p/16IOjG7MPFUaOoglTTNefd http://pastie.org/p/3oLwlEzojDZckgEQZZoqnx
I can give the other coding components if you need them
Could someone help with the best practice to implement this multiplayer logic, i have a VR scene which is highly detailed.
I want to be able to create a separate scene, let's call it planscene that is just a simple plan of the VR scene, with a cube that represents the location of the user.
I also want on the plan scene to see the movement of the player in real time.
Also, I want to be able to say add a tree, so on my plan scene I click a button which shows me a green cube, i position it and then click deploy and a real tree is displayed in the VR scene.
So I basically I need server-client communication but i want my plan scene to be very lightweight as it doesn't need all the detail of the VR scene.
so what is the best way to achieve this
Unity Netcode
Unity with Firebase, connect the firebase backend to a website
Create a socket connection which is then connected to an external website
Any ideas?
with NetCode for GameObjects, the simple way: make it both the same scene and have all objects (incl. netobjects) have two views one for the real view, one for the map view. give your clients a role (think classes in an RPG), maybe through a NetworkVariable and toggle either view depending on their role. I assume you mean light-weight in terms of rendering not in terms of network traffic. To limit traffic you can implement/use network visibility on top.
yes but I also mean lightweight in terms of build size, if i follow your logic both server and clients will be same size, but that would not be practical
theoretically you could use addressables to load the assets from different sources, one low quality/simple, one high quality/detailed... build will be the same for both (but only shared assets are shipped), then the clients will only download what they need depending on their role or launch options.
ok thx, will read up on it
it should actually be quite simple to do... but not trivial
really, i've never used addressables
its a bunch of complexity, and I'm only speaking from what they can do potentially, i haven't built a system like what you describe myself.
k
so would a socket connection not be better, so if a move my player that sends the vector3 to my backend?
if you want to reinvent multiplayer networking yourself, and are very experienced with it, sure
thats the prob, networking side is kinda new, i can do the above using netcode but not sure how to create a detailed and scaled down scene
netcode is just a socket connection, a sophisticated transport layer to handle reliability and a few abstractions on top
yeah need to start doing some digging, thx for help
you can easily do the abstractions yourself, the transport is more tricky and there are very well made/established solutions for you to use
the most important site you need to read is this:
ok thx
if you want to get stuff done, use either Mirror or Netcode for GameObjects, some like to use Photon (can't say anthing about it) a sales guy from them will probably reply here eventually ๐
thx guys
Mirror has way better documentation
Replied...:) that's all
every little helps ๐
sorry, didn't mean to be critical
you're also not a sales guy ๐
All in good spirits
Gaffer on games and Gabriel's blogs are good resources for how things should be done properly for client/server architectures.
If that is the stuff you want, I can suggest you to take a look at photon fusion (from our stuff), as it implements all these things turn key
I'll also be live coding with it in 5min btw...
didn't gabriel use to be the only resource on the internet that contributed anything of substance?
Glenn Fiedler blog (gaffer) is also good
just in case: https://www.twitch.tv/erickpassos76 (live coding with fusion in 5min)
Does anyone know of any good resources on crossplay networking for Unity? I am eyeing Lobby, but I don't know if it will be crossplay compatible. I want to support PC and XBox playing together at least.
Any information about cross platform anyone can give me would be very useful
Unity Lobby service should be cross platform but I can't find anything explicit. Azure Playfab does have cross play matchmaking
Thank you very much for the response, I'm going to give lobby a shot and see how that works out
In the game lobby sample for Unity Lobby, I get the following error
I have ensured that I have signed in under services and have generated a project ID, set under my organization
You need to enable/activate Lobby and Relay from your unity Dashboard
So, open world using MLAPI. I have players scattered around world activating enemies around them. I'm suppose to use .Spawn() but I don't want enemies active to all players if they are not close by. What do I do?
Server Sharding (if the server is the bottleneck) and object visibility based on proximity (if rendering is the bottleneck).
Ok, that makes them invisible but aren't you still sending data over the internet for updating pos and anim?
Visibility here means also no trafficโฆ ie itโs network visibility
Host is the server, so Server Sharding?
youโd just update at higher frequencies the closer a client gets
Cannot be done with a host architecture, you need dedicated servers. (Unless you want to get extremely fancy with floating peer2peer server architecture)
Hello. Can anyone help me with multiplayer driving with mirror, Something like a car maybe ...
So lets say I have 4 players max. Each player can see roughly 10 to 20 enemies max at a time. Should I be worried?
No
Whats the max amount of players I possibly could have?
depends very much on what exactly you need to sync and how often.
All I have is player, enemies. Everything else is sync when you open a chest or build something at the moment it is done.
Implementing regular network visibility based on proximity will do fine
any tutorial on this you know of?
Thatโs not a tutorial kind of thing
Itโs a concept
can you give an example?
So server side checks proximity, if close enough, then send to client?
is this what you mean?
yes
ok, thank you ๐
oh wait, so i still use .Spawn()? How do I make them invisible after I check proximity?
or maybe enemies are just always visible so no worries
you tell the client they should be invisible, then don't update them anymore, tell the client to reactivate when in range again and send updates. Or spawn/despawn them on specific clients based on proximity.
i don't understand how to stop the update if I use .Spawn()
even if i SetActive(false). wouldn't it still send info over the internet?
netcode has that built in https://docs-multiplayer.unity3d.com/docs/basics/object-visibility
Starting with MLAPI version 6.0.0, clients have no explicit knowledge of all objects or clients that are connected to the server.
Thanks again, I understand
its sadly something that has to be fundamentally integrated into the network stack to work properly, but its a common problem so most libraries feature some version of it.
Yea so I have a sphere collider around player that activates enemies. I don't have to check player distance. I just use what you sent, just activate on server side. I get it now ๐
one last ?. I have dynamic objects like rocks you can kick around. NetworkTransform doesn't work with rigidbody dynamics. Any suggestions? I was gonna write out some code when a player collides to update its pos to other clients.
only the server needs to sim the physics, clients can just get updates via transform
but apparently netcode has you covered https://docs-multiplayer.unity3d.com/docs/advanced-topics/physics
There are many different ways to do physics in multiplayer games. Netcode for GameObjects (Netcode) has a built in approach which allows for server authoritative physics where the physics simulation is only run on the server. To enable network physics add a NetworkRigidbody component to your object.
Thank you so much!
I've done that but still get the same error ๐ฆ thanks for replying anyway
Well, since I can't seem to get Lobby & Relay working, I wonder, is there a way to allow players to browse a server list, join, and host without me having to pay for a server?
I've been looking at Mirror but I don't know where to start. I just need player hosted lobbies and the ability to browse and join those lobbies
I mean you probably don't want to host it from home, so you're probably going to end up paying for a server regardless
So a server is absolutely required to help connect players to one another without directly knowing the others IP?
I would say yes
Man, it's hard to start out with networking from what I've seen. I don't have much right now to be spending, I was hoping the funds for larger scale networking could come later..
Is it like a co-op game?
Yeah it's an open world adventure game where you can be any creature that you want to be
I'm not new to programming, but I am new to networking, so this area is very complex and unclear for my mind currently
If you don't want players to cheat, you'll need a server running the same simulation as the game, and the clients will talk to that server for the entire duration of the client session
also known as server auth
there's lots of third party services that pretty much do everything internally for you
photon is one of them
games like GTA don't do server auth, which is why players are able to turn other players into ATM machines, kill everyone at once, crash people's games, kick people at will, etc
Payday 2 entirely client auth as well and since its a co-op game, I haven't found many issues with hackers ruining the experience and I have well over 200 hours in that game.
Thank you very much for the info. I think I'll do some more research and maybe sleep on it
I like the sound of photon, doing the internals for me so I can get to developing the game
I'm a lone programmer so simplicity is really nice
All decent libraries like mirror and netcode use an authoritative server architecture. a lobby is รก somewhat separate problem from the actual sync of game state. You can implement such a lobby however you like as it isnโt really a real-time sync problem. It does not have to be part of your server/client app. Just a web-api works fine.
Players would find open games with that api or publish their running host to it.
I suggest you look at Photon Fusion (photon is a company, and there are many different products).
Fusion implements full server authority + tick accuracy + lag compensation + client side prediction, all out of the box.
You can use fusion to implement a "lobby" as well, there's no need to mashup different libraries.
I have actually been looking at photon realtime because they boast crossplay
I saw that photon will also take care of my lobby problem. Are you saying that I dont need photon and just need a simple web api instead of this more elaborate solution?
photon will take care of many things but won't take care in the sense that you still have have to learn the API and implement some stuff yourself... it is still pretty involved making a multiplayer game, Photon (via @gleaming prawn) is quite available for 1st-party community support. Mirror/Netcode have their own dedicated discord servers and offer some 1st-party support aswell. Maybe make a formal comparison of all libraries/products and their support/community specific to your needs. Its a decision you will not want to change when you are halfway done with your game.
what's more elaborate depends on your specific project, your workflow and non-functional requirements you may have... DIY can be simpler, can also be much more work... there are no general answers.
I figured making this game multiplayer would be a good bit of work. I'm prepared to learn a new API, I guess the main thing holding me back is knowledge of how networking actually works and what API would be best
all of them will get the job done, none is perfect
I'm experimenting with Unity's Netcode for Game objects and their new Lobby and Relay Service. It's still in beta but seems fairly functional so far
its generally a bad idea to rely on beta stuff that unity tech. makes unless you are prepared to rewrite everything that relies on it
especially in regard to netcode where unity seemingly hasn't made up its mind yet
The Relay Service is meant for P2P architectures and is currently capped at 10 players per match
Correct
a lobby is something completely separate from the main focus of multiplayer networking libraries, it is just that many of them have an example of a lobby implementation for you to use
Unity has a Lobby service in addition to a Relay Service. They can be used independently of each other
I tried to use lobby but for some reason I cant connect, it returns an error. I even quadruple checked that I set everything up according to documentation, signed in, had ID, and enabled the services
thanks Anikki. Nothing to add.
As said, feel free to poke me with specific questions @tepid prairie
Are you a part of the photon team? Do you think I am being reasonable/realistic with what I want to do? I want to design or (possibly) procedurally generate terrain which would have the same generation for each client if so, but it will be an open world with preferably between 30 and 100 players. I would like to only send and recieve data to those nearby and, if possible, have a sort of networking level of detail system where farther players are synchronized in a rougher, less accurate manner (every other frame, cull animations or physics after a certain point, etc)
I am one of the engineers of both Photon QUantum and Photon Fusion
Does photon fusion support crossplay between different platforms? That's another important one for me. That will be a big point of this game to connect friends and family together
I want to design or (possibly) procedurally generate terrain which would have the same generation for each client if so,
You can do these things, using a synced seed, and assuming you know how to make your gen deterministic (more or less)
preferably between 30 and 100 players.
From our stuff, go for Fusion. It's rated (realistically tested by us engineers, not marketing fluff) for up to 200 players (at full 60 ticks per second, not slow pace) in client-server mode with full server authority.
I would like to only send and recieve data to those nearby and, if possible,
This is called interest management. Fusion has 3 builtin methods for interest management, including AreasOfInterest (which is what you normally use for distance based culling).
Does photon fusion support crossplay between different platforms?
Yes
So these are all reasonable...
But remember, it's like others stated to you:
developing a multiplayer game is not easy
SDKs like ours (or others) may help you more or less with the necessary things, but it's still something you need to work to get right.
That said, feel free to ask any technical question.
Thank you very much for your responses, I will probably try fusion out very soon. I have an apples and oranges type comparison question, but I figure I'll ask it anyways: if I am able to do stuff like bounding box voxellized buoyancy, greedy meshing, full rigidbody physics character with animation states, and multithreaded procedural generation, do you think I will be able to tackle this task as well? Everyone seems to make multiplayer sound like a crazy task that is insanely hard to accomplish and it feels a bit deterring. I'm hoping its not actually as hard as people make it sound...
the notoriety is greatly exaggerated
It's not crazy hard. But it's harder than most people think.
it can be done, procedural world networking difficulty is very exaggerated as joy stated, its really just syncing seeds and making sure your generation is deterministic
do you think I will be able to tackle this task as well?
1 - as others said, you may be exaggerating in the "requirements" a bit... you can pull it off without all that.
2 - as for the question itself, only you can answer...:)
Has anyone ran into a VSCode issue using Mirror? I cannot understand why VSCode cannot resolve any of the keywords, tags, or attribute from Mirror plugin. Unity does not complain any issue regarding of the VSCode's false positive message. Yes Mirror does have a *.asmdef file, and yes I've regenerate Csproj solution four times. Do not know where else I can look into but ask this problem here. I had other project that uses the exact same plugin and doesn't show the false positive in VSCode. I feel like I may have to delete the library folder and rebuild it all again.
Any recommendations on what I can do to get this VSCode false positive fixed and referenced?
how would I fix this?
i've had success after adding new packages to go to the unity preferences -> external tools -> regenerate project I think
(not specific to that error though, but in general)
doesn't work
I fixed it before but I forgot how
It was something to do with how it was assembled in Assets
Hey,
does anyone of you guys works with the new malpi and can help?
Problem: I have ship in warter. On Server-Side everything is smooth and fine. The Client-Side has big jitter-Problems. Can figure out why.
could be tick rate stuff. have you looked at tom weiland's tutorials?
I got the floaters from him but the rest is scratched together somewhere else. Should the tick rate be higher?
This are the server updates
@gleaming prawn which one do I download for Fusion?
I found a page here https://doc.photonengine.com/en-us/fusion/current/getting-started/sdk-download, but I'm not sure if it's the correct one. It also says it doesn't have XBox or PlayStation support yet
@gleaming prawndoes master server work the same for Fusion and Realtime?
I don't see much documentation for master server on Fusion
Oh, I see, it's referred to as matchmaking. Sorry! I'll try to figure more out for myself from here on out. Thank you for the help and advice, I look forward to trying out Fusion
Check the 101 tutorial
Also, you should consider joining our discord
Thereโs a lot of discussions there, very active community and all the photon engineers included
Awesome, I think I've got a pretty good start now. I guess I had trouble navigating the documentation at first, my bad for not looking more thoroughly from the start. This looks awesome and actually not that bad, though there is more to it than I'd thought.
just realised there's a channel for this
does anyone know why this happens with Netcode for Gameobjects
I get this when I try to join as a client. Didn't happen before.
how do i sync up varibles in photon pun 2
i tried google and that said use [PunRpc] and call the function with
PhotonView.Rpc("", photontargets.all, params);
but photontargets isnt a part of photon.
i also tried youtube but the one tutorial i could find used PhotonStream and i have no idea how to use that
Anyone using the new malpi and has a working player transform sync?
Maybe a bit late, but RpcTarget.All is what you are looking for (your ide should normally tell you in the auto completion)
Alright so unity's MLAPI doesn't seem very usable in its current state so im switching to PUN2. My game has deformable terrain, so when a player joins, I will need to sync the terrain changes to them. What is the best way to do this, without exceeding the maximum message size?
In a general sense, if a message is too big, a strategy could be either to split it into multiple messages, or somehow compress it, or maybe the players only receives deformed terrain in a certain radius around him, etc
do you have namespaces Photon.Pun and Photon.Realtime ?
if so you should be able to use PhotonStream to sync values and this is the most correct way to do that
I encountered that too, it only happend when the host process was killed and not shut down correctly.
Depending on the Transport I got differenct Exceptions.
for the Unity Transport (UTP) it was somthing with NativeArray.
They'll hopefully fixing it soon.
anyone know any good playfab-unity tutorial series?
Does Unity Relay attempt a NAT Punchthrough first and fall back on Relay if that fails? Or does it exclusively use relays? Need to know so I can choose between this and the new Photon Fusion.
Avoiding a relay is preferable for lower latency, but obviously that isn't always possible, which is why I want a relay.
Steam claims that using their relay network your average latency will actually decrease due to more efficient routing in their system. So although it might feel counterintuitive, using a relay can result to lower latency (but i'm not an expert engineer, best way to see is to try!)
epic online services has a free relay, don't need to worry about saving costs with nat punchthrough there
Oh really?
Are there any restrictions with that, like accounts and future CCU costs?
Looks like the Unity plugin only works on Windows atm, with Mac, Android, iOS and Consoles coming in the future. But I guess they're too big to fail so should be a safe bet. Would that mean that people would have to login with an Epic account to play my game?
Fakebyte's epic transport should help to learn how to use it in unity:
https://github.com/FakeByte/EpicOnlineTransport
CCU costs are free thanks to fortnite's economies of scale.
latest commit mentions android build support, so I guess it works on mobile now too
Ah, this is a third party one for Mirror. This is the official one I was looking at: https://github.com/PlayEveryWare/eos_plugin_for_unity
The one you sent me has Android support but not iOS
To answer the initial question, Unity relay does not attempt nat punchthrough.
Didn't think so, thanks
Epic lets people to use other ID services with EOS, so if you have a game in say, steam, you can let people use steam accounts for the ID and not require Epic accounts to play your game
that being said, I haven't checked the recent progression on that topic but in past it meant that you couldn't get crossplatform progression, like achievements etc carried over to other platforms if you didn't link to users own Epic accounts, I guess because they simply don't have any public account you can link against then
I've taken a short look at the EOS stuff and it's a lot to take in compared to Photon. But I guess that's the price you pay for getting it cheaper.
but like, if you only care for single platform or don't need players to be able to continue playing the same save on different platform, you can just use external ID setup with EOS
I do kinda want cross-progression though. PlayFab gives that with their account system.
then you are forced to require Epic accounts from players if you use EOS
(or handle progression on some other service)
I am following this tutorial
https://www.youtube.com/watch?v=LH0fLkeV5Q0&list=PLTm4FjoXO7nfn0jB0Ig6UbZU1pUHSLhRU&index=11
But I am having some errors at the end of this video when I clic: "Login" button.
Please Consider Supporting me on Patreon:
https://www.patreon.com/join/635193?
Hello guys.
Welcome to this series, where we will be learning PHP and MySQL so that we can create a backend for our games.
In this specific video we will create the PHP files and function in our Web.cs class so that we can download the items of our users and also t...
Yea none of these networking solutions really compare to Fusion, especially when looking at just transports
@grizzled moon Hey, I have working player transform sync. You might want to try replacing "Network Transform" with "Client Network Transform". This solved my problem, but I don't know if it'll solve yours.
@grizzled moon See the answer here: https://stackoverflow.com/questions/69903567/unity-netcode-mlapi-host-moving-and-client-connecting-but-client-not-moving
Anyone here who can help me a logic, i am using photon
Simplest way to find out is to ask the question and provide the necessary details ๐
I am using photon need help with a problem, i want to share a Code to my friend and then that friend join me as a team member and then search for opponent online.
How can i achieve this?
Can anyone help me with my problem above?
Can I share anyDesk with someone here so that you can see when the error happens? it happens when I clic "Login" button
If the players know one another's userID, you could use FindFriend to follow a friend:
https://doc.photonengine.com/en-us/pun/current/lobby-and-matchmaking/userids-and-friends
When you exchange a code outside of PUN (because PUN itself does not enable communication outside of rooms), you can exchange this as room name as well. Tell the other the region to use and the room name to join.
Both users can use JoinOrCreateRoom(code_or_name) and then wait for the other in-room.
You can set a room option to create the room as invisible. This prevents others from joining the room by JoinRandom.
How can I send calls to 1000s of URL and load them asap?
Using coroutine it will be sent 1by1.
Hi everyone! I'm following this tutorial for networking: https://docs-multiplayer.unity3d.com/docs/tutorials/helloworld/helloworldintro/index.html
Tutorial that explains creating a project, installing the Netcode for GameObjects package, and creating the basic components for your first networked game.
but even the local networking is not working on my machine
are there any ideas as to why this is not working? Is this a firewall issue?
hello
so, I have a problem with my inventory
I wanna optimize it
but the item gets created on the server
You need to specify what networking you're using
guys
i have a small problem
can i get a small help?
i use Photon.PUN
and i already have an Object with a script attached to.
using System.Collections;
using System.Collections.Generic;
using UnityEngine;
using Photon.Pun;
using UnityEngine.SceneManagement;
public class ConnectToServer : MonoBehaviourPunCallbacks
{
void Start()
{
PhotonNetwork.ConnectUsingSettings();
}
public override void OnConnectedToMaster()
{
PhotonNetwork.JoinLobby();
}
public override void OnJoinedLobby()
{
SceneManager.LoadScene("Menu");
}
}
even with it
i cannot join a room...it says:
i mean create a room
so im having a problem with photon atm
I want to load a new scene locally and from the masterclient so it refreshes everything
the problem is that the clients seem to load first so they delete the instantiated photonviewers after
i actually had this working earlier but it stopped working all of a sudden, any ideas?
nvm i got a great solution, i just paused the messagequeue until the scene loaded, then resumed it
is there networking for DOTS?
https://docs.unity3d.com/Packages/com.unity.netcode@0.6/manual/index.html Yes, "Netcode for Entities"
0.6 preview. is there network solution for entitas or other solutions (that not in preview)
Pretty sure every official Unity networking solution is in preview right now
@safe sand if you care about things not being in preview, maybe indeed look outside of DOTS (where only burst + jobs are released and everything else is in preview)
Well it does seem that they pivoted to Entitas, which solves that one ๐
Just ask your question for someone to answer. If someone is available, they will.
I have got a link that, on my internet explorer, downloads an image directly instead of loading it. How could I get that image in unity?
I've tried with UnityWebRequest but it throws this error:
HTTP/1.1 404 Not Found
So, looking at the api documentation, when asking for an image, the api with throw a "HTTP 302" which its a redirection (?)
How could I deal with this?
How do NetworkObjects interact with child game objects?
Are they completely ignored?
Can I replicate data on child game objects that aren't network objects but the parent is?
matchmaking ig.......
Hosting?
Does anyone know any good tutorials for multiplayer?
I honestly can't find any for Unity's own multiplayer system
Also, Mirror or Unity's own multiplayer system, which is better? I'm considering Mirror now as it has way more tutorials
Are there a lot of tutorials for Fish-Networking though?
I'm not extremely experienced hence I need something affordable and preferably free as well as something which has a bunch of tutorials
using PhotonView.RPC(function, target, args) how do i pass a gameobject to the function
MLAPI NetworkRigidbody. Will this use bandwidth if the object is not moving to sync position?
Also is it recommended for enemies with Network Transform to send 20x a second? (this is the default, I was thinking of lowering it to 10x a second.)
mirror is easier
Mirror is definitely a good starting point. Despite all the naysayers and negative crap that it gets, it works. May not be the absolute be all end all tool in the shed, but it works, it's supported, it most likely powers an indie game that you've been playing on Steam, works in VR titles including an FPS, etc.
Anyone had much success using Garry's Facepunch.Steamworks library and setting up connections with the master server?
Better to have a project fail because your networking library canโt handle the millions of users than to fail because it never gets finished.
Could mirror do 64 player servers across 3-7 servers?
I would expect it to do that on one server.
@deft halo To answer your question, Mirror doesn't support "across servers". There is no functionality to link servers together. That sort of infrastructure can get complex very easily, as you have to keep clients on server 2 in sync with activity on server 1 and 3 as well as server 2 activity.
Each server also has to keep the other server's world updated, so if a nuke went off and destroyed a town on server 3, then client in server 1 and 2 "know" about it. Even discussing it is starting to throw my head for a loop, it's complicated 
Your game would have to have some specific usage case for cross-server, I understand some MMO games might offload clients into smaller mini-servers that run dungeons and then return you back to the main world server.
So I'd probably say please elaborate for a more specific/detailed answer
Im just trying to create a battlefield like game with 32vs32 on 3-7 servers at a time
Hello! Is there a tutorial/example somewhere on how to do non-blocking sockets? My socket/TcpClient connection works fine otherwise, but it's freezing the whole program while it does its thing, and I'd prefer it didn't. But I somehow can't google how to do non-blocking sockets in Unity.
Set the socket to non-blocking mode or use the async API?
How do I do that? Set the socket to non-blocking mode I mean. That's what I was trying to find out.
Unity socket/tcpclient doesn't seem to have that property, or I don't know how to access it.
what exactly are you trying? can you show some code?
I'm just trying to set the thing you just linked, in Unity, with C#
this works for me ```cs
var s = new Socket(AddressFamily.InterNetwork, SocketType.Dgram, ProtocolType.Udp);
s.Blocking = false;
TCP Client is a an abstraction on top of a socket connection and has no non-blocking mode
Great, I should be able to work with that, thanks for the help. ๐
(The problem with my code currently is that it's like var s = newTcpClient instead of var s = new Socket, but maybe I can convert TcpClient into Socket. I'll look into that.
what do you actually want to do?
Just send a message (a string) over this kind of socket connection
I just wrongly assumed TCPClient has a blocking mode that I couldn't find, that was the problem. ๐
does that string have to be sent 100 times per second?
Nah, just once. ๐
and do you have to conform to a specific protocol on the other end?
Hmm, I don't think so.
well, do you write both ends?
Yeah, the server is in python and the client is in C#/unity
just send a HTTP request
python has plenty of very comfortable libraries for that, and you can use UnityWebRequest or System.Net.HttpClient
Fair enough. ๐ If you're suggesting rewriting an entirely different approach, then I guess switching from blocking to non-blocking socket wasn't going to be easy like I hoped.
well, HTTP does a lot of extra stuff you don't need, but from a getting it done point of view, its probably simplest as it is the most common thing that happens in the world today
its not hard, but you have to do everything yourself, read some docs etc. or maybe run the TCP client in a thread and schedule main-thread callbacks... or use one of the many transport libraries like Ruffles, Enet, LiteNetLib
Gotcha, maybe http will indeed be easier then. Thanks again!
actually you got me confused there for a bit... TcpClient ofc has an async API you can use TcpClient.ConnectAsync
Oh, awesome
Guess those will be easier to spot once I'll be more familiar with the terminology. ๐ I see now that it's right there. (But I was looking for "non-blocking" instead of "async")
Battlefield doesnโt use multiple servers per single match. Battlefield is solely single server, up to X players. Donโt complicate things. Trying to keep server states synchronised between servers is difficult and requires a lot of know-how, otherwise you will desynchronise very quickly.
If youโre going to make a FPS, look into dedicated single server that acts as god, while the clients send commands and messages to the server to perform the stuff on the server. Server Authoritative is the keywords you want. Mirror is server authoritative by default, so it can be a starting point.
I am working on a FPS project that will initially support 16 player matches (8v8), and if I can achieve that, Iโll scale it up to 20/24/32 player matches.
If you want to support extra players, simply spin up another server instance. Server 1 can run at maximum capacity while Server 2 takes the leftovers.
Thinking about it, if you wanted 32 players on each of the 3 to 7 server instances, then yes, Mirror can do that. But if you wanted 32 players spread across 3 to 7 servers running the very same game instance, then No. Multiple servers trying to keep each other server in sync is gonna be murder. Especially with lag involved, if you have region specific servers.
It has been done before for MMO RPGs, but I have yet to see a shooter that spreads its clients over server shards
yes, thats what got me confused for a second aswell. the implementation blocks, but you can always run it in a thread so it will only block that thread... that you can do with any blocking method call... but its annoying to construct all the sync around that so an async API is nice.
this may seem like a weird question but I've never really done any networking stuff... how does Mirror interact with Steamworks.net/Facepunch? Both have server client commands so I don't get it. Can I just make my multiplayer stuff with Mirror and pass it all over to steam when I'm done?
You use the steam transport for mirror. This doesn't change anything about how mirrors api works, it's plug and play.
yo quick question is there an networking system that can cross platform with unity and mobiles ? if yes how do you call
Thanks!
?
Most network systems work cross platform, as they use common network protocols to communicate, for example photon
Hello.
I'm having an issue with the tutorial for the Netcode thing on unity. Specifically, the Helloworld "client/server/host" only work for "host", not "server/client" (it rely on the spawnManager to provide a player object from a "GetLocalPlayerObject" which returns "null" in the case of a server instance. Which prompts the question : How do I get the clientID in that scenario ? :/
nvm I'm an idiot
there's no clientID because it's the server instance. doh.
is there a modern/netcode alternative to NetworkBehaviour? it's listed in the docs as deprecated, but it's also used in the example docs for netcode
Which docs are you looking at? That should not be deprecated
i see now that
NetworkBehaviour is an abstract class that derives from MonoBehaviour and is the base class all your networked scripts should derive from. Each NetworkBehaviour is owned by a NetworkObject.
this is the correct version
was just confused for a bit, hahaha
Anyone familiar with facepunch for steamworks? I don't know, all they have is a documentation of their commands but barely any code examples except for the most basic stuff... but people say it's better than using steamworks.net as that one is using outdated p2p connection instead of steamsockets
I can find code examples and tutorials on how to set up a lobby and be able to invite friends to your games for steamworks.net, but none for facepunch
nonblocking mode in Unity's mono version does not work.
it's actually blocking sometimes.
it does have the property somewhere, but see my message above.
TCP in unity is very difficult.
async/await, SAEA, nonblocking methods are all not working well, or not at all.
1 thread per connection is the only solution that scales (in Unity).
outside of Unity, the other methods are way better.
Thanks for the heads up, I really appreciate not having to spend tons of time just to eventually arrive to this conclusion myself ๐
you just have to explicitly run async code in a separate thread/threadpool to work around the unity synchronisation context that, by default, runs await'ed method calls on the unity main thread. That context also introduces a Thread.Sleep(1) at the end of each scheduled task which causes unexpected performance problems with netcode... all of those things can be mitigated and networking works fine in unity without spawning 1 thread per connection. It is nevertheless a good idea to use a transport layer that has all these things worked out already.
Mirror
Uhhh
Explain the problem
Words can be better than video some times
Looks like a null reference exception
Check your variable/component assignments
No one knows what networking youre using, we cant help
you'd need to ask in MLAPI (Unity Networking) Discord since that's what you're using.
interesting. anything else you can share?
- run in new Thread()
- overwrite sync context for that thread / all threads
and thatโs it?
I am surprised you mention that. nobody figured this out for 5+ years afaik
you can try our Telepathy low level transport (free open source)which does just that. itโs a work horse really, battle tested for years.
will try a version with Anikkis suggestion too.
I did not figure that out myself. I just look at how other people do it in well regarded libraries/assets and research their reasons for doing what they do
Beyond that I like to verify that stuff people post online is actually true when they have given no explanation
That being said, the sync context allows you to do fully custom scheduling and bypass the sync system altogether aswell. Performant netcode does not require a custom sync context, it can just be tripped up by the standard one.
@austere yacht thanks!
heyaaa,can someone please help me with something?
im trying to figure out how to shoot with mirror,but cant find any sort of help at all
and im stuck on it since a couple of days
can anyone help me?
Does your code for shooting work without networking?
yep!
the only problem is that i cant find how to make it so the bullet appears for all players
also sorry for the late answer,my wifi died a bit
but yea,the problem is with instantiating it for all players
where can i get help with some photon problems?
check out the tanks demo that comes with mirror!
oh,where do i acces it?
oooh,found it!!
MLAPI NetworkRigidbody, will this use bandwidth if the object is not moving?
I think you should join the Unity Multiplayer Networking Discord linked in the pins here, you seem to ask that question but never get an answer, and those guys will be able to help you a lot quicker
ok
Hello. Are there in here familiar using Mirror Networking? I wanna ask about how to do unit test in unity in multiplayer game that using Mirror framework. When I add assembly definition in script folder, there cause a lot of error in the Mirror assembly (maybe). So, any solution of that problem?
Error shown like in the picture. There is some problem or conflict in like syncvar, command, etc in Mirror when I add Assembly definition GameAssembly in script folder. Please help.
You need to add a reference to Mirror ASMDef.
Like so.
@sturdy juniper see above.
Alternate solution is to delete the ASM Definitions in Mirror folder, however it's 2021 and you should really learn ASM Definitions and keep your main code chunks out of Assembly-CSharp.dll. For example, your code can be like MyStudio.MyGame.Core or MyStudio.MyGame.ReallyAwesomeModule
Refer to the Unity Scripting Manual for more information.
Add reference Mirror.asmdef in my assembly definition? or in test assembly on folder tests?
The former.
Did you install Mirror via Package Manager/Asset Store or did you install it from Git?
package manager
You shouldn't have a "Mirror.Tests.asmdef" if you're using asset store/package manager release.
ok
Basically this
in your scripts folder, make a ASMDef
call it whatever.
click it, add under dependencies / references
Mirror.asmdef
hit apply
Unity will recompile. Now the only downside is you will need to have all your code inside a ASM Definition.
But that's easy. Just make a scripts folder where all your stuff is stored and one asmdef, then link it up.
That is work, thanks for help
I'm working on the networking for my game. Should I use unsafe code? Is the extra performance worth it?
heya guys,i have a problem
my bullets only seem to show for the host of the server when i spawn them
i've followed around with the examples
but it just doesnt want to work
can anyone help?
im using mirror
they seem to spawn for the host
but not the client
this is the code for spawning the bullet
hi, anyone can help me with unity transport?
i've copy paste the sample script from https://docs.unity3d.com/Packages/com.unity.transport@1.0/manual/samples/jobifiedclientbehaviour.cs.html
and
https://docs.unity3d.com/Packages/com.unity.transport@1.0/manual/samples/jobifiedserverbehaviour.cs.html
edited some line (because somehow it broke up on IJobParallelForDefer so i use IJobParallelFor instead) and upload the server with linux build to my Digital Ocean (Ubuntu).
then i got this warning (attached) and no messaging works. theres no error.
this only occurs on the server. if i test it on local (127.0.0.1), it works perfectly
You need to make an RPC to spawn bullets
Rpc?
its kind of a long topic. but basically just do more reseach on what RPC s do
sorry i have a hard time explaining things to people
that's just the way am built
Can anyone help me with making NPC over the network
using mirror . . . . .
It's allright,don't worry!
little update from here. turns out my UDP port is closed on the droplet settings. now my client can connect to the server
but the warning persist
its kind of annoying tbh
https://mirror-networking.gitbook.io/docs/community-guides/quick-start-guide#part-20 May be this will help you more
Written by JesusLuvsYooh / StephenAllenGames.co.uk, edited by James Frowen
Depends on what the NPC needs to do
if you want to have it wander around, make sure you run its logic on the server, NOT on the client. Mirror has mechanisms for that.
Please be more specific when it comes to networking questions. We don't know what you want the NPC to do over the network ๐
Hi, I need help getting a game to run on an old version without it updating. Me and my friends have 2018 files for Star Stable Online and are a team going by as "Star Stable Archived" with a website in the making. The game only runs on the PXRouteruntimeMMO.exe file but the launcher seems to be broken. We wanna get it to run without it updating to the current version
Old version of what?
If youโre trying to reverse engineer an existing game to keep it alive, then this can actually be a violation of the games terms and service or EULA
If you are going to want to block the updater stuff, Use something like WireShark or a process monitor to study itโs endpoints and just set it to localhost in your hosts file. That way the game canโt phone home and upgrade. But to me unless that game is a unity game, youโve stopped at the wrong station.
@shadow spoke Sir, you seem knowledgeable -- I'll pay you 30 bucks if you can help me fix an issue with my project
After changing scenes using ServerSceneChange() my player object not only has all his references broken (despite appearing fine in the editor), but also loses client authority (despite being checked in the editor)
What framework is this?
Mirror -- Steamworks
I've looked at this for hours now without even understanding what can possibly cause it
How is the character being spawned? Is he being despawned on scene change, then respawned? Or is he being put into DDOL? If youโre using DDOL for characters then that is no bueno
Despawned on scene change, then respawned
Verified by debug.logging the spawn as well
Okay, so basically destroyed and then recreated?
Yes
Working completely fine on the scene change from offline to online
But when you change scene after that you get missing reference exceptions on everything
OK. So by references, what do you mean? Links to input manager, etc?
Yeah you could say that
But they are very clearly visible in the inspector
And can even be clicked to prove they link up correctly
I'm like 18 pages deep into google trying everything lol
Hmm...
This is a tricky one, I'm trying to think.
So you use references that you explicitly set yourself
Yes, and they appear just fine in the hierarchy in the inspector during gameplay
I assume you don't use like senpai = GetComponent<Senpai>() or anything in your code
Nope, these are manually set references
Does this happen on both client and server? Or one or the other?
That are nested in the object itself
Both
I'm certain that there is a deeper reason to this error than just face value
It's not like I'm brand new to this
No, just the default out of the box solution
Like in my head
There should be no way I'm getting a missingreferenceexception
When I can literally see the correct reference in the inspector
and click it
and it links properly in the hierarchy, even
Code is just health < 0 PlayerDeath() so nothing complicated there either
Like 4 lines of code
Yeah, and I assume health is causing NRE ?
No, that apparently links fine
It's seemingly random references
Some text in the gui, some scripts here and there
What version of Unity?
Ah, Unity 2021.2
Last time I had a conundrum like this it was literally just a fatal error with Unity
I'm on 2020.3 LTS and have yet to have it be spaghetti like that
And I was told to upgrade to fix the issue
Submitted fully reproducable bug report too
Ah
Despite documentation saying terrain supports 4+ layers in URP
You'd get fatal memory leaks only solveable by rebooting the computer and you'd soft lock your project
Occasionally brick it too
So it would be completely ruined
100% reproducability too lol
Ah, Unity... as much as I love your engine please pay the QA devs more to fix these bugs before they make it into gold releases of Unity
Ahem
Ok, idk exactly what I can do about this issue but I really appreciate you taking time to help me try to troubleshoot
One final bullet in the chamber, though... What I would do, just to rule out Mirror being janky with commit that broke it, is downgrade it to a few versions before. I know Package Manager doesn't let you do this but you could grab like Mirror 46.x (which is what Mirror LTS is based on) and try that
But from what you describe
I don't think Mirror is at blame here. I think we're stepping on land mines and they're just delayed explosions
I can try to comment out any netcode and see but
lol
I fixed it looks like
Deeper into google than a dwarf in Moria
What, talking about it fixed it?
Like the literal exact same problem as me
And turns out it's delegates that are the problem

Despite me using Debug.Log and it only actually prints once
Literally checked this
Need to manually remove the delegates
Before object is destroyed
Ever heard about this?
Kinda ran into it myself when using event related stuff
BUT
not on the severity like yours
What was the case for you?
Just me being dumb
i have a problem.
im using the photon 2 and i have the player prefab have a camera since this is an fps game.
i wish to find a way to assign the camera to each player
It is not advised to put your camera as a child sub-object as your player object. Instead, what you can do is make an anchor point where your local player camera attaches to. Then, when you spawn your network player, you have a script that runs only if this is your object. Attach the camera, done.
I've seen a lot of kits do this on the Asset Store and it is smart to do so.
If a camera was a child of the player object, then you will spawn another camera and that will double/triple/quadruple.... the camera draw calls since a full camera is drawing on top of another, etc.
what is an anchor point and how do i use it?
An anchor point is simply a empty gameobject at a XYZ position in your object
For example, for "body awareness" FPS games, the camera is around the head area, usually 0.075 - 0.15 units "in front" of the body mesh
ok, and i guess i can add the anchor point a script to rotate it and because the camera is attached to it it will rotate aswell, am i correct?
Yeah. So you set the camera as a child of that new anchor point. It's position then becomes 0,0,0
so it'll follow the position/rotation of the parent
ok then, now, how do i make sure the local player camera attaches to the anchor point?
Simple. You'd make a script that references the camera ONLY if it's the local player.
You'd ask PUN2 if that object is yours and if so, do something
how do i reference the camera if it's not in the scene?
Are you spawning the camera via script?
i thought im not supposed to spawn any cameras?
What do you mean?
you said i need to only have 1 camera because it is the oh wait i get it now that i can hear myself saying it
basically i can have 1 camera in the middle of the scene
but then how do i assign the camera to the reference since i cant use GetComponent<>();
how?
I'm going to write this in Mirror-style networking, because that's what I am most fluent in, but I am confident you can understand and adapt it to PUN2.
ok
basically just tell me how to reference the camera ONLY if it's the player's view
Camera TargetCamera;
GameObject Anchor;
// This, in Mirror, is called only if it's local
// Can't remember the exact name, but it's like OnStartLocalClient or OnStartLocalPlayer something idk
private override void OnStartLocalPlayer() {
TargetCamera = Camera.main;
if(TargetCamera == null) {
Debug.LogError("Is there really a camera in this scene?");
return;
}
if(Anchor != null) {
targetCamera.SetParent(Anchor);
targetCamera.transform.position = Vector3.zero;
}
}
so I guess in PUN2, you would wrap that code into a isLocalView check in whatever function, maybe in Start or some PUN2 initialization callback
i think im getting the hang of it.
so basically there is an anchor for each player and if there is an anchor then the camera is set as a child to the anchor and sets to it's position (i can also use this for the rotation).
i can then use the update method to rotate it
im gonna need to learn more about isLocalView but so far this sounds briliant
thank you, i will add your name to the list of people from this server who helped me
No worries. Networking journey is a long one, just remember to ask for help when you need it.
i kinda wanna finish the project before saturday but the game is pretty simple (after that all i have to do is implement teams a timer and im done)
hello
i am unaware on how to implement this after many trials, can you please elaborate on this code?
Uhh
I am not familiar with PUN2's system
I guess I could take a look at a quick written PUN2 tutorial
but basically it would be a script that has PUN hooks
i mean for starters im not sure what object should have the script you gave me
The player
what part of it?
Stick it on the root
on the parent of everything?
can you please explain in more details so i can visualize it in my head?
i am sorry i do not mean to cause annoyance im just not sure on the implementations
i know where to put it but not really sure what to put in the script
for starters i dont know how to use a quaternion to reset rotation
https://doc.photonengine.com/en-us/pun/v2/demos-and-tutorials/pun-basics-tutorial/player-camera-work
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!
If you don't know the basics of that...
ok thank you
I honestly recommend brushing up the basics of unity, like quarterions and stuff
Making your own camera can be a pain in the butt
i kinda need this before sunday
why?
Let me ask you this
Do you have any code at the moment that works with PUN2?
If the answer is no... then ๐
By that, I mean any network related code, such as but not limited to, movement et al
yeah, i have scripts that work with it
im still not sure on how to implement this
I wrote this on a whim, I don't know PUN2 enough off the top of my head to dive deeper.
using UnityEngine;
using Photon.Pun;
using System.Collections;
public class LateNightHelpingUnityDevsInADiscordChannel : MonoBehaviourPunCallbacks {
#region Configuration
[SerializeField] private GameObject cameraParentTransform;
private Camera attachedCamera;
#endregion
private void Awake() {
if(cameraParentTransform == null) {
Debug.LogError("The parent transform to attach the camera to is not assigned.");
enabled = false;
return;
}
if(Camera.main == null) {
Debug.LogError("There is no Camera tagged as MainCamera in your scene.");
enabled = false;
return;
}
attachedCamera = Camera.main;
}
private void Update() {
if(!photonView.IsMine) return;
if(attachedCamera != null && cameraParentTransform != null) {
attachedCamera.gameObject.SetParent(cameraParentTransform.gameObject);
attachedCamera.transform.position = Vector3.zero;
}
}
}
i can manage that.
if its night for you then please go to sleep, your health is more valuable lol
GameObject does not contain a definition for set parent
Try attachedCamera.gameObject.SetParent(cameraParentTransform.gameObject); to attachedCamera.transform.SetParent(cameraParentTransform.gameObject);
ok wait
now it cannot convert from GameObject to Transform
remove the .gameObject part of the stuff in the ( )
ye im dumb i didnt see that part lol
should i drag the main camera to the "camera parent transform" slot?
is the "Camera Parent Transform" slot meant for the main camera in the scene?
it's the location where the camera should be
so should i drag the anchor?
ok wait i will give it a try
it wont let me create a tag named "MainCamera"
i didnt see it dear gosh im dumb today
this is in play mode
the camera is not in the transform of the anchor
ok
try changing the vector3.zero in the position assignment to attachedCamera.transform.position
unity is probably faffing around
this is after i changed to attachedCamera.transform.position
okay, let's try changing it to new Vector3(0,0,0)
shouldn't it be Vector3(0f, 0f, 0f)?
if i remember correctly vector3 is a float (i mean not a float but it recieves floats)
"Non-invocable member vector3 cannot be used like a method"
should be fine either way
but it doesnt work though

hello, i wanna do unit testing in unity that implement mirror for networking. But, when I call function that derive from NetworkBehaviour, there is error like this. So, any solutions?
please help, thank you
function that I called is roomUI.UpdatePoliceCount(1);
you're probably sleeping but i just want you to read this when you wake up:
You're amazing!
I figured out the problem, i should have been setting the transform.position of the camera to the anchor.
i will now test this in multiplayer.
this is the function. I make that in class that derived from NetworkBehaviour
For better help regarding Mirror please use the Mirror discord
thanks a lot!
it works in multiplayer!!!
now go to sleep now please, i want you to take care of your health.
@sturdy juniper Check the sidebar on https://mirror-networking.com. I am not going to link the invite URL directly as I could get flagged for spam and I don't want that ๐
@lean anchor Will do. Have a good rest of your day ๐
๐
i have a problem.
i cant sync animations in the PUN 2 networking because i need to have the Photon Animator View component on the parent object that has a child that is animated
i want to sync the animation of the child however when i add the component to the child it doesnt sync
I have a problem
i managed to set up the animated object as the parent but now the animation sync straight up doesnt work
nvm found solution just set it to continious instead of discrete
Steam doesn't have their own multiplayer solution right?
If anyone is interested in evaluating a new multiplayer solution that is easy like photon, but fully server-authoritative, send me a note. We're letting people try it out (at no cost, in case you were wondering) while we're finishing up some stuff.
Basically it's a system that lets you build multiplayer games on a custom back-end from Unity. Deploying and running your online code takes a couple of button clicks.
The server-side API offers full orchestration functionality (ie. rooms can start/stop/callRPC other rooms etc.). Also, it can sync an insane amount of dynamic objects at very low bandwidth, full state syncing, built-in prediction system, full 3d server-side kinematic physics, and will work with web/PC/mobile/console targets out of the box, with crossplay if you want it - all of this is working right now.
We've been using it to build some games and tools of our own - Scene Fusion for example. We're at a point where we can start letting other people try it out.
If anyone is interested, shoot me a DM.
check out mirrors built in unit tests to see how it can be done
they have steamworks(?) transport. and their own engine seems to have networking built in, there are several articles about it
I'm using Netcode for GameObjects and Relay. When a client connects to the host (me), my computer crashes and I get a blue screen.
I'm not even sure where to begin to identify the issue.
Tried a clean project? What's the BSOD? Can you run something like BlueScreenView and get the error?
If you get a BSOD from a network library then something is seriously wrong
Maybe also temporarily disable your security (Windows Defender, Norton, whatever) just for a few minutes to see if that's causing a problem
Windows can be super janky when it comes to random crashes
@shadow spoke I looked up the BSOD stop code that it might be related driver issues. I disabled my VPN and now my client is able to connect without a BSOD. :)
Oh yeah
VPNs and game development can be problematic
They are a valid use case (ie testing latency), but I personally only recommend using them if you have a remote server, instead of going your PC -> VPN -> Relay -> back to your PC
It didn't occur to me that it could be an issue, but I'll keep it in mind now.
90% of the time VPNs are fine
but it really depends on the quality of the VPN product, some VPNs are great but have really crappy client drivers and software
And all it takes is something to run stuff through a code path that hits a crappily coded section of the driver/software and boom, BSOD. Especially kernel level
Something dies unhandled in Windows kernel? BSOD. At least on Linux you'll get an "Oops!" warning and that module gets unloaded
But that's nerd talk

Hey!
I try to get values from DynamoDB through Lambda by using API Gateway.
I managed to get data defined only if they are string.
When I make nested classes and try to get the whole structure, I could not define.
public class Restaurant
{
public string Id { get; set; }
public string RestaurantName { get; set; }
public string Phone { get; set; }
public string City { get; set; }
public string RestaurantSlogan { get; set; }
public string Email { get; set; }
public List<Catalog> Catalog { get; set; }
}
public class Catalog
{
public string CatalogName { get; set; }
public string CatalogID { get; set; }
}```
public async Task<Restaurant[]> GetAllRestaurants()
{
ScanResponse result = await _amazonDynamoDb.ScanAsync(new ScanRequest
{
TableName = "test"
});
if (result != null && result.Items != null) {
List<Restaurant> restaurants = new List<Restaurant>();
foreach (Dictionary<string, AttributeValue> item in result.Items) {
item.TryGetValue("Id", out var id);
item.TryGetValue("Catalog", out var catalog);
restaurants.Add(new Restaurant()
{
Id = id?.S,
Catalog = catalog?.
});
}
return restaurants.ToArray();
}
return Array.Empty<Restaurant>();
}
}```
how can I get the Catalog value from this AWS lambda function_
trying to integrate steam. how can i fix these
i wish to implement a system of teams.
i need a way to implement it since im new to networking (using pun 2)
how it works is basically i wish to have all players start on the same team, then 2 players randomaly die on that team.
whenever a player dies they change team
what i want to do though, is have a different player model for each team
and i NEED to have the model for team 1 be the root object otherwise it wont sync animations
heya,can someone please help me figure out a fps camera?
i've tried to many things already
and it just doesnt seem to want to work
if you want one for multiplayer i have a solution for you
first, you only need 1 camera in the scene
then, go to the root object of the player and add an empty object at the position where you want to place the camera. call that object "anchor"
after that, add these 2 scripts to the root object of the player (assuming there is a main camera in the scene)
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.
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.
im going to go somewhere for a few minutes but then ill be back
i have something similar to that
actually,it would help you if i shared how it work and the code,right?
im using mirror btw,for ref
one second!
{
if (isLocalPlayer == false)
{
return;
}
cmdinitiatelook();
}
[Command]
void cmdinitiatelook()
{
rpclookaround();
}
[ClientRpc]
void rpclookaround()
{
float mousex = Input.GetAxis("Mouse X") * mousesensitivity * Time.deltaTime;
float mousey = Input.GetAxis("Mouse Y") * mousesensitivity * Time.deltaTime;
xrotation -= mousey;
xrotation = Mathf.Clamp(xrotation, lookdowndistance, lookupdistance);
cameraplayer.transform.localRotation = Quaternion.Euler(xrotation, 0, 0);
player.Rotate(Vector3.up * mousex);
}
oh
think you could at least give a idea on it?
i can try to give more info where i can
the problem that i've ran into and just cant seem to figure out is the fact that the camera rotation doesnt work at all
either all players can controll it for other players too
or it doesnt work at all
the left-right works perfectly fine either way
just looking up and down
and honestly,i've kinda hit the bottom of the idea barrel on my side
im not really sure how that works im burnt out rn so bad
it's allright,you dont have to answer to it if you dont feel like it
yeah its fine
its mostly if anyone using mirror has figured it out .,.
This code is....craziness. Mirror has it's own Discord for support (see ReadMe).
can you send me their link please?
don't think I'm allowed to put discord links here, but it's on the asset store page and the readme in the Mirror folder
i was saying in dms,but allright
"Resources": {
"GetRestaurants": {
"Type": "AWS::Serverless::Function",
"Properties": {
"Handler": "backend::backend.Functions::GetRestaurantsAsync",
"Runtime": "dotnetcore3.1",
"CodeUri": "",
"Description": "Function to get a list of blogs",
"MemorySize": 256,
"Timeout": 30,
"Role": null,
"Policies": [
"AWSLambda_FullAccess",
"AmazonDynamoDBFullAccess"
],
"Environment": {
"Variables": {
"BlogTable": {
"Fn::If": [
"CreateBlogTable",
{
"Ref": "BlogTable"
},
{
"Ref": "BlogTableName"
}
]
}
}
},
"Events": {
"PutResource": {
"Type": "Api",
"Properties": {
"Path": "/",
"Method": "GET"
}
}
}
}
}
Hello people!
I could not manage to change the "path of the method" for API Gateway. AWS Cloud formation.
I put for instance "restaurant" before the '/' but response is 500.
Using Netcode for GameObjects, I'm unable to see the walking animation of another client when connected over Relay, the idle, jump, and fall animations all seem to play just fine, but walking around, the other player moves, but doesn't animate.
I believe the walking animation works just fine when connected over a local network, but now that I've setup and connected over Relay, it doesn't appear to play the walking animation when the other client walks, you can see your own character walking.
Quick question does connecting unity clients to dedicated server is an networking system that could work on steam
An answer to my question above regarding character animations is I think the client needs to manually update the server using RPCs of it's own animation states (which I thought was the job of NetworkAnimator but I think it only works properly at the moment for games that are fully server authoritative). I believe this is accurate, though I might not be describing it entirely correct.
Steam is P2P networking via SteamWorks. Steam users connecting to dedicated servers is usually just steam acting as a authentication mechanism
Yea. Networktransform and Network animator are fully server authoritative.
There is a clientnetworktransform but there is no clientnetworkanimator
It is inconvenient, I wish there was a ClientNetworkAnimator, but I can work around it.
How can I set a GameObject to my client's player object in photon unity networking?
Hey, anyone have any quick fixes for me? I set up a lobby, received the callback OnConnectedToMaster, and it joins and works just fine locally, with multiple windows after being built.
When I build to WebGL, it stops working, I tried to understand the logs, and even tried calling OnConnectedToMaster manually to see if that would help, but I keep getting
Client is not on Master Server or not yet ready to call operations. Wait for callback: OnJoinedLobby or OnConnectedToMaster.
Would appreciate any help, been struggling for a while lol
For the code: https://github.com/NathanMLu/Final-Project
hi, hope is the right channel. any advice about how to validate client data before save match result into external database (for this i can use webrequests, but how to be sure user dont inject modified data?)
it is for a multiplayer game, for example the ranking. the match end, i need to save result and points to the database, avoid any try to hack the data sent.. there's some useful doc/lib/tutorial for this?
thanks
note that you can not use UDP in WebGL, so TCP only. That would seem like the most obvious problem going from desktop build to web build
Based on the callback names, they are using PUN, which should change the transport based on platform.
yeah but be careful with assuming, I'd name my methods the same, and I've never used PUN before!
Yeah, I think it automatically gets changed to WSS, like this screenshot. Could that the problem? I've even tried doing the callback manually after the scene is loaded but no luck
I think the wierd part is that it works just fine when built to .exe but not to webgl
Yea don't call the callback manually. It asks you to wait for the callback because by then PUN should be in the appropriate state.
I would change the logging levels in Photon settings to be more verbose and make sure the connect methods are called
How are you running the WebGL build btw? Nvm, I see the URL.
WSS won't work for localhost, you'd need a domain with a valid certificate, I think
you can try WS if that's possible
Could someone point me to some tutorials, or explain to me how server and clients work? I created a server with playfab/mirror via a tutorial that is hosted on a VM using docker, but I would like some help with explanations regarding for example how playerstatistics are stored and how they are shown on the client. If my played leveled and they wanted to up their stats, I would have to send a request to the server(playfab) and then update the client(mirror) as well correct?
From what I understand the client is what the player sees and theserver is where the data is actually stored, so how are those two able to communicate via playfab and mirror?
I watched some tutorials from azure playfab on things like creating player data and storing it in the server, but they didnt explain how it would be displayed on the client
I do this shit single player only
Do you get the network message on your client already? Like its up to you what you do with the data after you recieved it, or do you struggle with gettin the data already?
So well,
I asked this question on Mirror server, but didnt got any answer, so im asking here
Could anyone give me any direction that i could take to achieve it?
Who in here is familiar with Photon? I need help with something, but it's going to be a looong long conversation about what I've done so I'll need someone to be able to talk to me through DMs or something so that the chat's not hijacked
use Threads
Ya know, right click your own message and make a thread
to keep this chat clean but also to give opertunity for some ppl to learn smth new
ok good point
Photon for a card game help
can anyone help me again to fix this problem with mirror
I control the other character and not the right one
@haughty idol Okay so basically you know, you need some way to identify if the spawned player is remotePlayer or if its localPlayer
for remotePlayer you need different scripts to be disabled and enabled
i've had a video from Brackeys but he made it for UNet
If you think you could understand the concept and move it to Mirror's one
i can give you the link
I programed if(islocalplayer) and a return function, but it didn't work
Please give me it
actually try doing like
if(!isLocalPlayer) return;
in the 'LocalPlayer' script
We start adding multiplayer functionality by setting up a NetworkManager and spawning the player on the network.
โ Download cool Weapons: http://devassets.com/assets/modern-weapons/
โ Download project (GitHub): http://bit.ly/1JOvQ61
โฅ Donate: http://brackeys.com/donate/
ยทยทยทยทยทยทยทยทยทยทยทยทยทยทยทยทยทยทยทยทยทยทยทยทยทยทยทยทยทยทยทยทยทยทยทยทยทยทยทยทยทยทยทยทยทยทยทยทยทยทยทยทยทยทยทยทยทยทยทยทยทยทยทยทยทยทยทยทยทยทยทยทยท...
here
he explains how to disable things
but it might be old solution
i would suggest you checking how Mirror's recommends it
also timestamp if the link didnt worked for you somehow
@haughty idol also check this:
https://forum.unity.com/threads/how-to-make-multi-player-movement-with-mirror.1176137/
the third response
(please do note that im just-a-random-guy who joined day ago,
im fresh and new here too, and i do not obtain knowledge that other ppl do)
O
thanks ๐
Hey if I am in different scene and join a lobby with different scene, would my game switch to that scene?
How to sync walking (moving)? Using NetworkTransform or sync using my custom funtion?
I was able to set up a server with playfab, I need tutorials now on how playfab and mirror can communicate with eachother. For example, how do i display stats on a character from their view(client). Mirror and Playfab would have to speak to eachother in some form, correct?
Playfab has a Rest API that you call to store or retrieve data
how do i make a client control the transform of a gameobject in mirror



