Re: Programming question

From: Andrew Wilson <atwilson_at_home.com>
Date: Wed Oct 27 1999 - 18:29:19 EDT

>On a unit I used to be on at my Real Job they just did this:
>Take the smaller of xlength or ylength, multiply it time 3, divide
>by 2, and add the result to the larger of xlength or ylength. The
>result is a close approximation of the square root of the sum of
>the squares.

The other thing that just clicked for me is that you probably don't really
care *how* the gravity varies with distance, just that the gravity gets
stronger as you get closer, so you might try just playing with a straight
linear value (X gravity = X distance/constant_scale_factor).

For Space Wars gameplay, the important thing is that the shots bend around the
sun and that you can get yourself into an orbit, so I'll bet any of these
strategies would work. Roger's formula has the advantage of being done with a
couple of shifts, adds, and a compare, so I'd try it first...

                        Drew
Received on Wed Oct 27 17:29:20 1999

This archive was generated by hypermail 2.1.8 : Fri Aug 01 2003 - 00:32:47 EDT