#archived-networking
1 messages Β· Page 65 of 1
You mean GGPO?
GGPO is just 5% of what you'd need, and I'd argue that GGPO is not the way to go for an RTS, because it's not a 1v1 kind of game
And also it is predict/rollback, you need lockstep
First:
a) write a deterministic simulation (forget all unity libraries like navmesh, physics - these are useless for these kinds of game);
- you need to write a flow-field/influence-map path finder
- use fixed point numbers (Q48.16, Q5.3, etc etc), so you are cross-platform determinsitic
b) server in determinism is only used to batch and manage input distribution between the clients, and serve as a source for clock sync (hardware clocks drift), so you keep everybody on the same timing;
c) THAT is if you really want to do an RTS (and not other kind of game).
The number of units the game will handle has NOTHING to do with netcode when you use lockstep in particular... it has to do with how efficient your simulation code is...
But it should be no problem writing a game with 10.000+ units...
I'm currently working on a game with 10k+ zombies + 8 physics-based cars at 30Hz in full predict/rollback mode (not lockstep)...
But again, it really depends on your experience.
disclaimer: I work at exit games, and I'm a game engine guy, part of the team who writes Photon Quantum (deterministic game engine).
Thanks this question gave some nice insights on RTS networking.... Another thing how RAM and CPU side of game going to be handled? 10000+ units is pretty heavy you know. Also how much input delay is there in the determinism model?
predict/rollback is 0-delay...
lockstep is a tradeof
you add input delay proportional to your ping
IF you have the server to mediate things (that's what we have)
so players on good ping can have very very small delay (in lockstep... in predict/rollback it's 0)
How map generation sides of things gonna be handled?
For static objects that'll be loaded first ofc
If you do procedural generation, just define a seed (from server?) an generate locally on both machines using a deterministic approach...:)
The seed will give you the randomness factor
Remember that if you want to do an RTS you need your own "physics" and path finding anyway, so it's all custom
Forget the naive Unity default stuff, that won't cut for a proper RTS
If you just want to create a toy game, for hobby, and you accept things to be a bit "crappy", and you are ok with a low unit-count (in the hundreds), so maybe a normal state transfer would be ok-ish
But if you really want to do a proper RTS, start by studying how real RTS are done
Fixed Point number implementations in C# are public domain, you find several
just search stack overflow...
But finding stuff like flow field path finding is another story... You find good guides on the topic
But don't expect to find (a lot of) free libraries for this (at least not for everything - you might find a few useful things here and there)
This is the project that I am working for.
Tried RTS in unity
but soon realized it's not just worth it.
AFAIK AoE is deterministic
About pathfinding custom made navmesh is better or A*?
Unity as a rendering engine is excellent
Forget navmesh
RTSs use Flow Fields
navmesh will NOT work for an RTS... It's not a problem with Unity's navmesh... You need a flow field...:)
A* is a search algorithm (a specialized Dijkstra). It is used internally in many navmesh path-finders in one form or another... Flow field uses a regular Dijkstra search AFAIK.
So the question is not to A* or not, but actually what you need as PF data structures and algorithms... Forget pre-done libraries...:)
Also notice that Unreal is NOT deterministic either... So Unity is not at all BAD... It's just that RTS are a different Beast, really...
You can do RTS with any engine, you just throw away their default libraries (for physics and PF, etc) and use just the rendering, asset pipeline/tooling and build-runtime capabilities (which is not a small help, it's great)
RTS do NOT use regular physics engines as well..
So you won't see an RTS using bullet, havok or PhysX... They use custom simplified/super-cheap collision detections, otherwise it would not scale to 1000+ units...
Think we won't be using those. We have to make ourselves.
Yes
That's the only way IMHO.
You are not trying something easy TBH
IMHO this is not a good starting project if you are not experienced in game networking
Definitely not good as a first project at all
We have small team working on
currently working on converter side
soon will switch to unit testing
to make the converter compatible with what we are doing
I have 14 years game programming experience, and I would NOT do an RTS unless I had a very good team with me...
And making an EMULATOR for an existing older game is even more difficult
We are deciding which approach will be best.
RTS you need lockstepping, pretty much 100% that
unless, as I said, you are ok with a sub-par implementation to hold just a few hundred units in LAN environments
That's as much as I can say.
goal isn't as same as the way AoE genie engine works
File loading and all stuffs are handled differently
Also you know you are in a legal gray area (if not 100% ilegal), so you won't even be able to use tools like ours.
because we can't support that.
Anyway... Try to search these keywords:
- float field or influence maps
This will be a good way to start on path finding for RTs
and go straight to a FixedPoint number implementation
project is similar to this
btw, navmesh accesses less array indexes or what?
compared to flow field?
so far what I know is flow field does BFS search over the map
then get direction out of it
ideal for lots of unit on one target
but not so much for multiple target
A* becomes viable at that time
If navmesh is done right then it should give faster and more smooth pathfinding or what?
btw, navmesh accesses less array indexes or what?
This is only useful for low unit count, individual targets
You should start finding that yourself, where the tradeof lies... You'll MAYBE need both approaches
Don't start hanging to use Unity's navmesh though (just because it's easier for you). It has a major problem:
- it is NOT determinsitic, so youΓre done (you can implement a custom navmesh path finder for individual units);
In the end you might need both Flow Field (much much more efficient for group path finding) AND individual path finding (over the same data structures you build for your flow field)
It will be cheaper and simpler to build a Dijkstra for flow fields + a tile-based A* for invidual Units
Unity's navmeh would be useless, as I said...
Need to work here... That's as much as I can say... Start by understanding that you need determinism, so unless a library is guaranteed to be cross-platform deterministic, forget about it...:) This will save you weeks/months of unnecessary headaches (that's my hint)
Custom navmesh algorithm can work? Having control over grid and terrains?
I would personally do what I said above:
- both flow fields and individual cached paths (using A*) over custom tile-data
Navmesh != tile based
If you implement a tile for flow fields, it's just much easier to just use the same data for A*
currently plan is combined solution of A* and Flowfield ofc.
There's no point in implementing a complete navmesh (which is a different approach, and will be useless for the FF)
Navmesh can be cheaper IF done right (for the individual paths)
But a hierarchical tile structure can do the same in the end
I'd do hierarchical tile-based... Would not touch navmesh
Need to leave now... Good luck with the project...
Hardest side of navmesh is determining polygons and vertices?
you can answer later if wanna
Don't have anything else to say
It's just that it looks a waste having to code two data structures, where one would do
I'd not START with navmesh at all
First use something that solves both... Later add in an alternative
Navmesh is NOT the first for an RTS..
Remember that in either case you'll need to code from scratch
thanks you for helping.
Anyone here with experience/recommendations for different networking engines for turn based games with only discrete game states? I assume some corners can be cut when latency at around 1s is acceptable
you shouldn't be seeing 1 second of latency unless your transport is like yahoo mail LOL
What do you actually need from your engine? Because what you likely just need is a cloud service.
Some kind of matching and persistent game state, so an external service would probably be smart
I don't have enough experience to tell you which on would be good/bad - but most of them should have some tutorials for dealing with games - especially turn based games.
Ideally I would think you would want one that can run C# scripts? So that your Unity versions and the cloud server can run the same simulation code and share your library.
but.. way out of my wheelhouse - so I would take anything I say with a grain of salt.
I'm on a similar boat, why I was looking for opinions on technology. But thanks a bunch anyway
Running similar code would be preferable
gonna ask my question again...
Do I need both netcode and transport or just one? are they both different models?
Going from the documentation if i wanted dedicated host / server authoritative I would want netcode or am i misreading the doc?
I don't know what cloud options like AWS give you for being able to play around with them for free, but would be good if you can to just make a quick sample tick tack toe game in a couple of the options just to see the workflow and api documentation. @pastel linden
Huh haven't seen much mention of AWS for unity, mostly photon and such. Wonder what strengths and weaknesses are between these
Photon isn't going to do any of the database type stuff, its more for relaying messages between realtime games. It can be used for turn based, but I think its largely the wrong tool for the job depending on how much meta data you need to save pre-post game and such.
@vernal remnant If you simply check the dependency of the NetCode in the package manage, you'll see that DOTS NetCode is dependent on the Transport package.
If I'm not mistaken, the Transport package basically contains socket wrapping code, which handles the connection.
I've noticed that trying to freshly import a project which depends on netcode is a real pain (unless I'm doing something wrong here). The problems that I'm having are that
-Unity won't compile certain components (treating them like missing scripts on my prefabs), like a PlayerId component for example, unless I fix all compiler errors
-I can't "Generate Code" on my ghost prefabs because those components are "missing" (not compiled)
-I have systems in my project which make use of those generated ghosts/collections (to actually make use of netcode in meaningful ways), so clearing out my generated code so that PlayerId can finally compile means that those systems are now throwing errors & PlayerId still can't compile, meaning I still cannot generate new code for my ghost prefabs or collections.
This feels so cyclic. Am I missing something here to make this less ridiculous?
It is all preview, so you are playing with bleeding edge stuff there.
bleeding a lot...:)
I mean the only way I can think of getting this to work is commenting out all the netcode bits in my systems (which is alot), clearing all genrated code away, allowing it to compile the data components, generate the collection code, then going back to uncomment all the code I commented out (inevitably, with enough code I'll forget to uncomment something somewhere)
Maybe there's some solution to this with asmdefs, partial classes, or something else
Good evening first I want to clarify that I am French and that I have trouble understanding and making myself understood
I will try to describe my example and my problem in the best possible way
so to start in my example:
1 The client requests a connection to the server
2 the server responds accepted or not, if yes the server generates 2 variable which and the position and rotation then send it back to the client
3 the client receives and appears the chosen one the server
So far so good
4 the client sends the input to the server
5 the server processes the input and changes the state
so we come to my problem
the server needs transform.forward and transform.right to allow the client to go in the chosen direction
so I would like to know how to manage this because to prevent cheating it is the server that manages all the player's state and objects
You seem to basically be asking how to make a standard Server Authority game.
You can play with Photon Bolt for free, it was designed based on that spec.
I would like to start from zero create my own base and understand the different problem
thanks i will watch this
question: if a command packet is lost, does the client resend it ?
or do i have to check that it was sent properly
Watch the video on Overwatch's networking as well?
In this 2017 GDC session, Blizzard's Timothy Ford explains how Overwatch uses the Entity Component System (ECS) architecture to create a rich variety of layered gameplay.
Register for GDC: https://ubm.io/2yWXW38
Join the GDC mailing list: http://www.gdconf.com/subscribe
Fol...
thank you
@stuck hinge You are kind of leaving out what your game type and sim type are, so that totally depends. If its not lockstep and its a realtime fighting type game you typically send the last X ticks worth of updates every send, so if a tick gets lost you might still get a repeat of the info to the server he next time.
When that all fails and the server gets a buffer underun, you will extrapolate inputs (make a guess of what the player likely was doing... like if they were holding down W.... they likely still will be)
Same advice as was given to the previous guy... read/watch the things above
@jade glacier Thank you so much for the reply. Currently I am trying to understand the primitive parts of this. The issue is that the server gets a command from the network player to spawn their character controller GameObject, in the case that the client fails to send the packet or it gets lost in-between, will it act like a TCP packet and retransmit until the method executes on the server? The client only calls the command on the Start() function of the script. meaning it only gets called ONCE when the player connects.
Most udp transports have reliable and unreliable options
each input must be transmitted in a different message or can the customer send several input in a single message?
for example at the end of each frame the client checks the input which we change and sends them in an array of bytes?
what and the right way to do it?
You want as much as possible to combine and pack every tick into its own message. That includes and historical inputs you want to pack in there as well. Packet overhead is something worth avoiding.
hi guys im using Mirror and I believe that most of what they have is based off of UNET and I have a problem when making a short variable
public const short PlayerPrefabSelect = MsgType.Highest + 1;
this line throws an error saying that I cant implicitly convert a MsgType to short
im using unity 2019.3
so cast it?
how do you cast an enum to short?
@jade glacier I did not understand very well, sorry I am French I have a lot of trouble, so I can combine the input?
I may not have understood the rest
yes
I've created a test HTTP Trigger azure function. I can trigger it correctly on azure portal and browser. However trigger from Unity editor gives "Error HTTP/1.1 500 Internal Server Error". Finding Unity-Azure sdk and google setup search results seems all outdated/not supported https://docs.microsoft.com/en-us/sandbox/gamedev/unity/azure-mobile-apps-unity any suggestions to make this work pls?
Regular .net http works. And there are several http helper assets around (you do not need anything azure specific)
hey @gleaming prawn thanks man, is there any links or example of implementation you can post here please? im pulling last few hairs hahaha
I tried this code from Unity but didn't get past EnsureSuccessStatusCode()
public async Task<string> PostAsync(string uri, string data)
{
var httpClient = new HttpClient();
Debug.Log("Before await");
var response = await httpClient.PostAsync(uri, new StringContent("myName"));
Debug.Log("After await");
response.EnsureSuccessStatusCode();
Debug.Log("After success");
string content = await response.Content.ReadAsStringAsync();
string result = null;
Debug.Log("RESUlT is " + content);
Debug.Log("Before Run");
return await Task.Run(() => content=result);
Debug.Log("After Run");
Debug.Log("End " + result);
}
i'm quite a newbie on this, found a way to start getting results from azure's function in case it helps anyone https://stackoverflow.com/questions/60501681/azure-functions-http-trigger-unity3d-2019-3/60502808?noredirect=1#comment107034674_60502808
how to manage 20 snapshots per second?
if (frameCount < tickRate)
{
frameCount++;
}
if (frameCount == tickRate)
{
frameCount = 0;
}
else
{
yield break;
}
is this a good solution?
tickRate and set to 3 which is the division of 30 frames per second
60 frames per second sorry
What? Nonono
You want to separate your send frequency from regular render framerate?
@crude night Here's some reading, if you're rolling your own loops this might be helpful.
https://gafferongames.com/post/fix_your_timestep/
I would like my server to send 20 snapshots per second knowing that the server and the client are running at 60 fps
with the code i showed it works fine but i would like to know if this is a good way to do it
It's not
You can't be sure that client or server always runs at 60 fps. Bad practice for client, and will most likely drift.
how can i proceed?
I sent you a link to read
@crude night
You must have a network time in your networking asset
You can use that to figure out which frame should a client or server be simulating
Network time is supposed to be synced between server and client
watch out for lagspikes and pauses though
time will not stop meanwhile
after some pause, network time might say target frame is 1000 frames away
you will often have your unity frozen when you pause or debug if you dont deal with that
.
I mean if you do this like i did:
// update until in sync with networktime
while(sceneTimeFrame < networkTimeFrame){
UpdateScene();
}
and have networkTimeFrame return something like:
(int)(networkTime / 0.02f)
sceneTimeFrame what is Time.time?
really sorry if i seem stupid but i'm a french guy who has a hard time understanding and making himself understood in english
tonight on my data this link https://developer.valvesoftware.com/wiki/Source_Multiplayer_Networking
so I try to put it into practice
@crude night
what i said might be confusing for snapshot interpolation i think sorry for confusion
You don't update the scene by simulating in snapshot interpolation afaik.
So don't mind what i said, it was probably irrevelant
okay thank you my brains started smoked lol
i am sorry π
I have a little problem I would like to store the positions in a list and delete the one that is 1 second
you can know which frame you should be on like this though
(int)(networkTime / 0.02f)
this is for 50 fps
I show you the function
public IEnumerator RemoveIfExpireTime<V>(Dictionary<float, V> collections)
{
foreach (KeyValuePair<float, V> kvp in collections)
{
float timer = (Time.time - kvp.Key);
int seconds = (int)(timer % 60);
if (seconds >= 1)
{
collections.Remove(kvp.Key);
}
}
yield return null;
}
/0.016f for 60 fps
I get this error
Collection was modified; enumeration operation may not execute.
dont remove elements while iterating in list
@crude night
public IEnumerator LoopDeletePositions()
{
while (true)
{
yield return RemoveIfExpireTime<Vector3>(positions);
yield return RemoveIfExpireTime<Quaternion>(rotations);
}
}
I call the function in a loop like this
add items that you are goimg to remove in a new list
then delete while iterating from the new list
its like cutting the branch you are standing you know
@crude night
modifying the list you are iterating i mean
I understand for the branch lol
to delete so i may understand the list in court will keep the collections?
it will increase for nothing
i dont understand that
you told me added the items I need to delete in a new list
May for the first list which contains all the items I do how to remove them bad
you iterate in that new "toDelete" list
and delete that element in the original list
@crude night
I don't quite understand an example please?
I tried things but I got a unity freeze π¦
@crude night you need to read the references and understand...
Code for this would be a lot more complex than what you are trying to do.
you have given no context pretty much
How do you expect me to help you with such a question
That doesn't sound like a question. That sounds like your expression of your confusion lmao
Are you asking how to sync rotation of a character? @rancid anvil
Well
I have already sync it
But even the other player rotate
@high night
I tried with if islocalplayer
Yes
try printing isLocalPlayer
`
before the if
using System.Collections;
using UnityEngine.Networking;
public class Movement : NetworkBehaviour
{
public float speed = 1.5f;
public float offset = 0.0f;
public Rigidbody2D rb;
void Start (){
rb = GetComponent<Rigidbody2D>();
}
void Update ()
{
if(!isLocalPlayer){
return;
}
//ROTATION
Vector3 difference = Camera.main.ScreenToWorldPoint(Input.mousePosition) - transform.position;
difference.Normalize();
float rotation_z = Mathf.Atan2(difference.y, difference.x) * Mathf.Rad2Deg;
if(isLocalPlayer)
rb.transform.rotation = Quaternion.Euler(0f, 0f, rotation_z + offset);
//MOVEMENT
if ((Input.GetKey(KeyCode.LeftArrow))||(Input.GetKey("a")))
{
transform.position += Vector3.left * speed * Time.deltaTime;
}
if ((Input.GetKey(KeyCode.RightArrow))||(Input.GetKey("d")))
{
transform.position += Vector3.right * speed * Time.deltaTime;
}
if ((Input.GetKey(KeyCode.UpArrow))||(Input.GetKey("w")))
{
transform.position += Vector3.up * speed * Time.deltaTime;
}
if ((Input.GetKey(KeyCode.DownArrow))||(Input.GetKey("s")))
{
transform.position += Vector3.down * speed * Time.deltaTime;
}
}
}```
that's it
@high night
print isLocalPlayer at start
okay
see if you get two true's
hm
you shouldn't be seeing rotation on other character
@rancid anvil
Other body should stand still
You have an is local player test after if(!islocalplayer) return
yes
...
network transform has Client authority ?
if there is one im assuming theres one
hang on I need to read the issue mor
camera.Main
are you sure you using each characters own camera?
I would personally not use isLocalPlayer regardless. This isn't what it means hasAuthority is preferred.
HasAuthority is what I use
But @rancid anvil please check that you are not using the wrong Camera.main
Alright let me try with HasAutority
But @rancid anvil please check that you are not using the wrong Camera.main
@stuck hinge How?
are you having issues with both client and server ? or one
I was making an RTS and ran into similar issues
if(HasAuthority){
rb.transform.rotation = Quaternion.Euler(0f, 0f, rotation_z + offset);
}
Does it all work locally when you remove the authority checks?
If i try with hasAutority , only the main player rotate
i mean only the player that host
Are you using Network Transform to sync it?
Do you usually have a int number on server and updated by server that keeps the time?
(This number is also sent to clients with states, clients wil figureout their times based on this value)
Or do you use the networked time? (which is synced time on servers and client, synced from the start)
Just wondering
.
When the server lags, does the server have to catch up?
Or time is just stopped/slowed for a while
I think the second one is more logical
Using time with networking isn't really a very good practice for a lot of reasons.
you mean the synced time?
You typically do everything based around a fixed tick, and all timings based around those ticks.
I would try to use that term then, since they have very different names and meanings
okay, how about how the ticks/frames number is handled though?
What happens when the server lags
you should also be very clear what you mean by lag
because in this context lag can mean like 3 different things
(server can't simulate fast enough)
Does server constantly try to catch up?
If the server can't simulate fast enough, your game is broken and you need to go refactor it until there is no risk of that.
So i shouldn't deal with this case?
The server doesn't do anything on its own, but FixedUpdate will play catchup if that is your timing segment
If the server hangs, simulations will stop happening and clients will buffer underrun waiting
if server runs 1 frame per second
when i look at 1000th second, server will always have simulated 1000 frames right?
even though server was overwelmed in 200th second for example (cant simulate fast enough situation)
Depends what is triggering your simulate code, but I would assume you are coding for it to work like FixedUpdate, or to just use FixedUpdate
I control it in Coroutine
at 50 hz
i have this:
int FrameNo():
return (int)(Mirror.NetworkTime.time / 0.02);
while(true):
SimulateUntil(FrameNo())
Wait(0.02f);
Think of it like this
frameNo : (int)(Mirror.NetworkTime.time / 0.02);
So always same number of frames simulated at sime time
If server can't catch up, it freezes
Because "Mirror.NetworkTime.time" doesn't ever stop
I personally always just use a net tick singleton, and tie everything to FixedUpdate. Coroutines are satan's work.
other option
int frameNo;
while(true):
SimulateUntil(FrameNo())
frameNo++;
Wait(0.02f);
And i sync the frameNo to clients
.
@jade glacier If you fix timesteps, FixedUpdate may get you in trouble though right?
But if you don't sync it, then your server may freeeze
By default, fixed update interval can get big as 0.33f, whereas it's 0.02f normally
It does help catching up at the cost of ruining your fragile determinism
Why would fixed get you in trouble?
Because of state syncronization
I'm not doing the snapshot interpolation
Fixed is Unity's fully built in fixed time engine, and it also will ensure that your net code works on the same timings as the physics engine
You have a tick, so you are doing snapshots
I need my time intervals fixed
whether you interpolate or extrapolate, or neither is separate
what is better, to have the client ask a question to the server, and the client acting on the request, or having the client call the server, and then trigger a RPC (from the server) ?
The honest answer is that that is all pretty terrible.
adhoc messaging creates horrific tangled race conditions. You want to reduce your game to a tick based simulation, and tick based user inputs. Once your game runs in that context, then everything is a question if whether your a syncing a buffered input, or a buffered state.
it's turn based though
Though to your question, what you are asking about is prediction. If the client acts locally on something that it needs server permission to do, you just have to have a way of cleaning things up if the server doesn't give the answer you expected.
so basically the client would send a moveIntention to the server
and the server would return a bool
Turn-based is still tick based... those ticks just don't happen at a fixed rate.
Typically you give the user feedback that their command has happened... like a sound and like a cursor ding on the ground where they clicked or something.... and then you wait for the confirmation before actually simulating forward.
RPCs are just messages, which all networking is. The RPC part doesn't matter.
If its turn based, why do you need server permission?
so that the server is authoritative
You are making a non-deterministic turn based game? Any reason you are opting to not make it deterministic?
what do you mean by non-deterministic?
@jade glacier
it should be deterministic afaik
the server-side stuff is fully deterministic, and the client asks the server for stuff, so it should be
a framework I will probably be using might implement async/callbacks for commands toward the server
if its deterministic, then your networking for each tick should only need to be a reliable message if the players inputs they applied locally for that tick.
And no need to wait for server confirmation of anything, since there can't be any disagreement.
@jade glacier you don't trust players that's the thing
Nothing to trust, its deterministic
they aren't sending states, they are sending inputs only. Same as with server auth.
yeah but the client can't know if the input is ok
The difference being that you don't have to transfer states, because its pointless.
since it dosen't know game state
Of course it knows the game state
nah client is only UI
You might want to read up on what determinism means in games, because I think we are having to different conversations.
yeah I guess
There are only two things to sync in networking... inputs, and states.
I mean it depends on the gameState what effect an input will have
The reason for state transfer is because of non-determinism. You have to sync the RESULT of a simulation, rather than just what goes into the simulation.
Determinism means that every machine everywhere will produce the same exact results given the same previous state and new inputs.
So to get in sync, you just need an initial state transfer, or to be sure each client has the full history of user inputs.
Once you are in sync, you are forever in sync.
still don't get where it's not deterministic
but anyways it will have to be RPCs anyways
where what is not deterministic?
so I will have to change it so the client dosen't wait for anything
RPCs are fine, though bloated unless you are RPCing a byte[]
since it affects other clients
You said turn based... but now you are describing realtime
I know for a fact I am not
turnbased you can lockstep fully. Realtime you need an intermediary like a server to be the final word on what inputs were.
so the entire game logic runs on the server
and the client dosen't need to know how the game works, it just displays it
yeah, we are kind of going in circles here. Give it a shot how you want to.
Just I would recommend reading up on the concepts of determinism, and the benefits
I mean I don't get what you're saying
the big one being that you don't need to do any state transfers
I know how determinism works in a state machine
the backend is deterministic and I don't see why you asume it is not
In networking... all traffic related to game simulation is either Inputs (Cause) or States (results)
with determinism you can eliminate the need to transfer states
you're saying an input is a state?
all that's being transfered is a direction and an ID
nope, an input is the non-deterministic stuff you put into the simulation. The previous state is the starting point... the inputs create changes to the state... and a new state is produced.
what an input is, is up to you... but it is the stuff the users do... be it key presses, or mouse moves, or whatever....
The state is the end result values of your game after the simulation runs... like player locations, health, velocities... etc
yup, and every position on the board is mapped, so from a starting position the resulting position from a given direction is always the same
legit you could strictly compare the directions and the resulting arrays and the result will be the same
Then that would be determinsim, and you can make that work for you. You don't need to worry about security, players can't cheat determinism. If they do something illegal (by hacking) it will just cause a desync and that will pretty much end the game
Typically that would produce a checksum failure... which means its over.
yeah so that's great, but right now my issue is that players have to have a limited time for their turn
but I can't really do that from the server, because of latency
An intermediary likely is needed for that yeah.
The server can do that, but you will need the clients to produce heartbeat ticks of some kind.
but the issue is that you could cheat an heartbeat tick for example
since it's all local
no?
For that scenerio, you will need a master intermediary like the server to be the final word on inputs.
my first idea was to have the timer locally, but you can cheat that pretty easily also, not that I should worry too much about it but kinda sucks to have everything authoritative except that
yeah, you will need a 3rd party authority on that. And you will need the means to rewind and resim if the server says your input didn't make it in time.
Depending how aggressive you want to get with it, you can also have the other client monitor its ticks, or you can have the server just loosely check for excessive heartbeat holdups... and if they do it too much kick them and give the win to the other player.
so you get heartbeat ticks, and check if they respect a certain thresholds, and also have some sort of timestamp on each of them, including the turn start and turn end server calls?
I would probably break down a turn into X heartbeat packets. And the server/other player can raise a flag if they get held up in a way that seems unfair.
ohh, interesting
no need for timestamps, you should be on a fixed tick
how do I know that I'm on a fixed tick?
Because if you aren't you should be.
I mean, I didn't create my own networking library
Fixed ticks = sanity. Adhoc time = hell in networking.
Fixed tick is as simple as using FixedUpdate for your timings rather than Update
true
really expected to find a more elegant solution
seems messy but I guess if it works
Queing up the players actions and sending them every tick is pretty elegant.
Its as clean or dirty as your simulation is.
you can send it all on one tick, and just keep an eye on the elapsed time, and terminate the game if they exceed a tolerance.
I guess I could also just do it locally for now until problem arise, since the code that needs to be added will be the same either ways
hmm
I didnt know it was about sending the info at the same time as the heartbeat
I would solve that problem later. Getting your simulation broken down into ticks, inputs and states will make the rest easy to solve.
though you would just monitor them and know if it was before or after the 'timer number of heartbeats' threshold
The value of the intermediary ticks is you might want the other player to see what the player is doing, rather than getting it all after the fact.
Like in Hearthstone you can loosely see the other players actions.
loosely as in it's out of sync?
Its still in sync, its just giving the other player X ticks worth of turn. I have no clue, I don't even know what your game is - so the best answer is totally based on what you are trying to do.
Hearthstone is loosely because its not determinstically locked second by second. Its deterministic because everything happens on action at a time.
You won't see things perfectly time aligned with the other players actions, but you will see that players actions in the correct order.
ohh and you sure thats how it works in HS?
HS I believe is server based
so the player sends packets every X tick?
for all the random shit
leaving the random generation on the clients would open the door for cheating, since you could determine the outcomes of actions before you do them.
I was only referring to HS for the way you see the other player acting during their turn
yeah, still trying to wrap my head around the heartbeat thing though,
just think of it as sub-turns
give a player X ticks for their turn, and any inputs made you queue... and then apply them to your sim locally when the next sim tick happens. And send those exact same inputs to the other players, along with the tick ID.
It basically is treating it more like a realtime game, but its a slower paced lockstep.
Though again, I have no clue WHAT your game is or what kind of tick rate it would need/want.
deferment is pretty important. Don't just go applying inputs directly to things in Update()
use the space between ticks to collect (queue) user inputs, and apply them on the simulation tick in order.
Then if you send those same exact inputs to other machines, they can reproduce the sim step exactly the same. That is the principle of determinism.
What about getting the player's ping for example
And calculating the time equal to given time + player's ping x 2
you could factor that into the forgiveness sure. Though of course they could fake that.
Keep in mind ping won't matter
But you can certainly add it into the forgiveness.
ping wont matter?
I would REALLY not start your focus on this part. Focus on your simulation and boiling your game down into ticks.
Forget a said anything about ping. Its so far away from the things you need to be working on.
yeah thing is, the only aspect of the game that requires real time is... time..
the game could basically run on a REST API
Until you have an input/state tick based simulation, this is all pointless conversation really.
The highway of network games is littered with guys in these channels worrying about hacking, and this kind of stuff way too soon.
yeah just seems overkill to get that deep for just time, I guess it is pretty core but taking me far away from the idea of a small networking project I would like to finish
Focus on the simulation. THAT is networking, not the messaging.
I mean the simulation is complete, what do you mean?
is it, its purely input/state based on a fixed numbered tick?
no I guess, but it's not tick based either, it's turn based
Is it a pure tick then, no watching the other guy play to deal with?
if its like chess, then you may be done yeah.
yeah you could say that
but how do they handle turn lengths in speed chess for example
that's the annoying part
but yeah, I'm overthinking it I guess
could just do that locally and not worry about theses things till they happen
So no need for the intermediary ticks. I would just make your intermediary server do some basic time accounting to check for time cheating.. and if it spots it kick the player and award the win to the other guy.
how do you do basic time accounting?
When the player is sent the other players turn, log the time on the relay/server
and compare that with the time the player returns control. If that exceeds the turn length by too much too often... call the match.
The alternative is to enforce it by making all actions need to be confirmed by the server.
Which it sounded like you didn't want to do.
That route you have two choices... to predict and rewind if the server says you were too late... or just to delay the inputs until the server confirms.
The issue is prediction
It's as simple as you skipped your turn
But if the player on their side acted in time and you allow that to predict, you will have to undo that action.
so you wont see anything moving, since nothing moves until the servers says it did, and the server wont move anything
Then you already are doing full server auth yeah
yup, but with time it sucks
You can do what you are describing there and still be deterministic, so that's all fine
the downside is players will feel the latency in their actions.
yeah, well I want to add some local feedback to say that you did that move, and then the server feedback
but yeah I know that there will be that feeling
but with time it's never perfect, is it
what we were talking about earlier is non authoritative time
The server knows the real time. All you are doing is waiting for permission for each action
The client will be able to have a reasonably good guess on the hourglass based on ping.
yeah but the ping makes it so there's a delay
but I guess the server could do like u said and check if the client is cheating
There is no cheating in this case really
the clients actions after the server says times up will just get a denied response.
and I probably add the player's ping * 2
to that
or average player's ping rather
otherwise if a turn is 1 second
he could get a real 8th of a second to react
with a 100ms ping
or half RTT
RTT?
ping
why half?
That's how long it took for the server "your turn" message to arrive
oh right, it's half
its all pretty easy math, just use the right value for the thing you are trying to solve for
so one player's ping accounts for receive time on both side
its all super loose, since that is just to try to give the player a guess at a turn timer
You don't generally get a ping between clients, nor need one.
yeah, they will see stuff moving but they are independent
the players only concern is how long it takes to get a message from the server, so it can guess the turn time left. Other than that there is no time concerns at all.
yeah, still wanted to have it more accurate than that
but I guess it's as close as it gets
The server will just stop accepting inputs when its clock says the turn is over.
without going into ticks
The ticks aren't needed if you aren't doing any kind of player observation stuff
yeah here you go
but server timer is never a real timer, so it would have to be local
then u need player observation
If you have a server of any kind, I would make that server the god of time.
player observation I mean like hearthstone.. where you can see the other player doing stuff.
rather than old Civilization... where you just get their turn when they are done.
You can't ever have networked time in networking, unless you are like fully extrapolated determinism. There is no need for it anyway.
Your ONLY use for time in this case is the client needs to know how long they have left in their turn, so that is something of a guess based on RTT
alright
I will go for that
thanks a lot
more complicated of a subject than I expected
the rest should be easy though
All you need locally for that is when the server packet saying "Your Turn" arrives... you subtract half RTT from that to get the current remaining time.
It will likely be a bit off, but by a bit I mean like a ~10ms off
ye, or let the server do the math, and the client can assume his turn is of the given length
there is no way to know what internet jitter is
If their connect is complete dogshit... that is on them
Or they will just be annoyed that the turn end clock isn't always honest
HS has horrific turn clocks... doesn't stop them
warning the clock might not be accurate cause ur internet is dogshit
yeah lets just say when you have only 1 sec to play with vs 1 min
it matters more π
Or just make the bar lie and promise less time than there actually is.
like say turns are 30 secs but make them 35 secs
yeah I guess not showing an actual number is better too
like in hearthstone they use the bomb thing
yeah, just make it and see... adjust creatively
so it can be off and u don't really realize
aight well thanks again!
well fuck, that's a way to do it
yeah, RTT comes from the transport
and I think they do a smoothing on it, so its not too noisy
NetworkTime I disklike, but you can use it here - its just RTT wrapped in their own attempt to make things transparent. Its pointless though for you.
ohh right
You don't need a universal time, you need time until turn ends. So just TurnLength - RTT * .5f
its 1/2
just a good practice to always multiply rather than divide in programming
since its faster
never heard that
doesn't matter here. Its more for hotpaths
I mean, good to know though!
is this the right place to ask about NetCode? or should those questions go in #archived-dots ?
Dots will likely get you more answers
ok
Hi, does anyone know where to start if I wanted to write a multiplayer game in unity? I have unity/general programming experience but the network stuff really confuses me--all the tutorials I've found use something that's being deprecated apparently, so I'm not sure where to start
@crystal ore photon is common and mirror is unet's successor
I'd choose either mirror and photon
using mirror currently though
used some photon before
Ok great, thanks!
Im trying to learn photon after using unet for a while, diffrences are there
Should I use a different enum to represent a movementIntention (frontend to backend) from a movementDirection (backend to frontend) if they are the same?
Not sure what front and back end are in the context of your question. You are trying to make a non-unity build for the server in a different language or something?
Framework is a bit weird, ended up just using the same for both, since they represent the same thing, they don't need to represent the context/use case aswell
Anyone has recommendations when it comes to login for Unity, and storing data, though of maybe using a REST API to do that
hello good morning I try to practice networking with
https://developer.valvesoftware.com/wiki/Source_Multiplayer_Networking
and https://www.gabrielgambetta.com/client-server-game-architecture.html
first i would like to know which is clearest for you then
So I have a question: the server and the client should send 20 to 30 snapshots per second?
to get off to an easy start, I would just make my net rate and my sim rate match
I do not understand
Do you have a simulation? Where/how are you generating your ticks?
If your sim is fixedupdate... generate a tick every fixedupdate.
wait can i show you a simple MonoBehavior class with only the tick to get a correct opinion?
at least you can tell me if i am wrong
never hurts to paste it, someone else might have an opinion as well
public class NetworkClient : MonoBehaviour
{
// frame count
readonly int frameRate = 60;
int frameCountPerSeconds = 0;
int frameCount = 0;
// tick
readonly int tickRate = 20;
int tickCountPerSeconds = 0;
int tickNextCount = 0;
int tickCount = 0;
void Awake()
{
Application.targetFrameRate = 60;
Application.runInBackground = true;
}
// Start is called before the first frame update
void Start()
{
StartCoroutine(LoopWaitForOneSecond());
}
// Update is called once per frame
void Update()
{
frameCount++;
// frame rate => 60 / tick rate => 20 = 3 // |frame|tick|result|
int divideRate = (frameRate / tickRate); // | 60 / 20 | = 3 |
// tickNextCount = 1|2|3
if (tickNextCount < divideRate)
{
tickNextCount++;
}
// tickNextCount max length from tickEvery
if (tickNextCount < divideRate) // != or <
{
return;
}
tickNextCount = 0;
tickCount++;
// update 20 tick per seconds
}
void OnGUI()
{
GUI.Label(new Rect(10, 10, 400, 50), string.Format("frame per seconds: {0}", frameCountPerSeconds));
GUI.Label(new Rect(10, 35, 400, 50), string.Format("tick per seconds: {0}", tickCountPerSeconds));
}
IEnumerator LoopWaitForOneSecond()
{
while (true)
{
yield return new WaitForSeconds(1f);
frameCountPerSeconds = frameCount;
frameCount = 0;
tickCountPerSeconds = tickCount;
tickCount = 0;
}
}
}
with this I allow the client to send 200 snapshots per second
is the right way?
Why would the client send snapshots?
I find it very difficult to understand English for me when the client sends an input I take its as a snapshot?
translations also don't translate very well π¦
you should use like hatebin.com for larger code posts like that, easier to read. And if posting here be sure to include the ```cs at the top so it formats it better.
I added the ``
There is a lot going on there that I would not do. First thing being the use of a coroutine.
```cs
your code
```
the cs adds the colors
I'm not going to go into that discussion, there is plenty online about why coroutines are a nightmare if you google the topic.
Are you doing your own simulation, or are you going to use PhysX?
PhysX?
Have you made a Unity game before?
complete no I have experienced the basics
PhysX is the physics engine. All of the colliders, rigidbodies, etc... have you used those?
yes
That is PhysX
is your new game going to use those, or are you making your own simulation?
I think to use it for the moment for simplicity
Then your simulation is PhysX
which means your simulation timing is FixedUpdate
That is your simulation tick
I don't understand very sorry
the simulation of the player I have to put it in the fixed update? is that what I should understand?
Do you know what simulation means I think is the first question?
the simulation is the movement simulated by the player's keys
I may have simulated them not executed it is it?
The language barrier is making this harder than it needs to be I am sure.
I think I understand better the player sends it is input and predicts its change it can be executed while waiting for the response from the server
then on the server side, he simulates the world in his time
it's correct ?
It is so much more complex than I can explain here, especially with the language barrier. I don't think I can help sorry.
π¦
someone can at least tell me clearly the steps that a server and a client must each perform in turn
ok so let me explain what is going on, as you can see in the window of the left player, at the down right corner it says CLNT-UN:username this stands for client username: username. for some reason even though it shows up as username in the left client's window, the nickname shows up as player(clone) on the right player's window. ill send everything responsible for setting up the usernames right now:
Start():
pv.RPC ("setNick", RpcTarget.AllBuffered, gameObject.name);
[RPC]
setNick(string nick):
usernameTXT.GetComponent<Text> ().text = nick;
also the there is a function for teams, which also didnt work, but i assume that it originates from the same issue as the nickname problem.
@crude night elaborate on the server and client must each perform in turn
oh hold up....
nope still have no idea
i do receive those errors though
i didnt receive them before this problem started
@near cairn : I would suggest to read and code the tutorial:
https://doc.photonengine.com/en-us/pun/v2/demos-and-tutorials/pun-basics-tutorial/intro
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!
is it that hard to tell me the solution though
The second screenshot you shared shows you didn't connect (or at least didn't finish connecting).
i switched unity versions from 2k17 to 2k18 and this error started appearing
The solution is written in that tutorial. And it will help you know the context, unlike any short info you get here.
Sorry. Bad translation from German thinking. Removed that "down"
i know everything mentioned in that tutorial
nothing there helped me really
@stiff ridge do you know the solution to my problem and just playing with me or you do not know the solution and sending me to an introduction tutorial
To get any help on that, you would need to give a lot more context. Otherwise everyone can only say "You have a bug in your code somewhere"
well i don't know what else to say really
That you are getting warnings saying you aren't connected, would suggest you are trying to call these things before you are in a room.
but the thing is that when i used 2017 it was all fine and everything was syncronized across the network
i switched to 2018 and everything was gone to spaghetti
Execution order changed on you maybe, and your code timings were fragile and not specific enough maybe... dunno.
That literally is giving no information on where things are going wrong. All we know is you are getting a message saying you aren't connected when you try to do something....
i don't know much myself
So all we can say is "Make sure you are connected before that calls"
Use the SupportLogger to get some context into the console log. Post the complete log.
all i know is what i typed above
Post complete code as well. Very short snippets give no context for what callback you are calling things from, so we have no idea what your timings are.
Like if you are calling networking stuff in Start(), that is risky.
alright thanks
actually i think it will fit here
void Start ()
{
pv = GetComponent<PhotonView> ();
rb = GetComponent<Rigidbody> ();
pv.RPC ("setNick", RpcTarget.AllBuffered, gameObject.name);
pv.RPC ("sendColor", RpcTarget.AllBuffered, chosenTeam);
}
[PunRPC]
void sendColor(int clr){
mesh.GetComponent<MeshRenderer> ().material.color = teamColors[clr];
}
[PunRPC]
void setNick(string nick){
usernameTXT.GetComponent<Text> ().text = nick;
}
this is the one that should set the nickname and the colors
ill now send the script which connects the client
Yeah, don't use Start() for networking would be the first thing
hmm
That is not a network aware timing, so all bets are off.
Use the PUNCallbacks for your timings
You really need to refer to the docs for that stuff
I can't code and read the docs for and with peeps in the channels, or I would never get any work done.
I can just point you in a direction
Even if you had a running game, I can only suggest to do the tutorial.
It will (also) show you how to use the built-in nickname for players, so you don't have to send RPCs for that in the first place.
i dont like this built in stuff
it's optional in my case
so i prefer doing it on my own
Then you are basically wanting to be out on your own... so you are going to have to get your hands dirty in the docs
to also tweak specific stuff i want in my own code
as i said it worked fine in 2017 @jade glacier
and i nailed the nickaname system fast
Because you coded in a race condition using that Start() maybe... who knows
Building out to mobile or different exe targets also might have exposed the problem. But again. No clue.
well ill try what you recommended
Is it possible to send 5mb image over network? Im using photon.
Not meant for that purpose
Good lord no
Keep your assets like that someplace "webby" and just reference them by link or something
realtime game servers and file hosting you don't want to go mixing.
Realtime game servers are for sending high frequency (20, 30, 60 Hz and up) very small packets ( < 1KB so for in one UDP datagram) efficiently...
A photon server can hold a few thousands game clients with this kind of message passing...
Sending images is normally done over TCP, via a CDN infrastructure... So two different problems
Is there some app that emits my packets from a public ip from some other server?
So i can access there behind my NAT
and host the game with that servers public ip?
You meet stun punch through, or upnp (and because these only work 85% of the time, a relay service as a fallback)
Need*
What i'm describing is more of a relay server no?
So, steam does that for you, photon as well (low level realtime gives you punch as well)
Yes, but you want to avoid the relay if possible
Punch through enables direct connections via NAT
That's standard practice for client hosted listen servers
Photon bolt comes with that, etc
Does photon include NAT-punchthough-ed connections in it's CCU?
Depends...
In bolt yes, because you are using the service for matchmaking, signaling of the punch and fallback
For low level realtime it gives you the socket, so I think if you disconnect from the room when a punch works it stops being a ccu
But you need to read the EULA
As well as just paying for having that library made for you - I assume is baked into the hosting costs a bit? For Bolt?
It's our software library that you are still using.
just answered π
Yes
It's our daily job to create these libraries so you don't have to...:)
Or you don't have to pay a few k $ a month for someone to do for you (+ hosting)
Steam does for "free", assuming 30% of your revenue is free...
Well, i'm pretty much just a hobbyist, i haven't been digging much into the costs, revenue and how will it recoup the costs
I'll worry about those if i can make a decent game
And does with just a basic transport, no actual netcode... Just a comparison
Photon you pay 95 buck ONCE for 5 years of 100 ccu
You need a game with a decent amount of players to passa that threshold
Oketjing like 40k Mau
Something*
so these 100 ccu will be only the non punchtrough users? %15 of my users?
Not in bolt
Bolt is always connected to the room, so everyone is CCU
I do not know about the photon realtime (low level) EULA
But as I said, probably all are CCU
That is how we pay for the employees... We done pay only for servers
You know, these boring guys who write the libs (like you)
:)
No, lol i won't be writing libs
If you want to write games, it's what emotitron says
Use bolt, or quantum, or mirror
Not sure if mirror has punch + relay though
I am just writing netcode for my game
I won't be writing networking layer stuff
You can even start with the free 20 CCU tier with bolt
I just make the bytestreams
Mirror has some punch stuff now, not sure about relay. But I think they are charging for those services like everyone else. Since no one wants to pay for your networking costs.
Or quantum, it replaces your netcode (I won't get into details)
I enjoy writing netcode,
And i want to try funky things after my system is stable
If you are a hobbyist just host a server on your local dev machine and open a port.
If you actually intend to have players, you are going to eat some costs though.
Yeah, you can reverse nat
Port mapping on your router
Manually
Upnp is for doing that automatically, but super unreliable
Your ISP might come down on you for that as well if you actually get real users
And not safe,.lol
But once you are starting to take those things into consideration, you might want to rethink if you are a hobbyist.
I think send rates are very slow from my router to world if you know what i mean
upstream i think what networking guys call it
the upload speed i mean compared to download
But bandwidth should be ok
Unless your netcode is really bad
Nd of course, depends on what you want to do
You won't host more than 16/20 players, will you?
yeah right i wont
In that case, consider the photon realtime as a fallback
Because 20 CCU is free anyway
Ithout asking for 30% revenue
Without
But o would not use relay 100% of the time it doubles the hops
Adds delay on a listen server architecture, should be just fallback, really
For quantum, the photon server is the host/server so then fine
quantum servers can have dedicated servers?
Quantum is different
Yes, we can give dedicated servers, including running authoritative SIm on them
But it's a different architecture
Quantum is a game engine
We don't run unity on servers
So we have our own physics, path finding, math, ai sdk, etc
hmm, interesting
It's not FPS style netcode
Like bolt or CS, or the new unity netcode
It's deterministic predict rollback
With server mediation
You do not deal with netcode, just gameplay
And unfortunately not aiming hobbyists
At least not yet
Not that you are a bad hobbyist
Just that it does not have a free version
We give free trials, and some rev share options for really good groups/studios
But it needs to be something more seriously targeting business results...
Exit is a small number of people, so the support of free stuff for hobbyists isn't REALLY a winning strategy.
Every minute in a channel explaining something is a minute not coding.
Yep,.we do not have investors to burn from,.lol. not anymore, company is past these days log ago
Just a small profitable business.
That being said, being friendly to hobbyists is good in that some % of those hobbyists turn pro.
With some cool customers
Well, I enjljoy.beingnhere, even though I should be sleeping
But spending 2 hours explaining to someone in chat why their gameobject isn't syncing movement.... hurts a lot π
Yeah, I do this because its a break from thinking, but it can get time consuming.
Yeah, for quantum we have our own private discord
About 400 Devs in there alread...;)
That is the nice thing, once you have devs, they support one another
Yep... And it's been a surprise how some big shot studios are friendly and participative
Really good Devs in there, it's fun to watch
Well, i dont know how likely i am to turn into a pro.
I don't feel worthy of your pitchπ
I hate to pitch, lol
I've just seen the same story so many times
You are on a good track, better than 95% or more.of the pack tbh
If people are excited about the product, you can't stop them. Programmers love tech talk.
I like our results, yes, but I do not like to pitch in itself
I see, you are fortunate to make a business of your passion
This is why I always mention the competitors. It's not my intention to divert people
Hmm, if I knew quantum were open to rev-share I might've looked more into it more. ^:) How would you resolve persistent data that is the outcome of a match from such a system?
You can learn a lot using something like Mirror. There is a benefit in not having the high level stuff, and seeing for yourself where things go off the rails.
We have cross platform serialization of the full snapshots
Turnkey
Jaws, super simple....
And we can run the master simulation on the server
So you can store game results from there
Ah, I thought it was server less
The server doesn't get brutalized like clients, since it doesn't have to resim constantly.
It is a isnt
There are several ways to do
Server is mandatory for input management and time sync , but that is game agnostic
And with just that you can already forward full input stream to a backend
So you can reproduce game match results from a referee .net.console app
Say to audit tournament matchs
Matches
Optionally, you can just reuse the same SIM code and run on the live server, so you.have an authoritative master source even for snapshot based late joins
I didn't even consider that. Rather than having the server run the sim and hold that in memory - you can just write each ticks inputs to a file, and have a second machine recreate the end state in one shot off the game server. Nice.
file meaning database, bad use of language
And because we have the whole tooling around the ECS data structures, you don't need.to write serialization code, all cross platform determinist by design
We also support grabbing snapshots straight from another client for late joins, also out of the box
So it's pretty much a decision you can do later down the line of you start making shit loads.of money with the game
To run the server Sims or not to
I guess it's not directly compatible with Unity ECS, but you run your own?
It's our own, production ready, not beta...:)
We are about to launch quantum 2 (hopefully to customers.tomorrow)
We want to eventually integrate to unity's ecs (when it is reliable enough)
For rendering, animation particles
It's nice stuff... We just can't use it at all in its current state
And for simulation, nah...
Our task system seems to have less "gaps" even... And unity on server would be 10x more expensive... When ours can run on lean .net core
As I said, it's fun to benchmark...:)
It's cool to demonstrate stuff on a 12 core machine, but in the real world you need to ship games that work reliably on a low end phone with 2 usable cores only
Reliably and fast... Of course
Hmm yeah. Sounds good ^: ) I just know I can't be paying the 1k$/month as I'm living off half of that/month rn^^
Fully understand
I mean, we have two interesting ways to get hands on it
One is, if you and a small group can do crazy cool stuff and have a great idea, we normally pay for well done demos
It's a fun way to experiment with, being oaid
Second is the rev share deals, also related to a solid plan for something with potential
Good way to make a win win with hobbyists, nice call.
We've been doing this for the past 2.5 Sears with quantum... All samples were created by small studios
Years*
Win win for everyone, no question.
So you are saying I should make my flight model based dueling game π
The 1k is about the following:
- the amount of features and tooling and support we give would cost you around 2 devs a month, and take 3 years to make, IF you have good developers (think about a good dev salary)
Do the math...:)
Maybe @jade glacier
So for a professional studio, the 1k is a no brainer
Any company with any kind of funding its insane cheap yeah. So the rev share and demo deals kind of fill the gap. You guys have done a nice job positioning.
I can't mention all, but square Enix Montreal, Ubisoft, moon studios all did the math...:)
Yeah sure, but also there are "free* more cumbersome" alternatives, but I understand the logic behind it. π
Yeah, I'm not here to say people.dontnhave options, as I said, I always mention at least mirror
I'm here mostly to hang out and chat with other devs
There is something to be said for also not dumping it on the market, because that actually kneecaps the bigger studios with plans and funding. The game markets are already awash in democratized garbage.
We can't give the same level of support if we had 5k developers in our discord instead of ~400
Unity has a dark side.. that being what it has done to online game stores with too much crap.
Well, do you really care about good netcode? Honest question, lol
We deal already with thousands of free users with pun/realtime/bolt
But the quantum family is a bit more intense. I usually take things more personally when someone who wrote a game you play relies on you, lol
Its pretty obvious the difference. Count the number of published profitable Forge or Mirror-based titles. Having to work out the hard details puts a lot of hobbyist devs in years of endless coding.
A complete stack in game networking is massive.
I know it is massive, photon is small, but just the quantum team count is in 2 digits already
Started just fholm and me
Asking me? π I care more of the game than netcode x) But I'm considering if I should even consider swapping at this point or not. Already started my game on Unet=>Photon=>Own solution => now NetCode^^x)
That would be the endless dev cycle of working with incomplete stacks yeah @stray scroll
Do you really notice a good netcode when playing
I do, but that is partly because I am from a tournament Quake background.
Most of what I know about networking I learned having to live with it.
shrug somone wrote a review saying netcode for my game was good, made me happy, so guess some care? π
You normally notice bad net code
As a developer quantum has tons of advantages, you finish the game faster, more reliably, with more features available (if you want to give them to players). Besides the obvious super snappy gameplay
yeah, that is really more how it works. You notice it when its shit.
But the later is subtle
For most games, the issue is just not getting buried in the endless rabbit hole of net development, which is where most people in these discord channels live.
But you are full of games with crappy or semi crappy netcode that have tons of olayers
I've see many of the same faces working on the same projects now for years in here.
I need to sleep on it x) Is there a trial to test out, to see the framework so I could estimate the refactor time? x)
I mean, look at overwatch, much better netcode than poor pubg and fortnite
Yes jaws
Send me an email
erick@exitgames.com with copy to developer@photonengine.com
But my point is, pubg had a really bad netcode, specially at the start... 10 ticks per second at the beginning... But didn't matter, right?
Lol
Here and there you get these unicorns
People accept a lot when its free
Porting to quantum is normally a full re-write.of the gameplay... But Devs who have done it for quite fast acrually
Battlelands royale was originally PUN, they re-wrote in quantum in 1 month, then 4 months polishing
Nd were talking about a production game with content
Ahh, 1 Guy did. The initial port in their team
We did a presentation on this last Unite, me and them
Aight, will send an email. Now time for some sleep, gngn.
good evening I am a tutorial that I have a little trouble reproducing on unity to better understand physics and networking
would it be possible to have help on the first part Digital integration
here is the tutorial https://gafferongames.com/post/integration_basics/
Introduction Hi, Iβm Glenn Fiedler and welcome to Game Physics.
If you have ever wondered how the physics simulation in a computer game works then this series of articles will explain it for you. I assume you are proficient with C++ and have a basic grasp of physics and mathem...
why am I getting this error? Mirror.Weaver error: Cannot generate writer for component type UnityEngine.UI.Text. Use a supported type or provide a custom writer
You'll probably get a faster response in the Mirror discord
Are you trying to pass Text as an RPC argument?
Or you put SyncVar on a Text object?
oh sorry I thought this was the mirror discord my bad
So was thinking a bit about quantum when going to bed and this morning in regards to my use cases. Would I be able to set up a in game lobby(basically lobby world) where players can purchase things for in game money and irl money?
Normally in-game-asset ownership is handled with a combination of a player profile services + in game mechanisms to enforce the policies
Answer is YES, of course, but it's not something you get just out of the box (it's always game specific)
As for the lobby you mentioned, this has not to do with Quantum. I'd say
Quantum would be for the actual gameplay match... You have the photon room where all game clients must be connected to (in order to start the quantum session - coordinated by the room server plugin).
In there you're free to use photon realtime features to communicate anyway between clients (and combine with backend checks via the server plugin - in case you go that more complicated route)
So maybe I didn't understand right... If you're talking about an in-game-match items store (like League of Legends'), then that's easily implemented using Quantum's deterministic commands + data assets
I'll talk to you over email @stray scroll
Hmm I'm talking about having a game world as lobby. I think dungeon defenders does this for reference. So not match lobby but generic lobby.
Is this your main gameplay
It depends on how many players you want to have in there
At the same time
And what they are doing while in there, what kind of interaction
And for the store, how you implement it (as a tightly controlled store with quantum apis, or a separate backend-based store)
depends on what it is really.
Is it a store for items to use when you "enter the dungeons", metaphorically?
Then it'd be backend-based IMHO
Quantum is for this:
- player interaction, specially when you need accuracy, fast pacing, physics, etc
Hmm ok, I'll send an mail later more specified :)
2nd one I think I played with this kind of setup
Both Dungeon Defenders are online multiplayer
Saw on the Steam page only single player + screen-share
Maybe I didn't see it well, let me confirm (not doubting, from the trailer it looks online, yes)
Remote play together = streaming...
DD 2 says it all:
Are there VAC enabled singleplayer games? π
Not sure why it multiplayer isn't listed there
Maybe there is some limit to how many features you can show there π
yeah, maybe
G'day, gentlemen.
What's a proper way to make multiplayer in Unity in 2020?
Since UNET is deprecated, should I use Mirror or Forge or whatever? Any success stories?
What kind of game(gameplay?
Was UNet ever the proper way? π
What kind of game(gameplay?
@gleaming prawn Something RTS-like. 2-8 players controlling multiple units.
?
Honestly, for an RTS, the only tool that would give you the right stuff out of the box for an RTS is photon Quantum
Was UNet ever the proper way? π
@spring crane At least it worked somehow. Though Mirror is advertised as "better UNET with fixed bugs"
Neither UNet, nor mirror, nor photon bolt, or photon PUN (put your state-transfer lib here) would be the right tool for an RTS
The creator spent few years IIRC trying to fix UNet for use of his projects
Honestly, for an RTS, the only tool that would give you the right stuff out of the box for an RTS is photon Quantum
@gleaming prawn I can't afford it ($1000 per month, right?), my game is just a hobby project
Mirror is super nice, yes
Just not for an RTS
Well...
If you search here, I describe what you need
Is not "rocket science"
You can do your own poors-man version of this (very simple though)
I've recently discussed a lot about RTS here
I said out-of-the-box: quantum
Seems like a wiki needs to be made on this regular topic
who to like gmod 12?
But you can certainly implement:
- FixedPoint math (just search c# FP48.16 on stack overflow)
- Your own determnistic simulation (with flow fields path finding, etc);
- Your own lockstep (not fancy server-based predict/rollback like quantum) library;
You can use any basic transport layer like steam network, photon realtime free, etc
BUT, you need to start with the basics:
- RTSs need determinism
So you can forget Unity Physics, Unity Navmeshes (and most asset store assets)
Seems like a wiki needs to be made on this regular topic
To replace that infamous blog post, lol
@jade glacier
LOL, yeah... that thing
And including reference to all existing production libraries from photon, mirror, and all vendors (free and paid)..:)
Start with that, and run lines through sections and correct them @gleaming prawn π
A lot of people say "hobbyist networking", but even that needs a lot of clarification. Like there is nothing "hobbyist" about trying to make an MMO that supports 100 players.
There are very very few exception to this rule @verbal oar : (RTSs are deterministic)

I understand all of this, BUT:
- what about handling pathfinding and interactions on authoritative server?
- why I still need lockstep in 2020? It is just techique to reduce traffic and bandwitdth requirements. There is even an at least one RTS game (Planetary Annihilation) working perfectly without lockstep
One of them is planet annihilation, and it's not a simple model to implement..
A lot of people say "hobbyist networking", but even that needs a lot of clarification. Like there is nothing "hobbyist" about trying to make an MMO that supports 100 players.
@jade glacier I wouldn't ever need more than 6-8 players
- you don't need this... that's the whole point... Determinisim is authority... You just store the replays...
If you can live with latency for the players, server side non-deterministic is doable, but transferring AI states will decimate your bandwidth usages among other issues.
Using a server to mediate input exchange is enough to have fully auditable game results in an RTS
And RTS is a massive achievement @verbal oar
It's not simple
Lol, you got the point
Planetary Annihilation is a SUPER nice model, indeed...
But it's completely UNIQUE (and difficult to implement - there's no tool around doing that for you)... AAA studios today still use Lockstep... It's a perfect technique for RTS
Reason #1 to use determinism for an RTS (not mandatorily lockstep, although RTS under predict/rollback is overkill):
- easiest way, BY FAR, to implement an RTS, and get A LOT of features out of the box (replays, authority, low bandwidth, etc)
That's it... This is a super repetitive topic IMHO..:)
- Planetary Annihilation is awesome, but there's a reason other studios are not trying to do the same (it's not simple to implement)
And also: servers are EXPENSIVE...:)
Well... Ok, thanks. So there is no easy way to get rid of lockstep?
But my initial question was about which networking library for Unity should I use?
And also: servers are EXPENSIVE...:)
One of players can also be a host, I suppose
First, why do you want to "get rid" of it... This is the first question you should ask
π
One of players can also be a host, I suppose
Super complicated for an RTS
Lots and loads of bandwidth, requires reliable punch thrugh
First, why do you want to "get rid" of it... This is the first question you should ask
It has some downsides though
First: lockstep is NOT bad if done correctly... It's done all the time...
Super complicated for an RTS
I was sure that most of RTS uses this model