February 22, 2005

Tetris Attack AI

I got an e-mail from someone regarding my knowledge (or lack thereof) of Tetris Attack. Great game! I've written about it before. Here's my reply to him, adding to the data of which I know of TA.

--

Unfortunately, no, I don't have any experience implementing the AI for Tetris Attack, or anything to that degree. Nearly everything that I know about Tetris Attack and it's AI, I've documented there. And it's all observational data, I've just kinda summed it up.

I love this game, though. And for you to be implementing a clone, I would assume you feel the same way?

...

Well, I crossed tetris attack and AI on google and I found you, haha. So I guess you already know about tetrisattack.net. I just found it, but it might help you (doubt it).

The more I think about it, the more I definitely want to help you. How far along are you?

Here's what I have so far, based solely on reading your groups post and from what I remember.

From what I read, it sounds like based on your observations, the computer "sets up" combos? Like, it pre-swaps a bunch of panels to *then* make a combo? Part of me somewhat disagrees with that, not sure why.

I can remember moments where I've thought... Hey, this AI isn't too smart. And that's a good thing and here's why. Something that isn't smart or rather what we're looking for here is not complex is something that can easily run on a Super Nintendo, know what I'm saying?

This might be a case of emergent behavior... I hope I'm not getting too fluffy already. That is, the AI isn't complicated at all, it's just maybe one or two rules that run in such a way that it looks like it's doing a lot of thinking.

I'm writing this as I think so pardon the random flows in thought.

The three scripts I listed on my site are:

Attack (here's what you want)
Clean (mechanical)
Raise (mechanical)

By mechanical I mean my blog discussion should be sufficient in implementing them.

Here's what I think is going on in the Attack script. There are two parts, mechanics and logic. Mechanics are just going up/down/left/right and swap. Logic is what you're after. Again, hope this isn't too boring, I'm just trying to flesh out the idea as I go.

The logic involves a very magical portion of... "Seek combo". That's the heart of what we're looking for.

You would evaluate the current game state (panels on screen) and it should fail for a positive combo match (a combo match would be the ideal state of the board, but it would never... happen until it happens, know what I mean?). Then the computer would choose any set of panels to arrange and make INTO a combo ("color lock" maybe?). It would force the current state of the game to improve in score and aim for a combo. This is the logic part.

Then using whatever mechanics it has available to it, it would make that combo come into fruition, just as human players do.

Then, to simulate the act of making combos, I think it just runs the seek and create combo script again. Again so fast that it just looks like it's creating combos?

I'm already this low into the e-mail and it just seems that I wrote a whole lot of nothing... But the AI doesn't sound too complicated. It just... Operates the way we operate. Or at least the way I operate...

Look at the board and be unsatisfied. Find a set of panels you want to make happen and make it so. You score.

If in the available time slot it is possible to make another combo, do so. Rinse, repeat.

I don't think this AI is very smart. It's just... Brute forcing itself through the program.

Oh, I also forgot to mention to you. I've seen cases where the AI kinda... Stops. Or halts. And here's an instance why.

Let's say the AI "locks on" the way we do to a certain series of panels. "I'm goin' for blues..." and while it's shifting the blues into place, the red panels suddenly combo out of nowhere. This is what I'd call happenstantial. It just happens. Nobody planned it, but it just kinda fell on your lap.

At this point the AI would just abort it's current "creating" script and perform another seek combo script that would take advtanage of the current board state.

One challenging part of this might be programming the AI into operating around the dynamics of the game. Blocks are falling, things are rearranging... It might be tough. But if you define your states properly and teach your AI to address those situations and "physics", as I call them, accordingly, there shouldn't be too much of a problem. You can tell it to be really slick and do drop ins and stuff outlined in the Tetris Bible...

Oh man that made me think of another thing. I think dynamic zones (blocks where things are happening, blocks are popping, comboing) are forbidden zones! I'm pretty sure I can recall the computer being very brute forcy and not being slick. By slick, just check all the moves outlined in the Tetris Bible. They're really, really slick. Beginners don't touch that stuff. And I'm sure the computer didn't either!

I think that would help you a great deal. If you don't program for finesse, then you're definitely aiming for something that replicates the AI on TA.

Phew. I'm spent. Hopefully this e-mail was useful to you. It was to me, at least. I love this game. And thank you for your correspondence. Please let me know if you need anything else or how your implementation is going. I'm eagerly waiting the results.

Any questions, I'm always available.

Thanks, good luck.

PS - Reread through the e-mail to make sure it wasn't too bad... It is. Haha. But I forgot to address larger combos. Things that make an AI look aggressive or smart. I already mentioned how aggression is an illusion governed by a speed of the AI's cursor. But umm anyway... When you evaluate the state of the board, that's where you are or are not looking for the greatest combo. This, I cannot remember. If you set the AI for TA on zero, like totally stupid, you can actually see it's thinking pattern. If it goes for these crazy lucky 10 panel one swap moves, you can guess that it's evaluation function actually cares about what it's getting. If you can see no actual aim in what it does, then you're in luck. The Seek Combo script is just that. Seek a combo, any combo. If it's a nasty one with lots of points, then it just happened upon me and I'm in luck.

Posted by Mark Canlas at 06:56 PM | Comments (1)

April 10, 2004

Malak Lives, That Idiot

In Final Fantasy Tactics, try casting a Truth or Un-Truth on yourself. If you die in the process, but are still responsible for casting the rest of the spell, Rafa/Malak will stand up/sit down. It's funny. Because they're already dead. Up. Down. Up. Down.

Posted by Mark Canlas at 04:54 PM | Comments (0)