Bay 12 Games Forum

Please login or register.

Login with username, password and session length
Advanced search  
Pages: [1] 2

Author Topic: Politics, Strategy, Tactics, and AI - Suggested Reading  (Read 1249 times)

Fieari

  • Bay Watcher
    • View Profile
Politics, Strategy, Tactics, and AI - Suggested Reading
« on: July 24, 2007, 11:08:00 am »

Hey Toady, not sure if you're familiar with Jeff Orkin's work.  He's the guy that did the AI for F.E.A.R., often considered the best game AI ever written.  Anyway, he's written a number of papers and articles on how it works, at http://www.jorkin.com/  , and after having read them myself, I think the techniques would be -perfect- for a global politics engine, that would also run strategic war, and tactical combat as well.

Anyway, since this stuff is coming up very soon, thought some reading material might help you out. "3 States & a Plan: The AI of F.E.A.R." in particular is the key document here.

Logged

Akjosch

  • Bay Watcher
    • View Profile
Re: Politics, Strategy, Tactics, and AI - Suggested Reading
« Reply #1 on: July 24, 2007, 11:32:00 am »

Erm ... the AI in F.E.A.R. is mostly smoke and mirrors driven by quite deliberately placed environments (quote: "The design philosophy at Monolith is that the designer’s job is to create interesting spaces for combat, packed with opportunities for the A.I. to exploit."). They have some basic problem solving (which is mostly an A* search through the problem space; nothing really exciting) and groups as entities. That, in itself, is probably about as complicated or less so than the current AI in DF.
Logged

Fieari

  • Bay Watcher
    • View Profile
Re: Politics, Strategy, Tactics, and AI - Suggested Reading
« Reply #2 on: July 24, 2007, 12:56:00 pm »

I'm talking more on an implementation level.  The use of planning instead of FSM, creating a database of actions and goals, weighting the links and using A* to navigate the decision tree...

Yes, FEAR's AI was mostly good level design.  But there's still the coding part to do, and I'd bet that these little details would help greatly in modularity and expansion, making it easier to code additional things further on.

For instance,

quote:
Our A.I. system consisted of goals that competed for activation, just like they do in F.E.A.R.  However, in the old system, each goal contained an embedded FSM.  There was no way to separate the goal from the plan used to satisfy that goal.  If we wanted any variation between the behavior of a mime and the behavior of a mutant, or between other character types, we had to add branches to the embedded state machines.  Over the course of two years of development, these state machines become overly complex, bloated, unmanageable, and a risk to the stability of the project.

That's the sort of information I think would be helpful when designing the game.  The result isn't anything excessively spectacular... standard FSMs can do the same thing.  But coding FSMs gets complicated, while this is expandable.

No difference in what we, the players, get.  Big difference in making it.

[ July 24, 2007: Message edited by: Fieari ]

Logged

hactar1

  • Bay Watcher
    • View Profile
Re: Politics, Strategy, Tactics, and AI - Suggested Reading
« Reply #3 on: July 25, 2007, 09:59:00 am »

The goal prioritization would be especially useful in DF.  The "Satisfy Thirst" goal should not become highest priority until they're dying of thirst, whereas the "Defend the Fortress" goal should be higher than any normal job, but not higher than goals involved in preserving one's life, except for particularly brave dwarves.
Logged

Axehilt_VuP

  • Bay Watcher
    • View Profile
Re: Politics, Strategy, Tactics, and AI - Suggested Reading
« Reply #4 on: July 25, 2007, 10:26:00 am »

Really great article, thanks for the link.

That said, I think FEAR's AI was a bit overblown.  Functionally I barely noticed much difference from the "feel" of the AI's intelligence in Half-Life 1.

Logged
Re: Politics, Strategy, Tactics, and AI - Suggested Reading
« Reply #5 on: July 25, 2007, 10:41:00 am »

Never played FEAR but the special forces from HL impressed me more than any FPS AI I've seen since.
Logged

Fieari

  • Bay Watcher
    • View Profile
Re: Politics, Strategy, Tactics, and AI - Suggested Reading
« Reply #6 on: July 25, 2007, 01:57:00 pm »

I'm thinking on a larger level here, though.  You can be disdainful of any FPS's AI mostly in the fact that the goals are darned simple.  "Kill the player!"  There's only so many ways you can go about doing that.  Yeah, there's tactics and all, and that's good, but it's still just a single goal.

Apply the SYSTEM to politics.  First, you need to figure out what the nobles wants.

"Create a glorious empire that spans from sea to shining sea!"
"Promote liberty and justice for all citizens!"
"Lead our nation into an era of prosperity and wealth beyond all expectations!"
"Have our name be feared by our enemies!"
"Have my name remembered for generations to come!"

Let's take that last goal as an example.  With the planning system, you would set the goal, and have a couple of things that could lead to it.  Creating a large empire could be one such method.  Alternatively, building massive monuments, like the Colossus of Rhodes, the Hanging Gardens, or the Great Pyramids, should be another.  Taking over a huge swath of land is pretty hard; especially if that land is already occupied by military nations.  So lets go with monument building.

Monument building is slow, and human lifetimes are short.  We need manpower.  Organize work teams.  The work teams need food, so make sure there is still farming going on.  Need to increase the size of the work teams, so send out slaver parties.  The slavers are decreasing our farming population, so send the slavers to OTHER nations instead.

Instant politics.  Simple system.  And the beauty is, each leader can have different goals, and even those that have the same goals can find themselves in different situations, which would weight the planning trees different, so they'd take different routes to get what they want.

Logged

Toady One

  • The Great
    • View Profile
    • http://www.bay12games.com
Re: Politics, Strategy, Tactics, and AI - Suggested Reading
« Reply #7 on: July 25, 2007, 09:41:00 pm »

I haven't had a lot of time to think about the implementation of this, of course, but one thing that stuck out that kinda bugged me was the world state discussion.  In particular, during planning, the nodes are "world states" and the edges are "actions".  This suggests that the world states have to be fairly small, and that during the "it's easy to add a turn on the lights action" discussion, it neglected to mention (I gather?) that this would require adding the light status to every single node of the planning tree and that there'd be lots of new edges between all these nodes (at least state nodes where the light changing action can occur).  Wouldn't this method get out of control memory and possibly speed-wise in all but the most simple games?  I suppose that many nodes wouldn't actually need to exist since they wouldn't be reachable from the current state (assuming the planning tree (graph?) is made on the fly so that unreachable nodes are excluded).  There's probably a lot that can be done to mitigate the overhead.  This is just my first impression.
Logged
The Toad, a Natural Resource:  Preserve yours today!

hactar1

  • Bay Watcher
    • View Profile
Re: Politics, Strategy, Tactics, and AI - Suggested Reading
« Reply #8 on: July 26, 2007, 08:56:00 am »

Yeah, DF might have an unwieldy number of goals and actions for this to be practical.  But I don't think the light state needs to be included in every single node of the planning tree in that example; the light state exists in the game world, and all the planning tree needs to know is how to "sense" that information from the agent's surroundings.  Similarly, an enemy agent needs to know where the player is, but his AI code isn't directly updated whenever the player moves; it just "looks" around for the player whenever it needs to know.  That's the "Working Memory" box in figure 5.

Nevertheless, FEAR's AI needs to run for probably only 10-40 agents at a time, and they each have only a few goals apiece with a few dozen actions at their disposal.  DF needs to run for many hundreds of agents at a time, most of whom have complex goals (drink when I'm thirsty, eat when I'm hungry, sleep when I'm tired, take a break when I've been working a lot, defend myself when attacked, and do my job otherwise) and, all told, probably a hundred possible actions they can take.

Honestly, it's a miracle that DF's AI works as well as it does at its scale, so I wouldn't worry about re-engineering it unless you have some comprehensive idea of how to make it all work.  That's not to say it couldn't be made smarter using the current systems.

Logged

axus

  • Bay Watcher
  • Axe Murderer
    • View Profile
Re: Politics, Strategy, Tactics, and AI - Suggested Reading
« Reply #9 on: July 26, 2007, 11:35:00 am »

I think the world states were generated on the fly, based on where it was and creating each new one based on where it was going.  It wouldn't need to be concerned with every light or everything in the world.  The current world state could be read from global variables and extrapolated from there.  

The effect is really no different than having jobs generate new jobs if they can't find their resources.  The nice thing was that it handled multiple ways to accomplish the same goal, for dwarves there's usually only one way to do it.  For complex tasks like setting up a farm, it'd probably be better for the player to script that how he likes it.  It might be good for invaders though, who are just looking to kill or kidnap any dwarf they can.

Logged

AlanL

  • Bay Watcher
    • View Profile
Re: Politics, Strategy, Tactics, and AI - Suggested Reading
« Reply #10 on: July 26, 2007, 01:33:00 pm »

Personally, I think the current AI with some tweaks (pay attention to fire, speed up job searching, etc.) would be suitable for the final game, but all in all the end decision is up to toady, all the rest of us can do is put ideas out there for him to consider if he wants to.
Logged

Fieari

  • Bay Watcher
    • View Profile
Re: Politics, Strategy, Tactics, and AI - Suggested Reading
« Reply #11 on: July 26, 2007, 03:59:00 pm »

Well, again... I'm not hoping that this is used for each individual entity, but rather for political planning.  There are probably only a dozen or so civilizations total in the world.  Planning for them could be handled with this method.

Sending out armies could also be handled this way.  Attack?  Defend?  Ambush?

Individual units would likely be too much.

Logged

Tallim

  • Bay Watcher
    • View Profile
Re: Politics, Strategy, Tactics, and AI - Suggested Reading
« Reply #12 on: July 28, 2007, 12:27:00 am »

In terms of politics the state tree really only has to run for whichever noble is currently "in charge". Based on rank. Is anyone really going to defy the king of the dwarves?

Maybe one or two extra state trees for Military and Social concerns, but even those would be swayed by what the highest noble wants.

Traditionally big decisions would take much deliberation so you wouldn't have to run the entire politics AI all the time. Might take several days to decide whether war with the elves is a good idea or not etc.

You could almost have a simple scale for decisions. The highest noble decides something then every related noble sways the decision by a small amount. Could be enough to sway the balance.

Logged
Cats always land on their feet, finding the feet after is the trick.

mickel

  • Bay Watcher
    • View Profile
Re: Politics, Strategy, Tactics, and AI - Suggested Reading
« Reply #13 on: August 10, 2007, 07:18:00 pm »

The AI in F.E.A.R didn't strike me as very impressive. Nothing in that game impressed me, but that's another story.

When it comes to game AI, my models are Chris Sawyer (Transport Tycoon) and    Peter Molyneux (Black & White) who have both done some amazing stuff.

Logged
I>What happens in Nefekvucar stays in Nefekvucar.
Re: Politics, Strategy, Tactics, and AI - Suggested Reading
« Reply #14 on: August 10, 2007, 07:28:00 pm »

And you top it all of with a bit of Sid Meria. I wonder what he'd do if he did Sid Meria's Dwarf Fortress?

Propobly just enable cheating.

Anyways back to the orginal point. I have played alot of Smiulation/Stragtgy/Tyccon games in my time and I have to say the DF's is way up the top, if the not the top game with such complex depth and intercatibilty AND it's not even full deveolped yet. For me, DF is one of the most orginal and best games I have ever played so I don't think a new engine should be employed but rather improved.

Remember, DF is only, in a sense, a prototype and is constantly being improved so anything thats not inclued/badly done at the moment will likly be improved later on.

Logged
warfs are fearless...unless they are interupted by a deer.
Pages: [1] 2