New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Randomized Enemy Sizes #3321
Randomized Enemy Sizes #3321
Conversation
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This is awesome and was a ton of fun to see in the chaos race!
float randomNumber; | ||
float randomScale; | ||
|
||
uint8_t bigActor = rand() % 2; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I've seen pushback on PRs calling rand()
a few times but for something like this I think rand()
works perfectly. There are other "on the fly" random things that use rand()
throughout the codebase - random fuse timer for bombs for example
Shipwright/soh/src/overlays/actors/ovl_En_Bom/z_en_bom.c
Lines 105 to 107 in 02f61bc
// Set random fuse timer with a minimum of 10. Do the sound and scale immediately, | |
// otherwise the bomb is invisible until the timer hits the "normal" amount. | |
uint32_t randomTimer = (rand() % 150) + 10; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
My next project is to get rid of ALL rand() calls, so those existing ones are living on borrowed time :) What I'd prefer you to do here is use the Random function from 3drando if for no other reason than this is a C++ file, so we should be using C++ functionality, although no matter what you do here, it will be changed by me soon anyway. The 3drando header is already included in this file, so it should be a trivial substitution.
float randomNumber; | ||
float randomScale; | ||
|
||
uint8_t bigActor = rand() % 2; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
My next project is to get rid of ALL rand() calls, so those existing ones are living on borrowed time :) What I'd prefer you to do here is use the Random function from 3drando if for no other reason than this is a C++ file, so we should be using C++ functionality, although no matter what you do here, it will be changed by me soon anyway. The 3drando header is already included in this file, so it should be a trivial substitution.
Originally made for the Chaos Race build.
Build Artifacts