Page 1 of 1

Question: Generating Randomness in a game

Posted: Fri Apr 10, 2020 11:55 am
by miketwenty1
I'm thinking about a dice mechanic in my head..

I already have some ideas.. but wanted to see what other people's thoughts were on generating randomness..
Ideally would love to come up a random number. let's say between 1 and 6 for a die roll..
I would maybe traverse a unit over a grid for all to see .. so they can see the die roll happening and maybe where ever the unit stops is the die roll.. but would want him to walk a random amount of time.. between 1 and 10 seconds maybe..

Any thoughts would be appreciated. Still not sure how to easily create "randomness" that can then be used to drive some other functions/triggers.

Re: Question: Generating Randomness in a game

Posted: Fri Apr 10, 2020 3:44 pm
by Neotje
I'm not familiar with building scenario's - as in, I never build any, but looked at triggers ~10 years ago a bit - so I don't know a lot of techniques.

However, there is an option to spawn a random number of units in a certain area of the map, I think there is also one to count the number of units in an area. If the distribution of the first one is flat, that can give you a technique for throwing random numbers.

[Edit]
I know this technique is used in Vortex TD, to spawn a random number of goldminers between I think 2 and 6. I'm not sure about the chance distribution, might be flat, might be Gaussian or might be something else.

Re: Question: Generating Randomness in a game

Posted: Sun Apr 12, 2020 11:41 pm
by Arntzen
What about:
Have 6 units spawn from 6 different computers in a small space so they can all see each other. All are enemies. The different computers are assigned a number from 1-6. Whichever unit survives is the number of the dice.
Example one:
1 Marine from Computer 1, 2, 3, 4, 5, 6 spawns. Computer 2's marine survived = Dice roll 2.
Example two:
1 Marine from Computer 1, 2, 3, 4, 5, 6 spawns. Computer 5's marine survived = Dice roll 5.