Hi,
I’m creating a game for ~1000 players, I want them to play simultaneously on the one unity scene.
I don’b believe that UNet can handle it.
I’m looking for better library to handle this semi-massive rpg game.
I want to implement my own network behaviour and the engine that sync object depents on thier position, to avoid synchronization between every player-creature if they are not even close on the scene.
The second issue is the scene, I want to use ~100 terrains simultaneously (I dont want to use separated scenes).
The problem here, is Unity. If I create even empty scene with 10x10 terrain, unity will load the whole scene into RAM and it will be more than 4GB for just empty scene.
I’m looking for help, maybe you know some assets/librares that can help me with my issues.
I would love to use already created library that can handle server with ~1000 players, creatures, scene items etc.
I thought about something like minecraft chunks for synchronization.
And second issue, do you know any library/asses that can help me with dynamic load/unload terrains on the scene also similiar to minecraft chunks, to avoid situation when game client consume 10gb of ram for the running game…
I dont use physic in this game, is old school (ultima style) isometric game.
With 1000 CCU to a single server at maybe 10 updates per connection per second outgoing from that server - you’re looking at 10k outgoing packets per seconds (or if the server runs at 50 fps internally - that’s 200 packets per frame). I think you’ll agree, that’s not going to happen with uNet or any other networking system.
My best guess is that 200 CCU is a more reasonable expectation for a single server, so you are looking at an architecture of some sort of load balancing system with multiple servers. The cost of which could easily ramp up.
Terrain streaming would need to be handled by a separate host of servers due to the sheer quantity of data you’re looking to stream.
Don’t mean to piss on your chips, but there’s a reason such grand ideas aren’t already out there, especially in the indie world. Reign things in a bit, and go for something smaller first. When you’ve got that working, you’ll have a better understanding of the limitations, costs, and timespans involved. Then you can push the boundaries a bit further.
Thats why I consider to create my own network behaviour implementation.
If player is on the 3,3 game square I can synchronize 3,3 2,2, 2,3, 2,4 3,2 3,4 4,2 4,3 4,4.
If server know what the position of each player-creep is, than I can synchronize only the part of object for this specific player.
So I can aggregate all players from the 3,3, prepare synchronize package, and send it to them. (Information about all network objects that are around of them.
The map issue probably can be resolved by using one big mesh instead of 100 terrains.
It is harder to develop but it should works fine on the game client.
You’re describing goals and suggesting there are roadblocks arbitrarily. Without an understanding of how these types of things happen, you’re not going to be making anything of that scale any time soon. Take plenty of time to research and understand how network architecture should work for your scenario.
I’m pretty sure how it should work for my scenario, I even have a plan (I just found there is a new c# open source game engine). Big issue for me is the fact that Unity is totally incapable to handle bigger amount of objects. I spawned 400 mock creatures on the scene with one player on the localhost, and after 2 crashes, when I successfully logged into the game, there were terrible lags with ~30-50 creatures in the camera view. These creatures just fallowing player and hitting him (with the logic handled by server ofc) and it was unplayable. I wrote thesis about code optimization and I believe that I’m a quite good programmer but in this case I just can’t jump over this engine. I don’t want to represent game on the server side by scene. For now I’m creating turn based strategy game with separated server logic where unity client is just a tool talking with engine and its fine but in a case of rpg I need too handle much more, for example raycasts without scene representation to avoid cheaters and keep almost all logic on the server side. So if I will need more servers to handle one scene there is additional issues. What if the player is on the edge chunk, and the next should be handled by another server and I want to hit player that is already handled by second server? Edge chunks should be shared between servers and its going to be really complicated. So anyway thanks for help, I have 1.5 - 2 years to start this project so maybe i figured it out until this moment. Nice material Wobes
If you haven’t LOD system, or your models aren’t optimized you cannot expect good perfomance especially if they are in the camera view, and the problem is not the Game Engine in that case.
If you are trying to sync all of those creatures between all clients every frame then poor networking design relative to scope is your problem and no game engine is going to fix that for you.
I attached most involved mock-skeletons scripts. I’m using network transform to sync positions.
Ofc there is some more logic for handle receive dmg for example but nothig special.
LaneFox, I’m testing this on the localhost server with only one client. So I synchronize 400 cubes to this client. I’m not sure that the network is the main problem here. Some of the movement “ifs” may looks like redundant but these are required to handle most of the scenarios.
You mean “Target.GetComponent().ReceiveHit(result);”
It cannot be the main issue, I know that can be cached but I just prepared a test.
This is called only when creature hitting me, hardly. With there is 100 creepts it works fine ommiting spawning moment but with 200 there are lags, I’m not sure that these lags are caused by network or just by the amount of objects on the scene.
I just noticed that there is a memory leaks on the client side (server is fine). Soo with 100 creeps client consume ~350 mb of ram, with 200 it is around of 600mbs, but it grows quite fast. Ill need some profiler for figured it out.
It’s obvious that you don’t like me but anyway I’m glad for your responses.
I want to write a server side logic that split the whole map by chunks and thread every chunk as single server.
I’m sure that even if I handle separated thread for each chunk it will be not enought. So if the one client-server will be handled by couple of servers, that require synchronization form each server to master-server that can keep the current game state and neighboring servers should synchronize edge chunks with each other additional player should know how to synchronize with servers depends on his position (synchronization with up to 4 servers on a cross chunk).
I would like to resign from the scene representation on the server side but I can’t imagine how to handle raycasts then
That’s not true. We dislike that you come to the Unity forums, display a lack of knowledge about networking, have glaring optimization problems in your work, post partial code, don’t consult the profiler and all while you demand that Unity is the problem.
So that’s a pretty frustrating front to deal with. You seem pretty nice, but you also seem more interested in bashing Unity than getting actual help.
You are right and I’m sorry for that, I just had a problem with mono in my current project (even on the new 2017 beta there is no correct implementation for the net tcp wcf binding), I’m looking forward for the next project that I’m planning since I was a child and I already spend a lot of time to figured out how to handle it, and when I was on the straight way to goal I noticed that my game doesn’t scale enough. I can imagine how to goal it on the unity but anyway I have to implement a lot of code and I’m worried about - what I will lose from the engine features if I’ll handle synchronization by my own. I’m not sure how unity handle prefabs spawning thorught the networking.
Maybe when I test this world streamer and handle this memory leak then I’ll be fine.