Tuesday, January 31, 2006

Crystal Chaos

Alright, I'm finally done with my first Flash creation. It's a Tetris sort of game with a bit of physics to it. The goal is to clear the board of all crystals and go onto the next level. Crystals disappear when you get 3 in a row (it's not a Match-3 game, I promise). After several moves, the bottom of the board will rise up and if you don't clear the board in enough moves, and a crystal goes over the top, you'll lose the game (at which point you can reload the flash to restart).

Go check it out, then come back here, I'll be waiting for you.

...

What level didja get to?

The real question, one for me is: what was learned while making it?

Making the Game
It's Flash. It works. Mostly. There's one teeny bug in the physics system that I know of and you might have seen. Also, you can't restart your game. There was a bug there and I just got tired of tweaking the thing. And I am trying to tell myself that I don't have to have a completely polished product before I put it down and put it up somewhere. Which is a hard thing for me -- I tend to be a perfectionist with these sorts of things.

The design process went something like this.

1) Hmm, Tetris games.
2) A few stupid ideas and an ideas I'd had in the past but discarded.
3) What if the blocks were rotated 45 degrees?
4) How would they delete? 3 in a row seems the best way to go.
5) How would they fall? I guess they should drop in a somewhat analog fashion with physics for sliding.

Then I made some of it. But I was still thinking about the game as I was playing early prototypes and I realize that it just wasn't that hard, and there was no real pressure to play well. You could make groups of 3 pretty quickly and without hassle. I needed to add some pressure to up the challenge a bit. I thought about having the piece drop automatically after a few seconds. I thought about having a timer after which you had to end the level. All the while, I had been thinking that the game was sort of like Puzzle Bobble in reverse. I decided to borrow a mechanic from that. In Puzzle Bubble the ceiling slowly falls in on you. So in my game, the floor raises.

So I added that. Then I added some levels. I thought about that some. At one point I was going to program in set-piece levels. On the one hand I felt that the game should probably be able to stand up on its own without set-piece levels. On the other hand, while checking out various Indie games on the market I found Soda Pipes, a remake of older pipeline games, which I thought wouldn't be a fraction of the game it was without set-piece levels. In the end I decided against it. Due to practical concerns more than anything else. I don't think at this point that I want to get too heavily into level design. It's an open-ended pit that I might not come out of. Maybe if I worked really hard I could make a given game 50% better with cool levels. But that's not really the point of my experiment -- I'm more interested in giving some ideas quick testd-rives and then maybe some day I'll come back to polish up a few and see how much better they get. So instead of set-piece levels I created a system where the number of colors of crystals increases as does the number of lines of crystals put out to begin with.

Another variable I might have played with that I think could have changed the game is the size of the board. I liked it where I had it but I think that a more constrained board might have made the game more challenging.

Overall I probably dumped about 20-25 hours into the game itself and a fair chunk of time just figuring out how to get Flash working. The physics engine was very simple, as far as physics engines go, but fun to work on. Collision detection between two squares rotated 45 degrees is stupidly easy (I gave that a seconds of thought and then realized, "duh"). I did have a lot of bugs as I worked on the thing but most were caused by an unfamiliarity with Flash, and by Flash's acceptance of code that wouldn't have type-checked in any "real" language. More about that later.

Judging the Game
The result? I hesitate to talk about my opinions too much because well, I don't want to bias your own. I'm hoping that other people can tell me stuff about my designs that I don't see. In this case I'm not too worried. I think the game is ok, and that's it. I do enjoy playing it and trying to get to higher levels. But in general there isn't a lot of thought that goes into playing it and I, myself, can't get that excited about it. I definitely prefer good old Puzzle Bobble (which is fine, Puzzle Bobble is a fantastic game).

Judging the strategy of your game is tough while designing it. Especially for something like this which is only slightly incremental and fairly different than other stuff out there at the low-level -- and a few details here and there make a lot of difference. Who could have thought, without playing them first, that Match-3 games like Bejeweled would be the sensation that they are.

I've been giving Lumines some thought as a comparison (if you haven't played that, play my clone, or better yet get the real thing, and come back to the conversation). The conept is very simple and from a high-level view it's not that clear why it would be as interesting as Tetris. It works because of a few very low level, non-obvious patterns. The fact that Lumines pieces can get stuck in checkerboard patterns which are very hard to break up is very important. It is also highly non-obvious how to setup big deletes. These two, along with a system that requires not only more thought but a lot more hand-eye coordination than my game, results in something that you literally spend hundreds of hours learning and getting better at.

And I wonder how Mizuguchi got there with his design. I can see coming up with the timeline idea that Lumines uses and the idea to integrate music into this. But the gameplay is incredibly subtle and I just don't think someone could come up with something that subtle through sheer genius. I am guessing that the answer is that he just tried a lot of things on top of his timeline idea and finally noticed some patterns or got lucky and found one idea that stuck, and thus Lumines was born. Or it could be that he's just a genius, and I'm not. In the meanwhile, I'm having fun and I'll hope that trying out lots of different ideas is the way to go for me.

Using Flash
So, Flash was ... ok. I'm certainly not ecstatic about the experience.

Things I strongly dislike:
  • No type system. Type systems are good. While coding for work I rely heavily on them to point out my stupid typos. Flash programs happily run when I misspell a variable name and I have to do a lot of line-by-line proofreads to catch my mistakes.
  • The IDE is horrible. I'm using Flash MX 2004 (anyone used the newer one? is it any better?). It is completely non-intuitive. Even the graphics drawing functions, for the vector graphics, are often a pain to use. And I can't seem to use my own editor for the code. Given that their editor is almost as bad as the rest of the program this is a big issue for me.
  • The documentation is written for animators. All I needed was a "here's Flash for programmers" intro to get me started. Nope. I couldn't find any good online documentation either (although I found these two essays which discuss flash as a platform for developing games)
These made the whole process a lot more difficult than it could have been. Everything felt like a hack. I couldn't find good ways to organize my code. I spent far too long debugging problems that were simple typos. All in all I felt like a lot of my energy went to fighting Flash.

Things I did like:
  • The vector graphics are nice, apart from the IDE. I could use another program to generate art, but I did find it very useful to just switch panes click a few times, and voila, my art had a new prettier gradient on it. And using simple gradients and vectors I can make semi-ok programmer art.
  • The GUI API was quite painless to use. Getting the mouse location, hiding the mouse, getting keys, etc., was a snap.
  • I could see that that there was a lot of functionality that, were I to master, could make some simple effects very easy to implement.
Despite severe dislike of certain bits, I think I am going to stick with it for now. I think I need to learn a bit more about how to create classes in Flash, learn a few more tricks, and maybe develop some techniques for organizing Flash code. And if that doesn't work, I'll move on to Java which at least I'm quite familiar with.

Performance-wise, the results were also a toss-up. With a physics engines and lots of pixels moving, I thought this was a good game to test out Flash with. It runs ok on my machine but it slows down a bit in the browser (not sure why). I tried it on my fiance's older laptop and it also ran ok on there although I did notice that it started to chug a bit after playing a while. I think as long as I stay away from really flashy stuff I should be fine, which is my intention for now anyway.


Conclusion
Anyway, can I work on a new project yet? I've been chomping at the bit to work on my next idea, which at the moment I think has more promise. More on that .... soon I hope.


6 Comments:

Anonymous Michael Chui said...

Not bad. I only got to level 3; I think I've mastered all the actual mechanics (in terms of skill and knowlege) at this point.

There is an amount of Tetris-like boredom: I sometimes get bored of Tetris, too, and I believe the reason (which I don't know what it is) is the same.

Oh, and to be fair: it's closer to Connect Four meets Tetris than Tetris plus Physics.

11:46 AM  
Anonymous Anonymous said...

Steve,

I played one level. I had a little difficulty through out the game because I am color blind to certain shades. So, the green & red (orange?) blocks were very hard for me to distinguish. I eventually got to the point where I could concentrate enough to distinguish them, but it was too much work to keep going for more levels.

As far as other parts of the game play go, it was pretty transparent. Although, the sliding nature of the blocks is different than any other tetris-like game I've played, it was easy to figure out where to place everything.

Is there any trigger event for the floor to rise? Like number of blocks played or lines cleared? I couldn't tell. And, is there some preferential presentation of colors toward the end? I was surprised to get 4 blue blocks in a row, when I needed all 4 and nothing else to finish off the board.

The game reminded me of 'Plinko' from The Price Is Right when I first saw it. And, I imagine, it wouldn't be too hard to integrate some plinko elements into the game in higher levels?

The game loaded and played quickly. Other than the color problem I previously mentioned, I found the graphics quite good.

So, I'd call it a success.

If you are going to be at Eric's place tomorrow, I'll talk to you more about it then.

... Richard James

5:16 PM  
Anonymous Patrick Curry said...

I got to level 8 before I ran into a bug. It's a fun little game! :-)

What's next?

12:04 PM  
Blogger StGabe said...

I had a little difficulty through out the game because I am color blind to certain shades.

Interesting. I hadn't even thought about color blindness as a design constraint.

I got to level 8 before I ran into a bug. It's a fun little game! :-)

What's next?


Regarding a bug at level 8, my fiance also experienced the same. I will have to give that a look at some point but right now I'm trying to focus on moving forward. Maybe I'll revisit the game in a while. I do think that with some wildcard crystals and some other tweaks it could significantly increase the "fun" aspect. One thing I considered was having giant 2x2 crystals. Either to drop or to have these created spontaneously as 2x2 groups "fused" together in the play field.

My next game? I'm still working out some details but it is a solitaire tile-laying game tenatively called "Boats, Trains and Automobiles".

1:45 PM  
Blogger soniCron said...

While MX's IDE really sucks, MX Pro has the advantage of editing scripts in tabs, instead of being constrained to store your code in frames on the timeline. Or, you can just edit your code in notepad/favorite-editor. (#include)

7:52 PM  
Blogger StGabe said...

I've been making a much greater use of classes in my next project. One of the advantages of this is that I can put my code in external .as files and edit them with Emacs. Things are going a lot more smoothly that way.

1:31 PM  

Post a Comment

<< Home