Latest Posts

Topic: map symmetry

Adamant

Joined: 2012-10-11, 16:21
Posts: 180
Ranking
Widelands-Forum-Junkie
Location: Alemania
Posted at: 2013-09-25, 19:33

Matter of AI-Programming concerns from Matter of Playing-Strategy as the PRogrammer have to implement any Kind of Strategy. Complex Strategies for Human Players may work fine but would cause overwheelming Trouble for a Programmer as he would have to code a Lot Stuff aside of Matter it's hard to cast it into Algorithm.

I remind a Thread last Time read related to PlayingStrategies but aimed for human Players. In this Context there is Need for another Thread dealing with same Matter aiming for Programmers which want to implement a (relative to (most) Humans) simple AI, which can effective deal with the Problem in a generic Approach as competive as can (as long as not far superior beating each human Player without any Chance for human Players ... excepted perhaps me ;)).

The Player-AI, as is, is not very competive but largest Problem it have, I can see, it is very plain, straight and does not offer a Lot Surprises or Long-Term-Strategy or OverAll-Strategy. I am not sure how the 3 Modes Softy, Middler, and Cracky rate their Military (Dis)Advantage relative to their Opponent. but Cracky attack even with high DisAdvantage and order its Units against FrontLine as long as Cracky can compensate its Losses. May bleed out in very short Time but won't change his Strategy. Middler is more moderate and need a significant Advantage to attack Opponents and thus goes better with his Resources. Softy I still didn't test but (I should) but intuitively expect anyway just a more likely Sparring-Partner I can take his Lolli even out of his Mouth.... have to verifiy - Speculation!

I want to omit my Part to make AI-Discussion more into Depth but also want to advise briefly for AI-Programming few Aspects: If two fight the 3rd is happy! Actually AI does not factor in any 3rd Party in its Strategy.

Long-Term-ASpects: Estimating actual own and/or Opponents Resources: Wood/Stone/Metal/Coal/Food/Fish/BuildSpace
-- take at least one, take more, take sufficient, prefer most relevant, take ... but get anytime finished with Code/Data/Processing! Then approximate several Stats linear like Military-Strength, Economy-Strength, Access to all that Stuff Players can take from Statisitics! I don't mean to factor all in into Algorithm but consider some basic Stats there. Eg if AI defined an Opponent to get attacked but delay Attack till got ready resp right Time and figure out monitoring the Military-Strength-Chart and find that his Opponent's Line falled, then it may easily assume that his Opponent got Trouble with another Player (he can't see directly .. but check CoIncidences in Charts if another Player losed also many Troops same Time and thus know if an Ally fight or an Enemy fight there. Anyway there is actually nothing between then PRO or CON. Consider State 'neutral' resp 'does not concerns Objectives'.

AI may decide to either wait some Time till both Opponents did weak each other sufficient enough to beat one or both together or if one is an Ally supports him by attacking common Enemy from another Side and thus cause more ReInforcement-Problems to the Enemy (lost Territory means normaly lost Sites means reduced Economy aside of potential critical BottleNecks in Production, means large Share of OverAllEcomy or just for partial Sectors concerning Wood or Coal, Stone, etc. 2 Iron-Mines hurt more than 2 Mines for Ore+Coal as if the Opponent lost eg the OreMine he don't need temporarily alos not the CoalMine or inverse Order.

There exist a Lot of possible Strategy-Approaches but actually AI factor just in ShortTerm-sighted Military-ASpects.

So we got here in Total 3 additional/unsupported Dimensions: LongTerm, Economic Targets and let it call social Dimension when it factor in to support Allies if can or either wait or intercept if two of his Opponents fight each other with Idea that both get this Way with least Effort together down parallel. Another Strategy is to fight the weaker to collect that Way with lesser Effort more Territory resp Resources but when adjecting the remaining Opponent there that is lesser weaked than if fight the stronger to get both same Size. Yes, Social. Dimensions. Why do you ask? face-smile.png

And additional quickly a very plain Strategy which alone would avoid the described Behavior that Aggro blasts its Troops in short Term due to it can't process FeedBack that he just lose Troops while doesn't archive any Success in Form of Loses for the Enemy. Any plain Way to calculate Effectivity and discard/delay useless military Objectives like objected Site or Player or Region.

Btw: some People plays really aggressive what does not imply they play stupid or ineffective BUT blasting Troops the Way described here is extremely ineffective and that coded Strategy is clearly to simple and inflexible to change from stupid Behavior.

I am normally rather restrictive with ... "big Terms" and would neither state that I consider one of the AI-Modes to be smart nor these combined .. but if we consider a 4th AI which can switch between these 3 Modes to change its Behavior in Respect of Situation/FeedBack for own Actions -- no Matter this gets ttried.

Eg if got attacked it drives up Aggro and keep in that Mode while/until any temporal/economical/miltary limiting Factors: until >10 Minutes passed and/or until <40 Iron and/or <60 Soldiers in Storage or Loses<30 Soldiers WIN/DFT > 1.25,

"You know you gonna lose, if..." 1) .. you lose 5 Soldiers to defeat 4 from Opponent! 2) .. your Sites keep vacant due to your Smithies don't left Steel for your ToolSmith! 35) .. there are anymore own Sites around your HQ!

Simple Approach: Find multiple of such simple important IF-Rules and You-know-StatementForm and define any Rates for all Field of Table. NOTE that You don't need to rate them perfectly to archive Results which don't let People laugh about you. Ask Moody for Details! If you hit with 90% HitRate the Nail you are on a good Track to.

Do that Way an Initial-SetUP. If you want to fine-balance these Rating consider a comfortable Interface, and review StatementForms and Rating-Rules and be able to sort Rows in Table by Value inside an arbitrary Column and thus easily monitor that EST-Table to get a quick Idea what is Stat for the AI resp rate intuitive/interactive the Results of that Table ( why is Statement GonnaHell so weak rated and figure out that large Amounts of Water suck it back to Code_Green and consider another Rating for Depency Water/Hell)

NOTE In this Context, please consider LinearCombination of Vectors resp the Gaussian Algorithm! FYI with 100 Rules (Equations) and 100 StatementForms (Variables) you need theoretically need just about few 100 Calculation-Steps to determine correct Values for .... dunno ... have to break now but at Moment the Calibration of Table looks lesser challenging than thought. Point is here: 100X100-Table looks scarry to calibrate but could be much simpler than thought.

Perhaps a Risk-Game-like Win-Condition like "Defeat Enemy RED", "Liberate Region BLUE", "Keep Player YELLOW undefeated", and Defeat-Conditions like "Don't let Player CYAN conquer Region WHITE" etc. and combine these randomly (check for unsolvable Depencies/Condition-Combinations) with optional Negations. (Perhaps call it Mission-Mode?)

Left partially Topic and now no Time left to remange but won't throw now 1.5h Work into Trash due to OT.


Ivan the Terrible is dead .. Genghis Khan is dead .. and I do not feel well, too.

Top Quote
fk
Avatar
Joined: 2013-07-30, 22:58
Posts: 151
Ranking
At home in WL-forums
Posted at: 2013-09-25, 20:18

einstein13 wrote:

This night I've played a map "The maze" (https://wl.widelands.org/maps/the-maze/) and the simulation took about 40 hours of gameplay. There is only one AI player completely destroyed (6-8 hour of gameplay), two are destroyed partially and one or two are fighting.

The max speed of play (on my computer) is x4. To have stable game (and system) I've used x3. I've tried even faster, but then the game crushed (the window existet, but the program didn't respond to the system).

Probably we have two different situations, I can't see that from here. I actually ran The Maze this day and achieved 10 hours of game time in about 10 minutes. But in any case you should know that the AI is not good at creating it's own path through forests, and forests grow fastest on grasslands, so you just need less grasslands. I always stop playing maps as soon as the AI-players do not advance any further.


Top Quote
einstein13
Avatar
Joined: 2013-07-29, 00:01
Posts: 1118
Ranking
One Elder of Players
Location: Poland
Posted at: 2013-09-26, 14:58

@Adamant I think I got your point of view and I agree that each mode has some troubles with long-term play. But in my oppinion most of problems are inside the code. I've never seen it, but I will try to find everytjhing, when I will have some time. Probably more problems in long- term play are connected to growing forests everywhere (grasslands as fk said) and 100 building of one type (why AI are building a farm when they have about 10 tousands of crops inside warehouses?!).

Probably making any AI-strategy thread on this forum will help a bit face-smile.png But having good idea to improve something is not as simple as You told. Good algorithm means more than "change something". I'm thinking for two days about wood-problem, and I have no good idea how to solve the problem. Maybe it should be connected with "get all the land clear" (wood, stone, ...?). But how to implement that?!

@fk You have tried 10 hours of playing- good. First 10 hours are very simple. My computer do that in about 40-50 minutes, so it's not so bad. But after 24 hours of gameplay everything changes: more trees, traffic jjams, huge empires, stone/wood problems. Very slow expansion. I've reached 60 hours of gameplay. Replay file has only 27 MB face-grin.png There is no exact winner in my oppinion. But there is 3 best players face-wink.png Maybe we should define our expectations? " AI-players do not advance any further" is about 50 hour of gameplay (in my simulation).

And in my oppinion playing with people to check maps is more funnier AND faster face-smile.png We can make some kind of skills list like in chess (http://en.wikipedia.org/wiki/Elo_rating_system). And then we can try any map to check it, can't we? face-smile.png


einstein13
calculations & maps packages: http://wuatek.no-ip.org/~rak/widelands/
backup website files: http://kartezjusz.ddns.net/upload/widelands/

Top Quote
Adamant

Joined: 2012-10-11, 16:21
Posts: 180
Ranking
Widelands-Forum-Junkie
Location: Alemania
Posted at: 2013-09-26, 18:42

einstein13 wrote:

@Adamant I think I got your point of view and I agree that each mode has some troubles with long-term play. But in my oppinion most of problems are inside the code.

You can't believe how much I am surprised about that Statement. face-grin.png I did talk about more than just Data but also Data-Structure and Behavior which is Result from implemented Code and DataStructure.

I've never seen it, but I will try to find everytjhing, when I will have some time.

I am not sure what you are want to look for but hope you success and wonder what it is. face-smile.png What is it?

Probably more problems in long- term play are connected to growing forests everywhere (grasslands as fk said)

I agree with you that at present State growing Forests MAY cause serious Problems even to Non-AI-Players. I don't understand what GrassLands means in this Context.

and 100 building of one type (why AI are building a farm when they have about 10 tousands of crops inside warehouses?!).

This Point is one I am interested more into Detail.
Does AI this: {100x Type_A, 100x Type_A, 100x Type_A, ...} or does it this: {100x Type_A, 100x Type_B, 100x Type_C, ...}

Probably making any AI-strategy thread on this forum will help a bit face-smile.png

Would participate a Lot but won't open a Thread I write for my self. face-wink.png Feel free to make one. face-grin.png

But having good idea to improve something is not as simple as You told. Good algorithm means more than "change something".

What I did specify was an Appraoch to calibrate a Data-Structure to get cheaply a Set of Statements the Programmer have to determine what Likelihood exist per Statement, to be true in his personal View, what means that Results gets compared with that what he determine .. in an intutive Way normal while playing . That works anyway no Matter what Algo he use in his Head!

A Likelihood of 49% is rather useful due to Negation we can easily transform it into 51%.
However, 50% HitRate means something like you did not hit ANY Nail and may ignore the Result totally or use Random-Function instead, with same HitRate.

That's only Support for AI to react specific to the Informations that indeed brute Approach provide no Matter what Value the Implementation&Calibration at last may provide. Now let's assume a Likelihood of 99% per Statement resp enough that these Statements are more useful than ignoring them. Better 1 Time fload a House needless with Water than 99 times let Houses brun down due to Fire wasn't extincted. I mean: assume that it works fine enough that you can use it.

My Proposal (still ) does not contain any Idea how these Statements may evalutated resp how they may trigger any Decisions like stop building Farm and build Wells instead.

I'm thinking for two days about wood-problem, and I have no good idea how to solve the problem.

I found one. face-smile.png My Idea is logical simple: I assume that there is already Space to build any WareHouse-suited Site {HQ,WH,Port} That Site have to sever as Interims-Solution to house basic Worker-Types as Production-Site. That Site could eg house 100 Lumberer but that does not mean that the Site gets by Extension able to emits 100 Lumberer what means that this Site got 100x Productivity like a single Lumberer's House -- who would then still need them? Let's assume it could house 2 active Worker resp virtual ProductionSite while being able to support 5 basic ProductionSite-Types. Assume the Types are Lumberer, StoneCutter, WoodCutter, StoneMason and Forster. {Trunk,Wood,Stone,Column,Trees} Additional the Productivity may get reduced that a Lumberer in his House can produce faster than the WH-Type that WH-Types don't change into competive Alternatives but stay BackUp-Solutions resp enable Players to bootstrap Economy with smaller minimal Starting-Capital.

In Case of Wood-Problem, that would mean, that the Port can order a Lumberer if AI-Assistance tell the Port the Player can't build there any Sites due to the Forest or similar OR the Player get another Option to order the Lumberer directly resp can instruct the Site to utilize its 2 Slots with any of suited Site-Tasks like 2x Lumberer or 2x Stone-Cutter or mixed etc.

Another Way is, if the Ship self performs in that Sense like a WareHouse (for just max just 20 Wares) and thus a Lumberer in the Crew can mov out from Ship and lumber a Tree and either move it into Ship's Store or drop it resp left it at Ground as Item like the lumbered Tree change into and remain free for later Handling. That Way I miss for Port-Construction by Ship any visible Wares at the Port's ConstructionSite. If Ware get droped on Road it remain at least for a limited Time but if a Flag gets removed the Wares at the Flag gets removed. Small Thing to change that. (just to remove Feature)

Maybe it should be connected with "get all the land clear" (wood, stone, ...?). But how to implement that?!

straight and clean! face-grin.png

@fk You have tried 10 hours of playing- good. First 10 hours are very simple. My computer do that in about 40-50 minutes, so it's not so bad. But after 24 hours of gameplay everything changes: more trees, traffic jjams, huge empires, stone/wood problems. Very slow expansion. I've reached 60 hours of gameplay. Replay file has only 27 MB face-grin.png There is no exact winner in my oppinion. But there is 3 best players face-wink.png Maybe we should define our expectations? " AI-players do not advance any further" is about 50 hour of gameplay (in my simulation).

Rather Interesting Statement! ... and rather interesting Scope related to AI-Critique useful if AI gets tried to get improved. Good Job, Einstein13!

And in my oppinion playing with people to check maps is more funnier AND faster face-smile.png We can make some kind of skills list like in chess (http://en.wikipedia.org/wiki/Elo_rating_system). And then we can try any map to check it, can't we? face-smile.png

Excellent! Never heard about Elo-Number. But I feel nevertheless somewhat uncomfortable that you want to try per fide rating to score the WL-Match Results. Sounds anyway unmoralic. ;D
Good Luck and report your Experiences with! Most thriving Point to me is how much these Number are suited to produce representative Numbers for Player-Strength. You could take simply Cross-Sum and get another nice Value but how well do your EloNums represent your personal Idea about Player-Strength? Approach sounds IMO fine to better compare Player-Strength between WL-Players that never played together.

-- ADM


Ivan the Terrible is dead .. Genghis Khan is dead .. and I do not feel well, too.

Top Quote
einstein13
Avatar
Joined: 2013-07-29, 00:01
Posts: 1118
Ranking
One Elder of Players
Location: Poland
Posted at: 2013-09-27, 13:56

I've never seen it, but I will try to find everytjhing, when I will have some time.

I am not sure what you are want to look for but hope you success and wonder what it is. face-smile.png What is it?

It- the code of the game & AI players. face-smile.png Is it C++? After that I can talk about the changes there. Till now I know only results. face-wink.png

Probably more problems in long- term play are connected to growing forests everywhere (grasslands as fk said)

I agree with you that at present State growing Forests MAY cause serious Problems even to Non-AI-Players. I don't understand what GrassLands means in this Context.

Grasslands- every land covered by grass. On the desert/ sand/ raw ice/ water/ fire/... trees won't grow. So there the problem of trees doesn't exist.

Does AI this: {100x Type_A, 100x Type_A, 100x Type_A, ...} or does it this: {100x Type_A, 100x Type_B, 100x Type_C, ...}

I'm not sure what you mean, but I will tell you some examples: The Empire is building lots of Vineyards and it has only one Winery. The Atlanteans are building lots of Blackroot Farms and no mills. After 48 hours of gameplay (the longes term I've ever seen without getting stuck) they just have no stone to build them.

What I did specify was an Appraoch to calibrate a Data-Structure to get cheaply a Set of Statements the Programmer have to determine what Likelihood exist per Statement, to be true in his personal View, what means that Results gets compared with that what he determine .. in an intutive Way normal while playing . That works anyway no Matter what Algo he use in his Head!

In my oppinion firs part (getting set of statements) is easy to program, but "intutive way" will make some trouble. face-smile.png Probably I'm wrong face-wink.png

My Proposal (still ) does not contain any Idea how these Statements may evalutated resp how they may trigger any Decisions like stop building Farm and build Wells instead.

Have you heard about expert system and neural network? (http://en.wikipedia.org/wiki/Expert_system, http://en.wikipedia.org/wiki/Neural_network)

Those tools are a bit complicated, but in strategy games they are very effective! In Age Of Empires II there was expert system which was learning with gameplay. Easy AI player after several hours of play it was better than hardest AI player without learning ;). All of that is working, but it isn't simple to connect it with the code.

I found one. face-smile.png My Idea is logical simple: I assume that there is already Space to build any WareHouse-suited Site {HQ,WH,Port} That Site have to sever as Interims-Solution to house basic Worker-Types as Production-Site. That Site could eg house 100 Lumberer but that does not mean that the Site gets by Extension able to emits 100 Lumberer what means that this Site got 100x Productivity like a single Lumberer's House -- who would then still need them? Let's assume it could house 2 active Worker resp virtual ProductionSite while being able to support 5 basic ProductionSite-Types. Assume the Types are Lumberer, StoneCutter, WoodCutter, StoneMason and Forster. {Trunk,Wood,Stone,Column,Trees} Additional the Productivity may get reduced that a Lumberer in his House can produce faster than the WH-Type that WH-Types don't change into competive Alternatives but stay BackUp-Solutions resp enable Players to bootstrap Economy with smaller minimal Starting-Capital.

As I understand, you want to create small economies inside huge empire? For me it will work for some places and will help a lot. It won't work everywhere.

AI-Critique useful if AI gets tried to get improved.

I remember that traffic jams in the Settlers II was solved (in AI players) by building another roads near the jams. Sometimes it doesn't work (the nearest road is 10 units away of traffic jam), but it is the simplest way to get first solver face-wink.png

And in my oppinion playing with people to check maps is more funnier AND faster face-smile.png We can make some kind of skills list like in chess (http://en.wikipedia.org/wiki/Elo_rating_system). And then we can try any map to check it, can't we? face-smile.png

Excellent! Never heard about Elo-Number. But I feel nevertheless somewhat uncomfortable that you want to try per fide rating to score the WL-Match Results. Sounds anyway unmoralic. ;D

Not quite, but yes face-smile.png I'm rather thinking about some site with opinions about players and their skills. If you conquer somebody, you can give an opinion about the player (general strategy, economy, military, kindness, fairness, ...) and if you want to play with another player, you can check what another people think about your future opponent. Of course it CAN BE immoral or overused. After several years of playing you will have a rank with number of plays, average ratings (from 3, 6 ,12 and ALL months).

how well do your EloNums represent your personal Idea about Player-Strength?

That's only an idea of ranks around the world. In Poland we have statement like this: "Why force the opened door?" (one dictionary said: "to reinvent the wheel "). We can just modify some ideas and use them in Widelands Community face-smile.png

And I've realized that I could make a mistake with "EloNums". I've just found a site with some numbers and chess. So probably- my mistake face-wink.png (as always :D)


einstein13
calculations & maps packages: http://wuatek.no-ip.org/~rak/widelands/
backup website files: http://kartezjusz.ddns.net/upload/widelands/

Top Quote