I’m going try putting out scheduled fortnightly news on what’s going on with Scraps. That way you can stay informed on what’s happening, and if anything it might help make sure I’m always working on something significant as well. If there’s a builder demo update to release, I’ll probably do it at the same time. Right now things are in the middle of big changes, and things aren’t stable or tested enough to release just yet.
I’ve heard that in the USA the word “fortnight” has fallen out of common usage and “biweekly” is often used instead. Biweekly can be a little confusing – even some dictionaries have definitions both for “every two weeks” and “twice weekly” – so let’s stick with the glorious Commonwealth and have fortnightly updates.
Code, performance, bugs
So what have I been doing recently? Mostly code cleanup and code refactoring so the game has a better base to move forward from. Some things were a bit of a mess internally, not horrible, but enough that it was letting random bugs start to creep in. This stuff has a little bit more work to do on it, then hopefully that’ll be all that’s needed for a while and I can focus heavily on new content. I don’t want to be one of those people that spends forever optimising their code and never actually releasing games.
Anyway, there’s now a massive performance improvement when building large vehicles. No more long delay when adding or removing parts from vehicles that have hundreds of them. No short delay even. Parts and snap points now go into a couple of custom dynamic octrees, which lets me calculate stuff like “will this part collide with that part?” or “is there a snap point nearby?” much more efficiently. It’s a big tree graph of what’s in the world divided up into cubes, which divide into smaller cubes etc. If I draw in the edges of the cubes it looks like this, which the redder cubes being inside the bluer ones:
For those who know octrees, the Scraps implementation splits or merges nodes as needed (when enough parts are added or removed), grows or shrinks the outer bounds as needed (when the vehicle gets bigger or smaller), and is a “loose” octree (which helps with stuff on the line between regions). It also converts any internal positional data to cancel out the position and rotation of the vehicle base, so the octree doesn’t need to be updated if the vehicle base moves around.
That last point (and some related work) also means that the vehicle no longer has to snap to a flat position when holding a part. Time still freezes, but it makes things a bit smoother. If Unity would let me compare oriented bounds instead of AABB bounds, this would have been possible sooner.
- Rewrote the whole system for checking weapon range availability. The old system started off simpler but had too many annoying edge cases to cover. All the vehicles I know of that had issues with the old system get correct results now. Hopefully that means everything does. The calculation of the “best” option for reducing the range to fit is also sometimes a little better now.
- Bullets don’t look like they’re firing with their casings still on anymore. Oops. Bullets and their separate casings (large cannon, medium cannon, and casings only for the machine guns):
There’s also a crash bug in the current builder demo release where the game can crash going from the test map back to the build screen. Fortunately for players, but unfortunately for me trying to fix it, it happens very rarely. It also doesn’t have any clear steps to reproduce. It happened to me once, so I’ve at least confirmed it, but repeating seemingly the same steps gave me no luck reproducing it again. I need to take a deeper look at it – it looks like something to do with the physics loop trying to reference something that’s just been deleted as the test map scene unloads.
A few people have asked for walking mech bases in Scraps. Although Scraps will eventually have a few more propulsion options (tracks, hover, maybe others), it won’t have mechs exactly, but you might like to check out M.A.V.. You build a mech and fight other people’s creations, it’s also made by just one guy, and he’s got functional multiplayer that looks pretty great. It’s not available for purchase just yet but it’s currently running a Kickstarter campaign, and doing pretty well by the looks of it too. Chromehounds and MechWarrior fans will feel especially welcome.