Phantom Tactics development journal

Make games! Discuss those games here.

Moderators: Bob the Hamster, marionline, SDHawk

User avatar
Momoka
Metal Slime
Posts: 759
Joined: Fri Apr 24, 2009 5:29 pm

Post by Momoka »

Mogri wrote:Yes. Use the included file, which is included for this reason and others.
Erm....how? It says audwrap.dll was not found.
User avatar
Mogri
Super Slime
Posts: 4598
Joined: Mon Oct 15, 2007 6:38 pm
Location: Austin, TX
Contact:

Post by Mogri »

Oh, this is because I'm an idiot. I'll upload the dlls soon.

(edit) Done. This should also solve a few related issues that you didn't mention (see Delfino's review).
Last edited by Mogri on Thu Sep 03, 2009 6:40 am, edited 1 time in total.
User avatar
Mogri
Super Slime
Posts: 4598
Joined: Mon Oct 15, 2007 6:38 pm
Location: Austin, TX
Contact:

Post by Mogri »

:zombie: :zombie: :zombie: Rise from the dead :zombie: :zombie: :zombie:

What's this? Madness! I am reviving a three-year-old thread because I am reviving a three-year-old game. Phantom Tactics is in development again.

When we last heard from it, Phantom Tactics was stalled because I was really dreading creating a few things:
  • Menus for army management
  • A world map
The world map problem will be solved by not having one. This has the disadvantage of putting the game on rails: you can no longer decide to go back to an area.

I'm okay with this. A linear (if branching) game flow is good enough for Fire Emblem, and it's good enough here. The bigger loss is a sense of the game's geography, but it's an acceptable loss.

As for army management, I was facing two problems: managing the units you already have and buying new ones. I've decided to roll them up into one interface and have eschewed default menu functionality in favor of a more visual interface. Hopefully, I'll be able to get some screenshots of it soon.

I also did some stat shuffling on all of the classes that aren't playable during chapter 1. I'm happy with the stat balance for Janus, Garland, and the three basic classes, but I wanted to make some adjustments to the tier 2 classes. The net effect as far as chapter 1 is concerned is mostly negligible, but one important difference is that the knight in the final battle is a little less of a wall.

Finally, I tried to reach out to Twinhamster for his assistance on the remaining unit animations. He might be avoiding me. :hurr:
User avatar
Baconlabs
Liquid Metal Slime
Posts: 1067
Joined: Mon Nov 02, 2009 6:29 am
Location: Middlin, TN

Post by Baconlabs »

Yusssss

I cannot wait to see what happens
User avatar
Bob the Hamster
Liquid Metal King Slime
Posts: 7460
Joined: Tue Oct 16, 2007 2:34 pm
Location: Hamster Republic (Ontario Enclave)
Contact:

Post by Bob the Hamster »

Yay! I am excited about more Phantom Tactics!

This reminds me that I really want A-star pathfinding and Dijkstra range-finding as built-in features. Your input Mogri, would be valuable as to how a plotscript interface for these should look.
User avatar
BMR
Metal King Slime
Posts: 3310
Joined: Mon Feb 27, 2012 2:46 pm
Location: The Philippines
Contact:

Post by BMR »

Please forgive the newbie question, but, what exactly is Phantom Tactics? I gather that it's an old project of some renown, but beyond that, I don't really know much of it.
Being from the third world, I reserve the right to speak in the third person.

Using Editor version wip 20170527 gfx_sdl+fb music_sdl
User avatar
Bob the Hamster
Liquid Metal King Slime
Posts: 7460
Joined: Tue Oct 16, 2007 2:34 pm
Location: Hamster Republic (Ontario Enclave)
Contact:

Post by Bob the Hamster »

User avatar
BMR
Metal King Slime
Posts: 3310
Joined: Mon Feb 27, 2012 2:46 pm
Location: The Philippines
Contact:

Post by BMR »

Oh, well wow, that is extremely impressive. I've been trying to figure out how to do a battle system like that for a while now, though I gave up on it as being beyond my current skillset, hehe. Looking forward to more of this then!
Being from the third world, I reserve the right to speak in the third person.

Using Editor version wip 20170527 gfx_sdl+fb music_sdl
User avatar
Mogri
Super Slime
Posts: 4598
Joined: Mon Oct 15, 2007 6:38 pm
Location: Austin, TX
Contact:

Post by Mogri »

Phantom Tactics AI

The general AI routine is to construct a Dijkstra map for the entire map, then use that for each unit to decide on a "best" tile. Dijkstra map means more or less assigning a value to each possible destination that represents how much you want to move there. You start by assigning values to particularly valuable destinations (for example, enemies or allies), then you flood-fill the rest of the area with decreasing numbers, representing that it's more desirable to get closer to good things.

In this particular case, I use two Dijkstra maps: one representing distance to nearest ally and one representing distance to nearest enemy. To store these maps, Phantom Tactics uses a maptile layer with an empty tileset. This frees up your globals for something else, plus you can hold several pathmaps in memory at the same time if you want (I don't). The disadvantage is that you can only use values from 0 to 255; luckily, I don't really care about values higher than 255. Incidentally, this is the step during which "Thinking" is displayed onscreen.

With these maps stored, each unit uses a heuristic to determine its preferred tile. As an easy example, a Cleric will gravitate towards its allies, since it can't attack. A more complicated example is that when a unit is deciding how to group up with its allies, it will prefer to support an ally who is within attack range of an enemy. And the most complicated thing is deciding how to attack.

Due to the combat mechanics of Phantom Tactics, you don't want to move your attacker into position until your supporters are already in place. If a unit is within attack range and the AI decides it's a good idea to attack, the first step is to figure out which unit is the best attacker. There are a lot of considerations here: Who's going to benefit the most from attacking directly? Who's going to take a lot of damage as a direct attacker? How much support will each unit be able to receive if it's the attacker? Will the attacker die? And so on. The AI is very aggressive and will usually fight even when the conditions are unfavorable, but it won't attempt an attack that doesn't damage the target.

Once the attacker is decided, he can't move yet. The supporters need to be brought into position. There's a similar level of complexity here, and even more considerations that the AI doesn't bother with; notably, should we save this unit to perform an attack later. The AI always prefers to stack support units. Fortunately, it will stack the units that are best at supporting: bowmen, for example. This means that if there are extra attackers after this combat resolves, they're more likely to be front-line units anyway. During this phase, the AI is forbidden to move next to an enemy unit -- that would start another combat.

After everyone who's going to fight has fought, the rest of the movement is resolved. The AI prefers to group its units, but if a unit is already grouped with other units that haven't moved yet, it will approach the enemy. The AI will hesitate to enter enemy attack range, preferring to stay just outside unless it's already near the line.

In order for a unit to move to the destination tile, the game calculates the unit's movement range as if it were already there. As discussed in the A* thread, this creates a map of descending values from the point of origin. The unit then traverses that map using the highest-valued adjacent tile.

And now you know everything* you need to know to reproduce the Phantom Tactics AI :)

*Note: assumes you have taken several years of college-level programming courses
User avatar
Mogri
Super Slime
Posts: 4598
Joined: Mon Oct 15, 2007 6:38 pm
Location: Austin, TX
Contact:

Post by Mogri »

All that said, I just noticed some considerable flaws in the support positioning algorithm. It's fixing time!
User avatar
Mogri
Super Slime
Posts: 4598
Joined: Mon Oct 15, 2007 6:38 pm
Location: Austin, TX
Contact:

Post by Mogri »

I tried booting up the game with the latest executable today and came across a weird engine bug. It seems that for some reason, palette changes don't work when a menu is open. This is an issue for this game in particular, which opens the difficulty menu before fading the screen in. I've worked around it, so it's not a huge deal.

Another change I've noticed is that the rectangles now allow negative widths. People complained about HP boxes on dead units before? This is way worse. This is more my fault than the engine's.

ANYWAY: The army management menu has some issues to work out, so no screenshots today.
User avatar
Mogri
Super Slime
Posts: 4598
Joined: Mon Oct 15, 2007 6:38 pm
Location: Austin, TX
Contact:

Post by Mogri »

Image

classy


On the right is your current army. Press up and down to scroll through them. The question mark is a placeholder for your very next recruit: select it, and instead of changing someone's class, you can choose which unit to take.

On the bottom is the class wheel. Press left and right to cycle through them. You can preview the stats for the new class from here. Of course, since he's just a level 3 Bandit, Caden can't actually access any of these jobs except the three basic classes (Bandit, Fencer, and Bowman).

I may add a backdrop later. I also need some music to go with this screen.

I think this is the first time most of these classes have seen the Internet. Can you name them all? Start from the top with Bowman and go clockwise. For each class you guess correctly (excluding the basic classes and the Knight, whose name appears in the screenshot besides appearing in chapter 1), you get a Phantom Tactics Cookie! Collect enough of them and something good is bound to happen.
Last edited by Mogri on Mon Jan 28, 2013 1:43 am, edited 1 time in total.
User avatar
Spoonweaver
Liquid Metal King Slime
Posts: 6247
Joined: Mon Dec 08, 2008 7:07 am
Location: Home
Contact:

Post by Spoonweaver »

I think this is the first time most of these classes have seen the Internet. Can you name them all? Start from the top with Bowman and go clockwise. For each class you guess correctly (excluding the basic classes and the Knight, whose name appears in the screenshot besides appearing in chapter 1), you get a Phantom Tactics Cookie! Collect enough of them and something good is bound to happen.
Ok, let's see:
Bowman, wizard, pirate, ninja,robot/spearman, knight, cowboy, fencer, bandit, jogger
User avatar
Mogri
Super Slime
Posts: 4598
Joined: Mon Oct 15, 2007 6:38 pm
Location: Austin, TX
Contact:

Post by Mogri »

Two exactly right and two mostly right (again, not counting bowman/knight/fencer/bandit).

I've bumped up the difficulty, especially for the higher difficulty levels. It's a negligible difference for Easy or Normal, but it will make a large difference for Superhuman, where enemies will now receive a 2.5-point increase to all stats on top of their existing difficulty bonuses. This should have a marked effect on chapter 1, but less of an effect later on. On Normal, the bonus is less than half a point, which is less than the (still insignificant) bonus your story characters receive. Incidentally, there's a 1.5-point variance in units' starting stats anyway.

And that brings us to point B: implementing the actual functionality behind the army management menu. Class changing is easy enough, but I'm still throwing around ideas about what to do for the new unit UI.

Unit recruitment is the reason you've been earning gold at the end of each battle (and potentially by using your bandit's special ability). You can recruit a unit of any level up to Janus's. Once you unlock advanced classes, you can recruit units directly into those classes; and once you manage to recruit a magic user, you will probably be able to recruit the magic classes (but don't quote me on that).
User avatar
Mogri
Super Slime
Posts: 4598
Joined: Mon Oct 15, 2007 6:38 pm
Location: Austin, TX
Contact:

Post by Mogri »

Things that you can theoretically do now, but which I haven't tested:
- Change a unit's class all willy-nilly
- Place units on the map at the start of a battle (a la Fire Emblem/FFTA)

Also, base stat tweaks to make the second-tier physical classes a bit better. You can expect about a six-point stat boost going from a basic class to an advanced class.
Post Reply