Topic: AI enhancement suggestion - wood
Tibor Topic Opener |
Posted at:
2014-01-25, 23:03 UTC+1.0
Hi, I have an idea how to improve the AI, it relates to wood and ranger's huts. In fact I have two ideas:
Also from lua scripting perspective, is there an call to stop/resume a building? Tibor ![]() ![]() |
einstein13![]() |
Posted at:
2014-01-26, 01:34 UTC+1.0
To point 1.: Some of the maps have need to have more than 200 trunks in stock. They just need to be burned into the coal. So that the stock is not a good reference. Better are flows of stock (how many we are producing and how many we spend). Worse problem is to count how many trunks we need to deal with the economy? Based on map size, amount of coal, green place size and size of country. But the idea is good To point 2: If you do so, the woodcutters will be placed everywhere around ranger's huts. That is not good. That is the worse you can do. The algorithm should take account existing woodcutters (and their production)! So if there is a woodcutter with 100% and still some trees, then you have a permission to build a woodcutter. If there are no woodcuters, then build one. einstein13 ![]() ![]() |
Mars |
Posted at:
2014-01-26, 21:32 UTC+1.0
I am not sure how it works at the moment but for me it would also be ok if the AI 'cheats' and knows the whole map (at least for resources like coal). As a human one can have the same information before playing the map, so the AI could determine if it needs to burn coal from wood or if there is a mountain with coal nearby. ![]() ![]() |
Tibor Topic Opener |
Posted at:
2014-01-26, 22:09 UTC+1.0
Mars,
![]() ![]() |
einstein13![]() |
Posted at:
2014-01-26, 23:10 UTC+1.0
Tibor, but this works only with existing whole economy. At the beggining computer should know whether it have to build lots of woodcutters and coalburner or not. Mars have a good idea of that. Now computer cheats too. It knows what resources are in the mountains (I've never seen sending geologists into the mountains by AI). It is very complex problem. Some solutions have a feedback some not. Mars' idea had no feedback, and it is very complex: how can we decide what is on the map? It's not easy problem. Tibor have a feedback and whole idea is based on it. But it is not simple to build a good controller (sometimes your economy needs more coal, sometimes less). einstein13 ![]() ![]() |
Tibor Topic Opener |
Posted at:
2014-01-26, 23:52 UTC+1.0
Well, I am not suggesting a brand new AI, just additon to existing one. So building and destroying of buildings would be done as now. I dont know how exactly AI works now but I hope my suggestion would not interfere with current algorithm in a bad way. And I believe it could be very trivial to implement. Of course, if I had to suggest the new AI from scratch, I would have another ideas... Right now, I want to address very specific problem - AI after some time begins to stagnate - especially when no enemy is in sight... and I believe one of reasons are trees in a way and AI is to stupid to cut them and clean up the space. ![]() ![]() |
einstein13![]() |
Posted at:
2014-01-27, 00:47 UTC+1.0
In my opinnion we should begin the discussion on brand new AI. It is very hard to implement it, but if we solve problems of AI from math side, the implementation would be much more easier. And it is very hard to discuss all the things in one thread on this forum. Some of the ideas are already written here (just search the forum), but the discussion are not simple (to write and to read). einstein13 ![]() ![]() |
SirVer |
Posted at:
2014-01-27, 06:26 UTC+1.0
I am following this thread. The current AI implementation is done in c++ and is more or less a set of rules like the one tibor suggested in the op. As far as I understand the literature this is also what works best in general for AIs for specific games. There are obviously some rules missing - for example tibor is right that trees are a big problem for the AI (one solution would be to kill the tree life cycle for that - it would make it less likely for the AI to get stuck). But back to the questions:
No, this is currently not implemented, but can be done very quickly and easily - however we are in feature freeze for b18 (still) so we can not do it in trunk. If you want to I can add this into one of the branches that will be merged after b18, but you need to build Widelands yourself for now.
The biggest issue with the current AI is that its code is a total mess. It is very hard to understand what it is doing and it is really hard to change behavior in an easy fashion. For example a rule based AI should be understandable by looking at each individual rules independently as they should not influence each other, but right now everything is one big if/else case. ![]() ![]() |
teppo |
Posted at:
2014-01-27, 08:25 UTC+1.0
I am somewhat interested, too. Is there anything preventing many AI's in parallel? If the current is a mess, we could develop new one(s) and keep the old as it is. This way there would be no need to be afraid of false starts. ![]() ![]() |
einstein13![]() |
Posted at:
2014-01-27, 18:17 UTC+1.0
This is a very good idea! But I have a question: is it possible to make a part of forum created only for AI threads? It can be a subforum of existing one. It would be much easier to create completely new threads only for completely new ideas. For example I try to make a simple math model of wood-economy (to bring everything into short equations), so I don't want to create every idea into new thread and create mess here, on the forum. Small off-toppic: Also in the game shold be something changed with the AI players. Maybe add "AI method"? In other game (Age Of Empires II with unofficial extras) you can choose the AI method (standard AI, barbarian, hordes,... ; difference only with the power and inteligence) and the level (standard, easiest, moderate, hard). I can imagine that we can choose AI method as drop-down list (none, old AI, new AI) and it's strength (defensive, normal, offensive) like now. Then we can produce more AI-methods, dedicated to different map types (big, small, islands, continent with islands, etc.). einstein13 ![]() ![]() |