• Advertisement

Archived

This topic is now archived and is closed to further replies.

Opinions wanted on AI for turn-based strategy game

This topic is 5102 days old which is more than the 365 day threshold we allow for new replies. Please post a new topic.

If you intended to correct an error in the post then please contact us.

Recommended Posts

I''m in the process of writing a simple turn-based strategy game that will require 1 or more computer-controlled factions. I have some ideas on how I might approach this, but I would be interested in hearing any other ideas, as well as opinions on my proposed approaches. At the strategic level, the computer player has a set of needs or objectives, such as increasing the army size, scouting/mapping, defending key people+positions, attacking key people+positions, and claiming territory. The importance of each objective would rise and fall according to circumstances. Individual creatures have heuristic functions that return how well suited they are to fulfilling these needs, based on their inherent statistics and their environment. This makes it possible to match up creatures to strategic objectives, in such a way that the most important objectives are approached by creatures that can best accomplish them. Possibly at a later stage, different AI ''personalities'' could have different biases towards these objectives and/or different algorithms for allocating creatures to them. On the other hand, this seems like it might be difficult to balance out, as the different objectives aren''t necessarily easily comparable, and therefore a universal approach to the objectives might not work. So perhaps one idea would be to have a basic state-based system where each creature starts off exploring, and then switches to attacking when it spots an enemy, and so on. I''d also have a provision for mission-specific scripts that can assign a more important goal to individual creatures if necessary. This seems easier but perhaps is a little too simplistic? [ MSVC Fixes | STL Docs | SDL | Game AI | Sockets | C++ Faq Lite | Boost
Asking Questions | Organising code files | My stuff | Tiny XML | STLPort]

Share this post


Link to post
Share on other sites
Advertisement
I might not have interpreted what you wrote correctly, but it sounds to me like you have two different problems to solve:

1) Determine the heirarchy of importance for strategic objectives; and,
2) Determine the appropriate allocation of resources to achieve as many highly important tasks as possible.

The first isn''t too hard... you just need a way of expressing the value of a given strategic goal in a given context. Modelling the preferences (''importance rankings'') of Human players is often a good technique. Alternatively, you could utilise an approach that predicted some future state of the game based on a given ranking (and an assumption of achieving a certain number of the highest ranked strategic goals) and then evaluate the quality of that state using some metric that you choose.

As to the second, you can either express the problem as an optimsiation problem (maximise some measure - like goals satisfied, or time to satisfy n goals) or a planning/resource allocation problem (search for the best allocation of units at given times to achieve the specified goals).

Of course, there are other approaches you could try, but I doubt you''d get guarantees as to the quality of the outcomes.

Timkin

Share this post


Link to post
Share on other sites
Well, it''s two problems if I divide it up that way, yeah.

I wouldn''t know how to model player preference, largely because I have no players and won''t have any players until long after the AI is done, and also because I don''t know how I''d measure it. I can think about these things in general terms but can''t really quantify it. All I know is that pretty much you''d start out growing your army, then perform scouting, and then attack where possible, with significant overlap.

Regarding the resource allocation, I can''t go too far down the planning path because I will have a large number of units, all of which can move 6 or 7 spaces and perform some actions in a turn so the potential state-space is massive. I hope to abstract some of this away by using influence maps to represent the safety level of an area and so on.

I think the system is perhaps complicated by the fact that I don''t have clear peon/infantry/cavalry divisions or anything like that. With a few exceptions, all units are capable of doing the same things, just to varying degrees. A human player might choose to create several all-rounder creatures that can be adapted to any objective, but I have trouble seeing how the AI could come up with that strategy.

[ MSVC Fixes | STL Docs | SDL | Game AI | Sockets | C++ Faq Lite | Boost
Asking Questions | Organising code files | My stuff | Tiny XML | STLPort]

Share this post


Link to post
Share on other sites
your game sounds a lot like mine from a high-level point of view. I have yet to implement the "empire-level" AI, but my game works by placing units on the map and assigning them "missions". They complete these mission on their own with the perameters set by the player. For instance, i have a "harvest" mission where the objective is to collect map resources and return them to base for decollection (yes, i made that word up, and it''s good). The player sets the base point for the search and the preferred return point. The actual unit decides what resouces to collect, the path to get there, and the path to return home, with no hlp from the player. There are many mission types including PATROL, HARVEST, INTERCEPT, DEFEND ("cover"), HALT, MOVE, CAPTURE, etc.

You could move this idea up a notch and have super-missions where the empire-level AI allocates several units to a super-mission with basic perameters and you just take care of the mission-specific AI code. For instance, you might have a DEFEND BASE super mission where the AI would attempt to defend a base through a varierty of means; perhaps building fortifications, adding guard units to the area, blocking entry points, whatever. You could then build larger super missions from the basic ones listed above.

At least, that''s my plan.

feel free to check out my project and design doc if you would like:
http://www.project-axis.net/

Share this post


Link to post
Share on other sites

  • Advertisement