DIA FFT #4: Enemy Movement AI

by DFortun81


Posted on September 13, 2006 at 7:32 AM



DIAFFT is a series of examples that will eventually develop an Final Fantasy Tactics Engine. We are currently on Example # 4/6, Basic Enemy and Guest AI Movement.

Controls Up, Down, Left, Right or Move Mouse -- The usual
Enter or Left Click -- Select Location/Unit

F5 -- Debug, Change the Maxstep

DIAFFT History
DIA FFT #4: Enemy Movement AI DIAFFT #3: Abilities and Status
DIAFFT #2: Selection
DIAFFT #1: Movement

NOTE: The Zip contains a GMK, GEX, and Gm6 file. The GEX is the WinSkin extension required for the GMK.



Crazy Star commented September 13, 2006 at 12:13 PM
Very cool example. I only read some of the source but everything seems to be working as expected. The only reason why I write this comments is to mention that sprites that arent transparent shouldn't have precise collisions set if they are going to be checked for collisions. Also where did you get those sprites and tilesets?
Cesar commented September 13, 2006 at 12:25 PM
really good, i'll base my movement and selection example on this, but it'll be a bit different...
it is a bit confusing, though, but good nonetheless...
8/10 *it would be 9/10 but i stopped giving 9s except for those who are REALLY good*
The movement moves quite fluidly, the mouse movement is also a great feature, but the act feature is a bit odd... especially since it shows a cross instead of a single square...
DFortun81 commented September 13, 2006 at 3:36 PM
&SpectreNectar: which object is transparent that deals with precise collision? If you are thinking of the mouse, it is no sprite, it is a rectangle. If you were thinking of a Unit, then you didn't look at the mask_indexes.

&mr.pacman0: Act shows a Cross to demonstrate A Ranged Attack, like a Fire spell. If you wanted, you could modify the range of the attack by saying:
atkrange = 0;
Crazy Star commented September 13, 2006 at 5:10 PM
eg spr_unit_mask - it doesn't require precise collison checks because it is a rectangle and nonprecise collision checks rely on rectangles. It's a detail worth noticing because it can really boost speed..
Polystyrene Man commented September 13, 2006 at 9:20 PM
This is the most exciting thing that's ever happened to me.

Well, not really, but it's still a good example. I'll give it a 9/10 because I would have liked to see different "act" formations (e.g., a line of attack instead of a cross).
Polystyrene Man commented September 13, 2006 at 9:21 PM
This will lead into the next DIAFFT where it will involve more attacks and abilities. (atkrange of 0 is a single cell, atkrange of 1 is for a Fire, Bolt, or Ice ability)
Quote

Aha...
DFortun81 commented September 13, 2006 at 10:11 PM
I didn't get into different Act formations because of what I wanted to accomplish. (only needed Selection and Turns, Act was kinda an extra)

EDIT: COMMENT AND RATE PLZ
7 out of 27 DLers are man enough to comment, 1/3 are 1337 enough to actually RATE it. (not including duplicates and posts by me)
Polystyrene Man commented September 13, 2006 at 10:52 PM
Looks like it didn't count my rating...
Cesar commented September 14, 2006 at 12:10 AM
yes it did, i put an 8/10 and you put a 9/10... instead of rounding off 8.5/10 to 9/10, it drops the decimal and puts 8/10...
Polystyrene Man commented September 14, 2006 at 12:46 AM
I meant that it showed only 1 vote after the rating:

8/10 (1)
Quote
ParadoxEquation commented September 14, 2006 at 3:05 AM
10/10

My team is doing a tactic game, and this is gonna be really handy to learn. Thank you.
DFortun81 commented September 14, 2006 at 3:39 AM
I wish you the best of luck. (and all the others who are attempting one)
zax commented September 16, 2006 at 6:42 AM
nice i like it, very useful
zero koll commented September 22, 2006 at 7:29 PM
The best example i have ever seen!

10/10!
DFortun81 commented September 23, 2006 at 6:24 AM
Thanks guys, although it's not the best. ( the next DIAFFT pwns this one ;D )
DARKSPARK3893 commented October 01, 2006 at 12:55 AM
nice, i liked it 10/10
Mewgull commented October 05, 2006 at 11:24 AM
you have shown NEARLY everything there is to a tatics battle system.. although... there are still stuff to show, like maybe some health, and enemy movement, instead of moving the enemy yourself... perhaps thats in the next one? =)
9
DFortun81 commented October 05, 2006 at 1:43 PM
Well, this version only shows Ally Units, you can move and attack them because if the battle field was real, you could actually kill your teammates.

And yes, the next version there is health, but enemy movement is last on the list.
DFortun81 commented October 07, 2006 at 7:45 AM
*ALL COMMENTS BEYOND THIS POINT ARE FROM DIAFFT #3*
Shork commented October 11, 2006 at 3:48 PM
Oh, the graphics are from the RPG Maker XP RTP. I never figured out how to get the graphic files out of the RTP though.
DFortun81 commented October 20, 2006 at 10:23 PM
Program Files/Common Fils/Enterbrain
Tumetsu commented October 29, 2006 at 6:22 AM
Very nice engine! Cannot wait next part! 10/10
But you should make little documentation because some not-so-experienced users may have problems figuring out where to add new attacks and so on.
FlamingFury commented November 11, 2006 at 7:55 AM
This rocks!
DFortun81 commented June 22, 2007 at 12:12 AM
DIA FFT #4: Enemy Movement AI Added!
DFortun81 commented June 22, 2007 at 8:18 AM
For GM6 Users: I added a GM6 version of the Engine.
DFortun81 commented July 11, 2007 at 10:36 PM
Do NOT post telling me that I'm using RMXP graphics. Do you think I'm blind? Do you think I care? Nope.
Severene42 commented September 11, 2007 at 11:56 PM
The awesomeness. BOOYOW.
DFortun81 commented January 12, 2011 at 12:03 AM
In order to make this example compatible with GM8, go into the script "timeline_start" and add the line "timeline_running = 1;" to the end just before the "}". This will allow the enemies to move as intended.
DFortun81 commented April 19, 2014 at 4:13 AM
Updated to work with GM:Studio
They removed show_menu, so I had to get creative to fix it.

Here is the file:

http://files.64digits.com/DFortun81/DIA_FFT_AI_DFortun81_Fixed.gmz
I added a very simple menu popup system, fixed a bug in the obj_attack object where it would remove mana for each instance of the object rather than the cost of the spell. (dumb mistake a long time ago)

The menu system intelligently places the cursor on the top-most index for quick and effective index selection. Such as if you can Move, it will place the cursor there. If you can neither Move nor Act, it will place it on Wait.

Also, don't use show_message. The thing breaks the game since clicks performed on that popup also get detected in the game. I would have made an object for displaying error messages, but I got lazy.

Enjoy!
-DF81
PS: I might redo this project. Maybe.