Super Mario Bros. Online

Super Mario Bros. Online Forums
March 29, 2024, 05:02:35 am
Welcome, Guest. Please login or register.
Did you miss your activation email?

Login with username, password and session length
News: Welcome to the Super Mario Bros. Online forums! We hope you enjoy your stay! Please remember to read the rules!
 
  Home Help Search Arcade Gallery Website download Staff List Login Register  

A Brief Exposé on SMBO Enemy AI

Pages: [1]
  Print  
Author Topic: A Brief Exposé on SMBO Enemy AI  (Read 404 times)
jdaster64
Global Moderator
*****
Offline Offline

Posts: 486


FINALLY learned how to block POW blocks in MKWii


View Profile
Badges: (View All)
Third year Anniversary Level 4 Windows User
« on: February 07, 2011, 01:57:56 am »

A Brief Exposé on SMBO Enemy AI:

Simply put, Super Mario Bros. Online’s enemies are all basically the same, and conform to a strict set of rules as to when and how they move.

We’ll start with the basics, the most pressing matter being when enemies are allowed to chase you without you first striking them.  This is rather simple, if your level is four levels or more above the enemy’s level, it will not attack you.  All enemies that have no set level (all bosses and midbosses, DE Koopas, MK-PVP Goombas, and select Shy Guys, Pipe-Dwelling Lakitus, and Blue Paratroopas) will always auto-attack, regardless of your level or stats.  On the flip side, a select few enemies will never attack first, these including Goombas, level 2 Koopa Troopas, Drillbit Crabs, most Pipe-Dwelling Lakitus, and the like.

No enemy will start to chase you, regardless of level, unless you pass within its range of sight.  Each enemy has a set value for this stat, and there is no way to determine it within the game.  Note, however, that this value is the absolute distance between your tile and the enemy’s, calculated by the formula √(H2 + V2), where H and V are the horizontal and vertical distance between you and the enemy, respectively.  So for a range of 5 (a fairly typical value for later enemies), an enemy that can attack first will start chasing you once you touch any of the tiles with red borders below (you can determine which these are by imagining a circle with radius 5 tiles, and seeing which tiles' central points are inside or on the border of the circle).


Note that special attack range is calculated in the same manner (I think, I’ll test that when I get a chance).

Now then, for the finer points of enemy patterns. Much like the red ghost in Pac-man, if an enemy has begun to chase you, it will always try to get as close to you as possible with each step it takes.  Therefore, it will always move in the direction in which it is farthest from you.  For example, if you are situated three tiles to the left and four down from an enemy, your total distance is √(32 + 42) = 5.  Moving to the right or up would obviously increase the enemy’s distance from you, so it will not consider those options in most cases.  Moving to the left would make the distance become √(22 + 42) = √20, and moving down would make it √(32 + 32) = √18.  Therefore, it would be slightly preferable for the enemy to move down, as √18 is slightly shorter a distance than √20.  Note that if two options are equally viable (e.g. up or left if you are three tiles up and to the left of the enemy), it will randomly choose between them, and if one of two favorable options is blocked, it will choose the other (e.g. it would go to the left in the first scenario).  Now, if there is no way for the enemy to get any closer to you (e.g. there is some object obstructing a direct path between you and the enemy), rather than staying in one place forever, it may occasionally move in a random direction.  In most cases, though, its best option after that is to return to the spot it was in, so this rarely makes a large difference.

Here are some sample situations, with the enemy paths marked clearly.


In this situation, the enemy can choose either down or right at each spot marked in yellow (including its original location), then it has only one option from each other spot.


In this fairly common (and rather annoying) situation, the enemy will continue to move down until it is one tile above and to the left of the player, where it will randomly choose to move right or down.  If you are traveling somewhere with a much higher-leveled player and an enemy is attracted to you, try to create this type of situation, and have the higher-leveled player stand at or before the enemy’s two-choice intersection, so he can dispatch of the enemy most easily.


In this situation, it would still be of interest to the enemy to move to the right after its second move, but the wall prevents it from doing so, so it goes up a tile instead.  A similar choice is made at the next stop, and it continues straight afterward.


This type of tactic is your best bet when fighting boss battles that include normal-enemy minions. In this setup, there is no way for the enemy to escape, for if it moves up or down, its best move from there is to move back to where it was.  As far as I’m aware, the player is completely safe in this situation (leaving him free to pummel the enemy with special attacks or ranged weapons if he so desires). However, were there only one blocking tile rather than three, if the enemy were to randomly move up or down, it would start moving to the right after that, so make sure that you trap enemies behind sufficiently wide platforms to cover your needs.

So that’s about all there is to know about enemy AI; I’ll try to add at least the bosses’ sight range values to the SMBO guide at some point in the near future.

Please leave your questions and comments here!
« Last Edit: February 07, 2011, 06:57:38 pm by jdaster64 » Report Spam   Logged


First to get all 47 cards, all in inventory
SIX maxed characters at level 75!
Check out my updated suggestions thread here!

Share on Facebook Share on Twitter

Penguin4478
Touhou Music is Best
Global Moderator
*****
Offline Offline

Posts: 1015


Top Poster On The Forums!


View Profile
Badges: (View All)
Tenth year Anniversary Nineth year Anniversary Eighth year Anniversary
« Reply #1 on: April 11, 2011, 07:11:16 pm »

Shocked is the enemy sight formula based off of eclipse, or based off of programming kimi and hydra did?
Report Spam   Logged

Creator and leader of SMBO Union!

YTC: http://www.youtube.com/user/Penguin4478/videos
Card List and Recipes 100% Complete!
jdaster64
Global Moderator
*****
Offline Offline

Posts: 486


FINALLY learned how to block POW blocks in MKWii


View Profile
Badges: (View All)
Third year Anniversary Level 4 Windows User
« Reply #2 on: April 12, 2011, 04:35:04 am »

Funny thing, I think I overcomplicated that bit of analysis, and it actually just takes the shorter distance between you and the enemy; e.g. if either vertical or horizontal distance is less than seven tiles for a 7-range enemy, it will target you.  It's a shame, it can't have been to hard to code circular targeting.  As far as I know, the direction it chooses is still determined by triangulation, though.

In recent news, I found out that if an enemy is trying to reach a certain tile, but an NPC or player character is blocking the way, it will never move the spot it is in (unless its target tile changes, of course).  Also, if an enemy is trying to go downward, it will stay put even if in front of a NPC-block tile.  If facing any other direction, though, it will occasionally move in a random direction as I said before (unless blocked by an NPC/player, of course).

To answer your question, I'm pretty sure all of the coding behind this is native to the Eclipse engine, although I could be wrong.
« Last Edit: April 12, 2011, 04:36:58 am by jdaster64 » Report Spam   Logged


First to get all 47 cards, all in inventory
SIX maxed characters at level 75!
Check out my updated suggestions thread here!
Pages: [1]
  Print  
 
Jump to:  

Powered by EzPortal
Bookmark this site! | Upgrade This Forum
SMF4Free.com - Create your own Forum

Powered by SMF | SMF © 2016, Simple Machines
Privacy Policy