I've been studying AI design—things like behavior trees and FSMs. They make sense from the perspective of deciding a specific entity's goal and action.

However, the AI in my game is very hive-like; multiple drones share the same knowledge and desires. What a particular drone can do is unimportant, as each can do any task. Instead, it's a question of which drone would be the best choice for a particular task, given the list of tasks to be done.

For example: The AI decides it wants a particular resource type gathered. Different resource types are available at various locations across the map. Which drone should it send to gather the resource? All are capable, but some might be further away from the resource. Some might already be gathering a different resource. Some might be performing tasks that the player is actively waiting on, or that strongly affect the player's success.

To decide, the AI would need to evaluate various factors and continually re-evaluate as the game progresses, without stepping on it's own toes and continually reassigning jobs to the same drones.

Is there a field of AI suited to this sort of task distribution that I can look into?

  • \$\begingroup\$ Is your aim to accurately model hivelike behaviour, or to efficiently coordinate units like a central leader would? Social insects tend to work in a distributed, self-organizing manner, where each independently picks tasks based on local stimulus. Much of the work of the hive is in setting up cascades of stimulus to lead the individuals to make statistically good choices. This emergent behaviour is hard to design and balance from the ground up though, so it matters: are you aiming for such a simulation/reflection of real hive phenomena? \$\endgroup\$
    – DMGregory
    May 3 '14 at 7:04
  • 1
    \$\begingroup\$ Very interesting question. You would have to value task-priorities and cost of reallocating a worker (pathing cost and maybe penalty for aborting a task in progress). Reallocating from a low-priority worker far away might be a worse decision than reallocating a high-priority worker from close by. \$\endgroup\$
    – Philipp
    May 3 '14 at 12:02
  • \$\begingroup\$ en.wikipedia.org/wiki/Swarm_intelligence \$\endgroup\$ May 3 '14 at 13:31
  • \$\begingroup\$ @DMGregory The second is what I'm going for, a single intelligence coordinating the actions of a large number of units. Once a unit is given a job, it can use its own AI to complete the job. It's that initial assignment (and possible later reassignment) that I'm currently interested in. \$\endgroup\$
    – Nairou
    May 3 '14 at 14:10
  • 1
    \$\begingroup\$ Mm, this is an old one, but it popped up in a search related to something I'm looking into. I didn't see it mentioned, but the way ants appear to work (based on some research I only half recall) is that they secrete chemicals that say "I am doing Task X" and every ant they meet along the way, they know what task each is performing. Then based on a the desired ratio between tasks (5% defemse, 25% gather, 15% explore, etc.) if there's a disparity in the ants it has met recently ("I've only seen 12% as gatherers!"), they switch tasks. \$\endgroup\$ Jan 6 '16 at 19:10

Real-time strategy game AI is a closely related and well-studied field:

Early research in AI for RTS games [1] identified the following six challenges:

  • Resource management
  • Decision making under uncertainty
  • Spatial and temporal reasoning
  • Collaboration (between multiple AIs)
  • Opponent modeling and learning
  • Adversarial real-time planning

a survey of Starcraft.

That "[1]" refers to M. Buro, Real-time strategy games: A new AI research challenge, in IJCAI 2003. International Joint Conferences on Artificial Intelligence, 2003, pp. 1534–1535. It refers to various other recent (2012–) research too.

Additionally to academic papers, you might want to study open source RTS games such as Spring.

  • \$\begingroup\$ Thanks for the links. However, these all address a slightly different problem. Units in an RTS typically function independently, and the AI can decide what a given unit should do regardless of what others are doing. I'm looking for a way to assign jobs of various priorities to a set of units, where there are a finite number of jobs, each unit is in a better or worse position to perform the job, and reassigning a unit to a job means abandoning or opening the job it was previously doing. \$\endgroup\$
    – Nairou
    May 3 '14 at 15:55
  • \$\begingroup\$ Ok there probably is a difference, in RTS you do not usually cancel a unit's task to replace some other to work on it instead but let them finish. The other aspects hold though: assigning various jobs to a set of units for a finite number of jobs, each unit being in better or worse position for them. So perhaps same / similar AI can still work if you can add the different kind of aspect of abandoning jobs to it. \$\endgroup\$
    – antont
    May 3 '14 at 16:39

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.