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: Modular Vehicle Combat
Moment Studio
Moment Studio
2020-12-18
Action Indie Singleplayer Multiplayer
Game News Posts 61
🎹🖱️Keyboard + Mouse
🕹️ Partial Controller Support
Mostly Positive
(156 reviews)
http://www.scrapsgame.com
https://store.steampowered.com/app/350150 
The Game includes VR Support
Scraps Linux [960.68 M]
Scraps lets you create a vehicle that’s great or a vehicle that sucks. Maybe your vehicle falls over when it corners or doesn't have enough power to fire its weapons – that’s okay. Maybe it doesn't need an engine because it moves by firing its cannons backwards. You decide what you drive.
Your design choices aren't just cosmetic - they're truly functional and at the very least affect the weight and balance of your vehicle. Battle in single-player against the AI, on LAN, or over the Internet. Easily host your own LAN or Internet games. Using the Scraps demo version, your friends can join a LAN game even if they don't own the full game.
language Note:
The only complete language at this time is English, but partial in-game translations are selectable for Russian, Danish, Dutch, Norwegian, Romanian, French, and Swedish.- OS: Tested on UbuntuGraphics: Radeon HD 6570 / Mobility Radeon HD 5850. Shader model 3.0.Network: Broadband Internet connectionStorage: 1 GB available spaceAdditional Notes: Broadband is only required for Internet play.
- Graphics: Radeon HD 6570 / Mobility Radeon HD 5850. Shader model 3.0.Network: Broadband Internet connection
- Storage: 1 GB available spaceAdditional Notes: Broadband is only required for Internet play.
- OS: Tested on UbuntuGraphics: Radeon HD 5750 / Radeon HD 6750MNetwork: Broadband Internet connectionStorage: 1 GB available spaceAdditional Notes: Broadband is only required for Internet play.
- Graphics: Radeon HD 5750 / Radeon HD 6750MNetwork: Broadband Internet connection
- Storage: 1 GB available spaceAdditional Notes: Broadband is only required for Internet play.
[ 5951 ]
[ 1903 ]