Results 1 to 8 of 8

Thread: Computer player placing doors code

  
  1. #1
    KeeperFX Author mefistotelis's Avatar
    Join Date
    Sep 2009
    Location
    Poland
    Posts
    1,242

    Default Computer player placing doors code

    I just rewrote Computer player door placing code.

    Please test if it works OK - the new code is available since r844.

    Also, there are some things which should probably be a bit optimized:
    - Computer player prefers wooden door, and will place other kinds only if wooden are depleted
    - Computer player will only place doors around rooms
    - Computer placed doors only on corridors which are on straight line to central tile of the room

    If anyone has a concept of how these should be fixed, feel free to comment. If anyone would like to implement changes in computer_check_for_place_door() - also feel free to do so.

  2. #2
    Beetle Stanislas Dolcini's Avatar
    Join Date
    Aug 2012
    Location
    France
    Posts
    113
    Gamer IDs

    Steam ID: StanleySweet Raptr ID: stanleysweet

    Default Re: Computer player placing doors code

    Quote Originally Posted by mefistotelis View Post
    I just rewrote Computer player door placing code.

    Please test if it works OK - the new code is available since r844.

    Also, there are some things which should probably be a bit optimized:
    - Computer player prefers wooden door, and will place other kinds only if wooden are depleted
    - Computer player will only place doors around rooms
    - Computer placed doors only on corridors which are on straight line to central tile of the room

    If anyone has a concept of how these should be fixed, feel free to comment. If anyone would like to implement changes in computer_check_for_place_door() - also feel free to do so.
    For the wooden doors, maybe make the computer check if better doors are available if so, then place the better ones.

    For the second, you'd need to find a way to make the computer detect that threats can come from a corridor and then make it put a door, and even better a locked one.

  3. #3
    KeeperFX Author mefistotelis's Avatar
    Join Date
    Sep 2009
    Location
    Poland
    Posts
    1,242

    Default Re: Computer player placing doors code

    Quote Originally Posted by Stanislas Dolcini View Post
    you'd need to find a way to make the computer detect that threats can come from a corridor and then make it put a door, and even better a locked one.
    That's a good point.

    Placing locked door could lead to various problems and I think it should be avoided; but placing door in a corridor which leads to enemy dungeon - this is doable and sounds like a really good idea.

  4. #4
    Beetle Stanislas Dolcini's Avatar
    Join Date
    Aug 2012
    Location
    France
    Posts
    113
    Gamer IDs

    Steam ID: StanleySweet Raptr ID: stanleysweet

    Default Re: Computer player placing doors code

    Quote Originally Posted by mefistotelis View Post
    That's a good point.

    Placing locked door could lead to various problems and I think it should be avoided; but placing door in a corridor which leads to enemy dungeon - this is doable and sounds like a really good idea.
    For the last one i guess the computer should be checking if there are holes in the wall around the room. I don't how how it places door with the center tile reference though. Maybe that was easier to make the computer build 5x5 rooms so that there was not any complicated AI check to write.

  5. #5
    Spider
    Join Date
    Mar 2013
    Location
    Cardiff, UK
    Posts
    206

    Default Re: Computer player placing doors code

    Doors manufactured, but unused, are a waste. As long as they aren't locked, the worst they can do is be ineffective, and at best they can impede enemy progress. Hence better to be free with the placement algorithm. Maybe one condition based on proximity to enemy territory?

  6. #6
    KeeperFX Author mefistotelis's Avatar
    Join Date
    Sep 2009
    Location
    Poland
    Posts
    1,242

    Default Re: Computer player placing doors code

    Quote Originally Posted by dayokay View Post
    Doors manufactured, but unused, are a waste. As long as they aren't locked, the worst they can do is be ineffective, and at best they can impede enemy progress. Hence better to be free with the placement algorithm.
    When players are fully developed, creatures are manufacturing most of the time - so it's good to have wider range of places for doors. But a few first doors a player manufactures should be placed in places that look more important.

    It would be possible to prepare a "score" for every place and start with the places with higher score - but that's quite complicated, I'm not sure if we want to go this way.

    Maybe there should be two algorithms for placing doors - ie. first try the "strict algorithm" to place doors in crucial places. If all crucial places are taken, run "free algorithm" and select places which are not necessarily most strategic.

    Quote Originally Posted by dayokay View Post
    Maybe one condition based on proximity to enemy territory?
    That would make computer vulnerable to attack from behind, do we really want it?
    Last edited by mefistotelis; October 30th, 2013 at 17:58.

  7. #7
    Dragon DragonsLover's Avatar
    Join Date
    Aug 2009
    Location
    Quebec
    Posts
    1,490
    Gamer IDs

    Steam ID: dragonslover

    Default Re: Computer player placing doors code

    Doors around rooms are good because they add efficiency to these rooms. Even wooden doors are sufficient to boost a room's efficiency. I agree with Stan to replace wooden doors to better ones once they are available. At the same time, door placements should come along with what kind of rooms they are adjacent to and set a door accordingly to these kinds. For example, the Dungeon Heart room should obviously have magic doors surrounding it, same would go for the treasure room and the portal. Lairs, libraries and traning rooms could have iron doors, braced doors for the workshop, prison, torture chamber, graveyard and scavenger rooms, wooden for the rest. These are just examples. If the kind of door isn't available to build, downgrade to the previous most solid door, down to wooden. Also, if the door is between two rooms, make sure that the best door is used depending on both rooms. For example, if there's a space between the lair and the treasure room for a door, use the magic door.
    Next, if the computer has extra doors built and has mostly filled all spaces for doors, keep improve all doors until all of them are magic.
    I don't know if it's feasible, but that's my idea.

    About the "threat", it could be based on coordinates of enemies' dungeon hearts, but this could lead to a problem if, for example, the level is in a U shape where the computer would place best ones near the impenetrable rocks. I don't know what kind of calculations could be done on that.

    Finally, make sure doors aren't placed in an exaggerated way, such as having a corridor filled with tons of doors, square by square.
    I like dragons! They're the center of my life! I'll never forget them...



  8. #8
    KeeperFX Author mefistotelis's Avatar
    Join Date
    Sep 2009
    Location
    Poland
    Posts
    1,242

    Default Re: Computer player placing doors code

    I'm not really convinced if such complicated algorithm for selecting door kind is a good idea.

    Maybe it would be enough to just place a random kind out of the available ones?
    Or maybe there's another way to make a simple algorithm?

    And what do you think about the idea of using two functions for selecting place for door - a "strict" one and an "open" one?

Similar Threads

  1. Some traps and doors questions
    By friscmanseby in forum KeeperFX
    Replies: 5
    Last Post: July 29th, 2012, 22:26
  2. Wood, Braced and Iron doors
    By Mistressmaster in forum KeeperFX
    Replies: 17
    Last Post: March 28th, 2011, 23:49
  3. Computer AI issues
    By naton9 in forum KeeperFX
    Replies: 22
    Last Post: February 25th, 2011, 18:13
  4. Old & New Traps & Doors for Dungeon Keeper 2
    By d4rklqrdnem3sys in forum Dungeon Keeper 2
    Replies: 4
    Last Post: October 20th, 2010, 06:55

Tags for this Thread

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •