More Stuff I did
Thursday, January 26, 2012
I feel like rambling about the stuff I did. So here goes.
I made a single file addon system for GMod. This is what it sounds like - a single file which contains a bunch of other files. It gets mounted on the filesystem so that the game sees no difference between files in the addon and files in the normal folders.
This is a lot faster than the old way of mounting folders. I've said this before but every time you mount an addon it makes your loadtimes a little bit worse. This is because it's adding the folder to the search path, when it's looking for a file it looks through all the search paths. Most of the time it doesn't matter because the file is usually found in the HL2 content - but if it's not it falls through. The biggest hit is when you search for files in a folder - which isn't exactly super fast anyway - nevermind when you're searching through 100 extra paths too.
So why doesn't that happen with the new system? Because the addon contains a list of filenames. When the addon is loaded the filenames are added to a tree. This tree is super super fast to search - especially compared to searching the disk. Problem Solved.
Well Hopefully. Only 4 addons exist for the new system so far, so we'll see when the next beta comes out and people start pumping the addons out.
The new addon system uses Steam's new Workshop feature. It's totally awesome - and was really incredibly easy to get it working in GMod. I'm looking forward to exploring and finding more uses for it.
The GMod's Workshop Addon Distribution System has some pros and cons that it's nice to be aware of.
- Fast Downloads via Steam's network
- Easy, simple installs - no messing with files
- Can be used inside or outside of the game
- Integration with Steam
- Addon Ratings
- Addon Comments
- Addon Reporting
- Automatic Addon Updates
- No Delta Updates - download the whole addon again (which isn't that much of a big deal really - is it?)
- Filesize restrictions. I'm told this is a temporary thing - Steamworks is in its infancy. The biggest file I've managed to publish and re-download was 40mb (compressed).
- Haven't figured out a way for it to work with servers yet
So a mixed bag. It's great right now and it's only going to get better as time goes on. Steamworks is a revolution for GMod.
Someone on the forums reported a bug. When you started Lost Coast the camera got stuck and you couldn't move. So I looked into it.
Someone suggested that the spawnpoints were broke. There's 3 spawnpoints and we're spawning at the wrong one - we should be spawning at the one with the master flag. I checked out my spawning code. It did just that - spawned at the point with the master flag. I compared it to the engine code - yep - same.
So I got in game with all the debug output on and saw that some trigger was being enabled but not triggered. So maybe somehow I changed the player's collision group, or changed which collisions collided with what. About an hour running through this, stepping through the debugger trying to find the problem. Running every ent_ command in game. Downloading the Lost Coast map source and analyzing the players.
Turns out my spawning code had one little difference. It returned the last player entity with the master spawn flag. The engine code spawns the first. And yep - all 3 spawn points in the lost coast map have the master spawn flag. As soon as I made that change it worked perfectly. Doh.
I updated GLua's file library this week too. I added backwards compatibility to some of the legacy functions - but a couple of them are changed.
You should check out this document to see more details.
Something I always hear people with foreign keyboards moan about is that they can't find the console key. So in GMod 13 it's bound to F10 by default too.
I'm going to bed now, but here's a list of stuff that is in the next beta.
And here's a list of everything in the previous betas.