Scraps: Modular Vehicle Combat cover
Scraps: Modular Vehicle Combat screenshot
Linux PC Mac Steam
Genre: Shooter, Simulator, Indie

Scraps: Modular Vehicle Combat

Moving back, moving forward

The last couple of weeks of dev have been a bit frustrating. I came up against an engine feature that I wanted which - my mistake - I had thought was in Unity 4 but was actually only introduced in Unity 5. Scraps has been halfway converted to Unity 5 for a while so I did a bit more on that conversion, tested the stuff I needed, and realised it still wasn't going to work anyway. Not a real loss of time because I'll most likely need to move the game from Unity 4 to 5 eventually anyway, but annoying because I want to get new content out as much as the next person.

I can actually show some work on content rather than code for once though. You may have seen the new pile of crates and barrels on the Test Map in the last update:



In the editor the crates look like the left image, but when the game is run they take on some random colour variation to look a little more interesting. Giving them all different Materials with different tints would blow out the amount of draw calls in the scene, so instead they all share the same Material, and the tint colour is set via the vertex colour on the mesh itself. Pretty simple code:


void SetTint(Mesh mesh) {
// Tint is set via mesh vertex data rather than in the shader properties,
// so that we can still use the same shared single material instance on everything!

byte colour255 = (byte)(Random.value * 255);

Color32[] colors = mesh.colors32;
for (int j = 0; j < colors.Length; j++) {
colors[j].b = colour255; // Setting the blue channel
}
mesh.colors32 = colors;
}


The meshes are simple so running through the array is super fast - but it only runs once on level load anyway. Then in the surface shader I use the blue vertex's blue colour channel value to do whatever - it's really just a way of getting information from the game to the shader.


// Any extra tint stored in BLUE channel
// fmod is % (mod). Using it to map all possible RGB values
float4 tint = 0.7 + float4(IN.color.b, fmod(IN.color.b * 2, 1), fmod(IN.color.b * 4, 1), 1) * 0.3;
if (IN.color.b > 0) {
c.rgb *= tint;
}


You may wonder why I set just the blue channel and then calculate a colour tint based on that rather than setting the whole vertex colour RGB and setting the tint to that value.

The reason is that a lot of things in Scraps are actually done this way - heat effects on vehicle parts, damage texturing on everything, and how shiny vehicle parts are (specularity) are all specified by modifying the different colour channels in the mesh vertex data, so that each vehicle can be shown with one Material and the environment can be drawn with another. So I need the red and green channels for other things. Otherwise every time something got damaged or heated up, it'd have to use its own Material and have its own draw calls, making graphics performance a lot worse.



I also made these barrels. The red one explodes of course. I wrote a generic script that I can attach to any world object to make it explode when destroyed and damage surrounding stuff.



Driving a vehicle by ScrapsEnthusiast there. Yesterday I also added subtle air control to the game, so that'll be in the next update. It's tuned more for gameplay than being realistic, but you can at least pretend it's created from the torque of the wheels spinning in the air.



And I made some light beam/forcefield-style walls that I can use to create more subtle level borders for some levels. Functionally they work the same as the current walls.



For the next game mode I need lots of terrain, so I've been improving my terrain creation workflow. I can now take a basic low-detail terrain and put it through my Scraps-specific World Machine setup to get out a terrain fairly quickly with erosion and varied texturing.



OK, the bottom one still doesn't look amazing yet, but that's without any grass, fog, sky, etc etc. It's a lot better than the top one considering the minimal manual effort involved. One thing that's not obvious in the screenshot is that the "after" terrains also have more fine detail - so I can map out a fairly low-res base terrain and then run erosion on it to make it into a more fully detailed one.

Scraps v0.5.3.1

Today's Scraps update doesn't change anything exactly, but the install size of the game is now almost half what it was!

Basically there was a lot of duplication between the main game and server components. This was OK when the game was very small anyway, but it's been getting steadily bigger, so I've refactored things so there's no separate server app at all anymore. Now a server is just the main game with a server flag passed in, and all the duplication is gone. You can still host a game and play on it at the same time.

Scraps v0.5.3.0

The latest Scraps release is again focused on fixing bugs and generally making the core game better. In the background I've also been working on the new Singleplayer mode, but that's not ready to show off just yet.

0.5.3.0
- More efficient shader/material usage for environmental stuff
- Bigger shockwaves move faster (just looks better)
- Some new destruction FX
- Fixed some lightmapping glitches and improved some normal maps on terrain
- Added some new stuff on the test map that I've been creating for the upcoming singleplayer game mode
- Using the lowpassed music track in the lobby instead of the full one, it's more chill
- Added an additional vertical adapter block
Bug Fixes:
- Fixed multiple issues where games could get stuck at Dropship In Transit when starting games. Please let me know if this happens to you after this update
- Fixed AI sometimes being lazy and just hanging out until being destroyed for the first time, causing it to henceforth spring into life
- Fixed game start failing if scrap limit was changed lower, then deploy clicked right away, causing the limit to lower and make a vehicle selection invalid
- Fixed some incorrect cube weights on the Test Map
- Fixed shockwaves sometimes not showing up when they should

Two Dropship In Transit bugs - one that happened on going from menu to lobby, and the other while going from lobby to game - were horrible timing bugs that only occurred when the stars were aligned just right. The issues I found are definitely fixed now, but please let me know if you still get stuck at a loading screen in the future. Of course, report any bugs you find - I do try to fix things!

Working on a new game mode

It's been a bit longer than usual since the last Scraps update, so I just want to give some reassurance that I'm still working hard on things. There was a little time off over Christmas and New Years, but recently I'm working on something that I've alluded to a little in the past: A major new single-player game mode. My thoughts are that it should help a lot to flesh out the game content whether or not Internet multiplayer numbers pick up. I won't go into details of how it'll play just yet because I'm still testing things out myself, but I will in the near future. I think it'll be a lot of fun.

The new mode is pretty major, and is going to take several months to finish completely. I'll attempt to get some stuff out to try earlier, but I'll also keep doing some smaller game updates in the meantime regardless. The next game update will be next weekend but it'll be mostly bug fixes and minor improvements. Still, things are happening, and I'll have more to show soon.

Scraps v0.5.2.15

This update is mainly lots of bug fixing and code cleanup behind the scenes. I also did a smaller v0.5.2.14 update that I didn't make an update post for earlier, which improved CPU performance.

The specifics:

2015-12 - 0.5.2.15
- Added heavy armour part
- Better support for XBox 360 controller on Mac and Linux. Separate default key bindings keep actual inputs the same on all platforms
- Engine sounds with multiple of the same engine work together better
- Removed an annoying ridge in the RiverRift terrain
- Added some subtle fades between scenes
Bug Fixes:
- Fixed occasionally coming back from testing vehicles to the build screen and your vehicle has flown off into space somewhere
- Removed more false positives and not-really-bad words from the swear filter
- "Open save folder" button now working on Linux
- Fixed the loading screen getting stuck if your vehicle spawned in right as a round ended
- Fixed visual glitch between light beams and edge wall glass
- Fixed screen staying white if your vehicle was destroyed right at the moment of evac completion
- Fixed game modifiers (low gravity) not being unapplied on connected clients if the server shut down
- Fixed SkinnedMeshRenderer errors being generated in-game (in the background) if a vehicle had no moving parts
- Lots of refactoring and fixing issues with chassis, propulsion systems and their hit points and other values
- Tooltips for chassis select now include the extra HP gained from the wheels (so they show the actual full chassis HP now)

2015-12 - 0.5.2.14
- CPU performance improvements due to physics and rendering optimisation work
- Tweaks to the RiverRift map layout
- Swedish translation update

Have a good Christmas everyone. I won't be able to join the Weekly Game tomorrow. Thanks everyone who reported bugs that are fixed here.

Scraps Weekly Games reminder

A while ago a few people organised an unofficial "Weekly Game" where people would try to come onto Scraps multiplayer at the same time to play together. These have been going on for a while now and they're sometimes more popular than others, but if you're looking for people to play against, coming on at one of these times is probably your best bet:



There's no official server to join - either people join one of my official ones or they create their own with custom settings. Again these are just unofficial things - no guarantees of attendance - but it's been good fun in the past.

Scraps v0.5.2.13

Smallish update today:

2015-11 - 0.5.2.13
- AI is much, much less likely to follow you off a cliff
- Added top speed guess to the Build screen stats
- Performance: More efficient terrain rendering
- Reduced HP on Medium and Heavy cockpits
- Made heavy vehicles a little faster

You can now see a reasonable estimate of your vehicle's top speed in the build screen stats:



It'll show up in mph if you have that set instead.

Scraps v0.5.2.11 – New map, ground effects, other stuff

I've added a new map called RiverRift to the game. It's got jumps as shortcuts, water, and a big rift in the ground that you can shove vehicles in to destroy them.









Skidmarks are finally back (see my post here for a technical writeup on the skidmarks effect).



And leaderboards now show whether other players have their vehicles currently in-game.





Icons are a vehicle on terrain for in-game, a spanner & hammer for build screen, and a dash for no vehicle.

I've also adjusted vehicle speeds a little: Very light vehicles will be a little slower, but heavier vehicles will generally be a bit faster now with the same engine configuration. Mass in general had a little too much effect on speed.

The first time I made the change I set the multiplier too high. Actually so high the frame optimisation ruined this gif I tried to make of it:



You'll also find a little more wreckage drops in general, due to a change of calculation for drop amount from reliant parts (when a part is destroyed that has other parts that are reliant on it for their connection to the vehicle).

Full Changelog


2015-11 - 0.5.2.11
- New engine power calc. Very light vehicles are now a little slower, but heavy vehicles are significantly faster.
- Vehicles with a high centre of mass are a bit less prone to tipping over.
- Better wreckage spawn calculation; reliant parts get sorted by cost.
Bug Fixes:
- Fixed SFX volume, which was no longer affecting all sounds.
- Better collision damage calculation in some cases.

2015-11 - 0.5.2.10
- ## New Map - RiverRift.
- ## Skidmarks make a triumphant return, now without the ridiculous garbage generation.
- Minor work on existing terrain FX.
- Improved game camera obstacle avoidance.
- Added icons to leaderboards to show player's vehicle state (none/in-game/building).

A little driving tour of the new map:

https://www.youtube.com/watch?v=jqH2CEsbtuo