TIP: Click on subject to list as thread! ANSI
echo: c_plusplus
to: HERMAN SCHONFELD
from: CAMERON CLARK
date: 1997-05-13 21:55:00
subject: Re: Doom like games...

CC>    It takes a while to implement it right. This needs to be lightning
CC>    fast if you have to use this for every corner of every polygon (4 to
HS> CC>1
CC>    ratio).
HS> 
HS> a multiply, divide and two adds aren't bad for a projection. Thats about 
as
HS> fast as I could possibly get it? Do you know any other ways?
    Each is case specific. Example A * 4 is the same as a shl 2. Any operand
    that's a power of 2^n can be multiplied by shifts:
         6 dec
         0110 bin
         shl 2
         11000
         18 hex  24 decimal
         6 * 4 = 24;  6 shl 2 = 24    (4 = 2^(2) where (2) is used as the
                                       shl value)
    The same is true for division by an operand that's a power of 2^n.
    
    Floating point numbers are stored in a myriad of ways and you'll have
    to do what "id" did and write your own floating point operations or
    use a processor with floating point instructions (586)
HS> replaced with a very fast bit shitf. (<<8)
HS> 
HS> But just remember, a good perspective can be 256, so a multiply can be
    I guess I should have read ahead a bit.
CC>    It takes a while to implement it right. Once again, it needs to be
CC>    used once for every visible polygon. Which do you choose, speed or
CC>    acuratcy? The function should be highly malualbe to allow for speed
CC>    over acuratcy.
HS> 
HS> Speed and accuracy can both be acheived. I will be happy to post some 
code 
HS> mine for you if you want.
    Sure. I never got past scalling in my graphics studies in virtual 
creens.
    You may also want to use an inline function or macro to do this - you
    don't have a jump every time you need to do a calculation, but you will
    have the size of you executable increase for X bytes every time that
    macro or inline is pasted instead of jumped to.
HS> So is there an engine for this from Fuzzy Logic? I would like to see it. 
(p
HS> it or ftp address etc)
    No such thing that I know of; however, you may do a web search and find
    a good discussion. Here's a quick overview of fuzzy logic:
    Things are not black and white/true or false. You can define cases that
    are a bit of both. EG:
         always true
         almost always true
         mostly true
         half true/half false
         mostly false
         almost always false
         always false
    You have to define a bit of probability to match a percent to accomplish
    this. "almost always true" = 90%/10%  (true/false)
    You may define this to be a random number between 0-9  0-8 is true 9 is 
    false.
    Lay this over onto a character. A character is "smart" and sees the
    player leave a room.
         character seeks and finds player - almost always true
    A character is "stupid" and sees the player leave a room.
    
         character seeks and finds player - almost always false
    This requires a _quick_ random number generator - you may even use
    the system clock to formulate a quick number.
--- GEcho 1.00
---------------
* Origin: Digital OnLine Magazine! - (409)838-8237 (1:3811/350)

SOURCE: echomail via exec-pc

Email questions or comments to sysop@ipingthereforeiam.com
All parts of this website painstakingly hand-crafted in the U.S.A.!
IPTIA BBS/MUD/Terminal/Game Server List, © 2025 IPTIA Consulting™.