Game Design, Programming and running a one-man games business…

Programming Gratuitous Rocket Trails

I was watching District 9 ( I liked it, except the more yucky violent bits), and there were some cool rapid rocket trail effects in it, and it suddenly reminded me that the rocket trails in Gratuitous Space Battles aren’t good enough at high speed. Take a look at this rocket trial, from a rocket cruiser missile at 4x speed:

Crap isn’t it :D. At normal speed it’s fine, but at super high speed, the missile actually moves too fast per frame of rendering for me to actually space out the particles. So I just knocked up some code that instead of doing this: (pseudocode)

HowFarHaveWeTravelled?
IsItTimeForAnotherParticle?
IfSoPlaceAParticleHere

does this:

for(distance_accounted_for = 0; distance_accounted_for < actual distance, distance += particle spacing)
{
  Position = LastMissilePosition
  Position += (distance_accounted for)
  Place a particle at Position;
}

Which is more work :D But it’s worth it, because even at 4x speed it now looks like this:

I know it’s a bit late to be worrying about all this months after the game came out and got reviews, but I am just completely drawn towards tweaking the game to look better. Also this means I can experiment with superfast rocket trails which will still look good. Also today I’ve done all of the debris and turret gfx for the new race in the new DLC/expansion pack thing. Now I have to actually design their ship configurations, and allocate their bonuses. Then I need to do their mission deployments, and then it’s pretty much done (and I then need to balance and playtest it). Yay!


9 thoughts on Programming Gratuitous Rocket Trails

  1. Not related to this post, but I was wondering if you could do a post about your STO experience?

    I have read your few posts on twitter here & there, and it has left me disappointed, I was planning on getting into it.

  2. Nice! Will get this expansion for sure!
    Is there a discount when buying both expansions at once?

  3. If the speed of projectile is 4x and it “jumps, how do you resolve collision problems with small objects?

  4. Like debris? That’s optional anyway. There is no normal collision detection in GSB, stuff hits the target or not, but in gameplay terms, there is no getting in front of enemy fire by accident. Shots go under or over other targets.

  5. Looks much better than the first version. Rendering to 2D seems to be a clever way for avoiding superfluous collision detection. Great trick!

  6. Guys,
    Impulse sale!
    Get 5% off anything on Impulse!
    Grab ‘The Tribe’ now (and other stuff…)
    Coupon Code: Start Impulse Tray, Right Click, ‘Show Promotions’.
    Thank me later, start downloading!

Comments are currently closed.