Dev Diary 010: A Damnably Simple SHMUP

Matt Barton's picture

I apologize for posting another dev diary so soon, but I'm pretty excited about my first playable Unity game and just had to share. It's just a very simple shoot'em up, though my plans to keep it simple were foiled when I ran across the Explosion Framework. I was nervous about trying to use Detonator, but again I'm floored by how easy this was...Installed this with a click, dragged it onto the variable I set up in my script, and viola! Awesome ass explosions. It even came with its own sound effects! To get the laser sound effect, I used this fun little generator, which lets you create 80s stye arcade effects just by clicking some buttons.

I followed the 3D Buzz videos pretty closely here, and didn't bother creating splash screens or menus (though I couldn't resist adding a score). I want to have a decent game before I start messing with that.

The next big step will be creating some models in Blender and figuring out how to import them, replacing the blocks and spheres with 3D models. I'd like to experiment with making your ship rotate a bit left and right as you move, and I'd also like to have a variety of enemies.

The eventual plan is set up the Match 3 stuff. Here's how I envision this working:

Across the top of the screen will be phalanxes of aliens as in Space Invaders. I haven't decided yet if I want them to look like aliens or just cubes. The reason why I'm undecided on this question is the gameplay I have in mind.

Instead of just blowing up aliens when you hit them, you will change their color. If they are blocks, they will just turn, revealing a face of one of four colors (red, green, blue, or yellow). The only way to destroy an alien is to match up the colors with at least two others connected to him, either horizontally or vertically (I'm not sure about diagonal yet; have to see how that plays). Meanwhile, as in Space Invaders, the aliens will be steadily moving horizontally and dropping vertically, eventually touching the player and killing him. I plan to do the usual match 3 stuff, such as giving you a bonus if you destroy more than 3 enemies simultaneously, and perhaps some powerups of various sorts.

It's probably beyond my skills at this point, but I also thought it'd be awesome to have a multiplayer version. I imagine that could get pretty frantic if the communication was bad and the other player kept messing up the shots. :)

Anyway, feel free to play my "sample for the day."

Unity Web Player | WebPlayer

Comments

TripHamer
TripHamer's picture
Offline
Joined: 07/31/2010
Add 2 small things

Add 2 small things...

Have to bullet end when it collides with a sphere

After a collision, reset the sphere and the cube at the same time so that it's not right on top of the cube after it just collided with it, on the next time around. Start the new cube in the center.

So far so good, keep going! :)

n/a
Matt Barton
Matt Barton's picture
Offline
Joined: 01/16/2006
Thanks for the criticism, but

Thanks for the criticism, but I'm not trying to fine tune anything right now--just learn the basics.

And I've hit a roadblock...

I'm trying to copy the Space Invaders movement, but damn...Again, something seemingly simple has me totally stumped.

I can make a row of enemies move left and right, but moving them all down when one hits the side of the window is proving difficult.

My initial approach was to set up some static variables so that when any enemy hits the zone, they all know to move down and switch direction. I thought I could do this easily, but I can't find a way to do it. I've tried arrays, everything else I can think of, but no matter what, it breaks up the formation. The ones who hit the borders move down first and end up getting closer and closer to their neighbors. Surely to God there has to be a way I can just move ALL of them at once, but I'll be damned. Maybe there's not.

n/a
TripHamer
TripHamer's picture
Offline
Joined: 07/31/2010
From my own experience...

I actually have an unfinished space invaders game that I wrote a little over a year ago. Still toying with the idea of actually finishing it and possibly releasing it. (needs sound and fine tuning)

Anyway, from memory, what I did (to keep them in formation) is even though the invader was dead, it only became invisible and ignored all collisions with enemy fire and such. When an alive invader (the one closer to the left if they are moving to the left) moves to the point where they have to move down and then start moving right, it would trigger for all of them to move. Every invader had it's own class and I would use an array of classes and nested for loops to cycle thru them.

There is suppose to be a way where all will follow the leader, but I have not figured that one out and went with this solution.

Maybe that will help?

n/a
Matt Barton
Matt Barton's picture
Offline
Joined: 01/16/2006
Can you describe the array

Can you describe the array and nested loops? That's the approach I tried but couldn't keep it all synced.

n/a
TripHamer
TripHamer's picture
Offline
Joined: 07/31/2010
Little code snippet

        for (int i = 0; i < 5; i++)
        {
            for (int j = 0; j < 11; j++)
            {
                temp = invader[i][j].autoMove();
                if (temp)
                {
                    drop = true;
                }
            }
        }

5 rows of invaders and 11 in each row.
each time thru the loop, I cycle thru them all and update each one's automove function. I return a bool to indicate it's time to drop and use another set of nested for loops to drop them all. Probably not the best way to do it but it does work.

Obviously there is more code to make things move, but the unity video's probably covered that.

Outta time for now. I'll check back later.

n/a
Matt Barton
Matt Barton's picture
Offline
Joined: 01/16/2006
I finally found a

I finally found a solution...I made an empty gameobject called "EnemyParent," made all my enemies children of it, and then applied my transforms to the parent instead of the children. Viola!

Thanks for your help, though.

n/a
Nathaniel Tolbert
Nathaniel Tolbert's picture
Offline
Joined: 11/06/2010
Very cool sir! I cannot wait

Very cool sir! I cannot wait to see what you come out with next. I haven't played the last game you made, because I couldn't donate anything, so I'm holding off till I can. Maybe in a few weeks when we get our tax return, I can spend some of my share on it.

n/a
Matt Barton
Matt Barton's picture
Offline
Joined: 01/16/2006
Well, as usual I've greatly

Well, as usual I've greatly underestimated the skills required to bring a concept into reality...I never considered just how complex it would be to make a match 3 game.

I'm pretty sure the answer involves arrays, but I'll be damned if I can find a clear explanation of them anywhere. Sadly, it looks like I might have to ditch this idea and go for something a little more intuitive.

n/a
gilgamesh (not verified)
Arrays
Matt Barton wrote:

I'm pretty sure the answer involves arrays, but I'll be damned if I can find a clear explanation of them anywhere.

You mean an explanation of arrays? Sorry if I got that wrong.

Arrays are items data stored away one after another in memory, all of the same type. Texts (or strings in programmer's lingo) are realized as arrays of characters, for example.

If you wanted to have 25 integer numbers, you would declare a variable arr of type int[] (array of ints).
int[] arr;

You would tell the compiler to allocate the memory for 25 integers and store its offset in arr by
arr = new int[25];

You will usually do both at once
int[] arr = new int[25];

Now you can access the individual items of arr with an index, e.g. for accessing the sixth(!) element write
arr[5] = 10;

Remember that the first element always has the index 0. That is
for(int i = 0; i < 25; i++) {
arr[i] = doSomething(i, someVariable);
}

Now you can have arrays with more than one dimension. Because memory is one dimensional, data items will still be stored internally one after another, row by row. You would use it like

char[,] gadget = new char[10,15];
gadget[0,5] = 'a';

Another fairly advanced option are arrays of arrays, e.g.
int[][] adv = new int[5][];
adv[0] = new int[3];
adv[1] = new int[6];
/* … */

TripHamer
TripHamer's picture
Offline
Joined: 07/31/2010
You stuck on arrays?

Your stuck on how to use arrays?

There should be tons of tutorials on those. You don't even have to find c# ones. You just need to understand the concept and the c# way on using them.

http://www.3dbuzz.com/vbforum/sv_showvideo.php?v=32

Those 3dbuzz video are for C++ but the idea is basically the same.

n/a

Comment viewing options

Select your preferred way to display the comments and click "Save settings" to activate your changes.