Tracks for vehicles

Tracks for vehicles

Discuss game development here, from a distinct game project to an accessible third-party mutator, down to the interaction and design of individual units if you like.

Moderator: Moderators

Post Reply
User avatar
Snipawolf
Posts: 4357
Joined: 12 Dec 2005, 01:49

Tracks for vehicles

Post by Snipawolf »

Ehhh, heh, got a slight problem. I don't know what the different colors do.

Anybody know how I should use the colors here? I would greatly appreciate help.
User avatar
Argh
Posts: 10920
Joined: 21 Feb 2005, 03:38

Post by Argh »

You mean alpha transparency? Simply put, the alpha channel on your secondary texture is how you do transparency, which is useful for tracks. The white areas of the alpha channel are drawn; the black areas won't be.

Keep in mind, if you use this, that Spring does not draw S3Os double-sided, so avoid situations where it's going to be obvious that you can see through the "back" of things. With tracks, that's not a big problem, obviously.
User avatar
Snipawolf
Posts: 4357
Joined: 12 Dec 2005, 01:49

Post by Snipawolf »

Heh, not those, the ones rendered on the ground.

These:

Image
User avatar
Argh
Posts: 10920
Joined: 21 Feb 2005, 03:38

Post by Argh »

Oh. Yeah, I hate those, I wish they were just alpha, so that we could use proper colors. Just a sec, lemme look at the ones I've done, and I'll tell ya how they work...
User avatar
Snipawolf
Posts: 4357
Joined: 12 Dec 2005, 01:49

Post by Snipawolf »

From what I have gathered, brighter purple is more visible, and darker purple is less visible and brighter colored..

Weird... :?

Edit: Well, at least they don't cause any extra lag whatsoever. I just tested with 21 units.

Without tracks = 55 FPS
With tracks = 54
User avatar
Argh
Posts: 10920
Joined: 21 Feb 2005, 03:38

Post by Argh »

Ok, IIRC (not at home, no Photoshop, so this answer is probably missing something important):

If you look at the image in Photoshop split out to the RGB channels (this can be done in GIMP, too), then you'll see that it's essentially a grayscale where real change is only on the RG channels, never B- B's value should always be 255. R's value default is 180- IIRC, you wanna leave it there, and just raise the value of G to make that part less-transparent.

So, for example, you want completely dark, no fuzz, areas of a track, the RGB value is 180, 255, 255. If you want it to be halfway-faded, the value is 180, 124, 255.

Making sense? In addition, I figured out that if I painted a grayscale, then (Photoshop, dunno how to with GIMP) did a fill of RGB 180, 0, 255 and the "overlay" setting, then it worked just fine- the black areas became 180, 0, 255, and everything else faded upwards properly. I think it was "overlay"... I'd have to try it again to be sure, though. At any rate, for simple tracks, you can just put in the values manually, and it'll work just fine.

Now, for the "fun" part! Because this part of Spring is... erm... I have no nice way of putting it... so let's move on...

Because Spring's handling of this is different from just about every other area, aside from Groundscars, which also use bizarre color formulae (I'm guessing that the weird colors are because this is really a normalmap, but I really don't know anything about the code side), and has some very big static assumptions, you're going to need to play around with things a lot, for anything that isn't just a simple treadmark. When I set up tracks for the Strider unit in NanoBlobs, I spent quite a few tries adjusting the positions of the dots, so they'd roughly match up with the stride-lengths and not look totally shabby. I've been thinking about whether or not I want units that aren't wheeled in PURE to use this, and thanks for reminding me how much I hated dealing with this ;)
User avatar
Snipawolf
Posts: 4357
Joined: 12 Dec 2005, 01:49

Post by Snipawolf »

Heh, no problem. Thanks for the help.

Now to put them on my infantry or not, I am guessing that wouldn't be a good idea >___>
User avatar
Argh
Posts: 10920
Joined: 21 Feb 2005, 03:38

Post by Argh »

It's not that it's not a good idea. It's just that it will take some patience, and probably more than one try, before you end up with something that doesn't suck.

Also, keep in mind that one fairly-generic set of tracks can be used in a very wide variety of situations. You could take my Strider texture from NB, move the dots closer to the center, and probably make an OK infantry-footstep texture pretty fast. I never heard a single complaint from players that the footsteps of my walking units, which all use that same Strider texture and different scales, weren't doing what they needed to- so long as players can see a visual trail behind the unit, showing where it's been, that makes some sense- alternating footsteps for most walkers, lines with little fuzzy bits for tracked and wheeled things, and amazingly-cool cracked-ground spots for PURE's Nuclear Pogo Stick (kidding!), you're not likely to hear a lot of complaints.

I can imagine units where the trail might really "make" things. However, most of my imaginings on that topic involve being able to use trails that can have color values that aren't arbitrarily defined by Spring, and / or more control. You could fake a pretty fancy trail using timed COB stuff and CEGs, though, among other things...
User avatar
Snipawolf
Posts: 4357
Joined: 12 Dec 2005, 01:49

Post by Snipawolf »

I already have a dust trail that follows vehicles, but someone suggested I add trails/tracks as well. I may try it for infantry. I'll wait till after I am done with my few vehicles.
User avatar
Snipawolf
Posts: 4357
Joined: 12 Dec 2005, 01:49

Post by Snipawolf »

If you make your tracks into PNGS, and put .png after the track name for the unit.

Code: Select all

TrackType=LavTrack.png;
You can divide your size by ONE FUCKING HUNDRED!

I changed my Lavtrack to a png from a bmp, wanna guess how small it is!?

It went from 48 KILOBYTES to 396 BYTES!

48,000 to 396. How is that for saving space...

My other one went from 48 kb to 352 BYTES, also.
User avatar
Argh
Posts: 10920
Joined: 21 Feb 2005, 03:38

Post by Argh »

Hmm, I wonder if that has any performance advantages at all, or just saves a bit on d/l? BMPs get a lot smaller when zipped...
User avatar
Snipawolf
Posts: 4357
Joined: 12 Dec 2005, 01:49

Post by Snipawolf »

Maybe.

The bmp is almost the exact same size on a normal compress as the PNG one is.

I am not sure about performance differences.
User avatar
Argh
Posts: 10920
Joined: 21 Feb 2005, 03:38

Post by Argh »

I'm gonna have to test this, with groundscars, which are a major area of performance-suckage in Spring. I've been thinking I'll remove them entirely from PURE, and use a newer method with CEG, but if there are any good ways to improve real performance, that'd be useful for everybody.
User avatar
Peet
Malcontent
Posts: 4384
Joined: 27 Feb 2006, 22:04

Post by Peet »

It actually makes absolutely no difference.

In the vram, they both exist as uncompressed textures (unless you use dds). In a mod, if you're using sdz/sd7, it's compressed anyway. If you release sdd mods you're just weird anyway :P
User avatar
Argh
Posts: 10920
Joined: 21 Feb 2005, 03:38

Post by Argh »

So they're unpacked to bitmaps?

Hey, while you're paying attention, why are groundscars and tracks using these weird colors, instead of just straight grayscales? Can't we get that fixed? This is one of the weirdest things remaining, from the days of SJ...
User avatar
Snipawolf
Posts: 4357
Joined: 12 Dec 2005, 01:49

Post by Snipawolf »

Indeed, and they are probably not even utilized at all by those not in the know.

(And, the wiki has no documentation on this area)
Post Reply

Return to “Game Development”