Results 1 to 3 of 3

Thread: Increase meatbot difficulty

Threaded View

Previous Post Previous Post   Next Post Next Post
  1. #1
    Corporal guiismiti's Avatar
    Join Date
    Dec 2013
    Location
    Brazil
    Posts
    244
    Thanks
    121
    Thanked 42 Times in 31 Posts

    Increase meatbot difficulty

    Hi again,
    Today I thought of a way to increase the difficulty of meatbot. I know there are people here who use it in their servers.

    If you run around bots, they will keep shooting at the position where you just were, and that makes it too easy to dodge their attacks.
    What I did is simple - I made bots predict where the target will be and shoot at this predicted position.

    In an infinite loop, I save the player position and time of saving.
    When the bot finds the player, it uses the current position at current time + saved position at saved time to get a movement rate for the target.
    Extrapolating at this rate to a certain moment in the future (the delay of the bot's shot), we have a predicted position of the player.

    If you want to make it even harder, remove the spread from the bots weapons.

    Now, the code may be a bit messy and may have a couple of unnecessary things, I'm very tired.

    onPlayerConnect:
    PHP Code:
    self thread definePreviousPos(); 
    onPlayerSpawn:
    PHP Code:
    self.previouspos[0] = self getOrigin();
    self.previouspos[1] = self getOrigin();

    self.previouspostime getTime(); 
    The infinite loop:
    PHP Code:
    definePreviousPos()
    {
        
    self.previousposold = [];
        
    self.previousposnew = [];
        
    self.previouspostime getTime();;

        for(;;)
        {
            if
            (
                (
                    (
    self.pers["team"] == "allies") ||
                    (
    self.pers["team"] == "axis")
                ) &&
                (
    isAlive(self))
            )
            {
                
    self.previousposold self.previousposnew;
                
    self.previousposnew self.origin;
                
    self.previouspostime getTime();
            }

            
    wait(0.1);
        }

    Now, in _mbot_tdm.gsc::checkEnemy()
    Replace
    PHP Code:
    vtarget vectorNormalize(target_mark eye); 
    With
    PHP Code:
    botdelay 150;
    interval getTime() - (target.previouspostime 100);
    extrapolationfactor botdelay interval;

    deltapos = [];

    for(
    03k++)
    {
        
    deltapos[k] = (target.origin[k] - target.previousposold[k]) * extrapolationfactor;
        
    // deltapos[k] = (target.previousposnew[k] - target.previousposold[k]) * 100;
    }

    vtarget vectorNormalize((target_mark[0] + deltapos[0], target_mark[1] + deltapos[1], target_mark[2] + deltapos[2]) - eye); 
    botdelay is the delay of the bot's shot (in ms). I have it roughly calibrated at 150 ms.

    Have fun
    set logfile 2

  2. The Following User Says Thank You to guiismiti For This Useful Post:

    kung foo man (30th March 2017)

Posting Permissions

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