Toribash
Original Post
suomynona has a new random function.
Blam wanted to see it, so here it is.

All it does is turn a player's entire joint setup into a single integer.

Q calculates and shows you the integer.
E turns the last calculated integer into your current joint set.
Attached Files
b4b10.lua (656 Bytes, 59 views)
Squad Squad Squad lead?
The standardization of Toribash Squad roles may have gone too far!
So pressing Q records all the current joint settings, then pressing E sets your joints in that config? Awsome. Now anyone can do opener on button press...
That's not what's special.

It's how it stores the joint info.
Squad Squad Squad lead?
The standardization of Toribash Squad roles may have gone too far!
If it was secret, why the hell did I release it.

Sorry, please use more common sense. :P
Squad Squad Squad lead?
The standardization of Toribash Squad roles may have gone too far!
Just play Wushu. Problem solved.
i have a totally post modern tattoo of a scalene triangle.
<DeadorK> fair maiden
<DeadorK> if the cum is going to be in your mouth
<DeadorK> it shall be in mine as well
Cool idea, although it doesn't really change anything as far as the user is concerned. The time saved passing one base10 number instead of nineteen base4 numbers might be small in comparison to the time required to hash those nineteen base numbers.

Still, I wonder how much information you could store in a hash like that. It seems like the lua interpreter in toribash is compiled with standard floating point doubles for numbers, which means it can accurately represent ints up to 10^15. With 19 base 4 values the biggest your hash can get is in the 10^11 range, which is getting up there.

Also, you could just make the thing hash 20 values instead of 19; the last base4 variable can store the grip state for the hands: either (off, off), (off, on), (on, off) or (on, on), corresponding to 0,1,2, or 3.
double precision r platform dependent, yo. But why commit to such an enormous block when you can use chars, which are like a byte? You only need 5 and a quarter.

Also, it's 20 base 4 numbers for joints, plus 1 for grips. Adjust calcs accordingly.
Last edited by Dafe; Mar 13, 2008 at 12:01 AM. Reason: I need to sleep more before doing math.
Radioactive torso's description should be, "You have cancer like wow."
Base 4 is 2 bits each, 20 * 2 = 40, 40 bits.

vs. a string of chars which is 20 * 8 = 160. Time is negligible, seeing as it's not really meant for necessarily storing things on the fly (in which case, just use a table with the joint set ups or something, it's not that hard to do), but it's more proof that there are more effective ways to do things. Not to mention, the number isn't really getting too big too easily, so I doubt it matters too much whether double is going to be the same or not.
Squad Squad Squad lead?
The standardization of Toribash Squad roles may have gone too far!