I need help with rolling the six dice and having 6 new random dice pictures appear. the game needs to know which dice are on the board then calculate which hand you have upon hitting bank score. also holding dice and not rolling any held dice. to increase your possible high hand. maybe 3 rolls total. That is pretty much the game. everything else is whistles and bells and networking. i have created the script and it works awesome in c# with windows forms inside visual studio. i simply need to recreate this in unity. once i do this with these dice. i will have a much better understanding how unity works and uses objects. this is all high hands. 2 pair, 3 pair, 3 of kind, 4 of kind, 5 of kind, 6 of kind, straight, two sets of 3, full house = 2222 33. 9 high hands possible. i’m willing to invest the time. i just need help. The photo i posted is built with unity and is my current layout/scene
I put together something. Hope if it helps you. Although I am not quite sure that I understand your problem perfectly. Tell me if it is what you want.
thank you . thats exactly what i was looking for.. i would appreciate it if you could help me until this dice rolling is complete within unity. There were some bugs within your code and some stuff is not commented and i dont understand some of the code. Fullhouse is not working when it hits 4 and 2. And i had to run an arron so i didnt get to fully test . Ill be back home in 1 hour. Things to complete dice roll. I have a star dice for wild card or equal to any dice. Holding dice and re rolling other dice And no high hand bugs
I've attempted to fix the Full House bug/ Two Sets of Three, and I cannot. no matter what i do it renders four of a kind.
Ac Actually I had no idea what is your high hands. I just went with my guesses. If you explain them, I can make it work. Yes, Sure. That's why I am here. Ask me anything that looks confusing or wrong to you. I thought full house is only made with 4 twos and 2 threes. Does star replaces any specific numbers? Or we just have 7 possibilities for each dice?
so two sets of three and full house can be any numbers. two sets can be = 111,222 or 555,333. and same for full house 1111,22 or 6666,33. its anytime 4 of any dice is the same and 2 of any dice is the same. the star is a 7th dice and very complicated . when the star hits the board it can be 1 or 2 or 3 or 4 or 5 or 6 like a wild dice. holding the dice will consist of clicking the actual dice. and have its color changed from white to blue.or red or anything. i'm going do 3 chances to gain the best hand you can. or 3 rolls to gain the best hand you can. i hope i'm explaining this good enough. and i want to say thanks your helping me get this dice iteration done and i just need these dice to work with no bugs so i can move on with my project. leaving the star wild for last is way ok with me. the main iteration is much more important and trust me the star wild gets really hairy and conflicts with the rest of the script layout. after the dice are very nicely scripted with no bugs then id like to attempt to add the star wild. it will actually be very important at some point later in the game creation. for instance like acquiring 25 stars in a single game would award bonus points. it also changes the luck factor and allows people to get really good rolls. six of kind pays allot of points and with stars you can achieve some of the high pointed hands.
I just got to work. Ill check it out when i get home. Thanks for helping and for your time . Its much appreciated.
Code works good. no bugs as of yet. thank you very much. When im done with demo version, i will post it on my website for download. and ill post that back here on this page in case you want to see or play my version of this game.
I look forward to see your game. Now please explain a little more about that star dice. We can add that to the game now.
Ok, i'm excited about the star dice. the star simply can = a 1 or 2 or 3 or 4 or 5 or 6. if you roll 1234,star,star. that would = a straight. i think its going to be hard to do and not conflict with the other code. I'm Hoping there is a simple method that can achieve this. another example 666,star,star,star = six of a kind Star = wild dice , 1 or 2 or 3 or 4 or 5 or 6 i hope i explained it well enough
I've managed to modify it and it seems to work. I tested it with your examples. Only one difference. I simulated a 666,star,star,star and it gave me a full house. Because it thought that it can be 666611 instead of 666666, and a full house is more valuable than a six of a kind. Is it correct behavior?
666,666 is highest score possible. post your star code because ive simulated true and false statements for scoring purposes.
It has a bug, I am working on it. Probably take like half an hour. In the meantime can you tell me the high hands in order of best to worst?
until i further test probability scoring is just set to random numbers right now. here's what i have. Code (csharp): int onepair = 100; int threekind = 150; int twopair = 250; int fourKind = 400; int threepair = 1000; int fullhouse = 1000; int twosets = 1500; int fivekind = 1500; int straight = 2500; int sixkind = 5000;
here's my script with scoring , everything works perfect Code (CSharp): using UnityEngine; using UnityEngine.UI; public class SceneController : MonoBehaviour { public Dice[] dices; public Text handText; public Text[] buttonTexts; int onepair = 100; int threekind = 150; int twopair = 250; int fourKind = 400; int threepair = 1000; int fullhouse = 1000; int twosets = 1500; int fivekind = 1500; int straight = 2500; int sixkind = 5000; public bool HasOnePair = false; public bool HasTwoPair = false; public bool HasThreePair = false; public bool HasTwoSets = false; public bool HasFullhouse = false; public bool HasThreeKind = false; public bool HasFourKind = false; public bool HasFiveKind = false; public bool HasSixKind = false; public bool HasStraight = false; bool[] holds; void Start() { // holds = new bool[dices.Length]; } public void RollDice_Click() { for (int i = 0; i < dices.Length; i++) { if (dices[i].hold == false) dices[i].ShowRandomFace(); } HighHands hand = DetectHighHands(dices); handText.text = hand.ToString(); } int[] repeats; public HighHands DetectHighHands(Dice[] dices) { repeats = new int[6]; // find out how many times each number is repeated for (int i = 0; i < dices.Length; i++) { repeats[dices[i].faceIndex]++; } bool four = false; bool two = false; int threes = 0; for (int i = 0; i < repeats.Length; i++) { // is there a number with 4 repeats? if (repeats[i] == 4) four = true; // is there a number with 2 repeats? if (repeats[i] == 2) two = true; // how many sets of threes do we have? if (repeats[i] == 3) threes++; } if (four && two) // 4 twos and 2 threes { HasFullhouse = true; HasThreeKind = false; HasThreePair = false; HasTwoSets = false; HasTwoPair = false; return HighHands.FullHouse; } else { HasFullhouse = false; } if (threes == 2) // 2 sets of three { HasTwoSets = true; HasThreeKind = false; return HighHands.TwoSetsOfThree; } else { HasTwoSets = false; } // detect if there is one of each number - straight bool isAllOneSoFar = true; for (int i = 0; i < repeats.Length; i++) { if (repeats[i] != 1) { isAllOneSoFar = false; break; } } if (isAllOneSoFar) { HasStraight = true; return HighHands.Straight; } else { HasStraight = false; } // detect if it is a straight hand for (int i = 0; i < repeats.Length; i++) { if (repeats[i] == 6) { HasSixKind = true; return HighHands.SixOfAKind; } else { HasSixKind = false; } if (repeats[i] == 5) { HasFiveKind = true; return HighHands.FiveOfAKind; } else { HasFiveKind = false; } if (repeats[i] == 4) { HasFourKind = true; return HighHands.FourOfAKind; } else { HasFourKind = false; } if (repeats[i] == 3) { HasThreeKind = true; return HighHands.ThreeOfAKind; } else { HasThreeKind = false; } } // find the number of pairs int pairs = 0; for (int i = 0; i < repeats.Length; i++) { if (repeats[i] == 2) pairs++; } if (pairs == 3) { HasThreePair = true; return HighHands.ThreePair; } else { HasThreePair = false; } if (pairs == 2) { HasTwoPair = true; return HighHands.TwoPair; } else { HasTwoPair = false; } if (pairs == 1) { HasOnePair = true; return HighHands.OnePair; } else { HasOnePair = false; } return HighHands.None; } public void BankScore() { if (HasFullhouse) { Debug.Log("Has Full House"); AddScore.score += fullhouse; } if (HasStraight) { Debug.Log("Has Straight"); AddScore.score += straight; } if (HasTwoSets) { Debug.Log("Has Two Sets of three"); AddScore.score += twosets; } if (HasTwoPair) { Debug.Log("Has Two pair"); AddScore.score += twopair; } if (HasThreePair) { Debug.Log("Has Three Pair"); AddScore.score += threepair; } if (HasSixKind) { Debug.Log("Has Six of A Kind"); AddScore.score += sixkind; } if (HasFiveKind) { Debug.Log("Has Five of A Kind"); AddScore.score += fivekind; } if (HasFourKind) { Debug.Log("Has Four of A Kind"); AddScore.score += fourKind; } if (HasThreeKind) { Debug.Log("Has Three of A Kind"); AddScore.score += threekind; } } } public enum HighHands { None, OnePair, TwoPair, ThreePair, ThreeOfAKind, FourOfAKind, FiveOfAKind, SixOfAKind, Straight, TwoSetsOfThree, FullHouse, }
َAnd finally it is done. Star dice works like a peach (and I think it is a very exciting feature in your game) I used a recursive function to check all the possible combinations. The recursion level is as many as stars appearing in the hand and it works beautifully. Check it and let me know the result.
Its going to be a pc install. With plans to be global multiplayer. With big jackpots for real money. If it becomes popular well make a mobile version. Hey btw did the particle systems work for you ?. My buddy downloaded it and said theres no particle systems
Need your help again. ok so there is some issues with how the dice work compared to how the game is suppose to work. the way you have it coded its checking for highest hand possible. when in fact that's eliminating the users choice and users attempt to achieve a higher hand. i have a solution but since there's 270 lines of code now its becoming confusing. so here's my thought and plan. I hope i can explain this so you understand. We need to lock the held dice and change its color to red. upon locking lets say 3 dice , we need to run a check for highest hand possible for the held dice not the entire six dice. the key to this game is achieve a six dice roll. allowing the player to roll the six dice AGAIN rather then banking. any 1 or 5 or six dice score allows the player to roll again. if a player has EXAMPLE: 333155 this would consist of six dice locked and a valid six dice hand allowing the player to re roll all six dice. EXAMPLE 2 : player rolls 333,466 player then holds and locks 333 and re rolls the other dice and hits 666 this would enable to player to re roll all six dice because he has 2 sets of three. To build is score higher and higher. EXAMPLE 3: player rolls 444,662 Player holds and locks 444 then rolls the other 3 dice. hitting 562 because the player has a 5 he can lock the 5 and re Roll the other 2 dice. he now has 4445. If the player fails to achieve a situation not allowing him to gain any points then he would loose all his points. EXAMPLE 4: player rolls 444,662, player holds and locks 444 but then roll 336. turn would be over he failed to achieve more points. Only if pulling a six dice hand or hitting a 1 or 5 would allow the continuation of another roll.. 1 will declare 150 points. 5 will declare 250 points. Lets say three of a kind declares 350 points EXAMPLE 5: player rolls 666, 513 Player then locks 66651 and is able to re roll the 3. Here is where the fun comes from and this is what were currently bypassing. 66651 = 750 points. player can choose to bank score or attempt to roll his sixth dice to achieve a 1 or 5 or 6 because 6 would = 4 of a kind . If player achieves this he can re roll all six dice. if player fails and lets say rolls a 2 or 4 then he would loose his 750 points and turn would be over. i know i typed allot and its allot to take in but i tried explaining this the best i could . its really simple when you play and understand the concept. The main key points are locking the held dice until round is over or until a six dice re roll is available. and the 1 and 5 being involved to allow a re-roll. Ill be working on it or here to answer any questions you have for me thank you.
I have this feeling i have to much in one script. Should we break all this code down into small scripts . Like one script per function. Would that make it easier to manage ?
I've read your post 2 times and still not have a clue about what you want first things first. How we are eliminating user's choice? What choice is that? It's usally a good thing to keep your script files short and simple. But the breaking down process also have to make sense. It's one action, one job. Therefore I think it's better to remain as one file. But it's your project, you should decide which way is more convenient for you.
once a player holds a dice it cannot be un-held, until his turn is over. We need to check if he has a 1 or 5 or minimum 3 of a kind / Lowest high hand possible. the dice need to lock after holding them. here's the process Step One: Player rolls the dice Step Two: Player decides which dice to hold. Minimum of 3 of a kind (OR) having a single 1 or 5. Step Three: Check the players choice to make sure hes holding a valid roll then lock those dice Step Four: Re- Roll the UNHELD dice. If a player rolls NO new points round is over.
So player can't just hold any dice? He/She has to follow rules. And what happens if they don't? New points means a better high hand than the last one?
I think ive somewhat confused you with the 1 and the 5, And we can add that part after we fix this main problem. NEW EXAMPLE: Player rolls 444, 323 . Player then holds the 444 and re rolls the other 3 dice. Now the 444 are locked and cannot be unheld. Upon the re-roll the player now has (444)423 Player holds the new 4 and now has 4 of a kind and can re-roll the other 2 dice. Upon the re roll the player now has (4444)43 Player holds the new 4 and now has 5 of a kind and can re-roll the last dice. If the player gets lucky and hits sixofakind he can reroll ALL SIX DICE. if the player does not his turn is over banking no points. A player can bank at anytime to bank points instead of loosing his whole hand
Ok ive found a online game thats quick and simple and its exactly what im trying to achieve please play it. At the bottom choose to play with computer and you will see what im trying to do. no account creation required http://www.playonlinedicegames.com/farkle I appreciate you being patient with me helping again.
Thank you for the example. I think I got it. Let me think a little about it. I'll come back to you soon.
OK. In the example you gave me, there is no signs of high hands. Instead we have this scoring table: Category Score Each 1 100 Each 5 50 Three 1s 1000 Four 1s 2000 Five 1s 3000 Six 1s 4000 Three 2s 200 Four 2s 400 Five 2s 600 Six 2s 800 Three 3s 300 Four 3s 600 Five 3s 900 Six 3s 1200 Three 4s 400 Four 4s 800 Five 4s 1200 Six 4s 1600 Three 5s 500 Four 5s 1000 Five 5s 1500 Six 5s 2000 Three 6s 600 Four 6s 1200 Five 6s 1800 Six 6s 2400 Straight (1-2-3-4-5-6) 1500 Three pairs 750 Do you have this scoring system in your game too? And the game only allows me to re-roll if I have some score with my held dice. Is that correct?
Ok thanks man ill check it out when i get home from work. Thank you And your scoring table is correct I wanted to add six dice scores. Like Two sets of three , fullhouse, three pair. And the star wild , to not completely copy that game. And my game will score more points and go past 10,000 for final score