<a href='http://playrust.com/friday-devblog-16/'><img src='http://files.facepunch.com/garry/2014/July/11/2014-07-11_19-24-49.jpg'></a> Has it been a week already? Man, this week has really flown! Here's what's kept us busy.11 July 2014
Andre has been working on the AI. I've explained why AI is taking so long before, but I will explain it again incase you've just started reading our blogs. The old AI used Unity's built in navmesh stuff. The mesh for the island was 400mb. We can't use that stuff on the new island because everything is procedurally generated, we can't pre-bake a mesh. It has to be dynamic. That's what Andre is on top of here.
There was a longstanding bug where when you disconnected from a game it turned night and thirdperson and your player fell through the world forever. This is now fixed, you can disconnect and rejoin another server just fine :)
Walls are in. You can place them on terrain without a foundation at the moment. I'm not sure we'll be keeping that functionality. But I definitely want to add fences and 'garden walls' at some point.. because that would rock.
To stress test the servers I've made placing foundations and walls really cheap and quick, and knocking them down really hard and slow. This means that when you join a server you're probably going to see this.
It gets worse.
I am trying to work out if we're being dumb about the building system. Whether it should be block based or something. Trying to think it through more before we fully commit.. that's why everything is programmer art so far.
A string table is a bandwidth saving system. Instead of sending words over the network multiple times, certain words like entity names are pooled and are referenced by number. This means that instead of sending 7 bytes for the word "entity" you can send a 2 byte integer.
There was a problem in the string table system where the client could sometimes add their own values to it, meaning that all the strings got messed up. This could cause the client to spawn the wrong entities. This is why you sometimes saw a tree running around like a player.
Something I've been meaning to test for a while. What if the foundations were orientated to the ground you place them on, so you need to place them on nice flat ground? It was a one word change in the code so I decided to enable it and see how we get on with it.
It obviously makes for some pretty unrealistic situations, and would probably end up in us having to add some kind of building stability stuff. But to be honest we're probably going to have to add that anyway at some point.
Ragdolls now properly transition from the player's model - instead of just appearing sprawled on the ground under where they died. This works for wolves too!
You can now see and hear other players shoot their weapons, with muzzle flash and shooty noises. Your viewmodel has muzzleflash and shooty noises too!
Anyone else get the feeling that Goosey really loves animating animals? All those years wasted on Counter-Strike when he could have been working on a game where animals move in an animated fashion. He's been working on the deer this week!
We've had a problem in Rust since we added building. People build too much. In Unity there's a collider limit of 64k and with 100 people on a server we can hit that easily in about 10 hours. Unity5 uses an upgraded physics engine - so this is fixed, but Unity don't love us enough to give us Unity5. So in the old version of Rust there were a few hacks to help us overcome it. At the start of the game all the tree's colliders are merged into one big collider. That's why we can't remove trees in that version. That saves about 5,000 colliders. Next when you're building all the connected colliders are merged. This works but it's a hell of a lot of fucking about to make it work and even more fucking about to make it work without lagging the server. Then you have the problem of a player shooting an object - it's hitting a compound collider.. you need to find out which object it actually hit.
So fuck that shit. You can become a slave to workarounds like this.
In this version the world is divided into a grid for network reasons. A player is only sent the objects in adjacent cells. So because they're already in a grid we can look at each object and say.. there's no player subscribed the cell you're in.. so turn your collider off. And this works so far. It's keeping us well under the limit. The limit is still there but hopefully this cheeky fix will hold us off until Unity5 comes out.
More speed, more optimizations. Items were using ScriptableObjects, which are great because they're automatically serialized and you can view them from the editor and they have a nice Destroy function. But it turns out they also eat memory for breakfast relative to a regular class, especially when you have tens of thousands of them lying around. So they are all just plain old classes now. And it's all good.
Before (memory used in bytes is on left):
It's worth keeping in mind here that we might not have the same amount of items lying around at the end of this graph - but at the start it's exactly the same situation. And I'm seeing a nearly 100mb difference in Unity's memory usage. Yikes!
Also we had a few situations where we were using InvokeRepeating to call functions every second etc (which seems like it'd be a slow way to do it, but it isn't). When we had multiple ones of these running they would eventually bunch up so they'd all be called on the same frame, which could cause a tiny < 50ms hitch. We fixed this by varying the repeat time on each one by about 1% - which meant that if they all managed to get bunched up, they would un-bunch automatically over time.
We got some decent stuff in this week, we learned a few things and we made a few things better. Multiplay are now hosting some test servers for the Experimental version.. but they're probably out of date already.
Most of the cleaning and optimizing is done now. Next week I'm going to set up a list of easy, low hanging gameplay fruit and just pile through it. Our goal is the baseline - every feature currently in the legacy version. It's going to be a few weeks until we get there but once we do it'll be a case of balancing them moving forward with new stuff to encourage people to move over to this version.
The comments are back. Please don't post erotic stories again.
If you want to follow this project you can sign up to the mailing list.
We'll only update you about this project, we won't spam you about other stuff or sell your email address.