Missile Command, Part 1

posted in ferrous' Journal
Published January 24, 2018
Advertisement

I'll follow this up with a more verbose post with pictures and links, but I figured I'd start things out.

So for the Missile Command challenge, I decided I wanted to try a couple of different things:

1. Drunk Missiles.  You know, those weird randomly spinning anime missiles from Macross / Robotech.

2. Use UniRX some more.

Now, the first one ended up causing lots of other design decisions.  First, to really be able to see a drunk missile, I needed 3D, and to best show off the drunken 3d spin, I decided I need a more cinematically placed camera.  My early experiments with 3d spinning in Unity, I quickly learned that the default spin rate on rigidbodies are incredibly low, and hidden behind a code only property.  I also found any tweaks to missile speed would have them behave rather unpredictably, either doing a very slow spin in a circle, or that my missiles were too drunk, and easily spun off and then back on camera again,  It's not much fun to lose a city because a missile spins off camera and then back on camera at the last moment.

Now, I knew going in, that I might have to scratch missiles as an interception mechanic, as drunk missiles would be too hard to intercept.  But it turns out, even doing a hit-scan raycast was difficult.  Partly because clicking directly on a spinning drunk missile is hard, and partly because, the spirit of missile command is causing chain reaction explosions to catch other missiles.  To that end, I wanted to be able to click anywhere.  and setup an explosion in advance.  But... how do you do that in 3d?  I ended up setting down a 3d Plane in between the missile spawner and the ctiyscape.  But my drunken missiles were so drunk, that there was little guarantee of them even meeting that plane at all.

The solution was to drop my first implementation of drunken missiles.  The second implementation is even hackier than what I had, but also much more predictable.  It involves two game objects.  One is the anchor, that is invisible, and moves right along that 3d Plane, and moves straight towards it's target (A city or a tower).  The second is the missile, which is attached to the anchor via a hingejoint.  It spins around the anchor via the motor property on the hingejoint.  I then play with the anchor distance as it gets closer to the target, eventually becoming zero, so that it converges with the anchor.  Viola -- Drunken missiles stay on the 3dplane, but still spin.  They're still a right pain to click on, but one can still click the plane, and set up chain explosions.

Now, for the interception mechanic, I probably could've settled for straight up clicking, but I've decided to try implementing lasers.  My first thought was a big beam, but I've since rethought it.  I've still got the three towers, and shoot from the nearest tower.  That makes planning where the beam will come from kind of a pain.  So now I'm thinking of the more traditional star wars blaster laser.  It'll still be fairly thick, to help catch drunken missiles in their spin.

(I'm still tempted to have all shots come from a single point, and the towers to just act like ammo containers.)

 

And I'm digging UniRX for it's event handling.  I'm not utilizing it to it's fullest though, and hacky code abounds as I don't have as much time as I'd like to polish things, but oh well.

Previous Entry Learning UniRX
0 likes 1 comments

Comments

ferrous

Okay, I lied, life happened, not sure I'll make the January deadline (not that it matters all that much, I suppose).  I'll still try to get a link and some screenshots up when I get a chance.

January 30, 2018 08:58 PM
You must log in to join the conversation.
Don't have a GameDev.net account? Sign up!
Profile
Author
Advertisement
Advertisement