#archived-networking
1 messages · Page 54 of 1
Do know that multiplayer is a complicated thing.
And by judging your clip, you are dealing with a compatitive game with tight timings
Out-of-the box solutions might not offer what you are after
Well I have 5 weeks of free time at my disposal ^^
Depending on how much knowledge you have in online multiplayer
And depending on how pre-made your solution is
5 weeks might not be enough time
@jade glacier I think I've pushed the perf down as far as I can reasonably go.
I'm also going to wrap up soon enough. This is ending in some stupid feature-chase
I kindof still want to add VLC, min/max, half floats and strings to my bitstream
And add some of that to the serializer via attributes
These are my timings currently for writing + reading a Vector2
@fossil sapphire If you want a simple, multiplayer prototype online in as short time as possible and you don't want to get deeply rooted into learning networking i would suggest Photon, free to setup up to 20 ccu, where you go from there is up to you and how much time you have to learn other systems like Mirror etc
been around for a while so there are plenty of tutorials and examples available.
my recommendation would after asking the same questions here and doing a few weeks research is to check out spatialos
it seems to be a sturdy and future proof network environment and comes with a nice set of tools that integrate with unity 🙂
Make sure to add the following to the checks:
- how much it will cost you.
Any solution comes with costs involved, either direct payment, or attached to number of players, or (for "free" solutions) in added time/developer salaries needed (for the stuff it doesn't provide), or with server/bandwidth (if you need to self host)... The list goes on...
Hey guys!
So I am trying to make a multiplayer game using UNet. I already set it up and it worked. However, now I moved somthing, and when I join a game, it does not load the player nor other prefabs. I load the scene manually
Thanks in advance
@karmic monolith before anything you should know that UNet is deprecated, and not supported by Unity anymore. There's Mirror, which is the open source fork that is trying to keep the UNet approach alive.
yeah I already know that. However we have already set it up and we need it done asap, because it is a school project
If it's just a school project, which will be abandoned after you get the grade, by all means go for UNet
Yeah, should be just fine. Sorry I'm not able to help you with the exact question.
We tend to answer thinking as if everybody is trying to release a game with production quality code...:)
Hello guys, got a question
what is the best way to limit the amount of time a client produces an input to a certain time interval
to prevent faster client to produce more inputs (i.e. moving faster)
because both update and fixed update are dependent from the performance of a client
thus faster clients would produce more inputs over time
I thought of using a tick system based on timeperiod and time.time, but unity advices against the use of time.time in an update cycle
{
if (Time.time > Nextactiontime)
{
Tick = true;
Nextactiontime = Time.time + TickPeriod;
}
else Tick = false;
....
faster clients would produce more inputs over time
That's normal
As per a network developer of Vermintide 2: Clients with higher update rates also generate/consume more network packets
(Paraphrasing here)
sure I know this
that's why im asking how to limit it
I can't have some players being faster than others
I guess every game has a way to limit this
I'm wondering what is the best implementation... i.e. performace and precision
The context is an 100% authoritative server that receives inputs from clients and clients only receive position synchs in exchange
What's wrong with 1 game being faster than others?
You are always going to have this anyway
I'm making spaceships moving
there would be a spaceship traveling 2x the speed of another
if you have a 100% authoritive server why dont just merge all commands since the last tick?
so if you have 2 commands like move, only process it once
@foggy vale implement the token bucket algorithm
Or flag commands with ticks, so you only accept one per tick... This requires fixed update rate + synchronized clock
But it is a common solution nowadays... We use it (in our case because we run determinism, so attaching commands to ticks is a requirement)
But token bucket is an option if you don't have that option (synced clock + fixed update rate).
I've seen more implementations where packets contain #tick as a field
@gleaming prawn What do you mean with sync clock?
Well, you need a single source of the tick updates (a "stopwatch" to tell you it's time to call Simulation.Update() again)
And the source of this clock NEEDS to be a single HARDWARE, because crystal clocks DRIFT
It's a very basic problem you need to solve.
Uhm.
I think it's best that I try to solve this when I run into it
Because right now, I am confused
It's not easy... I know
But if you don't do it, it will not work correctly...
It will be difficult to prevent speed hacks, or you'll get a client that cannot play anymore because his clock is drifting, etc
Or player will have disadvantage, etc
I haven't done anything yet with networking aside from some prep work with serializing...
So most of what you tell me flies right over my head
Well, that's why we think good networking tech is actually cheap....:)
As soon as I'm finally done with my current thing, I will try to get player movement synced for my game
There's A LOT of experience and solved-problems you won't have to deal with
Hard problems...
Building netcode is basically building a game engine on itself... So you've got ask this question:
- Do I want to finish my game, or write an engine?
Both
If you mean by option A I should go for a pre-made solution like Mirror or whatever
That's not what I'm here for. I'm doing this because I want to learn the nitty gritty of it all
Rather than have some library do it all for me
I'll not give a lot of opinions on specific tools
That's not what I'm here for. I'm doing this because I want to learn the nitty gritty of it all
Yeah, that's fine
I will basically need to build a "network engine" if you will, correct?
Some mechanism that handles all the inputs/timings etc
It's a lot.. You minimally need:
- server synced time
- input serialization
- decoupled game simulation (Fredrik's famous update function model);
- either state serialization (+ sync mechanism: either state transfer or snapshot interpolation) OR determinism (either predict rollback or lockstep);
And getting each one of them right is a lot of work...
But yes, possible... This is what Mirror, UN, PUN, UNet HLAPI, Bolt, Quantum, SpacialOS, etc etc do (some better, some worse, some really bad).
You said that predict rollback would suit my use-case best
The reason I ask about your goal is because it's super awesome to be an "engine" guy, yes... There are lots of jobs/positions asking for this particular type of guy...:)
Truthfully, I enjoy making games a lot
You said that predict rollback would suit my use-case best
I don't exactly remember your use case
But I also enjoy getting to know and use the technical aspects
That's why I think my current job is boring
It's mostly using big frameworks and libraries that do all the heavy lifting
writing netcode is much closer to writing game engine code than it is from writing gameplay code
Yeah, I know about it that far
My use case is an action-rpg dungeon crawler game
Think diablo, to put it most bluntly
Specially Quantum, it's literally building a gameplay engine (as we write our own physics, navigation, ECS, data asset pipeline, etc). We just don't deal (much) with rendering and input frameworks
Think diablo, to put it most bluntly
This is one of the cases in which both predict-rollback determinism OR state transfer would work...
Each with its pros and cons
Predict rollback sounds like a beaufitul solution to me
As Fredrik said, original Diablos were even a strange mix between the two concepts (AFAIK)
Predict rollback sounds like a beaufitul solution to me
I think it is, but I'm biased
Well, don't forget that this is not going to be some professional end-product
Well, don't forget that this is not going to be some professional end-product
I tend to say you should target building something you are happy to give to other people to use...
Because this forces you to do your best
I am
What I meant to say with that is, I need it to work for my specific use case and that one only
The problem we saw with what you are doing is:
you are writing a library
I don't need some crazy-advanced abstracted networking like Quantum
Nobody will use it unless it is professionally made.
I don't need some crazy-advanced abstracted networking like Quantum
I tend to describe it as something that actually works (and it is more or less simple to use)...:)
🙂
Not targetting what you do, please understand that...
It's super awesome that you want to understand HOW TO... This is actually the only way to learn...
And then, at some point, build stuff that will be used in practice
I juts don't know exactly how I could help more, I learn by trial and error (specially at the start)
Solid programming background sure helps...
I'm tailoring those libraries I'm writing to my own needs. And want to make them intuitive enough to throw them on Git, so others don't have to put in the same work as I have
But I always end up with feature creep, endlessly adding stuff I might at some point use
But never actually end up using
Yeah, just be prepared to work for 2 years before having something that will work well enough for a game. Specially if you're working alone
I personally recommend finish a complete stack by whatever means necessary, and THEN revisit the whole thing, maybe even starting from scratch. A generic library will lead you down so many rabbit holes.
that will work well enough for a game
By this I mean something that makes the game really enjoyable. Just having something that barely works is not so difficult (maybe this is enough for learning)
Until you finish a working stack, it is hard to imagine the actual usage
I agree with @jade glacier any SPECIFIC library has it's rabbit holes.
BUT there's a problem with this approach as well:
- if you write 1 (one) networking stack, you'll be getting down ONE of the rabbit holes
- you might end up biased towards that only solution...
I mean, isn't there the option of making a stack and improving it over time?
I fight the tendency to think-quantum everyday... This is important to me
You will refactor things SO much you will often wonder if a restart makes more sense 🙂
I mean, isn't there the option of making a stack and improving it over time?
Probably better to throw the first one away...:)
lol, exactly
What I have found is parts of your lib will survive
Have you guys ever saw the solution used by Planet Annihilation?
Ehm, so
How do I develop this in a project without having to untangle everything once I decide to refactor
It's a super super nice variation of state transfer
make the parts you feel confident about into their own libraries @weak plinth and keep the "what the hell am I doing" code in a sandbox
I wouldn't aim so high with the first iteration...
If you do separate libraries, you are over engineering what should just be a dirty broken prototype
IMHO, it's important to end up with a playable game... that you can share with friends at least
If you concentrate too much on library APIs, flexibility, syntax sugar, you'll just get lost and never have anything usable.
at a glance it sounds like a compressed method of storing each tick
@jade glacier Do you mean like a net standard 2.0 dll?
nah, just cs files you consider "good"
at a glance it sounds like a compressed method of storing each tick
It is a compresssion technique, that works super nice for forward/rewind
you might want to namespace them off and such
Ah, so you mean literally separation of folders in assets?
And that still keeps perfect server-authoritative scoping (like strate transfer)
Basically, keep the stuff you feel confident about separate from your throwing shit on the wall code
No need to overthink it, just be aware of if what you are making you feel confident about, or if you know its a complete unreusable mess
@jade glacier you should see how many prototypes we've thrown away before we ended up with the first consumable version of Quantum SDK
Like my compression libs I trust
I pull them into any new project and I count on them just working @weak plinth
I can imagine, I know fholm farts out libraries like in a week now when he tries things
but same deal there, he has a pile of trusted code he pulls in
normally we would crunch together for 2 days
That's enough to have something new working. It was at least....:)
With the two of you on it, I can imagine you generate a lot of code fast
but same deal there, he has a pile of trusted code he pulls in
Yeah, but these were not written at the first time.
After a few years you start to have some pieces you trust to save for future use
But this is not achieved in the first iteration of anything.
yeah, I was in the channels when he was trying his first deterministic stuff
he was hitting up the guys in Shrine of Loaf for a lot of his starting info
Yeah, there are some basic things you end up converging to...
Like:
Q48.16 is the best overall fixed point...:)
for all world sizes and everything in general?
Not Q32.32 (accurate but slow multiplication), not Q16.16 (not enough buffer)
or just for a "works for all cases" best guess?
for all world sizes and everything in general?
As a generic solution
or just for a "works for all cases" best guess?
yes
Some complex games use 3 different implementations mixed...
I've never played with fixed point, so its all alien to me
🙂
I just nod my head 🙂
I've never played with fixed point, so its all alien to me
It's a trustable workhorse... Devil is in the details to get it to perform super fast, and at the same time expose a simple enough set of operators (so normal game programmers can just use it and think of them as a float variable)
BUT, this is not a secret, good Q48.16 implementations are everywhere. Stackoverflow, etc
In any language
You also find Q32.32 (avoid these, lol)
Anything I ever do with it would likely be under the Exit umbrella...
Anyway... Going home...:)
cy
@gleaming prawn taht's exactly what I was asking for
could you suggest some links that point to how to implement a synchronized clock
(maybe when you are back) 😉
Or flag commands with ticks, so you only accept one per tick... This requires fixed update rate + synchronized clock
But it is a common solution nowadays... We use it (in our case because we run determinism, so attaching commands to ticks is a requirement)
But token bucket is an option if you don't have that option (synced clock + fixed update rate).
Will look into the token buchet solutio too... any doc is welcome
(still trying to understand how to quote someone here
> greater-than + space
greater-than + space
We send a packet with our client’s local timestamp to the server.
The server takes this timestamp and adds new data with their own local time to a packet, and sends this back to the original sender.
The client receives this packet and compares their original sent time to their current time to get the round-trip time.
Half the round-trip calculates the latency.
Subtract the server-time from the client’s local time to get the difference between server’s time and client’s time (that is: serverDelta).
We can then use the serverDelta plus the latency to find and adjust any time coming from the server to what it is when we received it, therefore syncing all clients to the same time.
Who is "we" @foggy vale ?
what obout implementing this approach to have a "Server clock"... based on Date.time.utcnow
It is from some guide I have found online
Hmm
I've looked in the source code of Space Engineers a bit
To see how they are doing stuff
And I'm sure they are using this what you described
Judging by their packet layout
could you give me a link to the code?
I'm trying to find the most effective way to implement this... my guess is that I could manage having a "ServerSychedClock" mixed with local ticks derived from its delta to the now of an Update / fixedupdate (maybe 40ticks x sec)
Eh. That game is AN implementation
mostly to limit the "Allowed tick " and prevent differences in speed/inputs
And I don't think it's the best one, as the actual product suffers a lot from lag
And they have a propietary license. It's not MIT
(Just a bunch of disclaimers)
Oh and the source code is an absolute abonimation
I don't know on the top of my head where everything is in there
It's probably best to clone the repo and browse it in Visual Studio
@foggy vale
*- The source code and art assets must not to be mistaken for free software, an open source in a free-software activist understanding, copy-left or public domain software. All source code and art assets remain copyrighted and licensed by KEEN SWH LTD. and you are allowed to use them (modify, tweak, make a derivative work, distribute, etc.) only under following conditions.
- The source code, modifications or derivative works can be distributed only if they are intended to be used as a mod for Space Engineers, and only if valid customers would be able to use them. You are not allowed to bypass this restriction and create a standalone application or use our code in your projects.*
Also, I'm not by any means a network engineer. So I can't judge how good/bad any of this is
@foggy vale a synced clock in theory is relatively easy:
- send packets with timestam from server;
- adjust client clock with it + half-RTT (compensating avg ping time)
The problem is in the details
Because ping jitters like crazy in the real world... and indivdual messages have variable delay
including the processing time in the network stacks, VMs, etc
AND packet loss, etc
So to make sure you have a synced clock is easy... to make sure the synced clock is SMOOTH in the clients 99.99% of the time is another story...
But here you'll have to experiment with it yourself, as I can't explain all the details we have in our "secret" sauce..::)
Simpsons taught me it's just mayo left out in the sun
Could just be as well...
wbonx you can also just ask the Simpsons if you want... Problem solved.
🙂
As for token bucket, there are several example implementations around. It's a super efficient algorithm, so it doesn't impact performance of the server, while giving a reliable rate-based interface for processing inputs from a client (without flagging them with a specific tick).
Here's one example in C#: https://github.com/esendex/TokenBucket
hi, are there any tools, libraries that can help me create this networking model for my multiplayer turn-based game?
here's a sample of how I currently imagine it
IMHO this looks over-complicated, and it means that if ANY of the clients fail, your architecture stops working.
You'd need to deal with "host migration" or something like "retopology" of the network ring if any of the clients stops working (if I understood correctly)
For a turn-based game, it's fine to run one of them as a server for everyone (even host migration is simpler to handle in case this single node fails).
Having a single node/client/host manage all authority also makes it simpler to move a real server-authoritative implementation (a turn based game is normally the ideal candidate to write server code even outside of unity).
because you can scale stuff like node.js, or any "serverless" computation stack to thousands of games without a lot of cost...
BUT, if you really want to implement this model @thick peak , ANY library that allows peers to send messages to each other would be enough. Examples: Steam offers a punch+relay P2P transport layer, the basic photon realtime or PUN do the same, etc etc
@gleaming prawn , so isn't anything that would work cross-platform? do I really need to make custom for each platform?
also, I choose this model to reduce costs. and as far as I know PUN pricing scales with player base. Isn't there any way to make it fully decentralized, to only have a small server for matchmaking?
so once the players are connected, their own client-side-server takes care of staying connected to all others and only after the game ends sends data to the main server.
I see this model to have some great advantages over the one-host-model
This table is inaccurate if you ask me
There's still a host advantage and the possibility of cheating in the last model. It's just more limited
You can still use client-side cheats regardless of networking model
Imo, this just looks like someone is trying to sell the ClientServer2ClientServer model extremely dishonestly
@weak plinth , that picture is not real, I made it as a comparison, that model doesn't actually exists.
almost all client-side data is actually on another's player machine (the Validator), and also on a second one (the witness, which confirms with Validator)
Also the witness/validator are helping eachother in case one disconnects
Well, ask yourself why almost every game out there uses client-server?
What type of game are you developing?
If you have some game with matchmaking in it, there's no way that's going to function properly without a centralized server for matchmaking
Also, it might be worth checking out how some existing steam games do their networking
A game like Vermintide runs with a player as host, and doesn't require any port forwarding
@thick peak the standard native photon realtime offers punch-through and gives you P2P sockets if it can be stablished
So you only need to keep connected to photon those 15% that fail.
Steam is free to use (also does punch internally), but it's locked to that platform (photon is x-platform)
you could use a pure-punch strategy, but it would only work between 85-90% of the cases (and you'd deal with 10% of your players being super angry because your game doesn't let them play).
This is what the super old, original Unity Networking model used to do... It's no secret it didn't work
But anyway, notice I'm not trying to push any specific product
but can't I just use a normal client-server and have the server included with the game and tweak that to achieve this model?
IMHO, for a turn-based game, I'd use a centralized, NON-Unity server to run all the logic
That could be super cheap because the game is turn based, so you could host a LOT in one single hardware
@thick peak Yes, you can
but can't I just use a normal client-server and have the server included with the game and tweak that to achieve this model?
Didn't understand here
If it's LAN, yes
On the internet you need to guarantee all peers (or from peers to this host) can communicate
Or nat traversal
@weak plinth that's PUNCH
I'd pay for a matchmaking server, but once players are connected I'd love, if possible, to have them play by themselves
that works 85% of the time
Punch, yes
Good luck to rely only on punch... You'll get an angry mob...:)
Steam does punch (to ease the load on their relays), but guarantees connections because of the fallback relay
You can't guarantee that port forwarding/punch would work all the time... This is a very known and discussed problem.
@gleaming prawn Do you have information regarding on how games like left4dead or Vermintide 2 do this?
Where the bulk of the game runs on a player host
But players are connected to each other via a central server?
How is port forwarding guaranteed for the hosting player?
can't just each player do the port-forwarding by themselves?
I mean, each player for the others (as they are also servers)
That's the same as Steam, Photon Bolt, or Photon Realtime.
Try to punch, if that works, perfect... direct connection (no server involved). But if it doesn't, there's a relay as a fallback
can't just each player do the port-forwarding by themselves?
Yes, it will work... 85% of the time.
That's EXACTLY what stun/turn RFC does, etc
but what is the centralized-server-model doing (regarding port-forwarding) which a player (acting as a server) cant?
We implement our model over Stun/Turn standards... I think Steam uses a proprietary version, but it's pretta much the same ideas
Damn you are confusing me...
Wait, I think you might be confusing things
A PLAYER is probably behind NAT/firewalls, so he's NOT the same as a server (with a public IP address)
Can I use their service to achieve this?
Yes
oh I see
Steam guarantees P2P messages will reach their peers...
It's just single platform...
And very low level, but these are the only "cons".
Otherwise, super nice.
Epic is promising to offer something similar, cross platform... But, not yet there AFAIK.
Ehm, if I develop a game targeted for stream
I need to use their API for networking also then or what?
@thick peak I'm talking about two different things. So, clarifying:
- IMHO, you should just use a centralized, non unity server to run the turn based LOGIC (that's my overall recommendation, not involving any special service like ours, or steam);
- on another TOPIC (if you really want to implement your architecture), then you can use a Stun server to do punch/port forwarding (we call this punch signaling, which is not standardized by Stun)... And this "server" would be temporary (you can use the same you use for matchmaking, or actually just use public google stun servers for free).
The problem with punch is that it only works between a peer-pair 85%-90% of the time...
There are Router/Nat combinations that just DON'T let this work at all...
This is a super super old topic... The whole Stun/Turn RFC is dedicated to it
Stun (punch "protocol"), Turn is the fallback relay... Stun/Turn is the standard used for WebRTC, video conferencing, etc
And also used in many game p2p libraries because it gives the same result: UDP direct connections.
in terms of costs how much is added to the matchmaking server if that will also take care of the lost peer-pair that needs help (the 10-15%)?
also, is there a possible workaround for Router/Nat that won't work at all? ( so that that anyone can play)
I choose this model because it does't increase costs regardless of how many CCU there are
Don't allow them to host a game
That how xbox did/does it
If your NAT isn't able to traverse other clients, you won't be selected as a host
but everyone's a host in this model
but it solves two big issues: cheating, and really expensive scaling costs of centralized server
I'd better get rid of the 10% of players or just keep looking for a method to allow them play too
As I already pointed out, it doesn't solve cheating
I can still use my wall hacks no matter what networking model you use
If you want people to not cheat (or limit it) don't give them access to any server locally
If you'd care this much about the integrity of the game, you'd definitely opt for a cental server
that's not an option
What are the stakes in your game that not being able to cheat is so important anyway?
it is competitive
Any game where 2 or more players play against each other is competitive
That still tells me nothing about any stakes
Do you get anything of value if you win?
What prevents me from clicking quit if I run into someone that cheats?
there is a ranking system
In that case, definitely use a central server
since that's not an option, what alternative do I have?
Or what was your idea? That your hosts are going to tell a server if they win or not?
at the end of the game ,yes
Yes, and they can't give false information there because?
because players can't report their own results
Are you going to make an entire statistical system to determine who is more likely to be telling the truth?
i.e. player 1 results are reported by player2 after player3 confirms them
Yeah, so I will just tell that "my client" who actually won, lost
player's server-side is only authoritative for the data of the player they're responsible for
The point here being is, that at the end of the line someone is telling some central server who won and who lost
This data can be influenced
yeah, player 2 can report a false player1-score, but player 3 will see that it is not real
And then what, let's walk through this
this inconsistency is reported to central-server and players are marked. In 2-3 games (if they cheat again) they will be spoted
So, you just throw away the entire score of these 2-3 games?
yes, as they are not fair
That must be nice for a person that just won
cheating is rare at start, and vanishes if players see they get banned
And good for someone that just lost
cheating is rare at start, and vanishes if players see they get banned
😂 Lmao no
People who cheat will cheat
how does other games do when they catch a cheater mid-game?
Throw them out of the game and make it a loss for them
And let the rest play unaffected
Possibly resulting in a suspension for the cheater
lets say I sell the game on steam, if someone is banned they can't cheat again
I'm extremely sure you can't just throw people out of their purchased goods on Steam
As you are using a third party service
I mean, if they login with their steam account into the game, I just ban them by their steamid
and no, I don't actually sell, I mean I put it on steam
Doubtful of how that works with steam ToS
But you are saying you don't want a centralized server
But you are also saying you are going to have one
yea, but not for the gameplay itself
Why not
cuz the price will then scale with playerbase
Or you use a model that doesn't scale costs with #of players?
yes
this is what I see as a solution to allow people make fully free-to-play multiplayer non-cheating games.
If I were you, I would ask myself why there are (to my knowledge) no games that exist with this model
There's probably a reason for that
I couldn't find one yet. If you see one please let me know
Again, there's probably a reason why no-one does this
Including competitive, ranked games
probably because it is overly-convoluted. That's what I hear the most
And probably because all of the extra work doesn't pay off
not sure about that
you don't actually pay anything, only the networking experts that will build it
Besides the fact that you still need (a) server(s) for keeping track of rankings and stats
And besides the fact that the extra time the network engineers will have to work to make such a convoluted solution work
i expect that to be less than 5% of the price i'd have to pay for a fully secure centralized server
Will be the same as up-keeping costs for this simple table-top server for a millennia
So, lets run some quick numbers
This literally random website I found asks for 241 dollars per month
A network expert costs what, 200 dollars at the very minimum an hour?
So for every 2 days 1 guy needs to spend extra working on this solution
You can rent a server for a whole year
And those are low figures
b ut once the solution is done, no more costs
@weak plinth you said this:
I can still use my wall hacks no matter what networking model you use
Are you SURE? 🙂
By wall hacks you mean shooting through walls=
?
No, seeing through
Shooting through is definitely not possible, I know 🙂
If the character is in the vicinity, true
This is super difficult, as you can do wall hacks directly with the GPU driver..:)
difficult to solve...
Yes, I know
And yeah, you don't send everything to the GPU... but anything close will go to
I saw some amazing documentary about some guy that made a wall-hack based on sound
otherwise is too expensive to cull...
another thing super super difficult to combat (and any networking model is vulnerable to) is aimbots...
He just reverse engineered the 3d sound produced by the game to determine where the person is
BUT, the end of story is:
- solving THESE is not in the scope of what Netcode is responsible for
Nope. Because it has nothing to do with netcode 🙂
well, SOME hacks do
like shooting through walls you can solve with good models
Walking through walls same
Wall hacks are borderline..
Snapshot interpolation and determinism are vulnerable to it (although the implementations based on GPU drivers can be prevented).
But with State Transfer, there's the possibility of preventing some wall hack situations based on LoS checks for scoping...
In game which are not super super complex this is feasible,.. So there will be no data on your machine about the guy behind the wall (until he walks around)
Networking for FPS games is insane 😦
Quite ironic. The games themselves are probably one of the easiest to make
Looks Easy
Might be a bit easier today because there are so many solutions ready-made for them that you take for granted
Like KCC implementations which are mostly targetting FPS movement, physics engine raycasts, etc
I won't ever touch the FPS genre, no way
Making those games feel good is rocket science
trial and error as well:)
@gleaming prawn If I'm planning for a steam release, should I do something special in terms of networking?
I don't understand the question
If you ONLY plan to have steam, you can rely on their super basic networking (it's just a UDP-based nice transpot layer)
Can I just use ENet even though I'm targetting steam?
That's basically my question 🙂
So you can implement P2P server-less models.
But that's about it
I don't think you need ENet if you use them, because their API has a few options AFAIK, like sending reliably, etc
or at least giving you back the ack when message is confirmed. I haven't checked in a while...
But I can?
Not sure, because I don't think they give you the UDP socket directly
BUT, if you can pack the enet stuff into any buffer, than always possible, right?
This would make your networking layer agnostic to the transport layer you use (this is the principle Fredrik used for his UDPKit, which is the baseline transport for Bolt)
I want to try and do that as much as possible anyway
So UDPKit abstracts photon, Steam, direct UDP sockets, and so on...
I want to try and do that as much as possible anyway
It would make your library portable to outside Steam
So my networking layer just deals with everything up to buffers
Which is good in general
And transport handles sending of buffers/receiving
I think it's generally a good idea to have these different layers (from lower to higher):
- basic transport options (steam, photon realtime, upd sockets, Nintendo PIA, XB1 Teredo, PS4 Networking, etc);
- your intermediate level transport contract API (acks, reliability). You own implementation, or ENet, etc
- your networking model (entities, states, packing, compression, etc);
- your game
UDPKit is Bolt's intermediate layer
I hadn't thought of the first layer even 🤔
Quantum has one extra layer, and it's intermediate is very thin.
Not as a separate thing though. But it makes sense
Quantum is:
- base transport (exclusively photon realtime currently);
- intermediate transport layer (very thin interface, but it's there);
- networking model (we call it the baseline predict/rollback deterministic API, does all the input management, rollbacks, etc... has three interfaces which I'll detail later: Frame, Game, Server);
- ECS Game Engine (our FP math library, ECS, Physics 2D and 3D, Navmesh, RNG, assets, events, signals and other gameplay APIs);
- Game implementation (based 100% on the ECS engine only, no need to operate network APIs at all). Single Player, Local multiplayer, Online multiplayer, all use same API.
Frame: game state (on ECS, partially code generated);
Game: several callbacks for updating view, polling input, etc...
Server: callbacks for optional server authority (currently runs on photon server plugin only).
Photon Bolt is like I described previously, as it uses Unit as gameplay engine...
PUN does not have an intermediate transport interface (as it is implemented directly on top of Photon Realtime).
Is Unity’s new netcode available to use? I couldn’t find a package for it in the package manager, even with “show preview packages” enabled...
Not yet AFAIK.
Strange, I thought I saw some people on the forums talking about how they’ve played around with it
If it is indeed not yet available, the blog post about navigating unity’s network transition is quite misleading...at least it give me the impression that the new netcode is available to use in preview
There's the FPS sample
Good god, don't go there though
Its a solid implementation from what fredrick says, but to even witness it you have to install the entire massive project
and even then, its hard coded for its one game type
And the snapshot delta compression is quite cool...:)
It's a solid implementation, but yes, hardcoded to that particular sample...
Is anyone aware of a timeline/potential release date for a preview package?
Being honest, I don't see Unity people answering much here.
And only them can answer that.
Do you actually need to make use of the DOTS aspect of it?
Yeah I just meant maybe there’s been some sort of announcement I’m not aware of
I’m relatively early in my games development, and I want to switch to pure DOTS, and the new netcode seems to go hand in hand with that,so I’d like to switch to that as well
That it does
DOTS is not even ready itself.
I’m not planning to release anytime soon so the fact that there will be breaking changes over the next few months isn’t too much of an issue
If you aren't in a rush, it will all come along eventually
So, only Unity can say anything there. I'd not bet yet.
but its bleeding as bleeding edge gets... not a fun place to try to publish a networked game from
next few months
You're being optimistic...:)
Lol
Getting dots to a user friendly place is going to be an achievement... and Unity tends to lag far far behind on anything networking
True
So, really is mostly a question of what you are doing
If its just hobby poking around, then sure - just play around with whatever Unity releases
but if you have an actual production, I would not bet my company on DOTS networking any time soon
Well it’s a massive project which I’m not sure I’ll ever release, so I’m working on it largely for the learning opportunities
And what is there is painful as it is. Like the Unite presentation took 20 minutes just for the presenter to spawn a player
There's another reason to look "beyond" dots networking
Beyond?
Unity eems to be betting on a single approach, which is to run a Unity headless build as server
That's what FPS games do... But not really a silver bullet
So if you restrict yourself to anything Unity releases, you're locking yourself to run everything on Unity headless servers (and for online games, this means the most expensive option)
So it's all about what your GAME is
Expensive as in financially or performance-wise
Depending on the genre, you'll need even more than what Unity will offer...
Expensive as in financially or performance-wise
Financially
Depending on what you do, more than one order of magnitude more expensive than other options
Performance will be stellar, but performance and networking is a complex conversation
Like running super cheap turn based servers, for example
Based on the netcode forum post we’ll be able to self host servers so why would using unity be more expensive
Or running super cheap servers for input authority on a deterministic system
That is still hosted I think is Erick's point
Self host IS the most expensive option...:)
That's the point
Self host means you need to run One Unity process per logic server... And then you need to pay for the physical servers...
Hmm but what’s the alternative
You can have one VM to run a few unity processes... But this is still a LOT more expensive than running thousands of CCU in a SINGLE machine with custom code...:)
Well... Alternatives is what we all discuss here.
There are tons of alternatives (Steam, Photon, Your own stuff, etc).
Most of them will be much much cheaper.
As I said, first thing is to check what is the best networking model for your GAME
Well right now I have a server built as a console app, but I can’t use Unity’s physics in there
Then you start to think about the alternatives
What is the gameplay like?
is it an FPS or TPS?
If you are building your game while deciding all of this, I would STRONGLY recommend start separating out your game simulation as much as possible
FPS...think sea of thieves-like
its kind of a common denominator for easy networking.. you want your simulation to be as abstracted as possible
Yeah I figured
Well, honestly:
- Just use Photon Bolt
- Or UE4
lol
Or wait for Unity and hope for the best...:)
FPS is the genre they are aiming for...
yeah, if its a classic FPS/TPS without some giant persistent world and more match based... Bolt will pretty much get you there.
So that's cool, DOTS seems to be the way to go, if they finish it soon.
Unless you have LOTS of deterministic AI.. then you want Quantum 😛
Bolt does not integrate with DOTS as of now, but it's the most complete state transfer framework out there.
If you want to finish the game, it's good.
If you want to write LIBRARIES, do your own stuff
Yup, all comes back to "what are you making?"
Apart from the DOTS compatibility, I was also eyeing the lag compensation/sever rollback stuff which is something I’m not sure I want to build myself simply because it seems so complex
CS is snapshot interpolation, bolt is state transfer
Did it evolve out of that?
Bolt has more features, like scoping and priorization
I just know when he made it it basically was using the CS way of doing things
CS does full snapshot interpolation (it's best for competitive)
But it may have evolved, so I am not expert on Bolt
So but unless I put bolt into a unity server, I still can’t use unity’s physics server side
The physics are its own
I just know when he made it it basically was using the CS way of doing things
In some aspects like lag compensation on server, yes
@dire venture Bolt IS a Unity asset
so it uses Unity physics
Oh I see
Except for lag compensated raycasts, which it does with it's own cached hitboxes
For the controllers and hit colliders and such though he had to roll his own
for resims to work
but the basic physics stuff is unity
But its in unity, so you aren't excluded from making use of PhysX
yes, that's what I meant for the cached hitboxes @jade glacier
Still would really like to use DOTS lol
Then you need to wait and hope for the best..
Yup, if you have time to wait... you have that option
Or, maybe we are working on something for DOTS...:)
fholm has made a few stabs at it he shared in the channels, but kept finding it to be not ready - but I have no idea on the NDA side of things where that is.
Or somebody else here is...:)
“That option” meaning which exactly
fholm has made a few stabs at it he shared in the channels, but kept finding it to be not ready
DOTS is not ready, so it's difficult to commit apart from some experiments (I mean, for us to make a product around it, for example).
Yeah I mean this is kind of a personal project so I’m in no real rush
But if fholm can't make use of it... I wouldn't expect many people to be able to for this yet
Its just not ready
You can...
There are some guys in the NCoders channel who are messing around with it
Although my biggest concern is building gameplay in a way that isn’t compatible with alternative networking solutions...I’d rather not rewrite everything if I don’t have to
Focus on your simulation in the meantime I would say
The more you can decouple your simulation from rendering, the best
That gives you all the flexibility later on
Almost all horror stories about people trying to network already made games comes from the spaghetti of entangled simulation and rendering.
Yeah that’s what I want to do, but I’m not super familiar with the workflow of more traditional networking solutions so I’m not sure if the way I’m abstracting things is enough/will work
Messaging <-> Input and State Buffers <-> Simulation
Messaging and Sim should not touch one another
It's not really the "unity way" we know about since years, but it's the right way, and will be fine with DOTS.
Yeah see my custom solution doesn’t really have that lol
It’s a very rudimentary solution
Well I have the physics simulation
Make sure you can as deterministically as possible isolate that pre and post stages of that sim @dire venture
@foggy vale you mean the new netcode or is this something else?
LLAPI is a transport layer, and that's it
@dire venture My advice is... don't try to make a game and than implement the networking later... doesn't work this way
Messaging itself isn't going to care much about DOTS
it's pretty much a glorified UDP socket, with some extras
Definitely not doing that @foggy vale
messaging is literally just byte[] being mailed around
@dire venture is a rework of the low level network Api from unity ..... but this time with more featuresw.. pipelines, better multithread and ECS support
@jade glacier i don’t have buffers or state at this point
How about my byte*
LLAPI is just an abstraction layer over the platform specific UDP sockets + acks and a few extras
yeah exactly... so a low level net lib
your byte* is still going to just be a byte[] to the system io
My byte* is going to be a byte* to the system io 😄
Sockets fix byte[] and cast to byte*
@dire venture you are going to need to start thinking about Input and State buffers
At least, the winsock dll does
Yeah thought so, not looking forward to it though lol
Whatever form they are in... be it traditional classes, or memory maps with dots or whatever @dire venture
My only point there is that the transport is just taking serialized stuff and sending it. It doesn't care how beautifully memory aligned things where
@weak plinth
Yeah, you're right
@dire venture Either use a high level Api.... like unet or what ever ytou like... but then you are going to be tight to it the whole develop and get's hard to switch. Or if you are skilled enough you build from the bottom, in that case any low level net lib will do the job and you build from that
All of my stuff still just stores states and inputs in classes... so when DOTS finally delivers I will be revisiting the whole buffer layer.
@jade glacier So, your grandchildren will inherit your project and can finally convert it to DOTS? 😂
LOL, maybe
Hey, generic serialization is almost here!
Who would have ever guessed such revolutionary technology would be available in 2020
Generic you mean it also supports classes?
Right now I have a Frame base class is all and I derive from that. It works well enough for MonoBs.. but it wont cut it when dots is a thing
Or just structs?
Anyways thanks for the input guys, I have a lot to think about lol
I hope both, but I don't even know
Focus on structs...:)
Classes and managed structs are a special corner of hell for trying to memory align stuff
Guys try this Ceras library I told you about..... is super.. does Class serialization with looping
I am, but I can imagine people have a use-case for classes as well
Take inspiration from fholm's native collection library, that's faster than .net's original one
Just by restrciting to structs
Just by restrciting to structs
I immediately had to abandon that since I have to play nice with MonoBs
For runtime transfers, if you care about performance, avoid classes...:)
@foggy vale I have my own serializer for network stuff
seeems it does what you want to implement plus polymorphism.... pooling... custom constructors.... autoconstructors
I immediately had to abandon that since I have to play nice with MonoBs
Oh, that...
If the Ceras library doesn't use either IL (which it probably doesn't), not uses code-gen
I'm skeptical of the performance
I allow MonoBs and unmanaged structs. I drew the line at managed structs... they couldn't be pinned.
I'm done chasing that dragon for now. I Codegen and that wires up delegates. That is good enough for me.
it does Codegen
@weak plinth but it had ways around codegen to prevent some of its problems
---- silence ---
everyone is checking that Ceras lib 😄
1 uS is quite good I think
The Ceras bench does caching pre-test
your does do polymorphism... looping
guess there is a lot of checks there
it is a big project
the one you posted is doing looping
check for a standard struct
The one I posted, where?
https://hatebin.com/todedhcqsg
Ive gotten mine down to just some initialization reflection, but after that its all just delegate references
yeah I said the one u posted
The codegen side does most of the work
the one you posted is doing looping
check for a standard struct
I don't understand this then
that specific case is not optimal
didyou implement custom classs serialization with looping ?
and your impleementation does this 10x ?
t takes 1.5 micros for 1 object?
That's what I can do for a full KCC update...:)
IT's a custom struct serializer
1.5u is A LOT
And it's far from an optimal sollution
But it's still light-years ahead in terms of speed
DOA...
And why would you need classes for network IO anyway 🤔
And I'm extremely skeptical of the memory footprint this has
why not.... very fast to implement for a prototype... but it does also structs serialization
Does it generate garbage?
And if I write a struct of size 16 packed, what is the size in the buffer?
Also, mine does bitpacking
This one probably doesn't
for a next gen Netcode tech, DOTS style, You need to be able to serialize something like:
- a few 1000 entities
- over 100 connections (so separate delta serializations);
- in under 1ms
No one is getting that stuff right first networking library attempt
My bench was running 70 nanos for serializing and deserializing a Vector2? I think
So 35 for once
Full auto
~45 nano for semi auto
Full means it finds the typeinfo for you
semi, you supply it
guess it is different serializing 2 floats from serializing a class with looping
That's not going to make a difference of factor 40
@gleaming prawn serializing 1000 entityes in 1ms is double with this lib.... over 100 connections I don't know what u mean
1000? One small class is already taking 1.5
yes
so 1000 X 100?
not all 1000 entites would go into each connection, not on every frame also
ms not uS !
Since different players will see different parts of the world and have different lost packets they are recovering from and such
but serialization is just one tiny aspect
So you should make it absurdly fast
so 1000 X 100?
No, not so much
frame? we are talking in ms not frames
The fastest you can probably get is with IL
I said frames meaning ticks
the prioritization engine is where it gets a bit brutal
network tick
net tick isn't 1 ms
yeah, you need time to do this on server ticks:
- receive, deserialize inputs
- run server logic
- run scoping/priorization
- serialize (with delta compression);
- compress and pack to send;
The faster you run all this, the more CPU you have to run multiple instances on a single machine...
The cheaper your game is to run online...
it does 40uS for 1000 entities ina list
Everything WE (I mean people in this channel) directly impacts the running costs, and viability of a game
it does 40uS for 1000 entities ina list
That's better
Universal binary serializer for a wide variety of scenarios https://discord.gg/FGaCX4c - rikimaru0345/Ceras
I understood 1.5us for one small object
it depends..... guys one is talking about serializing 2 floats.... the other 1 struct
hard to compare if we talk about tomatoes and apples
anyway.... I love the flexibility so far
? You are not listening then
if one of you has a better serializer with the same performace to suggest.... I can try it
His benchmark result literally says it takes 1.5us for one of these Person objects
And then the question is, why are you using classes for network IO
I'm testing it with classes and structs
very flexible when you can take advantage of polymorphism
You shouldn't want this for networking
will write with it the DB too.... maybe
just testing while imlplementing some features
DB= database?
saves.... or simple db
And it's fine for writing to files
?
database is anything that you can throuw is data and get them back in a defines structure
a db is a fil a serializer and a program using it
(sorry for the typos... I'm dislessic)
anyway... thanks for the opinions about the performance
always eager to know how to better evaluate cases
I thought you meant an actual DB
Like Oracle
Or MongoDB
@jade glacier 😂
@foggy vale I'm nearly finished with my serializer. You can use it if you want
Once it's finished
if you like
sure
I have thefeeeling that I'm ok with my framework so far... and happy to have avoided UNet and other similar implementations
@gleaming prawn Not sure about using a TokenBucket... but thank you for the link
do you have a similar link for the implementation of a Synch clock with the server?
data.SetLong (1, (long)(DateTime.UtcNow - new DateTime(1970, 1, 1, 0, 0, 0)).TotalMilliseconds); // get the current time as unix timestamp
Then a ticksystem based on the synch from the server
{
Tick = true;
Nextactiontime = Time.time + TickPeriod;
}
else Tick = false;```
Hey guys, I'm just getting into this stuff and I'm very interested in multiplayer but one question bothers me.
Let's say I've made a nice game (on my own, no team) and there are a lot of people that want to play it ASAP. It's only multiplayer using dedicated servers using Transport Layer API.
And that's my question: Let's say I have 32 max player servers. How could i handle the let's say 5000 players playing the game at the same time? Would I have to rent 160 machines and put servers on them? How the hell would I handle that? Please @tag me in answer.
If you made the game before even considering networking, you are likely boned right out of the gate. But depends on how you deal with your simulation. @worldly plinth
If you have a lot of your logic inside of misc Update() methods, you are going to need to replumb most of your game before even trying if you want to not go insane.
That's not even my question and I've said I'm just getting into this stuff. I haven't made any games yet. I'm just wondering how is this handled.
I misread then, sounded like you had made a "nice game"
Let's say I've made a nice game (on my own, no team) and there are a lot of people that want to play it ASAP
My point being, don't make the game and then add networking to that... it will take years off your life.
You are going to likely need to spawn instances of the game server for each "match" or whatever you call it
Lots of other questions have to be answered, like what the server is responsible for.
If its little more than a relay, then you can spin up lots of "match/room" instances easily enough
if the server needs to run a simulation then it gets a bit tougher. If it needs to run a full unity instance for PhysX and such... then it gets much more restrictive
Have you made a few Unity games at least already? I would start with a new one just to get your head around the difficulties of networking with any library.
I know small steps etc, it's only question about thing I don't understand.
Just to simplyfy imagine this: I make a multiplayer game that works by using dedicated servers. It need's to run simulation for AI enemy's . Servers are 32 player at most. How do I apply it if I release a game and 5000 people want to play it at the same time. How do I setup this servers? Do I rent like 160 machines and run server on each? Or maybe few server per machine? Or maybe there are some services that do it automaticly?
Is the simulation something you write yourself? Or is it relying on PhysX and Unity classes?
The more you can isolate it out, the easier it becomes to "spin up" instances
But yeah, you typically have like a Lobby or something
and from there you match make
and then those players are given tokens and are connected to a new instance of your game simulation
Ignore it, it's not important part. I mean setting up the servers themselves. Doesn't matter what it has. Do I just:
- Rent a machine
- Put as many servers as it can handle on it
- Repeat until I can satisfy all players?
I'm not talking about in-game part
It all depends on how you go about hosting of course
And what are the ways?
if you use like PUN or Steam vs rending metal boxes
Not entirely sure what steam's architecture is, but others in here do and likely can chime in
It does offer punch and relay and such, but i don't know what it fully does and doesn't do
Ok, how would you do it. Imagine you have made a mp game that uses dedicated servers. Where would you put them?
Would you just find some comapny that rents machines and put your server files in there to host?
Its a bit of a broad question, because it comes down to what you need from those servers - the numbers involved, how much you want to keep things in-house etc. But there are answers for every possible combination you decide.
It's fairly normal to rent a server from a decidated company. Especially in the case of smaller game companies
@weak plinth Ok but now imagine Your server is only 32 players and you have 5000 active players. Do You rent 160 servers or sth? :v
So you launch as many servers on one rented machine as possible right?
And 5.000 CCU on one machine. Depending on the type of game.... doubltful of that
It depends
It can be separate applications if you will that run concurently on one machine, although I think that's rather strange
There are many games that use instances within their server
A lot of MMO's do this
Ok, could you explain "Server instance", what exacly do you mean
Ok but let's say that game has AI enemies. So I would have to simulate them, each server might have different map, doing it in one app wouldn't rly be possible
Why not?
You can load multiple scenes at once in Unity, on a server as far as I've understood
And non-Unity servers are a thing...
And 5000 CCU with AI together is definitely not going to happen
- Ok so you could have like 20 different scenes running with each one running it's own server, am I right?
- Yeh but how then would I simulate AI with pathfinding, not seeing players behind walls etc
- I'm just saying that 5000 player would be playing the game on steam. Not together. Not on one server. So we would need to rent few machines, each one running app that would be running a lot of server instances. And somehow connect players to one of those instances. Right?
Scenes? You might be mixing Unity with server instances there
Unity would not be running 20 scenes if that is what you mean
Your scene would be your "instance"
That's what I meant
instance in this case = whole new instance of Unity
i'm assuming some pvp game where 32 players are in one map
Multiple scenes can run within a headless server
And it depends on the use case
You are not going to boot up multiple headless Unity instances if all you are doing is instancing a dungeon in an mmo for instance
No no, let's assume a pvp game that can have different maps
Or if a "server" contains multiple scenes that need to be active at once
You are not going to use the same Unity instance for that
Typically if that is your use case, you will code your simulation completely outside of Unity and run those sims as their own instances
@jade glacier What about AI and server auth though without Unity?
A game with an architecture similar to something like Counterstrike?
Well yes
Im just curious, I'm far from making sth like this but I'd like to know how it works
Bolt and Quantum both operate in their own black boxes like that as far as I know
There are lots of paid/free solutions that handle server-client and master server framework. PUN, Bolt, etc. I'd look into how those work and copy.
If you haven't even made a MP game yet, you are getting WAY deep down this rabbit hole way early
I honestly think noone should discuss any of this stuff until they have completed a decent playable version of Pong... using ANY library
Let me type this again: I'm not planning on making gamr like that now. I'm just curious. Same as I'm interested in how rockets work but I'm not planning on building a starship
The general idea is that to direct all these players, you need master server which every client connects to. That master server communicates with other servers to determine how many server instances are needed for the number of players connecting to it.
Those servers are separate computers that run headless instances of Unity on different ports. Or it could be 1 server if that's enough for your game.
Think of the master server in terms of a "room list" that the player can browse. Of course, you could replace that with a matchmaking system or similar that hides all that. The idea remains the same.
So you use one instance of headless unity per server and run few of them per "separate computer"
The scene method works too, but I would prefer to have one instance per game, in case something breaks or crashes.
You can maybe look at the architecture of MMO services
Since they do this, but on a larger scale
Where a login server "directs" you to a game server
I would argue that MMOs are very, VERY different in terms of architecture.
Login server and Master server are the same thing though.
So to sum up:
Game after launch connects to master server
This master server is connected to an app running on a machines that host multiple unity instances of ur server
So master server has info about all instances from each machine
Player just choose one by ip and port (or just from the list) and connects right to it right?
Yeah. The idea is that the master server uses one up or domain name that all clients can forever trust to be available.
Ip*
This is also how games with player-hosted servers work btw
The player hosted server "registers" to the master server
Yes, exactly what @weak plinth said.
Updating player count/latency and such
And from the list that the masterserver provide, you connect to one of these others
This is fairly easy to make. Since the master server is pretty much passive
You need extra behaviour if you own ALL the servers
Since you need to boot up extra servers if required
Or close down when empty
Well, I'm describing this wrong...
either you have an x amount of servers that just register to a master and that's that
Or you have a system that allows for expansion of instances if the need is there
If you get as far as spinning up servers dynamically, send me some royalty from your game as payment for this chat.
😂
Well ok then, my questions are answered
If you get as far as spinning up servers dynamically
ofc I will just give me 40 years to learn this stuff
Start hiring devops people that know 50 times more about this than any of us probably
Generally that last part is referred to as "load balancing".
There are many, many of these options already out there
And I think this qualifies as middleware
A good third-party option that's pretty (relatively) easy to understand is SmartFoxServer if you want to roll your own master.
Yeah, you'll need to study the whole gamut of network authentication, NAT, etc. to get a good result that isn't blocked by your players' routers, etc.
No one wants to hear that answer, but you can't even ask the right questions yet until you make some basic first networking attempts.
The correct answer to everything changes dramatically based on what your actual game needs.
Ok, thanks guys again for all the info and time.
Keep coming back as you get along with it
you will end up with way more questions once you start
No problem; it really is a big problem for anybody to try to solve.
Yeh I'll be back in 2 years when I finally make my first chat as networking exercise
LOL nah, chat is non-deterministic and non-simulation
Or actually sooner with 15633213216513 questions about how to make it
you will have that solved in 2 hours
Keep an eye on Unity's upcoming Connected Games service. I'm holding out to see how that looks once it goes to preview.
I think those 2 years have passed before that happens @granite otter
Keep in mind as you play with chat.. that it avoids ALL of the pitfalls of actual game networking
I am not kidding when I say "Make Pong"
Pong is a bitch to do right.
@weak plinth I know...
I was just having a chat in #⚛️┃physics about physics determinism in unity and why I roll my own character physics everytime. It simplifies networking artifacts a LOT.
Time travel (as I like to call networking) is a fun study.
For sure, anywhere you can find determinsm in networking makes life easier
and if its 100% deterministic, that lets you totally rethink how to tackle it
Since we're here, what are all the cool kids using for multiplayer in Unity these days?
All sorts of stuff, same deal though - depends what you are making for starters
I like simple interfaces that give me a lot of control over how I serialized objects.
All of my current work is with PUN2, but I am working for Exit to develop tools for PUN, so I don't count
PUN is pure relay, so its only applicable to certain models
But I am doing some fun serialization stuff with it
How would you rate PUN2 currently?
Its a blank slate, so hard to say. As a solid working relay its great. PUN2 does generate some garbage in the transports I would like to see cleaned up sooner than later
This is some of the stuff I am adding to it
Okay that sounds like what I want, actually.
Where it falls short is on anything that needs server authority
its really aimed at fast and easy dev for non-hypercompetitive games
Largely the tools I am making are drop in components like this guy, but for all sorts of stuff like hitscans, projectiles, health, other vitals, pickups and such
Hmm, I am looking for speed mainly. I would prefer to write all my prediction and reconciliation myself.
Its not aimed at that, though there is nothing stopping you from bypassing the serialization I produce
Which is fast, but sounds like you want control
the main thing going on is its all running on its own tick manager
So everything happens on a fixed clock, its designed to not be adhoc and respect simulation timings
So you can latch onto those callback interfaces for timings for serialization
same as the components I write
That's good. My intended model is a bit like lockstep so that I can save replays or slow/speed the game if players fall out of sync.
The attribute stuff above ties in the same way, any synced var with those attributes is serialized as numbered ticks into the same master byte[]
and applied using the same timings, so it all plays nice together without race conditions
Relay will not be super conducive to that. For that Overwatch style of buffer management, you really want/need a server
I am talking with Tobi about giving PUN2 some relay logic that will actually allow for that, but that is just a talk at this point
I do want to use a dedicated server for any game.
Yeah, that eliminates PUN2 for you
Can't I just treat a player as authority? Or it only does ring relay.
You can use Mirror, Forge or MLAPI and bypass all of their internal syncvars and RPCs if you just want the easy access to transports
player as authority goes totally against the other stuff you were talking about though
I've never heard of Mirror.
Mirror is Vis2k's project, basically they forked UNet
MLAPI is a cleaner attempt at that, but its a little slow on the uptake since its a lot of work to do and only one guy doing it
MLAPI is deprecated; don't want. Forge had some scalability issues with their editor scripts which power the network object workflow.
Maybe I should give MLAPI a modern look-through.
MLAPI is still somewhat active, TwoTen is in his channel. But it doesn't have the most active community
MLAPI like Mirror is all open as far as I know
The only real advantage is that it doesn't bring a lot of the dirty luggage that came with UNet. Main downside is its not super active so you would need to fork it yourself most likely... or contribute
I'll consider that.
Mirror is far more active, but they tend to push breaking changes out, and they don't have any kind of stable releases, if you want a bug fix from a release, you have to get the next release... which may have more new bugs.
They are fast though to chase them down.. so its messy, but it does get attention
Lol, I'm okay with working with a dev package actually.
Maybe I'll look into Mirror; that sounds good.
Thanks!
@granite otter here's an example of using @jade glacier's excellent sync asset with MLAPI https://youtu.be/5yslaRRaE8M
Tutorial: - install the following assets/libraries: - Character Movement Fundamentals (CMF) - MidLevel API (MLAPI) - Simple Network Sync (SNS) - create a pre...
Check the description of that video for a tutorial
@worldly plinth if you ever wanna make a game like that, consider "SpatialOS" as a possibility
Anyone knows features of websockets in PhotonUnityNetworking?
Guys I'm still trying to understand how to optimize the Synchtime / tick system
I'm wondering what would be the downside of just having a 60hz asyncronous implementation on both client and server
I mean I let the client do a cmd send every 20ms and I let the server apply the CMS from a queue when they arrive
This solves the problem of having clients running at different speeds and at the same time avoids overloading the band
I would still use UTCtime.ms and do an input send when a 20ms tick is passed
could someone advice about the downside of this implementation?
Lot of words there, but my takeaway is you are not using a fixed tick
{
Tick = true;
Nextactiontime = DateTime.UtcNow.Ticks + TickPeriod;
Debug.Log("ONE TICK IS PASSED");
}```
ticks are not synched
How exactly should I get started with Photon ? I just want to make a basic Lan WiFi game for mobile.......maybe just a co-op game or something with two people
@civic pulsar I would go on youtube to get an Ideea.... plenty of tutorials. Tha's a too generic question
I suppose......okay then
Does anyone know a free to use server platform where to deploy my Game server made with Lapi2 to do some basic testing?
I thougt Unity has a free to use game server platform but turns out it is only compatible with HLapi?
@@foggy vale Xammp ?
@civic pulsar XAMPP is a free and open-source cross-platform web server solution stack package developed by Apache Friends, consisting mainly of the Apache HTTP Server,
how idthis related?
😉
anyone has any advice?
Yah, Photons offical website shows u how to do it, but ig you need theyr source
with all networking classes as NetworkingPeer, PhotonNetwork etc @civic pulsar
You can start by downloading photon asset
Source and everything is there
Thank you @weak plinth
No problem
Also i think that, u need to put ur game source inside the ones asset provides @civic pulsar
Are there any platforms where there is minimal distinction between game code and server code? I’d rather not write everything twice to have the server be authoritative. Wondering if I can somehow use a unity build running on the server as the server?
That's highly dependent on your game structure, latency tolerance, and expected operations
