#archived-networking
1 messages · Page 57 of 1
Though learning photon might give you a better feel / insight on how networking works
@tough oracle if you learn enough to be able to build something like what you want, you will also have learned that its basically impossible to do by yourself
so it becomes quite the interesting philosophical problem, by learning enough you learn that there's no way to do it for you
so did you really learn to do it?
😄
Its learning either way
@graceful zephyr Haha, I like that it's kind of parallel to the "The more you know a subject, the more you realize how much there is left to know". Thanks for explaining RESTfull as well, it's kind of what I found online with a few extra steps. Would saving a token on a DB, which is used to authorize other queries count as not being RESTfull then or not?
@stray scroll im not 'in' on how the web world does/calls things anymore
i think it's a matter of definition
but generally yes, REST should be stateless protocol
on both sides
if you save stuff into a DB to authorize future requests on the server, it's probably not restful
but tbh who gives a fuck 😄
@tough oracle But taking on a MMO as your first game is far fetched. Would recommend do some singleplayer gamejams, learn basic socket connection, look into basic networking concepts, then look at 3D party APIs & solutions. Try a few of them with smaller games. Then decide if you really want to do an MMO.
Ah yeah. If it works the way you want it, don't care what you call it 😄
me and a friend are doing a 'semi' mmo, which can support up to 100 players per 'area'
but we've both been doing networking for a looong time
@stray scroll yeah if it works it works, i usually don't get bogged down with strict definition of various patterns, etc.
@tough oracle getting 500 players at the same time is a challange by itself, not even on one server
where to start learning about networking in unity? i just want to know the basics to create a lan game.
Hi, currently evaluating the tech to run a dedicated server and Unity clients. Photon Server seems to be the obvious choice for us at the moment, but the Unity client is using DOTS and the new NetCode sounds very interesting. The main problem is it won't really be production ready until Q2 2020 as I understand. Does anyone have any experience with Photon Server? Is it possible to run a headless Unity build as the dedicated server?
NetCode may be missing other important features provided by Photon: load balancing, authentication, matchmaking, etc?
I want to manage to make a server like terraria or minecraft, more like client hosted lan
I have created a working Moba in Unity (not optimized) with Photon PUN2 and a sql-server; but obviously dedicated servers would be a big +. Unfortunately I only find a) unity presentations praising their future releases and b) companies selling their solutions for thousands of dollars. Is there any way to create dedicated unity servers (in a small scale for developing) today and do tutorials how to do this in practice exist ^^
@high moat I'm looking into the same thing at the moment. It seems there is a wide range of options.
Photon Server is one solution (there is a free tier) which may work for you as you already use Photon.
You could also create your own dedicated server executable (maybe even Unity headless) and deploy using something like AWS Gamelift.
@weak plinth if you have little experience in this, I'd suggest taking a look at Photon PUN. There's lots of examples to help you get started.
Oh, ok, thank you
@hollow sandal do you know any tutorials/information/documentation on how to start creating a dedicated server executable? I can image how a "headless" instance of a game looks like but have no idea how real world implementation should work ^^
and ty ofc, gonna check out aws gamelift :)
I don't know I'm afraid, I just saw that passing -batchmode -nographics initialises a player executable in 'headless' mode
You would need to detect this in gamecode and become a server.
Networking middleware for Unity 3D and realtime multiplayer games and applications. Get started without having to know the details of networking or write any complex networking code.
@high moat I've discussed in the past with a company that have published a big product on a popular IP with a headless mode dedicated servers, and tbh, the cost/performance is really poor. (not only cause of poor operational side) but with their calculations they could handle about 6 instances of server per a CPU core. That gave them about 6x7(usable cores)x6(players) per machine, whichis really really poor performance. I've made a cost analysis later for a similar project that for big playerbases (1M MAU+), the cost/player even with grat autoscaling and resource management would be just too big (not counting transfer fees etc.)
So I wouldn't go with the headless mode if you want to publish and scale your game, but for learning and funzies, it's a great solution.
good to know, ty :)
@turbid rune this: > and tbh, the cost/performance is really poor.
That's THE point... You nailed it...
You start to understand a lot of our business decisions when you try it yourself...:)
Oh I abolutely appreciate what u guys are doing @ photon (: we're using a lot in my current company with great success
When you put on the table that you need to pay a beefy server just to host 6 instances of a game (even if your game can have an avg 50 players per game this is super EXPENSIVE).
And you need a 100 player/per instance to reach something like avg 50
I don't know the exact numbers, but I think Albion Online (which runs dedicated photon servers with custom authoritative logic running on them) can host in the thousands of players per physics machine AFAIK...
Hello everyone, me and some friends (all from the game industri) just started a new project, and we are actually trying to stress test some network midleware such as Photon etc ... as the new Unity network transport is not ready for production and is lacking of documentation. is there any spreadshit with the differents middleware currently used on the market ? (note that we are actually aiming to have like 200-400 players on a game, with Authoritative server architecture) +thousands of AI. so the perfs are important, if you have some Network Middleware to share would be glad having some recomandations ! Thanks everyone if it's DOTS compatible it's a big +
@gleaming prawn @turbid rune I wonder if the progress on Tiny Game and DOTS will help improve this significantly. So if I understand you correctly, you think it's best off to write a custom server rather than use Unity in headless?
I think it's a case by case decision.
Locking into one approach is never best IMHO.
@hollow sandal it depends on the project. I've used Unity networking for example for local-hosted apple-tv/iPhone/Android multiplayer where the tv app was the host. I would also go for headless if your multiplayer is terraria-like, so one of the players can be a headless host. If you have a small team and small budget I would go with Photon for p2p/hosted logic multiplayer and maybe top it off with a gamespark/playfab for the business logic. Especially if none of your people is experienced with network programming. Netcode is a hassle. Connection upkeep is a hassle, and using Photon or other solutions will save you COUNTLESS hours of work
This without mentioning determinism, which can scale and give authority even without running simulation on server 100% of the times.
@gleaming prawn @hollow sandal
This without mentioning determinism
THIS SO MUCH.
It's a lot of different options.
It's your gameplay that "chooses" for you which approach to use. Not a tool vendor or anybody...:)
This is helpful thanks. I currently have gamelogic running in a deterministic native plugin. My plan was lockstep simulation but I guess I'm concerned about performance now, my partner wants to support 10 players. Seems like simulating 10 players on every machine might get too expensive.
Seems like simulating 10 players on every machine might get too expensive.
In lockstep, really?
10 players, each with.. 50 units say
I mean, take a look at battlelands royale... 32 players, not even lockstep
or 200 units I don't know
Determinsitic predict rollack on mobile
in lockstep you should be fine, if you are coding it rigght
I mean, if you can't simulate all players in ONE client, how Beefy do you need your server to be?
This will be even more expensive...:)
Well, I remember early games of Total Annihilation, where one slow machine would take the whole game down.
That's the point, you should not consider server as an infinite resource, quite the opposite:
- you client's machines power is payed by your player...:)
- your server CPU consumption is payed by you...:(
where one slow machine would take the whole game down.
You are talking about a super super masive RTS.
My deterministic plugin is using software float emulation so it's probably a lot slower than if I had a single server authority and I could write faster non deterministic code.
- with a lockstep implementation that does not have server for batching (canceling out slow players)
My deterministic plugin is using software float emulation
What do you mean by that?
a Fixed Point implementation?
well, a software implementation of floating point, so that it gets the same results across different hardware
assuming it compiles with the same settings.
Are sure that is a good approach?
no 😂
We're super happy with FP 48.16
But I've seen RTS games use (in the same game) several different FP implementations for different problems
16.16, 24.8, etc etc
But I've never seen a float emulation one...
32 FP was too low for me, but I'd not considered FP64
Do you use something off the shelf for 48.16 ?
you have Q32.32 (64) that has super good accuracy
But it's slower on Mult operator (compared to 48-16 that we use)
Do you use something off the shelf for 48.16 ?
This can be found all over. It's an open standard, and there are MIT licensed implementations in C#.
We have our own because we pretty much manually inline all the code.
notice 48.16 is the same accuracy (16 bits decimals) as 16.16, it is just much faster because it does have a buffer for multiplications, ezc
32.32 does the same as 16.16, then adding 32 bits for decimals.
Now I'm really struggling with what decision to make! I was just assuming that lockstep sim would be too slow, and going classic client server would solve issues with cross platform play, at the expense of supporting lower unit counts and the cost of hosting a server per game.
Now I'm having second thoughts and thinking that deterministic lockstep is worth sticking with. Just sending player inputs has a lot going for it.
There's a lot going on with determinism currently... Not even talking about us only.
Lockstep is just the basic way... Probably the way to go for your game.
Thanks for your time, this has been an enlightening conversation. If I have questions about Quantum should I direct them to the email address on the website? Or can you answer them here?
Sure, platform support? PC, Mac, mobile?
When are they expected to drop?
and secondly, when do you expect the SDK and pricing to be finalised? When can we reasonably expect to ship a game built with this tech?
Finally, just so I understand, how would I port my gamelogic from native plugin to Quantum? What language / programming paradigms?
Sure, platform support? PC, Mac, mobile?
PC, Mac, Linux, iOS, Android, PS4, XB1, Switch (all with cross platform determinism)
When are they expected to drop?
It's in production.
production I mean: being used by several studios.
and secondly, when do you expect the SDK and pricing to be finalised?
Quantum was released in January 2018. We have a few released titles, with several games in production (around 80 studios using it)
When can we reasonably expect to ship a game built with this tech?
Now? This depends essentially on how fast you can finish the game.
What language / programming paradigms?
Standard C#, using our own ECS APIs... There's a deep dive video you can watch (just send us an email)
awesome, this is super helpful thanks. The website gives the indication it is an early access kinda thing. I'll email and try and get some more details. Thanks again 🙏
The website gives the indication it is an early access kinda thing
It's more that it's not free to download and we help you evaluate if it's the right tech for you
There are cases in which state transfer is better anyway. In those cases you have Bolt, or something custom if you really want to, etc.
Does anyone seen my question ? 😦
just saw it
Maybe you want something from outside, of course, be we'll be happy to discuss ways for you to benchmark our stuff (we do have some test-bench middleware we use internally to stress test our servers)
But the approach you want (authoritative state transfer server for 200 players per game is something you don't have out of the box AFAIK). Of course the Albion Online guys do more than that with Photon Server, but maybe that's not exactly what you want.
Reading again, IMHO what you are looking for is something really like either photon server raw SDK (like Albion Online uses) or SpatialOS stuff (pricing not really straightforward)
Leaving office already here, so drop an email to developer@photonengine.com if you want to ask us anything.
i will consider sending a mail to you,
have you guys done some prototypes with Photon and ECS ?
Albion online can be somthing similar to what we are doing.
we are basically more doing something like RUST (by facepunch) than Albion Tbh
aw i missed the quantum discussion 😦 😄
Start your own
lol
Question: How great is Quantum? Super great? or the greatest?
Hey I am fairly familiar on how a raltime pvp type multiplayer game with unet works but I want to create a game like shakes and fidget for example. Something that does not use realtime pvp. What would be the best networking solution to use here since unet is deprecated. (my game basically only consists of ui elements)
@gleaming prawn Do y'all have a Photon transport level API documentation?
I can't seem to find any on the website
Transport level?
I just want to establish connections + send emessages through a Photon relay
@final depot look up photon realtime docs
thats what the low level transport is called
Thanks! Just checked out the API, and it seems useful. Only downside is that passing byte arrays as messages incurs GC unless you pool them.
Would be great if it supported raw pointer + length
Tangentially related: are there Unity Paackage Manager packages for Photon products
Yeah
You could use PUN then
Uh
I think there is the PUN asset
Got check it out @final depot
Go*
I already have a netwokring solution, I'm just looking to get it to work on something that is platform agnostic.
Does anyone have experience with loading asset bundles into a WebGL build? I am running into an issue where I am not allowed to load data from a domain that is not the same as the webpage that it is being hosted on due to CORS policy. I want to make an HTTP header that states that I am allowed to pull data from a cross domain.
I have very basic HTML knowledge and thats it.
what networking solution should i use if i do not want realtime multiplayer
@fading apex need to be more specific
basically you create a character collect gear and battle other players
the batteling is automatic and can not be influenced by the player
so i do not need to sync anything in realtime
Sounds like it'd be enough with a database to store characters/gear/etc in and then a deterministic simulation to run the game
i.e. basically no networking at all
ok is there some nice tool for databases that i should use ?
¯_(ツ)_/¯
ok XD thx tho
Only ready-to-go solution I know of is Entity Framework 6 or Hibernate
Which are both not exactly light-weight
And I have no idea how or even IF those run in Unity
Ah, well that solves that 😄
Saves me a lot of trouble hitting that wall eventually
Is SQLite a thing that works (well) for client-hosting?
Good to know, thanks!
Reasonable. I've been busy with my actual job and some other stuff the past few days
I'm getting some architecture up. And I've managed to get the player/camera moving via a tick-based buffer
Next step is to throw ENet in and connect a client and see about syncing 2 players
Anyone who're using the NetCode and had the same problem? https://github.com/Unity-Technologies/multiplayer/blob/master/sampleproject/Assets/NetCode/Snapshot/GhostSendSystem.cs line 442. As I create my Character entity.
@stray scroll Dont think anyone is using tbe preview drop from 4 months ago 😛
pff
Hey guys, I'm using the LLAPI (because there's still no suitable replacement) to build a game. So far I have simple data messages sending back and forth from client to server, but I'm wondering how best to do this for rigidbodies. Serializing the whole component sounds expensive, but just position, rotation, and velocity may not be enough. Any advice? Thanks! (please mention me)
The correct answer involves going into architectures like snapshot and determinism and such, which you will want to scroll up for - they happen often.
But its not as simple as 'sending data' - it involves creating an entire tick system to do correctly.
@manic spruce
"no suitable replacement" - for the worst library in the universe?
@manic spruce what's the target platform?
If you just want a transport level replacement, I have several options for you
@weak plinth alternative is to just set up a HTTP server that does that communication, hell a Flask + SqlAlchemy setup works fine too.
@fading apex ping since you also asked that question
Then the client side logic just needs a HTTP client
@final depot target platform it currently just PC (because this is mostly just a test).
You could try lidgren
Or ENET-Csharp
Or Valve's GameNetworkingSockets
If you have a well established server IP, these should work just fine
If you are looking to do some P2P
You might need to look into solutions with integrated relay network support
LiteNetLib is a good option if u just want a simple udp/transport lib
Just a beginner question, how would I go about setting up a multiplayer game? Any good tutorial link or a page that is latest. All I can find are 3-4 year old videos
I think the flow everyone has done at one point or another in their game is:
- Try the UNET HLAPI, shit the bed and try the LLAPI.
- Get frustrated with the LLAPI, then attempt any of Photon's products.
- Stick with Photon or roll their own solution.
As far as I can tell, there are a few HLAPI like networking solutions out there: Photon, Mirror (great free choice btw), and a few others listed on the Unity forums.
By far, I think Photon is the most polished immediate solution.
But IMO, networking is not built for a one-size fits all solution, probably why there are so many different networking solutions/products, evein within Photon's lineup.
I understand not everyone has a full education on internet infrrastrucutre and can work at any level in the internetl Protocol Stack, but it's worth learning at least a little about what lies underneath some of the more auto-magical APIs and solutions available.
I'm a strong proponent for using a viable and solid transport level API and serialization layer
To build game specific netcode
I'm working right now on a whole component system for PUN2 for Exit, but not sure when that will beta
R u a dev?
Its pretty much a pile of interworking components for all of the usual stuff like hitscans, vitals, pickups, projectiles, transform/animator syncs
@jade glacier
I make networking stuff yeah
@final depot @weak plinth Thanks for the help! I'll be using Photon most probably then as I just need to try it for the first time
How did i help u?
its extending this out into a full system of components pretty much @weak plinth https://assetstore.unity.com/packages/tools/network/simple-network-sync-134256
So u dont work with datas?
datas?
I mean, I fix my bugs LOL
Loool
Not sure what context you mean that in
@weak plinth
Or you can try websockets
Of PUN
I assumed this was something related to my query, nvm sorry
Websockets its a http connection m8
Just googled it :x
Tobi is working on some security stuff on the server side, if you are talking about the back end?
Yeah right
I'm all HLAPI and UX, I don't touch transport and below at all
Nope, there are much better people than me who do that stuff
Lol alrighty
I don't even work on PUN2, I am just making this extension system that will play along with PUN2 for them. So I'm not really a PUN2 pro by any measure.
No clue, never played it
Photon is a collection of layers and APIs, so its a larger discussion than I can really type here. That and I am not the most qualified.
Joined this server seeking some basic info. I'm new to unity, but not to coding and game design.
If I had the goal of producing a competitive multiplayer game, what are some resources and documentation that would be good to look into, assuming I currently lack information on multiplayer/server based games?
I can give context for exactly what project I'm planning on starting if needed.
Also depends on what game you want to make, how optimized you want your system, how deep your knoweledge of networking is, and what your target genre is
Oh and ongoing recurring budget for servers
Players go around shooting one another with modular spells, but all hitboxes are perfect spheres, including the players.
I want it to be playable with around 10 players.
I have no knowledge of networking, other than that I would prefer if it functioned in such a way that players could host for games.
Target Genre is third-person shooter.
I have a budget of 0 dollars, and am entering in under the assumption that I will be doing everything myself.
Do you need stringent anti-cheat
Well, if you are going to do this with servers, it's going to be mroe than $0/mo
Perhaps I misworded then.
My preference is that players host the games, rather than relying on a central server.
It doesn't require stringent anti-cheat
Target platform is? PC? Mobile? Console?
PC
I would start off with a solution that uses Photon to get used to reasoning over the network.
This will however not be free
You can at least get a basic implementation on it and see if you ridea works
Then if you are planning for PC, I suggest integrating with the Steam or Discord P2P relay networks
their matchmaker would make it much easier to make a P2P game
but is much more lower level
I apologize for saying this/shutting down your advice, which I do appriciate, but I'm not going to be able to pay money at any stage.
That's ifne
Photon is free to start and expriement with
and is a good way to prototype
Also getting used to the desgin patterns for networked gameplay isn't easy
One big question I have is, do I need to begin the project with a server ready from the beginning, or can I create the finished project, and then implement the multiplayer functionality by modifying this?
For Photon, all logic is client side
The server is a mere relay
At least he basic version of it is
I strongly advise against developing a base game then adding networking
a lot of game types need to be architected with netplay in mind
you can end up with patterns that just don't work online
and will need to find ways around that
As for general resoruces
I see. Thank you for your advice. Unfortunately, all of this put together seems to indicate that my project is dead in the water.
I strongly suggest reading Gaffer on Game's articles
they're a great look at the lower level mechanisms for networked game dev
argh. i wish i read through these channels earlier.
i built this over the weekend after waiting for the dots networking samples to drop. https://github.com/gamedolphin/dots-multiplayer-sample
@weak plinth Albion uses photon transport layer, but it's not PUN or anything client side. Full logic is server side (custom implementation, using photon server SDK), and they intercept and "digest" every message. You can't send messages that will end up on the other clients directly.
And they had to deal with hacking attempts since day 1...
So I think it's a good candidate for probes... Good luck...:) They are cool guys... If you approach them with something that works they will probably listen to you as well.
They deal with DDoS every day and nastier stuff, so they are probably not naïve... But, you never know...:)
Lol
That rlly makes it challenging
So u cant just get theyr games appid, put it in a diff game and fuck it up?
I wonder if they patched the serversides shits
It's not the same logic
I don't think they even have the same kind of issues.
I think all the things you work on top are relying on simple features from the load-balancing/plugin approach (for client based apps), which is not what they use.
@raw wigeon With the naming I thought it was using the actual NetCode :/ , gj and gl
@stray scroll i wish haha
what should I use for encoding packets?
you mean for compression? or encryption?
compression @jade glacier
Byte packing using your writer, or bitpacking. You can try to compress the whole thing with an RLE as well, but not sure if people have found that to be particularly effective or quick.
I personally bitpack everything
https://github.com/emotitron/BitpackingTools
and
https://github.com/emotitron/TransformCrusher
Are what I use for all of my stuff. There are a lot of bitpackers out there.
@final depot I'm not going to pull game data through http requests that is supposed to be local in the first place
That literally makes no sense
@weak plinth sorry what's the context for this again, sort of got lost along the way
Looking back: I think you were suggesting Entity Framework or Hibernate within Unity and settling on SQLite usage.
If it's entirely local, that's probably a good choice, albiet I'm not sure how GC friendly a string based SQLite connector will be.
I wasn't suggesting
But the qusetion was about non-realtime networked play.
I was asking if it was possible
To which I was suggesting just use a HTTP server instead.
Or a websocket enabled HTTP server
Might as well use just TCP if you're at it
If the game is not realtime, I don't see a problem in the latency of HTTP
Needless overhead
It simplifies deployment and devops given how much existing work there is around web infrastructure.
Hell, people use Firebase which is HTTP/websocket based for even lightly realtime operations all the time.
Doesn't mean it's good
It depends on the use case
Rather needless to pretty much wrap your database in a rest endpoint
Either access your data via a server that actually handles the data
Or access it directly
No needless middle-step http
So you're suggesting a direct client <-> remote database connection?
For a networked game?
Yes, because your client should be a server
Depends on the scale and scope of the game
I definitely wouldn't apply this for a game like Pokemon Go
which, btw, does use the aformentioned architecture.
Want to bet it's not just a http server
If it's a direct turn-based 1v1 game, by all means, skip the server entirely.
In cases like pokemon go, and pretty much every case, that server isn't just a http middle man
Even in that case, TCP is fine. the latency of a turn-based game supercedes any connection latency you could have.
Especially if there's only one handshake
Yes it isn't, but you decried TCP as a issue earlier, which I thought I'd also address.
But again, I don't see an issue with HTTP for non-realtime networked games. Particularly since web developerss, devops, and available infrastructural support are in abundance.
I do, since it's needless
Another thing I think I should address is that HTTP/3 is UDP based.
If there's no business logic on that http server, it's pretty much doing nothing
And uses a protocol that is very similar to that of Valve's GameNetworkingSockets.
If you need it for authentication, authorization, input validation, etc.
yes, you need that HTTP server.
Lest you directly let clients arbitrarily call DROP TABLE ....;
But then it's not just a http server anymore
It actually has a purpose in that case
Also, if we're talking localDB, something like SQLite is obviously better
Wait what do you mean "not just an HTTP server anymore." Those seem like pretty standard features developers bake into those kinds of servers?
In fact, pretty much every HTTP server framework I know of offers some variation of those features.
If you are talking entirely local for a P2P game turn based game, I wouldn't even use SQLite and just manage my own in-memory state.
Depends on how much extra time you want to spend on a propietary sollution that might end up in spaghetti and or poor performance
In what way is this proprietary? I was under the impression pretty much the entire stack is open source now.
Save for maybe your Unity client.
Insofar as performance goes, yes it'd be an issue if yo uare firing multiple requests per action
But if you have control over both the server and the client. I don't see how you couldn't make each action in the game just another endpoint and atomically apply operations on the game state.
Yeah, nvm. Much context was missed here
Whats the topic
Seems to much to read
Tcp
Its a really nice protocol
Not nice
But good
And u do t get data loss
Dont*
I really have this one question I couldn't find answer for on the internet... I know games like FPS does things like client-side prediction, interpolation, delta compression, lag compensation, etc to combat latency issues. How about games like Diablo (ARPG). Do these big companies try to synchronize all clients for every single monster models running around in the screen? If so, how do they achieve this? Just periodic updates from server with massive states of all the moving parts?
IMO , it could be just an animation, and once the players are on enemies sight, they receive the animation of the player aswell, and position gets updated every frame
If what i said isnt correct, correct me bois
I think the players dont even get rendered if you're x amount away
Hello,
Every player in my game have their own Ray how do i send this Ray to the server?
Iam using photon2
Can provide more information if needed, thanks!
Every player in my game have their own Ray how do i send this Ray to the server?
Which server? You can send data to the other clients in PUN/PUN2
@gleaming prawn PUN2 Thanks for answering!
You do have access to a server plugin (that you can write in C#) if you have photon enterprise, but that is normally better suited with either photon realtime or Quantum (which are designed with server logic in mind)
what does photon use for packet compression 🤔
Photon Realtime, the low level transport layer, nothing... then the individual HL products use different things:
- PUN doesn't do compression unless you do;
- Photon Quantum uses a few different compression methods on the input batches. Snapshots can be compressed however the developer wants as well;
- Photon Bolt has its own delta compression mechanisms embedded...
But they are all custom compression methods developed for each use case. Not an off-the-shelf library.
Photon Realtime has the option to enable Encryption to all messages by default though...
does anyone did Bandwidth optimization by limiting network streams redundancy ?
(im new to Networking)
im trying to optimize client & server bandwidth by limiting the streams sent from both sides, each time the client sends a message (inputs) i add it to a ring buffer with X elements then i try to see if all elements contains the same message values, if true then i just dont put the current message into the outgoingMessageBuffer.
in client side it's just awesome cause it optimises a lot the Bandwidth without even noticing it, eg when a player is running into the same direction or his just not moving it automatically stop sending message after about 1.5second.
in server side it's more complicated because the server is sending custom messages to each player about all players around him so if the server stop sending messages about specific players a new arriving player in the current area will not be updated about them. so the muted ones need to save informations about notified players. it gets a litle bit complecated XD so im here to ask if anyone already did it and if there is any good approach to do it.
that's a pretty common technique
Because you are using state transfer, I guess you need scheduling
especially for games with larger player counts
To limit server bandwidth
So even players who need to receive info about a lot of "entities" would receive each entity updated data "keyframe" in more spaced intervals, while keeping bandwidth bellow a defined threshold
Removing redundancy is nice as well, of course... It's a form of "delta compression" in the end, right?
(there are different definitions/flavors of delta-compression)
that's reassuring, i never seen this approach in any website so by implementing it from scratch i thought it maybe presents hiden bugs XD
You won't see most of the more complex stuff on websites...:)
🙂 that's awesome thanks!
im limiting the stream redundancy to 20 duplicated messages, is it ok or should i be more greedy about Bandwidth XD
If you are bitpacking, you can inline bools to indicate things like that @dapper night
I abuse the hell out of inline bools in my serialization
sorry @jade glacier im new to networking, by bitpacking you mean the whole message pack or boolean values ?
Try to limit individual packets to < 900 bytes or so (to fit into 1 UDP datagram, no fragments)... And server->client frequency can be something between 10 to 60Hz or even 120Hz (depends on the game actually)
for the moment im serializing all my structs by their primitive. float are Quantized to 1000, 2 joysticks are compessed to 4 bytes and messages concernes are sent as an int. my game cant have a maximum number of 32 players for the moment so if i want to send messages about player 1, 5, 9 20 i just these indexes bits in the concernes value. (ECS is halping me alot with it's linear data)
But you are getting those into you a byte[] somehow. What lib are you using?
Sounds like you might be letting a HLAPI do it for you
im using Datastreams from the unity transport package
ah, haven't looked at that - so no clue what they are doing
Do they have Write() methods and a buffer?
Ah, so probably all byte aligned
yes
yes im including masks when sized messages are written to the buffer
i saw in some blogs people are compressing to bit Level i didnt get hwo it works
same as with byte level
it just has more going on behind the scenes to dance around the byte alignment
instead or writing and reading bytes from a buffer... you read and write bits
but for ECS stuff, that might not be your friend
It makes hand serializing really easy
either way, sounds like if you are using masks and such you are doing the same thing
making markers that indicate what is in the stream
for the moment i think my optimization is anough for my game type.
for a 6mn game ( 3 players ) the server Bandwidth is about 0.5MB , (without incliding server side streams redundancy)
https://github.com/emotitron/BitpackingTools
That's my bitpacker, there are a lot like it out there. But I do have some documentation on that page that should give you the idea of what it is doing
Your main enemy as Erick mentioned is the MTU
If you are keeping your packets under that, you are doing well
start needing multiple packets per tick, you need to start getting more creative
ow that's awesome Thanks @jade glacier
i have a noob question, by optimizing the Bandwidth does it authorize me to increase the tick rate or should i take more options in consideration ?
Tick rate generates more packets, but it does affect latency
so its a whole spreadsheet of considerations
there are factors like how you are managing your buffer, since the higher tick rates let you run a smaller buffer (in terms of ms) but you may have to increase the buffered number of ticks to stay on top of jitter. Though eventually you should write in some adaptive buffer sizing code, so that you are always running as close to 1 tick of buffer as possible.
Then there are server costs
and just CPU limits based on the number of connections
and if you have to start using a priortization engine to keep your packets under MTU... and how much that is going to struggle at high ticks... and on and on.
So basically... don't try to answer that yet. Its kind of a big question
I would finger in the air it with "Does this feel acceptable" and get as low as you can with that in mind. You will always be trying to get away with using the least data possible to get the feel you want.
ow i get it! that's exactly the answer i was looking for ^_^.
for the moment im using ENet for the networking stuff, im checking and sending messages 60/s but filling outgoing buffers at a lower rate (in FixedUpdate) .
so generally i send messages the same frame they got written and process them the same frame they are received (60/s)
My default settings for my asset is fixed rate of 50 per second and sending every 3rd tick
i think ill test my server at a lower fps and see how it works it can be really benefic for server costs 🙂
I tend to dev at low fixed and send every rates
it makes it easier to spot weirdness and frame dependences and such
@dapper night server costs will be HIGH... That's one of the reasons why I do not agree when people say what we offer is expensive...:)
I have gotten into lively debates with some net lib makers on here about that - who think that data is cheap and optimization of data is a waste of time, as it creates CPU usage.
CPU usage is a concern, but the scales lean heavily in favor of not making bloated packets I have found
PUN2 implodes when you exceed 1 packet
It's more on the line that:
- FPS-style authoritative server is a LOT more expensive than other options (unless you are not paying for the server costs, like player hosted games);
CPU usage got crushing compared to the cost of bitpacking to stay under the MTU
Bloated (UDP) packages don't make sense, and don't scale (on the contrary, it's a death spiral) no matter the transport layer you use...
with 50 characters with transform/animator syncs... PUN2 needed to create 3 packets and bitpacked it was just one... and the CPU difference was massive
So, not scientific
transport layers like ENet alow you to send beefy messages, but that doesn't mean you should do that in runtime every tick...
PUN2 doesn't schedule updates AFAIK.
Neither does compression (except for basic delta compression I think), so ...
PUN actually forces a new packet every 20 net object writes
To avoid MTU I guess
Yeah, it's an educated guess... the 20
Not sure how or why 20 was arrived at
but a transform and an animator produced about that
Tests with the most common use cases...
seems so
Whats le topic
@gleaming prawn for the moment our team (army of 4) found that kubernetes fits our needs with it's free 300$ trail and agones library to manipulate the game servers easly.
we are also looking for a server provider that have low costs and as less a possible downtimes.
we are hosting our Social,Store Server in contabo but downtimes are really frequent.(daily)
The thing @dapper night is that as soon as you have real players and the numbers grow... Bang...
Social,Store Servers normally are fine with these options, the load in there is not nearly as high as the game servers (specially if you run headless authoritative servers)
This becomes super expensive...
How much would photon quantum cost?
It's on our website
1K/month for SDK access
Or you can pay 4-5k / month for a (good) developer to write something similar over 3 years or more..::)
way too many people reinventing that wheel for how hard it is to do right
And not finishing...
Just read this interview on ars technica: https://arstechnica.com/gaming/2019/11/interview-with-guilty-gear-creator-daisuke-ishiwatari/
And the guy says he does not have rollback netcode because he said they would need a super programmer (I guess he needs a better engine that supports that by default).
There are just not enough great game networking people in the world vs the number of people who want to make net games
That and most net games fall into some very common archetypes... which make them very conducive to just using a premade library
I think the reason is another
Single player, local multiplayer games do not COST to the developer over time much (with infra-structure)... Games run on the player machines...
Multiplayer games have an inherent cost that people just don't think about when they say: I'll write an MMO.
Premade libraries EXIST, and many of them are free, some are good as well....
But how many good online games exist from smaller developers? (they exist, but not a lot).
The business model is totally different. Reason is not technical.
Anyone have the new links to the new Unity3D Networking information. I see some stuff pinned, but it doesn't look updated.
@faint fern thats still the latest
@graceful zephyr what about this talk?
Dive deep into the networked future of Unity using DOTS. Hear how we made the DOTS Sample a networked game, and what we learned on the way. Speaker: Tim Joha...
I feel like there is more here I'm just not seeing
@faint fern
Is it possible to add extended build platforms in unity e.g. for servers to mark assemblies to be included in? I.e. I want to have both all of my different servers and client in same project, but be able to build the different executables with different assemblies. I see you can tick by platform, but not sure if you can extend this list?
That's a good question... But I never see the Unity guys answering here.
Maybe there is a better way to do this? I don't know.
I just figured there are some pros of having them in same project, and now with ECS and multiple worlds it feels like a neat option.
@stray scroll asmdefs have a setting for 'Define Constraints' which are like preprocessor defs but on assembly level
so you could put UNITY_EDITOR and it'd only be included in editor
or anything you define yourself in build
Thanks a lot!
Thanks
Does anyone here have some informations about Unity UNET 2.0 (connected games netword) and a possible release date ?
or if there is a chance to try it, on the actual state, cause the sample project is so broken
There will be no UNet2 AFAIK
What they are working on is DOTS netcode, and that's essentially it
That's what is being stated with all the samples and blog posts (all of them posted here as well BTW)
It will not be even remotely close to what UNet was...
It's a different approach, more focused on high performance and less on simplicity of use.
yeah yeah, i know all this already, but still it's a middleware that fit well with DOTS as it will be made for it
i am not asking for what it will be, but on when we will be able to try it out really with a proper doc
@winter solstice No proper doc, you can watch the vids on youtube and try it out https://github.com/Unity-Technologies/multiplayer . Some things will change in the next update, I would assume it comes with 2019.3, and that is struggling to be released afaik, as it should've been released already. Most likely before next year?
i have a webserver, I want to connect my unity project to that server and read the account/password for a login system. I cant seem to find anything that is working. any help is apreciated
I would like to control my unity 3d software via a webpage. for that it would be handy, to host the webpage over my project because of CORS. What can I do to use an already built webpage in a unity 3d software. At the moment I build listeners and stuff by myself, which is ugly, unhandy and doesn't support the REST API ...
@brazen cairn this has been done a bunch of different ways over the years. Some have used a tcp client, I was just actually looking for Discord hooks into Unity3D.
Since Discord is so popular as of late.
@solar tendon UnityWebRequest?
@stray scroll yea i realized that im not having an issue with unity but rather with the form on the site
@azure quail Maybe you know this as well, but I have now made two defines for Server.asmdef and Client.asmdef, both uses Mixed.asmdef which in turn uses Base.asmdef . I've turned off Auto Referenced on Mixed & Base, because those are referenced in Server & Client .asmdef and shouldn't be included without either of them being included. But now the compiler doesn't find code from Base.asmdef in Mixed.asmdef . Is there some concept I've misunderstood here?
Or is this one of those cases where I must have them defined in the project, but the build will be fine?
i feel a bit frustrated as we are starting a new networking project, and i feel like the new Unity network system is about to be released.... it would be such a pain in the ass to start a project and see the new vrsion being release 2 week after
but thx anyway @stray scroll btw the repo you sent : https://github.com/Unity-Technologies/multiplayer
is fully bugged
with 2019.3
and the last update was 4 month ago 😢
I'm using 2019.2.12f1 and it works, there are some "bugs", but you can work around them. However next release won't be production ready, so if your release date is close, I wouldn't start there.
no close release date, just starting a new game
Mixed.asmdef has a reference to Base.asmdef? that should work
I'm going to redo the process then.
to be clear you gave it a reference in Assembly Definition References on the Mixed.asmdef right?
and also not the other way around
{ Client, Server } => Mixed
{ Client, Server, Mixed} => Base
Hmm, ok it seems to work now.
noice
sometimes you might need to restart while fiddling with asmdef's because unity's dll handling seems to be weird sometimes
like dll's not unloading once they are loaded even when you delete them from the project
until you restart unity
Yeah ok, something is still off. When I have no defines, it still includes Mixed and Base into the Player assemblies.
what is the Player assemblies
using UnityEditor;
using UnityEditor.Compilation;
public static class AssemblyLister
{
[MenuItem("Tools/List Player Assemblies in Console")]
public static void PrintAssemblyNames()
{
UnityEngine.Debug.Log("== Player Assemblies ==");
Assembly[] playerAssemblies =
CompilationPipeline.GetAssemblies(AssembliesType.Player);
foreach (var assembly in playerAssemblies)
{
UnityEngine.Debug.Log(assembly.name);
}
}
}
Wished Unity would've named it differently x)
just tested your script and seems to work for me
tho that's without any references to other assemblies
Yeah, so I can see in the logs that Client, Server - assemblies are not included. But Base and Mixed are.
And only amsdef:s in my Asset folder that have Auto Reference ticked are dots NetCode and Wwise, which both doesn't reference any of the other.
hmmm looks fine
oh
i dunno if you just removed them for testing but if you don't set any define constraints they'll always be included
Oh, isn't that what Auto Reference solves?
i think auto reference just makes it so it's referenced from the normal assembly (like putting scripts in Assets) but i could be wrong
lemme test that
yea that seems to be what it does
naming isn't really clear
Ugh, so I need to have 1 define for client, 1 for server, 1 for mixed and base ?
hmmm
Then if I add another server, like Login, I'll need to create 3 new defines, {login, commonServer, commonClient} .. what if unity just added some logic to the defines x)
yea i'm not sure how to get around that
i'd def make an editor script to make this easier tho if you're gonna have so many different build types
like something that automatically sets defines through a button/dropdown
Anyone familiar with photon. I have done alot but just recently found its all on the client side. As soon as a second player joins nothing gets sent to serverside. Is this a huge hazzle, is it smarter to start over and get it right from the start? I have movement syncronized but other stuff such as pushing a button and doors is not syncronized and iam not sure how to do that.
Any help is appreciated
Thanks!
@stray scroll btw if you set the platform to Editor unity won't let you add the monobehaviours to a scene (i guess it doesn't check Editor marked assemblies) but if you do a UNITY_EDITOR define it will
thx for bringing this thing up, i ran into the issue earlier when trying to make benchmark scenes but didn't realize defines could be the solution
How can I get a confirm/deny message from a webpage when using wwwform to submit a username and password. I get no errors in unity however I can’t seem to figure out how to get a response reading from the post. Any help appreciated
Note: what I’m trying to do is use my webserver login system to weigh the account is active when logging into my game in unity,
Hey! I created a script that removes whatever the player is leftclicking at. When my friends join and deletes something on his side it works sometimes on the serverside and sometimes not. Any idea why? Iam using Photon
@solar tendon This is one of my systems that does it. I use php on the web side to echo out info. https://pastebin.com/ysCu3eHS
@maiden sundial The RPC code will trigger one each client? So if they're not hovering the object it wont be removed?
I was hoping that after submitting the username password that right there in the c# script on unity it could tell me “correct” or “incorrect” for password and teach accordingly, is that something possible?
You want to stall the main thread until you get a response back from server which might take several milliseconds or seconds even?
Yes. All I want is a nice “success” of “failure” step notification
Or*
String*
iPhones + fat fingers = frustration
Ideally I’d like to be able to
Post username;
Post password;
Wait however long
Get response if password was ok or not
I'm not sure but I guess you can do a while(requestOperation.isDone == false) { } ?
Yea, the issue I’m having is detecting the success or failure based on whether the password/username successfully logs in
You can use coroutines as well, but I guess you don't want that as well.
But what are you doing on your web side then?
Registration of accounts and housing that data (username/password) in a DB
in php?
Yea
so just echo 0 if it's success and 1 if not?
How would I go about getting it to echo?
I'm a php newbie, but this is how I do things. https://pastebin.com/YvfJYhw7
And that goes in unity project or webserver?
webserver
It checks the DB if row exists of the credentials, from IsValidSession functions.
Ok ok right on thanks man, I’ll definitely give that a shot
Then from UnityWebRequest..downloadHandler.text you get the response you have to parse.
Does Unity have a dedicated server able to be built from editor like Unreal does? I'm thinking on making the switch to Unity but if it doesn't have Dedicated server support then I can't...
Or if there is another way
There are headless builds if you want it
Though management and deployment of multiple sessions is basically, as far as I can tell, 1:1
So you'll need something to orchestrate game sessions
Ah yeah like a master server?
To send info between and push players to the game server etc?
If you need a relay server or just something to coordinate clients
You can make that without Unity
I would suggest using Unity as a server only if you need the Unity game loop
Or other Unity systems
On the server as a source of authoritative simulation
🤔
Hello. I have a question:
I want to make an app that access a website, search its products, save images (optional), name and price of the selected items on a wishlist. I'm trying to learn about web request command but i can't understand how it works. Can someone please enlighten me? Thank you
Anybody?
@left ember I answered something about web request like 5 messages up, is your question unity related?
Hey all, I've got a two questions / issues (I am using UNET).
- My player UI shows up for all players. Is this a camera problem or can I simply solve it with isLocalPlayer? Ie if the player is not local then hide the UI? At the moment I just have one camera per scene.
- Whats the best way to make line renderers visible on a network? I can spawn in projectiles but am having trouble with line renderers.
Thanks.
Anyone else get ClientServerBootstrap interface error when using multiplayer netcode?
Looks like the hybrid renderer API has changed and the ClientServerWorld.cs hasn't been updated
Anyone fixed this on their own?
I haven't tried netcode the newest released ECS update no.
well since in #💻┃code-beginner i get no answers ill post here as well
https://pastebin.com/YsYK58ye
I try to use photon with playfab and since i want to get a token for both chat and realtime i try to call the above after requesting the playfabId
but the second one is never called any ideas?
@ me if you find any solution
I'm using Mirror Networking (which is UNET, but more up to date), but I am stuck with a predicament. I'm creating a 2D sandbox game, with procedural generation, but I don't know how to sync the generation and any world modifications to clients.
@weak plinth We can help you in Mirror's discord
I fixed it by adding a boolean to switch on second token on update()
so if anyone is against that or has a better suggestion tell me
though now the chat is fully functional from what i can tell.
anyone here knows how to use firebase database?
im having a trouble with getting jsons
@winged veldt Strange, i was just gonna ask a question regarding firebase lol
Is firebase the best option to store scoreboards? And should i store results to the cloud in the game or in the lobby after a game session? Im thinking that storing results in a game can cause some performance issues with extra network requests
meh
if you are doing a tiny game just dont use a scorboard based on a database
is easier to use google play services
Right, i thought about that service earlier but overlooked it. Does it provide any analytics or reports about crashes? I saw firebase had this, not sure if i need it atm but it would probably be nice to have to optimize the game further.
honestly idk, but it does his work
Playfab also stores user scoreboard
But don't know if it can work with Google services
Needs research
what is best photon engine or other staff
Hello! Anyone use KCP for Unity: https://github.com/KumoKyaku/KCP ?
@karmic void Any reason you're posting random articles/githubs without any messages? lol 😄
First article is about Coherence, second is a question. Anyone use KCP in Unity?
only one using KCP i know of is Improbable
Interesting. It is better than UDP? What the difference?
@graceful zephyr Thank you for you info...
Is there a good tutorial on how to set up the social api? It says it uses the default gamecenter depending on the platform, but it seems like i still have to considering if the user is on android or ios because the leadeboard ID is different since google has game play services and ios has gamecenter (im assuming i need to create a leaderbord ID for each gamecenter in order to sync data relative to my game)
Hello fellow developers!
This is not very Unity related but more of HTTP
So in HTTP Status Codes 301 means "Moved Permanently"
Does that overwrite my domain to the new domain?
Because I have a friend using HTTP 301 to redirect user traffic rather than 207 "Temporary Redirect"
"Fall (Q3) this year: Preview DOTS-Netcode will be available sometime this fall providing a server-authoritative stack, including entity serialization, delta compression, forward prediction, and interpolation. Given the Preview state, developers should still expect breaking changes to the API surface until the stack achieves verified state."
Has this "Preview DOTS-Netcode" been released yet, or are we still waiting?
What is the entities package?
Thats what DOTS uses.. the Entity Component System (ECS) with their jobs system. Basically they are contents of the DOTS
ok, so an update was made to DOTS but the new netcode is not yet available
exactly..
Thank you!
The other samples that use that entities package is not out yet which includes the netcode
So the FPS sample is not using the preview dots netcode?
The current fps sample uses the older code. They are going to release the new one which uses the new package pretty soon now I think.
OK, thank's for the info, I look forward to trying it when it comes out!
I think I'll lay low and learn about DOTS while I wait...
so is DOTS actually available via package manager or what
yes. Just enable preview packages in the package manager and you should see it.
Weird when you're asking for "DOTS" in networking channel, Entities package is available yes, but not DOTS netcode.
yea it was the netcode specifically i wanted to check out
is it available in the 2020 alpha build?
it's not out yet.
The latest Entities package has dropped (0.2.0*) but nothing else from the FPS demo at Unite copenhagen (animation, netcode) has released yet
@jade wharf it's not out yet, wait a couple of weeks
Rip
@lucid stag It depends on what the 301 redirect adress is. Usually 301 just redirects domain on http to https for safety purposes.
Anyone familiar with the Unity Social API? Im trying to figure out how it works with Google Play Services and IOS Gamecenter
It's happening! 😮 Soon ™️
https://bintray.com/unity/unity/com.unity.netcode
https://bintray.com/unity/unity/com.unity.transport
https://www.youtube.com/watch?v=_J6-3l3hCm0
I just wanted this quote to link to my friends constantly when they should have done something a long time ago :P
Or well, you can already download manually if you can't wait x) But not in package manager yet of what I can see. ;; I knew it would be release just as I can't work on my project for a few days sobs
Asking for console development: Will voice chat be supported through the new networking subsystem?
Like in, if NAT punch fails for P2P voice chat, the PSN / XBoxLive relays will be used. Anyone know? I would greatly appreciate, thanks.
(not trying to start a scary console NDA discussion here, just a yes / no answer will suffice)
Not sure what you are asking. Are you talking about Dots netcode?
I'm not familiar with Dots, but I'm pretty sure it isn't directly related to online services for consoles.
@burnt axle Kk
@stray scroll Right now if you do a console game with UNet LLAPI (for transport only) and dedicated servers, you'll still have to solve encryption, ping and voice chat.
Voice chat is the only thing left to do and requires to implement the networking subsystems of the consoles to leverage the PSN and XBoxLive cloud (so we won't pay anything for voice bandwidth)
This is a game in Unity 2017 and we want to know if it helps to upgrade to 2019. Is there anything in the works for voice chat support?
No, not that I have heard off yet. Also the new network system is based on ECS so that might be a problem too.
Oh ok. I'll try to e-mail support and see if anything is in the works. A year ago they didn't know if they'll add it or when. Thanks for the help!
Hey all, I am experimenting with the new transport layer, and whilst everything works in editor, as soon as I build I get a 'plugin expected x86 architecture, got x64'. I have check the com.unity.transport folder, found the dll but it has all checkboxes ticked. Any ideas?
(its the networkbindings.dll btw)
sorted mine. (need to change the setting in build settings :P)
Its actually going fairly well (im pleasantly surprised at this point). The layer is low level, doesnt hold your hand that much, but it does cover up all the memory management and core networking that I want to avoid. Ive got transforms and rotations syncing across a central server. Im a VR programmer, so I'm going to spend some time over the next week setting up a simple VR networking system, see how I go.
I want to see how you interpret it
Let me know when you get your demo going
@worldly cedar
Will do :)
I'm learning C# for unity at the moment but it seems no matter where I look it's all single player tutorials. What is different between single player and multiplayer when it comes to C# for Unity? Like what should I search for when it comes to guides?
I want to learn the server authoritive kind of c#
I was thinking on using Photon or Atavism or something as server software but I think I still need to network my code to allow it to talk to the server right?
If you are still learning to program, I think you should really consider finishing a (single player, simple) game before venturing into multiplayer...
I just don't want to relearn stuff if I can help it.
I see there's a new networking system coming in. I guess if I spend the time to learn the workflow of Unity and C# I can later update my knowledge once the new system gets released?
Really, trust us. Just take your time to learn solid foundations. Not really more to say, sorry.
Ok
Any recommendations on good tutorials to learn Unity besides the ones from Unity directly?
Paid or free, either one
🤔
I'd say it depends a lot on your goals.
I'm looking to make a Isometric Action RPG a bit like Path of Exile
What do you want to do?
- develop games just for fun?
- become a professional (if yes, a programmer, a game designer?);
- develop games in a small team or alone (if on a team, which role like above?)
As my final product
Each path would require more or less proficiency in programming (which is something you need YEARS to get, there's no shortcut)
Isometric Action RPG a bit like Path of Exile
Multiplayer?
Alone?
Was hoping for multiplayer but you recommended single player for my first game which makes sense I guess so I'll say single player.
Alone for the coding and functionality, hoping to find someone later for graphical assets
sole programmer... Sorry to disapoint you, but this will take you some time.
But yeah, start with single player

The path doesn't change much. But you'll need some time...
Tutorials it's more about which ones YOU feel confortable
I'm expecting at least a couple of years to complete a game at least.
People learn in different ways and paces, so what I like might be boring for you, etc
True
Try free tutorials on Youtube + Unity's docs
If you are more of a formal guy, try solid C# tutorials, not related to Unity.
Ah yeah that's probably me
Thanks for pointing me in the right direction
I appreciate it

There are good books that give you a nice understanding of game engines (I highly recommend the one by Jason Gregory):
https://www.gameenginebook.com/
can a NetworkBehaviour marked with ServerOnly Call RPCs?
Sure, since RPCs are called from the server
However, not if that RPC is inside of that serveronly code
that I would expect to fail
If you are using Mirror @ocean ledge then there may be some changes in that behaviour, best to ask in the Mirror chan for that
I'm looking to do some custom networking with TCP in an application I'm thinking of using Unity for, would this API be the right thing to use for that? https://docs.unity3d.com/2019.3/Documentation/Manual/UNetUsingTransport.html
Communication would be via a simple text-based protocol
The Transport Layer can use two protocols: UDP for generic communications, and WebSockets for WebGL
Looks like that's a no for TCP
Looks like only way is with the Sockets standard lib (System.Net.Sockets)
@livid spear Youtube and Udemy

Do i need to create an leaderboard in google play console before i can use it with the Unity`s Social API? There is very little info from Unity and google results on this
@jade glacier no I'm using UNET in 2017.4 I have an object with a network identity component marked as Server Only. A script component on that object is calling a RPC on a different networkbehaviour and that one isn't marked Server Only in the network identity component. for some unclear reason to me this doesn't work when i build the project however works flawlessly in editor mode (having 2 pcs - 1 client and 1 server)
so, simple question, is there an established method for retrieving client/server IP using Unity Transport Layer (the new mulitplayer system)?
@ocean ledge I don't fully recall the quirks of unet. I would though make all methods and fields involved public, and you may need call the RPC from inside the same class... Meaning making a second method in the server only class that is not an RPC, and have that call the RPC. The Weaver is quirky.
Sorry in advance if this is the wrong channel, seems like you networking guys would probably know DB's the best and it didn't seem to fit in anywhere else other than "general code".
So I'm making an MMORPG which requires quite a bit of traffic/storage in ye ol' database.
Have looked into what to try and since I am working with limited funds I was mainly looking into Open Source DB's. MySQL seems to be used everywhere but I am not a big fan of oracle and SQLite is probably my favorite so far but apparently it gets slow when handling big amounts of data. So, what would you guys consider to be a good choice for this and why?
One of the top contenders for me right now is MongoDB since I have nothing against NoSQL DB's and it seems like a very quick and fast DB and if I do reach the need to scale it up, I can use the cloud SQL service...
@jade glacier Can i ask you about client prediction ? i didn't understood the input resim part, from what i grasp the client sends numbered inputs to the server while also using it for local movement AND also storing it in a input buffer, the server moves the player with the input and sends back the position with its tick number, the client that may have stored/used inputs receive the real position and check if we are almost at the same position if yes i clear the input buffer up to the server tick number, if not what now ? what is the resim ? applying the inputs remaining in the buffer and if we are still not good just apply the good pose ?
is what i said even true ?
What about the resim ?
The resim is the reapplying all inputs past the disagreement
You move objects to the server stated state, and run the ticks again with you history of inputs
but why would i do the history of inputs when i has a chance to be wrong counting packets lost ?
just move the player to the right pose and move on right ?
i don't understand this input buffer business
inputs can be wrong to the eyes of the server wich is autoritative anyway so when you predict + store the inputs and get your pose back but its wrong on your side why re applying inputs matter if there is a chance that it wasn't recived by the server ?
i mean your prediction was wrong, replaying it will still have the same result right ?
But more than I can explain here on a phone sorry. But it's all the standard handling of prediction and correction after desync
Its ok thanks anyway !
If you don't reaply inputs again (it's just advancing the local prediction one more time) your client will be "laggy" just interpolating server confirmations
Information confirmed from server is always "in the past", so you need client side prediction again (all modern games do it, otherwise it will fell slow)
I think only quake 1 did this way back without local prediction
Only way to do the client side predictio then is too keep the input buffer (even if slight different than the server ones - these will come later in the next confirmations).
That is the bread and butter of client side prediction. Notice I'm not talkinh about deterministic predict rollback (which is another story completely as discussed here many times)
does the server has a input buffer too or it just sends position and tick number ?
Server also uses input buffers yes, but it will accept them in order...
There is normally a queue to control the input rate, etc
In some implementations you also might want the client to be "aware" of the server clock, so the client tries to comply with the server input rate...
It might send input with tick numbers, etc...
The client queues in the confirmations and applies them smoothed (then adds the re-prediction on top)
I think the best explanation of this is the video by the overwatch team
So tell me if i got this senario right: Client sends inputs to server + stores them + use them to move locally, server gets them and sends back tick number + position, client receives it, tests if we have the right position, if yes continue + remove inputs up to the same number as the server tick, if not re apply the inputs in the buffer
If not, apply partial correction directly to position (and keeps the extra error to apply over next ticks smoothed).
No matter if correct or not (position for tick), always discard local inputs up to tick
They are not useful anynore
You only need the local inputs from confirmed tick to last tick (+ the new input for this next local tick)
sorry to come back to this but if you apply server position what are to inputs doing in the equation ?
The higher the ping the larger the buffer
I think me and emotitron explained this at least twice. Let me give you numbers so you undersyand
Local machine simulates with my own input ticks 40, 41, 42 (I keep this in a buffer and the positions)
At some point, server receives my input for tick 40... Applies it there, sends down confirmed position for tick 40
Let's say that (due to the speed of light, damm, we can't be faster) this confirmation (for tick 40 position) arrives on my client exactly after I have predicted tick 42 for the first time (as stated above)
My client checks position for tick 40 if it matched the confirmed one... If yes, I just discard my local input for tick 40, as it is not needed anymore
If it doesn match, I replace position for tick 40... But I CAN NOT render this confirmed position, because it is "in the past"
I then reuse the local input buffer 41 and 43 (re running the player movement logic for those 2 ticks).. this will move my character to the present time + the correction
Then, finally.... It's probably time to simulate yet another new tick (43)
New inout is polled from local controller, simulation runs.. input 43 appended to local buffer...
Loop forever... Profit
That's it, I don't know how to explain bettwr
There are small variations of how to smooth these corrections in (the way I described the corrections would look jaggy)
But this is it in a nutshell...
@graceful zephyr did I say any obvious bs?
Notice the local input buffer necessary is directly proportional to your full ping to server + the server buffer (if it has one)
This lit some part i didn't know i have just an other question, if you feed all pooled inputs to your movement script in one single frame won't your player shoot out ?
So I described with you keeping 3 ticks. At 60hz this is equivalent of a super nice 50ms real ping (including processing)
Shoot out?
You don't pass all at once
You call your movement logic once per input... One at a time
With the fixed delta time every time... So if you are moving with a KCC query, it will move smoothly over surfaces, etc
ah i thought you add dthem together
Nop, this doesn't make sense
Input is not a vector
Might be just digital directions, for example
You reapply your input logic, that might include jumping, etc
Input is a struct, with maybe a vector, maybe buttons pressed, etc
There no "definition" for "adding" a complex inout struct
These input buffers can be quite long....
At 60hz and 200ms ping, you are talking about at least 12/14 ticks
Think of CS running at 120hz...
this i understand 😄
200ms ping would imply in at least 24 input structs in the buffer
Notice this is so complex that many times you only use it for stuff like movement
Because you don't need to reinstantiate a bullet... You either confirm it was shot (and then it becomes a networked entity on its own), or you cancel it (remove the rendered entity)
This is so complex it hurts my eyes on the special cases... Lol
Gosh bless predict rollback determinism...:)
yeah and we didn't even discus the demo feature 😄
where bullets and projectiles can be rewinded
Not touching on how to transfer data efficiently... How to smooth the data for non local players, etc
Bullets and projectiles are normal entities after instantiated... They use the very same logic...
Just that they don't need an input buffer (just the direction anyway)
but if they die it means they'll be re instantiated when you rewind ?
What I mentioned was about the very tick where the projectile is created (the logic of resimulating the trigger)
ahh ok
No, they become separate entities, remember that
If that is necessary, lol
Many times it is NOT
You use the local bullet just for rendering (you just delete in case of cancellation), including predicted shot hit... Particles
Then server only confirms or not the damage (and here we go again...)
Damage logic, hit checks is another soap opera
yeah i tried out cs with lag + loss and bullets are indeed shot in local
Done with lag compensated raycasts, the famous favor the shooter mechanic
This I again recommend watching the overwatch "let's talk netcode" video
yeah will do thanks for your time @gleaming prawn this was interresting
I'm looking to develop a game using Unity, I want to make an online action turn based rpg style game and I'm wondering if nodejs using restful api and tcp websockets would be alright for the back end?
I know there's BaaS out there, but I feel like it would be easier to shape out if I build my own backend and have full control over the database and relations.
Turn based, I've made something like this about 10 years ago over Google app engine at the time.
I fear doing directly over the backend for every turn might be dangerous, because rest + dB is not really made for instant response etc... It really depends ontm the game pace
We tend to offer now solutions that work on a game server keeping the game state as a memory transaction model there...and you push to the back end periodically, or even only at the end game.
But it really depends on the game pace, and the scale you think you'll need
is there an time estimate on unity's "new" network solution?
Its technically out
If it's really really slow paced and a movement confirmation can take a couple of seconds, then fine
On package manager @weak plinth
as in complete or untested bits and pieces ?
The latter
ty @graceful zephyr 🙂
For turns I would use sockets rather than rest
Notice you need two way communication from backend to all players (like some websockets or notification system)
Yes, that makes sense then... But I would also not make every turn a dB transaction
I'd put the game model in memory and save asynchronously
Yeah for sure
I just keep user inputs on the same size ring buffers, so I don't bother discarding
Database would just be where it gets the user characters info initially, as well as enemy info
But same outcome
As for nodejs, whatever... If that's what you are best at... I fear it is way too barebones and a lot of reinventing wheels... But it's whatever you are more comfortable with.
Makes sense then WL
Tô me at least
I don't mind using a different language if node wouldn't be efficient
C# on both ends, means you can share code
What do you think would need to be reinvented?
Between server and client
That's true
Less to write, less bugs
Net standard for the model
So you can run a net core backend, and unity uses the net standard model as well
No code duplication... Also decouples simulation model from unity, normally a good practice
I was thinking of using Net Core as well
Imho it would be a better choice for the reasons exposed by Fredrik
Thanks for your input, that's probably the route I'll go then
I'm worried nodejs being single threaded might be a pitfall anyways if there are a lot of interactions happening at the same time
which wouldn't be an issue unless there were a lot of players
@tepid steppe a lot of those BaaS solutions are hyperscalable, you won't be able to even come close to that.. Why would you reinvent the wheel?
The best BaaS for games are developed and maintained by pretty big companies. What's your experience by the way? Do you require only a subset of the functionality?
I think because I already have clear idea of how I want my game to be and what it needs, and I feel a BaaS might have more than what I need or can't cater specifically to how I want it perform
But I might be looking at it the wrong way because I haven't actually played around with a BaaS yet, only read what they have to offer
I have a couple years experience in full stack web development, as for game development I've only made a couple small rpgs with vb6 awhile back
Playfab, GameSparks and the others are really powerful. If you don't want to waste your time or start your own BaaS provider, don't..
Yes you can make it do anything, especially something like GameSparks. And even if you have a corner case, just extend it in AWS, they play well together.
Alright I'll experiment with some BaaS
Thank god :))
Saving time is a good thing haha
Playfab is easier, but not as flexible / powerful as GameSparks. Just take a look at it's website. If that isn't enough and you have time on your hands, go with GameSparks. I don't have much experience with the others but really using any of those services is a big win. Are you a game developer or a middleware / services provider? The answer to that question will make things obvious.
Also, if this is your first game, make a single player. If not, go multiplayer. If you already did that, go multiplayer with backend. And at each stage, actually ship it (as in you sale it on Steam / consoles / etc). This is a common advice everywhere, by the way.
Thanks for your advice
You're welcome ✌
is that official now ? just noticed a massive change in the repo
is there any other network systems like photon PUN so i dont need to care about NAT?
I suspect there are some other basic relay services like PUN, but not aware of them
so, as someone completely new to working with multiplayer in Unity, what framework/resources would you recommend?
@rare crypt yes you can get them on the package manager now
the new networking
but its early early early
like... early.
proper early
0.0.1-alpha-preview-only-for-testing early
@graceful zephyr hmmm... true that, i think ill still give it a shot and keep checking for updates, so once its gonna mature like good wine, ill be ready to drink that delicious net code.
@graceful zephyr 👋
whadup duder
not much
trying to get youngest kiddo to sleep
and getting sick
lol
you? 😄
kid-less this weekend
ah
so i'm writing a FPS-character controller thing for funsies
that dude gets it all xD
thank god
gz
yay got the new netcode up and running
i hope unity uses some doors and triggers in their upcoming sample because I've no idea what's the proper way
right now i went for a predicted ghost for the door
where i'm still having trouble is with different objects for the same ghost type. seems like there's no pipeline for this at all. like different platforms for movers or different characters for predicted character ghosts. the only way to change it would be in DefaultGhostSpawnSystem in the netcode
Yeah, the way I did it on the previous version was to use an ID synced to spawn locally with a system.
I have a question: when there is a state desync we reapply the inputs we have in the buffer but do we snap back the player to the desynced state and the apply the inputs ? and if you apply them once per update won't this mean that the player won't have control of the player until the input of the buffer are applied or do you separate the render and do this on a hidden object for the player ?
@solar garden you snap, and reapply all inputs
That are after the frame that desynced
ok and i do this on the render player ?
Hi! I've been looking to learn a bit of multiplayer and googling around has me a bit confused. Where should I start to give my html5 games some human interaction?
@solar garden for monobehavior/non ECS I create a second lightweight physics scene and do limited resins there, then copy the results of the object in question back
On the DOTS side that will play out differently, since things are all moving forward with stateless physics
when you say physics scene you mean a "level.scene" scene ?
2018.3 and later let you make isolated physx scenes
And manually run . Simulate on them
You can do work on the main scene for resim, but you have to be more careful there
so you use this scene to simulate the player and if the render player is too off you snap it to the one of the physics scene ?
You put into that scene things you consider important to the resim
The player, relevent terrain, intractables, whatever is applicable to you
OR, use the main sim... Just the you have to rewind everything
A small scratch pass sim let's you make you resim a lot more lightweight
But totally depends on what your game is, and what needs to be in the resim
all this is for the server side ?
Either, depends what you are resimming
On the client for missed predictions
On the server for rewinding shots
For rewind checks, it's not so much a resim... Since you don't simulate forward after rewinding
Have you read the stuff on how csgo works? And the overwatch videos?
i've seen the valve doc for css but i didn't saw this kind of physics thing
Enjoy the videos and music you love, upload original content, and share it all with friends, family, and the world on YouTube.
But they don't use this kind of hermite physics scene system right ?
essentially this physics scene thing is to kind of hide the raw processing in the background while the render players are walking freely until they are corrected right ?
Not sure of the details of how they run rewind. More just making sure you are aware of the different uses for rewind and resim
The second scene is not a thread
There is no 'background processing' for this, since all work on the next frame can't happen until after the resim
oh yeah i didn't ment background as separated thread i meant like its invisible