Jump to content
  • Advertisement
Sign in to follow this  
  • entries
  • comments
  • views

Farkle Friends Scoring Update

Sign in to follow this  


It's been a while since my last update. I've been pretty busy and haven't has a whole lot of time to work on my game. But over the last few days I have been able to finalize the player and CPU scoring. The player scoring was fairly easy to get it working as the player controls which dice to keep and makes decisions based on what was rolled. The CPU scoring was a little more difficult and I ended up with a little easier implementation that I'm just in the process of tweaking to make it both winnable and challenging at the same time. If anyone is curious I am using Unreal Engine 4.16 as my engine. This game is a combination or Blueprints and C++.



I'll start with the player scoring. I started by doing a little research into scoring dice in a game to get a few ideas on how to tackle this. I created a utility class that handles scoring the dice so when the players turn is finished, I use it to calculate the players total score. I take that score and update the players score in the UI. Here is a sample of that scoring utility class. You can see that with these 4 functions I have the ability to check if the player has a straight or three pair, and the ability to score each accordingly. I have one function to determine if each scoring possibility is in the dice, and one to score each possibility. I count each of the dice values and most of the scoring depends on the count of each value. For the straight its easy, if the count in each index is 1 the player has a straight.

const bool UScoreUtil::HasStraight(TArray count){ if (count.Num() == 6) { return count[0] == 1 && count[1] == 1 && count[2] == 1 && count[3] == 1 && count[4] == 1 && count[5] == 1; } return false;}const int32 UScoreUtil::ScoreStraight(){ UE_LOG(LogTemp, Log, TEXT("Incrementing score by %d for a straight."), UScores::STRAIGHT) return UScores::STRAIGHT;}const bool UScoreUtil::HasThreePair(TArray count){ int8 threeCount = 0; if (count.Num() == 6) { for (int8 c : count) { threeCount = c == 2 ? threeCount + 1 : threeCount; } return threeCount == 3; } return false;}const int32 UScoreUtil::ScoreThreePair(){ UE_LOG(LogTemp, Log, TEXT("Incrementing score by %d for three pair."), UScores::THREE_PAIR) return UScores::THREE_PAIR;}

Now lets talk a little about the CPU scoring.

I began to Google around for some ideas, but I wasn't able to find a whole lot on this subject. I began to bake my own solution and it started to get pretty complex. Being that this is my first game and, a fairly simple one, I didn't want to get overly carried away on fancy complex AI. So I decided on a simpler solution. I'm using the odds that a particular scoring option will happen and using that to decide if the CPU player scored. I can set individual percentages so I can change how often each scoring option happens. Based on what I get from that, I update the UI accordingly and repeat the process for the next CPU player. I have a total of 3 CPU players and when their turns are finished I switch back to the player.

I have this working good and I can go back and fourth between the players turn and the CPU players turns. Its quite nice and simple and works perfectly so far. All I need to do is tweak it so the game is challenging and fun at the same time.

Once that is complete, I have 11 issues right now I want to get through before I feel ready for beta testing. I have a couple sites in mind that I would like to use, Gaming Betas and Alpha Beta Gamers. I haven't look into them a lot yet but they seem promising. If anyone has used either of them, please let me know your experience.

Until next time

Game On

Sign in to follow this  


Recommended Comments

There are no comments to display.

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now
  • Advertisement

Important Information

By using GameDev.net, you agree to our community Guidelines, Terms of Use, and Privacy Policy.

We are the game development community.

Whether you are an indie, hobbyist, AAA developer, or just trying to learn, GameDev.net is the place for you to learn, share, and connect with the games industry. Learn more About Us or sign up!

Sign me up!