[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Field difficulty (was Re: checking in)



The following was a note I wrote to Galen about my patch...

>One word of warning... I'm not sure I did the dist_tolerance code correctly. It's possible that setting the light side's difficulty to 'easy' will affect the dark side, or do something weird if dark is a human. I'll have another look at it when I get the chance.

I've looked at computer.c again and here's my synopsis:

The problem is a little worse than I thought. The macros that look up the computer's skill levels expect the static variable computer_side to be set, but it isn't set when they're called in computer_field_compute_stats. The result is that the actual values used for distance tolerance are unpredictable.

The more I look at this code, the less I like it. I can't think of a nice clean way to implement the distance tolerance code without a lot of rewriting. Here's a quick fix (a patch to my last patch) that goes back to using CELL_XSIZE, ignoring DIST_TOLERANCE:

--- xarchon-workbak20001010/src/computer.c	Tue Oct 10 15:18:52 2000
+++ xarchon-working/src/computer.c	Tue Oct 10 15:22:42 2000
@@ -662,10 +662,10 @@
     safe_distance = enemy->weapon->actor->speed *
       (1 + 2*CELL_XSIZE / (3*fa->actor->speed)) + CELL_XSIZE;
     max_unsafe_distance = safe_distance;
-    min_unsafe_distance = safe_distance - DIST_TOLERANCE;
+    min_unsafe_distance = safe_distance - CELL_XSIZE;
   }
 
-  max_safe_distance = safe_distance + DIST_TOLERANCE;
+  max_safe_distance = safe_distance + CELL_XSIZE;
 
   /* store the squares of the distances */
   stats->min_safe_dist_2 = safe_distance*safe_distance;
-- 
Mike Ciul
GVOX Interactive Music
1080 N. Delaware Ave. 8th Floor
Philadelphia, PA 19125
Voice: (215) 922-0880 Ext.: 144
Fax: (215) 922-7230

This message comes to you from GVOX...creating new ways to bring music to life. 
http://www.gvox.com
http://www.notationstation.net