s&box
24 November 2017

Devblog 6

What we've been working on this month.
Key Binds
Because this is a prototype, we hadn't got a proper key bind system yet. Instead things are pretty raw.
This was fine but it's got to the stage where we're debugging and trying enough things that we're standing on each others toes with the binds, and could do with ways to bind keys to specific console commands. So I added a key bind system. There's really two stages of the key bind system. Setting it up so you can bind specific keys to certain console commands is simple. Then you have to consider how that's going to be used for keys like "forward" that you want to query the state of, rather than running a command based on it. I used the same method we use in Rust. If you bind a key that starts with a "+", on key press it calls that string + " true", on release it calls that string + " false". This means you can have a console variable which is a bool and will get set true or false depending on whether the key is down. Or a function that gets a bool parameter to switch something on or off. I opted to create a special class for it.
This class implements IConsoleCommand, an interface the console system can talk to.
This allows us to do a bit of logic in the class to provide useful functions like JustPressed, JustReleased, rather than just IsDown.
Autocomplete Ingame
Last week I added autocomplete to webcon, now it's in game too.
Map Editor Ingame
Our goal for map making is to have it be just another gamemode that you can play ingame, hopefully with multiplayer support. Here's where I'm at with it. You can create brushes, move them, copy them and delete them. You can move and extrude faces. All of this is made easy by using a half edge mesh structure that allows for easy traversal of connecting vertices, edges and faces. I had a feeling that Valve used this same structure for their Source2 Hammer editor so I made an importer to find out. Cool, it works. All of this was done in an addon, so if you wanted to make something like this, you could.
More Asset Importers
In devblog 4 we showed you how asset importers could be made in C# addons. We already had an FBX importer but it was in C++, I've now moved this over to a C# addon using Assimp. Boom, we can now load any FBX and spawn it as a mesh. I did the same for audio importing. All nice and clean! The only other importer left to move over is skeletal animations. As a bit of fun, I made an importer for SanAndreas maps and models to see if it was feasable to import assets from other game archives.
First Deathmatch Playtest
Not many people knew that we had multiplayer working so here's a video of deathmatch with placeholder assets.