 |
|  |
 |
|
J Bytheway
|
 |
England
Jul 2001 time: 05:22
|
|
I've been researching the way the location of barbarian spawns is chosen.
The way this is performed is really bizarre (and I found at least two bugs in the code ).
If there is exactly one human player, then they are placed as follows (I call this the SP algorithm):
A human city is selected at random, and then neighbours of this are selected at random repeatedly (essentially this generates a random walk around the map) for at most 4000 steps until it finds a land square not visible to the human player which is at least as far from the nearest human city as a given minimum distance, and then places the barbs there.
If there are zero or more than one human players, then they are placed as follows (I call this the MP algorithm):
Random squares on the map are chosen (for at most 400 attempts) until a land square is found which no player can see, and the barbs are placed there.
There are several problems with the SP algorithm:
Barbs will always be placed "just out of sight" for the human player, and whether other players can see the square is ignored (although this is a bug - it isn't supposed to be ignored). This is very unfair, and strange.
This method is likely to produce barbs on the borders between the human player and the AIs, exactly in the warzones where all the troops will be and so the barbs will probably be easily dealt with.
If that doesn't happen, then they will be placed just inside the neigbouring AI civs, possibly right next to their cities (in fact, it might try to place them inside their cities!) which is also not good.
The way in which the code randomly walks around in the SP algorithm is quite silly, and could easily result in it getting stuck and no barbs being produced when a large portion of the map is visible to the human player. This is particularly true on a map with much water.
Because of these problems, I suggest we strip out the SP algorithm and use the MP algorithm for all games - it seems sensible. It's implementation could probably be improved, but it's sufficient for the moment.
Some people have put forward more suggestions for barbarian camps, etc., but for the moment I'm primarily interested in what we should do in the short term.
Last edited by J Bytheway on 01-10-2004 at 00:57
|
|
|  |
 |
|
J Bytheway
|
 |
England
Jul 2001 time: 05:22
|
|
quote: Originally posted by E
is there a way to implement BigMCs model (without too much work?) |
Well...
quote: Originally posted by The Big Mc
Random
Barbarians appear randomly on the map |
Well, obviously this is easy, because it already exists.
quote: Regional
A region is specified which has a lot of barbarians often being only 5 or 6 tiles big. |
This is not so easy. How do you choose the region? What if it turns out to be a small island - then that island will be swarming with barbs when someone finds it. What happens when this region is built over by a player?
quote: Leader
A random barbarian leader is generated which changes with age.
Camp
A barbarian camp works similar to the leader |
This should be relatively easy, but I don't really understand the purpose. I think the way the game chooses which units to spawn for the barbs is somewhat silly anyway, and should probably be altered...
quote: The hard bit is going to be to get the barbarian unit DB to add and remove units depending on age |
...using age to decide what units to use is another way, but I still don't think it's right.
At present any land unit with a non-zero attack value can appear, and which one does is chosen at random from the top few units available to any player (sorted by attack value). It seems to me that it might make more sense to, for example, allow units.txt to specify which units can be barbs, and prehaps sort by the sum of attack and defense, rather than just attack.
quote: There will also be an option to allow you to attack barbarian leaders and camps to steel gold of the barbarians. |
This would probably be most easily done with SLIC...
|
|
|  |
 |
|  |
 |
|
Flinx
|
 |
Toronto, ON CANADA
Nov 2001 time: 00:22
|
|
I've been researching the way the location of barbarian spawns is chosen.
The way this is performed is really bizarre (and I found at least two bugs in the code ).
If there is exactly one human player, then they are placed as follows (I call this the SP algorithm):
A human city is selected at random, and then neighbours of this are selected at random repeatedly (essentially this generates a random walk around the map) for at most 4000 steps until it finds a land square not visible to the human player which is at least as far from the nearest human city as a given minimum distance, and then places the barbs there.
IIRC the minimum distance is from the text files and varies/can vary with barbarian difficulty.
If there are zero or more than one human players, then they are placed as follows (I call this the MP algorithm):
Random squares on the map are chosen (for at most 400 attempts) until a land square is found which no player can see, and the barbs are placed there.
There are several problems with the SP algorithm:
Barbs will always be placed "just out of sight" for the human player, and whether other players can see the square is ignored (although this is a bug - it isn't supposed to be ignored). This is very unfair, and strange.
I do not view the preferential placement of the random barbarians near human players as a problem. The AI knows not to walk through goody huts which spawn barbarians, so the preferential placement can be thought of as the same thing. Conceptually, barbarians should not appear within the vision of any military unit (AI or Human).
This method is likely to produce barbs on the borders between the human player and the AIs, exactly in the warzones where all the troops will be and so the barbs will probably be easily dealt with.
If that doesn't happen, then they will be placed just inside the neigbouring AI civs, possibly right next to their cities (in fact, it might try to place them inside their cities!) which is also not good.
The no-man’s-land between civs is conceptually where I would most likely expect to find barbarians, provided that there is no military unit to see them appear, other than another barbarian.
The way in which the code randomly walks around in the SP algorithm is quite silly, and could easily result in it getting stuck and no barbs being produced when a large portion of the map is visible to the human player. This is particularly true on a map with much water.
The random walk around does seem somewhat non-optimal. Having the number of barbarians that appear decrease as the map (land tiles) becomes increasingly visible to everyone makes sense to me. The MP algorithm achieves this by requiring the tile be not currently visible to any player (AI or Human) and so is no different than the SP algorithm in this respect.
Because of these problems, I suggest we strip out the SP algorithm and use the MP algorithm for all games - it seems sensible. It's implementation could probably be improved, but it's sufficient for the moment.
Some people have put forward more suggestions for barbarian camps, etc., but for the moment I'm primarily interested in what we should do in the short term.
I think we should come up with a new algorithm for placing barbarians. With one human player, I think the AIs may be worse off by switching to the MP algorithm.
|
|
|  |
 |
|
J Bytheway
|
 |
England
Jul 2001 time: 05:22
|
|
quote: Originally posted by Flinx
IIRC the minimum distance is from the text files and varies/can vary with barbarian difficulty. |
Yes, that's where the value comes from.
quote: I do not view the preferential placement of the random barbarians near human players as a problem. |
Perhaps not. It goes against my grain to be biased in this way, but it might give better gameplay, provided the other problems are dealt with.
quote: The random walk around does seem somewhat non-optimal. Having the number of barbarians that appear decrease as the map (land tiles) becomes increasingly visible to everyone makes sense to me. The MP algorithm achieves this by requiring the tile be not currently visible to any player (AI or Human) and so is no different than the SP algorithm in this respect. |
Well, it is different in that it is likely to place barbs if there is non-visible land anywhere, rather than just near the human player, and it is more likely to find somewhere to put the barbs - it will have a 50% chance when less than 0.2% of the map is unseen land - this might in itself become a problem because the barbs will become denser and denser as the amount of unseen land decreases.
quote: I think we should come up with a new algorithm for placing barbarians. |
I can't think of a good one...
quote: With one human player, I think the AIs may be worse off by switching to the MP algorithm. |
I'm not so sure - in the buggy SP algorithm they might get barbs on their very doorstep once the human civ borders theirs. Certainly in the early game the AIs will be worse off, but once most of the land is covered in cities it depends how densely the AIs units/cities are packed compared to the human, and thus how much unseen land there is in or near their civ...
Last edited by J Bytheway on 01-01-2005 at 03:43
|
|
|  |
All times are GMT. The time now is 05:22. Apolyton Time is 00:22. |
top of page
|
|
|
Forum Rules:
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts
|
HTML code is ON
vB code is ON
Smilies are ON
[IMG] code is ON
|
|
|
|
|
|