changeset 20:6efd0830715b

ai work
author zzzzrrr <mason.green@gmail.com>
date Wed, 25 Mar 2009 15:25:25 -0400
parents 08ddf9e71b88
children cad384ad349e
files ai/ai.d ai/steer.d openmelee.geany
diffstat 3 files changed, 23 insertions(+), 19 deletions(-) [+]
line wrap: on
line diff
--- a/ai/ai.d	Wed Mar 25 14:44:47 2009 -0400
+++ b/ai/ai.d	Wed Mar 25 15:25:25 2009 -0400
@@ -58,7 +58,7 @@
 	    
         // Elementary steering AI 
 	    steer.update();
-        st = steer.steerToAvoidObstacles(5, m_world.bodyList);
+        //st = steer.steerToAvoidObstacles(0.25, m_world.bodyList);
         
         if(st == bzVec2.zeroVect) {
             st = steer.steerForPursuit(enemy.state, maxPredictionTime);
@@ -66,6 +66,9 @@
         } else {
             avoid();
         }
+        
+        st = bzVec2.zeroVect;
+        
     }
     
     void chase(Ship enemy) {
@@ -114,7 +117,7 @@
        
         ship.state.turn = true;
         
-        if(abs(angle) > PI/4) {
+        if(abs(angle) < PI/4) {
 			ship.thrust();
 		}
     }
--- a/ai/steer.d	Wed Mar 25 14:44:47 2009 -0400
+++ b/ai/steer.d	Wed Mar 25 15:25:25 2009 -0400
@@ -159,7 +159,7 @@
             if(o is m_body) continue;
             
             // This code which presumes the obstacle is spherical
-            findNextIntersectionWithSphere(o, next);
+            findNextIntersectionWithSphere(o, next, minDistanceToCollision);
 
             if (!nearest.intersect || (next.intersect && next.distance < nearest.distance)) {
 					nearest = next;
@@ -184,7 +184,7 @@
     }
 
 		void findNextIntersectionWithSphere(bzBody obs, 
-                                            inout PathIntersection intersection) {
+                                            inout PathIntersection intersection, float mdc) {
                                                 
 			// This routine is based on the Paul Bourke's derivation in:
 			//   Intersection of a Line and a Sphere (or circle)
@@ -211,7 +211,7 @@
                 }
             }
         
-			c = square(lc.x) + square(lc.y) - square(obsRadius + m_radius);
+			c = square(lc.x) + square(lc.y) - square(obsRadius + m_radius+mdc);
 			d = (b * b) - (4 * c);
             
 			// when the path does not intersect the sphere
--- a/openmelee.geany	Wed Mar 25 14:44:47 2009 -0400
+++ b/openmelee.geany	Wed Mar 25 15:25:25 2009 -0400
@@ -14,17 +14,18 @@
 run_cmd=
 
 [files]
-current_page=1
-FILE_NAME_0=3173;D;0;16;0;1;1;C:\\workspace\\openmelee\\main.d;0
-FILE_NAME_1=7284;D;0;16;0;1;1;C:\\workspace\\openmelee\\melee.d;0
-FILE_NAME_2=2250;D;0;16;0;1;1;C:\\workspace\\openmelee\\orz.d;0
-FILE_NAME_3=9310;D;0;16;0;1;1;C:\\workspace\\openmelee\\render.d;0
-FILE_NAME_4=4052;D;0;16;0;1;1;C:\\workspace\\openmelee\\ship.d;0
-FILE_NAME_5=6206;D;0;16;0;1;1;C:\\workspace\\openmelee\\steer.d;0
-FILE_NAME_6=2252;D;0;16;0;1;1;C:\\workspace\\openmelee\\urQuan.d;0
-FILE_NAME_7=0;None;0;16;0;1;1;C:\\workspace\\openmelee\\build-dmd-win.bat;0
-FILE_NAME_8=304;Conf;0;16;0;1;0;C:\\workspace\\openmelee\\gui.cfg;0
-FILE_NAME_9=1648;D;0;16;0;1;0;C:\\workspace\\openmelee\\planet.d;0
-FILE_NAME_10=2757;D;0;16;0;1;1;C:\\workspace\\openmelee\\ai.d;0
-FILE_NAME_11=814;D;0;16;0;1;1;C:\\workspace\\openmelee\\example.d;0
-FILE_NAME_12=19;None;0;16;0;1;1;C:\\workspace\\openmelee\\testScript.md;0
+current_page=5
+FILE_NAME_0=0;D;0;16;0;1;1;C:\\workspace\\openmelee\\openmelee.d;0
+FILE_NAME_1=1787;D;0;16;0;1;1;C:\\workspace\\openmelee\\game.d;0
+FILE_NAME_2=3831;D;0;16;0;1;1;C:\\workspace\\openmelee\\melee\\melee.d;0
+FILE_NAME_3=2415;D;0;16;0;1;1;C:\\workspace\\openmelee\\ai\\ai.d;0
+FILE_NAME_4=0;D;0;16;0;1;1;C:\\workspace\\openmelee\\ai\\human.d;0
+FILE_NAME_5=7818;D;0;16;0;1;1;C:\\workspace\\openmelee\\ai\\steer.d;0
+FILE_NAME_6=2371;D;0;16;0;1;1;C:\\workspace\\openmelee\\ai\\utilities.d;0
+FILE_NAME_7=12531;D;0;16;0;1;1;C:\\workspace\\openmelee\\render\\render.d;0
+FILE_NAME_8=0;D;0;16;0;1;1;C:\\workspace\\openmelee\\ships\\models.d;0
+FILE_NAME_9=1907;D;0;16;0;1;1;C:\\workspace\\openmelee\\ships\\orz.d;0
+FILE_NAME_10=1673;D;0;16;0;1;1;C:\\workspace\\openmelee\\ships\\planet.d;0
+FILE_NAME_11=2220;D;0;16;0;1;1;C:\\workspace\\openmelee\\ships\\ship.d;0
+FILE_NAME_12=1679;D;0;16;0;1;1;C:\\workspace\\openmelee\\ships\\urQuan.d;0
+FILE_NAME_13=16183;D;0;16;0;1;1;C:\\workspace\\blaze\\blaze\\bzWorld.d;0