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

Graphics problem

I’ve just encountered a bit of a dilemma.

I have this wibbly wobbly ‘not a cloaking device’ effect on the ships in GSB. The thing is, it wobbles the original ship sprite, and when I’m drawing ships, I’m also attaching some extra sprites for stuff like damage textures etc. Not to mention flashing lights etc.

When the ship cloaks, this means all those extra sprites effectively disappear, which is very jarring, and breaks the sense of ‘realism’ of it all. I’m not sure yet how to handle it. One idea would be to fade out all of those sprites over the few frames before the ship starts to wobble, so it’s less sudden, but that still makes no sense. Ideally, I would apply the exact same distortion to each sprite as I amd doing to the ship sprite, but that is problematic and complex (to put it mildly).

I could just wobble them ‘out of synch’ with the underlying sprite, but that would lead to some artifacts which would look crap. There is a video which i think shows it a bit below.

The way I wobble the ship is to basically split it into a grid and then wobble each point on the grid out of synch, the sprite is then drawn like a flat mesh grid, with bits of it stretched all over the place. If the damage sprites sat at exact grid intervals, this would be easy, but they do not.

It might make sense to actually burn the damage texture onto the ship texture. This would make things very easy, but suddenly if I have 10 frigates on screen, I have 10 times the texture memory (worst case).

Even as i type this, I realise the answer is likely to always align the damage textures themselves at grid wobble boundaries, and then to wobble them in synch. That doesn’t solve the issue of flashing lights though.

What A nightmare. i hope people use the wibbly wobbly effect a LOT.

12 thoughts on Graphics problem

  1. Could you make the ship grid smaller and place damage sprites at fixed points within this smaller grid. Damage impact points won’t appear as realistically but you wouldn’t have as much trouble fading them out with the ship.

  2. It’s something I’ve considered,m and was ready to do, but the problem of positioning flashing signal lights and particle emitters means I still need a way of getting the distorted position of an arbitrary point on the sprite.
    I think I can do it by querying the four nearest grid points outside the current point, and interpolating between their current and assumed positions.
    it will be a bit of a code nightmare though…

  3. Is there a real issue with using 10 times the texture memory? (Mind you I’m not a programmer) but how high could that get?

  4. Hate to reply to myself, but couldn’t you also do the low quality way for lower end computers and do the burning it onto the ship for higher quality displays? Just have a few different graphics settings.

  5. high enough. the ship sprites are up to 512×512, which is 1.3MB with mipmaps. If there are ten ships types on screen (not impossible) and ten of each, that’s 130MB of video card memory for the ships. That’s without all the effects, the backgrounds, user interface and fonts.
    I know a lot of people have cards with 512MB of VRAM, but I don’t want to demand that for the game. Plus using tons of texture memory means longer load times.
    It also means you are switching texture pointers during rendering for every single ship, which is slower.
    I’d like to avoid it if at all possible.

  6. Sorry, i forgot to mention that i agree with the first comment. Your hard work is really showing in the video previews. Nightmare is right, complex maths has never been my strong point.

  7. the interpolation will work and not be that complicated – that was my first thought. alternatively you could render the ship and all its attached sprites to a separate texture first, and distort that, which would require only 1 more texture instead of 10.

  8. “I think I can do it by querying the four nearest grid points outside the current point, and interpolating between their current and assumed positions.
    it will be a bit of a code nightmare though…”

    no, it wont

  9. rendering on the fly to compose the texture offscreen and then re-using it is an interesting one…
    I hate having code where render targets swap because it can be so buggy on some drivers.

  10. well you’re targeting what, directx 9 now? Any card that supports dx9 should do it fine.

  11. Couldn’t you just define the vertices of your detail quads in a coordinate system that’s based on the deforming mesh?

    If the rippling mesh is triangular, detail verts would be represented as barycentric coords within a specific triangle; if the mesh is an actual grid, it would be bilinear interpolation within a specific cell.

Comments are currently closed.