The path of the laser is affected by user input and enemies present on the screen. Here is a video, at 5:00 minutes the laser in question is shown : Raiden II (PS) - 1 Loop Clear - Part 2


Here is a test using Inkscape, ship is at bottom, the first 4 enemies are targeted by the plasma. There seems to be a sort of pattern. I moved the ship first, then the handle from it to form a 45° angle, then while trying to fit the curve I found a pattern of parallel handles and continued so until I reached the last enemy. enter image description here

Update, 5/26/2012 : I started an XNA project using beziers, there is still some work needed, will update the question next week. Stay tuned !

enter image description here

Update : 5/30/2012 : It really seems that they are using Bézier curves, I think I will be able to replicate/imitate a plasma of such grade. There are two new topics I discovered since last time : Arc length, Runge's phenomenon, first one should help in having a linear movement possible over a Bézier curve, second should help in optimizing the number of vertices. Next time I will put a video so you can see the progress 8-)

  • 2
    \$\begingroup\$ Well, it's a spline of some kind. Possibly Bézier Curve. I'm not sure if this question is answerable by anyone other than the original developers. If you're trying to re-create this effect you should show us what you have and tell us what about it isn't working. \$\endgroup\$
    – House
    Commented May 21, 2012 at 22:22
  • 2
    \$\begingroup\$ No idea, but it's got a fine of amount of radical to it. \$\endgroup\$
    – Hackworth
    Commented May 21, 2012 at 22:26
  • 1
    \$\begingroup\$ Having played an unhealthy amount of Raiden, I have my doubts the toothpaste is any kind of closed form curve. It always seemed to keep a fair amount of memory. I suspect it's doing some kind of pathing with a mandatory turn radius. \$\endgroup\$
    – user744
    Commented May 21, 2012 at 22:27
  • \$\begingroup\$ @Byte56: Shmup devs/fans are dedicated, I would be surprised if this isn't documented / reverse engineered somewhere by now. \$\endgroup\$
    – user744
    Commented May 21, 2012 at 22:33
  • 3
    \$\begingroup\$ Looks like it places segments one at a time proceeding out from the ship, with a maximum bend, and each segment either turns towards enemies if any are nearby or in the direction of the ship's movement. \$\endgroup\$
    – Kevin Reid
    Commented May 21, 2012 at 22:36

1 Answer 1


I just created something that may help you. It was in response to help somebody on the GLBasic forums.

Here is the forum link with my suggestion: Random Textured Rolling Hills

This is written in GLBasic, but I tried to keep it easy to read, so it should be easily converted to any language.

To use it for your needs, you would need to generate your spline data / points. Replace the 'hill' points in my example with your spline points. You would only need to add an animation / flickering effect somehow. Maybe a random texture shift.

The real 'magic' happens in my 'AddPoint' function:

FUNCTION AddPoint: h AS THillPoint
    DIMPUSH self.points[], h

    // Is this the very first data point?
    IF LEN(self.points[]) = 1
        self.points[0].pu.Set(0, self.points[0].pm.y - self.texture_ht_up)
        self.points[0].pd.Set(0, self.points[0].pm.y + self.texture_ht_dn)

    ALIAS h0 AS self.points[-2]  // Reference to the 2nd last point
    ALIAS h1 AS self.points[-1]  // Reference to the last point
    LOCAL angle#
    LOCAL v1 AS TVector
    LOCAL v0 AS TVector

    // Calculate 'p2' of HillPoint - form rectangle with previous point
    angle = ATAN(h1.pm.y - h0.pm.y, h1.pm.x - h0.pm.x)  -90// Angle of the two points

    v1.x = COS(angle) * self.texture_ht_up + h1.pm.x
    v1.y = SIN(angle) * self.texture_ht_up + h1.pm.y
    v0.x = COS(angle) * self.texture_ht_up + h0.pm.x
    v0.y = SIN(angle) * self.texture_ht_up + h0.pm.y
    h0.pu = h0.pu.AverageWith(v0)

    v1.x = COS(angle) * -self.texture_ht_dn + h1.pm.x
    v1.y = SIN(angle) * -self.texture_ht_dn + h1.pm.y
    v0.x = COS(angle) * -self.texture_ht_dn + h0.pm.x
    v0.y = SIN(angle) * -self.texture_ht_dn + h0.pm.y
    h0.pd = h0.pd.AverageWith(v0)

This is where I calculate the final quads / polygons that plots the sprite along the line.

Here's the final results: enter image description here

And with the polygons' wireframe turned on: enter image description here

  • 1
    \$\begingroup\$ Great I will look at it. BTW, the link you gave is broken. \$\endgroup\$
    – aybe
    Commented May 23, 2012 at 23:27
  • 3
    \$\begingroup\$ The link doesn't appear to be broken for me... \$\endgroup\$ Commented May 24, 2012 at 5:10
  • \$\begingroup\$ I just checked Random Textured Rolling Hills link right now, it brings me a 404 error. \$\endgroup\$
    – aybe
    Commented May 24, 2012 at 16:50
  • 1
    \$\begingroup\$ Weird. It still works for me. But here's the underlying link: glbasic.com/forum/index.php?topic=8118 \$\endgroup\$ Commented May 24, 2012 at 19:11
  • \$\begingroup\$ Broken for me, I tried the home page, it shows 'It works !' and that's it ... weird. \$\endgroup\$
    – aybe
    Commented May 24, 2012 at 22:02

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .