yvsarkisyan / keeperfx

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

newdig: Rooms are build adjacent to distant treasure rooms. #624

Open GoogleCodeExporter opened 9 years ago

GoogleCodeExporter commented 9 years ago
In r1850 with the newdig option the CP builds treasure rooms close to distant 
gold pockets to mine more efficiently. However he might also build other rooms 
like a library right next to it.

Packetfile, screenshot and log file attached.

To reproduce the issue:
1.  Load campaign level 19
2.  Claim all rooms
3.  Use cheat mode to view blue player

Original issue reported on code.google.com by Loobinex on 18 May 2015 at 11:55

Attachments:

GoogleCodeExporter commented 9 years ago
Actually, not a flaw as such; I simply didn't add distance heuristics to room 
evaluation yet, so AI doesn't realize it's a bad idea to spread out (most kinds 
of) rooms. Will be easy to at least do better in majority of cases.

Original comment by eatpajdi...@gmail.com on 20 May 2015 at 7:58

GoogleCodeExporter commented 9 years ago
Priority raised because I think it shouldn't take me long

Original comment by eatpajdi...@gmail.com on 22 May 2015 at 7:15

GoogleCodeExporter commented 9 years ago
[deleted comment]
GoogleCodeExporter commented 9 years ago

Original comment by eatpajdi...@gmail.com on 22 May 2015 at 7:21

GoogleCodeExporter commented 9 years ago
Is there a cheat to start level 19 without starting all maps before it?

Original comment by eatpajdi...@gmail.com on 12 Jul 2015 at 8:02

GoogleCodeExporter commented 9 years ago
Yes. Two options.

1.) Start the game with -alex command line option. Continue/start campaign, on 
the overworld map use Ctrl+F10 to move forward through levels. Ctrl+F9 to move 
backwards.

2.) Start the game with '-level 19' command line option.

Original comment by Loobinex on 12 Jul 2015 at 9:47

GoogleCodeExporter commented 9 years ago
Added some heuristics in r1884. Rooms far away from enemies are preferred 
(unless e.g. prison) and close to player dungeon heart are preferred.

Note that this will not change behavior on level 19 testcase; it is because 
it's arguably a good thing to have rooms far away from player.

What's clearly missing at the moment is some heuristic to ensure rooms with 
working creatures are more consistently close to a hatchery, but that will be 
added when found practical.

Original comment by eatpajdi...@gmail.com on 13 Jul 2015 at 5:36

GoogleCodeExporter commented 9 years ago
Don't think it works like you want it to. See the graveyard in the image made 
in r1885.

There's nothing wrong with building rooms away from the player. However, you 
added code making treasure rooms near gold(good), but that does not mean other 
rooms should be build across the map near where the gold was.

Original comment by Loobinex on 13 Jul 2015 at 11:59

Attachments:

GoogleCodeExporter commented 9 years ago
It's building graveyard there because it expects lots of corpses closer to 
player. Now arguably it should also take into account whether it expects to be 
winning versus player, which it doesn't at the moment.

Original comment by eatpajdi...@gmail.com on 14 Jul 2015 at 7:26

GoogleCodeExporter commented 9 years ago
I think you're making it too complex and the results won't be better for it. 
Think of it in a few easy groundrules a human player will also follow:

1) Always make the dungeon as compact as possible. If at all possible avoid 
corridors of more than 1 tile and in general the dungeon should be most 
efficient. Even for prison and graveyards you generally would want them close. 
This allows the rooms to be more easily defended, makes it far easier to wall 
off the entire dungeon, allows creatures spawning from the rooms to be close to 
the main dungeon and when the imps drop them off they are close to the other 
key dungeon tasks.

2) Optional: Only when you find out you cannot complete a task because of a 
long walking distance you'll build a room close by the task at hand. I think 
this is hardly ever efficient though. Dropping all your imps near the 
corpses/prisoners will usually get results faster, unless you don't have to dig 
out and claim a room but the space is already available.

If you really want behavior where rooms are build really close to the action, 
you'd need to come up with rules that weight the higher risk of losing the room 
against the benefit of reduced imp effort.

Original comment by Loobinex on 14 Jul 2015 at 8:23

GoogleCodeExporter commented 9 years ago
I was making of making it conditional on having a large advantage versus
the player the room is close to. There are still some things hard to take
into account (such as, level script deciding to spawning tunneling heroes),
but that's mostly an argument for making it configurable (at the last an
on/off switch).

With prisons, at least it used to be the case that room placement is
important to prevent prisoners from waking up during transport. For
graveyard less so since there are no non-linear bad effects of the delay.

Original comment by eatpajdi...@gmail.com on 14 Jul 2015 at 9:42

GoogleCodeExporter commented 9 years ago
Oh and of course this kind of evaluation is always limited to the fact it's 
only considering the present and not the future. So if the enemy player was to 
increase his strength a lot relatively speaking (likely in case of human), 
you're right it puts sprawling rooms in a worse position. On the other hand, I 
think it might be worth to sacrifice at least prison for it due to how much 
fast transport of prisoners matters.

Original comment by eatpajdi...@gmail.com on 14 Jul 2015 at 9:46

GoogleCodeExporter commented 9 years ago
There is indeed a risk of prisoners waking up during transport, and the shorter 
the travel distance the lower the risk.

However, the wake-up time of stunned creatures is long enough for prisoners to 
be transported from one side of the map towards the other side with time to 
spare. They will only wake up when you leave them stunned for quite some time 
before picking them up. This basically only comes into play when an entire army 
is defeated and there are more prisoners than there are imps, at which point 
the game is more or less over anyway. In all other cases the proper solution 
would be for the CP to assign the imps the pickup prisoner task.

Frankly, I've never seen distant room placement of prisons as a limitation if 
the AI, and for myself whenever I play I not only don't build proxy-prisons, 
but if I happen to claim them I will sell them because I want the prisoners in 
my big prison in my dungeon not spread all over the map with the risk of them 
escaping because they won't fit.

I think you are underestimating how detrimental it would be for the CP to have 
is dungeon spread out. Having reinforced walls is a really big bonus, digging 
into hero pockets is a very big risk and when the player decides to attack the 
CP will lose the prison first leaving the CP without a prison when he needs it 
most.
It is very, very common for the CP to start out with an advantage only to be 
caught up by the player. It is a defensive game, so as long as a player is 
disadvantages he will remain walled up.

I have yet to see a situation where the CP has prisoners waking up during 
transport, but if you're really conserned about this situation I think the far 
superior option would be to make building proxy-rooms part of an attack plan. 
So build a prison in the main dungeon when it becomes available, and than when 
the CP decides to attack and money is available build another small one closeby 
as a side-room of the tunnel that is being dug to actually attack.
This because when not attacking you have none of the advantages of a 
proxy-prison but all of the disadvantages. 

Original comment by Loobinex on 14 Jul 2015 at 10:35

GoogleCodeExporter commented 9 years ago
I really like the idea of proxy prisons and I had forgotten all about that. I 
will replace the positive weight with zero for prisons for now (so that they're 
unaffected by distance to enemy) and add a 3x3 proxy prison logic later on.

Original comment by eatpajdi...@gmail.com on 15 Jul 2015 at 5:03

GoogleCodeExporter commented 9 years ago
Temple placement still is problematic on r1892.

The original issue is also still there. Dungeon is pulled apart in two bits 
because of remote treasure room.

See attached images.

Original comment by Loobinex on 16 Jul 2015 at 11:54

Attachments:

GoogleCodeExporter commented 9 years ago
I can certainly add another metric to make exterior walls much more expensive, 
which should make the dungeon contract (otherwise, simply minimizing distance 
from heart). It will make the dungeon's shape somewhat less "artistic", but I 
guess that's acceptable.

On temple, while it might look silly it thinks it's easier defensible. On the 
other hand, a temple has dependencies on other rooms in reality (creatures to 
walk to/from without player intervention so it's not that practical admittedly).

So to summarize, although I admire the visual aesthetics the organic dungeon 
shapes at the moment I'll try to hammer them into more compact shapes that are 
quicker to reinforce walls of.

Original comment by eatpajdi...@gmail.com on 17 Jul 2015 at 12:21

GoogleCodeExporter commented 9 years ago
Good. Not only walking distance and reinforcing, also having to spend more time 
to dig out the room and bigger risk of breaching danger are considerations.

Reinforcing walls takes a long time, so if the CP can build a room on 2 sides 
of the reinforced wall that saves a lot of time. So reusing walls is a more 
important metric than distance to heart.

Original comment by Loobinex on 17 Jul 2015 at 12:58