forums

TNT Basic Forums > Beyond Basic
question for matteo
< Last Thread     Next Thread >
Author
Thread        Post A Reply

08-08-2004 12:42

Posted by:
Fischgurkensenf

Location:
Bern, Switzerland

Click Here to Email Fischgurkensenf   Find more posts by Fischgurkensenf

Is this a joke?: (I can't stop thinking of it)

''''''''''''''''''
yeah, you guessed it, only TNT has this problem of slow square roots, due to bad programming by Tully...
it can be made faster if you write

#do{FastSquareRoots}

at the first line of your code

and, yes, the distance formula can be used only for constant points, that is, you can' t move them; or, at least, they have to be still in the last 7 frames, otherwise there are problems because of general relativity.
''''''''''''''''''''
'''''''''''''''''
Please keep this a serious topic

No kiddin, I was serious.

1) The #do{FastSquareRoots} is available only if you have the "RadRebPrefs" extension file (Acronym for "RADicals REsolving Boosted PREFerable Speed") installed in your system. You can get it at
http://www.danlabgames.com/radicalrebound/RadicalRebound.sit
'''''''''''''''
'''''''''''''''
hehe...

How much would you pay for my "RADicals REsolving Boosted PREFerable Speed" (RadReBPrefS) library? with it you can :

#do{FastSquareRoots}
#do{FastAndFuriousHardwareMode}

and finally, the new added jem

#do{Make-O-So-Cool-Game}

it' s yours for only 25$!!!
'''''''''''''''
'''''''''''''''
the secret...

I got a modified version of TNT that Mark Tully made for me only... HAHA...

Dunno... the trick is to use nice grahics, small sprites and 640*480 res... also not doing stupid things with the code...
Also, I noticed that while playing the right music the game actually gets 1 or 2 frames faster!!! That' s true, no kiddin! Mysteries behind TNT...
Anyway get ready for RadicalRebound v3, it' s gettin UNBELIEVABLE...
''''''''''''''''''

08-08-2004 16:59

Posted by:
DanLurie

Location:
Earth>USA>New Jersey>Clifton>My Chair

Click Here to Email DanLurie   Find more posts by DanLurie

FWIW, you could code your own square root function...doubt it would be much better speed wise.

08-08-2004 18:06

Posted by:
eekaydee

Location:
CA, USA

Click Here to Email eekaydee   Find more posts by eekaydee

:) He was joking.

08-08-2004 19:52

Posted by:
DanLurie

Location:
Earth>USA>New Jersey>Clifton>My Chair

Click Here to Email DanLurie   Find more posts by DanLurie

I know he was/is. Still, rolling your own sqrt is not too hard.

08-08-2004 21:20

Posted by:
eekaydee

Location:
CA, USA

Click Here to Email eekaydee   Find more posts by eekaydee

I was just trying to clear that up for Fischgurkensenf.
But now that you mention it, how can you make your own square root function in tnt without using tnt's sqrt function? The only one I can think of is precalculating it and storing it for later reading.

08-08-2004 23:13

Posted by:
matteo

Location:
Venice, ITALY!

Click Here to Email matteo   Find more posts by matteo

Aaah... the good old days when people had a humor and liked to laugh... I remember that was a pretty funny thread ;-)

By the way, it actually is not too hard to make an algorithm that finds the square root of a number with a certain precision, but I guess if you can make one that goes faster than the one built with TNT you deserve the nobel prize...

The first method I can think for calculating the square root("Y") of a number "X" is this: (X is the known number, Y is the root you must find)

you guess "Y": say it's 10: so you square 10^2=100 : if the number "X" is greater than 100 you guess a higher Y, otherwise lower: once you have captured Y between an upper bound and a lower bound you can keep doing this kind of check to refine. There must be much smarter algorithms to do this, but usually once I find some way to do a thing I'm happy enough...

08-12-2004 02:23

Posted by:
Wil Hostman

Find more posts by Wil Hostman

Roling your own square roots

Some simple code, which allows setting your own limit on number of digits

procedure SqrRt(float value, int decPl)
float amt =1
' amt is ammount of increment
float res = 0
'res is output
int lpctl
' loop control vale
if value >100
amt = 10
decPl = decPl +1
end if
if value >10000
amt = 100
decPl = decPl +1
end if
if value >1000000
amt = 1000
decPl = decPl +1
end if
if value >100000000
amt = 10000
decPl = decPl +1
end if
' each of these increases amt and decPl, since DecPl is assumed to
' be places past the integer, and increasing amt increases loops needed to reach the integer root.
for lpctl = 1 to decPl
' loop for number of decimal places
while res*res < value
'loop increments res until res^2 larger than value
res = res+ amt
wend
' since we went over, decrement back under, and increment by
' next decimal place
res = res - amt
amt = amt / 10
next lpctl
return res
end proc


this is brute force code, but it allows as much recursion as needed for the desired return value

All times are GMT        Post A Reply

Forum Jump:
< Last Thread     Next Thread >

< Contact Us - TNT Basic >

Powered by: vBulletin Lite Version 1.0.1 Lite
Copyright © Jelsoft Enterprises Limited 2000.