Staredit Network

Staredit Network -> UMS Assistance -> Dice
Report, edit, etc...Posted by sharf on 2006-05-09 at 20:11:26
ok im making a board game. i ned dice 2 6 sided dice so it ranges from 2-12. now im useing rndomized switches like if 2 is set u move 2 is its clear randomize 3 etc.but the conditions are what im having probs with i have 1 switch for eahc player and 11 for the rolls i want some help with teh conditions i have it:
Trigger
Players:
¤ Player
Conditions:
¤ Player brings 1 civ to roll
Actions:
¤ set p1
¤  kill 1 civ
¤ randomize 2
¤ preserve


and

Trigger
Players:
¤ player
Conditions:
¤ p1 set
¤ 2 set
Actions:
¤ clear 2 set deaths of DICE to 2
¤ preserve


thats fine, but
Trigger
Players:
¤ player
Conditions:
¤ p1 set
¤ 2 cleared
Actions:
¤ randomize 3
¤ preserve

this means that when 2 is cleared itll keep randomizeing 3, help?
Report, edit, etc...Posted by Urmom(U) on 2006-05-09 at 20:18:58
If you want a six sided die, try randomizing 3 switches to get 8 possibilities. Then have the 2 leftovers just re-randomize the triggers. It would be like this:

Switch 1 is cleared
Other conditions to begin roll
----------
Set Switch 1
Randomize Switch 2,3,4
Get rid of other conditions to begin roll
Preserve Trigger


Then you use in the conditions of the outcome triggers something like:

Switch 1 is Set
Switch 2 is cleared
Switch 3 is set
Switch 4 is set
---------
Outcome actions
Clear Switch 1


Then you just need to do that for all of the possible combinations. For the 2 leftover combinations try this:

Unused Combination
Switch 1 is Set
-------
Randomize Switch 2,3,4
Preserve Trigger


Hope that helps. smile.gif
Report, edit, etc...Posted by fritfrat(U) on 2006-05-09 at 20:29:11
This is a post I made a long time ago on a different forum and saved since it was so long. This was originally on how to do it for monopoly, but I edited out all the extra monopoly stuff, excluding the doubles. Hope this helps.



QUOTE
My explanation of how to do dice rolls.


If you want to get into throwing dice, you will be up for a treat. There are 36 permutations of two dice being thrown, and you need to take them all into account; for example, a 7 is 6x more likely to be thrown than a 12 or 2.

The dice throw permutations would work like this:

11  21  31  41  51  61
12  22  32  42  52  62
13  23  33  43  53  63
14  24  34  44  54  64
15  25  35  45  55  65
16  26  36  46  56  66

Added together:
2  3  4  5  6  7
3  4  5  6  7  8
4  5  6  7  8  9
5  6  7  8  9  10
6  7  8  9  10  11
7  8  9  10 11  12

2/12- 1 chance
3/11- 2 chances
4/10- 3 chances
5/9-  4 chances
6/8-  5 chances
7-    6 chances

Note, if you add them all up, there are still 36 permutations, just stated in a different way. Now, to use switches, we must randomize 6 switches. This will create 64 possibilities, but without the 6th switch, there are only 32, which is not enough.

Randomize Switch 1
Randomize Switch 2
Randomize Switch 3
Randomize Switch 4
Randomize Switch 5
Randomize Switch 6

I will use "+" for set and "-" for cleared. Switches 1 to 6 would be written in order from left to write, and the dice roll that is asoociated with it comes after the switch states.

------     2  (Doubles)
-----+     3
----+-     3
----++     4   (Doubles)
---+--     4
---+-+     4
---++-     5
---+++     5
--+---     5
--+--+     5
--+-+-     6    (Doubles)
--+-++     6
--++--     6
--++-+     6
--+++-     6
--++++     7
-+----     7
-+---+     7
-+--+-     7
-+--++     7
-+-+--     7
-+-+-+     8   (Doubles)
-+-++-     8
-+-+++     8
-++---     8
-++--+     8
-++-+-     9
-++-++     9
-+++--     9
-+++-+     9
-++++-     10   (Doubles)
-+++++     10
+-----     10
+----+     11
+---+-     11
+---++     12   (Doubles)
+--+--
+--+-+
+--++-
+--+++
+-+---
+-+--+
+-+-+-
+-+-++
+-++--
+-++-+
+-+++-
+-++++
++----
++---+
++--+-
++--++
++-+--
++-+-+
++-++-
++-+++
+++---
+++--+
+++-+-
+++-++
++++--
++++-+
+++++-
++++++



Now, to make the triggers. Lets start it at the beginning of a dice roll.

Randomize all 6 switches.

Now, you will have 36 triggers that follow the format of this one:

Conditions:
Switch 1 is cleared.
Switch 2 is cleared.
Switch 3 is cleared.
Switch 4 is cleared.
Switch 5 is cleared.
Switch 6 is cleared.
(A condition that shows which player is rolling the dice; for example, current player commands exactly 1 Dice Roller or something.)

Action:
(Whatever you want done).



Doubles are done by associating the first of every even trigger as a double.

If the switches come out to one of the switches without a number associated with it (Very likely), just re-randomize the switches until you get them randomized in a way they are associated with a number.



This is what I would find the most accurate way of representing true dice rolls. Good Luck  smile.gif
Report, edit, etc...Posted by sharf on 2006-05-09 at 20:40:08
well infact im useign 2 dice but doing 2-12 2 6 sided dice and i am makign monopoly i dont need all that extra stuff im just gona try randomizing switches.


user posted image


trigger number 3 is the problem
Report, edit, etc...Posted by fritfrat(U) on 2006-05-09 at 20:46:10
If you want it to be truly accurate, you should follow my suggestion. It would be extremely noticable making getting 2 and 12 a 1/11 chance instead of a 1/36 chance. If you do roll one big 11 sided die instead of 2 six sided dice, you should most definitely make a note of this in your game, since this would GREATLY affect how people play it.

It is a lot of work to have it accurate, I admit.. but it is what is necessary. If you are actually making the map as a copy of monopoly, I would most definitely suggest taking the time to make an accurate rolling system.. I suppose if not, then it really doesn't matter.


I am going to PM you the full original quote, seeing that I now know you are doing monopoly.
Report, edit, etc...Posted by sharf on 2006-05-09 at 20:49:54
yea well i dont realy need the full roll thing i just want an answer to my question a prob with switches, i dotn use switches that often so im not very good with um
Report, edit, etc...Posted by fritfrat(U) on 2006-05-09 at 20:57:38
I really don't get what you are asking for.. your triggers were not accomplishing an accurate dice roll, and since you said:

QUOTE
i ned dice 2 6 sided dice so it ranges from 2-12


I told you how to do it. Now you're saying:

QUOTE
i dont realy need the full roll thing


Clarification will allow people to help you greater. Concerning switches, just know that they basically act like light switches that are either on or off, starting off and always staying at their position they are at until changed.
Report, edit, etc...Posted by sharf on 2006-05-09 at 21:09:07
i meant i dont want your FULL acurate thing. i want peopel to look at the picture of my triggs
user posted image

now i know its not done but it works i just need help with the 3rd one. it has a sligth prob because when it randomizes 3 but the conditions to randomize it, are alwyas the same thru all the rolls so it randomizes it all the time.
Report, edit, etc...Posted by Heimdal on 2006-05-10 at 01:42:17
There's an easier way to do dice rolls, and accurately too. It's based off of the death-counter method in the tutorial DB. Basically what you do is have a death counter for a computer player constantly increasing, but when it gets to a certain value it will be set back to 0. In our case we want that value to be 35 (so that we get 36 distinct values, 0-35).

Now, when the conditions are right for a player to roll, just look at the current value of the death counter. Use the following table to get the proper probabilities (thanks fritfrat!):

Counter: Result (sum of dice):
0 2
1-2 3
3-5 4
6-9 5
10-14 6
15-20 7
21-25 8
26-29 9
30-32 10
33-34 11
35 12

It should be obvious how to detect when doubles were thrown - just pick one of the death counter values from each range (of the even numbers) to be the one that represents doubles.
Report, edit, etc...Posted by JaFF on 2006-05-10 at 08:54:02
Death counters are much easyer I think. If you will need a 1/1024 chance you will need 10 switches, but still 1 deathcounter. Switches are good at 1/4, maybe 1/8 randomisation, but not more I think. It's your choice anyway smile.gif
Report, edit, etc...Posted by Daedalus on 2006-05-10 at 11:25:30
I also got a question about randomization. I hope it isn't a problem that I "hi-jack" your topic which is - I think - already solved.

This is the situation:
There are a lot of units from Player3 in a set location on the edge of the map. What I want is that all the units from Player3 get randomly split between Player 1 and 2. The units are placed in 'boxes' orderd by type, so box 1 has 10 Lurkers, box 2 has 10 Zerglings, etc.

At the moment I'm using 3 triggers to accomplish that:



Start Randomization Process
Conditions:
- Player3 Brings At Least 1 Unit to 'Bla'
- Switch1 is Clear
Actions:
- Set Switch1
- Randomize Switch2
- Preserve Trigger

Option1
Conditions:
- Switch1 is Set
- Switch2 is Set
Actions:
- Clear Switch1
- Give 1 Unit From Player3 to Player1
- Preserve Trigger

Option2
Conditions:
- Switch1 is Set
- Switch2 is Clear
Actions:
- Clear Switch1
- Give 1 Unit From Player3 to Player2
- Preserve Trigger



The problem is however, that you will have a way higher chance that it is split like this: Box1 has 4 Lurkers from Player1 and 6 from Player2, Box2 has 5 Lurkers from Player1 and 5 from Player2.

In short, I want that Player1 gets a random number of units ranging from 1-10 while Player2 gets the remaining units.
Report, edit, etc...Posted by Heimdal on 2006-05-10 at 11:30:35
Why is this biased? It seems pretty even to me. True, it will give you distributions much closer to a 50/50 split than picking a uniformly distributed number from 1-10. You could use death counters like I mentioned before, just reset it when it gets to 10.
Report, edit, etc...Posted by Daedalus on 2006-05-10 at 11:38:54
Yes it is even, which is exactly the problem. When it is 'even' Player1 will get around 4-7 units most of the time. What I want is that you have an equal chance to have 1 unit or to get 10 units.

I know there is a really simple solution to this, but I just can't figure it out mellow.gif.

EDIT: In response to your edit tongue.gif
Your death counter method won't work with my map. It does work with a game like monopoly though, because then the time when you will go to the 'randomize' beacon is quite.. random. That is why it seems to pick a random number from 1-36.
However I don't have that kind of condition which will stop the death counter and 'picks' a value. I want to randomize all the units at the very start of the game and as quick as possible.
Report, edit, etc...Posted by Heimdal on 2006-05-10 at 13:06:43
Making an even distribution over 10 values is difficult. If you change it to 7 units, it would be much easier:

Always
Randomize Switch 1

Switch 1 is set
Give 1 units to player 1
Randomize switch 1

Switch 1 is set
Give 2 units to player 1
Randomize switch 1

Switch 1 is set
Give 4 units to player 1
Give all leftover units to player 2

Note that this has a distribution over 0-7. If player one got somewhere between 1 and 8 units, then player 2 will get somewhere between 0 and 7...that's not exactly fair, right?

You could also adjust this for 15 units by adding another trigger like above and give away 8 of the units.
Report, edit, etc...Posted by Daedalus on 2006-05-10 at 14:06:40
That doesn't work. You got 50% chance to get 0 and 50% chance to get something higher then 0. After that you get 50% to get 1, and 50% to get higher, etc.
Test results show the same.

Ah nevermind, I think I'll just use 3 randomization switches and use some extra triggers.
Report, edit, etc...Posted by Heimdal on 2006-05-10 at 14:35:04
Oh woops...It does work, you just need to make sure that the switch gets randomized regardless of its previous value. You can do this by copying the first trigger in between each of the others, or use slightly more complicated ways and re-use the first one.
Report, edit, etc...Posted by sharf on 2006-05-10 at 15:33:30
Well im back, first i dont mind u "hi-jacking" my topic but its not solved Heimdal ur death idea is cool but i think ill do a few more trigegrs to get an easier system

UNITS:
dice1
dice2
DICE

always set dice1 deaths to +1
always set dice2 deaths to +1
or something like that, and each timen u roll ill check both death counters, but this would always be doubles so i think ill think ill do a trigger like set deaths for dice 1 +1 then anoterh set it to +3 then to +2 and same for dice 2 except different order this would realy mix um up and if teh death are same amount ill make doubles. will this work?
P.S. DICE deaths are set so it keeps track of ur roll and decreses by 1 each time you move
Report, edit, etc...Posted by Heimdal on 2006-05-10 at 18:03:12
You'll get the same number of triggers doing it that way and doing it my way. I think you'll actually get fewer doing it my way, because you can lump together some of them - you only need one trigger for each sum, not each possible combination. I suppose if you want to actually show what the two dice were, then you'd need something different. All depends on what your requirements are.
Report, edit, etc...Posted by sharf on 2006-05-10 at 18:51:37
Well nvm i got the rollign to work my way. now i need hel pswitching players, i have 4 players and i need it so after p1 goes it puts up p2 IF hes there if not skip to 3 etc.
Report, edit, etc...Posted by Noober on 2006-05-10 at 18:58:53
P1 is set. (or whatever you used to end p1's turn)
======
Set p2.
Clear p1.

P2 is set
Player 2 commands exactly 0 units.
=====
Clear p2.
Set p3.

P3 is set
Player 3 commands exacly 0 units
=====
Clear p3.
Set p4.

Etc.
Report, edit, etc...Posted by sharf on 2006-05-10 at 21:03:19
ok that works i think prob is when i roll im getting 0s and i dont have any 0s in the triggers >.<
Report, edit, etc...Posted by (U)Bolt_Head on 2006-05-11 at 02:13:57
QUOTE(Noober @ May 10 2006, 05:58 PM)
P1 is set. (or whatever you used to end p1's turn)
======
Set p2.
Clear p1.

P2 is set
Player 2 commands exactly 0 units.
=====
Clear p2.
Set p3.

P3 is set
Player 3 commands exacly 0 units
=====
Clear p3.
Set p4.

Etc.
[right][snapback]483892[/snapback][/right]


I prefer the raise hand method that uses current player controled triggers. So when the first player finishes his trigger then next player runs his. It doesn't actually check if that player is there or not, if they are present then they will run the trigger. While the remaining players wait.



With your zeros problem my guess would be that your adding values to a counter or something and well, its not doing it lol. That or you have something else subtracting it, like movement triggers or a countoff maybe. Its pretty hard to guess.

I don't know why you would have to stray from Heimdal's method. Even if you wanted to display what dice were rolled then you can still use it. Each value would represent a differant combination, you would just display that. Example: there are two possablities to roll a 3, (1+2 or 2+1) using heimdals method death counts of 1 and 2 both yeild a sum of 3. The same way you determan doubles you can decide what each of the dice were.
Report, edit, etc...Posted by Heimdal on 2006-05-11 at 11:35:39
QUOTE((U)Bolt_Head @ May 11 2006, 01:13 AM)
I don't know why you would have to stray from Heimdal's method.  Even if you wanted to display what dice were rolled then you can still use it.  Each value would represent a differant combination, you would just display that.  Example: there are two possablities to roll a 3,  (1+2 or 2+1)  using heimdals method death counts of 1 and 2 both yeild a sum of 3.  The same way you determan doubles you can decide what each of the dice were.
[right][snapback]484211[/snapback][/right]
If you wanted to display the individual dice using one death counter with range 0-35, you would need 36 triggers. However, doing it with two death counters 0-5 would only require 12 triggers, plus 6 more for doubles. Then, you could have a separate trigger that uses a different death count to move the pieces, which got updated by the original 12 triggers.

BUT if you don't need to show the original dice rolls, using one death counter 0-35 only requires 11 triggers, plus 6 for doubles.
Report, edit, etc...Posted by (U)Bolt_Head on 2006-05-11 at 14:05:36
QUOTE(Heimdal @ May 11 2006, 10:35 AM)
If you wanted to display the individual dice using one death counter with range 0-35, you would need 36 triggers.  However, doing it with two death counters 0-5 would only require 12 triggers, plus 6 more for doubles.  Then, you could have a separate trigger that uses a different death count to move the pieces, which got updated by the original 12 triggers.

BUT if you don't need to show the original dice rolls, using one death counter 0-35 only requires 11 triggers, plus 6 for doubles.
[right][snapback]484284[/snapback][/right]


Oh I see i thought you were saying you couldn't tell what the dice rolls were with your system but you ment that it would require more triggers than other methods if that information was required.

Well thats cool Heimdal I understand what your saying now.
Next Page (1)