-
Notifications
You must be signed in to change notification settings - Fork 60
New extension: Pseudo random #1645
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
base: main
Are you sure you want to change the base?
Conversation
Thank you for submitting an extension. Extensions are meant to be editable by anyone. This means that:
|
!update PseudoRandomExtension.zip |
✅ Successfully updated the extension. |
Hi Davy @D8H, I replaced the minified library code with the non-minified one and added the repository link to the extension description, thanks. |
|
The Math.random() function is overridden only in the visibility zone after calling seedrandom(), that is, in the event where it is called and in subevents, in the rest of the game Math.random() works as before (randomly), usually I use it only once when starting a scene to build a level and the rest of the game works as before. |
I didn't quite understand the question, but neither the sound reproduction nor the creation of particle emitters affected the game's reproductive ability. |
!update PseudoRandomExtension.zip |
❗ No updates found. Please check your file. |
!update PseudoRandomExtension.zip |
❗ No updates found. Please check your file. |
!update PseudoRandomExtension.zip |
✅ Successfully updated the extension. |
I moved the repository link from the description to the js comment |
Hi Davy @D8H, I updated the example by adding random value generation next to pseudo random values, this can also be combined into one event if necessary, but then it will be unclear when which sound plays |
Yes, it can break certain processes in your game if you call "set seed" for the whole scene or the whole game, but you can easily control it by calling it only in one event (for example when starting a scene), that's why I set the extension category to "advanced", maybe a warning should be added, what do you think? |
What do you do to enable it only for 1 event and its sub-events? |
Just call the set seed function, in the event where it is called there will be a pseudo random, in all other events there will be a regular random |
How does the extension make it works? |
!update PseudoRandom.zip |
Can't update the extension, as it doesn't pass automatic tests:
|
I was wrong, it overrides the Math.random() function globally, not just in the event and sub-event, it seemed to me that this is because gdevelop itself returns the Math.random() function to its original form after some time (about a second). |
I would be more at ease with functions like |
Then it won't be so clean, for each generation of one number you will need to have a unique seed, that is, each time after calling the generation you will have to add 1 to the seed, in my opinion this is extra work, if you use it as I showed in the last message, then there should be no side effects, since Math.random returns to its original form in the same frame |
Description
Set seed to generate pseudo-random numbers in sub-events.
This extension will be useful for:
How to use the extension
How to use:
Example:
Checklist
What tier of review do you aim for your extension?
Community (Unreviewed)
Example file
PseudoRandomExample.zip
Extension file
PseudoRandomExtension.zip
Extension by @Jurfix
You can update the extension on this "Pull Request" by commenting the update command: in the comment field, type
!update
, then drag and drop a zip file with your extension file in the commenting field, like how you initially submitted the extension. It should look like this:It can take a few seconds for the file to fully upload and show as the above. Once it is like shown above, click "Comment" and let the bot do the rest!