- Fix damage calculation in TestSniperRifle, aim a bit lower to compensate initial angle shift in sniper rifle. As a result, AI seems to never fail sniper rifle shots.
authorunc0rr
Sat, 09 Jun 2012 17:05:16 +0400
changeset 7204 522f165cd2e7
parent 7202 2d78dc517c91
child 7206 ce46b56ae9f5
- Fix damage calculation in TestSniperRifle, aim a bit lower to compensate initial angle shift in sniper rifle. As a result, AI seems to never fail sniper rifle shots. - Temporarily make AI tell its expectations in chat
hedgewars/GSHandlers.inc
hedgewars/uAI.pas
hedgewars/uAIAmmoTests.pas
--- a/hedgewars/GSHandlers.inc	Sat Jun 09 12:15:05 2012 +0200
+++ b/hedgewars/GSHandlers.inc	Sat Jun 09 17:05:16 2012 +0400
@@ -1025,7 +1025,9 @@
         else
             AmmoShove(Gear, Gear^.Timer, 20);
         CheckGearDrowning(Gear);
-        dec(i) until (i = 0) or (Gear^.Damage > Gear^.Health) or ((Gear^.State and gstDrowning) <> 0);
+        dec(i) 
+    until (i = 0) or (Gear^.Damage > Gear^.Health) or ((Gear^.State and gstDrowning) <> 0);
+
     if Gear^.Damage > 0 then
         begin
         DrawTunnel(oX, oY, Gear^.dX, Gear^.dY, 82 - i, 1);
--- a/hedgewars/uAI.pas	Sat Jun 09 12:15:05 2012 +0200
+++ b/hedgewars/uAI.pas	Sat Jun 09 17:05:16 2012 +0400
@@ -178,6 +178,10 @@
                         begin
                         AddAction(BestActions, aia_attack, aim_push, 350 + random(200), 0, 0);
                         AddAction(BestActions, aia_attack, aim_release, 1, 0, 0);
+                                                
+                        AddAction(BestActions, aia_Down, aim_push, 100 + random(150), 0, 0);
+                        AddAction(BestActions, aia_Down, aim_release, 32, 0, 0);
+                        
                         AddAction(BestActions, aia_waitAngle, ap.Angle, 250, 0, 0);
                         AddAction(BestActions, aia_attack, aim_push, 1, 0, 0);
                         AddAction(BestActions, aia_attack, aim_release, 1, 0, 0);
@@ -431,6 +435,8 @@
 AddFileLog('Thread started');
 end;
 
+var scoreShown: boolean = false;
+
 procedure ProcessBot;
 const cStopThinkTime = 40;
 begin
@@ -447,13 +453,23 @@
                     StopMessages(Gear^.Message);
                     TryDo((Gear^.Message and gmAllStoppable) = 0, 'Engine bug: AI may break demos playing', true);
                     end;
+                    
                 if Gear^.Message <> 0 then
                     exit;
+                    
+                scoreShown:= false;   
                 StartThink(Gear);
                 StartTicks:= GameTicks
                 
-                end else
-                    ProcessAction(BestActions, Gear)
+            end else
+                begin
+                if not scoreShown then
+                    begin
+                    if BestActions.Score > 0 then ParseCommand('/say Expected score = ' + inttostr(BestActions.Score div 1024), true);
+                    scoreShown:= true
+                    end;
+                ProcessAction(BestActions, Gear)
+                end
         else if ((GameTicks - StartTicks) > cMaxAIThinkTime)
             or (TurnTimeLeft <= cStopThinkTime) then
                 StopThinking:= true
--- a/hedgewars/uAIAmmoTests.pas	Sat Jun 09 12:15:05 2012 +0200
+++ b/hedgewars/uAIAmmoTests.pas	Sat Jun 09 17:05:16 2012 +0400
@@ -652,7 +652,7 @@
 
 dmg:= sqrt(sqr(Targ.X - x)+sqr(Targ.Y-y));
 t:= 1.5 / dmg;
-dmg:= dmg * 0.33333333;
+dmg:= dmg * 0.025; // div 40
 Vx:= (Targ.X - x) * t;
 Vy:= (Targ.Y - y) * t;
 ap.Angle:= DxDy2AttackAnglef(Vx, -Vy);