Staredit Network > Forums > SC1 UMS Mapmaking Assistance > Topic: how to make a randomized system?
how to make a randomized system?
Jan 13 2009, 8:54 am
By: djinni  

Jan 13 2009, 8:54 am djinni Post #1



Basically i want to have a minigame, so there is 10 (or x) amount of results.

I can think of a way, but with 10 choices, it creates uneven chances for all, where i want an even chance for each 1 to happen
how would i accomplish this?
edit: atm the way i did it, was just create 10 switches, when each switch is triggered it adds a death,
then when you initiate the game, it randomizes all triggers, then calculates how many deaths you have, and gives your result, and sets the deaths to zero.

So basically im flipping 10 coins, and you get a prize based on the amount of heads.

As it stands, %'s of each occurence go as follow
[Amount of deaths] [%]
0 - .09%
1 - .9%
2 - 4.3%
3 - 11.7%
4 - 20.5%
5 - 24.6%
6 - same as 4
7 - same as 3
8 - same as 2
9 - same as 1
10 - same as 0

Worst case scenario, i could live with the system, (since its an optional gambling game) but id like the chances to be fairer
than .09% :rofl:

Post has been edited 1 time(s), last time on Jan 13 2009, 9:01 am by djinni.



None.

Jan 13 2009, 10:38 am Ahli Post #2

I do stuff and thingies... Try widening and reducing the number of small nooks and crannies to correct the problem.

Since this gambling is optional, you may have no problems with a system that could need more than 1 trigger cycle to finish.

you could use a system with the outcome range of [0, 15] and delete the wrong ones:

5. if the value is at least 11 -> set DC to 0 because the try out of the last trigger cycle failed.
1. randomize 4 switches
2. transfer the outcome into a DC
switch1 set -> add 1
switch2 set -> add 2
switch3 set -> add 4
switch4 set -> add 8
4. you have your 11 outcomes as the numbers 0-10 -> do your actions now




Jan 13 2009, 1:20 pm djinni Post #3



and this will give all 11 outcomes an equal % chance of happening?
Otherwise what are the chances for each result :O just 1/15?
edit:
or if i did it right, results 0,6,7,8,9 and 10 would all have half the chance of 1,2,3,4,5?
out of 15 possible outcomes, 1,2,3,4,5 all happen twice, whereas 0,6,7,8,9,10 only happen once. [this is subtracting 10 from any number of kills over 10]

Actually ill just do it your way, minus my way a bit,
ill add in 5 more results giving them all a 1/5 chance (6.6%)
otherwise my system works flawlessly enough, so thats all the help ill need for that, thanks m8, ive never done a system like this before, and math is my fail subject, everything should work out great on it thanks to you :)

Post has been edited 4 time(s), last time on Jan 13 2009, 1:52 pm by djinni.



None.

Jan 13 2009, 7:40 pm Wormer Post #4



Also, if you're interested in minimizeing probability of rerandomization you might look the similar disscussion there. But I should warn you need some math there...



Some.

Jan 13 2009, 10:20 pm Falkoner Post #5



Instead of using a new switch, like Ahli said, you can just reuse the same switch over and over, which will be very easy to make triggers for the outcomes, this is Single Switch Randomization.



None.

Jan 19 2009, 4:43 am Dungeon-Master Post #6



So there is no easy way to make switch randomisation without having a 0.9% and a 24%? Man SC is really a pain in the ass to edit!



None.

Jan 19 2009, 12:01 pm Ahli Post #7

I do stuff and thingies... Try widening and reducing the number of small nooks and crannies to correct the problem.

Quote from Dungeon-Master
So there is no easy way to make switch randomisation without having a 0.9% and a 24%? Man SC is really a pain in the ass to edit!
with my system the 11 outcomes have equal chances to be chosen (9.0909090909...%).
Same with Falk's system.




Jan 19 2009, 12:41 pm rockz Post #8

ᴄʜᴇᴇsᴇ ɪᴛ!

If you randomize 30 switches, you'll have 2^30 possibilities, or 1073741824 possibilities. Let's say you want 10 outcomes, each of different %.
1 - 0-107374182
2 - 107374183-214748365
3 - 214748366-322122547
4 - 322122548-429496730
5 - 429496731-536870912
6 - 536870913-644245094
7 - 644245095-751619277
8 - 751619278-858993459
9 - 858993460-966367642
10 - 966367643+

This way they are almost exactly the same probability of occurring. I'm not saying you need to use 30 randomized switches, but you might as well use some huge number like that.

Alternatively, considering it's optional, just always add 1 to a DC, and return it to 0 when you get above 9.



"Parliamentary inquiry, Mr. Chairman - do we have to call the Gentleman a gentleman if he's not one?"

Jan 19 2009, 3:28 pm Falkoner Post #9



If you're randomizing that high, definitely do single switch randomization, it would also allow you to use At Least and At Most when identifying multiple combinations it could be.



None.

Jan 20 2009, 7:19 pm UnholyUrine Post #10



I didn't read anything other than "need 10 diff randomized results"

make 4 switches randomize continuously.. so you get 2^4 = 16 results.. have the last 6 do nothing.. and there u go...



None.

Mar 7 2009, 9:47 pm euphonic Post #11



Personally when I just need a simple random trigger (for instance, in my current map, building a medic spawns a random hero unit) I use two triggers, the first always adds one mineral to a computer player and preserves the trigger, the second resets the mineral count for the computer to 1 mineral when the computer has at least 4 minerals (or however many options you want). With hyper triggers on, this creates a decently random mineral count for this computer player between 1 and your upper limit which you can use as a condition in the actions of your random triggers. Works best for lower numbers of options.



None.

Mar 7 2009, 9:52 pm Falkoner Post #12



Quote
Personally when I just need a simple random trigger (for instance, in my current map, building a medic spawns a random hero unit) I use two triggers, the first always adds one mineral to a computer player and preserves the trigger, the second resets the mineral count for the computer to 1 mineral when the computer has at least 4 minerals (or however many options you want). With hyper triggers on, this creates a decently random mineral count for this computer player between 1 and your upper limit which you can use as a condition in the actions of your random triggers. Works best for lower numbers of options.

Yeah, the issue with this is if the player will be doing an action based on the random number repeatedly within a few seconds of eachother, or in a sort of pattern, you'll see the same numbers coming up.



None.

Mar 7 2009, 10:23 pm stickynote Post #13



Is there a better way to do it then with switches and deathcounts?



None.

Mar 7 2009, 10:35 pm Pyro682 Post #14



I have a way, and since those are pretty precise percentages, you might be able to do it accurately if you do the math right.

Get a unit, preferably from normal walking speed to upgraded vult speed. Have it walk in a line, and when it gets to the end of the line, teleport it back to the beginning. (You cant go with ridiculously slow units like reavers, or else the "Randomization" can be predicted.) --- This randomization is based upon the player's decision on when to "Flip". If the player KNOWINGLY controls the "When to Flip", you obviously have no randomization, just prediction.

***Warning : Logic here may be false- Sorry, haven't used math in a while, fellas.***

I think this is how you calculate it: Find the distance (in units of Terrain Squares, lets abbreviate that to TS.) For Simplicity Purposes, lets say that the unit travels 1 square a second, and the distance is 10 squares long. So, it takes 10 seconds to travel. Take 0.09% of that 10 seconds. Multiply that by the speed, and you get the amount of terrain squares you have.

You can also do this in pixels, i dont know if it is any better.

Now, you can either have 10 or so lines, or just re-use the same line and have a couple DCs keep track of deaths.
Throw in some triggers to kill, and Voila.



None.

Options
  Back to forum
Please log in to reply to this topic or to report it.
Members in this topic: None.
[2026-7-18. : 2:27 am]
Symmetry -- https://staredit.net/topic/18903/ THE REVIEWS ARE HERE! "ok these are pretty good memes" - ssj9Kevin
[2026-7-17. : 2:58 pm]
Ultraviolet -- Symmetry
Symmetry shouted: Man I wish we had this tech back in the day when people played ums lmao
fr fr
[2026-7-17. : 2:39 am]
Symmetry -- Man I wish we had this tech back in the day when people played ums lmao
[2026-7-16. : 6:28 am]
NudeRaider -- EUD actions, specifically. The conditions remained. Today we can even have actions again, but they're all virtualized/whitelisted (not sure on the actual technical implementation) so you can only use them for specific intended purposed, not arbitrary code injections.
[2026-7-16. : 6:26 am]
NudeRaider -- I mean yes, maps - through EUDs - were theoretically able to do that as well, but that was patched quickly.
[2026-7-16. : 6:25 am]
NudeRaider -- Symmetry
Symmetry shouted: Ohhh imagine a SC map that could delete itself
not the map, the editor
[2026-7-16. : 2:28 am]
Symmetry -- I vaguely remember Voy doing some ACE back in the day, but I had no idea EUDs could do that kind of shit. I am very much catching up on the technology
[2026-7-16. : 2:28 am]
Symmetry -- Ohhh imagine a SC map that could delete itself
[2026-7-15. : 8:51 pm]
NudeRaider -- Symmetry
Symmetry shouted: NudeRaider Is EUD editor capable of writing shit onto the player's harddrive? That seems like it would be dangerous
yeah an editor that isn't allowed to write files sounds rather pointless, so I'd assume it can. Like most other programs too btw. and yes, obviously that's dangerous, but also kinda necessary. MS introduced that virtualization for exactly that reason.
[2026-7-15. : 4:10 am]
Ultraviolet -- I don't think so. I think they shut that shit down after 1.16, maybe even earlier
Please log in to shout.


Members Online: Zycorax