Unity Invaders

Note: this thread is old. :wink: This is one of the first projects I did in Unity, long ago, but I posted it to the forums here and it has gotten occasional comments and questions ever since. One of those comments prompted me to update it for Unity 5, but when doing so I realized the project was actually quite a mess. Apparently I’ve learned a thing or two since then, but also back then Unity didn’t have a lot of the features it has now…e.g., things like no collision matrix made hacking around with IgnoreCollision necessary. So I redid it from scratch, aside from the graphics/sound, using modern features in Unity 4.6 (since I can’t really bear to use the old GUIText/Texture objects now). And yes it works fine in Unity 5, though the physics in the title screen are a little off, at least with b17.

Since it’s a relatively small project, I thought it might make a decent example of a complete game for newcomers to maybe learn a few things from, so I uploaded the project folder (see links below). I think some things are easier to understand in context, and this ended up covering quite a few areas…2D sprites in a 3D environment (though mostly not ā€œrealā€ sprites since I used material offset animation), particle effects, sound, scoring, physics, multiple camera techniques, layers, a bit of level management, object pooling, simple UI elements, etc.

There are some elements that are easily tweakable in the inspector (on the ā€œMain Cameraā€ object mostly), but it might make an interesting exercise to expand on the game if anyone feels so inclined. Powerups, different alien behavior, bosses, etc. Right now it’s just yer basic Space Invaders.

Some of the sound effects are modifications of sounds from the Gear Worx Productions ā€œmodern weapons and warfareā€ sound pack (the explosions and ricochets), so please don’t reuse those unless you’ve also bought a license from them. The rest of the stuff is by me (aside from a few publicly-available sound effects), which you can do with as you like.

Download here for Unity 4.6. (The old junky version is here, though it was updated several times and works with Unity 4.3.)

–Eric

1 Like

Nicely done! I couldn’t get past the coin slot though…

Naw, j/k, it only took me ten minutes. The game was fun, glad you released the project to :slight_smile:

Very cool Eric! The invaders are a little more accurate and trigger happy, than what I remember… but a very good remake of the classic! Well done.

Excellent job! I found this to be quite addicting, actually. I wanted to keep pumping in virtual quarters to try again. Nicely done!

Great handling overall. The coin thing took me about 4 - 5 tries before i realized you needed to line up the shadow.

The invaders do seem much more agressive then the original.

This is a lot harder than the space invaders I played. A couple things I might change:

The falling invaders should be able to be shot and also be a hazard to the player.

Slow down the enemies bullets and make there be less of them, if you want it to be more like the famous space invaders games.

The game over sequence seems a bit too long?

I love the coin thing too! Should I be able to skip it with space?

Just think if you had an actual quarter for each time we have played it so far… :stuck_out_tongue:

Me too…I’m not sure why. I mean it’s a nearly 30-year old game. :face_with_spiral_eyes: Oh well, at least it got a lot of play-testing…

When I first implemented the bombing routine, the invaders just bombed randomly. I quickly realized that made it way too easy, but fortunately it was just a matter of a few lines of code to bolt on some proximity logic. Now the program chooses a random number to decide whether to bomb randomly or not. I started at 80% but that was a bit much. :wink: I think it’s at 50% now, which seemed about right, but if you just change that one number to something lower, that will make it easier. You can also make it so they start dropping 2 bombs at once (the maximum) later on if you like. It’s possible they start doing that too early.

–Eric

Cool. And rather difficult, actually!

Great remake, much harder than original. I love the damage shake. You can really feel the pain. But level one is too hard :wink:

Cheers,

That’s a really clever way to make destructible 2D objects, Eric!

very well done – and what a great use of the ā€œmodern weapons and warfareā€ pack … I personally never thought of using it for something like this … and check it out … it works!

Great job … and excellent choice for a classic!

The thing I loved the most, aside from the obvious use of one of our products (heh), was the coin drop … and the 3d backgrounds … I also loved the overly pixelated 2d artwork … excellent work!

That is awesome to hear some of my sounds were put to good use, looks and plays great, addicting little game. Well done, gotta love the classics.

Eric5h5, can I post the web player version on the showcase section of Widget Monkyy Games, please?

Love it. And agree it’s harder than the original (which stole so many of my $0.25 I’d rather not remember).

haha that’s awesome! i’m surprised its in 2D - i’m eager to check out the project files to see how you got that all working (thanks so much for posting them ; )

go retro!

Fun stuff, good work! My only complaints/suggestions:

  1. While I enjoyed the whole ā€œdrop the coin in the slotā€ bit, maybe you can (a) expand the coin slot a bit, it took me 3 tries to get it right (sorry, still drinking my coffee this morning ;P), and (b) have an option to skip it.

  2. Can you have it auto-fire if I just hold down the spacebar? I’m lazy and want it to repeatedly fire if I hold down the fire key.

Otherwise yes, it is very addictive. It truly does remind me of all those days I spent riding my lil’ dirt bike over to the arcade to promptly burn through my entire weekly allowance playing video games… Ahh, good times!

Along the same lines as DaveyJJ, can I put the web player on Unicade? We’re going through a dry spell of games of sorts, and this is exceptional. :slight_smile:

Thanks for the comments, everyone! Yes, DaveyJJ and Moldorma, you can use it on your websites, but let me add in one or two things since I wasn’t thinking about having any distribution outside this topic. So hold off until later this evening, if you would.

As far as difficulty, I think y’all’s arcade skillz are a tad rusty. :wink: Let’s just say that screenshot was from shortly after I implemented player prefs for the high score, which was the last thing I coded…it’s way higher than that now. :slight_smile: I’ll ease back on the difficulty anyway, though. The ā€œgame overā€ part is probably a second too long, but I like having a moment to reflect on my failure before being thrown back to the title screen. OK, I’m weird.

It would be trivial to have the falling invaders be a hazard (and I certainly thought about it), but that would be changing the gameplay too much from the original. Same deal with autofire…I’m pretty sure you can’t do that in the real Space Invaders. So, no. But hey, you’ve got the source… :wink: And as I mentioned at the end of my (long) first post here, you can skip the coin thing with whatever you’ve got ā€œfireā€ set to. Normally space/control.

–Eric

Absolutely and thanks.

David

This is great! Thanks for letting people take a look at how it was made. I learned a couple of things just by looking at some of the files in the finder.
One question - How in the world did you get the standalone player’s file size down to 22MB?! I did a test build of a Unity project with one scene and nothing but a camera and it is 40.2 MB! You obviously know something I don’t know but really ought to know…

No I don’t. :slight_smile: I swear…I just hit Command-B…me knows nothing… I just did a test with an empty scene with a camera, and it came out to 19.3 MB (Universal Binary; PPC or Intel only is nearly half that).

(I haven’t done the additions yet, and now I want to have dinner. Soon. :slight_smile: )

–Eric