deestar12 / keeperfx

Automatically exported from code.google.com/p/keeperfx
0 stars 0 forks source link

Computer player to sell traps/doors when he has too many #541

Open GoogleCodeExporter opened 8 years ago

GoogleCodeExporter commented 8 years ago
If you leave a computer player who has access to enough gold and a workshop 
alone for too long, he will start to accumulate traps and doors. This will 
cause the workshop to be too small and for new workshops to be built. This 
allows him to build more traps/doors until he fills the map with workshops.

This not only looks silly but can also give rise to issues with the 
things-limit.

I think it would be a good idea for the computer player when he has enough 
workshops, traps and doors to start selling off the excess. This way he can 
keep creatures occupied and the additional gold can never hurt.

I'm not sure how to determine what is 'enough', but a suggestion is to start 
selling off crates when:
1. Workshops are full
2. CP has enough workshop to place 1.5 his creature limit of creatures in the 
workshop.
3. CP has at least 36 workshop tiles.

Original issue reported on code.google.com by Loobinex on 30 Mar 2015 at 1:18

GoogleCodeExporter commented 8 years ago
I think it may be better to improve trap/door placing algorithm:

Currently its:
- find a trap which can be placed; cancel if not found
- get a place on map where the trap should go (from pre-created list); cancel 
if not found
- place the trap

What could be improved:
- search the map for new places for traps if there are none
- if cannot find place for the trap, and we have more than one, then sell it

Original comment by mefistotelis on 1 Apr 2015 at 9:24

GoogleCodeExporter commented 8 years ago
Yes, sounds better.

Original comment by Loobinex on 1 Apr 2015 at 10:06

GoogleCodeExporter commented 8 years ago
This seems to work in r1665, or am I seeing this wrong?

Original comment by Loobinex on 5 Apr 2015 at 4:15

GoogleCodeExporter commented 8 years ago
I started implementing this but some parts are still missing. It doesn't work 
yet.

Original comment by mefistotelis on 5 Apr 2015 at 5:28

GoogleCodeExporter commented 8 years ago
well, something does. Like the picture you posted on missle, the CP just built 
2 or 3 workshops and then stopped building more traps/doors.

Original comment by Loobinex on 5 Apr 2015 at 5:34

GoogleCodeExporter commented 8 years ago
That was caused by something else - when player has lots of money (over 2 
paydays) and every item which can be manufactured has at least one crate 
stored, then computer player will no longer put any creatures into workshop. In 
game code, these conditions are stored in worker_needed_in_dungeons_room_kind().

I'm actually planning to loosen these conditions a bit when selling traps is 
implemented (ie. to 6 paydays).

Original comment by mefistotelis on 5 Apr 2015 at 8:03

GoogleCodeExporter commented 8 years ago
To conclude what I just wrote, less workshops is caused by computer not putting 
creatures there, which is caused by better gold management - it has enough gold 
from gems to stop relying on workshop.

Original comment by mefistotelis on 5 Apr 2015 at 8:08