#archived-networking
1 messages ยท Page 81 of 1
๐ that question/answer should be pinned and always visible for everyone ๐
what kind of networking solution do you think Clash Royale uses? at first I thought it was some kind of lockstep but in the end I am thinking it is lightweight client (only input and view) and a server processing all the simulation and sending the game state (or delta gamestate) all the time
does that make sense? I mean, there is not a lot of data to send, so it might end up with 100KB/s (or less, I did quick math without thinking about compression or sending only delta) for the server upload, and for each client half of that
downloading a stream of ~50KB/s in a phone with mobile connection doesn't seem too much right?
am I missing something, would love to a professional opinion
is the game realtime or turn based?
real time
50 is too much
i guess their laziness costs their users data ๐คท
it is a lot lot less than watching a youtube video or netflix in your phone
no no, I am speculating
well, at least they save a lot of cpu => battery (it is a phone/tablet game) if they do that well (they might be using less data, like sending only deltas and not all the frames, I calculated a worst case)
you should check it and see ๐
not a bad idea now that you say it
That type of game being a card game I think would be more another candidate for a cloud server turn based arragement
Welcome to the first ever look at Supercell's newest game, Clash Royale. Learn the basics and watch Chief Pat take on Chih from the Clash Royale team.
Chief Pat's channel: http://supr.cl/ChiefPat
Enter the Arena! From the creators of Clash of Clans comes a real-time multipla...
it is not a card game
Clash Royale can be done with server-based lockstep (but they probably use a lot of copy-paste from rpevious projects in SC)
I know Lego Star Wars battles (which has very similar mechanics) uses Photon Quantum...
Which is server-based deterministic predict rollback...
Is it realtime? I never played it
Oh yeah, that is right - I recall it now
but in both the combat is RT, path finding, a bit like a tiny tower defense / tactical / strategy
whops i was scrolled up lol
yeah, its like a realtime card game right?
yep, both
"card game" for placing the units, yes
And the meta game is done around these card-units (at least in LSWB)
thanks!
There was a question in the photon discord about that type of game and Quantum, not sure if it was the same person with a different name though.
The question being how do you deal with the database stuff like the players card collection. Does that require a server to validate the card collection? @gleaming prawn
Or in other words, how do you introduce 3rd party database information into the simulation?
you can intercept all inputs with quantum server plugin, yes, that's the best approach... But the deck building itself can also be done on server
There are a few different ways to guarantee 100% deck-safety
Ah yeah, forgot that a server plugin is still an option with Quantum
I would think that the player would get a token from the database for their collection before they join, and the relay plugin propagating that to all would be the shortest path.
Or more, the relay using the token to get the card data, and then replicating that out.
I guess two a player could join, but not be allowed to play until all players have successfully pulled the card data for the new player. Late joiners in this type of game aren't a think but I can see some game types where late joiners might come with "stuff"
I would not go for the last approach
photon doesnt have a data solution?
What's the most common solution to the problem of players bringing "stuff" to a game that requires database confirmation that its valid?
Photon does not handle player profile data
dont let players bring stuff.
Nope, photon is all realtime stuff only
ok, just played a match of clash royale, ~1 minute of game, consumed like a total of ~170KB (checking android data consumption)
that seems to be the goto solution for most of our customers (for that set of services)
I am just curious now how asyncronous stuff like that gets introduced into Quantum, since its not a player input.
ok, played a game, ~1 minute of game, consumed like a total of ~170KB (checking android data consumption)
Clash Roayle or LSWB?
I am just curious now how asyncronous stuff like that gets introduced into Quantum, since its not a player input.
SendPlayerData...:) Fully interceptable on server
you cant check bandwidth usage of a game by looking at data consumption in android phone
u need to measure it properly
that could include all sorts of analytics, etc
There's a lot of shit in background like post-notifications, etc
anything
Spying, spywares
And the server would verify the validity of that "stuff" @gleaming prawn I assume then a token or checksum is used against the database before the relay server flags it as a valid input?
And the server would verify the validity
You can actually have the server send that for the player in question
Is it Clash Royale @shy granite ?
I know there is a lot of other data from the app, but at least it is less than ~170KB in a minute game
or LSWB?
That is what I would have expected, that the player just gets a token, and then the server is the one that pulls the data from that token, and turns that into an input for the sim. @gleaming prawn I think I mostly get what you have going on.
clash royale, updated my message with that info
oh, sorry
so, arouns 2.5KBps for a 2-player game... That's about right
Could either be lockstep or even an ok state transfer, the game is quite easy on network transfer
2.5KBps is probably even mostly overhead, not even actual commands/state
I was expecting more for state transfer but my previous calculations were super naive (not considering a lot of techniques to reduce data transfer)
It MAY be lockstep
But I can't know for sure
I'd personally do a game like that with lockstep...:)
yep, the only thing that keep me wondering is that the game runs pretty well on really old phones (but might be super well optimized)
Combined with server-validated commands
so I was expecting no simulation on phone
That game is SOOOO simple, lol
Nah
That game is nothing in terms of sim
Compared to has is being done even with deterministic predict/rollback with quantum
A toaster can run a full simulation of a game like that
The bottleneck is 100% the rendering
but in an old phone?
old phone >>>>>>>> toaster
Rendering costs don't increase due to resims
rendering is a fixed cost based on framerate
but still it#s normally the most costly part (by far)
And in a game like Clash Roayle, the sim cost is very very small
really, you are talking about something between 0.01ms or 0.1ms (considering they do a smart waypoint based path finding)
for a cheap phone, single thread
I'd run the sim at around 10-20fps, interpolating view
I would think a super slow frame rate could benefit as well, allowing you to put off resimulation a bit longer, allowing more updates to arrive in time.
Honestly, that's one of the easiest gameplays to implement using either lockstep or predict rollback... (polishing and balancing and meta is another story, so it's never easy to FINISH/Release a game)
allowing more updates to arrive in time.
Just use a bit of input delay, even in rollback mode...:)
True, a game like that doesn't need the snappiest interactions. Easy to cheat user feedback without actually starting the effect.
The user sees the card drag on and do some particle effect... they know their input registered.
yeah, even actions are always delayed, like a design decision
deploying units in the field has always a duration (not sure if fixed for all units or it depends on the unit/action)
so you can show that immediately in the client as soon as the player executed the action
The main driver of that delay is that determinism relies on extrapolation... and extrapolation can make a real mess of things.
So buying user updates some time to get to the client reduces the need for resims... which is easier on the CPU and also avoids visual artifacts of cleaning up the bad guesses.
Determinism does NOT have to rely.on extrapolation....:)
Doesn't have to of course, but one of the big perks is letting the player exist in the present.
I guess that is another question, how many titles make use of interpolation or some mix of interp/extrap?
Introducing the input latency, I can see the interpolation side having benefits, since you are interpolating your own player as well.
I believe this one only does some visual interpolation for fast moving objects (or all objects) in the client side
There is always that kind of interpolation... in Update you are lerping between states
This is more the question of whether those states themselves are extrapolated
The system will I assume extrapolate whenever the buffer goes empty
Extrapolation just makes sense, and it's the opposite of mess when it comes.to physics
It's actually just better than the other option
I hunk you guys are messing apples with oranges
There are two things being discussed
The use of extrapolation (whereas via input prediction + rollback or in state transfers) Vs interpolation (can be done in quantum the same way as the other, default for stuff like ue) has more.to do with the gameplay
You use whatever makes your game look/feel better for the player
I was more just talking to what happens in the case of buffer underrun, not so much the lerping of rendering in Update
The networking should (ideally) not impose one or another... Quantum certainly does not
Exception cases look bad in any game...
A buffer underrun has to produce some kind of extrapolation, so my understanding is input latency and other tricks exist in Quantum to try and avoid that situation as much as possible
So if you have a sudden network loss with 0.5s without data, no matter the architecture, it will look strange
For sure
Buffer underrun, there are different ways to treat that, but they are as I said, the exception... You do not design the whole game experience thinking of that
You design the game to look right, in the correct condition window (and design a decent enough graceful degradation otherwise)
That part is news to me. I figured to get the player into the present quite a bit of extrapolation and resim were always dancing around doing their best.
One way to treat buffer underrun is rollbacks, sure, but again again, this does not impose at all whereas you should extrapolate or interpolate
Thinking it does is just wrong
The right condition window is quite flexible and configurable
I don't think I was confusing that. You can't interpolate your way through buffer underrun
underrun = extrapolation of some kind
But a sudden loss of data for a full 0.5s is pretty bad...
Interpolating by definition = seeing the past
So you can definitely design your interpolation to do just that (protect agains underrun)
My understanding was that the common usage of determinism like Quantum is to ride that edge, and let small amounts of extrapolation occur and let the resims clean things up before they get too ugly.
I get that that isn't hard coded, and is a choice
That's one of the reasons, yes
I just know that fully relying on input lag isn't ideal either
But it's far from the only or even major one since we started almost 4 years ago
since that puts you in the same world as state trasfer server authority without client prediction
Yes, and there are cases that's good...:)
Hi currently I have a lobby with a username input field. How do I save this username so it can be used in the main game? I am using Mirror as my networking solution
I would assume that the game devs just have to play with that balance and decide where the tradeoffs feel the best.
Yes
Technically you can even expose that to the player as an option I assume as well
The benefits from determinism are far more than just extrapolation
Since there is no advantage taken or giving by playing with that balance
Of course, didn't mean that if that is what it sounded like.
That isn't the determinism even allowing for that, that is just having your inputs on a tick. Non-determnistic engines can also do that if written with stateless physics.
As I said, extrapolation Vs interpolation is another (independent) variable...
Predict rollback determinism just does both easily (and does not rely at all in either - the view is the thing that relies one one or another, and regardless of the underlying sim approach)
Certain netcode tools are tied to interpolation (but technically the reason not to extrapolate is sometimes practical and visual, not that it's not possible)
Where interpolation gets weird for me to understand is how the shot rewind and such play in in a deterministic sim. I guess every client agrees on how much to rewind for a shot. Unless I am messing up the timing involved in my head.
That's one way of doing it..
But a bit more complicated than that underneath
I can imagine, since everyoe has to agree on how much they disagreed ๐
But you are already specifying one kind of gameplay
One that pushes for interpolation
Yeah, this example is a FPS shooter
There are many other kinds of gameplay where you could interpolate views, and still not need controlled rewinded shora
Shots
Why you guys only think about violent games? Lol
I just always think about the edge cases where things break, and that is one that seems like it would test the limits of quantum
FPS shooter is pretty much THE gameplay that pushes for interpolation + favor the shooter mechanics
Solving those, helps explain the system
And pretty much the only one
But it's not rocket science, just determinism science
of course... but I am not going to ask you how to do the obvious easy stuff.
I am curious how you guys are tackling the tricky edge cases.
We don't say how we do the internals... It's just mayonese left in the sun, you know (some very expert dude said here once)
I can and should just ask those kinds of things in Slack. Though really I should just be coding right now.
I need to finish my stuff before your stuff completely invalidates it ๐
I thought you had it already done
Just adding more stuff and fixes
See the differences (publicly stated in our docs) between quantum 1 and 2
Always nicer to have something smaller but production ready than something too ambitious that's never in working condition...
Then you build the next one...:)
I mostly have been working on Pun2 improvements, many of which have led to me being able to refactor SNS do to things how I wanted to do them originally (like handling ownership transfers on the tick engine)... So I mostly just had to tear it apart and make it all work with some very different timings.
I've largely been moving parts of my lib into Pun2. Like the bitpacking stuff and syncvar packing and such.
It is a constant struggle, because since its not out of beta, I can do massive refactoring still that I won't when its used more. But that does keep me in a spiral of refactoring.
Though really that isn't the hold up, it is mostly just that once I joined I get sidetracked helping Tobi modernize Pun2 a bit.
I read, that when instantiating objects with Photon, it's internally using Pools. What does it mean? Does it implement object pools and I don't need to worry about them (in order to prevent resources allocation in runtime)?
It doesn't automatically pull from a pool, but it uses an interface set up to make it easier to incorporate polling if I recall. @craggy bear
I'm new to unity networking and all the tutorials i watch have me add a network manager component but for me that doesn't exist has something changed or am i missing something
unity "deprecated" it.
you're looking for Mirror or Pun2 tutorials probably
oh thanks
Hello. Does learning mysql pushes people forward? Or is this an unnecessary to have skill.
When companies hire people, Is this a thing that can be benefit.
Talking about a unity developer
MySQL ir sql in general is good to understand always, but mostly for backend programming and web
For unity itself, I never look for SQL background... I want solid C and C# foundations... But that's me
Btw, wrong type of networking... No idea why you asked this question in this channel
Mysql is very very common, learn the basics at the least
but its more often a web/erp/crm/ecommerce use case
I am in a gaming school as intern. I have been offered to attend any lessons that I want. I have some opportunities such as c++, database,motion captures,animation,consepts art, 3d generalization. I want to learn something that they can help me in my career.
I do not know what to do would you please say something about that.
My ultimate goal is to become an XR AR developer
If you want to be a programmer you should learn it
If you want to be a programmer you should learn it
@mellow beacon what about the others. Should a programmer know how to write shader?
Or how much knowlede do I have to learn about motion captures or etc. basic levels are enough?
There is a lot of stuff to learn
Pone, you are right I will write all the lectures. If you were me, what would you prefer to learn?
Animation, Motion Graphics & Portfolyo, C++, 3D arts, Consept Art, Mocap, Maths, System Thinking, Game Engine Arch.
i don't know you
@mellow beacon I see. My goal is to become a good unity developer so I can catch the AR and XR things.
If you were me what would you do mr. @gleaming prawn and @mellow beacon and the other masters?
I have intetmediate C# knowledge
You are looking into heavy programming
My ultimate goal is to become an XR AR developer
That's your answer
Just get into all programming classes you can, and don't waste time with mambo jambo, just sit down and program
College itself is not even necessary (I do have a PhD in CS, but still agree college is not necessary)
I wanted to go for an MS CS but mainly just for the specialized topics
c++ for sure, c# of course, shaders yes but probably can get away with doing most stuff with shadergraph, networking is good to have, basics of 3d modeling/animation and a bit of database
having and introduction of those classes is not a bad idea but ar/xr and games in general is mostly programming
College itself is not even necessary (I do have a PhD in CS, but still agree college is not necessary)
@gleaming prawn Yes I agree but as a non eneneer, I can say that I have lots of holes in my knowledge. People who do that, must be powerfull.
if you can't code and have a good understanding of how things works you will be very limited
and don't forget math
very very important
I think this is absolutely OFF TOPIC for the channel anyway
This discussion should move to #497872469911404564 maybe?
Not even sure where to
yes
c++ for sure, c# of course, shaders yes but probably can get away with doing most stuff with shadergraph, networking is good to have, basics of 3d modeling/animation and a bit of database
@mellow beacon I will do my best thanks!
This channel is about multiplayer networking code practices and tech
I think this is absolutely OFF TOPIC for the channel anyway
@gleaming prawn Ok. thanks for your patience
Yw
and answers
The topic is not bad, just not for here...:)
๐ you are right. I thought it may be count as multiplayer but ๐
you did not ask any question about multiplayer tech (mysql is a database, not really related - maybe loosely if you had asked questions about player profile storage and management)
How do I make the room get destroyed and everyone leaves the room? Using the Phonon PUN.
you did not ask any question about multiplayer tech (mysql is a database, not really related - maybe loosely if you had asked questions about player profile storage and management)
@gleaming prawn I have just came from database class ๐ haha How did not you know? ๐ sorry embarrassing ๐
How do I make the room get destroyed and everyone leaves the room? Using the Phonon PUN.
Have them all disconnect (or from the server with a photon server plugin - requires an enterprise plan)
rip okay
Also, I do leave room for the player then load a scene back to main lobby and it teleports there for a split second then teleports back to the game, how do i fix this?
I though it was because the player didnt leave the room but i put leave room before PhotonNetwork.LoadScene() and it still doesnt fix it.
I'm not an expert in PUN, sorry...
All good.
But I assume you should only load the menu scene AFTER you receive the disconnected (or LeftRoom) callback for your own player...
Then you load a menu scene with Unity itself (not with PhotonNetwork.Load - that is for when you are inside a room)
AFAIK
Maybe the TransformView has some old "network value" stored and lerps you from there to the new value
Ah okay.
Because after i left the room i did PhotonNetwork.LoadScene
But i tried Load scene without disconnecting and it still did the same thing
The TransformView is quite simple and does not know about the change of scene (normally it's destroyed on load).
You can copy and paste the code to a new class, then modify it to become aware of the "hard reset".
That way, you don't lose the changes on next update.
As in the transform view script that is applied to a player object to get its position, rotation and scale replicated across all clients?
Nevermind fixed it, just had to leave and load scene using scene management, not the proton network.
Hey All,
Need some help to solve problem related to photon
I am trying to instantiate bots after all real players instantiate in Scene.
I used RPC to run bots instantiation code with Masterclient and then syncing it to other clients. But it is not working properly. All clients do not have the same bots . I want same bots to be instantiated on all clients.
What is the right way to this?
{
TcpClient tcpClient = tcpListener.EndAcceptTcpClient(_result);
int myID = i;
++i;
Debug.Log($"New client connected : \n id -> {myID}\n ip -> {tcpClient.Client.RemoteEndPoint.ToString()}");
//PROBLEM : THIS THREAD IS NOT EXECUTING FROM THE 2nd CLIENT (but it does for the first)
Thread thread = new Thread(new ThreadStart(() =>
{
//things happening
}));
thread.Start();
tcpListener.BeginAcceptTcpClient(TcpCallback, null);
Debug.Log($"Waiting for connexion on port {port}...");
}
pls help I really don't get it. might be due to the static property of the function
Hey All,
Need some help to solve problem related to photon
I am trying to instantiate bots after all real players instantiate in Scene.
I used RPC to run bots instantiation code with Masterclient and then syncing it to other clients. But it is not working properly. All clients do not have the same bots . I want same bots to be instantiated on all clients.What is the right way to this?
@kind knoll one of the right ways is to spawn bots on one the clients or the server if it is server-based, and then send infos to other clients about the instantiated bots. This is how you operate synchronisation
I would just spawn them as room objects, the master would then be the controller.
There is no server-based in Pun2 unless you are writing a server plugin
@kind knoll
How do I get everyone to run specific code if something happens on one of the clients? (Photon PUN)
I'm been watching unity multiplayer mirror tutorials but lots of the things like network behavior and has authority don't work for me and every tutorial dose the same thing and none of them work for me what am I doing wrong
anyone here have experience with the Unity.WebRTC package? I have a working webrtc connection between my browser and Unity client with working data channels and everything but mediastreamtracks are giving me issues
Is there a good multiplayer api that I can use for lan and dedicated servers or will I need to make it myself
I have several questions about steamworks multiplayer
@spring yoke I think you are going to struggle if you can't sort out the basics of Mirror. Did you check their examples?
What network solution should I use for a battlefiel style fps?
something along the lines of 64 players (32v32 in a team deathmatch)
The number of players in one game is the problem here.
PUN 2 will not handle this good enough. It's too simple.
If you lower your expectations about the player count, you can give Photon Bolt a go. It supports FPS well.
Understood, Thanks!
Hello. OnConnectedToMaster has super lag. It takes 10 second to be called. Why? My region is eu;
Assuming this is Photon. Can not reproduce this. Maybe the client is pining the best regions? Or did you set a fixed one?
Is there an address that he can just ping outside of unity just to see if the internet is being garbage today for him?
How do I get everyone to run specific code if something happens on one of the clients? (Photon PUN)
@severe mountain rpcs
Does anyone know how should interpolation be handled for smooth visuals? Are there some common techniques (e.g. smoothing linearly over last 3 frames)?
Should i use the same interpolation technique for entity interpolation as well as correcting error from client mispredictions?
@worn dome https://www.gabrielgambetta.com/entity-interpolation.html not sure if that works for you
that article doesnt go in depth on different interpolation techniques, it seems to be only lerping the last 2 frames
im wondering whether there are some more advanced techniques, like using speed, or maybe lerping differently
like maybe instead of lerping on last 2 frames, an alternative is to lerp based on -50ms from current frame (which is what the source engine seems to do (?))
@hard oasis i also have same question. Can anyone help us?
how do i set the interactable of the buttons for players differently?
@worn dome first thing is... By frame you mean a server controlled tick? If your simulation is based on a synchronized clock, with a server defined tick rate, then it's all easier....
If you are referring to rendering frames loosely in each game client, no technique matters, it will always look spongy and out of control
If it's tick based, then normally you try to keep a buffer of server tick confirmations (with positions for example, of other players characters), and interpolate with a variable timer.
You smoothly try to keep this timer/interpolation factor just enough to be 1 tick behind the guaranteed server confirmation (accounting for jitter)
That's it in short...
For local characters, ideal is to predict and rollback (non deterministically, not related to that other concept) so you get fast movement... Then you store the buffer of the local player predicted positions and inputs (all tick based). If any confirmed server position is different enough, rollback to the tick (local character), and reapply inputs to fix...
That's a summary of interpolated server positions (for remote characters) + client side prediction (for locals).
That's what photon bolt implements for you, for example... + Lag compensated raycasts, delta compression, etc
Hello All ! Am working in a two player game where UI elements are same. Whereas, if certain conditions are satisfied for one player then he can access the UI elements like he can click on buttons else the button should not e interactable? How can i achieve this?
Assuming this is Photon. Can not reproduce this. Maybe the client is pining the best regions? Or did you set a fixed one?
@stiff ridge sorry for the late answer but, At the university, I have this problem, when I get home it works. I mean if it was related with university's internet?
I can't say what exactly happens at your university network. It may block the pining. Completely or in parts.
In doubt, you may have to talk to someone who's responsible for the network there.
@gleaming prawn ahh i see, that makes a lot of sense. Just to make sure, when you say synchronized clock, do you mean having the client synchronized to the server's clock? If server is on frame 50, the client would need to infer that from the RTT received?
oh nice, any resources on how to get an accurate clock that doesnt fluctuate when theres extra latency / packet loss? Need to damp it somehow?
smooth the syncing...
It took us a lot of work to get it smooth, so not sure it there are lots of resources, sorry
ook, thanks for the help!
by smooth the syncing I mean:
- do not immediately apply the new tick clock + RTT/2...
- do the above server_clock + RTT/2, but smooth the RTT...:)
Something on those lines...
It's tricky to get it good, but with a lot of experimentation you get it
hmm, so for starters, itd be something like a moving average of say the last 10 received RTT/2?
That's a good start, yes
ook gotcha
btw: good to give suggestions to someone who seems to understand them...:)
hello i know that unet is deprecated but i have a question is it free now?
It's always been free, now it's just dead...
You have mirror, which is an open source evolved version. Use that instead if you like the unet ideas/approach.
@gleaming prawn @worn dome is your discussion about networking code theory in general, or specific to any library? I was about to ask about a situation seemingly fairly similar, but with regard to DOTS Netcode and what I should expect out of the box (in its current state) vs. what I'd need to manually implement myself (smoothing of movement) as I'm seeing choppy frames
my question was about netcode theory, im not at all familiar with how DOTS work unfortunately :/
gotcha
I followed (and have since expanded upon) the "Getting started" guide for Unity.Netcode, and once I make the "player object" move faster, the skips become more noticeable
I'm wondering if that's just expected in its current state and will be fixed library-level in the future, or if I'll need to compensate
It's "general" for state transfer based approaches
The current dots netcode library is expected to be deprecated (yes, another one)... They will start over again
Do not use preview packages, specially from unity...
Se mature software instead...
@gleaming prawn seriously they are going to scrap it ? I thought they were working on it and building features for their battleroyale game project?
You might be thinking of the wrong company ๐
Probably not entirely, but that package is useless for any game other than a small scale fast FPS
It's pretty normal for Unity to scrap things that are early in their lifecycle. There were several input system previews before the current one.
It was not a bad one for that kind of game, it's fine....
But that would never grow to be a fully fledged netcode framework
There's no official wordy but it's not being uodated thelat much anymore, and it is too restrictive. Expect something totally new at some.point again
I think Unity in a recent blog post mentioned that they will build something that is beyond a transport layer with some extras
They always promise, yes...:)
Fair ๐
Those who must have some solution in DOTS, Vis' latest project might be worth a look https://assetstore.unity.com/packages/tools/network/dotsnet-102633
dotsnet is a joke
Welp nvm ๐
@gleaming prawn they are not scrapping the DOTS NetCode btw... they are just building something else/modifying it to also work for GO/MB workflow
but it's not being scrapped
Wanna share some pointers on dotsnet?
@spring crane how do you mean?
What issues are you seeing?
Hello, anyone know how to load your account from a website. For example my username is wizardboy and i joined a server and it would say wizard boy but if someone else from that website joined and the username was "hello" their username would be "hello" in game
Hello All ! Am working in a two player game where UI elements are same. Whereas, if certain conditions are satisfied for one player then he can access the UI elements like he can click on buttons else the button should not be interactable? How can i achieve this?
client clicks button
client sends command to server
server updates states
server updates UI's via RPC
@digital girder
There will be a little delay on button click responses proportinal to latency
but you'll have your life easy
@high night i want to show button to both players but give the intractability to either one of them
interactablity would just be another state in server @digital girder
server decides who will press the button
server can check who pressed in command body
it will be no different than any other basic networking stuff, just on ui
client sending Commands, server executing logic and sending RPC to update views
trying to move from PUN to PUN2. PhotonNetwork.SendMonoMessageTargets seems to be mssing... anyone aware of the replacement?
We replaced those slow MonoMessage calls with fast calls of interface methods.
Here's a summary of the things you definitely need to be aware of:
https://doc.photonengine.com/en-us/pun/v2/getting-started/migration-notes
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!
Glad you're making the upgrade. About time ๐
yes. thanks. i already went through the migration notes. still a bit confused.
so my PhotonNetwork.SendMonoMessageTargets.Add(this.gameObject);
will be come PhotonNetwork.AddCallbackTarget(this.gameObject);
is this correct?
@stiff ridge
Each script can register on it's own. Complete objects are no longer registered.
ok. but if i have to register object , then this call is valid , correct?
Have a look at MonoBehaviourPunCallbacks. You can also inherit it and just override some of the callbacks, if you like that better. Make sure to call base.OnEnable(), if you ever override that.
if i have to register object , then this call is valid , correct?
The GameObject can't be registered. It must be some component that implements any of the provided Interfaces.
got it. thanks for clarity. i think MonoBehaviourPunCallbacks is what i need. i do get the new Callbacks design though.
Hope you are fine with it. Much much faster.
I will be off in a bit. Join the Photon Discord, if you like. Some more colleagues are there:
https://discord.com/invite/WytN33P
So I'm currently developing my own protocol on top of the already existing protocol, TCP.
This is what I'm thinking..
When the client connects, it's going to send a packet to the server with the username and password in order for the server to check whether that player exits or not, if it does exists it's going to send back a packet to the client that tried connecting saying "Successful connection". When the client receives this packet it's going to spawn the player into the game world. Once the player has spawned in, it's going to send another packet to the server saying "I'm in" which the server then will interpret as "Okay, a new client has landed in the game world, time to notify all the other already connected clients" so the server sends a packet to all of them in which they can add a new player object to their "internal" list of players.
Here is the issue.. The client that connected has no idea about the already connected clients.. How on earth do I add them to it's internal list of players?
Is this a good structure? What's a good way of notifying the connecting client that there are players already on the server?
You send it the list of currently connected clients.
Serializing a list, hm
i have an FPS game that i want to make multiplayer, but i have no idea how.
1st, which free networking solution should i use?
2nd, how the heck do i use it?
i've already looked at several tutorials on youtube, but either they dont work because they're old, or they arent what im looking for.
dm me if u want, if not ping
Guys i'm having problem receiving my packet, it is always filled with zeros, even if i retrieve the correct packet length, and receive the full packet, the full packet is only zeros...Why?
my packet structure is this: {packetLength}_{PacketId}{Data}
where {packetLength} is a string concatenated with '_' and encoded in utf8 bytes
PacketId is a single byte
Data is a byte[]
I'd check for an answer on maybe StackOverflow, most people here don't actually develop their own protocol and the ones that do will tell you about some arbitrary solution that won't really apply to what you're asking
Those who do either don't say anything or just advice not to write your own protocol as this is reivineting the wheel.
And if you insist on learning purposes, there are plenty of books and online material on how protocols are created.
What is more relevant to the channel are the solutions specific towards networking games... These most people here bother to answer.
I'll try to look at your code...
Not sure if I can find an obvious error though...
what's the right algorithm when receiving udp packets? I mean, i have the packet length, how can i recv the full packet? For now i'm doing this...```cs
StateObject state = new StateObject();
byte id = 0x01;
int offset = 0;
byte[] data = new byte[1];
List<byte> packet_length_bytes = new List<byte>();
while (client.Available > 0 && client.Client.Connected)
{
state.res = await client.ReceiveAsync();
state.buffer = state.res.Buffer;
for (int i = 0; i < state.buffer.Length; i++)
{
if (state.buffer[i].Equals(Convert.ToByte('_')))
{
offset = i;
break;
}
else
{ packet_length_bytes.Add(state.buffer[i]); }
}
if (offset != 0)
{
id = state.buffer[offset + 1];
int packet_length = Convert.ToInt32(Encoding.UTF8.GetString(packet_length_bytes.ToArray()));
packet_length_bytes.Clear();
data = new byte[packet_length];
int c = 0;
for (int index = offset + 2; index < packet_length; index++)
{
data[c] = state.buffer[index];
c++;
}
break;
}
}``` but right in the middle of the packet, some data get lost and replaced with 00
Is it worth to recv just one byte for every iteration?
Too many questions in one sentence
IMHO there are many many things wrong in this code, but I won't point them as it should be fine for now as it looks like you just want to learn a few things.
Try to log or debug the data in every one of the intermediate steps in this code.
ok
Try to print as much as possible from the full buffer, so you see exactly what it is that you received.
You'll probably find it...
As for the best way to send/receive directly with UDP? Sockets.
But it all depends on what is your actual goal...
I'll try, btw, is it possible to just recv 1 byte for every iteration?
when using UdpClient class
If it is to write netcode itself, I'd start with a more complete transport layer library
Receiving just 1 byte is ridiculously bad... It's just overhead...
oh ok
Just the UDP headers take 80bytes... The common practice is to fill UDP datagrams with 900 to 1000 bytes, trying to never pass 1200 bytes including the headers
Because > 1200 it is common for cheap routers to cause UDP fragmentation, which is bad for performance
1 byte, no, just don't
XD
I am currently using velocity for movement but was thinking that fixed step movement might be better (feels better) and it would probably help with resimulation?
Any pros and cons?
As long as it is tick based and you store the buffer(data + inputs) for resimulations, either is the same
I'm thinking of learning networking. What tools/tutorials would you recommend for doing so?
I've heard of photon and mirror
But I'm open to learning anything
pffff
And ideally something good to publish with. I don't mind somewhat steeper learning curves
So manual C# networking?
i recommend you take a book about internet architecture
Recommend one?
and operative systems
idk, i live in italy, i used to buy italian books
that idk if are available abroad
idk, that was just a point of view
I'm thinking of learning networking. What tools/tutorials would you recommend for doing so?
@prisma hollow If you want to learn networking, start by creating even a dummy Application protocol by your own
I don't mind more of a learning curve, but I also don't see the need to go into depth when all I want to do is make a game. I see it as learning how to assemble a computer by figuring out how the CPU architecture works.
I'd love to be proved wrong though
when u want to assemble a computer, you want to distinguish what is right to do, or not, same in networking, ofc you can use the highest level class that works well, and if your goal is to make a game with poor packet customization, then you're good to go with those options in the asset store, but i personally think that the best way to learn is to get your hands dirty on the low level, understanding how things works, and what is wrong to do and what is right ๐
st3ve what is this
int packet_length = Convert.ToInt32(Encoding.UTF8.GetString(packet_length_bytes.ToArray()));
packet_length is encoded in utf8 bytes
when u want to assemble a computer, you want to distinguish what is right to do, or not, same in networking, ofc you can use the highest level class that works well, and if your goal is to make a game with poor packet customization, then you're good to go with those options in the asset store, but i personally think that the best way to learn is to get your hands dirty on the low level, understanding how things works, and what is wrong to do and what is right ๐
I see. I'm not sure what you mean by packed customization, but I think I get what you mean
https://www.youtube.com/watch?v=uh8XaC0Y5MA Is this any good?
yeah
Awesome. He seems to make a c# DGS so it seems like a decent way to go
@prisma hollow depending on your needs, you must choose between TCP and UDP for your game, that's way i recommend first studying at least the principles of those transport protocols.
Okay. I don't know what they are, and since you say they're important I'll look into them
you could also look at TCP/IP and the OSI Reference Model to understand better the logic behind every working piece of "networking"
yw
@prisma hollow depends if you want to finish and publish a game or learn the very basics
I'm one of the developer of photon quantum, so photon is a lot more than what people typically think (the free tiers of pun and realtime)
In a fast paced realtime game you definitely need UDP btw.
Ah nice. I've been looking into PUN heavily the past few days
But in general, it's not what YOU prefer, but actually your game's gameplay that sort of dictates what netcode architecture you should go for.
Pun is easy to start, you can get a lot with it. But there's a lot more than that.
Is it suitable to build on top of PUN to create a server-authoritive type deployment with a headless server build acting as a master server?
Photon has three very different products (each with a completely differnt netcode architecture) for unity;
- pun (client authoritative)
- photon bolt (cliente server, with server authority)
- photon quantum (server based deterministic predict rollback)
No...
If you want a unity instance to be a sever, start with Bolt
Or mirror for an open source alternative
bolt is server-auth? I had no idea lol If thats the case, that may be a solution.
Bolt is considered by many best in class
For traditional client server, no other tool comes.close to it's built in features... Sure there are cons and not everybody likes its API, but it's free to download and develop for.
So worth a try
You may be a life saver ๐ I think I'll give that a shot.
A project that's sort of up the same alley as mine uses bolt and works amazing for theirs. Provides a solid example as well to learn from for me lol
Pun, bolt and mirror are the most popular of the solutions out there AFAIK. I'm not related to mirror though. They have a discord server with a good community. It's another option
The most famous game made with bolt is the forest
Yeah I seen Mirror and Telepathy but I feel like I trust photon more
Long time ago, bolt evolved a lot since then as well
If you go for bolt, join it's discord as well... Ramon Melo is the lead developer since a few years,.he's cool
Thank you for the helpful info ๐ Didn't expect to get info direct from one of the devs
I'm one of the Devs of quantum, but I know well what the other products are good for
What is Quantum good for?
Anything very twitchy/fast, where latency is the villain... Up to 64 players per game.
nice
There are certain things I'd not do with quantum, but it covers a great deal of genres well
Not yet at least, as our long term roadmap is ambitious...:)
Guessing long-living game servers that handle a lot of drop in/out?
That's fine... Quantum handles snapshot based late joins automatically for you
Dang that's been my one hangup with determinism
always thought you needed to store a giant buffer of inputs
Hmm... Nah, we do not run old fashioned 30 year old lockstep...:)
We have a lot more tooling than people think..:)
You only store the inputs for replay/validation purposes...
If you want... But we do not even keep full input histories on server (for memory consumption purposes). It's not needed... Late joiners get up to date snapshots, then proceed with the input stream under predict rollback
sounds interesting. any plans to support other game engines in the future? Seems like it's not heavily tied to unity
The tooling for storing full input stream is there turnkey for you to store match replays,.of course
Quantum is a gameplay.engine in itself, yes (Sparse set ECS + physics engines + navigation agents + AI SDK), however...
Although it is decoupled from unity in terms of gameplay API (and you can run that in our servers without unity) it's designed to run on unity for a few reasons:
- half the value is in the seamless tooling both with the unity editor (entity prototypes, terrain/navmesh/animation exports, static physics colliders) and runtime view interpolation scripts
- unity's runtime (il2cpp, job system, etc) are the only complete solution for running a pure C# ECS engine (like quantum) in multiple platforms without a vm
So, quantum is designed to work well with unity... And it should continue like this
We did run tests with UE, unigine, godoh, etc, but just for experimentation
It works, of course, but from a practical and professional point of view, it is meant to work with.unity
Since it prioritizes low latency would it be practical for a racing game with client collisions?
Hell yeah
Racing games are one of the things quantum shines at
Let me show you a crappy looking video
Testing Quantum's predict/rollback fully deterministic simulation to implement 3D car physics.
Two game clients connected to same server, input being exchanged between them (via server).
No input-delay used (full rollback netcode mode), 100% WYSIWYG physics.
This is even a bit old... But this is a physics based vehicle, try to spot any issues..:)
I mean, that's not even a question... A car/racing game "holy grail" is deterministic collisions with accurate client predictions.
looks great
We have a few raving games being developed with it now... No idea when they'll be released though.
Racing
I've had a racing game idea for a while now but I got stuck in the physics aspect of it but if I ever start that project up again I'll keep quantum in mind.
I had played with one in UE4 as well and the non-deterministic physics was a nightmare
won't lie, was fun to see the vehicles randomly launch into the stratosphere after running over something though lol
yeah, I know exactly what you mean
sry was bad joke
Lol, I knew the second part was a just ke
Joke
But I'm bad at jokes, sorry, I just work.
haha
i've seen vr raving games tho so i guess it is a real genre
like dancing stuff
have there been any vr games made with quantum
lots of racing games have VR support so I see no issue with VR
well fortnite concerts are raving games I guess.
i mean games where hands are simulated as well over network, i imagine vr racing wouldn't have that
Lol, time to sleep
guys can you vote up to my question in stackoverflow pls
https://stackoverflow.com/questions/63652254/how-to-combine-between-playfab-and-photon-friends-infounity-3d
Is anyone familiar with Master Server Toolkit? https://master-toolkit.com/ Wondering if its legit. I see in the reviews of the Master Server Framework on the asset store, a user comments "Asset is not abandoned! It's still alive" and links to that above link and turns out he is the guy behind it. But then searching the github repos for both, he's not the same guy as the asset store. Anyone know what's going on there?
It just seems suspicious because its not the same owner and this new one's repo shows a single git push 9 days ago and then nothing.
sorry yeah 9 days
Is it actually the same guy and same asset (just updated) though?
ooh wait I see whats going on. He updated the original to work with mirror and has a repo specific for that. The other repo I was curious about is something different
seems legit
@tranquil pollen Pretty sure I saw him posting on #archived-works-in-progress with his game project. I believe it's being worked on alongside of his projects.
If anyone has worked with Steam's multiplayer API stuff before, I'd love some help with requesting Lobby Data, I'm just completely lost on what this means:
Why am I getting a char as a return and how does that help me find the data? It says it is a key for what I assume is a dictionary, but I don't know where to access that dictionary, or if it's set up by me or whatelse
Why am I getting a char as a return and how does that help me find the data? It says it is a key for what I assume is a dictionary, but I don't know where to access that dictionary, or if it's set up by me or whatelse
@vestal valley const char* is a string
It's not written in C#
ah
Also, pchKey is only named Key, but it's not dictionary-type Key
well I'm still pretty confused on what I am supposed to be getting?
I can send over the SetLobbyData method as well
I have no idea what you're trying to do, also I never worked with that, but your input is basically your steam lobby ID and some key to associate metadata with
Yeah sorry, ideally I would want to retrieve data with GetLobbyData and input a lobbyID with the type of data i need to get, and retrieve that type of data.
Now looking at it I'm starting to see how it functions...
You create a new object/value in the dictionary when you SetLobbyData and then can retrieve it by key later, but It's weird to me that it only accepts strings then?
Apparently your keys and values are strings.
They're not Dictionaries (or in this case I rather should say maps)
Or maybe they are internally, but it's still a map<std::string, std::string>
noob question then: what's a map?
It's C++'s dictionary
ah, okay
Okay, I think I understand it enough to try out something tomorrow
I appreciate you helping me a bit :)
โค๏ธ
So I wanted to learn networking and read up a little on TCP and UDP. From what I gather, TCP is more reliable, but slower whereas UDP is the opposite. So UDP for where latency matters and the occasional packet loss is okay, and TCP when delay is fine and getting the message across is crucial
@prisma hollow not correct really
Oh
There is no 'speed' difference between TCP and UDP per say
TCP has overhead in handshakes and packet error checking/fixing?
Difference in how they handled lost packages
- UDP doesn't care
- TCP resends the data and stalls the receiving end and resends it
Difference in how they handle connections:
- UDP is connection-less
- TCP requires a connection 'socket' on each end which is unique
What do you mean by connection-less? And can you recommend any concrete source to read up/learn?
UDP doesn't have any connections at all
You send a packet to another IP address
That's it.
There's no connect/disconnect, etc.
You just send(data, targetIp, targetPort);
Whereas with TCP?
TCP requires a connection to be established, first by hailing an 'accept' socket from one side to the other, which then transfers the connection to a secondary socket used for communication
again, kinda high level explanations but it's the gist
In general games used UDP
again, as a simplification
The only reason for that is because the difference in how lost packets are handled
But most games use UDP, for sure - there's cases to be made for TCP/IP also
https://www.youtube.com/watch?v=uh8XaC0Y5MA So I found this, but he uses TCP.
@prisma hollow don't learn networking from people on youtube is my first advice
How then?
ยฏ_(ใ)_/ยฏ
Youtube is where I've learnt a lot of what I know, unity-wise
that's a decent example of networking
and based on well established patterns
https://github.com/Unity-Technologies/FPSSample/tree/master/Assets/Scripts/Networking here's the core networking 'library' inside of the fps game
There's so much going on there I don't know where to start and how to look
then look into mirror project: https://github.com/vis2k/Mirror
How did you learn networking?
i started learning before any good resources online
https://www.gamedevs.org/uploads/tribes-networking-model.pdf i read this paper
and then just a lot of trial and error
yeah the paper is good
there's some old talk about halo:reach also from like 2010-ish floating around too
https://www.youtube.com/watch?v=h47zZrqjgLc this from 2011
In this 2011 GDC session, Bungie's David Aldridge discusses the programming that drove Halo: Reach's online networking.
Register for GDC: http://ubm.io/2gk5KTU
Join the GDC mailing list: http://www.gdconf.com/subscribe
Follow GDC on Twitter: https://twitter.com/Official_GD...
but that's it, there's some small info on the source engine developer website also around counter-strike, but it's just a few pages
that's all that was around give or take
... wow
figured most of it out on my own, discussing with other people, etc.
So build projects, try, fail, repeat?
basically
I can't complain, that's my favourite way of doing things
depends on how you deep you want to go also
is the goal to network a game, or to learn how to do networking yourself
two different options
Network a game
But I don't want to be that guy who knows how to make the API work but has no idea what's going on
for networking a game you have options like:
- Mirror (based on old UNET)
- Photon PUN (easy to use, but has no authority functionality)
- Photon Bolt (comes with most stuff you need, I'm the original author of this)
- Photon Quantum (deterministic predict/rollback, not available publicly , I'm the original inventor of this also)
- ... some other stuff maybe... idk ?
Wow. You made photon? That's kinda amazing
I made Photon Bolt and invented the tech behind Photon Quantum
photon is a suite of products, i'm heavily involved in two of them
Are there situations where server authoritative isn't the way to go?
absolutely
server authority complicates things a lot
but for anything casual i'd probably go w/o server authoirty
depending a bit on the game at hand
Till now my perspective has been that since a lot of games seem to use server authoritative and so learn what the big bois use
It is an extension set for Pun2 - so there is no server logic in any of it.
@prisma hollow Completely depends on what you're trying to make
Atleast, I'm under that impression. I know I'm probably wrong in so many ways
I'm fiddling on a little 2 player co-op card-game in my spare time
I'm not doing authority for that
It's a co-op, played with friends, etc. just complicate shit, and if you want to ruin a game with your friends... go for it
If you plan to go server authority (make sure you really need and want that), there is quite a bit on the web about doing that correctly. What fholm posted for starters
So client authority makes each client fully in control of itself, or one client as host acting as the authority?
And i can build an authoritative setup by heart without having to look a single detailed up... and I still wouldn't do it for a game like that
@prisma hollow varies really, both models work - depends on the game
Any authority model always involves deciding who is the authority of what, and many games have that mixed - even server auth games can give client authority over some things.
I don't have any specific game in mind, but I want to learn something that can atleast work for most games, even if it's far from ideal. Then build up from there when needed
Keep in mind that a generic system is harder to make than a specific one as well, if you go into networking without a game or game type in mind... you will be making a networking engine. Not the easiest place to start.
So I'm fine with learning any one specific system
I can do something like a client authoritative FPS right? Theoretically, that can function
@prisma hollow you can have the same code-base work for client<>client, client<>client host and client<>dedicated server
they are not mutually exclusive
If you are just kicking tires, I would recommend doing the Bolt tutorial. It's workflow isn't the most fun, but you can see hints of its inner-working that will make some things more clear.
most of the pieces are the same for all of them
Kicking tires describes it I guess. I have a bunch of spare time in my hands, and I've been experimenting with different things to see what I can learn. So far compute shaders and basic unity jobs have been my feat
Bolt works on the simulation with a fixed time tick engine and uses bitpacking... you won't see those in other packages (other than SNS, but that is just a beta extension library)
What's the difference between Photon PUN2 and Bolt?
Completely different
PUN2 is a relay-based client-authoritative system
Bolt is built for client-server authority, with client-side prediction for local player, lag compensated raycasts, etc.
What's this <> thing you do?
๐
Depends on what game you want to build
If you are going for a FPS, then ... no, not really.
Okay. Thanks
I'm assuming most of the theoretical aspects translate to any tool I choose?
-ish, depends a bit... bolt is very much : it has one way of doing things, you do it that way or not at all.
and those are ways i decided on when i built it
other tools are way more open ended usually
but bolt takes care of A LOT of hard stuff automatically, things you'd have to do by hand in Mirror/PUN2/etc.
Ah
Aight, got it
Ironically enough, I found a couple tutorials I like and my favourite one uses PUN2 for an FPS
But I probably favour it because there's a lot more of a visual output than the others
And it's a bit more extensive
If you are kicking tires right now, do tutorials for all of them. Each will give you some insight into networking.
https://docs.google.com/document/d/1moPBIt8cNe-h1uG01pvaOZQvrIjZfSBfDmVa793X6AQ/edit#heading=h.qql6b8eo9tfa The SNS Beta stuff I am working on for Pun2 probably does a better job of things than whatever tutorial you are looking at for Pun2. If you are playing around with Pun2, I would try the SNS stuff - since it does have a tick engine and works on buffered frames. Without that, most Pun2 stuff will be a bit "mushy".
That and you can get two players running around and shooting projectiles and raycasts at one another without a line of code - so its a quicker entry. @prisma hollow It also has tick-based syncvars, where Pun2 core doesn't have syncvars at all.
It is though still Beta, but we are actively merging it into Pun2 core.
hello! i've just gotten started with networking for a project, and I decided to go with Mirror. I just have a quick question about workflow: Currently to test my game on the same computer, I have to build the game for every change I make to run it as a client (or host). Is there any way where I can test multiplayer on the same computer without having to build each time I make a change?
@fallow elk you can use directory junctions (windows) to allow you to open a single project in multiple editors: https://forum.unity.com/threads/official-multiplayer-improvements.390823/page-3#post-3013017
Okay so the docs for photon bolt are amazing
im new in the networking in unity, and i learn it from Youtube, ok i know this is bad Question but i dont know how can i fix it because my unity is 2019.4.4f last Youtubr video about networking in 3/20/2020 : i use mirror assets , i need to move my player but i cant this is my script
using System.Collections;
using System.Collections.Generic;
using UnityEngine;
using UnityEngine.Networking;
public class Online : NetworkBehaviour
{
[SerializeField] private Vector3 movement = new Vector3();
// Update is called once per frame
private void Update()
{
if (isLocalPlayer)
{
if (Input.GetKey(KeyCode.Space))
transform.Translate(movement);
}
}
}
i will send a video wait a minute
when i delete the (islocalplayer) the player move
when i put network behaviour it say: the network behaviour is obsolete
so what should i use!
hi i think i fix it
thank U U R very helpful hhhh
is this the correct channel for netcode questions?
yes @random pier
@jovial rapids thanks. I have a question about Ghost Authoring. I want to spawn multiple actors, which would be the same archetype. How do I spawn something that is the same archetype but is unique? i.e small health pot vs large health pot
Finally! My Network System works!
Why is my photon multiplayer game so laggy?
The other player don't walk nice and cannot stand still
They tremble around
Yes, use mirror
It's an open source improved version of UNet, and works well in LAN
Any good blog post or tutorial on how to architect the code when integrating with PUN2 especially when working with a team of developers.
That's a tough one @tardy forge . Searching here I could not find any entry interesting enough. @stiff ridge might know one though. You could also join our Discord if you want. I can PM you the invitation if needed.
thank you for helping out!
Hmm, no, I don't know tutorials for that specific topic. I guess that general ideas for team organization also apply for networking.
@west loom You will have to give a LOT more info than that to get any help, sorry.
anyone have some experience with agones and unity to create multiplayer games or matching making using the Open Match from google ?
i'm thinking on create a social game similar to animal crossing but i'm looking on the network part of it to make some prototype what you guys think will be best to use? for a indie studio? and for the future?
@jade glacier https://hatebin.com/bzzmrgqvum
here the movement script
the player moving very laggy around without animation
anyone know how to setup photon and can help me with it?
What's a good way of letting a client that connects to a server know that there are other people already connected. Becuase that's valuable information that the client needs in order to work with those players. Would the server send a list of all the connected players to that client? That seems pretty "heavy"
If the client needs it, you send it
You can also consider whether it needs to know about all players. Common sense applies.
Really hard to say without knowing your game's design
if a client joins a session in progress, the entire world will need to be synchronized with the client (this could be a lot of data). So sending a list of player names is pretty small
Hi i have a question that i cannot find any solution for it in google
I hoped you could help me
I have a game that works fine for desktop
The game have a persistent scene that reads a data.json file and then take all the questions from it into the quiz
It works very well on desktop
But when i build it for WebGl
It won't load the data.js file
I checked and it's because of security restrictions so webgl cannot read locally only from a server.
So i installed WAMP
And checked unity
And they changed from www to UnityWebRequest
So i implement UnityWebRequest
But
Here is my baffling.
Inside Unity it Works well
But when i build it it stucks
I made a boolian to switch between reading from localhost and the harddrive.
It works fine only inside unity
Any ideas how can i adress this issue?
Any help will be much appreciated.
Thank you
@verbal current you might ask that question in a general programming channel. This one is about multiplayer online discussions.
But sure,.maybe someone knows exactly what it is just by reading your description (I do not, sorry)
Thx
Simple question: Does the new networking stack require ECS/Jobs? It says its "DOTS Compatible", but not whether its DOTS exclusive
Also, if anyone knows of any up to date resources on learning the new networking systems, I would be grateful ๐
@worldly cedar originally it was coded just for ECS/dots... But AFAIK they are reworking it to also work for GO/MB workflow.
But no version with that is out yet... And resources are pretty much "get the sources and try it"
Ah lovely ๐ I have managed to get the Transport Layer working with GO/MB workflow, so Im running with that for time being. I dont really need most of the features available in netcode, so im going to see how I go and convert to Jobs down the road
Thanks for the answer ๐
yw
@jade glacier https://hatebin.com/bzzmrgqvum
@west loom didn't find a solution. But it seems that my player movement and/or animation the other is runed aswell. But just for one frame and than the other player come back to the place he belong to. Bat this cases that the other players never stand still when I move.I just dont see how I can solve it in my script
changing move and animation method to don't do it over rpc it made better. But now the animations are not seen at all.
Does anyone know how to do a GetBytes from a DataStreamReader in Unity Transport? Heres what I have, its throwing an error I cant quite parse
NativeArray<byte> buffer = new NativeArray<byte>(256, Allocator.Temp);
stream.ReadBytes(buffer);
string s = System.Text.Encoding.ASCII.GetString(buffer.ToArray());
print("Text buffer: " + s);
Im going to try to used FixedString as a workaround, but would be nice to know how to do this ๐
Well...it worked, but now clients are disconnecting like 30 seconds in. So much fun haha
nmd, it was timing out. Fixed. Apologies for spam
NetCode/ECS: Following the getting started guide to netcore 0.3, I have everything working except that when I try to move the cube, it moves on the client but not on the server, in short, the server appears to not be receiving data in the DynamicBuffer of the CommandData. Does anyone know how this could happen? More details https://forum.unity.com/threads/netcode-getting-started-server-does-not-enter-foreach-of-the-ghost-movement-system.962253/
William, most people here gave up on using the netcode samples until it's more stable. Maybe you'll get an answer, but being realistic, the sources are the best bet really.
Oof, alright thank you ๐ Thought that waiting 2 years after deprecation of UNet was enough ;_;
Well, I'm biased of course, but the reality is that most professional teams go for more mature solutions.
I was liking the integration with ECS tho
You have plenty of choice outside of the internal netcode (until they finish it, if you will)
Ye, but ECS itself is also not stable/production ready as well
So you do have a lot of (good) enthusiasts working with it, but not a lot of production stuff, so no mature solutions yet
Absolutely, I was mostly fiddling around trying to get a headstart on the tech
Ye, makes sense
Maybe the guys in the dots channel itself might be more responsive
Kinda sad that I can't make my damn cube move when most people seem to have it working
I'll try it out thanks
They are the early adopters of the stack
Otherwise, what are the current popular "mature" solution for Unity MP?
I'm biased, as I'm one of the developers of photon quantum (an ECS deterministic multiplayer engine integrated to unity)
Well do tell :p
So the various photon products are among the most used ones... You also have mirror (the open source version of unet)
Which is popular around, but I can't say much beyond that about it
If you liked unet, that might be a good option, but not for ECS
The ECS based ones are very simplistic (except for the unity one, which is a good foundation, and hopefully will be a nice framework in the end)
Photon quantum was released in 2018, there are several games released with it... We are currently.in it's second version.
It IS an ECS (a mature API based on the sparse set memory model), it does not relies on Unity's.
We do use the job system to wrap out task system worker threads (although we have our own task graph controls, with less overhead)
So it uses the same concepts and approaches (so you can say quantum is a form of dots), but we do not use anything from unity's except for job system. We have our own physics engines, navmesh, math library etc. Cross platform deterministic.
Interesting, so you guys develop twice as fast as Unity xD
We have a very specific focus
Yeah makes sense, no shade on Unity I know they have a big workload
Not saying it is easy, it is not. But Unity has a different goal and scope, so different challenges
Well, I appreciate the help, I'll look into alternative solutions until further netcode updates
Or just keep bashing my head until I become a vegetable
Yes, it all depends on your own goals
Unity new netcode has nice foundations, so it's a good learning step in either case
Depending on your goal, and the speficic gameplay you want to implement, other solutions (maybe quantum) might be always better, maybe not
Honestly I just wanted to do a small multiplayer game to learn DOTS/ECS/NetCode and see if I could use it for something bigger, but for now all I really want is to learn these
I don't know if I'm close minded or just warry but I seem more lenient in learning Unity frameworks than 3rd party
Thus why I'm getting impatient to finally get a solid MP framework
Honestly, it might be different this time (they have a solid foundation), but their past attempts were not great
And you should listen to other professional in the industry (not biased me), they might have a better opinion about 3rd party solutions...:)
Even the foundation being good, their approach also implies a certain architecture that forces you to host engine headless instances (that for many cases might not be the most cost efficient option )
There are reasons why predict/rollback determinism, or even client authority, are good options.
So, it's always excellent to learn
Yeah I'm a bit scared they will be way too restrictive in the use cases of their framework
But focusing on just one approach is a bit narrow IMHO
I think they are on a better path this time, compared.to the other attempts
Basically, FPS / MOBA people were saying on the forums
That leaves out MMOs or larger scale player counts
In terms of genres and gameplay, they should cover well most cases...
There's Nothing out there that handles mmo out of the box
Mmo requires a long and complex suite of several layered solutions
That's out of the scope of the discussion :)
What I said by restrictive is more in terms of costs, as it's a solution targeted towards hosting dedicated servers (which are expensive)
Yeah okay I get it, so there won't be a choice for devs but to buy cloud servers
Yes... That's not bad per se, it's just very specific approach.
Maybe that will enable cheaper hosting solutions tho if more people start using that
With quantum we let you decide on a match by match basis if you want to have server simulation running, or just rely on determinism + replay validations
So you are not forced to use server simulation and still achieve full authority
Nah, cloud hosting with VMS is fully consolidated since a log time
If hosting becomes cheaper, our solution becomes even more cheaper (at scale).
There's no silver bullet in the end.
There are use cases where their approach is recommended in either case... It's important to have options IMHO
Yeah okay makes sense
I don't know enough about Networking to understand all that yet
Just curious but is it possible to make a video call (with Webrtc) from a unity client (on android phones, Windows applications) to a third party client using html5(phaser, play canvas, other html5 engines)?
Has anyone implemented a local network server broadcast? Is it possible with Unity Transport, or am I going to have to make the socket myself?
I am using Time of Day and Mirror for my networking, I was looking on the documentation of Time of Day to sync to time with the network and this is what is says. I'm pretty new so I have no clue what this means
To network cloud movement, synchronize the property TOD_Sky.Components.Animation.CloudUV of type Vector3```
(Xpost from General) Does seem to be a channel for Web/WebGL related stuff so I guess Ill ask here? Does anyone have a good strategy for streaming web data to a WebGL build (SSE in this case)? Nothing async works in WebGL (HttpClient.ReadStreamSync etc) and Im finding that a single StreamReader instance is allocating too much heap memory for it anyway. Sync WebRequest would completely stall the app on the request. Anyone got any tips? :/
Hi everyone,
I need some advices regarding PlayFab and cloud scripts anyone ? ๐
How do I sync animator component in Photon PUN2?
I have a working multiplayer system, but when I test the multiplayer, only the local character has animations. Any ideas?
PhotonAnimatorView is the vanilla component for that
Nothing in networking just "syncs", you have to be explicit about what is being sent where as messages.
https://doc.photonengine.com/en-us/bolt/current/demos-and-tutorials/bolt-basics/bolt-104-events In this tutorial, why is the colour changing stuff done inside update and not SimulateOwner? It seems that when I use simulate owner, it doesn't change back to the normal colour on other players
But I can't understand why
Is there any difference between when those two are called?
And apparently I can spam it on the standalone but not in the editor
Few devs in this channel know Bolt, are you on the bolt discord as well? @prisma hollow
Anyone know how to grab friends steam name when they enter the lobby? when a player joins a match I would like to grab their steam use name then set it to a [SyncVar] string variable to put on a text object
every player in the lobby should be able to see the usernames of connected users
I am using Time of Day and Mirror for my networking, I was looking on the documentation of Time of Day to sync to time with the network and this is what is says. I'm pretty new so I have no clue what this means
To network cloud movement, synchronize the property TOD_Sky.Components.Animation.CloudUV of type Vector3```
Guys, are smartfox and node server are other multiplayer sdk like photon and mirror for unity
they are AFAIK, yes
but different architectures, not the same feature sets
When you say Photon, for example, there are at least 4 different products (each with a different architecture): realtime, pun, bolt and quantum...
So not really sure what those you mentioned would compare with, definitely not even close to quantum... maybe similar to photon realtime + a custom server plugin... maybe.
I want to make something multiplayer, basic cubes with guns. You know, for educational purposes.
But I don't want to use photon. I want to make something myself... Now, I made a basic tcp server and I am able to sync positions (even though it's sometimes a bit choppy).
I have two questions. My first question is about this choppy behaviour. I want to "solve" it using lerping instead of hard moving the characters to the synced positions. Is that a good idea?
My second question is: what's the best way to prevent "cheating". Like moving into walls and such. I saw someone run an instance of the game itself as the server so it would be responsible for the physics, but that seems a bit much to me.
- Interpolation will be a lot smoother than teleporting. Here is a good article - https://developer.valvesoftware.com/wiki/Source_Multiplayer_Networking
- Cheat prevention is imo easiest with an authoritative server. This way rather than the client sending their position to everyone, they are simply sending input to the server which does the authoritative movement and sends results to everyone (including the sending client)
Yeah I was worried that might be the case.
So what are the options then? Running a unity game instance or... I guess, creating a virtual representation of the world and using headless physics?
I guess everything is virtual but... You know what I mean.
2 - the only problem is that you need the player to locally predict (so it feels responsive), and then you need to "fix/reconciliate" from the server confirmations...
THEN, you need to make sure you have a tick-driven simulation (long story here in this channel). And it will go on and on and on...
It's very good as learning, but you'll quickly see that each small problem pushes you to a somehow complex solution (that's been investigated and solved by experience in these networking tools like Source, UE, Bolt, etc).
So next is this:
Sounds fun ๐
- tick based server driven sim, so inputs are bound to ticks
- then local client must predict movements, and keep a ring buffer of positions, so it can reconciliate from server confirmations (tick based as well), and if there's enough error, re-simulate from that fixed one to present, smoothing results visually at same time.
After this is done, you'll get to shooting, which will be another story again...:)
Ah, get rid of TCP, move to UDP (unless it's really really just a toy project in LAN).
oh, I might have misread. Apologies
No you didn't, I didn't provide the context ๐
Cool cool
me me big dumb dumb
So, I have some work to do it seems. Cool ๐
Thanks for the detailed pointers
The bullets are coming out of client's legs when the host is not watching, but as soon as the client gets in host's view, everything seems to work as intended. Very weird bug, anybody had similar issues? ๐ค
Without seeing your code or knowing the library involved, all anyone can says is "you have a bug in your code" @hallow locust
Well I'm using Mirror and it's not just the shooting, a lot of stuff is getting desynced when the host is not watching but this one is most annoying so I was wondering if this was a known issue or I have messed up.
I would present that in the Mirror discord, but you will likely need to show your code. The bug is likely something you are doing.
@urban shadow I use this for reliable UDP https://github.com/nxrighthere/ENet-CSharp
So far very satisfied with it
Since you like to do as much as possible yourself (if I understood you correct) I think this will be useful to you, it just gives you some basic framework to set up a connection and send/receive data, and all other stuff is up to you how you handle it
var client = new RestClient("http://example.com");
gives me now this error
'RestClient' is a namespace but is used like a type
I imported the complete asset folder from a older project
3 months ago
why does that happen? how can I oslve it?
will need some context, what package is this?
I don't know what library you're using but you might have to do using RestClient; on top of your script
Maybe try using RestSharp.RestClient;
i downloaded another dll... same
The error says RestClient is a namespace, so I suspect the RestClient class may be inside the RestClient namespace
Never mind according to github it should be in RestSharp namespace
I don't believe RestSharp has a 'RestClient' namespace. Do you have different restclient packages in the same project?
let's check... could be with importing the hole asset folder
not even one about restsharp
nor in the imported one
sorry I didn't mean specifically Unity packages. In your VS it should show what you've added in the Solution Explorer
fk, i'm using NetCode 0.3 and my connection to the remote server fails. Anyone else got it working or knows how to debug? Everything should be fine including firewall
DOTS typically has more people in the know about netcode than this channel. Not many DOTS users in this channel @white apex
i just solved it. ran into this problem: https://forum.unity.com/threads/textmesh-pro-ugui-hidden-characters.505493/ actually not networking related. after that it worked fine. ๐
Is there an accepted method for server broadcast/discovery, or is it a per-game basis kind of thing?
@hallow locust Do you have network culling setup?
Could animator culling affect it?
@spring crane No network culling setup and animator culling mode is set to always animate
i added IPunObservable to photonView but it reads a different stream ? also there is a photon transform view on the same gameObject , not sure what to make of it ...
Hey guys really basic Photon question but couldn't find an answer, how can I get the RoomInfo or atleast the room name of the room I currently joined ?
PhotonNetwork.CurrentRoom.Name
not at all
Hey guys, anyone using socketweaver for multiplayer? Im having issues with syncing the rotation of the player
Had never heard of it until now, but it advertises that it handles transform sync
it does but its just working with position not rotation
Its good i think cause photon only allows 10 people at a time wich is not much
And socketweaver allows 20G per month doent matter how many people actualy is online at the same time
And you just pay 4cent each GB you use more than 20Gb
You should join their discord for support, pretty sure most people in here won't have heard of it, so won't be able to help much.
Im in their discord but almost doesnt have memberns no one answers me there
That is kind of the risk of new untested libraries - you are a pioneer.
Hey folks!
I was wondering if one of you might have a solution for the problem I posted on unity answers. I'm really struggling with this...
https://answers.unity.com/questions/1767645/unet-moving-a-ball-through-a-maze-together-by-tilt.html
I'm writing some code in Unity using photon and I'm trying to receive the EventData however my unity keeps saying Assets\00_5 Players\Game Scripts\Player\CardAssigner.cs(39,49): error CS0246: The type or namespace name 'EventData' could not be found (are you missing a using directive or an assembly reference?) but I can't seem to find any answers on the internet about why
im going insane and I don't know any other type than EventData
its probably something dumb but I used the docs and even they said to use EventData:https://doc.photonengine.com/en-us/pun/v2/gameplay/rpcsandraiseevent#raiseevent
I hadn't imported unityengine.eventsystems but it still doesnt work adding it
I'm new to C# so I know my code is hella messy sorry
@shut yarrow Sorry for the belated reply, but thank you for your suggestion. I will take a look at ENet-CSharp
Can't see your line numbers in your screencap @lilac zephyr
Does your editor not suggest a fix by adding this?
using ExitGames.Client.Photon;
it didnt suggest it but that worked
can i just ask why it needed that specifically
@jade glacier ty so much, I bow to u my king ๐
XD
What are you using for coding?
VS 2017 and up should be giving you suggestions for that.
If you need to know why you need "using"... you REALLY should hold of on networking. I would get through a couple single player games with vanilla Unity before even thinking about a networked game.
Learning C# and trying to successfully make a networked game will end in horrific failure.
http://pastebin.fr/64539 So I try this code and it sends this error back "RPC method 'ParentObject(Int32, Int32)' not found on object with PhotonView 2009"
pastebin - outil de debug collaboratif
I would try more stuff normally but the code is so simple I don't see where the problem is (Object has PhotonView component)
and does PhotonView have a method called ParentObject that takes two ints?
check the Pastebin, photonviews dont host methods
I don't know anything about photon, but you're firing an RPC call on the PhotonView component, and getting a message that PhotonView doesn't have a method matching what you're sending
so surely PhotonView should have that method
it says the object holding the photonview doesn't have one, when the object has the script I sent which hosts both the method and the photonview ("GetComponent<PhotonView>()")
Looking into it, yeah I cannot see what you're doing wrong. Hopefully someone who actually knows photon will be able to help haha
Yes thank you for trying to help it's really nice
Ok so I've narrowed down some of the issues
It works only with the objects that hold the original class
those that derive from it dont ?
Do I need to do something so that classes that derive from it can still access the [PunRPC] Method ?
I made the method public and it worked, i have much to learn about classes
Which ports aren't reserved that I can use for a locally hosted server? I tried checking on here but I'm clueless https://en.wikipedia.org/wiki/List_of_TCP_and_UDP_port_numbers
This is a list of TCP and UDP port numbers used by protocols of the Internet protocol suite for operation of network applications.
The Transmission Control Protocol (TCP) and the User Datagram Protocol (UDP) needed only one port for full-duplex, bidirectional traffic. The Stre...
tried forwarding like 5 different ports but checking them afterwards always shows the port as closed
@narrow thorn no - https://issuetracker.unity3d.com/issues/type-load-exception-is-thrown-when-trying-to-load-system-dot-security-dot-cryptography-dot-ecdiffiehellmancng-in-net-4-dot-6-issue
Steps to reproduce: 1. Open the attached project 2. Open the StartScene.unity scene 3. Play the scene 4. Observe the error Actual re...
@grand terrace try anything about 1024
however you might have a firewall turned on
also bind to port 0.0.0.0 (the "all interfaces" ip-address+port pair) instead of 127.0.0.1
@worldly cedar not really, but many packages provide server discoverability. it is pretty challenging to correctly expose a local host to another internet-connected player, especially outside of platforms like steam and its related packages
I've had good success across local networks with UDP broadcast, and I have an idea for an internet wide system, just wanted to check. Thanks for the answer!
So I am using Photon Pun 2 and when i do the
PhotonNetwork.Loadlevel()
function It says SCENE_NAME (loading)
But it never loads...
Code: ```
public override void OnJoinedRoom()
{
PhotonNetwork.LoadLevel(6);
}
How should I fix it?
Where exactly is the log "(loading) coming from? When this is in the right place, it confirms that the level is loading.
Is there anybody that sits on some examples on how to use the new networking system?
i notice that fall guys used the multiplay network how hard is to implement it? because let's face has indie developers without a free tier on a service is hard for us to learn and analyze the best way to create our game since we prototype to learn first using each one of those network systems...
@glad pumice great question i also want to know how to use it
How do I sync particle systems and audio sources in Photon PUN2?
I have a TFPS, and a character is holding a rifle. How can I make it so that when somebody shoots the muzzle flash is seen on all clients and the sound can be heard by all clients?
You'd send a message "I shot" (where, when, aiming at) and this triggers everything else. You'd not send a message to sync a particle system or sounds.
i think using events on some way https://doc.photonengine.com/en-us/pun/v2/gameplay/rpcsandraiseevent ?
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!
Try this tutorial to get you started:
https://doc.photonengine.com/en-us/pun/current/demos-and-tutorials/pun-basics-tutorial/
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!
Read it and code along. Then you'll at least know some basics and you can begin making your own steps.
Alright awesome, thanks!
is New NetCode system in unity have a toturial .?
Best to ask about NetCode in the DOTS channel @signal halo
Few in #archived-networking really use, or touch it.
nice
Guys i get this error : Curl error 56: Receiving data failed with unitytls error code 1048578 when i try to login with playfab email in play mode...
and i using photon Pun 2 for multiplayer, playfab is only for player data
someone help me?
i trying now to reopen unity...
@stray scroll can you help me?
@crystal glen https://forum.unity.com/threads/whats-curl-error-56.794703/#post-5291700 checked this?
I found that page too in Google. But the comments doesn't show any solution...?
You got latest version of your unity editor?
@stray scroll i restarted unity and now seem to work you can help me with another problem of playfab? i trying to get Gold Currency but it's always 0...
So you got 0 gold ๐
after i logging with playfab i load scene of the lobby and with a script i trying to get the gold currency
in playfab profile i have like 155 gold
Then you're doing something wrong ๐
Best to do then is follow a guide to get up to speed
So you got 0 gold ๐
@stray scroll, ๐คฃ
all guide is only to get currency after login... but i try to get it every time
i made a void called GetCurrency and is on Update void...
@crystal glen https://forum.unity.com/threads/whats-curl-error-56.794703/#post-5291700 checked this?
@stray scroll
It's probably https certificate missing. When I change to http it disappear
@crystal glen ich empfihl dir mit IOTA z schaffe.
what?
Oh I thought CH is for Switzerland
i have it only because i like it xD
umh i don't know xD
Or the letters C and H? ๐คฃ
Hahaha why?
can someone help for my problem of playfab i can't get currency?!?!?!?!