Pages: [1] 2
|
|
|
Author
|
Topic: Pkunk rebirth algorythm (Read 5093 times)
|
Tiberian
*Smell* controller
Offline
Gender:
Posts: 335
|
Are there some factors that affect in the Pkunk Fury rebirthing? Sometimes it feels as if they never reincarnate and sometimes they seem to do it all the time.
I remember my record was something like 6 rebirths in a row a long time ago when playing the original version. Has this issue been tampered with in Ur-Guan Masters?
|
|
|
Logged
|
|
|
|
|
Tiberian
*Smell* controller
Offline
Gender:
Posts: 335
|
I read those, but I don't believe that it is 50-50 as they say it is. It seems like it is different in different situations. Maybe someone with actual knowledge of it could explain. Someone who knows the code. (no guesses here)
|
|
|
Logged
|
|
|
|
Nic.
Guest
|
Believe whatever you like, but the code says otherwise. The code in question lives in a function called pkunk_preprocess(), and the test is something like this (edited for clarity):
if (TFB_Random () & 1) For those who don't speak C, it looks to see if the number returned from the random number generator is even or odd. If it's odd, the Pkunk is reborn. Your chances of getting an even vs. odd number out of the random number generator are 50/50.
|
|
|
Logged
|
|
|
|
Lukipela
Enlightened
Offline
Gender:
Posts: 3620
The Ancient One
|
Taken from one of the topics you were supposed to read:
The code that controls the Pkunk "phoenix effect" is in a function called pkunk_preprocess(). It is a simple "50/50" test against a random number. No more, no less. If you want to believe that other factors control it, go right ahead, but the code says what it says. What is truly interesting part about Pkunk respawning is that whether or not the ship will respawn is determined BEFORE the fight even starts! This really makes me laugh when I think of all the times I'd try to "influence" respawning by holding down keys as the ship exploded. Silly hunam, the decision was made long before then!
No guesses, just simple code. Now, if you don't want to take Nics word for it, then you may as well go through the code yourself and have a look. Trust me, Nic does know what he is talking about
EDIT: Oopps, Nic beat me to it. And I wasted my 1K post... Oh well, I betetr scurry over to OT and make a speech....
|
|
« Last Edit: November 30, 2003, 10:34:28 pm by Lukipela »
|
Logged
|
What's up doc?
|
|
|
Rib Rdb
Frungy champion
Offline
Gender:
Posts: 85
|
Believe whatever you like, but the code says otherwise. The code in question lives in a function called pkunk_preprocess(), and the test is something like this (edited for clarity): if (TFB_Random () & 1) I've been reading about PRNG's for the GBA port I'm working on, and most of the stuff I've read says that the lower bits of most linear congruential prng's are not really very random. This could explain why people have complained about long periods with no rebirths then many rebirths in a row. Some of the things I've read recomend the rng returning
seed ^ seed >> (sizeof(seed)/2)
Instead of changing the RNG maybe it would be better to say
if (TFB_Random () & 0x100000) or something like that. Then again, I haven't done any tests. Maybe TFB's PRNG has a perfectly random LSb, and we're all just imagining that the rebirthing isn't 50/50.
Edit: I'm not sure, but it looks like there's some sort of test for ship mass in intercept_pkunk_death() that may influence the rebirthing process.
|
|
« Last Edit: December 03, 2003, 02:51:53 am by Rib_Rdb »
|
Logged
|
|
|
|
Culture20
Enlightened
Offline
Posts: 917
Thraddash Flower Child
|
Sorry if this thread is getting too technical, but why wouldn't the lowest bit (one/zero;odd/even) be somewhat evenly distributed in a psuedo-random number generator?
|
|
|
Logged
|
|
|
|
|
Rib Rdb
Frungy champion
Offline
Gender:
Posts: 85
|
TFB_Random does use it's own algorithm, but it looks like it's still a linear congruential, and my understanding is that most prng's of this type have problems with the lower bits.
|
|
|
Logged
|
|
|
|
|
Culture20
Enlightened
Offline
Posts: 917
Thraddash Flower Child
|
Bah! Statistics be damned! It all depends on how hard I press the key combination: ctrl-alt-5-b. Then 3/24 pkunks regenerate 4 times.
|
|
|
Logged
|
|
|
|
|
Nic.
Guest
|
Something that might be fun if/when code add-ons get going:
I think it would be sublimely cruel to the player if the Pkunk special toggled the death function pointer between "death" and "rebirth" every time it was invoked. Imagine the grand fun people could have making sure that they only taunted the opposing player in amounts divisble by two!
|
|
|
Logged
|
|
|
|
|
Rib Rdb
Frungy champion
Offline
Gender:
Posts: 85
|
i did some tests and the randomness does seem fine. Does anyone know the code well enough to see if that mass stuff in intercept_pkunk_death affects regeneration. It looks to me that if the mass points are to high the pkunk won't regenerate. but I don't know how the mass points gets set.
|
|
|
Logged
|
|
|
|
Pages: [1] 2
|
|
|
|
|