#archived-networking
1 messages ยท Page 58 of 1
You can do anything you want, this is programming
Doing it on the main scene just means you have to be careful
New dots stuff is going to change the whole physics workflow anyway
terrific
The new dots netcode implements a basic version of all this already @solar garden
So you can just use that
@graceful zephyr have you been liking the new netcode?
I think I want to do a tutorial on it.
I think that would force me to really over think it.
Like, its okey. Is my take so far on it
Read through the whole codebase line by line
Its missing a lot of features
Say on
Not a fan of the codegen, the rpc system is cumbersome, the delta compression I think is going to use too much CPU to scale well for dedicated servers that can use 1-2 cores only and still be able to host something like a fortnite
@faint fern
The biggest complaint that we had at the start of Unet was that it wasn't multithreaded when it went into the base Unity Game engine.
So I mean they fixed that this time.
But its early, so things will change
Sure, but you generally don't need that much multithreading for dedicated servers for fpses
True, it was more for the mmo's
Nobody builds an mmo server in engine anyway
There are people that are trying to.
So building a networking lib that lives in engine with that target seems useless
@faint fern sure, people try things all the time, doesn't mean it's a good idea
I didn't say it was a good idea, but the people that are trying to might outnumber us here.
and their money is money
so...
ยฏ\_(ใ)_/ยฏ
The new networking isn't going to work for an mmo anyway I'd say so
I wonder if that argument will cause them to branch it?
the new netcode is for FPS types only, so, yeah, at some point they will have more types
I'm not sure, I've not read it yet.
I'm just starting in the manual today.
I asked @graceful zephyr for his opinion since I've known him for so long. Thank you btw. for your info.
@faint fern yeah it's been a while
But yes, overall it looks good, but it's way to early to tell fully. A few things I don't agree with how it's done (rpc, codegen) and some performers concerns
what's up with the rpcs?
the InvokeExecute is weird but I think it's pretty straight forward
Hi ! I need help using Steamworks.NET in Unity, i can't figure out how to send an invite to a friend
anyone knows a good example on how to do that ? i can't find anything online expect the official steamworks api doc (wich isn't enough for me)
take a look at https://github.com/Facepunch/Facepunch.Steamworks
it's a different library, and lacks the same kind of example
i'm already using Steamworks.NET for the P2P networking so i was more interested in example using this library, but if someone has some with the Facepunch one it could also help me get on track.
@hoary lake The official steamworks api doc should be enough to figure it out in steamworks.net
its baically a 1:1 mapping
of the C++/C api into C#
SteamMatchmaking.InviteUserToLobby( CSteamID steamIDLobby, CSteamID steamIDInvitee ); It only takes like 3 seconds to google x)
the thing is i don't have a lobby i only have a P2P client to connect to
but i guess invitation only apply for lobby ?
but when the game start, isn't the lobby dead ? so i'm not sure about how to invite to the running game if there is no lobby
that's why i wanted a realexample and not an api doc with just functions names
Hmm, I think it's a state, don't remember correctly how to set it. I'll see if I can find it in some old code.
SteamMatchmaking.SetLobbyJoinable( CSteamID steamIDLobby, bool bLobbyJoinable );
So just never set it to false?
Oh then the lobby would keep existing even after the game had started... Do you know if it's how every Steam game handle late join and the way we're supposed to do ? It sounds hackish but i'll try, If it works then why not... :)
No, I have no other experience then using it myself and reading through docs. I don't see why it shouldn't be the way to go considering what the steamlobby brings in features.
I think it's better to ask steamworks questions in the forums as well?
Yeah you're right, this goes beyond the scope of unity.
Can someone help me out setting up server sdk?
I cannot access my routers info
By default ip
Diff pws for admin
Pwd
Hey guys, I'm new to networking,
my current project is for a roleplay server, they have a big group of emergency services but the dispatch system was terrible so I'm making a system for them.
I noticed Unet was bucoming depricated and so I just started using Mirror, but theres not alot of tutorials or anything that can really help me make a fully GUI based software
All I basically need is about 25 users or so that can click a button to change their status to "On Scene" or something similar, and a few people that can access a list with all the statusses in a list
Maybe someone can help me out on this? I can probably do everything except the networking.
I don't think you'll find anyone doing your work for you in this channel. I would try other generic dev discord channels that has a LFM, or reddit forums classfields or INAT.
I know
From what I've heard MIRROR and UNET should be very similar, so looking at UNET guides should help you out.
Its more that I could use some explanation on some stuff, when wrote that I didnt start on the program itself but now its more clear on what im gonna do
If you can't google yourself to your answers, ask ahead on the specific questions.
Ill read through some UNet docs for a min
Ok how do I make a button that hosts a server with a default name
go ask in the mirror discord
they can help you with that
much more efficiently
hows it going fellas
is there a way to get the old unity networking system back ?
the network view one. they deprecated it too fast imo
I found in the package manager the old HL API it says it will deprecated so as long as i keep old unity install im good i presume
use MIRROR
when you're having an issue and find a 4 year old post that Tobias answered in detail
Network view was before unet. That's legacy unity networking.
so Mirror it is
having some trouble importing will try to fix and come back here if no luck
How could I do local mutliplayer on Oculus quest (two to four) for an arena scale thing
What do you mean how? just do it
Can you make a more specific question CheckMiner?
man untiy is taking his time to release the 2019.3
been in beta for a while a no sight of the preview packages
It's released?
add "com.unity.netcode": "0.0.2-preview.1", "com.unity.transport": "0.2.1-preview.1"
not sure why it doesn't show up in packet manager
Hey guys, does anyone know how the Nintendo Switch multiplayer works? I mean, there is this multiplayer where you can connect multiple Nintendo Switches and play the same game, but I have an offline multiplayer, anyone knows how this feature works and what I must do for my game to make it possible?
What you mean by offli e multiplayer? A couch game?
Offline*
If yes, this is not the right channel, as this would qualify as a normal game, just with more than one controller, some rendering camera to show all players or split screen etc... No networking involved.
If you want to write the same code and have both local couch multiplaer + online + mixed (online with more than one player per machine) then I might have something that interests you.
My game is couch/local on every platform. But I think there may be a different way to handle things on Switch specifically cause you can use two Nintendo Switches to play the same game using a connect between them, and I don't know if this multiplayer is native (such as Steam solution for playing local multiplayer on network). I would like to understand this platform specific functionality.
Platform specific - in unity channel? Isn't that under NDA as well?
@stray scroll yes you are right, this stuff is not allowed to be discussed publicly AFAIK
Its a bit funny of course, since every major developer very likely has members on their team who are intimately familiar with all of the other platforms apis
my networktransform doesnt work how it should. the gameobject moves on the client but it doesnt update the transform on the server.
networktransform is bad, but it should "Work"
if its not working at all, that usually means your controller needs to be disabled on non-authority network versions
@plain dock
Most annoying code I've written in a long time (because all parsing stuff x) ) https://pastebin.com/TLSek3F2
Not sure if anyone ever would have use of the code, but share it anyway. I want to have all the servers in my project existing in different worlds, and those worlds can talk to other "worlds" through RPCs. I generate the simulation groups which exist in same namespace as their names. E.g. LoginSimulationSystemGroup /InitializationGroup. And extract the RPC network part of the NetCode and add it in specified folders. Parse and remove unneeded code (which is very prone to what they might update it with). But hopefully this will reduce my refactor time in future x)
@jade glacier thanks, i'll try that
am I missing something? you can make a listen server build with the new netcode right? meaning you can play the game and act as the host from the same client right?
I don't actually think you can build it as a client+server
Which is super weird, and I complained at forums on it as well ๐ But it works in editor to run client+ server
The thing is in bootstrap the define UNITY_SERVER takes precedence over UNITY_CLIENT, instead of being parallell.
Ok, I just watched the last unity video, and it seems they deliberately made the decision to separate them, they even said 'who would even want that?'
me: in the corner looking at my coop game ๐
man, I get that this is super early and all, but I'm kinda glad that I didn't drink the coolaid and jumped on this dots stuff right now
same with xrp
why would you do co-op with server though?
I have a weird one, i had set somewhere in a start function Application.targetFrameRate so my pc stop screaming on builds runtime, tho is it normal that if i set my input send rate below the Application.targetFrameRate, half of my input will be ignored ? i thought Application.targetFrameRate was only for frames to render but it seems it is doing more than that
Application.targetFrameRate is core loop rate, since everything is built on top of the basic loop.
I'm not sure what you mean with "half of my input will be ignored"
And are we talking Dots Netcode?
i don't know if i set the send rate bellow the Application.targetFrameRate it doesn't play the inputs and the far the number the most inputs are not played
ah no
its forge networking
but i just throught it was a problem from Application.targetFrameRate
Ok, haven't used forge. But imagine that if you set the targetFrameRate to 30, and you have a physicsTick on 60 you will have multiple physics tick on every render frame.Depending on how your send system works, if it consumes input, it might be that there is no input generated between your sends (since two of them happen after eachother) and thereby some inputs are "missed".
its just weird because why would it even be a problem its not packet drop it is just not playing for some reason but the framerate shouldn't cause any problem
i'd figured that i would keep the older input as i just override the InputFrame var
Could also be on the server side that the buffering of inputs can't account for your chunk sends of input
If there are 0 inputs, then it is weird, and then I don't think it has to do with framerate .
i don't have a buffer or input management of any kind i am pretty early in the code i just send a InputFrame object via RPC to the server and the server overrides its inputFrame object with the new one every time so yeah its weird that the framerate would have anything to do with this
ofc i use the current inputFrame directly for movements and such
I would print out (tickNumber, MovementAxis) on both client and server send/recv methods and see what's going on
yeah i did that and there is no slowing down when this happens :/
slowing down?
yeah you mean for showing if there is some missed packets right ?
Both that and see if inputs are zero
yeah i take a deeper look but i told you inputs can't be "zero" because they are not reset its just a matter of replacing a state input so while it is not a good idea the result would be that i should continue doing the input until i receive a new one...
See im spmming jump here
but it jumps only at times
Yeah, so check some output logs and see what actually happens.
yeah will do thx
I have multiple players with the same scripts ofcourse, but the scripts change eachothers values
if callsignSet is true for one player and its false for the other they keep changing eachothers value
how to fix this
@jade glacier @graceful zephyr Do you guys let the clients change fps at will ? i have a problem where inputs are being sent though the FixedUpdate() and if my server is running at a lower framerate as the client inputs will be glossed over because it is too fast for some reason a solution could be to make a input queue to process them one by one but if the clients are still faster wont the queue be bloated with inputs and will create more lag ?
Anyone got any good samples of Node.js / MongoDB REST server and DOTS?
@solar garden you are right, you should let clients run at a faster pace in many cases, but not completely free.
You should still limit that to a max, so your input queue doesn't require your code to process 10 inputs per tick. You should also require the input rate from clients to be a multiple of the server tick rate, this simplifies everything. Something like 3.
Rendering FPS glcan go free on clients, use interpolation to smooth.
@gleaming prawn oh ok thx for the reply ! I don't know if it is linked but right now im sending inputs in the fixedupdate making the sending bound to the fps of the game, im using forge it is supposed to run on a different thread so i am trying to see if i can't send the inputs in its own "loop" so the fps doesnt matter anymore the client can run at 300 fps like 30 no problem of overfeeding the server, is it something good to look into in your oppinion ?
I don't know how forge works. I though you were designing your own solution. No idea how to work with forge, sorry.
This is a basic idea/principle that I know works well.
But I never trust unitys updates anyway, because even the hardware clocks drift with time, so you need to feedback or even sync the client clocks based on the server (we do this)
I would always build in some kind of drift correction if possible. Pretty easy with physics.Simulate () now.
You can have clients slowly respond to feedback from the server about how happy it is with it's buffer for that client
Even if not for dealing with clock drift, just for shaving buffers down to razor thin over time.
Does this makes the input sending not fps bound ?
What makes it not fps bound is sending a fixed tick
Which means some updates get no update, some may get two
Same as how fixed update works
Hey, jealousy
Oops
Wrong window
but i used Application.targetFrameRate to lock the framerate to 300 so it is not uncapped on builds and it seems to change the fixedupdate aswell
i don't know what to use to send inputs now
Sup, Jealousy
A timer really
Erick will know the best way. I just know stopwatch for that.
Just a check of elapsed every update
Cant you just accumulate the inputs to your fixed steps?
@stray scroll client needs a way to adapt itself to the server if it ends up behind/ahead
So then it just changes simulation time until it's corrected?
What I meant was simulation tick rate, not the delta. Would that lead to jitter?
How to simulate loss of connection with PUN 2 on one client?
@fathom gust disable LAN interface? kill editor/game?
What i want to do is make player reconnect to server and room after short loss of connection. Basically return him back to match.
is there an actual tutorial for online multiplayer? ive heard photon is one of the easier things to use
Hey there !
I'm making an open world multiplayer game . You can interact with pretty much anything and there are lobbys with about 10 people that are hosted by players .
So is there anything to watch out for when building environments for those kinds of games ? Would you just optimize the world/game and spawn players in there ?
....Yea I know I could google it but I'm a multiplayer noob and would like to hear opinions from people who know more than me and well I'm 'waiting' for dots ._.
@weak plinth You're basically asking "how do i build a skyscraper" when you don't know how to nail two 2x4's together
The question is too big too answer is what I'm saying
Okay :/
@weak plinth do you have previous experience with multiplayer games?
I did some simple stuff but not really. I'm not even sure how a Server works ๐ ๐คฆโโ๏ธ
Start with 2 player Pong... not kidding
I will
@jade glacier you stole my words. But seriously, listen to his advice, start with something really simple and build on that knowledge
Hi guys, been stuck in position transform synchronization with PUN in my unity project. Would like to ask why my object position keep does not want to sync to other players ๐ฆ . Really thanks and appreciate for any input! Sorry im still a newbie to Unity ๐
and this is the functiion in Update()
getTarget.transform.position is the object that i wanted to sync to other players
master (Player 1) able to receive any sync but only clients (Player 2,3,4) not able to receive the sync
Have you first tried using the built in PhotonTransformView, or looked at its guts to get an idea? @neat python
Hi @jade glacier , yes the attached script object and its parent has photonTransformView and photonview
ObstacleSpace object being the attached script
You seem to be putting your rb and networking components on a child, so you may be experiencing some issues with that
Hard to say without the project open in front of me, but that does indicate you are trying to do some not quite vanilla stuff there
so you mean , better im not puttin rb in the child
I wouldn't start there if you are just getting familiar with networking
you are creating an edge case right out of the gate
oh ok got it
Anyone tried using gRPC with their projects and have any pointers on it?
What went good and what is good to think about and such.
Mirror 6.3 is live on the Asset Store
Download: https://assetstore.unity.com/packages/tools/network/mirror-129321
ChangeLog: https://mirror-networking.com/docs/General/ChangeLog.html
Hi, Im making an mmo social game, a bit like club penguin and growtopia, what's the best networking solution for me to use?
oh also it must be cross platfrom for mobile, pc, and webgl
Yea it's my first, why shouldn't I do one?
Do the most basic networking game possible
That's all about it... There's no point in pursuing an MMO as your first game, you won't be able to.
Even some of us with 10+ years of experience with game networking won't do one...:)
Think the most basic possible game (and not a fighting game, that is also not easy)
Do something like moving around and picking up mushrooms cooperatively... Anything super simple.
Then you can try to use either Photon PUN, or Mirror, etc...
There are people here who are part of the development team of several of these tools, and we always can answer technical questions.
Your question is essentially the same as this: https://discordapp.com/channels/489222168727519232/497874116246896640/653604130887041039
Look at the answers...:)
alright, ima go small first, thanks for the advice ๐
@undone jolt if your long-term goal is an MMO of some kind, learn PHP/MySQL or whatever the cool kids are doing for backend these days while you're learning unity
In 2005 or so I was contracted to write a backend for a "signature pet" thing that gained XP every time the sig was viewed by a unique IP (or non-unique every 8ish hours)
I hate myself every day for not realizing what a money-maker that was at the time but even in 2019, the easiest way to interact with an online server is via PHP
Things like JSON have only made PHP more powerful in that sense
if someone wants to chime in on a newer and better database system than mySQL I'm all ears, but I'd be surprised to hear an argument against a web-based backend
I am sorry to disagree with you, but IMHO PHP is not exactly the best choice you can do.
The only reason I would pick PHP is for legacy: a lot of companies (not in gaming, I mean in enterprise software) worked with PHP in the past, so now they have a tons of codebases on PHP. If you aim to work with this kind of companies, so yeah: learn PHP. If you're doing something new or you want to invest on something more solid, I would learn better technologies.
C# on ASP.NET Core is already a better and more solid pick than PHP (and if you come from Unity, you should already be familiar with C#). It also has an extraordinary tooling you simply cannot ignore.
You can check out Go, another good language for backend development, for high concurrency scenarios.
If we want to compare dynamically typed languages, even Javascript on Node.js is better than PHP if you talk about JSON and API interactions.
About MySQL: every DBMS has its own pros and cons. Be sure to check them in order to pick the one that better fits your needs. Check out MariaDB and Postgres too, as well as SQL Server.
Another good hint: don't be scared to use multiple database engines for different purposes. Classic relational databases can be mixed with NoSQL (Cassandra, for example... Or MongoDB) ones to improve the service and its architecture.
No serious one
oh... hey MH ๐
Hey ๐
Nicely put @tulip schooner
@tulip schooner I've written my stuff in PHP with WAMP rn, quite early in dev. You're saying I should swap to ASP.NET? ^^
@stray scroll currently I am writing all my backend services with C# and ASP.NET Core. Never looked back. I used PHP early on my backend dev career, I luckily quitted it after few time. I am suggesting every company I work for to migrate from PHP to something better (C# or Go).
Obviously, if you already coded all your stuff and it works for your use case, there is no point in recode everything from scratch
Just take it in consideration next time
90% of the code is just quieries to DB x) As one very new to that area, it feels like a jungle of words and choices. ๐
Yeah, I guess it is.
Also, depending on what you're doing and what you want to achieve, you should correctly model the backend architecture before even pick a language/framework.
Could you give any broad pointers/cases that this would differ?
For example: how many players your backend should be able to handle? In other words: is it something that has to horizontally scale?
Do I have a simple game that will have just 1000 players during the day? Well, a monolithic architecture should be enough.
Do I have a game that has to host as many players as I can? Yeah? Well, I should consider to distribute the load on demand on X physical servers (so we are talking about a distributed system, with all its implications).
In this case, a microservices architecture could fit your needs.
Hmm right, but does that tie directly into of choosing C# with ASP.NET or PHP or other, or isn't this a layer in between the web service and your application?
So for me, I want to have multiple servers running and talking to DB, and be able to scale it in the end. Like the overview of what I have in mind is this; and I have no idea if this is good or bad, but I would imagine you would use some DB solution that does redundancy and accommodate multiple servers reads in the end.
So I imagine only the DB and Matchmaker would need to have some REST API interface.
This does not tie directly with the choice of the tech you want to use, exactly. It is a layer before it, before you even pick tech A or tech B. It is important to decide this and to have clear in mind what you want to achieve, when you start.
For example, in a microservices architecture, you can write multiple services based on multiple techs: service A on C#, service B on PHP, service C on Node.js, etc. Just pick whatever fits better the architecture you already defined ๐
About your architecture:
It could entirely be done as a REST API
Just the game server will remain an actual "game simulation"
(I am doing myself a matchmaker too)
About REST API: recently there is a new competitor to build this kind of APIs. Check GraphQL
Hmm ok. But REST API can be written in any web backend language, so it doesn't really matter?
It doesn't matter as far as you don't have particular needs
But if you need to scale, performance, etc. I would pick something that I know it is reliable and performant
Idk why I suggested PHP when talking about gaming
glad someone showed up to point out how dumb that sounds
it's really easy to work with for simple stuff that you can handle with HTTP requests, stuff like managing a high score board
but it's actually really slow and can't communicate directly with like anything
Exactly, definitely not something I would invest in.
Instead, try what I suggested and let me know! ๐
I'll add C# with ASP.NET Core to the list of things I hopefully have time to learn one day
it's also not tailored for interacting with unity apps
it's easy enough to do, but there's better stuff out there these days
I've been working on getting my game's networking to work for a while now, and I'm aiming for something similar to the Unity Networking FPS demo, but something I'm still trying to figure out is how to handle one-shot events, rather than states. Anyone got any good tips, tutorials or articles on this? Do people create a second channel or something that's ordered and reliable UDP? It seems it's usually OK for an old packet to be overwritten by a new one for player position, but if a user key press to grab an item only gets sent out in a single packet then loss of that packet is going to make a big impact, even more so for chat messages etc.
I considered treating events as states, but attaching a series of old inputs as part of each packet (they only take up about 2 bytes in a custom bitfield anyway), but I'm hoping there are better ways that are obvious, simpler and that I'd just missed.
The best practice is to reduce EVERYTHING to tick based Inputs and States
making separate streams might seem like a fix, but now you are creating a situation where you have all kinds of oddball race conditions
It's a valid question.
Did some fast research yesterday and the things I read said only that PHP7 is marginally slower then ASP.NET ? Esp there wouldn't be any difference if the code only involves sending requests to DB.
This varies, there are solutions that indeed use a separate channel for things like events... you want to shoot projectiles with something like that (while the health changes are treated as state)
It should be the opposite question IMHO Jaws
PhP would have to be A LOT faster for it to be considered a valid option given the advantages of modern .net core
The only reason to use PHP seems to be cheaper developers on the market, maybe? (if you are a company)
Or in the same way, if your team has super good with PhP and do not want to switch
I mean a backend team that is doing more then just a game backend,
Being able to share C# projects for data-models between game simulation and the backend is a huge time saver.
This is something we really "surf" on in the stuff we build (photon server runs .net, unity accepts .net DLLs, so a .net core to match just saves everybody time)
PHP is the "challenger" in that sense, so it would have to bring a lot to the table (I'd say it's arguable in the cases I mentioned: available expertise within the team, or cheaper developers if building a team for a big project that's not only "game")
Sure, I think those are valid points. <sigh> how not to sound like an idiot, from some videos and posts I've read that there some sort of "populism" against using php. I'm not saying anything of what you should choose, just that the tone in the arguments should differ mayhaps?
yes, you are right
We should not have (a lot, unjustified) bias as much as possible...:)
There are always decisions made based on emotion and not on technical reasons... Sometimes that is the difference between a successful and profitable product and a flop...
For smaller projects it often comes down to what the dev knows and is comfortable with
yep
and if that is good enough to get the job done... next
that falls into one of the cases I mentioned (existing team expertise, so no brainer)
For sure
team = yourself... ๐
I can easily see using PHP if you are a PHP hero
y
Marvels new hero, PHP guy
But being realistic, what I've seen a lot in practice recently is neither of these...
It is specialized APIs like javascript-based Playfab Cloud, etc
Because just like what we do, people save A LOT of time by integrating everything into those...
I cannot share specific numbers, but I've seen the adoption of Playfab's cloud script grow a lot. And I'm talking about experienced teams, that could definitely develop a backend themselves...
Interesting
Some publishers already have their OWN legacy backends, in that case, that's what they use (nobody likes to share valuable data)... But new projects, Playfab has been getting some interesting use.
Manhunter manifesto incoming?
@stray scroll it is not only matter of who is faster (and on this point I still can't see PHP as a competitor in a field where .NET Core, Go and Rust can easily win, but this is my own point of view).
You should also check for:
- resources usage. Lower resources requirement = cheaper architecture for you to pay. When you handle a huge amount of players, wasting resources can really hit your bank account.
- tooling. Debugger, frameworks, package manger, etc. Just quality-of-life tools that improve your productivity.
- safety. Not only related to the runtime itself. But also related to the language. A lot of bugs can be easily catched on statically typed languages, bugs that you will not notice in a dinamically typed language until you get a runtime error.
- community. Self-explanatory.
- expertise. As @gleaming prawn said, your team expertise. If everyone on your team is a PHP addict and your whole libraries are written on top of it, just go for it.
@jade glacier yeah, I wall-texted again ๐
Excellent manifest though
yep, all sensible
Uughh, I feel like I need to do a lot more reading... is Playfab only framework or do they cover the hosting of the backend used as well?
backend as a service
If I remember correctly, they cover the hosting too
yes, they cover everything
It's SaaS
On first notice might feel expensive (out of my scope to judge), although this is arguable as always.
Because you might save a feel engineers (salaries are expensive, and you need people if you'll deal with liveops)
100$ for 100k users? seems cheap af
Wait.. then it's 0.008$/MAU, so when you bump 100k, you have to pay 800$/month. That's weird pricing.
Read it all
lol
Liveops is expensive, remember how much an engineer cost you, then check how many you need for a live successful game.
And now some numbers!
I made a little test just for fun: measured HTTP requests throughput for some of the tech I suggested.
Obviously, nothing advanced and basic/standard HTTP requests processing pipelines.
Bombardier is used to bombard the HTTP server and both of them have been ran on localhost.
The request was a simple GET and the response a simple constant string.
C# (ASP.NET Core): avg. 90k req/s
Rust (Nickel.rs): avg. 108k req/s
Go (FastHTTP): avg. 128k req/s
But 100k MAU is a SMALL game... that in Photon would be around 250CCU (100 USD per month)
Photon and playfab) do not offer similar services, so not really competing (more like complimentary, as I see several customers using both), but to my understanding their solutions are indeed more expensive. But this is arguable, as this depends a lot on what is the value being added, etc...
Ah, to my previous comment. From what I now understand you can even go completely free, but with limited features etc.
So it isn't really like Photon, as you always have to pay by usersize, and not by features x usersize ๐
Time to dig into Playfab, gamesparks and firebase and see if I should use them instead of doing my own thing x)
My sanity isn't free either ๐
^^ People who worry about server costs and such always seem to neglect the general cost of GETTING any users at all
"Build it and no one will come"
Firebase - seems only to be for IOS/Andorid
Gamesparks - 300$/month on release for any number of players
Playfab - Seems good at surface, until you see that it's all sort of "micro transactions"/"dlls" based. If you don't use the parameters as a "normal"(?) game, you will pay for extended parameters.
Has anyone had success getting networking working well for small lobby games (2-4) players where the game is very physics based (movement, projectiles ect) and dependent on animations for hit detection?
We'll, we can do that super well, but our solution is targeted to experienced teams. Depends more.on your studio.
@glad compass Yes in a few ways, but the answer varies depending on if you are going with state interpolation, state extrapolation or determinism. But in all of those cases as long as the animations are being synced using a fixed clock, you can reproduce them with great accuracy.
The main difference between methods being whether or not all clients see the exact same world through extrapolation or if they all live in the future and interpolate the world states around them.
To make that work ideally you will want your network tick and physics tick to match, so you aren't relying on any tweening of your animations on clients.
@glad compass you can set the animator to run in the fixed update loop if you are finding it non-deterministic
Interesting. I'll have to look into that.
hey guys I would like to ask someone with networking experience how to go about creating a matchmaker for Oculus Quest. I need to create a simple 1v1 multiplayer.
what makes the quest so different that you need a special matchmaker for this device ?
I dont know ,I'm a complete networking noob. I just thought that mentioning the device might be of importance. Reading this blog post https://blogs.unity3d.com/2019/06/13/navigating-unitys-multiplayer-netcode-transition/ and following the chart it seems I need to take a look at the fps sample. Currently I'm using the NetCode sample. But my game is monobehaviour based( I cant change that) and it seems NetCode is for pure ECS.
NetCode is for ECS, and not nearly close to being ready.
And for a VR 1v1 game that's overkill and not really a good approach I'd say...
Depending on what you need to do you have simpler options.
@gleaming prawn I would love some advice. What I need to sync over the network are the IK targets and spells that are being cast. The spells are not going to be physics projectiles so I think I would only need to sync the initial position and params of the cast.
You can do that super quick whit PUN2 (Photon on Unity asset store - free), but I'm biased (I work for Photon, although I'm a developer of another product: Quantum).
Other people here work with different solutions and they will have reasonable advice as well.
IMHO PUN2 would be the simplest for this use case and it will fit well.
There's enough documentation for you to get started and the support forums are very active.
do you mean this https://assetstore.unity.com/packages/tools/network/photon-pun-2-120838 ?
yes
I thought we had a free version of 2
you can get the free version of PUN classic if we don't. That would also work well for your case.
Here it is:
I have a question. 100 CCU, given that the game is 1v1, means 50 separate matches right? Not 100 people in one game ?
zes, 50 instances
CCU is total game players currently online, spread across all running matches.
The free plan is good for development and testing up to 10 matches simultaneously
the pay once is good for up to 50 matches at the same time and so on
Anything that you have to host servers would be way more expensive btw (arguably)
what networking system should i use with unity someone told me unet is gone
For peer to peer over relay, PUN2 is pretty nice. For dedicated <-> client, Mirror would probably pretty nice one to start with
PUN comes with matchmaking/lobby system hosted for you, which is really nice if networking quality and security aren't that important
I have just begun to use pun now
im working on an authoritative server and I'm not sure how I should handle user data. Should I have everything (physics, collisions, etc) be server side or are client calculations supplemented with server validations ok too?
I want to minimize server load so I can have as many players on a single instanec
typically players apply inputs locally and simulate themselves, and send inputs to server with a tick id. Player stores their sim results with that tick id.
Server once it applies that input sends out state for that tick (the sim results it got). Players compare that with their results to make sure they agree. If not you are in desync, and the client will move the object to the servers stated position/state and resimulte the inputs that followed that tick up to current.
@weak plinth
That keeps all extra work off the server, it is the clients job to get back into agreement.
Can anyone help me with Unity Transport Package?I imported it, used https://docs.unity3d.com/Packages/com.unity.transport@0.2/manual/workflow-client-server.html to try and learn how to use it.But at the part where they import everything, they do
using Unity.Networking.Transport;
but when I type that, I get an error because Networking doesn't exist?
@spice orbit Have you added the package to your project?
yes, still have the error
I made the script, then imported the package.Then when it "didn't exist" I deleted the script and made it again.The error still comes up
And what does the error say?
The type or namespace name 'Networking' does not exist in the namespace 'Unity'(are you missing an assembly reference?)
1st; Check package is actually in project, 2nd; Check you're not making any assemblies by asmdef, and have not included the reference there. 3d: Trigger a refresh of assets or restart unity.
I already checked that the package is there, I have not used any asmdef, I will try to restart Unity
am I supposed to do something with asmdef?
What do you mean?
2nd; Check you're not making any assemblies by asmdef, and have not included the reference there
sounds like you said I should include a reference in an asmdef for the script
I'm not using one, so I don't have to worry about it?
exactly
uh the moment my Unity opened now, the error is in the console
And it's the only error? can you print it here? And then maybe print your view of package manager containing unity transport?
If still not working I would try Clean library, remove content of Library-> PackageCache
And show the script you have as well.
Assets\Scripts\Server.cs(4,13):error CS0234:The type or namespace name 'Networking' does not exist in the namespace 'Unity' (are you missing an assembly reference?)
that's the error in the console
using Unity.Collections;
using Unity.Jobs;
using Unity.Networking.Transport;
public class Server : MonoBehaviour
{
// Start is called before the first frame update
void Start()
{
}
// Update is called once per frame
void Update()
{
}
}```
is the script, not much happened already ๐
oh goody I am stupid, sorry ๐ I have not imported it, I was looking at a DIFFERENT package earlier and it said that the other one was imported, and I thought that Transport is imported ๐
thx @stray scroll I would have never checked if you haven't asked for an image ๐
@jade glacier That was the answer I was hoping for. Thanks
Np
I'll ask him to talk to you tomorrow...:) He's not online on weekends
alright ty
I can't seem to get a Facepunch server instance to initialize unless connected to Steam even though it supposed to work without the Steam client ๐ค
Does anyone know why my dev would be unable to connect to PUN while running the game in Unity, but can connect fine when its being ran on his machine?
He gets stuck on "Connecting" inside Unity, but when he runs the .exe it connects fine. I have the same Unity project on my machine and can connect fine. All the PUN keys are fine on his Unity and the PUN settings.
firewall?
Hi guys, I want to get into game networking with Unity. My end goal is to make a multiplayer mobile RTS game, but I'm probably a long ways away from that. I was wondering which resource you think I should working with to put myself on that track, especially whether to use Photon or something else.
I've been looking at some youtube tutorial series on it but they're mainly FPS's and I wasn't sure how much of that sort of multiplayer would carry over to an RTS.
And also there's a surprising lack of multiplayer tutorial content on youtube
@versed cliff RTSes are made using deterministic lockstep (generally)
Introduction Hi, Iโm Glenn Fiedler and welcome to Networked Physics.
In the previous article we explored the physics simulation weโre going to network in this article series. In this article specifically, weโre going to network this physics simulation using deterministi...
Hey, anyone with PUN2 experience here. I would like to ask a quick question.
@graceful zephyr yeah I was reading about that. But where do you think I should start as a newbie to networking in general?
@versed cliff https://github.com/MFatihMAR/Awesome-Game-Networking
oh this is great
Do you think I should make my game and then worry about making it multiplayer after the fact or should I become familiar with networking practices before I do anything?
make a small simple pong game thats multiplayer
or some shit like that
taking a singleplayer game and trying to make it multiplayer is the cardinal sin of MP dev
Ok thanks
Do you have any recommendations for which resources on that page I should look at for making a pong game?
nope
Checked that list and it has almost no technical resources on deterministic predict/rollback... Interesting...
Except for two on Fighting game rollback (simple 1v1). And no mention to XWing vs Tie Fighter
@gleaming prawn
@frank thorn this doesn't look very modern
I haven't used it but it uses Entitas and LiteNetLib which I am a fan of
Literally first issue is stating that it's too slow and gets into a death spiral and author has no way to solve it
@frank thorn
sounds like a gameplay mechanic to me
Have any other unity lockstep examples?
Yes, https://www.photonengine.com/quantum @frank thorn
The revolution in multiplayer games development! Create MOBAs, brawler, RTS, fighting and sports games with the blazing fast deterministic networking engine: QUANTUM.
Well I made 80% of it so
How does that help me
Idk, but you asked for determinism in unity
Server less lockstep is a dead end
Even if you do your own, just don't waste time with client only lockstepping
And 1k a month is cheaper than a developer to write your own top notch lib over 2/3 years, but that's what it is...:)
a heads up @frank thorn, although PhysX guarantees determinism on the same machine (and these days across most cpus), ensuring a game made within Unity is deterministic can be pretty time consuming. Loads of stuff like Destroy() don't happen in the fixed timestep, so if you're planning on writing your own stuff make sure you have a robust system to check for desyncs
Thank you for the additional information.
Hey, anyone here using Forge Plugin for Networking? Need some help with Forge and master server
@frank thorn unitylockstep is outdated ๐
hey guys I'm a bit confused. I'm using PUN2 and writing my own implementation of IPunObservable and sending messages manually it works. But lets say I want a cube to move for both players. I add a Photon Transform View to it and drag it to the observable slot in the Photon View, but then when I run my test the cube movement does not sync. What am I missing ?
@untold gale check forges discord
@graceful zephyr
I have asked few question there as well. Just waiting for replies form as many people as possible
Do you guys use Input.getbuttonDown() in your games ?
i found it useful for task like jumping but its kind of hard to network it mainly because the processing is made in FixedUpdate
Im trying to implement a way to send a Input.GetButtonDown across the network but i am having a bad time with it
@graceful zephyr If you were to make a game like Fortnite today, what networking stack would you use to do it, assuming you did not have the time to write your own.
And you were using Unity
None of them can do a 100 player auth game easily, some of them don't have the perf, some of them will takelonger using the lib than doing it from scratch because the lib is so bad.
Photon Bolt is the closest (im biased ofc, as I made that originally), but it was really never made for more than ~50 players
Unity FPS Sample is a good starting point also, but you will have to tweak and optimize the code yourself for it to handle 100 players
I'd just do the game in Unreal instead ๐
So once you get past ~50 players, in general, it's time to write your own framework because you'll have to account for a lot of network optimizations unique to your product
Is the reason you'd do it Unreal because of network optimizations?
@frank thorn no because unreal has been proven to work for 100 player games (obviously: fortnite/pubg)
and i'd not bet my company on tech which hasn't been proven for the game im trying to build
or do you know of any 100 player game using unity on the scale of fortnite/pubg? cos i dont
Rust comes to mind
@frank thorn rust isn't a 100 player competitive shooter tho
and it's hardly the pinnacle of stability ๐
Lol
You have a valid point
However
I think it might be worth taking a gamble and building in Unity
Just because of DOTS
If you could get a decent networking framework going wrapped around DOTS, I think you could have as good if not better performance than Unreal
@frank thorn dots is very unstable stil
@gleaming prawn, rewinding the conversation a bit, why do you say serverless lockstep is a dead end?
I can understand for ranked games they would need some kind of validation, and P2P doesn't scale well for multiple players, but for low player counts should be fine right?
There's nothing wrong with server-less lockstep for simpler games, etc.
Maybe for a competitive title sure
https://github.com/Unity-Technologies/DOTSSample dots sample is out btw
yeah, like the fpssample, pretty hard to build on. lots of redundancy and abstractions could be removed
and the biggest problem i guess, i wouldn't mind building on a good foundation but it's not
weird pieces of code like in BeforeServerPredictionSystem where a system pretty much checks for disconnects and then calls a method that run systems that are not even systems, just functions. i would bet this could be done in less code and not as confusing
i had high hopes for a more advanced fpssample but it's not really the case
i'm getting 30ms on main thread in the editor without any safety checks. ๐ฆ
Pretty much they are showing their work in the early stages, because... they feel they have to show progress. But that early on its useless since everything made is still part of the "Let's see if we can make this even work" phase, and its going to need like 10 rounds of refactoring once its working.
And refactoring something like Unity = breaking changes constantly.
in the profiler it seems the animation package is the biggest contender for performance problems. pretty crazy when it's 1 char running around
kind of bothers me that they are not making a hybrid approach and sticking to this new workflow that they haven't figured out themselves yet. doing so many things at once is a recipe for disaster
yeah, haha, sorry i sound like an ungrateful bitch @jade glacier i'm happy they released it, it's just that the refactoring part is quite annoying because as unity dev you can't build on it. right now the default netcode sample is still the best to start
Not sure if you're meant to "build" on top of it? For me it more seems like they're trying to show off that things work together of course, and then also create smaller packages for different parts of the game.
@white apex color me... uhm, not impressed.
it's an absolute mess the code
impossible to dissect and figure out how it works
no clear examples, just a massive dump of what looks like a half baked project someone gave up on
found a nice comment in the dots sample
//@TODO: Temp hack for unite keynote to hide error
lol
xD
Thanks for the git link @stray scroll
I've found that most of the DOTS samples are a complete mess in the code
yup
Yeah, I donno, for netcode it feels like they mixed from the NetCode and FPS sample at first glance. Or if the FPS sample part is even used I donno? They have a NetworkServer.cs that seems to use the FPS network code but where Update is only called from test scripts it seems.
It feels like they're trying to do too many things at the same time here, I hope they clean it up and give some docs to it.
@stray scroll Honestly it's an absolute absolute mess, I don't get how they could release it like this, it looks like they did this:
- take fps sample
- cut out everything we want to replace with dots
- shove dots in
- duct-tape it together
=/
Yesterday i read the dotssample code for some hours to figure out what all the parts are. first of all, yes it has to be cleaned up. some parts are worse than others as some feel overengineered to me, like the ability systems or the amount of data that is required for the base character. What sucks is that there are so many classes for setting up systems and groups. I think in a composition this should be in 1-2 places for server/client but modules are all over the place which makes it weird to untangle and debug. I expected most to be found in attributes like [UpdateInGroup] and sometimes this is used but then a system in GhostPredictionSystemGroup calls a method from a world that runs those systems manually which again makes it hard to figure out what's going on or where to best put new things. I don't understand the benefit and usage of ManualComponentSystemGroup and I think all this can be intergrated in a more streamlined, elegant way.
Unity.Sample.Core seems pretty cool and useful for debugging.
Unity.Sample.Game is mostly alright unless you get to the player parts. Like, why is input sampled in HandleTime and why is there a ClientLateUpdateSystem that calls a function with ChatSystemClient as parameter? So many relics of MB behaviour makes it disjointed.
Unity.Sample.BaseCharacter seems like the best start for cleaning up.
Like, the abilities should be elegant in usage because they are an endpoint for devs and a lot of abstraction was built to get there so you'd expect to not need much code, just firing off entities with components for systems to work on. Instead the ability_rifle has 450 lines of code. They have abstracted so much but firing a projectile from a player/enemy is still hardcoded to one ability.
I was also searching for a better way to load prefabs and their WeakAssetReference and registry loading seems like a solution but then you find out it can't actually load anything and is really just a meaningless GUID split up into 4 ints. I wish they would use their own Addressables for that.
overall it's not that bad but I guess it's disappointing that it's still pretty prototype
@white apex honestly i think its pretty bad... i mean if this is supposed to be the sample of how to build a complex game in DOTS
yeah, from that perspective I agree
Why is it 1) an absolute fucking mess in terms of code organisation 2) basically cut and pasted FPS Sample with large holes cut in it
like... what is this? is this the BEST they can come up with after working on DOTS for 2-3 years?
Isn't dots supposed to give benefits in organizing code? this doesn't show that.
Isn't dots supposed to give perf benefits? this doesn't show that (it runs like dogshit...)
I just think its all very un-Unity. Not at ALL accessible to new devs in any way.
yeah, i'm with you. i'm not sure who all the coders are but some seem not good
i trust tim though
i know of 3 of them at least
I'm pretty advanced along the learning how to networking scale... and I have no desire to try to sort through that mess.
the androids netcode sample is the best unity has released imo
Also the fact that the networking seems to be? half fps frame work? half dots new netcode?
animations needs a fix, it drags the whole dotssample down
I can't speak to the quality of the code itself. I can only speak to that it shouldn't be anything be easy to use after 2 years of dev if its under the Unity banner.
@white apex turns out that literally replacing the entire engine at once isn't a good idea
๐
Unity = questionable code, but easy to use. At least to the dev world.
new engine architecture, new physics, new animation, new rendering, new netcode, new audio, new input
new particle system
new shader programming system
new visual scripting
like...
finish one fucking thing to completion please.
I feel somewhat redeemed because my initial take on the ECS announcements was "Why is this not just a new engine?"
@void burrow ninja reaction? ๐
Thought maybe I was missing something
tbh, yesterday i was at the point where I thought, why are they don't branch off from unity as it is right now.
"ninja reaction"?
unity dots or whatever
no i mean you just come in and leave a reaction without saying a word, like a ninja ๐
sneaky sneaky
Oh ๐
drive by
@white apex i'm just... i actually expected something good this time around for the dots sample ยฏ_(ใ)_/ยฏ
They could still fork Unity, but they won't
me too man ๐ i spent some time on the fpssample and built a LOT on it but it ran like shit and the architecture wasn't good. so, to find the same architecture in place is bitter for me
upside, Quantum isn't going to be facing any competitors.. maybe ever at this rate. @graceful zephyr
well, i suppose
Auch
but it feels like they are slowly killing the engine
which kills my customer base also
yeah, that is a problem
yeah
though you guys are already looking at UE ports anyway no?
we are
you are solid no matter how the wind blows
hdrp 7.1.6 fucked my project yesterday. had to revert to 7.1.5 but I couldn't so I had to manually add them in packages.manifest. everything is so cutting edge right now and buggy
If I were making a real game right now, I would likely be doing it in 2017
don't get me wrong, i think the best thing you can do right now is hybrid. using ecs for computation and unity as presentation layer
@white apex it's hard to do that even with so many missing features
Assuming your game even needs ecs
If your game is small enough to run with just standard monoBs... I would just do that
i think data oriented is the way to go, even performance aside
I don't disagree, I just have no desire to even try to learn their ECS at the moment unless I have something that begs for it
it's nice to really design in unity and things are stable and interact nice with each other
@white apex honestly i have my doubts on DOD as the main architecture for a game, it's basically unproven if it works well for large scale complex games.
well, programmers can ruin everything. i'm just saying it's better than monobehaviours
and mbs still have their place, i don't think it's wise to go fully in one direction. i see ecs as a tool
i mean MBs is not the pinnacle of engineering, don't get me wrong
but there's an inbetween land between full DOD and MBs
never go full DOD
it is, and ecs is IMO the best form to design memory layout for jobs to be actually effective. i mean, i feel stupid in retrospective but c# memory layout has fucked me over so much and I was optimizing code instead of knowing what's going on
or it's just a band-aid for a bad programming language haha
I didn't want to interrupt because you both seem really into this conversation
I really should go back to my first unity game at some point and look at the code for a laugh some time @white apex
but can someone tell me what ECS and DOD stand for real quick so I can follow along
entity component system and data oriented design
its all about aligning memory as a priority
ty ๐โโ๏ธ
sloppy OO coding can lead to all kinds of wackado cpu gymnastics when executing code
for the super non-tech explaination
totally and with MBs it's impossible unless you use managers
and even those will plateau out where you can't optimize anymore
then you try to find a good memory layout for an oop architecture that doesn't support it ... that's where most my projects stopped haha
@white apex yes ECS is good for memory layout
but you pay a hefty price for that, at least when in C#
can you eleborate? do you mean the system overhead?
And yes if you say that OOP = Mono Behaviour
Then yes 'OOP' is 'bad'
@white apex the price you pay is the fact that everything is native memory and structs, while it does wonders for memory layout and batch processing, it absolutely wrecks other parts of the architecture - you need to give up on the massive library of C# code that exists for example, and dealing with singular entities is very bad perf wise
Don't get me wrong, I do like and think that ECS is a valid pattern, and that DOD has its place. But this all-in thing where everything is going to have max performance, doesn't lend itself to actual game design.
or at least if it does or doesn't lend itself to game design, is unproven.
yeah, single entity systems overhead sucks. i don't write such
and i think noone should
i mean thats a misnomer tho
that's the hard part. finding what's best for what
what if you have a game that just have one special player entity with has TONS of unique logic?
you are going to need tons of singleton systems
for example
yeah but then you're in frankenstein land
imho
if ur gonna be mixing MBs and ECS back and forth
why not? it's all pretty readable
you have two physics engines? two ways to render things?> etc.
yes its a mess
i can see using jobs/burst to accelerate some subparts of a game thats built on MBs
so why's everyone so upset about DOTS?
maybe things are easier for me because i don't use their rendering and physics
sure, absolutely
@white apex what are you doing ? :p
@wind ruin upset is the wrong word, more ... just... sigh
"I'm not mad, I'm just disappointed"
just,... tired of it
all we hear is DOTS DOTS DOTS from unity side, but nothing is finished, everything is broken and buggy and the sample released a day ago is a mess, etc.
right now it's "just" a FPS, mechanically it's similar to risk of rain 2
multiplayer, many projectiles and enemies
ah
I feel like all other samples then DOTS and FPS have been good shrugs
but i've done other projects too, not much genres I haven't been lol
i like building things from scratch as much as possible. for anyone else I don't know how the transition to dots should even work. even most graphic assets are broken with urp/hdrp
Well from what little I can find out about it, it's supposed to optimize memory R/W but most of the engine's components don't work when using it?
At least not without a bunch of extra work
I'm curious as to why you would use an engine at all if you're building your own versions of its most basic features from scratch though
i meant, i'm building from scratch as much as possible so i'm not using store assets. i'm not replacing basic engine features
in that regard, i think unity5 rendering/physics is good enough for any moderate project and having ecs run on anything that's supposed to be batch processed is a win in both cases because it doesn't overcomplicate things and you also stay away from the cutting edge (buggy) stuff
most systems I write are for game mechanics because I agree, build games not engines. sometimes I feel we are still in the "build an engine" phase ^^
I definitely misunderstood you
Wait no
you said you don't use their rendering or physics
oh sorry, i meant the new ones
isn't that wildly redundant
Unless unity's physics system is bad enough to significantly affect performance
my bad unity projects have bottlenecks in simulation code and not in rendering/physics
you have to do a lot to get unity5 to choke
most games won't but still have a complicated simulation
factorio is one of the better examples.
it's not possible in unity5 + mbs but in unity5 + ecs
of course it's even better with dots rendering and dots physics
but that's for the programmer to decide because one way is a lot harder
I'm still a little confused about why you don't use unity's physics though
to be clear, you mean the new physics package? tbh, because I don't want to integrate it yet. Last time I used it I had constant crashes and random errors. It's just not stable enough. Default physics/havok is though
I was just starting to read about ECS/DOD/DOTS when you said "I guess it's easier for me because I don't use their physics or rendering"
so I thought you meant you used your own physics and rendering systems that you wrote from scratch
so I thought you were some kind of maniac
lol, i'm not that mad ๐
why still use Unity 5 though?
i don't, actually 2019.3 i'm just calling the default render pipeline unity5
i know this stuff is confusing
on top we have urp/hdrp with default rendering and hybrid renderer for the most optimization
and no proper names for it
I'm basically brand new to Unity but have a bit of a programming background.. Unfortunately I've only just come back to this side of the internet since around 2010
Done a few things here and there, but even OOP wasn't that common when I was fresh and up-to-date on everything
So it's a little concerning to hear that unity isn't all that well-optimized and that their flagship solution is a wreck
well, the negatives aside, it's a good time to start learning unity. a lot has changed in the last 3 years so be aware that 2 things exist for 1 thing. that's confusing at first but okay once you get the hang of it
it's mostly a wreck because the dots animation package is not done and takes too much cpu
roughly said, yeah
pretty much everything that exists in unity gets a dots counterpart
from animations, physics, rendering, audio, etc...
What sort of problems have you run into that you were hoping dots would help with?
Yeah, I get it. I can just ignore dots until it's something I can actually benefit from though.. I hope
many things actually, faster simulation code, proper barriers between designer/code data, avoid spaghetti code, avoid refactoring, interaction between game mechanics/systems, extendibility. you can get those right now IMO
oh cool
but then you still need MB for things that dont work
do dots and MB play nice together?
things that dont work are actually very specific
assetstore assets ^^
for example, I can't bring the kinematic character controller in ecs
it would take a long time to port this code to have cool movement out of the box
so, instead of porting, i use a gameobject for the player which is directly linked to an entity
there is another MB on the player, like the weaponmanager which creates entities with components when i shoot a pistol or shotgun
i talked with @graceful zephyr about this. systems that only work on one entity like the player are useless right now as they have too much overhead
so you need to use MB for anything your bullet is supposed to collide with
I am not looking forward to people complaining about my asset not working for their ECS stuff. I am going to have to be very clear in store description.
only for my player because it relies on the KCM asset. bullets can be built without colliders and raycasts instead
what do you want to make? genre like?
it is already difficult at times to find a tutorial on something that doesn't seem to be done terribly
I'm just making simple 2D games for now to learn the engine
most tutorials are horrible. they are the reason why dots exists in the first place. unity just doesn't scale when the same code is executed on 100s of gameobjects
@white apex eh... you're under the impression that things will be better with ecs/dots.
eventually I will learn to make games in 3D, but I have no long-term specific game in mind at this point
true but that's on us ๐
For example, last night I was trying to get an idea of how procedural level generation is done and how I could make it not seem repetitive
I found a youtube tutorial on it that was part of a series on making a spelunky clone
Around the halfway point of the first video (of 3 I think), I started to feel really bad for the people who followed this tutorial without knowing better because the guy did some seriously dumb shit
lol
you can find good resources in forums and repositories
but it's all "hidden" quite well
I watched the rest of the series and learned what I wanted to learn
but there's all these youtubers and what not teaching people to use garbage code and no one there to set them straight
it's why we have 100s of people in this server a day who ask "why dont this work" who haven't even read the error message
public GameObject[] rooms; // index 0 --> closed, index 1 --> LR, index 2 --> LRB, index 3 --> LRT, index 4 --> LRBT
//populate array stuff snipped
int direction = Random.Range(1,6);
if (direction == 1 || direction == 2)
{ // Move right !
if (transform.position.x < 25)
{
downCounter = 0;
Vector2 pos = new Vector2(transform.position.x + moveIncrement, transform.position.y);
transform.position = pos;
int randRoom = Random.Range(1, 4);
Instantiate(rooms[randRoom], transform.position, Quaternion.identity);
// Makes sure the level generator doesn't move left !
direction = Random.Range(1, 6);
if (direction == 3)
{
direction = 1;
}
else if (direction == 4)
{
direction = 5;
}
}
else {
direction = 5;
}
}```
that's how his final code decides which side of the room the next room should be placed (a third of it, anyway. theres another block for direction == 3 | 4 and one for direction == 5)
anyway I'm just not looking forward to seeing that kinda stuff for dots :/
easy answer, then don't ๐ i wouldn't either
i guess this code only runs once anyway on init level
nah I snipped a bunch out just to show the bad part
i'm done ranting now ๐คทโโ๏ธ
I have a mouse interaction script that gets the current highlighted asset, and invokes a predefined unity event on it to the main character.
{
if (Input.GetKey(KeyCode.F))
{
PlayerController.CallInvokeAction(newObject);
}
return;
}```
which calls ``` public void CallInvokeAction(GameObject gameObject)
{
CmdInvokeTargetAction(gameObject);
}
}``` in my TPS controller, which in turn calls ```[Command]
private void CmdInvokeTargetAction(GameObject newObject)
{
newObject.GetComponent<NetworkIdentity>().AssignClientAuthority(connectionToClient);
newObject.GetComponent<InteractionActions>().InteractionAction.Invoke();
}``` on the server. However, i"m sitll getting that pesky 'trying to send command for object without authority' error. Any idea what I'm doing wrong?
the script with that Command HAS to be on the object you spawn as the Player
its a major limitation of unet/mirror you learn to work around
At a glance you are trying as a player to command an object... to become your object. But command can only be called on an object that is yours.
So the answer is don't use command, use a MessageBase message, or a NetworkWriter message and send that... OR run all of that through your player object
@latent pendant
ahhh yes. that's exactly what i was trying to do. that seems very... odd. i'll try the mehtod you suggested. thanks!
here i was thinking that unet isn't ALL that bad with what people say about it, but now I get what the big fuss is.
@latent pendant You said the TPS controller has the command - isn't that on your player object?
yup
then that should work
but it's trying to interact with a different object
at least it does in Mirror
no, my TPS is trying to invoke a unityevent on another object
I'm confused then.
you have player object [P] and networked object [O] in scene. O has the click script that calls the TPS on P where the Command script is. true or false?
false
ok, clear it up for me?
P calls a Command script in P, that tries to invoke a unity event in O.
which, i've just learned, doesn't work. ๐
This is valid
P calls a Command script in P
[Command]
private void CmdInvokeTargetAction(GameObject newObject)
{
newObject.GetComponent<NetworkIdentity>().AssignClientAuthority(connectionToClient);
newObject.GetComponent<InteractionActions>().InteractionAction.Invoke();
}
right, but when in calls .Invoke on the GO, it gives that authority error.
Where is this code?
if (DoesGoHaveValidInteractions(newObject))
{
if (Input.GetKey(KeyCode.F))
PlayerController.CallInvokeAction(newObject);
return;
}
on the TPS controller
Is TPS controller on the player?
yes
and what is PlayerController in there?
in there?
in that last code snip
i'm sorry, i was mistaken
that code snippet is on a camera controller
that has a reference to the TPS controller
thats what PlayerController is
and this is in the TPS controller then?
public void CallInvokeAction(GameObject gameObject)
{
CmdInvokeTargetAction(gameObject);
}
correct
the camera script is getting newObject as something it's aiming at I guess?
yes, the GO under the cursor
in the controller?
it works all the way up to the server, until i try to invoke it
the Command that is.
it does and I think I know why - humor me
is on the camera - which has a PlayerController field with a ref to your TPS - how is that ref being set?
Application.Quit(); put this on awake method and u r good to go
@latent pendant is the camera a child of the player prefab?
no, instantiated client side only
which probably breaks your reference.
works completely clientside
the player GO does get the right functions called, but it's still the authority that's the problem
clear that assignment and grab camera.main from OnStartLocalPlayer and set the reference there. My guess is that every player object has that reference and it's going through the wrong player object
my apologies Camera.main.GetComponent<InteractionDetection>().PlayerController = this; this is currently in TPS Start
should I put it in OnStartLocal?
OnStartLocalPlayer
otherwise you're reassigning it for every player object on both the server and all clients
{
if (!isLocalPlayer)
return;
spawnedCamera = Instantiate(CameraToSpawn);
// get the transform of the main camera
if (spawnedCamera != null)
{
m_Cam = spawnedCamera.transform;
spawnedCamera.GetComponent<FreeLookCam>().m_Target = transform;
Camera.main.GetComponent<InteractionDetection>().PlayerController = this;```
that's what i had
isLocalPlayer isn't valid in Start in UNet (it is in Mirror)
i'm using Mirror. ๐
then why are you asking in this discord?
fair point, but because it was an authority question.
since mirror is a drop in replacement, i just came here. my bad. ๐
you said
4:49 PM] floppy pancakes: here i was thinking that unet isn't ALL that bad with what people say about it, but now I get what the big fuss is.
I know. I forget sometimes. it's my bad
I'll find their discord and ask over there.
Thanks for your help. ๐
There are differences, I've been going along thinking you were in UNet all this time ๐
My apologies. haha
sending by PM because this discord blocks links to other discord servers for some inexplicable reason
For the development of a competitive FPS multiplayer game, what setup would you recommend with Unity?
Photon, FPS Sample or else?
Looking for low latency.
Low latency = LAN games...just sayin' No network package can change the nature of the internet. Players either have a good connection to your server or they don't. Having regional servers in high quality backbone facilities might help a little, but your choice of network package really won't make any substantial difference.
@weak plinth use unreal, it's literally been built for this over two decades.
replied to an old message, sorry didn't realize
Yeah, no thx.
UE4 is great as a generic AAA game engine, but it's not great for competitive multiplayer FPS games specifically.
Unless it only works flawlessly on current High End PCs.
Significant amount of input lag.
Significant amount of stuttering when playing Online.
Even if the graphics look like Quake 3 Arena
HELP: i am trying to get the creation time of a webserver file but i cant seem to find anythign that can help me.
DateTime webFile = File.GetCreationTime(baseAddr + file);
this combines the root directory "baseAddr" with the file name "file" used in a foreach loop to compare if a file on the local machine is older than one on the websevrer and update accordingly
ok, sorry for asking for a spoonfed question, i pretty know many of aspect for unity, but one thing i havent done successfully before is networking (it was photon back in 2015 iirc)
so Im here would like some tips / starting point on where i can go to start this thing
I need a way to communicate between a server (windows pc) and ipad over wifi
it will be built on different project because the PC will be using HDRP while ipad will be solely using standard / urp / lwrp
and ipad will be able to send command to pc do various fancy stuff
it doesnt have to realtime and not that time sensitive (although low latency would be prefer)
ipad and pc server doesnt have to be connected all the time, it is just for some e-kiosk.
imagine playing wii u on large tv. except input will be touchscreen on ipad instead.
any tips & links appreciated
If its lan and you aren't making a real competitive game, you might want to just use Mirror or MLAPI
Neither will really put you down a path for tick based sims and such, but that layer of networking may not be of much value if you are just cosmetically syncing things.
read this earlier bit, now i understand a bit more.
https://blogs.unity3d.com/2019/06/13/navigating-unitys-multiplayer-netcode-transition/
although im curious what would be easiest way for me to test it.
my office pc doesnt have wireless and i dunno if i need to setup router or something
so i assume a pc version running concurrent with web version is good enough to test those.
Hi, I started recently with unity and my first (own) game. I planned to add LAN- and P2P-Multiplayer (direct connect via internet for more than 2 player). Now I have read that the UNET service is deprecated .... ... is the following solution available? What might be the best way to follow for multiplayer? ... ( it's a racing game)
You will want to completely back up from your game, and go make tutorial projects for like PUN2 and Mirror to even get familiar with the landscape of networking HLAPIs, then from there decide if you need to use a LLAPI/Transport and how you want to host your game type based on its requirements.
But you won't be able to even think about those things until you have made like Pong with a HLAPI to understand the challenges involved in networking, and the language used to describe them.
The authority model you choose will shorten to list of networking options.
ok. thank you! I'll take a look at PUN2 and Mirror
If you decide from that that you want proper server authority, Photon Bolt is another to do some tutorials for. @weak vessel
Being the only option out there with a full stack for server authority. It does however come with a lot of caveats, so you really want to understand most of the complexities of networking before deciding anything.
will build-in servers be included in the future? For my application dedicated servers won't be needed ...
has the namespace using UnityEngine.Networking been deprecated? unity cannot find it in my game
it has, quite a while ago
On unity unet deprecation faq it shows a timeline of unet support until 2022
does "support" for the hlapi mean that unity will keep the api updated and stable?
And ive read about the new network framework but im still confused wether the matchmaking service its payed or not?
Just saw price comparisons for photon vs unet and concluded to go to photon
Is Unity still proving those services? I assumed not but I guess they may still be.
Haven't looked in ages, I just assumed it was shut down by now, but I guess they really can't do that without something to replace it and games relying on it.
@graceful zephyr
@burnt axle Unity are keeping UNET available for a while yet... it's not being updated, and I wouldn't call it stable
Yeah I wouldn't touch unet with a 10 foot pole
Hi! I'm a bit confused and was hoping someone could help me out, I was looking at PUN 2. Now from my understanding the system is basically that all clients can talk to each other through multiple servers, so no 'main master'. However I see games showcased on the PUN website which use authoritative systems. For example the game Robocraft. How do those games do this if there is no main master, what am I missing here? ๐
Ive managed to set up the local connection fine with UNET, but the matchmaking services has uncertainty regarding its namespaces so id just rather avoid the whole thing and build with photon instead
@thom Checked out this? https://doc.photonengine.com/en-us/pun/current/reference/pun-vs-bolt
Photon Unity Networking framework for realtime multiplayer games and applications with no punchthrough issues. Export to all Unity supported platforms, no matter what Unity license you have!
Yes, I took a look at that. But it still brings up questions as how the game I mentioned uses PUN, which makes me think my understanding of PUN is just in general wrong.
Im not gonna say to much as im just learning the differences myself. What i understand this far is that PUN uses some of the old unity ways of networking and BOLT has its own way where you use alot of their components and such to sync varios data and states.
PUN allows for server plugins that let you give the relay some logic is likely what you are seeing
that and there is a Master that is given loose authority.Basically the first client to join a room is given the Master baton. If that player leaves the game another is selected and so on. @void burrow
Bolt uses its own codegen, physics, input system and controllers to create classical CS:GO style server auth.
Ah, so instead of it being full authoritative it has some simple checks. That does explain why they severely used client side anti-cheats and why there were hacks I had not seen in any other game xd
Thanks for the answer ^^
yeah, because of the extra hops to the master, and it not being the hub of traffic, you wouldn't want to do full server auth with PUN2 without a server plugin
but it is good for making a final word on some things
Which was for them a really bad choice, since it was a pretty competitive game ๐ค
yeah, they should have just used Photon Server really and coded more of that themselves
Or made the required plug ins
or... just used Bolt and dealt with the restrictions that come from having to use its systems
Maybe that they did in the mean time, I haven't played it for a while. But back in the days you had hacks which would make you impossible to kill xd
They were likely just new to networking and PUN2 got them working code fast... and they didn't expect the success?
No clue, never talked to their developers. I just saw it on the PUN website ๐
I am making an entire PUN2 component system for Exit right now, so I'm dancing around those restrictions right now.
A question about PUN2, you said earlier on that one of the clients is given more authority, let's call it the 'master client'. Does it know that it's assigned that roll?
And do others know that as well, or shouldn't it be used like that?
yeah, everyone knows who the master is
and it has the IsMasterClient check
I forget off the top of my head the check on others, but they all know which actor is the master
So all by all PUN2 is more fitted for games in which you don't really need authoritative servers but rather play with friends for example.
Let me rephrase that, isn't fitted for competitive gameplay. But rather for the opposite of that.
I make use of the master very little for my PUN2 work, and just assume that my assets for it will NOT be used for large scale competitive games. Trying to code in anticheats is tricky using just the master. By tricky I mean they will tax that players machine with a lot of rewind checks, and result it high latency corrections
So my intention is to eventually get with Tobi about creating some generic server plugins that create some universal relay owned objects that can be semi-intelligent
Sounds to me like you could better use bolt in that case, or am I seeing that wrong xD
I am not making a game, I am working for Exit to extend PUN2 with components
I should be releasing the first beta for it within a month. Basically its drop in components that are all properly tick based and work together for things like hitscans, projectiles, item that can be picked up, dropped, thrown, health and energy systems, powerup pickups and such.
So its all specifically about making PUN2 super easy to make stuff with, not so much about trying to make the perfect networking system, since Quantum and Bolt already have the serious server auth and deterministic sides of things covered.
Components are the relay sided plugins you are talking about right?
nope, MonoBs
lots of components like that
The relay owned object stuff is more just a conversation at this point
Ah alright
But those things are owned by the master client I assume?
If so, wouldnโt that have a decent amount of lag when picking up items as an example?
nope, its all just based on client authority
the pickup right now is a little extra latency for the first grab
I have the default for that being that ownership is given to the person grabbing it
but that is the big area where relay owned objects would come in handy later
for that reason. I will likely though work in prediction for grabs
and it will reconcile out if the master says someone else got it first
But can you still call it a relay if youโre basically making it a server?
But if you make it smart then whatโs the point in not using Bolt?
Bolt answers other bigger issues with server auth
server auth requires a tightly controlled simulation
you don't just "server auth" and finished
the whole system requires a simulation, which requires standardized inputs and controller code
Bolt code gens its own controllers, input structs and physics
which is what makes it a bit restrictive to work with, but its what allows for things like shot rewind and resimulation
It was made in like Unity 4, LONG before the new physx changes in 2018.3 that allow for networking to play nice with PhysX
thus why fholm had to make his own physics and controller system for it
I think I donโt have enough experience yet too really understand this xd
few people do, nor really want to. Its why better HLAPI tools are needed.
Just wanted to say thanks for the help btw! Iโm going to try to mess around with PUN2 for a little while. โค๏ธ
If you want in on the beta it works along side standard PUN2
unmuted for the sin of pasting a discord link now?
yay.
Im a little confused regarding the dedicated server part for photon. Do photon only provide the networking api for unity or do they also let you run games on their servers (matchmaking) as well?
On the bolt faq it clearly states that you need to take care of the server yourself but they also have a "server" service: https://www.photonengine.com/en/server which im a little confused actually is
Redistributable cross platform multiplayer game backend for realtime games and applications. Develop authoritative logic with SDKs for android, iOS, .NET., Mac OS, Unity 3D, Windows, Unreal Engine, HTML5 and others.
@burnt axle different products for different uses
Anyone have an idea why client.DownloadFile(url, path) doesnโt seem to ever want to download a .mdb file extension?
Only files that are downloading in the loop that get a 403 forbidden error
webserver doesn't have that extension in it's list of allowed files, thinks it's a database?
Btw are there any official solutions for unet deprecating yet
I cant be bothered learning how to photon yet
Unity is working on a solution, but if Iโm not mistaken itโs not production ready yet.
@void burrow that'd be an understatement
xd
I donโt really have the right to say something about it when I can barely my self do networking ๐
All I made was this with PUN2
https://www.youtube.com/watch?v=IsS6krcMc_I
maybe im missing something, but do photon provide servers/cloud or just the networking api?
I'm using PUN2 and they provide the servers. (The relay in this case).
Not sure how that's for quantum & bolt though
They use the same servers
Bolt may still allow other forms of hosting
but Quantum's ability to do determism without lockstep is based on the relay being the final word on user inputs
Photon provides the APIs as a way to get people to commit to using their servers
Quantum being the outlier for them, since they also charge for the API access as well.
The details I don't know, but that is the big picture
Ok so they give you both servers and apis
i tried to use MLAPI, managed to do simple stuff like start server / host / client
and call a method from client on the server
however i having hard time trying to find best to test this connection,
so far i have success via hardcoding my pc ip
issue happen when i tried to test on my phone itself
i succeed on
- using same pc (edtior + exe)
- using different pc on same lan network (editor + exe)
- using emulator + pc (editor + emulator)
however since i dont have solution for wifi yet
so i thought i can use tether connection
but despite using the number listed on ipconfig, it cant connect from my phone to my pc
any reason why?
and can i work with something like usb wifi + my phone via hotspot or something?
Sup guys, just uploaded my piece of code for an MMO game I'm working on right now.
It's just a beggining and contain a bit of mess but it may help someone struggling with base packets handling setup.
(Networking library is ENet)
https://github.com/Devdood/enet-mmorpg-server
Still missing quadtree setup and other meaningful stuff but should be a good start point ๐
@paper stone quadtree?
@graceful zephyr Spatial Partitioning for server entities grouping. Just to take performance load from iterations when looking for other entities around etc.
hey, i am starting a new project. its a real time strategy game
and i was wondering which netwroking solution is best to use here.
i already made another game using u net but I kept running into delay issues which is why i would like to avoid it
but I am a complete beginner to everything else so i need something that is simple to learn and also should be up to date
can anybody help me ?
Hi,
I can't really understand the pricing of photon. I if I subscribephoton server, I will get a server in the cloud
Good book or video tutorial to read to start networking?
Then maybe do some simple game like pong or three in row with sockets. And then try out the different 3d party solutions.
@deft thunder Not sure if best place to ask pricing of 3d party solution, but you should link to the model you're asking for. If you're talking about "Self-hosted Server" as indicated in name, you don't get a server in cloud, but for "multiplayer: Realtime" you do.
@fading apex Maybe explain what delay issues you're talking about? If you're complete beginner, look at my previous answer to Terror.Claw. Also explain a bit what your game entails, how many players, individual units alive at same time etc?
Thank you
@stray scroll
For example in my previous game the player could move a gun barrel wherever his mouse cursor moved.
If one player changed the direction of the barrel it took like half a second for the barrel to change from the other players view. This meant that when player 1 shoots and moves at the same time that the bullet und both players views did not lign up. They went in complete different directions. I tried as hard as I could but I did could not fix it without getting extreme jittering in the barrel movement
@fading apex And you tried this on two built versions on two computers on the same network? Ofc if bullet or spawn of bullet is not synced it might not be in same place by packet delay.
UNet is deprecated, and will be removed from Unity in the future. A new system is under development. For more information and next steps see this blog post and the FAQ., does it mean that I can't work on multiplayer aspects right now?
You still can, just with other solutions ๐
@fading apex deterministic lockstep is the way to go for RTS
@graceful zephyr ok thx for the tip
@stray scroll yes i tried it on the same network and it kind of broke me XD i gave up on the project because of this reoccuring problem
@fading apex There isn't really much of an option, deterministic lockstep is the way to go
ok thx i will look into that
im trying to check in which team the player is so he spawns with the right player model, but its not working, this is my code
{
GameObject go = PhotonNetwork.Instantiate(Gamehandler.Player.name, Gamehandler.TDMSpawns[Random.Range(0, Gamehandler.TDMSpawns.Count)].position, Quaternion.identity, 0);
go.name = StaticUserProperties.Username + go.GetComponent<PhotonView>().owner.ID.ToString();
Gamehandler.gameObject.GetPhotonView().RPC("AddPlayer", PhotonTargets.All, new object[] { go.name });
}```
this is happening well after the teams will have been set?
yes @jade glacier
Is PunTeams.Team part of the PUN2 api, or is that your type?
sorry if this not a correct place, but is it possible to do remote control via bluetooth + unity app on phone that control the app running on a pc?
assuming both device have bluetooth connectivity capability of course
@jade glacier it's part of pun2
I am only partially familiar with the handlers in PUN, but this seems a bit odd?
Gamehandler.gameObject.GetPhotonView().RPC("AddPlayer", PhotonTargets.All, new object[] { go.name });
You are passing it a null object array?
Which part is failing? are you getting the correct team value?
@copper wadi
i think i'm not actually checking which team the player is in so the if statement fails and the player is not getting spawned @jade glacier
I'm trying to make car crash physics over a network (Mirror) - rigidbodies and networking don't mix, but how would you all approach this?
One of the developers from Rocket League had a talk about how their vehicles work with networking and physics. Which may or may not help you get somewhere :D
https://www.gdcvault.com/play/1024972/It-IS-Rocket-Science-The
worth a shot. I appreciate it
it also boils down on what kind of results you find acceptable
determinism with built-in physx is kinda lost whenever you move rigidbodies around manually
also this totally depends on the networking model
if you do client auth, just let each player sim their own collisions
on server auth, the best thing one could do is to figure out a point in time where you know both colliding players got the same data and then predict their trajectories from that and use that same data for both sides on collision resolving
all in all, usually people just hack these things
as it's impossible thing to get 100% perfect due to ping
here's one gdc talk about client auth vehicle physics: https://www.youtube.com/watch?v=_8A2gzRrWLk
In this 2017 GDC session, Ubisoft Toronto's Matt Delbosc explores the techniques used in Watch Dogs 2 to replicate vehicle trajectories, compensate for network latency, and realistically represent vehicle-versus-vehicle collisions between players.
Register for GDC: https://u...
(that RL talk is in youtube as well)
well I'm looking for at least some sort of real feel during a collision (e.g., if somebody is hit on their front right side, I expect the vehicle to pivot as it would in real life). Not worried about the damage aspect of it, I have those set up via syncvar hooks - but are connected via OnCollision. The wheel colliders do use RBs, but if I have to rework that aspect to ditch the RBs, I will. Right now the RBs just don't look right while moving and when they collide, it becomes a total mess real quick
I can imagine
replicating networked physics is one of the hardest things to do well as it's always a quite custom solution for your application
did WD2 have an online aspect to it?
they had 4 player co-op mode
afaik anyway
I'd really recommend going client auth if you can
it'll make things so much easier
(unless it's designed as some sort of e-sports where cheating could be a real issue)
well I have it set up so each playerprefab has local authority...and enable their own scripts including the OnCollisions...you're saying keep the OnCollisions all client-side? Or are you referring to something lower level than that?
I saw forum posts about how making your own physics occur in Unity isn't that hard to do..yet I have found no good examples of anybody actually doing it