Page 1 of 3

AI city planner

PostPosted: 25 Mar 2012, 13:21
by Lewin
Krom has been working on a "city planner" for the AI. It's only just started and has lots of limitations/bugs but it's still nice to see the AI building things in the game :)
We'll probably release a video of it later on, when road connections are fixed and the AI places fields.

Here's a screenshot of a village made by the AI:
http://kamclub.ru/_fr/7/4517015.jpg

Just thought you guys might like to see the progress ;)
This doesn't mean there'll be a fully automated AI in the next release, there is still a lot to be done. (automated military is not even started yet)
Lewin.

Re: AI city planner

PostPosted: 25 Mar 2012, 14:44
by Jochi
Very good job Krom. In the picture is you've done a great job. Anger and move forward, thank you very much for your effort. I look forward to the video

Re: AI city planner

PostPosted: 25 Mar 2012, 16:56
by Shadaoe
This is amazing :p

Re: AI city planner

PostPosted: 26 Mar 2012, 08:15
by Thomas
Really great job guys. I'm also looking forward to the video :)

Re: AI city planner

PostPosted: 26 Mar 2012, 14:47
by pawel95
Really cool. Good job.
Maybe i will say it now and not later: If you program the builiding of the AI try to make "emergency exit´s" :D What I mean is, that in the SR 3 original KaM is it so, if you destroy one labour, while he makes a field of street or wine, at this place no labour will continue the work :-( and sometimes, all laboures stop building new houses, because of the one kill.

And sth other. is it possible maybe, to build 2 or 3 builiding at the same time (parallel) , because a human player will not build one house and build the next, if the first is finished!?


pawel95

Re: AI city planner

PostPosted: 28 Mar 2012, 14:18
by pavlos
Very Good job Lewin... you and Krom always be the top of the everest mountain

Re: AI city planner

PostPosted: 29 Mar 2012, 12:12
by Krom
@pawel95: These are the sort of bugs we would like to fix.

Killing a worker will not stop house construction by design. As with human player that will either abort the house plan and it will be recreated on next turn, or other workers will finish the house. Can not say the same about fields though - they are placed-and-forget about by the AI. Although certaqinly we can add a feature to monitor required fields/road-connections later on.

AI is already building 3 houses at once each time. We might make it a script command so you could set AI behavior more precisely (e.g. range 1..4 will allowed).

Thanks for response!

Re: AI city planner

PostPosted: 02 Jul 2012, 16:25
by thunder
Hello!
When i tested a map, i found two little things. Pictures show it. If needly, i can send to you replay.
Ai is a great job! I wasnt alone on the map. I hope you will continue the work on it and make weaponcreatorAI, armycreatorAI and battleAI.
Really good work!
Thanks!
t

lw.: it was happened only 2 times from 56 games what i played with AI.
(-Ai check the stone before start to built the roads
-if the buildings not grow up in x time(2-3mins) then take another place)

lwlw.:i dont know is my post good here? Sorry.

Re: AI city planner

PostPosted: 02 Jul 2012, 17:49
by Krom
It would be helpful if you could make a compilation of typical bugs AI has in this topic. 1 and 3 are common mistakes, but I did not knew no.2 happens. Are there any other mistakes AI does? Please add screens :)

Re: AI city planner

PostPosted: 02 Jul 2012, 17:53
by FeyBart
Watching this all, I might want to test it out sometime.


Anyway, isn't there an AI made by someone else out there on the internet that has been tested before? Might save you a lot of work if you implement one of those.

Re: AI city planner

PostPosted: 04 Jul 2012, 07:24
by Lewin
Anyway, isn't there an AI made by someone else out there on the internet that has been tested before? Might save you a lot of work if you implement one of those.
There are AI algorithms to do specific tasks like moving troops, but the KaM world is so specific that there is pretty much no generic AI that could function in it. Imagine taking the AI from say Age of Empires and putting it in KaM. It wouldn't understand about roads, food, weapons, etc. etc. Each game is unique so the AIs need to be written uniquely.
I mean, why would any generic AI on the internet be able to cope with KaM's road system?

Some modern AIs use a sort of "evolution" process to develop them, by running lots of simulations using different random parameters (e.g. building 5 stonemasons at the start or 3 stonemasons) and taking the best results (e.g. most resources, most soldiers after 1 hour) and then mixing (breeding) those algorithms together and repeating. After lots of generations apparently it gives good results, by selecting only the effective solutions. You can then end up with a set of parameters that you know are effective for certain situations, e.g. the simulation might tell you that in order to make the most troops it is best to build 4 stonemasons as soon as possible.
This is all quite a lot of work to set up and it still requires an AI framework, with some parameters to be tweaked. (which we don't have, the AI can only make a simple village at the moment) This is just what I've read about so I don't know if I've got all the facts right, but it sounds like it could work well. There's still a lot of work to go before we get near that stage.

Re: AI city planner

PostPosted: 04 Jul 2012, 11:46
by FeyBart
(...)
There are AI algorithms to do specific tasks like moving troops, but the KaM world is so specific that there is pretty much no generic AI that could function in it. Imagine taking the AI from say Age of Empires and putting it in KaM. It wouldn't understand about roads, food, weapons, etc. etc. Each game is unique so the AIs need to be written uniquely.
I mean, why would any generic AI on the internet be able to cope with KaM's road system?

Some modern AIs use a sort of "evolution" process to develop them, by running lots of simulations using different random parameters (e.g. building 5 stonemasons at the start or 3 stonemasons) and taking the best results (e.g. most resources, most soldiers after 1 hour) and then mixing (breeding) those algorithms together and repeating. After lots of generations apparently it gives good results, by selecting only the effective solutions. You can then end up with a set of parameters that you know are effective for certain situations, e.g. the simulation might tell you that in order to make the most troops it is best to build 4 stonemasons as soon as possible.
This is all quite a lot of work to set up and it still requires an AI framework, with some parameters to be tweaked. (which we don't have, the AI can only make a simple village at the moment) This is just what I've read about so I don't know if I've got all the facts right, but it sounds like it could work well. There's still a lot of work to go before we get near that stage.
No, I don't mean generic AIs. I meant, an existing AI designed for KaM. You guys aren't the only modders out there, so why wouldn't there be someone else who has made an AI for KaM already?

Re: AI city planner

PostPosted: 04 Jul 2012, 12:12
by Lewin
No, I don't mean generic AIs. I meant, an existing AI designed for KaM. You guys aren't the only modders out there, so why wouldn't there be someone else who has made an AI for KaM already?
Actually we're not modders, we wrote the entire engine from scratch, we only reused the graphics, music, sounds, etc. ;) The original KaM engine and AI is embedded into the KM_TPR.exe file, it's not possible to mod it.

Some games use an engine that runs external "scripts" which means they can be modded. In KaM all of the AI code is in the source code of the game which has never been released so modding the engine is basically impossible.

Re: AI city planner

PostPosted: 04 Jul 2012, 16:50
by godest
Its kinda sad it is like that, but not strange considering the age of the game. Im really looking forward to and hoping that the ai will be even better in the next version :D

Re: AI city planner

PostPosted: 05 Jul 2012, 11:56
by FeyBart
(...)
Actually we're not modders, we wrote the entire engine from scratch, we only reused the graphics, music, sounds, etc. ;) The original KaM engine and AI is embedded into the KM_TPR.exe file, it's not possible to mod it.

Some games use an engine that runs external "scripts" which means they can be modded. In KaM all of the AI code is in the source code of the game which has never been released so modding the engine is basically impossible.
So you're basically saying the AI would be useless? That's too bad.