Page 2 of 3 FirstFirst 123 LastLast
Results 11 to 20 of 24

Thread: Getting Computer Players to attack

  
  1. #11

    Default Re: Getting Computer Players to attack

    Quote Originally Posted by YourMaster View Post
    Thanks for the reply. I'm sorry to break it to you, but the color of the player doesn't change the behavior of it at all. There are several AI's to choose from, and you can assign each to every color.
    I've noticed the AI players acting the in the way I described.
    Both from playing, as from maps that I had build myself.

    Color is not the only difference, the colors also decide what place the AI Computer_Player gets in the tab.
    Blue is the one on top, and is used in the original game always as the default AI opponent.
    Yellow is only used if there are three AI keepers, and is very much less developed in it's behavior.
    The difference between green en blue is less than the difference between yellow and the other two, but there is a difference in AI.

    Maybe I don't understand your question, because all AI Keepers attack me quickly when I play.
    The computer process scripts, I used it to let the computer build other sized rooms, and that worked, but never noticed any other AI behavioral changes from using it in scripts. It is used in level 20, but the behavior of the AI in level 20 is rather default, and looks to me more decided by the way the map is designed, than by the computer process commands. Whatever it does in behavior, it will be a detail activity, is any effect, rather than any decisive strategy.

    Reading the commands, DIG TO GREEDY GOLD2 would be the command you may want to try to make the AI attack.

    As I said, I tested the room size commands in that list, they worked fine, just saw a temple 5*5 instead of the 3*3 as default today, and other rooms I scripted from that list, but for using commands for AI behavior means that you must understand the AI first and test a lot for it to make it work.
    DIG TO GREEDY GOLD or DIG TO GREEDY GOLD2 could work to start an attack with a timer, but what is meant by "attack" will depend on many things. Attack by imps, or attack by Call to Arms? I would guess it would be an attack by imps, because generally Dungeon Keeper calls attack taking tiles. Like building a bridge. For visible effect, a breach will be needed.

  2. #12

    Default Re: Getting Computer Players to attack

    Yes, player colors determine the place in the interface, player0 (you) is red, player1 is blue, player2 is green, player3 is yellow and player_good is white, see here. However, when you make a map you have to define the players to make them do anything, and in that command you assign which AI you want, the best one or one that is only defensive or just build small rooms or whatever. If you define two players on a map it is easily possible to make player1 very weak and player 3 good.

    And yes, I've read the commands there and they work, but you'll also notice a lot is not documented yet. The DIG_TO_GREEDY gold command can be used to make the player dig further and hopefully run into the player, but it might just as well dig the other way and it also depends on how much gold it has.
    What I want is to trigger one of the attack plan processes, based on a condition of my choosing. For example make both blue and green attack the player the moment he converts the knight.

    And yes, everything the computer players do is determined by the defined processes, and I've played around with it a bit, but have not managed to trigger an attack the moment of my choosing, while this is possible as the AI sometimes actively decides to do an attack.
    If you're interested to play around with it as well, in KeeperFX you can use the 'compuchat' command line option to make the Computer Players tell you whatever they decide to do.

  3. #13

    Default Re: Getting Computer Players to attack

    There are tricks possible, to make an AI Keeper to attack when you want.
    For as far the Computer_Player goes, these are much more different in behavior that the colors. Most levels I made where with several AI Keepers, I have lots of experience with tuning AI Keepers. The map Alcatraz you played last week, I originally had the blue Keeper thee, but tested the Green keeper later, redid the script, in order to notice any difference. I noticed not much difference on that map, but noticed differences on other maps. Very small, and these differences can be for many reasons, since the routines the DK engine walks through, are connected to the speed of the computer that it is played on.

    But back on topic:
    A trick one may try to start an AI Keeper attack on a certain timing, is throwing a creature in the color of the AI Keeper, at the imps that enter that AI Keeper door from an action point. Because once one creature is attacked, the AI Keeper will throw all his creatures there, and place a CTA there. This creature can be anything. An imp or a dragon level 2 or above. But such a trick should be tested and tuned.

    This SET_COMPUTER_PROCESS will define tiles being taken, and it is hard to figure out what it does in level 20.
    I've been thinking about it, it will make the AI Keeper there dig the Gold south of the map.
    I remember playing that level, where the AI would attack the gems in the south, which is very far away from it's dungeon.
    It would also place lots or traps there, and imps would attack that gold and gems.
    This may have been what that command did.

    As said, Dungeon Keeper defines attack as taking tiles and digging, not throwing creatures.
    The Vampires and Mistresses that attack the player0's dungeon in level 20, this is done default in all maps.

    I presume you want to have the AI Keeper throw creatures at player0, I gave you a trick to achieve that effect.
    ADD_CREATURE_TO_LEVEL, player1-2or3, at the action point that gets hit by player0, in order to make that Keeper throw all it's creatures there an set up an CTA. You will have to be sure that the player0 imp taking that tile is there also, in order to start a fight there. This will also work is the dungeon is not breached, but only if there is a claimed tile there where the AI Keeper can throw its creatures.

  4. #14

    Default Re: Getting Computer Players to attack

    No, I want to AI to start digging towards the red dungeon to attack.

    And yes, lvl20 has some of those scripts, I have not played around with that level to see how it works. One of them has some comments there,....
    But this is the direction I'm interested in, using those commands to get the AI to do directly what I want when I want it.

  5. #15

    Default Re: Getting Computer Players to attack

    Hey, what 'bout this, you create gold tiles which lead the AI dungeon to the Player's dungeon?

  6. #16

    Default Re: Getting Computer Players to attack

    That works in leading to an attack eventually, but you cannot control the timing of the confrontation based on player actions. If I want the attack to occur as soon as the torture room is researched, and some players research quickly others slowly, this doesn't help.

    The thing is, by using the script to modify the computer process, this is possible. We just haven't figured out how to use these script commands properly, which is a shame.

  7. #17

    Default Re: Getting Computer Players to attack

    Quote Originally Posted by Maxwell View Post
    Hey, what 'bout this, you create gold tiles which lead the AI dungeon to the Player's dungeon?
    Unfortunately that's what you need to do. A combination of open path, gold and water leading from one dungeon to the other. It can't be just a single tile either as the AI doesn't handle locked doors so well.

    If you want the player to be constantly threatened by the AI, you either build their majority army out of explorers (Flies/Hounds explore early, Mistress/Vampire/Reapers explore after max level) or you have 2-tile dirt path connecting both hearts. The imps will fight over territory which will make the AI drop their creatures at the 'frontlines' repeatedly.

  8. #18

    Default Re: Getting Computer Players to attack

    I ran into this piece of code in file player_comptask.c:
    Code:
    TbBool create_task_dig_to_attack(struct Computer2 *comp, const struct Coord3d startpos, const struct Coord3d endpos, PlayerNumber victim_plyr_idx, long parent_cproc_idx)
    {
        struct ComputerTask *ctask;
        SYNCDBG(7,"Starting");
        ctask = get_free_task(comp, 0);
        if (computer_task_invalid(ctask)) {
            return false;
        }
        if ((gameadd.computer_chat_flags & CChat_TasksScarce) != 0) {
            message_add_fmt(comp->dungeon->owner, "Player %d looks like he need a kick.",(int)victim_plyr_idx);
        }
        ctask->ttype = CTT_DigToAttack;
        ctask->dig_somewhere.startpos.x.val = startpos.x.val;
        ctask->dig_somewhere.startpos.y.val = startpos.y.val;
        ctask->dig_somewhere.startpos.z.val = startpos.z.val;
        ctask->dig_somewhere.endpos.x.val = endpos.x.val;
        ctask->dig_somewhere.endpos.y.val = endpos.y.val;
        ctask->dig_somewhere.endpos.z.val = endpos.z.val;
        ctask->field_8C = parent_cproc_idx;
        ctask->dig_somewhere.target_plyr_idx = victim_plyr_idx;
        ctask->lastrun_turn = 0;
        ctask->flags |= 0x04;
        // Setup the digging
        setup_dig_to(&ctask->dig, startpos, endpos);
        return true;
    }
    My best guess is we should use this command to get the computer player to attack: SET_COMPUTER_GLOBALS(PLAYER1,7,7,7,7,7,7)
    This command should make the CP dig a tunnel from one location to another, exactly what you'd want. Now just figure out what number to use instead of '7'.

  9. #19

    Default Re: Getting Computer Players to attack

    SET_COMPUTER_GLOBALS(PLAYER1,startpos.x,startpos.y ,startpos.z,endpos.x,endpos.y,endpos.z)

    Is this what you mean ?

    To be sure I don't misunderstand
    X is Horizontal axis and Y Vertical axis
    Z is used for ?
    Last edited by watler253; July 18th, 2016 at 20:36. Reason: typos

  10. #20

    Default Re: Getting Computer Players to attack

    I don't know how it works yet, but that isn't it. Still have to play around with it, but shared it yesterday in the hopes that anybody else found out how to use it overnight. You can see the complete file here.

    This command isn't documented at all yet, see here. But somehow we need to set 'Computer dig to attack' which is listed there. The computer globals command however only allows numbers, and does not allow to specify the process by name (Computer dig to attack) so you have to indicate the index of it. My first guess was '7' because it was number 7 here, but that doesn't seem right.

    The command does not seem to leave much room for both x, y and z coordinates, but when it would the game usually means the subtile. (x,y give the tile on the map, and each tile has 9 subtiles which is z)

Similar Threads

  1. Magic door and magical attack
    By mefistotelis in forum KeeperFX
    Replies: 24
    Last Post: February 23rd, 2014, 15:16
  2. Computer Players
    By dayokay in forum DK1 Mapmaking
    Replies: 5
    Last Post: July 26th, 2013, 16:08
  3. Melee attack for the Dragon
    By DragonsLover in forum Dungeon Keeper 1
    Replies: 15
    Last Post: August 14th, 2010, 22:21
  4. Bomberman 64 - The Second Attack Parodies
    By Metal Gear Rex in forum Off Topic
    Replies: 5
    Last Post: May 22nd, 2010, 19:17

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
  •