Thread Rating:
  • 0 Vote(s) - 0 Average
  • 1
  • 2
  • 3
  • 4
  • 5
Project idea: new AI for original LF2
#6
Hi... Seems like the idea is not starting yet.

I think I want to start with something for this. I know I'm not a really good in programming. My first C program is this AI. I learn a lot from this.

What I want to share for now is about chase attacks evading. Someone might had done this even better, but I have done mine. I see it works pretty good. At least not bad to evade two Dennis' chase ball or two John's biscuit.

Basic AIs lacks in evading balls.

    AI-Code:
int ego()
{
	//Get Detailed Balls
	for (int i = 0; i < 400; ++i){
		if (loadTarget(i) > 0)
		{
			if (target.x_velocity!=0 && (abs(self.z - target.z) < 70) && target.team != self.team)
			{
				int zw;
				zw = (bg_zwidth1 + bg_zwidth2)/2;
				//print("zw = " + zw + "\n");
				//print("selfz = " + self.z +"\n");
				//print("objectz = " + target.z + "\n");
				if ((self.x<target.x && target.x_velocity<0)||(self.x>target.x &&target.x_velocity>0))
				{
					if(self.z==target.z||self.z+2 >target.z||self.z-2<target.z)
					{
					//print("I gotta dodge \n");
						if(self.z>zw)
						{
							up(1,1);
						}
						if(self.z<zw)
						{
							down(1,1);
						}
						if((self.z>zw-10||self.z<zw+10)&&abs(target.x-self.x)<300&&self.state!=12)
						{
							int direction;
							direction = rand(1);
							if (direction == 0)
							{
								up(1,1);
								J(1,0);
								up(0,0);
							}
							if (direction == 1)
							{
								down(1,1);
								J(1,0);
								down(0,0);
							}
						}
					}
				}
			}
		}
	}
	return 0;
}


This code might help to create the AIs with evading abilities.

Let's see of there will be another scripts, and than we can merge them into one, as new basic scripts for the characters..

I hope someone may improve this.

(I will try to make Davis's AI and see maybe someone will be interested to test it)
Reply
Thanks given by: Memento


Messages In This Thread
RE: Project idea: new AI for original LF2 - by seikosantana - 02-18-2018, 03:59 PM



Users browsing this thread: 1 Guest(s)