11
Apr
10

Angel Beats – Tenshi the AI

Shinmaru made a post about how Angel Beats closely resembles a video game over on his blog.  It’s an interesting post, and it culminates in comparing Tenshi to an old school AI such as Mike Tyson or the Weapons.  It’s a fairly good comparison, but I decided I would take the thought a bit further by fleshing out what makes Tenshi tick.  Today’s lesson deals with a bit of programming logic, but I’ll explain how it works.

Most adorable program ever made.

First, we need to consider how Tenshi acts.  Yuri says that if you stick to the program, Tenshi just observes and generally leaves you alone.  Now, if you deviate from the program, she confronts you and asks you to return to your proper station.  When you start to attack her, she spawns a blade to defend herself and slowly advances to melee range.  When the attack intensifies, she spawns a second blade or a shield, depending on the situation in front of her.  If, instead, you put yourself in melee range, she starts executing Lag commands, which either speed her up or slow you down.  I’m not sure which is the case because the battle is shown from Yuri’s perspective, but there’s a difference.  The latter leaves her vulnerable to other attackers.

You should notice two aspects of Tenshi’s power.  The first is all her commands are reactive .  She does nothing unless someone gives her a reason to act.  Second, she slowly escalates her attack.  Tenshi doesn’t immediately start lagging her opponent to make easy work of them.  Instead, she uses a specific level of force proportional to her opponent’s.

Never bring a knife to a gunfight... unless you're Tenshi.

In short, Tenshi acts just like a computer program.  Every program in existence requires some sort of user input, even if the means aren’t entirely obvious.  A program that seems to execute entirely by itself requires action from you to start.  That action usually generates an empty String, or blank input, which tells the program to execute with default conditions.  Thus, if Tenshi is a computer program, then the SSS gang members are either users or programs providing input.  For example, she might have the following, very basic, code:

while(meleeTest(targets)){
delay(targets);
}

What happens here?  This is a while loop, a conditional statement that repeatedly runs so long as the condition remains true.  In this case, the condition comes from the function meleeTest.  meleeTest accepts targets as its argument, or input.  A good programmer creates programs a normal person can read.  Therefore, you can assume this function checks for any person on the list of targets stands in melee range.  If true, the function returns the value true, which causes the loop to execute.  The loop body runs the delay function on the target list, and it will continue as long as the condition continues returning true.  Once meleeTest fails, which returns false, it continues past the loop to the next statement in the program.

Stand still so I can gut you properly!

Clear as mud, right?  Well, she does have an AI program for combat, but it doesn’t seem very sophisticated at this point.  You might see enemies in Halo or Gears of War who do things like flank or take cover when the situation calls for it.  Tenshi just walks in a straight line and has her way with you.  You might wonder how she could be so deadly, and it goes back to classic gaming architecture.  Back in the day, developers had little memory or processing power to use when making a game.  They could only design rudimentary encounters.  To compensate, they made their bosses tough as nails.  These enemies can hit unreasonably hard, spam attacks, and take incredible amounts of punishment before dying.  This has the bonus side effect of taking all your quarters at the arcade.

In conclusion, if Angel Beats takes place in a video game, Tenshi is That One Boss.

Yeah, she's gonna be just fine.


7 Responses to “Angel Beats – Tenshi the AI”


  1. April 11, 2010 at 5:05 pm

    Brilliant post, Rakuen! I found this to be educational, interesting and highly enjoyable.

    I always find it so interesting to see how different people respond to certain parts of an anime series. In this case, as someone who plays a fairly small amount of games, I didn’t realise the full extent of the parallels between Angel Beats and a game (or rather, Tenshi and a boss). Anyway, one of the reasons I don’t play many games is that I’m pretty terrible at them. I think it’s safe to say that if I was in the SSS and battling Tenshi, I don’t think I’d survive very long. I guess Angel Beats is like a game in that sense too, though. You have lives.

  2. April 11, 2010 at 7:03 pm

    Another great theory on what is going on XD Someone on a forum called this series the Matrix but you broke it down and made it an actual possibility.

  3. 3 Dez691
    April 11, 2010 at 8:39 pm

    I’m no programming expert, but since Tenshi can use multiple abilities at the same time and while loops execute only the code inside them infinitely, I think it’d be more likely if she had a main while loop that encompasses every function she has in if statements:

    while(dangerLevel == 0){
    if(meleeTest(targets)){
    delay(targets);
    }
    if(dangerLevel == 1){
    rightBlade(targets);
    }
    else if(dangerLevel == 2){
    rightBlade(targets);
    leftBlade(taegets);
    }
    }

    I’m guessing she does have a normal mode, so another while loop would take care of that.
    I just know it’s going to be a really good day when I read something relating programming and anime.

    • April 11, 2010 at 8:58 pm

      Yeah, you’re right. To go even further, she would likely use threading, which would put Delay on an entirely different thread. Of course, the more code I write, the more I have to explain and the more confusing it can be to non-programmers, so I tried to go with the simplest scenario.

      Thanks for the comment! :]

  4. April 17, 2010 at 6:43 pm

    Ah~ I thought the title was gonna be an sub-H-type anime since I’ve heard of an H-title having Beat and Angel in the title (not sure what it was tho, but w/e xDD). And the theory behind anime is applaud-able as well, borrowing from programming to explain a point (yay programming! x3). a You sir have successfully netted the animation companies one more viewer.

    I never got what you meant by “delay” though. Is it because Tenshi just acts to buy enough time for the attacker to run out of whatever viable options they have?

    • April 17, 2010 at 9:05 pm

      You’re thinking of Beat Angel Escalayer.

      She actually uses an ability called Delay. It makes her appear to move very quickly. Whether she’s speeding up, time is slowing down, or she’s literally jumping to a different coordinate remains to be seen.


Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Connecting to %s


Categories

Archives

Rakuen’s Tweets

Blog Stats

  • 1,404,208 onigiri served

Follow

Get every new post delivered to your Inbox.

Join 44 other followers