.com.unity Forums
  The Official e-Store of Shrapnel Games

This Month's Specials

Air Assault Task Force- Save $8.00
Bronze- Save $10.00

   







Go Back   .com.unity Forums > Illwinter Game Design > Dominions 3: The Awakening

Reply
 
Thread Tools Display Modes
  #1  
Old October 31st, 2008, 05:57 AM
lch's Avatar

lch lch is offline
General
 
Join Date: Feb 2007
Location: R'lyeh
Posts: 3,861
Thanks: 144
Thanked 403 Times in 176 Posts
lch is on a distinguished road
Default Re: Moving Through Multiple Provinces

I see this "getting reinforcements to the front line is boring" as a non-issue because mostly it's only a specific setup which requires this: single player games against a losing AI and/or playing freespawn nations like LA Ermor. In the first case, you usually can just ignore that some crappy troops are waiting for you in some of your provinces and instead focus on your advance. If you're in a competitive game, you'll have far more to worry about than having somebody collect your crappy troops all the time. Most of your turn time will be spent on setting orders and scripts for your mages. If you don't want a micromanagement heavy game, don't use LA Ermor. You knew what you signed up for. You don't pick a blood nation if you don't like micromanagement either. If you don't want to spend too much time on armies, use mages or SCs. :P

In my opinion, there are too many variables about moving armies that you really can't let the AI do this for you. Some of those just include:
- which way to move, depending on terrain
- what to do about enemy provinces and/or enemy attacks along the way
- adding units encountered in provinces along the way
- how to handle supply problems when moving with multiple big armies

In general, I think that even a sophisticated solution for this, which would take an immense amount of work to set up, would be inadequate and require constant fine-tuning all the time anyway. Shortcuts to pool gems and so on that are already present in the game are usually pretty simple stuff, and as soon as it gets a little more complex (e.g. remote site searching) people are not too impressed with the results. Something like army movement is decidedly non-trivial to me.
__________________
Come to the Dom3 Wiki and help us to build the biggest Dominions-centered knowledge base on the net.
Visit my personal user page there, too!
Pretender file password recovery
Emergency comic relief

Last edited by lch; October 31st, 2008 at 06:00 AM..
Reply With Quote
  #2  
Old November 4th, 2008, 03:00 PM

Loren Loren is offline
First Lieutenant
 
Join Date: Nov 2006
Posts: 739
Thanks: 1
Thanked 8 Times in 8 Posts
Loren is on a distinguished road
Default Re: Moving Through Multiple Provinces

Quote:
Originally Posted by lch View Post
In my opinion, there are too many variables about moving armies that you really can't let the AI do this for you. Some of those just include:
- which way to move, depending on terrain
Non-issue. Algorithm (I hope the line wrapper leaves this alone!):

Data structures: An array with one cell per province. Each cell holds a turn count and a pointer to a province. Queue of provinces and turns used. Inner queue of provinces & movement remaining.
Load the stating province into the queue.
Repeat
Read province from queue, add to inner queue.
Repeat
Read province from queue.
Iterate across neighbors, add them to the inner queue along with remaining movement.
If the province in the map is empty, fill it with the turns used and the origin of the current move segment. Add the province to the outer queue.
Until inner queue is empty.
Until the target province has data or the outer queue is empty.
If the target has data:
Current = Target.
While Map[Current].ComesFrom <> Origin do
Current = Map[Current].ComesFrom
Move the army to current.

Runtime: This is linearly dependent on the number of provinces * the average number of provinces you can reach in one turn.

Quote:
- what to do about enemy provinces and/or enemy attacks along the way
Recalculate every turn.

Quote:
- adding units encountered in provinces along the way
The simple answer, albeit with a file format change wouldbe to add two movement modes:
Gather like--the commander attempts to add any units that match what he's already got. They are added to the same groups.
Gather any--the commander picks up any troops he can.

Quote:
- how to handle supply problems when moving with multiple big armies
See my previous approach. Run the calculation as above twice. Once normally, once rejecting a province if adding the current army to the already-planned contents of the province would result in starvation. If the second run is no more than one turn longer simply use it. If it's more than one turn longer look at what's eating the supply--if it's armies on move orders then wait, otherwise take the longer route. (Actually, internally you would do both calculations at the same time.)

This handles almost all cases. It will fail in a case where you need to distribute the armies through multiple bottlenecks--they'll all queue up for the shorter one and won't optimize the food use (Say, A needs 100, B needs 80 and C needs 60. The province feeds 160. This approach makes A go first, B & C wait.) It will also fail if two armies are trying to pass each other in opposite directions through a two-province bottleneck where neither province will feed both armies (This case will be detected, though, and you'll get a message.) Such bottlenecks are rare and armies crossing like that is also rare.

Quote:
In general, I think that even a sophisticated solution for this, which would take an immense amount of work to set up, would be inadequate and require constant fine-tuning all the time anyway. Shortcuts to pool gems and so on that are already present in the game are usually pretty simple stuff, and as soon as it gets a little more complex (e.g. remote site searching) people are not too impressed with the results. Something like army movement is decidedly non-trivial to me.
In a situation like this an exhaustive search is a realistic option. The only time I've seen pathfinding problems in a game that could use such an approach involved fog of war issues or improper handling of an impossible route. The army came along and found the path blocked. It turned back to take another route, once it got far enough away that the blocker was lost in the fog it turned around to take the short route again. (The real culprit here was mishandled fog of war--stationary items in the fog should be as you last saw them, not vanish.)
Reply With Quote
The Following User Says Thank You to Loren For This Useful Post:
Reply

Bookmarks


Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is On

Forum Jump


All times are GMT -4. The time now is 10:22 PM.


Powered by vBulletin® Version 3.8.1
Copyright ©2000 - 2025, Jelsoft Enterprises Ltd.
Copyright ©1999 - 2025, Shrapnel Games, Inc. - All Rights Reserved.