Scraps version 0.5.2.0 is now live on Steam. I’ll go into some more detail but here’s the changelog first:

0.5.2.0

– Added full turret versions of the MMG and Medium Cannon, and a semi-fixed version of the Large Cannon. Balanced other weapons to match.

– Added Large Chassis.

– Some in-game CPU performance improvement, particularly for vehicles with many parts.

– Major in-game GPU performance improvement.

– Switched from DirectX9 to DirectX11.

– Increased max scrap limits a little (40,000->50,000 for 8 players. Select less Max Players for more).

– Build screen inventory shows a little icon next to turrets (weapons with full y-axis rotation).

– Small and Large sizes for the Proximity Firing mode.

– Made the spinning camera effect in menus much slower (it hurt some people’s heads).

– Increased max suspension spring value by 25%.

– Darker shadows.

– More outlines on stuff.

– By popular request, leaderboard now only shows while the key (~ by default) is held.

– Background music for Round End and Game End screens.

– Other minor audio changes.

– Changed the angle calculation for projectile weapon trails – looks more “correct” when shot from moving vehicles.

– Added something to the Test Map?

Bug Fixes:

– In-game messages now show the correct amount of points a player earned from destroying another vehicle.

– Fixed weapon “can’t fire” sound playing too much.

Weapons and Large Chassis

The new turret versions of the MMG and Medium Cannon can rotate fully around if the space is available, but cost a bit more. They should help in the early game against opponents who’ve unlocked other turret weapons. The semi-fixed version of the Large Cannon is cheaper and a little stronger.

One minor note: Currently in the “same type” weapon link mode, all the weapons are considered as different, whereas I’m sure it’d be better to have normal and turret types of the same weapon linked together. I’ll change that in an update tomorrow.

Performance

The other major work in this update was on performance (check the changelog above for all the other, minor stuff).

I learned some graphics magic and implemented that to drastically reduce draw calls on the GPU, and graphics performance is now much improved. You might get a framerate that’s improved 50% or more in some cases.

In fact GPU performance has got so much better, that the game is now often heavily CPU bound when dealing with complex vehicles with lots of weapons, mainly because of all the physics work. I also did some physics optimisation in this update, but it’s not as drastic as the graphics improvement. I’ve pretty much optimised things as far as I can for now, and the next big step might be upgrading to Unity 5, since it’s supposed to have improved physics performance. Unfortunately before I update the game to Unity 5 I need to write a custom wheel collider (or buy someone else’s one), because the built-in wheel colliders have changed completely and can’t work well with Scraps anymore.

Graphics Batching

A few technical details here, particularly for Unity devs. The graphics improvement came from being able to combine more vehicle parts.

Unity developers will probably know that static 3D models – things that never move at all – can be marked as Static and get automatically batched by the graphics engine. Separate meshes, as long as they use the same material with the same shader, can be combined into one draw call, which means less work for the graphics card (although I’m no expert on how this stuff works exactly).

All parts on Scraps vehicles use the same material. All the part textures are baked into one big texture atlas image (think like the Minecraft texture file, but much bigger), and data in the vertices of the parts themselves determines whether they’re shiny or dull, or damaged, or hot – allowing the whole thing to use the same single shader.

But that’s not enough to get batching working on its own. Unity can do a small amount of “dynamic batching” – batching for objects that aren’t Static – but its limit is only a few hundred polygons. One vehicle part has a few hundred already.

On the Build screen, your vehicle is always made up of the individual parts that you’ve placed. But one thing I was already doing is taking all the parts on a vehicle that don’t move (I mean, the whole vehicle moves, but those parts all move together with it) and combining them into one big combined mesh when you entered a game. Having one combined mesh is the final tipping point to getting everything batched and reducing the draw calls. (When parts get destroyed I zero the appropriate ones out.)

That helped, but I couldn’t combine anything that moved on its own, like weapon turrets and spinning fans, and there was still a lot of that.

Here’s the trick. Unity devs, listen up, because I know there are others out there searching for the same powers I was searching for. Even batching stuff on the Asset Store often does less than this.

You can combine everything, and have the GPU do the transforms directly on the vertices of the parts that move to put them wherever they need to be. Create one model and change the model as you go. You could write a shader to do it, but you don’t even have to, because Unity has built-in support for it. Ever used SkinnedMeshRenderer to animate something with bones? The transforms of the separate moving vehicle parts can be the bones! The Unify Wiki even has an example of how to do the conversion!

So now I combine everything, and it’s real fast. There is a little bit of overhead in doing the transforms: People with DirectX11 or newer cards, you’ll be doing it on the GPU (Unity devs, check your Player settings for the checkboxes to enable this and DX11 mode). Those with DX9 or DX10 cards will be doing it on the CPU. But it’s a small amount of extra work either way compared to the gains in total performance.

Please use these powers responsibly.

What’s Coming

For the next few weeks I’ll be working on the Mac and Linux versions, with a plan to hopefully release those publicly on the 28th or 29th of this month. I’ll be seeing how crazy or sane that deadline actually is in the next couple of days as I start testing on those platforms again.

I’m also aware that the multiplayer has gone quiet recently. I always feel especially sorry for that lone person on a server when the stats read 1/8 (sometimes I join for a few minutes :)). I’ve been doing what I can with both some paid and unpaid marketing, and I have more to do, but the best thing I can really continue to do now is make the game as good as possible.

So the next major thing I’m currently planning to focus on after the Mac and Linux releases will be some expanded single-player content. I have a plan but I won’t elaborate on that just now. That way even if things don’t pick up multiplayer-wise there’ll be more fun single-player stuff to do, so you shouldn’t miss out too much either way.

Of course there’s already the AI (and you can always Multiplayer -> Internet -> Host A Game with AI to play against, that’s open to humans to join as well), and the Scraps demo can also join LAN games – so only one person needs to own the full version to play on LAN. Or if you can find some people that do have the full version, you can also host your own Internet games and they can join.

Thanks for continuing to follow Scraps. :)