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.
[07:47 pm]
Ultraviolet -- Yeah, I suppose there's something to that
[2024-5-06. : 5:02 am]
Oh_Man -- whereas just "press X to get 50 health back" is pretty mindless
[2024-5-06. : 5:02 am]
Oh_Man -- because it adds anotherr level of player decision-making where u dont wanna walk too far away from the medic or u lose healing value
[2024-5-06. : 5:01 am]
Oh_Man -- initially I thought it was weird why is he still using the basic pre-EUD medic healing system, but it's actually genius
[2024-5-06. : 3:04 am]
Ultraviolet -- Vrael
Vrael shouted: I almost had a heart attack just thinking about calculating all the offsets it would take to do that kind of stuff
With the modern EUD editors, I don't think they're calculating nearly as many offsets as you might imagine. Still some fancy ass work that I'm sure took a ton of effort
[2024-5-06. : 12:51 am]
Oh_Man -- definitely EUD
[2024-5-05. : 9:35 pm]
Vrael -- I almost had a heart attack just thinking about calculating all the offsets it would take to do that kind of stuff
[2024-5-05. : 9:35 pm]
Vrael -- that is insane
[2024-5-05. : 9:35 pm]
Vrael -- damn is that all EUD effects?
[2024-5-04. : 10:53 pm]
Oh_Man -- https://youtu.be/MHOZptE-_-c are yall seeing this map? it's insane
Please log in to shout.


Members Online: Rawflesh0615