Intelligent farming system
Posted: 19 Nov 2014, 20:22
Hi guys,
Sorry that I do not respond to your suggestions - I will in the future. Last 4 months were very busy for me. I relocated from Warsaw to London, had to find job, set up - and now I am running.
Last 2 evenings I spent working on bot performance - I tested it on 140 villages and it work better.
Next thing is to implement Intelligent farming. Today, I read all emails and suggestions about intelligent farming which you wrote me. I produced a draft of intelligent farming. It will be a base for me to implement it. You can read it if you wish, if you will have any suggestions, please write them down, making posts.
Hopefully it should be ready in mid-December.
Thanks for waiting!
Draft:
1. world with spies? (global)
1.a. in first attack send only spies (get number of spies, city)
1.b. if spies available, send spies in each attack (get number of spies, city)
2.
max time/range each package(you can define many packages, and set theirs priority, one package have lc, other sp, other sw)
packages will be multiplied if needed - so in this case this package is the smalles amount of troops which you can send in attack
===algorithm===
2.a. at first bot checks what range is covered by infantry packages - lets say 5 fields,
2.b. then bot gets rest of cavalry packages and start to send them from max range taken from infantry packages(it this case it start to send from 5 fields)
2.c. then bot gets cavalry package max range(lets say 10) and sends cavalry from range 5 to 10.
2.d. Once 5-10 range is covered, and cavalry is still in village, bot will start to send troops to range 5, then 4, then 3 - those ranges belongs to infantry range
2.e. If cavalry is out, then bot starts to send infantry to not covered ranges from 0-5. If range 5 was covered by cavalry then infantry will not be send there.
in this way you can define:
1. 10 lc - 15 range or time
2. 100 sp - 8 range or time
3. 200 sw - 4 range or time
sending will look like:
1. lc is started to send from 8+1 range to 15 range,
1a. if range 9-15 is covered, and lc left, ls is send to range 8, then range 7, etc until there is no lc
1b. if during covering 9-15 range, bot will go out of troops on covering 11 range, then it will stops, range 11-15 is not covered, there is no lc
2. there is no lc, so bot will take sp now, it will start to cover range from 4+1,
2a. if range 5-8 is covered, then it send sp to range 4, 3, etc until there is no sp
2b. if during covering 5-8 range, bot will go out of troops on covering 7 range, then it will stops, range 7-8 is not covered, there is no sp
3. there is no sp, bot will take sw, it will start to cover range from 0+1,
3a. if range 1-4 is covered, then it stops
3b. if during covering 1-4 range, bot will go out of troops on covering 2 range, then it will stops, range 2-4 is not covered
the easiest way to define packages:
1. 10 lc - 15 range
in this case sending will look like:
bot start to sending troops from range 0 to 15, if there is no troops while covering 5 range, then bot stops
maybe i will add option to invert it, starting with slowest units - which will be much easier, one user said that based on max time for units, they will be at home
at the same time(x2 forth and back) when you stop farming - so it makes sense, so there will be 2 algorithms for sending packages
===algorithm===
multiply package to gather all resources(if reports with spy available) - it send all available troops to get all possible resources from village
or(if reports not available):
options(maybe I will just write statistic function which will lover or decrease amount of package to cover it):
increase current package by 50%[define it(ceiling to 1 unit)] when gathered resources are bigger than 100% of report carrying capacity (1000 gathered /1000 troops capacity)
decrease current package by 10%[define it(ceiling to 1 unit)] when gathered resources are less than 80%[define it] of report carrying capacity (800 gathered /1000 troops capacity)
?or decrease and wait a little bit longer to send troops there again
option for fresh worlds
take into account informations from the last 48 hours(troops packages will be based on reports informations(building levels), time of day, travel time - at night probably send more troops than during a day, because during day people are farming)
if no informations available send minimal package
4.
if wall level is bigger or equal [(get setting)] send wall destroying troops package:
4.a. rams package count [x] per [y] wall level/s - it will be multiplied
4.b. catapults package count [x] per [y] wall level/s - it will be multiplied
4.c. troops package accompanying rams/catapults package
4.d. set highest priority to send destroying troops package(in case accompanying troops are out, bot will wait until they will be available, but if rams or catapults are not available atm, then bot will proceed to sending normally troops till rams/cats will be available again)
or check if there was loses(1 lc or similar - this is indicator that wall is on ~ 3lvl - (? 14 rams if you lose 1, 28 rams if you lose 2, 42 if you lose 3)
5. Farmed villages list per city:
- for each farmed village(or globally for your city) set minimal interval to send troops again(in case we send minimal troops packages and we have a lot of troops in village or global intelligent interval)
- farmed village distance
- covered by package?
- current package amount
!Global intelligent farming interval!
In WorkersController check if city needs to be processed(interval time passed, or we should receive new report from farming attack and act accordingly)
Sorry that I do not respond to your suggestions - I will in the future. Last 4 months were very busy for me. I relocated from Warsaw to London, had to find job, set up - and now I am running.
Last 2 evenings I spent working on bot performance - I tested it on 140 villages and it work better.
Next thing is to implement Intelligent farming. Today, I read all emails and suggestions about intelligent farming which you wrote me. I produced a draft of intelligent farming. It will be a base for me to implement it. You can read it if you wish, if you will have any suggestions, please write them down, making posts.
Hopefully it should be ready in mid-December.
Thanks for waiting!
Draft:
1. world with spies? (global)
1.a. in first attack send only spies (get number of spies, city)
1.b. if spies available, send spies in each attack (get number of spies, city)
2.
max time/range each package(you can define many packages, and set theirs priority, one package have lc, other sp, other sw)
packages will be multiplied if needed - so in this case this package is the smalles amount of troops which you can send in attack
===algorithm===
2.a. at first bot checks what range is covered by infantry packages - lets say 5 fields,
2.b. then bot gets rest of cavalry packages and start to send them from max range taken from infantry packages(it this case it start to send from 5 fields)
2.c. then bot gets cavalry package max range(lets say 10) and sends cavalry from range 5 to 10.
2.d. Once 5-10 range is covered, and cavalry is still in village, bot will start to send troops to range 5, then 4, then 3 - those ranges belongs to infantry range
2.e. If cavalry is out, then bot starts to send infantry to not covered ranges from 0-5. If range 5 was covered by cavalry then infantry will not be send there.
in this way you can define:
1. 10 lc - 15 range or time
2. 100 sp - 8 range or time
3. 200 sw - 4 range or time
sending will look like:
1. lc is started to send from 8+1 range to 15 range,
1a. if range 9-15 is covered, and lc left, ls is send to range 8, then range 7, etc until there is no lc
1b. if during covering 9-15 range, bot will go out of troops on covering 11 range, then it will stops, range 11-15 is not covered, there is no lc
2. there is no lc, so bot will take sp now, it will start to cover range from 4+1,
2a. if range 5-8 is covered, then it send sp to range 4, 3, etc until there is no sp
2b. if during covering 5-8 range, bot will go out of troops on covering 7 range, then it will stops, range 7-8 is not covered, there is no sp
3. there is no sp, bot will take sw, it will start to cover range from 0+1,
3a. if range 1-4 is covered, then it stops
3b. if during covering 1-4 range, bot will go out of troops on covering 2 range, then it will stops, range 2-4 is not covered
the easiest way to define packages:
1. 10 lc - 15 range
in this case sending will look like:
bot start to sending troops from range 0 to 15, if there is no troops while covering 5 range, then bot stops
maybe i will add option to invert it, starting with slowest units - which will be much easier, one user said that based on max time for units, they will be at home
at the same time(x2 forth and back) when you stop farming - so it makes sense, so there will be 2 algorithms for sending packages
===algorithm===
multiply package to gather all resources(if reports with spy available) - it send all available troops to get all possible resources from village
or(if reports not available):
options(maybe I will just write statistic function which will lover or decrease amount of package to cover it):
increase current package by 50%[define it(ceiling to 1 unit)] when gathered resources are bigger than 100% of report carrying capacity (1000 gathered /1000 troops capacity)
decrease current package by 10%[define it(ceiling to 1 unit)] when gathered resources are less than 80%[define it] of report carrying capacity (800 gathered /1000 troops capacity)
?or decrease and wait a little bit longer to send troops there again
option for fresh worlds
take into account informations from the last 48 hours(troops packages will be based on reports informations(building levels), time of day, travel time - at night probably send more troops than during a day, because during day people are farming)
if no informations available send minimal package
4.
if wall level is bigger or equal [(get setting)] send wall destroying troops package:
4.a. rams package count [x] per [y] wall level/s - it will be multiplied
4.b. catapults package count [x] per [y] wall level/s - it will be multiplied
4.c. troops package accompanying rams/catapults package
4.d. set highest priority to send destroying troops package(in case accompanying troops are out, bot will wait until they will be available, but if rams or catapults are not available atm, then bot will proceed to sending normally troops till rams/cats will be available again)
or check if there was loses(1 lc or similar - this is indicator that wall is on ~ 3lvl - (? 14 rams if you lose 1, 28 rams if you lose 2, 42 if you lose 3)
5. Farmed villages list per city:
- for each farmed village(or globally for your city) set minimal interval to send troops again(in case we send minimal troops packages and we have a lot of troops in village or global intelligent interval)
- farmed village distance
- covered by package?
- current package amount
!Global intelligent farming interval!
In WorkersController check if city needs to be processed(interval time passed, or we should receive new report from farming attack and act accordingly)