The Gang Garrison 2 Forum
May 19, 2013, 05:31:39 pm *
Welcome, Guest. Please login or register.
Did you miss your activation email?

Login with username, password and session length
News: Chat with us on IRC: http://ganggarrison.com/irc.html
Server: irc.esper.net, Channel: #gg2
 
   Home   Help Search Login Register  
Pages: « 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 »
  Print  
Author Topic: Tempest Bot [v5_3]  (Read 35408 times)
Orpheon
2011 Haxxy Award Winner
*
Offline Offline

Posts: 5818


Developer


« Reply #540 on: October 30, 2011, 08:29:55 am »

great to hear it from you z5
and what had changed?
(except for variables)
EDIT:have you tested it yet?
also i never understand the collision_line(...)<0
i thought i only return 0 and 1?
EDIT2:did you fix that unable-to-change-class yet?
Collision_line returns the instance of what you collided with, or -1 if there isn't one.

No, and that bug is starting to piss me off.
Adding a show_message seems to fix it, taking the show_message away breaks it again.
 Drolling

As for differences, there are a few, but I didn't count them. Yes I have tested and changed the script again a bit:
Code:
///////////
//HEALING//
///////////

//CHECK CURRENT HEALING TARGET//

//out of sight or meet obstacle in the healing beam
if patient != -1
{
    if point_distance(object.x, object.y, patient.x, patient.y)>300
    or collision_line(object.x, object.y, patient.x, patient.y, Obstacle, true, true) > 0
    or patient.cloak
    {
        patient = -1;
    }
}

if patient != object.currentWeapon.healTarget and isHealing
{
    isHealing = 0
}

//target is dead
if patient == -1 and isHealing
{
    isHealing=0;
}
else if patient != -1 and !isHealing
{
    // You've just chosen a new target
    isHealing = 1
}

//FINDING BEST TARGET//

with Character
{
    if team == other.team and id!=other.object
    and distance_to_object(other.object) <= 300 //in range of healing
    and !cloak
    and (player.class != CLASS_MEDIC or hp < 40)
    and (!ubered or healer == other.id)
    and healer == -1//target is not healed, dont steal patient, it's not effective
    {
        if other.patient == -1//no target yet:pick one
        {
            other.patient = id;
            other.isHealing=0;
        }
        else
        {
            if ((hp/maxHp)*1.5 < (other.patient.hp/other.patient.maxHp)//i am more hurt (*1.5 to prevent switching target every step)
            or (other.patient.hp/other.patient.maxHp == 1 and hp < maxHp))//he/she is fully healed
            and collision_line(other.object.currentWeapon.x, other.object.currentWeapon.y, x, y, Obstacle, true, true) <= 0
            {
                other.patient = id;
                other.isHealing=0;
                exit;
            }
        }
    }
}

if patient != -1
{
    if isHealing// I'm supposed to heal
    {
        aimDirection = point_direction(object.x,object.y,patient.x,patient.y);
        LMB = 1;
    }
}

///////////////////
//MOVEMENT+COMBAT//
///////////////////

//FOLLOW PATIENT//

if isHealing and patient != -1
{
    if patient.player.class != CLASS_MEDIC or patient.hp < 40// You should heal medics if they're almost dead, but avoid infinite loops.
    {
        //get close if moved too far or too near from patient
        if abs(object.x-patient.x)>=200
        {
            if object.x > patient.x
                dir=-1;
            else if object.x < patient.x
                dir=1;
        }
        //jump with patient
        if object.y-patient.y > 32 and patient.vspeed>0
            jump=1;
    }
    else
    {
        patient = -1
    }
}


//NORMAL MOVING//

//i am not healing
if !isHealing
{
    //there are no targets
    if patient == -1
    {
        //Enemies:
        if nearestEnemy!=-1 and !object.currentWeapon.ubering
        {
            if (point_distance(object.x,object.y,nearestEnemy.x,nearestEnemy.y)<350 or object.hp<30)
            and !collision_line(object.x,object.y,nearestEnemy.x,nearestEnemy.y,Obstacle,true,true)//i can see him
            {
                //run away
                if object.x > nearestEnemy.x
                    dir = 1;
                if object.x < nearestEnemy.x
                    dir =- 1;

                //shooting
                if point_distance(object.x,object.y,nearestEnemy.x,nearestEnemy.y)<300 and
                (collision_line(object.x,object.y,predictedEnemy_x,predictedEnemy_y,Obstacle,true,true)<0
                && collision_line(object.x,object.y,predictedEnemy_x,predictedEnemy_y,TeamGate,true,true)<0
                && collision_line(object.x,object.y,predictedEnemy_x,predictedEnemy_y,ControlPointSetupGate,true,true)<0
                && collision_line(object.x,object.y,predictedEnemy_x,predictedEnemy_y,IntelGate,true,true)<0
                && collision_line(object.x,object.y,predictedEnemy_x,predictedEnemy_y,BulletWall,true,true)<0)
                && !nearestEnemy.ubered
                {
                    RMB=1;
                }
            }
        }
    }
}

// You're healing someone, or you could heal someone
if patient != -1 and isHealing
{
    if point_distance(object.x, object.y, patient.x, patient.y) < 150// Pulled 150 out of the air, correct if necessary.
    {
        //follow him
        if object.x > patient.x
            dir=-1;
        if object.x < patient.x
            dir=1;
    }
    //oh wait,an enemy is nearer,run!
    if nearestEnemy != -1 and !object.currentWeapon.ubering
    {
        if point_distance(object.x,object.y,nearestEnemy.x,nearestEnemy.y)<=point_distance(object.x,object.y,patient.x,patient.y)+50
        {
            //run away
            if object.x > nearestEnemy.x
                dir = 1;
            if object.x < nearestEnemy.x
                dir =- 1;

            //shoot!(this make medic a bit too aggressive,maybe decrease 250 to 150? idk you choose)
            // I think I see why you used the okToShoot, sorry that I removed it :/.
            // Also, gave a check of the patients current hp instead of not healing medics and spies. -Orpheon
            if point_distance(object.x,object.y,nearestEnemy.x,nearestEnemy.y)<250
            and patient.hp > 50
            and point_distance(object.x,object.y,nearestEnemy.x,nearestEnemy.y)<300
            && (collision_line(object.x,object.y,predictedEnemy_x,predictedEnemy_y,Obstacle,true,true)<0
            && collision_line(object.x,object.y,predictedEnemy_x,predictedEnemy_y,TeamGate,true,true)<0
            && collision_line(object.x,object.y,predictedEnemy_x,predictedEnemy_y,ControlPointSetupGate,true,true)<0
            && collision_line(object.x,object.y,predictedEnemy_x,predictedEnemy_y,IntelGate,true,true)<0
            && collision_line(object.x,object.y,predictedEnemy_x,predictedEnemy_y,BulletWall,true,true)<0)
            && !nearestEnemy.ubered
            {
                RMB=1;
            }
        }
    }
}


////////
//UBER//
////////

//i am healing and not ubering and my ubercharge is ready and not being ubering
if !object.currentWeapon.ubering and object.currentWeapon.uberReady and !object.ubered
{
    //i am healing someone
    if isHealing
    {
        // Replaced percentages by absolute values for this, correct if necessary. -Orpheon
        if patient.hp < 30//my patient is going to die
        or object.hp < 30//or me
        {
            LMB=1;
            RMB=1;
        }
    }
    //or not...
    else
    {
        if object.hp < 25//i am really in danger
        {
            LMB=1;
            RMB=1;
        }
    }
}

I'll go ask in the Help Thread about this class change bug.
Logged

Your mind is software. Program it.
Your body is a shell. Change it.
Death is a disease. Cure it.
Extinction is approaching. Fight it.
MTK5012
2011 Haxxy Finalist
*
Offline Offline

Posts: 738


I was Gangsterman


« Reply #541 on: October 30, 2011, 08:54:58 am »

I saw and understand your changes,they really polished the code (a lot)
But you forgot to make bots not to atk cloaked spies
Logged
Mew!
2011 Haxxy Finalist
*
Offline Offline

Posts: 543


PAL5Q 1.15.2013


« Reply #542 on: October 30, 2011, 12:14:20 pm »

ERROR in
action number 1
of Begin Step Event
for object GameServer:

In script GameServerBeginStep:
In script processClientCommands:
Error in code at line 311:
   
                answer += chr(read_ubyte(socket) ^ ord(string_char_at(player.challenge, i)));
                                                                                ^
at position 79: Unknown variable challenge


Logged

Orpheon
2011 Haxxy Award Winner
*
Offline Offline

Posts: 5818


Developer


« Reply #543 on: October 30, 2011, 01:07:53 pm »

ERROR in
action number 1
of Begin Step Event
for object GameServer:

In script GameServerBeginStep:
In script processClientCommands:
Error in code at line 311:
  
                answer += chr(read_ubyte(socket) ^ ord(string_char_at(player.challenge, i)));
                                                                                ^
at position 79: Unknown variable challenge

Thanks. Stupid result of the 2.4 merge. Fixed and will upload soon.

Also, I thought of a new bot mode that could come in handy: Fill Server. The bots fill up the server, and when someone joins a bot gets kicked. When someone leaves, a bot returns.
I already programmed and bugfixed it.

Pretty much the only thing that's keeping me from releasing right now is the stupid class change bug.

If someone (Gangsterman) wants the source, here.
« Last Edit: October 30, 2011, 01:08:12 pm by Orpheon » Logged

Your mind is software. Program it.
Your body is a shell. Change it.
Death is a disease. Cure it.
Extinction is approaching. Fight it.
Green Wolf
Jr. Member
**
Offline Offline

Posts: 85


You ain't got no pancake mix!


« Reply #544 on: October 30, 2011, 02:18:00 pm »

so i re-noded ctf_truefort, i just have to upload the new version.
Logged

this guy
he is enlightened
Yes, real nice Wareya. I just love how your arguements are fucking retarded and prove absolutely nothing. What's next, do you flick your favourite "Shut up, I am the developer, I MADE THE GAME" card? Or rather the "Oh, you are just a bad player then" card?
Orpheon
2011 Haxxy Award Winner
*
Offline Offline

Posts: 5818


Developer


« Reply #545 on: October 30, 2011, 02:42:32 pm »

Also, Yay. Medo saved the day (yet again) and discovered the origin of the bug.

Code:
    global.playerID = 0;
    global.myself = serverPlayer;
    global.myself.authorized = true;
    if(HAXXY_PUBLIC_KEY==md5(global.haxxyKey))
        global.myself.isHaxxyWinner = true;
    playerControl = instance_create(0,0,PlayerControl);
   
    // Creation of the bots
   
...
   
    if(HAXXY_PUBLIC_KEY==md5(global.haxxyKey))
        global.myself.isHaxxyWinner = true;
    instance_create(0,0,PlayerControl);
Yep, PlayerControl is created twice. Which means both register "m", one opens the menu and the other opens it. Brilliant.

Will be uploading really soon.
Logged

Your mind is software. Program it.
Your body is a shell. Change it.
Death is a disease. Cure it.
Extinction is approaching. Fight it.
Machidro
Hero Member
*****
Offline Offline

Posts: 1888


Gardicolo time is over.


« Reply #546 on: October 30, 2011, 03:12:31 pm »

ERROR in
action number 1
of Begin Step Event
for object GameServer:

In script GameServerBeginStep:
In script processClientCommands:
Error in code at line 311:
  
                answer += chr(read_ubyte(socket) ^ ord(string_char_at(player.challenge, i)));
                                                                                ^
at position 79: Unknown variable challenge

Thanks. Stupid result of the 2.4 merge. Fixed and will upload soon.

Also, I thought of a new bot mode that could come in handy: Fill Server. The bots fill up the server, and when someone joins a bot gets kicked. When someone leaves, a bot returns.
I already programmed and bugfixed it.

Pretty much the only thing that's keeping me from releasing right now is the stupid class change bug.

If someone (Gangsterman) wants the source, here.

If you do this, I recommend that you make it so that you mark that the number of bots is equal to n-1, n being the room size. You want to make it clear to people that the room has a spot for them, so they attempt to join.
Logged

A CHALLENGER HAS ARRIVED.
Orpheon
2011 Haxxy Award Winner
*
Offline Offline

Posts: 5818


Developer


« Reply #547 on: October 30, 2011, 03:21:28 pm »


Changes:

-Added a Medic AI (Thanks Gangsterman!).
-Added a "Fill Server" mode.
-Optimized the target selection code, slightly reducing lag.
-Fixed the Haxxy "challenge" bug.
-Fixed the "Unable to change class/team" bug.

Downloads:
   -The Tempest Bot v5.2.exe
   -The Tempest Bot v5.2.gmk (the source)
   -Github Repository


EDIT:
If you do this, I recommend that you make it so that you mark that the number of bots is equal to n-1, n being the room size. You want to make it clear to people that the room has a spot for them, so they attempt to join.
Fixed.
« Last Edit: October 30, 2011, 03:30:30 pm by Orpheon » Logged

Your mind is software. Program it.
Your body is a shell. Change it.
Death is a disease. Cure it.
Extinction is approaching. Fight it.
Mew!
2011 Haxxy Finalist
*
Offline Offline

Posts: 543


PAL5Q 1.15.2013


« Reply #548 on: October 30, 2011, 05:43:25 pm »

At the end of a round when the victory banner is supposed to show up, the client freezes/crashes instead.
Logged

Orpheon
2011 Haxxy Award Winner
*
Offline Offline

Posts: 5818


Developer


« Reply #549 on: October 31, 2011, 02:03:57 am »

At the end of a round when the victory banner is supposed to show up, the client freezes/crashes instead.
What bot mode? What map?
« Last Edit: October 31, 2011, 02:04:27 am by Orpheon » Logged

Your mind is software. Program it.
Your body is a shell. Change it.
Death is a disease. Cure it.
Extinction is approaching. Fight it.
MTK5012
2011 Haxxy Finalist
*
Offline Offline

Posts: 738


I was Gangsterman


« Reply #550 on: October 31, 2011, 02:52:51 am »

after some play-testing,i have some few things about the medic AI:




that's all i guess
Logged
Floyd Pinkerton
Hero Member
*****
Offline Offline

Posts: 779


Is there anybody out there?


« Reply #551 on: October 31, 2011, 04:36:04 am »

hey can you make it so that each team gets a specific no. of bots?

(ex: red-2 blu-10)
Logged


Waiting to cut out the deadwood.
MTK5012
2011 Haxxy Finalist
*
Offline Offline

Posts: 738


I was Gangsterman


« Reply #552 on: October 31, 2011, 05:19:34 am »

sorry but no
but i might code the "bot formation loader"
like 3 heavy vs 5 medic or sth like that
Logged
Orpheon
2011 Haxxy Award Winner
*
Offline Offline

Posts: 5818


Developer


« Reply #553 on: October 31, 2011, 07:08:42 am »

sorry but no
but i might code the "bot formation loader"
like 3 heavy vs 5 medic or sth like that
Oh my god, like a Drag'n'Drop GUI where you can select each team which class and everything. That would be awesome.

Might try it.

after some play-testing,i have some few things about the medic AI:




that's all i guess
Thanks, I'll go look into this.
« Last Edit: October 31, 2011, 07:09:06 am by Orpheon » Logged

Your mind is software. Program it.
Your body is a shell. Change it.
Death is a disease. Cure it.
Extinction is approaching. Fight it.
MTK5012
2011 Haxxy Finalist
*
Offline Offline

Posts: 738


I was Gangsterman


« Reply #554 on: October 31, 2011, 07:25:35 am »

first fix the bot option menu please
Logged
Pages: « 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 »
  Print  
 
Jump to:  

Powered by MySQL Powered by PHP Powered by SMF 1.1.18 | SMF © 2013, Simple Machines Valid XHTML 1.0! Valid CSS!
Page created in 0.45 seconds with 19 queries.