#archived-networking
1 messages · Page 121 of 1
fusion is the modern replacement of PUN with a lot of added features
Any recommendation on which one?
no, they all get the job done
mirror has the best community support
Alr I'll look into mirror thanks
netcode is more low level than mirror and fusion
Hmm
fusion is the most advanced library for typical session-based games (MOBA, FPS, ARPG, Fortnite etc) that is available for free
Well I might try mirror as it has good community support and I'll assume more tutorial?
Thanks
Sorry for the long talk
All networking libraries are bad imo
They are great if you don’t code I guess, but if you’re a programmer you should be avoiding them at all costs imo and learning how to write actual net code
Yeah and maybe 3 years later you finally start your own game
Libs and frameworks have their purpose
with pros and cons
Does anybody have recommendations for a networking library? I've looked into fishnet and it looks promising
I like Mirror, very easy to get to grips with
i've also heard about face punch, any thoughts?
I hear facepunch switches the language of steam integration from c++ to c# or something like that
I think I might use that
Maybe in like a week you mean?
Client/Server architecture is pretty standard across programming lol
I agree they serve a purpose, but that purpose is mainly around not having to deal with netcode
and for most games that want to be something, skipping your netcode isn't what you want haha
I mean looking at this channel is kinda all the proof you need
It's 99% people asking questions about a library
meaning no one is learning anything here
Unfortunately, this is #archived-networking-assets chat not #archived-networking
You need to forge the hot iron with your bare hands if you want to be a real Scotsman
you are probably contrasting PUN to writing your own transport layer
Yeah idk I will admit I work on netcode that isn’t really supported by any library
There is a world of situations between the two that benefit greatly from libraries
So I’m biased because of that. Knowing that using a library would get me nowhere.
Because it’s not magic. Physics networking needs to be tailored custom to every game
usually homebrew is great when the tech is new but over time it becomes ridiculously less productive except for the most high budget productions
It’s basically one of those things that if you work with it, you would know it’s impossible to create a product that would be broad enough to work for a lot of games
Client side prediction with physics and state rollback, that is
So my personal opinion is that Fusion is a falsely advertised product and there’s no way that it wouldn’t get you stuck in a hole
all that stuff isn’t handled by the popular libraries
You can’t standardize that, so they don’t
I guess that’s my point and it’s a small one
But there’s very little you can standardize on in networking for games
Fusion is a fps framework for a very specific game
So it’s a better investment to learn networking principals than to spend that same time learning a library
It’s not Fusion then, it’s Quantum I think
Idk what libraries you have in mind here but most are just thin convenience layers on to of a transport
You still need to think hard about your data and sync strategy with most of them
Fusion and quantum are very opinionated
Yeah I’m obviously in the minority
I’ve did C# for 15 years before I started Unity
So for me something like LiteNetLib was wayyyy more attractive than using a netcode library
Especially having the flexibility of running servers outside of Unity
I can emphasize with that
You need to spec your requirements, do your own research into all the options you have, then flip a coin
i dont know anything about networking
so idk
im interested in either netcode or facepunch
Maybe fix that ‚idk‘ part first
maybe
No library will enable you to suddenly become a competent netcode developer
also none of the popular (and current) Libraries will prevent you from making a reasonably ambitious game
@odd apex Facepunch is a company
Maybe you’re talking about the Facepunch.Steam library?
yeah the steamworks facepunch
Which is a native C# library for Steam instead of using the official C++ one
ye
Yeah that won’t handle networking for you
oh wat
Well it will, but gameplay networking and lobby networking are different
Steam can handle lobbies, and some matchmaking, but it can’t run game servers for you
So it’s technically not netcode
I just want to have 2 players in a game together
will netcode be able to do that?
i assume so
Sorry “netcode” is a blanket term for all code dealing with game networking
“Netcode For Unity” is something that I have no understanding of
oh i meant the netcode for gameobjects thing
Yeah I can’t help with that but I’d have to imagine it’s a netcode solution so yes
Yes, netcode can help you with connecting two player’s gameplay
so specifically in regard to netcode for gameobjects, on top of the transport it really only streamlines the connection handshake and a few conveniences for syncing object state at intervals, RPCs and authority management… all very generic. All the actual gameplay sync is up to the user to write themselves, including serializers for high frequency data changes and most datastructures
Good i like that a lot
rollback and prediction are completely absent
sounds like it's something i might have been able to make my custom netcode solution on with that level on control
I still like that my matchmaking server is pure C# with no Unity
so that might have been a limitation
but still good info
yeah, would not build that with unity
As long as I have control, i can make rollback and prediction work
because those are more theories based on logic
I'm glad i invested time to learn the theory because now i'm not tied to any networking solution
yes. You can even do that with mirror… all those mid level libraries let you hook into the message system directly, they do abstract the transport however. So you can only configure them but not use them directly. (But you can ignore even that any use them directly anyway)
Is it inferior to tags?
Superior
I planning on using playfab, (I dont want to pay a single penny lol)
is it a good free option?
It says it has 750 free compute hours. what does this mean?
does it mean 750 hours a month that it can be on
or is it 750 hours divide number of players a month?
not a good free option at all, the free tier only gets you maybe 350 hours per month on the smallest VM config if you are very careful
its 750 hours divided by the CPU cores your VMs use, minimum is 2
If you worked with server client on netcode, could you examine my problem? My post: https://forum.unity.com/threads/netcode-character-just-controlled-by-server.1305477/
I was about to make a multiplayer using mirror, but I found fishnet, and apparently it's better. Should I use fishnet instead?
A certain group of people believe it's better yes
Mirror is a tried and tested solution that's been around for ages
if I wanted to host my own multiplayer using my own pc, would you recommend Mirror or fishnet (very new to networking)
makes no difference
I like Mirror personally, very easy to get into. It's your choice though and there's not much difference between them
ok
all these libraries are essentially the same
Yes using both would be an awful idea
I normally compare and do the "better option" so whenever I see a possible "better option" I always wanna know which is better haha
if I'm using mirror, and also hosting a server from my pc, should I learn both at the same time, or focus on mirror, then add the server / storing data side
if you rely on the opinion of others for what's better you will never find out whats best for you
its like googling "best TV"... completely pointless, just makes you want stuff that you don't actually need
yea i guess
if I'm going to be hosting on my windows desktop, could I code on my macbook laptop then send files over? or should I code on my windows desktop
I need to make a system so I can only ask certain amount of question aday lol
guys how can i pass ref to spawned object by host
what do you mean? the spawned object can be fetch easily, its the return of the method
when the client spawn object object need refrence let's say stats script i pass it normal from the client and on the host the object have the ref and everything good but when host spawned and pass ref on the client the object don't get the ref i don't know why i hope u understand me
{
if(IsOwner)
{
if(IsServer)FireBallClient();
else FireBallServerRpc();
}
}
[ServerRpc]
public void FireBallServerRpc()
{
FireBallClient();
}
private void FireBallClient()
{
switch (num.FireBallLevel){
case 1:
Instantiatee(Levels[0],Locastion);
break;
case 2:
Instantiatee(Levels[1],Locastion);
break;
case 3:
Instantiatee(Levels[2],Locastion);
break;
case 4:
Instantiatee(Levels[3],Locastion);
break;}
if( num.FireBallLevel >= 5)Instantiatee(Levels[4],Locastion);
}
GameObject currentFireBall;
void Instantiatee(GameObject Level,Transform where)
{
currentFireBall = Instantiate(Level,where.position,Level.transform.rotation);
currentFireBall.GetComponent<NetworkObject>().Spawn();
PassRefServerRpc();
}
[ServerRpc]
private void PassRefServerRpc()
{
currentFireBall.GetComponent<Transfer>().Stats = stats;
}```
i think i need to just make it rpc even for the IsServer right?
RPC is only client
but it executes on the server
nah sorry the other way around
RPC executes from server to all clients
this code work on client without problem but on host nope it dosn't pass the ref stats
.
i'm not a very good helper on that subject sorry
i just told you my advice, and that's it 😦
Hi,
Question about steam networking:
anyone who knows its ups and downs?
and is it completely free?
and what is the best place to learn it?
thank you
Hi guys are there any docs for EOS in Unity? or how can i implement basic P2P function with maybe Mirror and EOS
Does anyone know how I should synchronise my procedually generated world?
I'm working with mirror
Send the world seed to the player when they join and use deterministic world generation
ye, idk how to send stuff over
im down to call and share my screen for simplicity
I'd appreciate if you show me how to do it
https://www.youtube.com/watch?v=8tKFF0RP9Jw Here's a good video on synchronising data between clients and the server
alright, ima check it out. Thanks
Good day to all! The question is, do everyone know that in multiplayer games there is such a thing that you go into the search for games and you are shown a list of available rooms? So, does anyone know how to do this? Maybe there is some documentation? Otherwise I can't find anything...
depends on the framework yo use
Unfortunately, I don't understand network technologies in unity at all, I had to write my server using these lessons: https://www.youtube.com/playlist?list=PLI9CK8e_e3MeDv8K1vi0FosBV4dKmcOo3 , but I didn't understand much and now I'm trying to add code on my own... But it doesn't work out very well...
well if you have your own servers with your own code, you're the only one that would be able to do such thing
everytime someone connects and create a room on your server, you need to store that somewhere, and make it so your players can get access to that list
that is, there are no lessons or examples of how this can be done? And there I would have collected my solution from crutches)
not sure, i would recommend you using an existing framework for doing multiplayer if you're not sure what youre doing
unfortunately, the only thing I found was lessons on photon network, but it does not suit me, because it imposes restrictions on the number of users
it's not restricted if you pay
but it's costly, obviously
Mirror doesnt lend servers
well what if you host your own?
or you make it like host+client on one pc
ye thats what im doing for my game. You can host a server and play on it and friends can just join you. Like in Valheim or minecraft bedrock edition
alas, there is no money to pay, and I have my own server that is just idle, I would like to use it somehow
ok thanks
Why are these not synching?
the red is the host/server + client and the yellow is a second client
You have the same options available as other games, you just have to implement one.
Direct IPs, server browsers, matchmaking...
where is this ?
someone here who could help me with basic photon pun 2 room leaving?
You can Google that, the method name is quite obvious if you think about it
Did you try that link
bro I thought we don't need to install mysql on the system if we have xampp already
sorry it's another subject
its for connecting to a mysql server
so we still need to install mysql server stand alone ?
I thought it's built in
if you already have one why do you want to install it?
that doesnt even have anything to do with what i sent
yeah it's another subject I'm sorry
Hi there, not sure if this is the right channel, but I'm not sure where else to ask. We're working on a large project that requires networking, and we've currently got a peer-to-peer implementation, but would like to move to a dedicated server model. I'm wondering, when it comes to headless servers, if there's any advice / good practices when it comes to the code architecture. How do you keep your client code and server code separate? Do you use custom defines, separate project, or do you keep it in the same scripts?
I think that you can take a look at https://www.youtube.com/watch?v=zrIY0eIyqmI
In this 2017 GDC session, Blizzard's Timothy Ford explains how Overwatch uses the Entity Component System (ECS) architecture to create a rich variety of layered gameplay.
GDC talks cover a range of developmental topics including game design, programming, audio, visual arts, business management, production, online games, and much more. We post a...
Aha, yes! I will have a look, ty ty
Good morning everyone, we have a Normcore problem.
in the project what we are looking for is any connected user/player can change values/attack/destroy any NPC. Because currently not all players can change the values of an NPC, only user 1 = Masterclient (that is the first player) can change the values 😅
Please, do you know how I can achieve synchronization that occurs from all User's VS all NPCs? without need or obligation that only the "masterclient" do it 😅 🧐
Local firewall on your side?
What does this mean?
I use ParrelSync to open the project twice and since starting it today, I got this error
pls ping me if you answer...
How would you guys implement low level messaging?
I mean like sending a msg in byte[] from one side and having it land where its supposed to on the other side and have it deserialize to the same type
Can we avoid the boilerplate that the type enums and factories bring?
The simplest way is to not reinvent a bicycle and use an existing solution, like photon, netcode or mirror.
Then you have http requests, sockets and what not it you want to reinvent the bicycle after all.
I am just using enet
Trying to have little more control
Also don't want unity dependency
In the networking assets I've used, these issues of mine would be handled with RPC calls
if you're already using enet, what is the actual question? The worse option is to reinvent something like enet, and the more comfortable thing (a mid level library) you dont want
I guess I just have to do some refactoring
public class NetStateMsg : NetMsg
{
public byte[] Data;
public override void Serialize(BinaryWriter writer)
{
writer.Write(Data.Length);
writer.Write(Data);
}
public override void Deserialize(BinaryReader reader)
{
var dataLength = reader.ReadInt32();
Data = reader.ReadBytes(dataLength);
}
public override NetMsgType GetMsgType()
{
return NetMsgType.NetState;
}
}
public class TimeSyncMsg : NetMsg
{
public float TargetClientTimeOnClientReceive;
public override void Serialize(BinaryWriter writer)
{
writer.Write(TargetClientTimeOnClientReceive);
}
public override void Deserialize(BinaryReader reader)
{
TargetClientTimeOnClientReceive = reader.ReadSingle();
}
public override NetMsgType GetMsgType()
{
return NetMsgType.TimeSync;
}
}
and this:
what is the question?
public class NetMsgFactory
{
private Dictionary<NetMsgType, Type> _msgTypes;
private static NetMsgFactory _instance;
public static NetMsgFactory Instance => _instance ??= new NetMsgFactory();
public NetMsgFactory()
{
_msgTypes = new Dictionary<NetMsgType, Type>();
// iterate child classes of NetMsg
foreach (var t in typeof(NetMsg).Assembly.GetTypes())
{
if (t.IsSubclassOf(typeof(NetMsg)))
{
var netMsg = (NetMsg) Activator.CreateInstance(t);
_msgTypes.Add(netMsg.GetMsgType(), t);
}
}
}
public NetMsg Deserialize(BinaryReader reader)
{
var typeId = (NetMsgType)reader.ReadByte();
var type = _msgTypes[typeId];
var msg = (NetMsg) Activator.CreateInstance(type);
msg.Deserialize(reader);
return msg;
}
public void Serialize(NetMsg msg, BinaryWriter writer)
{
writer.Write((byte)msg.GetMsgType());
msg.Serialize(writer);
}
// TODO: reuse memory streams here
public byte[] GetBytes(NetMsg msg)
{
var writer = new BinaryWriter(new MemoryStream());
Serialize(msg, writer);
return ((MemoryStream)writer.BaseStream).ToArray();
}
public NetMsg FromBytes(byte[] bytes)
{
var reader = new BinaryReader(new MemoryStream(bytes));
return Deserialize(reader);
}
}
I was wondering if there's a library to do these
The factory, the messeges
you want a generic serializer/deserializer for datastructures?
Polymorphic structures to be precise
not possible without getting yourself a PhD in the process
hmm
people use game/engine specific (custom) libraries because the generic solutions are too inefficient
boilerplate is somewhat the name of the game in all things networking
there are so many contingencies to manage due to the lack of any guarantees inherent to distributed systems
Hmm, let me ask you a design question
if you want self documenting types you need to use a format that can store the data and the schema, this is extremely inefficient when talking about high frequency network messaging as it is typical in games, in game networking client/server are paired in a way that they know which type a message must be at compile time
I have a GameCore that you inject your ecs systems, the player command handlers and it simulates whatever you have in your game
Lets say there can be different types of commands
like these:
CharacterMovementCommand { characterId, movementVector}
ShootCommand{characterId, shootVector}
DropItem{characterItem, itemIdToDrop}
I mean, I am having trouble coming up with a system without polymorphic messaging, without factories and such
And then there are messeges that arent injected to the GameCore
Like assigning a character id to client, maybe sending a chat msg etc
hmm I see, msg must be known at compile time
you could just have a message manager that you register message types with and encode this type to an int that you pack into the message (as its first 4 bytes) and when a message is received you just lookup the type in that manager and deserialize it
thats essentially what all the mid level libraries do in one way or other
that'd be this I guess then
a factory
you don't need a factory if you don't want one
hmm, is there an alternative?
depends on what you understand a factory to be
I find myself having to create a factory for the game core that handles the GameCore msg types
And another factory for the game spesific msges like the types of the player command examples
if you want to call Create() on some base type and get a specialization of it back, you need a factory, because thats what a factory is, but you don't have to do it that way
I am just trying to minimize the boilerplate code while turning a byte[] into its type object and feeding it where it's supposed to go
I guess it can't be minimized much
If I didn't have the specialization here, I guess I'd have to just pack all the information in a one msg type
And use its bits
Based on its type integer
to minimize boilerplate you can wrap your messages into data structures
those would automatically register themselves with the message manager and send/receive through it, but you'd just access them like any other datastructure
say you have a Sync<T> type, the implementation of it would just be a strategy pattern based what kind of type it is (value, reference, ...) and wrap all the factory/abstract factory stuff
if you don't want to use fancy code weaving you could just have all your network classes subscribe to a message bus that receives messages and you just subscribe with your handlers (that a normal library would declare via attributes on methods)
hmm, these will take a while to digest
message bus might be nice I'd think about this a little more
Can I have a high level example of this?
Having some trouble understanding this
Have a look at how mirror/netcode for gameobjects implement a SyncVar or SyncList
it’s basically a wrapper around manually calling send/receive message
an event or message bus is a quite well defined pattern
hmm, I wouldn't want to do weaving anyways
I think the best solution for me would be the message bus
With the listening and publishing
Id have just one integer going on my msgs to indicate which bus it belongs to while sending them all in one enet channel
And I guess it'd be nice
Code generation can be used for this. Mirror/Mirage generates serializers and deserializers for you.
Allright thanks @austere yacht I'll see what I can do
Thanks, @spring crane I'll also take a little look, I've never implemented any code generation system before
I'll take look with the online vscode
I believe there has been some recent progress in more ergonomic code generation methods
it’s not very complicated code gen, but still annoying to maintain
Hey guys, I'm playing around with the NetCode package and am struggling with client animations being replicated on the host.
I've read through similar issues on the forums (https://forum.unity.com/threads/the-host-dont-see-animations-of-clients.1295964, https://forum.unity.com/threads/client-animations-not-displaying-on-the-host.127945) however even though I have followed the instructions given, my animations are still not propagating back to the host.
Is there anyone free to go through this with me?
apply it on the host before sending it to the other clients
y'all I'm lost at how to get clients to send a request to the server to do an action. I've played around with the [Command], [Client] and [ClientRpc] tags but Im clearly missing something
I've been looking at https://docs.unity3d.com/560/Documentation/Manual/class-NetworkBehaviour.html
The Unity Manual helps you learn and use the Unity engine. With the Unity engine you can create 2D and 3D games, apps and experiences.
I have a somewhat generic shader that deals with both a spawning and despawning based on timestamps.
I'm in a bit stuck in how I should deal with setting these timestamps to cover for people joining late & in general what time unit to use I guess.
I'm using Dots NetCode & have a GameplayAbilitySystem in place where my current thought would be to use debuffs to trigger the spawn and despawning with either applying gameplayTags or lookup on the actual debuff.
Issue I get into is if there is no debuff present, I don't know if it's because it hasn't been created yet or if it was created to far in the future.
anyone using mysql / phpmyadmin on droplet ?
Hey
I'm trying to make a multiplayer mod for a game that and make it so players see everyone else's gameplay
I made this component that sends what the camera sees to the other players through RPC (I use the legacy networking because of the Unity version the game uses)
The images are send in an OnPostRender
[SerializeField] private RenderTexture CameraTexture; //256*256
[SerializeField] private new NetworkView networkView;
internal Dictionary<int, Texture2D> Images = new Dictionary<int, Texture2D>();
internal Stack<Texture2D> ImageStack;
internal int PlayerID;
private IEnumerator OnPostRender()
{
yield return new WaitForEndOfFrame();
var tex = new Texture2D(CameraTexture.width, CameraTexture.height, TextureFormat.RGB24, false);
RenderTexture.active = CameraTexture;
tex.ReadPixels(new Rect(0, 0, tex.width, tex.height), 0, 0, false);
tex.Apply();
var data = tex.EncodeToPNG();
Destroy(tex);
SendTexture(data);
yield return new WaitForEndOfFrame();
}
private void SendTexture(byte[] data)
{
if (Network.isClient || Network.isServer)
networkView.RPC("ReceiveTexture", RPCMode.Others, PlayerID, data);
}
[RPC]
private void ReceiveTexture(int playerID, byte[] data)
{
if(Images.ContainsKey(playerID))
Images[playerID].LoadImage(data);
else if (ImageStack.Count > 0)
{
var image = ImageStack.Pop();
image.LoadImage(data);
Images.Add(playerID, image);
}
}
The streams themselves perform fine enough, my problem is that the performance of the game itself drops to a nearly unplayable level on the host machine when the match gets to around 5 players (it seems like it forwards the frames fine, but the host player wouldn't really be able to play the game)
Has anyone got an idea about how to optimize this?
Can someone explain to me how this works when you can't have nested networkobjects nor can you have a child networkobject with a non networkobject as a parent?
RightHand can't be a networkobject without rightArm being a networkobject, but besides that you also can't have nested networkobjects so what gives? (Unless the player was a scene object but that obviously doesn't work and also isn't expected as the networkmanager has a field for the player prefab)
i'm trying to use OpenURL to open the website to where i work. the game i'm making is mostly for the kids, and they get 10 minutes of break for every hour they're there, so i want it to open up the website that they have to go to once they're off break when the break ends. it works fine in a local build, but when it's done through webgl, there's a 403 error, probably because it's a request being sent from an actual website
Alright, i used a custom header editor and figured out that it IS the referrer header that's messing things up. i just need to know how to pass custom headers with openurl
fuck openurl is external
Have you tried to calculate the amount of data that is being sent with that approach? Perhaps you can consider just sending the relevant game state (i.e. the different camera positions + rotations) and let the clients reconstruct the views based from that?
My problem is that the objects that I want the players to see aren't shared between them
To be more specific, I want to make this mod for the game Keep Talking and Nobody Explodes where each player has a bomb that they defuse
And I just want players to see each other's bombs because this'd be a kind of contest, they don't play in the same scene. The bombs will be very different for each player and are only spawned for themselves
Hey guys, I'm a beginner with unity networking and I wanted to ask what the best networking thing for me to use is?
Do you need to send the image every frame? Can it be compressed, cropped or trimmed down in size?
Can you send the shared images asynchronously?
Not sure, is it possible to do RPC calls asynchronously?
A RPC is inherently asynchronous
None at all if you are a beginner. First get really comfortable with non-networked unity projects
You are not supposed to use network objects like that. The root player object is the only network object you would typically have. Network objects are entities that exist ‘on their own’ in a scene. You would only parent them to each other if they ALSO exist independetly, like a car and a player that can potentially drive it
That makes sense however that image I sent is from unity documentation
That's what has me confused
you can spawn two network objects from separate prefabs and then parent them to each other
you cannot spawn a network object prefab with another network object inside it
you also cannot parent a network object to a non-network object and expect that to sync
Exactly so unless I literally build the character at runtime (the hand object is a child of arm object which is a child of the shoulder object, etc.) how am I supposed to do it?
It just seems so counterproductive
you are supposed to build it at runtime (i.e. spawn and assemple in pieces)
I am supposed to connect every limb independently and have every limb be a networkobject?
you are supposed to not put network objects on anything but the root object of your entity (player, car, monster, whatever...)
But then I can't spawn an object and reparent it to one of the limbs
only to the root object
And this image literally has left hand as a networkobject
Which is also not possible because it would say that you can't have nested networkobjects or if you were to spawn it in the scene and reparent it to the limb then it would say you can't reparent to a non networkobject
So I literally don't see a way unless I were to spawn every limb independently and reparent them with every limb being a network object
this image seems to contradict what the docs say about parenting rules in the paragraph above
A NetworkObject reparenting solution within Netcode for GameObjects (Netcode) to help developers with synchronizing transform parent-child relationships of NetworkObjects.
This is where I found that image
A NetworkObject can only be reparented under another NetworkObject (GameObject with NetworkObject component attached). Only exception is moving a NetworkObject to the root of the scene hierarchy.
(on the same page you linked) this specifically says that the picture with the tree is incorrect
Yes I know, that's why I'm confused because it's clearly wrong but it's in the docs
well, tbh network object parenting is something you shouldn't do anyway
So how would I spawn an item on the hand of the player for example?
you would have to spawn those hand-attachments manually and manage the parenting with custom code
technically the image is correct, it just wouldn't be possible to spawn that structure as a prefab with nested network objects, the whole list of examples with those diagrams is there to explain that you cannot actually do it, and network object parenting is largely useless for runtime-spawned complex objects
hey
iam using photon 2
but when i build using this setting speicifcally it doesnt connect
on ios
but using the "faster run time" makes it work
ideas?
Yeah had been reported a while ago with mirror and should be fixed all the way down to version 2019: https://issuetracker.unity3d.com/issues/il2cpp-faster-smaller-builds-prevents-connections-when-using-the-mirror-plugin
Should still fail if you're using latest version of dots package though
so how can i fix it?
iam on unity 2021.2.11f1
Fixed in 2021.2.14f1
You'll have to upgrade I'm afraid
Please do a proper backup or use versioning, I don't want to be responsible if your project breaks 😉
Good morning :). Quick question from the netcode documentation:
You can select from three different Default Ghost Mode types:
Interpolated - all ghosts Unity receives from the server are treated as interpolated.
Predicted - all ghosts Unity receives from the server are treated as predicted.
Could someone gives me a clear example of what "type" of ghostentity you will rather spawn as interpolated and another as predicted? I have difficulty to understand the difference.
Predicted is running simulation RTT + buffer ticks on client. If you don't need this precision & potentional rollback in simulation you go with interpolated. Anything from team points, moving enemies etc.
Interpolated - Enemies, controlled by server, player doesn't really need to predict them.
Predicted - Physics Boxes/Doors, interacted with by player directly and may look bad if they are delayed interpolated.
Thanks @stray scroll
How can I have hundreds of network objects (enemies roaming the map) without crashing the clients?
The logic is all server sided (navmeshAgents)
But I add too many then the client crashes and it says payload size too small. I then increase it but eventually it crashes again (all the enemies are doing is roaming around)
All I'm sending the clients is the transform position, rotation and animations
Are there any free alternatives to Photon Unity Gaming Services and Epic Online Services for Peer 2 Peer
do you mean host based? i.e. one of the players acts as server?
one of the players that acts as a server without needing to port-forward
ok, ic, you are looking for a relay service alternative
i'd imagine any game networking service has a relay service and offers a free tier, none of them would be completely free
PlayFab Party would be an alternative
👋 Had a question for those who use ParrelSync. We're moving to a headless dedicated server, from peer-to-peer. I was wondering if people had experience with seperating the server / client logic with ParrelSync. Are you using their arguments to not run the logic on one or the other, or do you have a different way, like a seperate project for the server?
options in a single-project client/server architecture are separate but coupled classes for Server/Client/Shared code, partial classes and Server/Client Attributes and Suffixes on all relevant methods and all the server code is wrapped in #if SERVER_BUILD pragmas to prevent it from being distributed as part of client builds, i'm not sure what any of this has to do with parrelSync you'd just flag the clone to behave as server or client through an argument or a start menu or some sort of self-detection or some parrel arguments, whatever server/client means is up to your custom code
I wanted to do the defines, but because parrelSync copies all files, the defines would be the same for all the editor copies. So if I wanted one client to be the server, and 2 others to be the clients, they all would still have the same definitions no?
I feel like I'm not explaining myself well haha
you dont need the defines during development
they are just for distributed builds
they only thing different between parrel clones that you can use is the parrel arguments or stuff you do at runtime (click a button to make it a server/client)
but that generally has very little to do with how you architect your code
Alright, I'll do some playing around with the arguments then, thanks for the help!
Oh one more small question, because I did see in your original comment that you would recommend using the define to note server code. For the server build, would you recommend making client defines so that the server does not have all the overhead the client might bring?
Or does the nographics / batchmode on headless builds take care of a lot of that?
no, this is just a security thing
you do not want to distribute your server code to clients
but the server doesn't care if it also has the client code (from a security perspective)
that just prevents the graphics engine from being initialized and a window from being created
Alright, thank you very much!
Hey guys, I'm a beginner with unity networking and I wanted to ask what the best networking thing for me to use is?
I have a few months of experience with unity just wanted to try something new. Will never learn if I never try 👀
Photon
be careful with tutorials for photon. most of them are outdated and no longer relevant. use the example projects provided by photon to get started.
using System.Collections;
using System.Collections.Generic;
using UnityEngine;
public class PlayerController : MonoBehaviour
{
public float moveSpeed = 5f;
public Rigidbody2D rb;
public Camera cam;
Vector2 movement;
Vector2 mousePos;
// Update is called once per frame
void Update()
{
movement.x = Input.GetAxisRaw("Horizontal");
movement.y = Input.GetAxisRaw("Vertical");
mousePos = cam.ScreenToWorldPoint(Input.mousePosition);
}
private void FixedUpdate()
{
rb.MovePosition(rb.position + movement * moveSpeed * Time.fixedDeltaTime);
Vector2 lookDir = mousePos - rb.position;
float angle = Mathf.Atan2(lookDir.y ,lookDir.x) * Mathf.Rad2Deg - 90f;
rb.rotation = angle;
}
}
how do l make the script work with [Photon pun] help any edit will be fine with me
Is it possible to despawn scene objects and sync when a client spawns later?
For example:
- Network object in the scene
- Network object is despawned
- Client 2 joins the session
- Client 2 gets the information that the network object was despawned
all the popular netcode libraries handle that kind of thing automatically
I tried to do with netcode for gameobjects and it didn't work
Despawn only works if the gameobject is spawned instead of being on the scene
At least for me, I might be doing something wrong @austere yacht
with photon I can only spawn 1000 objects :/
if you want to synchronize that many objects over the network then your only option is deterministic simulation
ill try find a way around it
is this a bad way of initialising the players?
Elo boys,
short question, is it a good practice to use for example Google Play store's for authentication only, and then another source for storing and updating players scores, etc ?
how can i make my fps arms visible to only the client, with the character body being invisible, and then fps arms invisible to other players and only the character body visible? i'm using the default unity netcode package for this.
check IsLocalPlayer in some NetworkBehaviour on the same NetworkObject and disable them when false
ok so i tried doing that and i'm getting an error now:
Here's what I wrote: ```cs
public class visualClientHandler : NetworkBehaviour
{
[SerializeField] private GameObject thirdPerson;
[SerializeField] private GameObject firstPerson;
void Start()
{
SkinnedMeshRenderer characterMesh = thirdPerson.GetComponent<SkinnedMeshRenderer>();
if (IsLocalPlayer)
{
characterMesh.enabled = false;
}
else
{
characterMesh.enabled = true;
firstPerson.SetActive(false);
}
}
}
have you read the exception message? it tells you exactly what to do
Good evening. I have been searching for answers on whether to use SQL or NoSQL database systems and so far I’ve been getting mixed answers all over. Still, when checked on games such as WoW, FF14 & lost ark they all use SQL (FF14 uses MySQL). I tried searching for Genshin Impact but was unable to find any job postings. The game I am working on is an online RPG game with inventory system, quests, etc. What would you guys recommend?
if you don't know why you'd want a non-relational database you should definitely use a relational one
That make sense
The thing that got me into searching in the beginning is scalability that I see people talking about
yes, no-sql typically is only relevant at massive scales or if you have very specific performance requirements
Oh ok. Thank you
using System.Collections;
using System.Collections.Generic;
using UnityEngine;
using TMPro;
using Photon.Pun;
[RequireComponent(typeof(TextMeshProUGUI))]
public class PlayersConnectedUI : MonoBehaviour
{
TextMeshProUGUI connectedText;
private void Start()
{
connectedText = GetComponent<TextMeshProUGUI>();
}
private void Update()
{
connectedText.text = $"{PhotonNetwork.CurrentRoom.PlayerCount}/{PhotonNetwork.CurrentRoom.MaxPlayers} Players Connected";
}
}
Is connectedTest assigned in the inspector ?
Did you drag a textmesh pro UI element onto it ?
Oh didnt see the getcomponent in Start at first xD
I should finish my coffee
You sure the component is where you expect it to be ?
How can I update my NetworkManager script from Netcode for Gameobjects?
I'm trying to access
NetworkManager.ConnectionApprovedDelegate which was implemented in the version 1.0.0.
Started to use Netcode for Gameobjects in the beta around version 0.9.3 i guess.
PackageManager is showing me that I have installed the version 1.0.0. Also tryed to Reimport and Refresh the package.
afaik you subscribe the NetworkManager.ConnectionApprovalCallback event and write your approval response into the ConnectionApprovalResponse you get passed by the event
how do i check how many clients are connected to a room with photon?
with room i don't mean the photon server in my project, i have a system where you can connect to games with a code
using System.Collections;
using System.Collections.Generic;
using UnityEngine;
using UnityEngine.UI;
using Photon.Pun;
public class CreateAndJoinRooms : MonoBehaviourPunCallbacks
{
public InputField createInput;
public InputField joinInput;
public void CreateRoom()
{
PhotonNetwork.CreateRoom(createInput.text);
}
public void JoinRoom()
{
PhotonNetwork.JoinRoom(joinInput.text);
}
public override void OnJoinedRoom()
{
PhotonNetwork.LoadLevel("level 0");
}
}
//how can i check if more than x players are connected?
What's the best online gaming solution for a 3d card game in Unity?
yes, but the thing is that my variable IS in fact assigned
oh... oops i had the same script on another object.
photon is easy to start with
when a client joins a host, the client is put into the inspector along with the actual player. this results in two players in one scene, which duplicates the UI. This also happens on the client side with there being two players int he inspector. Is this supposed to happen?
I know how to fix it, but I was just wondering if it was normal for the player clones to be in the inspector for the client and host
Identical objects with few flags to control behaviour is a common approach for networking. Alternative would be to create separate local and remote objects, which would be a lot of extra work.
Same thing, netcode for game objects is the new name for MLAPI. If you are looking at something called MLAPI, it’s outdated.
thanks
how does connecting work? the example makes it as easy as csharp if(isServer) { NetworkManager.Singleton.StartHost(); } else { NetworkManager.Singleton.StartClient(); } but i'm skeptical thinking this would work if i sent it to someone
it works locally, but would this work globally, or on another computer in the same household?
Why wouldn’t that work?
as far as your app can control it, connecting to itself or an address at the other end of the world is the same thing
I don't know, I was always told that I'd have to host a master server or send an IP
I'm new to networking so I'm pretty confused 😅
obviously you need to configure the IP and port
I'm confused about that statement but I appreciate every bit of help you've given me!
the network manager and transport need some configuration
You can configure those in the inspector
after that, anyone can join anyone from anywhere?
at the click of "host" or "join"?
Theoretically yes, but they need to be configured with your IP and your LAN must forward traffic to the right PC and port
if you want to avoid these NAT issues you can use a relay service
in your LAN it will probably work straight away
relay service is paid from what I've seen, though I like it
i'm just writing a small game right now for practice before I try to make one of my games multiplayer in the future, since I'm uneducated in networking
so it's nothing I would pay for at this point
thank you very much for everything, I really appreciate it a lot
it's hard for me to grasp new concepts so your patience makes a world of a difference
Most relay services offer a free tier suitable for small scale use and development
Unity relay is compatible with unity transport and all networking libraries that use it
It’s free for 50CCU and 150GB
awesome, thanks! so that could solve my issue with trying to let people automatically find eachother?
no, that is yet another service, usually called ‘lobby’ or ‘matchmaking’
But you don’t need that if you can have people share their IP/joincode in some other way
you can also build one yourself quite easily for a small scale project if you want
I'm going to have to try to sleep on this and see if I don't understand it better when I wake up. I'm trying to figure out what more than an IP and some programming I would need in this scenario at the moment
thanks again, i'm heading to bed
Do you mean using the new line instead of the old line?
private void ApprovalCheck(byte[] connectionData, ulong clientId, NetworkManager.ConnectionApprovalResponse callback)
{
if (connectionData.Length > MaxConnectionPayload)
{
callback = new NetworkManager.ConnectionApprovalResponse { Approved = false, PlayerPrefabHash = 0, CreatePlayerObject = false, Position = null, Rotation = null }; //NewLine
callback(false, 0, false, null, null); //OldLine
return;
}
yes, you should name it "response" though, not sure if new'ing works, you may have to assign the fields individually
Ok Thanks.
Hi
I tried to make a networkvariable
NetworkVariable in question:
public NetworkVariable<int> netMarkerIndex = new();
But I keep getting this weird error
Update: After asking around, I've given up on that idea and decided to do something else
does NetworkTransform also synchronize children transforms?
why is it so hard to figure anything out, it feels like even the documentation itself is very vague and sparse
wtf
I can't even figure out how to connect LAN
I finally figured out how to get someone to connect to me, but they can't be using my router, they must have their own internet. Why is this, and how can this be fixed?
You can absolutely connect to a host on your local network, are you using the right IP?
Is there a way to get the UnityWebRTC to work with Unity 2017.4, .NET Framework 3.5? Or is there a cross-platform (Windows, Linux, Mac desktop) alternative for it that I could use to stream the camera target texture to other players?
Isn't unity relay average 50 ccu instead of just 50 ccu, or something like that?
I'm pretty sure i saw something saying that you only start paying if you get a monthly average of 50 ccu, which means you can have like 250 ccu in the first week of the month and 0 on the other weeks and still wouldn't pay no?
Which ends up averaging 50 ccu monthly
Yes I think it is an average
What packages and tutorials should I use to make MLAPI work on LAN?
Netcode just works on LAN, no extras required
Just put a local IP in
okay so I'm browsing through the pinned and I'm still running into the problem of feeling a little overwhelmed by all of the options and a lack of understanding of what does what and what is an acceptable approach for my project, a turn based strategy game
can i get some help with unity windows dedicated server build i keep geting these errors (URP project and on unity 2022.1.7f1 version and photon fusion is in the project )
Image
These errors should probably be warnings. That's just what happens in the graphics systems when you don't provide any graphics device.
Does anyone know how can I sync the position of a child object that is controlled by the mouse position of the player? (This object is a child of the playerprefab)
I tried with RPC's but it's too inefficient and very stuttery
I also tried attaching a network transform to the object but for some reason the server controls that transform even though it belongs to a client
How are you setting the ownership? What networking solution are you using?
Hello, I'm using netcode for gameobjects. What I'm basically trying to do is sync where the player is looking (with the lookat feature of animation rigging).
The animation rigs follow a sphere that is a child of the main camera, so what I'm trying to do is sync the position and rotation of the camera to every client and that would fix it
But what happens is that when I apply a network transform to the camera it doesn't work at all
I also tried using RPC's but I'd have to use it on the Update() method and I assume that would overload the server with many clients connected?
Hi, just wanted to ask what would be the best networking solution for a simple CCG like this: https://www.youtube.com/watch?v=ZHc4QrcljiI
I was thinking of having Node.js handle logins, matchmaking and game state, while having MongoDB handle account info, decks, collected cards etc. but I'm unsure if that's viable.
Subscribe to Me: http://goo.gl/Xq7EG
My Blog: http://goo.gl/qPiBe
Twitter: http://goo.gl/GjHNP
#game #GamingMole ---------------------------------------------------------------------
Subscribe to Me: https://goo.gl/Jb4xtm
Most Recent Upload: https://goo.gl/CcnPeH
Most Popular Upload: https://goo.gl/id51qE
Twitter: http://goo.gl/GjHNP
-------...
Other option would be Mirror + Playfab.
Hello networking channel
How can I show the same scene to 2 players on different devices at the same time
in principle, unless you are video-streaming your game to players, you will have to make both clients load the same scene based on a trigger you send to both simultaneously, usually this is facilitated by a netcode library
So it would be 1 camera and that camera is activated for the local player?
its always just one camera
Not sure if it helps any specifics but this is a game view
Player 1 and player 2 will see it and who ever gets the right answer first gets the point
but don't know how to setup
networking
🤷♂️
Someone help me
Oh wait
I'll do
i don't know to setup networking
for multiplayer
🤷♂️
i got it
but
the probelm is
The host is only updated
nd the client is like a kinda of shakking
nd not moving as well
@weak hull
Yeah
How do i make transform over network?
hello, Im working with PUN2 and I try to understand. I have a problem, I have 2 players et 1 enemy, the first player who join the game is the masterclient and then all GameObject with PhotonView owned by him. when my enemy die, the GameObject is destroy: if the first player kill him, no problems, but if the second player who enter the game late kill this enemy, I have error and he can't Destroy the gameObject. Someone know a good method for this problem ? thanks
pun2 is no longer used, I think photon has moved to something called fusion now
ok didn't know, some month I working on it
but I would like to find something in the net for understand the way to create a game server
thank you so much
its not working
i have 3 buttons, red, white and blue.
when you click them voids will be activated. when you click, it works perfectly in your client. but in server and other clients it's not
using mirror?
yes
Anyone can help with fixing PHOTON: player can spawn (setactive) and despawn a circle that is a child of that player object, other player cannot see the first one enabling or disabling the circle?
the other player just doesnt see the change and if rigidbody is moved, then it moves back
Please, I need to upload my game
Is there way to load scene for client only. like when i press a button on server the scene of the client will be changed but not on server
Guys, I wanted to ask about something. So I have finished a photon pun multiplayer game and it has like some problems with the connections and I'm assuming it is because I haven't open a server yet. So what are the procedures that I need to do in order to open a server for the game and test the connections? And thx 🤗
Usually you just tell it to make a room and join it
You have to be connected to the master server to do that, but you should already be connecting to it
It's making a room and doing everything, is that means that it's already connected to a server? Like am I ready to publish?
- it sometimes has like some sort of lag or latency in order to show the player what others are doing what's with that?
Have you tried to connect two clients to the same room?
Of course I did, if I didn't I wouldn't have known that there is that latency problem and the lag one
Check you're on the right region
Well, I am not 😅
so im using pun2 for multiplayer and when i actually instantiate it with photon than the graphics suck, but when i just use the same exact prefab by just dragging it into the scene, it looks good:
any help would be great
screenshots in #💻┃unity-talk