#archived-networking

1 messages · Page 54 of 1

weak plinth
#

I don't have any advice on libraries or tools that do multiplayer off the bat. It depends on your use-case I suppose

#

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

fossil sapphire
#

Well I have 5 weeks of free time at my disposal ^^

weak plinth
#

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

weak plinth
#

@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

somber drum
#

@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.

flint swan
#

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 🙂

gleaming prawn
#

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...

karmic monolith
#

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

gleaming prawn
#

@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.

karmic monolith
#

yeah I already know that. However we have already set it up and we need it done asap, because it is a school project

weak plinth
#

If it's just a school project, which will be abandoned after you get the grade, by all means go for UNet

gleaming prawn
#

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...:)

foggy vale
#

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;
....
weak plinth
#

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)

foggy vale
#

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

weak plinth
#

What's wrong with 1 game being faster than others?

#

You are always going to have this anyway

foggy vale
#

I'm making spaceships moving

#

there would be a spaceship traveling 2x the speed of another

thorny wadi
#

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

gleaming prawn
#

@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).

weak plinth
#

I've seen more implementations where packets contain #tick as a field

#

@gleaming prawn What do you mean with sync clock?

gleaming prawn
#

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.

weak plinth
#

Uhm.

#

I think it's best that I try to solve this when I run into it

#

Because right now, I am confused

gleaming prawn
#

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

weak plinth
#

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

gleaming prawn
#

Well, that's why we think good networking tech is actually cheap....:)

weak plinth
#

As soon as I'm finally done with my current thing, I will try to get player movement synced for my game

gleaming prawn
#

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?
weak plinth
#

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

gleaming prawn
#

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

weak plinth
#

I will basically need to build a "network engine" if you will, correct?

#

Some mechanism that handles all the inputs/timings etc

gleaming prawn
#

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).

weak plinth
#

You said that predict rollback would suit my use-case best

gleaming prawn
#

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...:)

weak plinth
#

Truthfully, I enjoy making games a lot

gleaming prawn
#

You said that predict rollback would suit my use-case best
I don't exactly remember your use case

weak plinth
#

But I also enjoy getting to know and use the technical aspects

gleaming prawn
#

But making GAMES is 100% != than making netcode

#

Yes, you got it

weak plinth
#

That's why I think my current job is boring

#

It's mostly using big frameworks and libraries that do all the heavy lifting

gleaming prawn
#

writing netcode is much closer to writing game engine code than it is from writing gameplay code

weak plinth
#

Yeah, I know about it that far

#

My use case is an action-rpg dungeon crawler game

#

Think diablo, to put it most bluntly

gleaming prawn
#

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

weak plinth
#

Predict rollback sounds like a beaufitul solution to me

gleaming prawn
#

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

weak plinth
#

Well, don't forget that this is not going to be some professional end-product

gleaming prawn
#

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

weak plinth
#

I am

#

What I meant to say with that is, I need it to work for my specific use case and that one only

gleaming prawn
#

The problem we saw with what you are doing is:
you are writing a library

weak plinth
#

I don't need some crazy-advanced abstracted networking like Quantum

gleaming prawn
#

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...

weak plinth
#

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

gleaming prawn
#

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

jade glacier
#

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.

gleaming prawn
#

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)

jade glacier
#

Until you finish a working stack, it is hard to imagine the actual usage

gleaming prawn
#

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...
weak plinth
#

I mean, isn't there the option of making a stack and improving it over time?

gleaming prawn
#

I fight the tendency to think-quantum everyday... This is important to me

jade glacier
#

You will refactor things SO much you will often wonder if a restart makes more sense 🙂

gleaming prawn
#

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

jade glacier
#

What I have found is parts of your lib will survive

gleaming prawn
#

Have you guys ever saw the solution used by Planet Annihilation?

jade glacier
#

like utilities you create along the way

#

I haven't

weak plinth
#

Ehm, so

#

How do I develop this in a project without having to untangle everything once I decide to refactor

gleaming prawn
#

It's a super super nice variation of state transfer

jade glacier
#

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

gleaming prawn
#

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.

jade glacier
#

at a glance it sounds like a compressed method of storing each tick

weak plinth
#

@jade glacier Do you mean like a net standard 2.0 dll?

jade glacier
#

nah, just cs files you consider "good"

gleaming prawn
#

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

jade glacier
#

you might want to namespace them off and such

weak plinth
#

Ah, so you mean literally separation of folders in assets?

gleaming prawn
#

And that still keeps perfect server-authoritative scoping (like strate transfer)

jade glacier
#

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

gleaming prawn
#

@jade glacier you should see how many prototypes we've thrown away before we ended up with the first consumable version of Quantum SDK

jade glacier
#

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

gleaming prawn
#

normally we would crunch together for 2 days

#

That's enough to have something new working. It was at least....:)

jade glacier
#

With the two of you on it, I can imagine you generate a lot of code fast

gleaming prawn
#

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.

jade glacier
#

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

gleaming prawn
#

Yeah, there are some basic things you end up converging to...

#

Like:
Q48.16 is the best overall fixed point...:)

jade glacier
#

for all world sizes and everything in general?

gleaming prawn
#

Not Q32.32 (accurate but slow multiplication), not Q16.16 (not enough buffer)

jade glacier
#

or just for a "works for all cases" best guess?

gleaming prawn
#

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...

jade glacier
#

I've never played with fixed point, so its all alien to me

gleaming prawn
#

🙂

jade glacier
#

I just nod my head 🙂

gleaming prawn
#

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)

jade glacier
#

Anything I ever do with it would likely be under the Exit umbrella...

gleaming prawn
#

Anyway... Going home...:)

jade glacier
#

so I would just steal your code 😛

#

lates

gleaming prawn
#

cy

foggy vale
#

@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

gray pond
#

> greater-than + space

greater-than + space

foggy vale
#

😄

#

😦

foggy vale
#

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.

weak plinth
#

Who is "we" @foggy vale ?

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

weak plinth
#

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

foggy vale
#

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)

weak plinth
#

Eh. That game is AN implementation

foggy vale
#

mostly to limit the "Allowed tick " and prevent differences in speed/inputs

weak plinth
#

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

foggy vale
#

thanks

#

will give a look

#

than nwe chat about the implementaion

weak plinth
#

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

gleaming prawn
#

@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..::)

scarlet venture
#

Simpsons taught me it's just mayo left out in the sun

gleaming prawn
#

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).

thick peak
#

hi, are there any tools, libraries that can help me create this networking model for my multiplayer turn-based game?

gleaming prawn
#

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

thick peak
#

@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.

weak plinth
#

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

thick peak
#

@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

weak plinth
#

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

gleaming prawn
#

@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

thick peak
#

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?

gleaming prawn
#

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
#

but I don't want a centralized server to do all the heavy-duty work

#

for all players

weak plinth
#

@thick peak Yes, you can

gleaming prawn
#

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

weak plinth
#

Also without lan, but players would need to port forward

#

Or UPNP

gleaming prawn
#

On the internet you need to guarantee all peers (or from peers to this host) can communicate

weak plinth
#

Or nat traversal

gleaming prawn
#

@weak plinth that's PUNCH

thick peak
#

I'd pay for a matchmaking server, but once players are connected I'd love, if possible, to have them play by themselves

gleaming prawn
#

that works 85% of the time

weak plinth
#

Punch, yes

gleaming prawn
#

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.

thick peak
#

but how does that work on clinet-server model?

#

the normal one

weak plinth
#

@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?

thick peak
#

can't just each player do the port-forwarding by themselves?

#

I mean, each player for the others (as they are also servers)

gleaming prawn
#

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

thick peak
#

but what is the centralized-server-model doing (regarding port-forwarding) which a player (acting as a server) cant?

gleaming prawn
#

We implement our model over Stun/Turn standards... I think Steam uses a proprietary version, but it's pretta much the same ideas

weak plinth
#

Damn you are confusing me...

gleaming prawn
#

Wait, I think you might be confusing things

weak plinth
#

If I make a game for steam

#

Can I use their service to achieve this?

#

API*

gleaming prawn
#

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

thick peak
#

oh I see

weak plinth
#

Lovely

#

Thanks Erick

gleaming prawn
#

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.

weak plinth
#

Ehm, if I develop a game targeted for stream

#

I need to use their API for networking also then or what?

gleaming prawn
#

@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.

thick peak
#

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

weak plinth
#

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

thick peak
#

but everyone's a host in this model

weak plinth
#

Don't use this model in the first place

#

It's horribly convoluted

thick peak
#

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

weak plinth
#

As I already pointed out, it doesn't solve cheating

#

I can still use my wall hacks no matter what networking model you use

thick peak
#

it's a turn based game

#

where everything is server-side

weak plinth
#

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

thick peak
#

that's not an option

weak plinth
#

What are the stakes in your game that not being able to cheat is so important anyway?

thick peak
#

it is competitive

weak plinth
#

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?

thick peak
#

there is a ranking system

weak plinth
#

In that case, definitely use a central server

thick peak
#

since that's not an option, what alternative do I have?

weak plinth
#

Or what was your idea? That your hosts are going to tell a server if they win or not?

thick peak
#

at the end of the game ,yes

weak plinth
#

Yes, and they can't give false information there because?

thick peak
#

because players can't report their own results

weak plinth
#

Are you going to make an entire statistical system to determine who is more likely to be telling the truth?

thick peak
#

i.e. player 1 results are reported by player2 after player3 confirms them

weak plinth
#

Yeah, so I will just tell that "my client" who actually won, lost

thick peak
#

player's server-side is only authoritative for the data of the player they're responsible for

weak plinth
#

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

thick peak
#

yeah, player 2 can report a false player1-score, but player 3 will see that it is not real

weak plinth
#

And then what, let's walk through this

thick peak
#

this inconsistency is reported to central-server and players are marked. In 2-3 games (if they cheat again) they will be spoted

weak plinth
#

So, you just throw away the entire score of these 2-3 games?

thick peak
#

yes, as they are not fair

weak plinth
#

That must be nice for a person that just won

thick peak
#

cheating is rare at start, and vanishes if players see they get banned

weak plinth
#

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

thick peak
#

how does other games do when they catch a cheater mid-game?

weak plinth
#

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

thick peak
#

lets say I sell the game on steam, if someone is banned they can't cheat again

weak plinth
#

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

thick peak
#

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

weak plinth
#

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

thick peak
#

yea, but not for the gameplay itself

weak plinth
#

Why not

thick peak
#

cuz the price will then scale with playerbase

weak plinth
#

Or you use a model that doesn't scale costs with #of players?

thick peak
#

yes

#

this is what I see as a solution to allow people make fully free-to-play multiplayer non-cheating games.

weak plinth
#

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

thick peak
#

I couldn't find one yet. If you see one please let me know

weak plinth
#

Again, there's probably a reason why no-one does this

#

Including competitive, ranked games

thick peak
#

probably because it is overly-convoluted. That's what I hear the most

weak plinth
#

And probably because all of the extra work doesn't pay off

thick peak
#

not sure about that

#

you don't actually pay anything, only the networking experts that will build it

weak plinth
#

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

thick peak
#

i expect that to be less than 5% of the price i'd have to pay for a fully secure centralized server

weak plinth
#

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

thick peak
#

b ut once the solution is done, no more costs

weak plinth
#

Except, that you still need a centralized server anyway.

#

Which also costs money

gleaming prawn
#

@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=

#

?

weak plinth
#

No, seeing through

gleaming prawn
#

Or seeing through SOME walls?

#

ok

weak plinth
#

Shooting through is definitely not possible, I know 🙂

gleaming prawn
#

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...

weak plinth
#

Yes, I know

gleaming prawn
#

And yeah, you don't send everything to the GPU... but anything close will go to

weak plinth
#

I saw some amazing documentary about some guy that made a wall-hack based on sound

gleaming prawn
#

otherwise is too expensive to cull...

#

another thing super super difficult to combat (and any networking model is vulnerable to) is aimbots...

weak plinth
#

He just reverse engineered the 3d sound produced by the game to determine where the person is

gleaming prawn
#

BUT, the end of story is:

  • solving THESE is not in the scope of what Netcode is responsible for
weak plinth
#

Nope. Because it has nothing to do with netcode 🙂

gleaming prawn
#

well, SOME hacks do

#

like shooting through walls you can solve with good models

#

Walking through walls same

weak plinth
#

Yes, but not client-side software "hacks"

#

Like, an aimbot

gleaming prawn
#

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)

weak plinth
#

Networking for FPS games is insane 😦

gleaming prawn
#

or at least gets super close to the corner

#

yep... insane is the word

weak plinth
#

Quite ironic. The games themselves are probably one of the easiest to make

gleaming prawn
#

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

weak plinth
#

I won't ever touch the FPS genre, no way

#

Making those games feel good is rocket science

gleaming prawn
#

trial and error as well:)

weak plinth
#

@gleaming prawn If I'm planning for a steam release, should I do something special in terms of networking?

gleaming prawn
#

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)

weak plinth
#

Can I just use ENet even though I'm targetting steam?

#

That's basically my question 🙂

gleaming prawn
#

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...

weak plinth
#

But I can?

gleaming prawn
#

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)

weak plinth
#

I want to try and do that as much as possible anyway

gleaming prawn
#

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

weak plinth
#

So my networking layer just deals with everything up to buffers

gleaming prawn
#

Which is good in general

weak plinth
#

And transport handles sending of buffers/receiving

gleaming prawn
#

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

weak plinth
#

I hadn't thought of the first layer even 🤔

gleaming prawn
#

Quantum has one extra layer, and it's intermediate is very thin.

weak plinth
#

Not as a separate thing though. But it makes sense

gleaming prawn
#

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).

dire venture
#

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...

gleaming prawn
#

Not yet AFAIK.

dire venture
#

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

gleaming prawn
#

There's the FPS sample

jade glacier
#

Good god, don't go there though

gleaming prawn
#

Which is a snapshot interpolation implementation...:)

#

I try NOT to be biased...

jade glacier
#

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

gleaming prawn
#

And the snapshot delta compression is quite cool...:)

#

It's a solid implementation, but yes, hardcoded to that particular sample...

dire venture
#

Is anyone aware of a timeline/potential release date for a preview package?

gleaming prawn
#

Being honest, I don't see Unity people answering much here.

#

And only them can answer that.

jade glacier
#

Do you actually need to make use of the DOTS aspect of it?

dire venture
#

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

jade glacier
#

That it does

gleaming prawn
#

DOTS is not even ready itself.

dire venture
#

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

jade glacier
#

If you aren't in a rush, it will all come along eventually

gleaming prawn
#

So, only Unity can say anything there. I'd not bet yet.

jade glacier
#

but its bleeding as bleeding edge gets... not a fun place to try to publish a networked game from

gleaming prawn
#

next few months
You're being optimistic...:)

dire venture
#

Lol

jade glacier
#

Getting dots to a user friendly place is going to be an achievement... and Unity tends to lag far far behind on anything networking

dire venture
#

True

jade glacier
#

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

dire venture
#

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

jade glacier
#

And what is there is painful as it is. Like the Unite presentation took 20 minutes just for the presenter to spawn a player

gleaming prawn
#

There's another reason to look "beyond" dots networking

dire venture
#

Beyond?

gleaming prawn
#

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

dire venture
#

Expensive as in financially or performance-wise

gleaming prawn
#

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

jade glacier
#

Performance will be stellar, but performance and networking is a complex conversation

gleaming prawn
#

Like running super cheap turn based servers, for example

dire venture
#

Based on the netcode forum post we’ll be able to self host servers so why would using unity be more expensive

gleaming prawn
#

Or running super cheap servers for input authority on a deterministic system

jade glacier
#

That is still hosted I think is Erick's point

gleaming prawn
#

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...

dire venture
#

Hmm but what’s the alternative

gleaming prawn
#

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

dire venture
#

Well right now I have a server built as a console app, but I can’t use Unity’s physics in there

gleaming prawn
#

Then you start to think about the alternatives

#

What is the gameplay like?

#

is it an FPS or TPS?

jade glacier
#

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

dire venture
#

FPS...think sea of thieves-like

jade glacier
#

its kind of a common denominator for easy networking.. you want your simulation to be as abstracted as possible

dire venture
#

Yeah I figured

gleaming prawn
#

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...

jade glacier
#

yeah, if its a classic FPS/TPS without some giant persistent world and more match based... Bolt will pretty much get you there.

gleaming prawn
#

So that's cool, DOTS seems to be the way to go, if they finish it soon.

jade glacier
#

Unless you have LOTS of deterministic AI.. then you want Quantum 😛

gleaming prawn
#

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

jade glacier
#

Yup, all comes back to "what are you making?"

dire venture
#

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

gleaming prawn
#

That's all done in Bolt.

#

It's built in

jade glacier
#

Bolt is basically CS adapted for generic use and Unity

#

(CounterStrike)

gleaming prawn
#

CS is snapshot interpolation, bolt is state transfer

jade glacier
#

Did it evolve out of that?

gleaming prawn
#

Bolt has more features, like scoping and priorization

jade glacier
#

I just know when he made it it basically was using the CS way of doing things

gleaming prawn
#

CS does full snapshot interpolation (it's best for competitive)

jade glacier
#

But it may have evolved, so I am not expert on Bolt

dire venture
#

So but unless I put bolt into a unity server, I still can’t use unity’s physics server side

jade glacier
#

The physics are its own

gleaming prawn
#

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

dire venture
#

Oh I see

gleaming prawn
#

Except for lag compensated raycasts, which it does with it's own cached hitboxes

jade glacier
#

For the controllers and hit colliders and such though he had to roll his own

#

for resims to work

gleaming prawn
#

but the basic physics stuff is unity

jade glacier
#

But its in unity, so you aren't excluded from making use of PhysX

gleaming prawn
#

yes, that's what I meant for the cached hitboxes @jade glacier

dire venture
#

Still would really like to use DOTS lol

gleaming prawn
#

Then you need to wait and hope for the best..

jade glacier
#

Yup, if you have time to wait... you have that option

gleaming prawn
#

Or, maybe we are working on something for DOTS...:)

jade glacier
#

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.

gleaming prawn
#

Or somebody else here is...:)

dire venture
#

“That option” meaning which exactly

gleaming prawn
#

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).

jade glacier
#

option of waiting to see what Unity releases

#

or... third parties

dire venture
#

Yeah I mean this is kind of a personal project so I’m in no real rush

jade glacier
#

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

gleaming prawn
#

You can...

jade glacier
#

There are some guys in the NCoders channel who are messing around with it

dire venture
#

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

gleaming prawn
#

It's just a lot of re-work everytime APIs change

#

but you can

jade glacier
#

Focus on your simulation in the meantime I would say

gleaming prawn
#

The more you can decouple your simulation from rendering, the best

#

That gives you all the flexibility later on

jade glacier
#

Almost all horror stories about people trying to network already made games comes from the spaghetti of entangled simulation and rendering.

dire venture
#

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

jade glacier
#

Messaging <-> Input and State Buffers <-> Simulation

#

Messaging and Sim should not touch one another

gleaming prawn
#

It's not really the "unity way" we know about since years, but it's the right way, and will be fine with DOTS.

dire venture
#

Yeah see my custom solution doesn’t really have that lol

#

It’s a very rudimentary solution

jade glacier
#

Doesn't have a clearly defined simulation?

#

I would start there then

dire venture
#

Well I have the physics simulation

foggy vale
#

@dire venture I'm currently using the new unity Llapi

#

and building on top of it

jade glacier
#

Make sure you can as deterministically as possible isolate that pre and post stages of that sim @dire venture

dire venture
#

@foggy vale you mean the new netcode or is this something else?

gleaming prawn
#

LLAPI is a transport layer, and that's it

foggy vale
#

@dire venture My advice is... don't try to make a game and than implement the networking later... doesn't work this way

jade glacier
#

Messaging itself isn't going to care much about DOTS

gleaming prawn
#

it's pretty much a glorified UDP socket, with some extras

dire venture
#

Definitely not doing that @foggy vale

jade glacier
#

messaging is literally just byte[] being mailed around

foggy vale
#

@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

dire venture
#

@jade glacier i don’t have buffers or state at this point

weak plinth
#

How about my byte*

gleaming prawn
#

LLAPI is just an abstraction layer over the platform specific UDP sockets + acks and a few extras

foggy vale
#

yeah exactly... so a low level net lib

jade glacier
#

your byte* is still going to just be a byte[] to the system io

weak plinth
#

My byte* is going to be a byte* to the system io 😄

#

Sockets fix byte[] and cast to byte*

jade glacier
#

@dire venture you are going to need to start thinking about Input and State buffers

weak plinth
#

At least, the winsock dll does

dire venture
#

Yeah thought so, not looking forward to it though lol

jade glacier
#

Whatever form they are in... be it traditional classes, or memory maps with dots or whatever @dire venture

weak plinth
#

Makes sense too, since byte[] is CLR managed

#

And socket calls are not

jade glacier
#

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

weak plinth
#

Yeah, you're right

foggy vale
#

@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

jade glacier
#

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.

weak plinth
#

@jade glacier So, your grandchildren will inherit your project and can finally convert it to DOTS? 😂

jade glacier
#

LOL, maybe

weak plinth
#

Hey, generic serialization is almost here!

#

Who would have ever guessed such revolutionary technology would be available in 2020

gleaming prawn
#

Generic you mean it also supports classes?

jade glacier
#

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

gleaming prawn
#

Or just structs?

dire venture
#

Anyways thanks for the input guys, I have a lot to think about lol

weak plinth
#

I hope both, but I don't even know

gleaming prawn
#

Focus on structs...:)

jade glacier
#

Classes and managed structs are a special corner of hell for trying to memory align stuff

foggy vale
#

Guys try this Ceras library I told you about..... is super.. does Class serialization with looping

weak plinth
#

I am, but I can imagine people have a use-case for classes as well

gleaming prawn
#

Take inspiration from fholm's native collection library, that's faster than .net's original one

#

Just by restrciting to structs

weak plinth
#

I have it bookmarked

#

Still need to figure out how I can use it though

jade glacier
#

Just by restrciting to structs

I immediately had to abandon that since I have to play nice with MonoBs

gleaming prawn
#

For runtime transfers, if you care about performance, avoid classes...:)

weak plinth
#

@foggy vale I have my own serializer for network stuff

foggy vale
#

seeems it does what you want to implement plus polymorphism.... pooling... custom constructors.... autoconstructors

gleaming prawn
#

I immediately had to abandon that since I have to play nice with MonoBs
Oh, that...

weak plinth
#

If the Ceras library doesn't use either IL (which it probably doesn't), not uses code-gen

#

I'm skeptical of the performance

jade glacier
#

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.

foggy vale
#

it does Codegen

#

@weak plinth but it had ways around codegen to prevent some of its problems

#

---- silence ---

#

everyone is checking that Ceras lib 😄

weak plinth
#

Wait holy shit

#

It takes 1.5 micros for 1 object?

foggy vale
#

goess it depends from the object

#

not bad I think

weak plinth
#

Not exactly a big object...

foggy vale
#

1 uS is quite good I think

weak plinth
#

Granted that mine only does structs

#

Mine is at least 10 times faster

foggy vale
#

it depends on the caching

#

and if you move structs is faster I guess

weak plinth
#

The Ceras bench does caching pre-test

foggy vale
#

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

weak plinth
#

The one I posted, where?

weak plinth
#

That's from the Ceras source

#

The benchmarking

jade glacier
foggy vale
#

yeah I said the one u posted

jade glacier
#

The codegen side does most of the work

weak plinth
#

the one you posted is doing looping
check for a standard struct

#

I don't understand this then

foggy vale
#

that specific case is not optimal

#

didyou implement custom classs serialization with looping ?

#

and your impleementation does this 10x ?

gleaming prawn
#

t takes 1.5 micros for 1 object?
That's what I can do for a full KCC update...:)

weak plinth
#

IT's a custom struct serializer

gleaming prawn
#

1.5u is A LOT

weak plinth
#

And it's far from an optimal sollution

#

But it's still light-years ahead in terms of speed

gleaming prawn
#

DOA...

weak plinth
#

And why would you need classes for network IO anyway 🤔

#

And I'm extremely skeptical of the memory footprint this has

foggy vale
#

why not.... very fast to implement for a prototype... but it does also structs serialization

weak plinth
#

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

gleaming prawn
#

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
jade glacier
#

No one is getting that stuff right first networking library attempt

weak plinth
#

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

foggy vale
#

guess it is different serializing 2 floats from serializing a class with looping

weak plinth
#

That's not going to make a difference of factor 40

foggy vale
#

@gleaming prawn serializing 1000 entityes in 1ms is double with this lib.... over 100 connections I don't know what u mean

jade glacier
#

100 players

#

each getting their own unique serialization

weak plinth
#

1000? One small class is already taking 1.5

gleaming prawn
#

yes

foggy vale
#

so 1000 X 100?

gleaming prawn
#

not all 1000 entites would go into each connection, not on every frame also

foggy vale
#

ms not uS !

jade glacier
#

Since different players will see different parts of the world and have different lost packets they are recovering from and such

gleaming prawn
#

but serialization is just one tiny aspect

#

So you should make it absurdly fast

#

so 1000 X 100?
No, not so much

foggy vale
#

frame? we are talking in ms not frames

gleaming prawn
#

bandwidth doesn't support that...:)

#

ticks...

weak plinth
#

The fastest you can probably get is with IL

gleaming prawn
#

I said frames meaning ticks

jade glacier
#

the prioritization engine is where it gets a bit brutal

gleaming prawn
#

network tick

foggy vale
#

net tick isn't 1 ms

weak plinth
#

So, you know....

#

If you want a fast serializer, slap open Cecil and have at it

gleaming prawn
#

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...

foggy vale
#

it does 40uS for 1000 entities ina list

gleaming prawn
#

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

foggy vale
gleaming prawn
#

I understood 1.5us for one small object

foggy vale
#

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

weak plinth
#

? You are not listening then

foggy vale
#

if one of you has a better serializer with the same performace to suggest.... I can try it

weak plinth
#

His benchmark result literally says it takes 1.5us for one of these Person objects

foggy vale
#

it is a classs with looping

#

it is not a struct

#

nor a float

weak plinth
#

And then the question is, why are you using classes for network IO

foggy vale
#

I'm testing it with classes and structs

weak plinth
#

One allocates

#

The other one doesn't

foggy vale
#

very flexible when you can take advantage of polymorphism

weak plinth
#

You shouldn't want this for networking

foggy vale
#

will write with it the DB too.... maybe

#

just testing while imlplementing some features

weak plinth
#

In the DB?

#

Sorry what?

foggy vale
#

it is a serializer

#

can use it to write to file

weak plinth
#

DB= database?

foggy vale
#

saves.... or simple db

weak plinth
#

And it's fine for writing to files

foggy vale
#

?

#

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

weak plinth
#

I thought you meant an actual DB

#

Like Oracle

#

Or MongoDB

#

@foggy vale I'm nearly finished with my serializer. You can use it if you want

foggy vale
#

hey

#

give a link to some code and I can test it

weak plinth
#

Once it's finished

foggy vale
#

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;```
worldly plinth
#

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.

jade glacier
#

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.

worldly plinth
#

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.

jade glacier
#

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.

worldly plinth
#

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?

jade glacier
#

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

worldly plinth
#

Ignore it, it's not important part. I mean setting up the servers themselves. Doesn't matter what it has. Do I just:

  1. Rent a machine
  2. Put as many servers as it can handle on it
  3. Repeat until I can satisfy all players?

I'm not talking about in-game part

jade glacier
#

It all depends on how you go about hosting of course

worldly plinth
#

And what are the ways?

jade glacier
#

if you use like PUN or Steam vs rending metal boxes

worldly plinth
#

So you can use steam to host dedicated servers?

#

Or player has to be server

jade glacier
#

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

worldly plinth
#

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?

jade glacier
#

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.

weak plinth
#

It's fairly normal to rent a server from a decidated company. Especially in the case of smaller game companies

worldly plinth
#

@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

weak plinth
#

No

#

Easiest scenario would be to just create a new server instance

worldly plinth
#

So you launch as many servers on one rented machine as possible right?

weak plinth
#

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

worldly plinth
#

Ok, could you explain "Server instance", what exacly do you mean

weak plinth
#

To make it as simple as possible

#

you just call new Server(); on your application

worldly plinth
#

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

weak plinth
#

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

worldly plinth
#
  1. Ok so you could have like 20 different scenes running with each one running it's own server, am I right?
  2. Yeh but how then would I simulate AI with pathfinding, not seeing players behind walls etc
  3. 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?
jade glacier
#

Scenes? You might be mixing Unity with server instances there

#

Unity would not be running 20 scenes if that is what you mean

weak plinth
#

Your scene would be your "instance"

worldly plinth
#

That's what I meant

jade glacier
#

instance in this case = whole new instance of Unity

weak plinth
#

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

worldly plinth
#

No no, let's assume a pvp game that can have different maps

weak plinth
#

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

jade glacier
#

Typically if that is your use case, you will code your simulation completely outside of Unity and run those sims as their own instances

weak plinth
#

@jade glacier What about AI and server auth though without Unity?

granite otter
#

A game with an architecture similar to something like Counterstrike?

worldly plinth
#

Well yes

#

Im just curious, I'm far from making sth like this but I'd like to know how it works

jade glacier
#

Bolt and Quantum both operate in their own black boxes like that as far as I know

granite otter
#

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.

jade glacier
#

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

worldly plinth
#

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

granite otter
#

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.

worldly plinth
#

So you use one instance of headless unity per server and run few of them per "separate computer"

granite otter
#

The scene method works too, but I would prefer to have one instance per game, in case something breaks or crashes.

weak plinth
#

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

granite otter
#

I would argue that MMOs are very, VERY different in terms of architecture.

#

Login server and Master server are the same thing though.

worldly plinth
#

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?

granite otter
#

Yeah. The idea is that the master server uses one up or domain name that all clients can forever trust to be available.

#

Ip*

weak plinth
#

This is also how games with player-hosted servers work btw

#

The player hosted server "registers" to the master server

granite otter
#

Yes, exactly what @weak plinth said.

weak plinth
#

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

granite otter
#

If you get as far as spinning up servers dynamically, send me some royalty from your game as payment for this chat.

weak plinth
#

😂

worldly plinth
#

Well ok then, my questions are answered

weak plinth
#

If you get as far as spinning up servers dynamically

worldly plinth
#

ofc I will just give me 40 years to learn this stuff

weak plinth
#

Start hiring devops people that know 50 times more about this than any of us probably

granite otter
#

Generally that last part is referred to as "load balancing".

weak plinth
#

There are many, many of these options already out there

#

And I think this qualifies as middleware

granite otter
#

A good third-party option that's pretty (relatively) easy to understand is SmartFoxServer if you want to roll your own master.

weak plinth
#

But.... you know....

#

Probably start with that one server first 😂

granite otter
#

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.

jade glacier
#

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.

worldly plinth
#

Ok, thanks guys again for all the info and time.

jade glacier
#

Keep coming back as you get along with it

#

you will end up with way more questions once you start

granite otter
#

No problem; it really is a big problem for anybody to try to solve.

worldly plinth
#

Yeh I'll be back in 2 years when I finally make my first chat as networking exercise

jade glacier
#

LOL nah, chat is non-deterministic and non-simulation

worldly plinth
#

Or actually sooner with 15633213216513 questions about how to make it

jade glacier
#

you will have that solved in 2 hours

granite otter
#

Keep an eye on Unity's upcoming Connected Games service. I'm holding out to see how that looks once it goes to preview.

weak plinth
#

I think those 2 years have passed before that happens @granite otter

jade glacier
#

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.

granite otter
#

@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.

jade glacier
#

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

granite otter
#

Since we're here, what are all the cool kids using for multiplayer in Unity these days?

jade glacier
#

All sorts of stuff, same deal though - depends what you are making for starters

granite otter
#

I like simple interfaces that give me a lot of control over how I serialized objects.

jade glacier
#

All of my current work is with PUN2, but I am working for Exit to develop tools for PUN, so I don't count

granite otter
#

Serialize data*

#

Okay, I tried PUN in the past and preferred Forge for a while.

jade glacier
#

PUN is pure relay, so its only applicable to certain models

#

But I am doing some fun serialization stuff with it

granite otter
#

How would you rate PUN2 currently?

jade glacier
#

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

granite otter
#

Okay that sounds like what I want, actually.

jade glacier
#

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

granite otter
#

Hmm, I am looking for speed mainly. I would prefer to write all my prediction and reconciliation myself.

jade glacier
#

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

granite otter
#

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.

jade glacier
#

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

granite otter
#

I do want to use a dedicated server for any game.

jade glacier
#

Yeah, that eliminates PUN2 for you

granite otter
#

Can't I just treat a player as authority? Or it only does ring relay.

jade glacier
#

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

granite otter
#

I've never heard of Mirror.

jade glacier
#

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

granite otter
#

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.

jade glacier
#

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

granite otter
#

I'll consider that.

jade glacier
#

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

granite otter
#

Lol, I'm okay with working with a dev package actually.

#

Maybe I'll look into Mirror; that sounds good.

#

Thanks!

dire crater
#

Check the description of that video for a tutorial

granite otter
#

Oh, very cool!

#

@jade glacier clapping

scarlet venture
#

@worldly plinth if you ever wanna make a game like that, consider "SpatialOS" as a possibility

weak plinth
#

Anyone knows features of websockets in PhotonUnityNetworking?

foggy vale
#

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?

jade glacier
#

Lot of words there, but my takeaway is you are not using a fixed tick

foggy vale
#
        {
            Tick = true;
            Nextactiontime = DateTime.UtcNow.Ticks + TickPeriod;
            Debug.Log("ONE TICK IS PASSED");
        }```
#

ticks are not synched

civic pulsar
#

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

foggy vale
#

@civic pulsar I would go on youtube to get an Ideea.... plenty of tutorials. Tha's a too generic question

civic pulsar
#

I suppose......okay then

foggy vale
#

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?

civic pulsar
#

@@foggy vale Xammp ?

foggy vale
#

@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?

civic pulsar
#

My bad.....this pig is still a noob

#

Wrt networking

foggy vale
#

😉

foggy vale
#

anyone has any advice?

weak plinth
#

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

civic pulsar
#

Thank you @weak plinth

weak plinth
#

No problem

#

Also i think that, u need to put ur game source inside the ones asset provides @civic pulsar

misty shale
#

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?

final depot
#

That's highly dependent on your game structure, latency tolerance, and expected operations