So, I bought tnet3 the night before last, tried running the server on my odroid c1 quadcore ARM SoC with 3.0.1 and it crashed; got the 3.0.2b update and it's working fine now.
Unzipped the server source and built it, watched the binary run on my odroid with htop, and started going through the example scenes.
I was playing with the multiple channels example and spawned massive amounts of cubes in each channel; and had fifteen clients connected. Things worked pretty much as I expected.
I've been poking through the classes, and notice there's http/websocket support, new ipv6 support, and SendQuickly to try udp if possible.
If possible, I'd like to provide webgl builds as well as win/lin/osx builds of my game.
One of the things that wowed me in the demo video was loading the assault helicopter asset.
Can serverside assets be streamed to webgl? Am I better off giving up on webgl if I want to deal with loading player-exported assets?
How do I provide my players with a unity3d scene suitable for exporting content?
I have access to extremely large servers, a quad socket opteron with 32 cores and 128GB of memory, or 4 dell C6100 blades with dual xeon E5520s and 48GB ram each for 192GB total.
I intend to build a first/third person shooter on a ~9.8x9.8km area of terrain, with all objects being droppable and persistent.
This means things like: Weapons, Ammo, bullet casings (brass), first aid kits, briefcases containing multiple items...
I have a working pickup truck with an ik-based steering wheel and my mechanim driven player characters using a third person chasecam.
I have not yet added a first person camera or attempted to resolve the problem of syncing mouselook to an avatar's head rotation and spinal curve.
In particular; the player characters I'm using have an odd rotation to the spine in a few of the various 3D models (Ruffian, police Swat, civilian, worker, clerk) so I'm thinking of improving and adding a second avatar with no mesh, and only the hip, spine, and head joints and writing a short script to override the animation controller on the meshed avatar to follow the 'shadow' avatar via IK. The shadow avatar only needs to exist for player-controllable avatars. Preferably, it would be a prefab that would instantiate the meshed avatar of the player's choice. I think this would allow me to deal with AI-driven avatars as well, but my question is, where do I put that logic, as tnetserver does not seem to simulate a world?
Do I run a unity client in a VM with some kind of account with special permissions on tnet? (admin?) How does Admin work, anyway? For that matter; how does the lobby work? Can it redirect to another IP? Can multiple simultaneous sockets be open from the client if the lobby server and channel host are on different systems? Can the lobby server instruct the client whom to connect to next already, or do I have to write additional classes for tnet server to deal with routing?
To keep with the idea of server authority, I'll be writing the input scripts separately from the scripts actually pulling the strings inside the spawned avatar, syncing input frequently -- but what is the best practice to sync the avatar's state? Do I sync the character controller somehow? The animator? The 'shadow spine' should be enough for player controlled characters in first person along with syncing some animation booleans of which state they're in (such as reloading a weapon); but there's also a dead state where the player is a disembodied camera that can wander for a while before respawning, leaving the avatar behind as a ragdoll.
At a high level, what are the tnet functions I'd be doing for handling player characters like this?
What about entering a vehicle? What's the best practice to reparent a player avatar as a child of the vehicle? With unet this proved extremely hard because initially I had it set up so players and vehicles both had networkidentities; reparenting a player to a ladder worked (no networkidentity), but reparenting a player to a vehicle did not. What I ended up doing in an earlier demo was adding an IK point on the car seat for the hip bone and having IK drag the player along with the vehicle without reparenting after handing off input control.
Over UNET this sort of mostly worked and even had the hands yankin' the steering wheel around through the IK targets... but eventually he'd start to drift. I have a screenshot around somewhere of his hip somewhere in the hood with his arms pinned behind him still desperately trying to fondle the steering wheel to control the pickup. I still think that given a server-authoritative architecture, I should be doing more things like using IK pods on the avatar's hands and setting world items to follow the pod, while exposing the magazine's grasp point as an IK target for the detach/reload animations lerping to work without having to make a whole bunch of custom animations and figure out how to sync them. I figure just let the IK solver deal with it on the clients and hand-wave away draggy-laggy items. Reparenting things when networking is involved just seems like a recipe for things getting out of hand, I don't know why, I just have that feeling after dealing with UNET. Hoping someone will tell me "nah, reparenting works fine in tnet, just do it like this:", I guess.
I haven't yet started the conversion over to TNET3 so I'm trying to figure out the recommended way to do things before diving in and wasting a whole bunch of time spinning my wheels.
From the tests I did on the odroid; it seems like TNet is a store-and-forward setup. However, it stores state to disk in a format that doesn't look like it supports being updated concurrently.
(This means I probably shouldn't run it more than once from a central SMB/NFS share.)
Do I write new code to store lots of little files and pray I don't run into a multiple writer situation? (seems to work for sqlite in practice)
That brings up the question, given that I have a choice between a single large multithreaded server or four independent blades, how best do I scale my game to meet a higher player demand?
The channel system seems like it will work pretty well for my large terrain, splitting areas of concern up and allowing the use of multiple scenes in unity (since punching a hole in a terrain's so hard, I made a crummy model of an railway entrance with a barred gate, jiggling the lock will trigger the scene+channel change, I imagine) but I'm not exactly understanding a good strategy towards growing even bigger. As players do their thing, resources will spawn, things will be crafted, and lots and lots of data has to be stored.
So, I probably want to back this with some kind of persistence in a database. One that's clustered, scales easily, accepts a common interchange format, and has a .net driver.
If those are my requirements;
rethinkdb seems like a pretty good choice, given it stores json documents, has a .net driver and the most recent version adds access control.
There's two .NET drivers:
https://github.com/bchavez/RethinkDb.Driverand
https://github.com/mfenniak/rethinkdb-netBoth of them have a minimum requirement of .net 4.5, although rethinkdb-net suggests it is "100% compatible with Mono (3.0+)", I still couldn't get it to work within unity itself and UNET.
But tnetserver doesn't rely on the unityengine namespace, and can be compiled against the 4.6 target according to this topic:
http://www.tasharen.com/forum/index.php?topic=14259.0Given that's the case; what kind of plan of action should I put together if I wanted to store data in rethinkdb? One of it's better features is being able to register a 'changefeed' on a document or document value and get an event delivered when it changes on the server.
With that information in mind; is it going to be worth spending my time implementing support code in tnetserver for accessing rethinkdb/paying someone else to, or should I start thinking of a different scaling strategy to deal with hundreds to thousands of concurrent players in a semi-seamless large region?
Since I've outlined pretty much everything about my requirements and plans; anyone wanna PM me a quote in USD after looking over rethinkdb and the drivers?
If it's useful; I've got no problems with the end result showing up in tnet itself for everyone to use, if that has any discount for sharing, I'm all for it.
I've tried various photon setups on previous projects, bolt and a trial of PUN, various other stuff in the asset store
like this mysql client thing and trying to port one of the rethinkdb .net drivers to unity's outdated flavor of mono, and Forge has to run inside a unity process...
I've got my own server hw that I only have to pay a power bill and hurricane electric 100mbit uplink, so I really don't want any of the cloudy-stuff that's so popular.
(Sorry for the huge post; but I've got a lot of complex questions, and I suspect other people'd like to know the answer to at least one or two of these themselves, but are too busy doing other stuff to ask)