AI Optimizations
Servers are working pretty well right now. They can support 100 players without breaking a sweat. When you start getting into 200+ players things start to get a bit sweatier, and the biggest perspiration is the AI.
So I did a bunch of profiling and worked out a few ways that should make it more stable. The AI was set up to think on intervals, and to randomise those intervals so they don't all think on the same frame and cause spikes. This wasn't exactly working: after a small lag spike caused by something else, the AI ticks would bunch up again and then slowly spread out. This could cause a snowballing situation where the AI would tick slow, causing the AI ticks to bunch up.
User Info
It's not sexy, but we now have userinfo. What this means is that the client can set variables that the server can read. This works the same as in the Source engine.
We're only really using it right now for god mode and skin changes. Admins can set "god true" in the console, which will set their userdata, then the server will know they can't receive damage. Previously this variable was global to all players.
We also added skincol, skintex, skinmesh userdata. They change the player's skin color, skin texture and skin mesh. We didn't want to add these, but people started requesting them for machinima. The thought occurred that it might be nice to now add these and have the machinima guys hire actors based on their in-game looks, but in the end we figured if we don't add it some server mod will, so we might as well make it easy. They are admin only.
Mesh Collider Optimizations
I had a bunch of code for building skinned mesh colliders. It took all the vertices, all the bone-weights, then it multiplies all the vertices based on the bone-weight matrices, then created a new mesh and set it as the collider. And this worked pretty well. Then I found SkinnedMeshRenderer.BakeMesh which does exactly the same thing, except in native code so it's faster and doesn't create any GC churn.
All those words mean it should reduce the lag spikes that happen when shooting.
Map
I started working on a map system this week. A map is a long requested feature, but I think we'd be missing a bunch of gameplay opportunities if we just made a straight up map, so I'm trying a bunch of things. I've got it rendering and navigable so far.
With the awesome work Andre and Diogo have done on the terrain system, we already have the terrain normal map, height map and splat maps at hand, so it's trivial to throw them all in a shader and have it render a top down map that looks kind of legit.
The hope is that the map will only show areas that it's been in and you'll be able to draw all over it. This should be in next week.
The Rest
- Fixed sign texture disappear.
- Menu building caching (perf. increase when looking at something).
- Spectators can use chat again.