Envision, Create, Share

Welcome to HBGames, a leading amateur game development forum and Discord server. All are welcome, and amongst our ranks you will find experts in their field from all aspects of video game design and development.

[A++][REQ] Gomoku Minigame (五子棋)

Once again since I don't do this very often, I apologise in advance for any confusion this request may bring upon its readers. If you happen to notice something that could be elabourated on, please don't hesitate to respond to this thread.

Introduction

Yes, I'm back with another long winded script request that I'm absolutely certain only a few members will read! But fear not my fellow enthusiasts, for I have brought you something that is sure to earn you countless hours of entertainment, a gambling addiction and a few pounding headaches! In fact I'm so confident on the addicting nature of this game that I'm willing to bet a whole cookie that at least fifty (50) members will play and enjoy this minigame in the end. Anyway, enough with the overzealous introduction, let's get down to business.

What is Gomoku?

I would assume that most of you have played Tic-Tac-Toe at least once in your lifetime, be it as a child in grade school or a senior citizen on a walker. Tic-Tac-Toe is just the type of game everybody loves (am I right or am I right?). Well to put it as plainly as I can, Gomoku isn't that much different. In fact, the only real difference between the two is that Gomoku is played on a much larger surface, involves the use of coloured stones instead of "X's" and "O's" and requires that the winner must line up five (5) pieces in a row rather than three (3).

Now my initial idea was to post a request for a chess or Go (Weiki (圍棋)) minigame, but Trickster pretty much destroyed my dreams in regards to the amount/level AI that is needed to have those games function properly. *glares at Trick* So throughout my search of ancient Asian board games, I happened to stumble upon something that seems relatively easy to script. Hopefully you will agree with me as you read through the vast explanation.

Tools of the Trade

Before you consider taking on this request, you are probably going to need to know what is used in a game of Gomoku and what the rules are. As I've already said, all you need to play this game is the proper board (a standard Go board) and coloured stones (traditionally black and white). These are also the graphics that will go into the actual script.

http://img259.imageshack.us/img259/9507/gomokuboardqr0.png[/IMG]
http://img208.imageshack.us/img208/7627/blackdragonstoneet6.png[/IMG]
http://img208.imageshack.us/img208/9695/tantigerstoneus3.png[/IMG]
If you have never actually played a game of Weiki before, you might look at the board and say "what the fuck". This is perfectly understandable considering there are more tiles on this board than you are probably used to seeing. I assure you that it isn't as difficult as it seems. Just think of it as an oversized Tic-Tac-Toe board (with different object placements). Here is a demo board I quickly threw together to give you a better understanding of what a typical game looks like.

http://img255.imageshack.us/img255/2530/demogomokuboardeb5.png[/IMG]
Functionality and Piece Placement

You may have noticed from the demo board graphic that the piece placement isn't at all like Tic-Tac-Toe. In fact, the pieces seem to be placed at the tile intersections rather than directly in the center. Yes, this is true.

Black and white alternate between turns (black always goes first) by placing their individual pieces on the board at the tile intersections. Pieces cannot be played in the center of the tiles nor can they be played on the edges of the board.

http://img99.imageshack.us/img99/3930/correctstoneplacementro4.png[/IMG]
http://img201.imageshack.us/img201/3853/wrongstoneplacementfm6.png[/IMG]
http://img444.imageshack.us/img444/1883/wrongstoneplacement2qn9.png[/IMG]
http://img322.imageshack.us/img322/2131/playableareaiu5.png[/IMG]
I would also like to point out that the outside border of the green section is also playable (just not the edges of the board itself).

Rules and FAQ of Gomoku

Most of the following text is just to re-emphasize the rule structure of the game. My main reason for reinforcing these rules in the request is so that any scripter who wants to take this minigame and bring it to life can integrate the restrictions and allowances appropriately. It also eliminates the "huh, what?" factor.

No. Gomoku doesn't require any setup at all. Unlike most board games out there, all this one requires is that you have the appropriate board and playing pieces. At the start of the game, the board is completely blank until black makes his/her first move.
Yes, there are quite a few different variations of the game. For more information, you might want to read the Wikipedia article on Gomoku. However for this minigame, I'm just going to stick with the popular choice.
Both coloured pieces are placed at the intersections of the tiles. Pieces may not be placed in the center of tiles, nor can they be placed on the sides of the tiles.
Once a piece has been played, you cannot move it in any way nor can you "take back" the move. Once you put the stone down on the board, it stays there for the remainder of the game.
NO!
The winner is the first player to get an unbroken row of five stones horizontally, vertically, or diagonally.
Considering I learned how to play within five minutes, I don't think so.
*Interesting Note* Logically when playing Gomoku, black should always win due to the advantage the colour has over white at the start of the game. Of course this generally only occurs when black plays the game flawlessly (which is damn near impossible).

The Rules
  • Gomoku is a two player game. I suppose someone can play against themselves...but how much fun would that be?
  • When starting a game of Gomoku, the colour choice can be either up to the players (mutual agreement), or they can be randomly selected (take a single stone of each colour, shake them around in your hands and then hold your hands out in front of you. The opposing player then will blindly pick his/her colour).
  • Black always goes first. No exceptions.
  • Stones must be placed on the tile intersections (please see the diagrams way up at the top of this request for clarification).
  • Once a stone has been placed, it cannot be removed or moved from or around the board. The pieces stay in their respective positions until the game ends.
  • The winner is the first player to get an unbroken row of five stones horizontally, vertically, or diagonally.
http://img401.imageshack.us/img401/4048/towingr7.png[/IMG]
There are many variations of "broken rows" so I didn't put them all in the above graphic. I do hope you understand the intention though.

Gomoku Script for Xiao Dynasty

After reading all of that information I provided above this section, I hope you have a fairly intimate understanding the game. It isn't too incredibly difficult now, is it?

Now we are going to get into the meat of the request by having me explain some added features to Gomoku. This section will also provide you with the general layout/supporting windows of the minigame so there won't be any surprises come show time. Let's take a peek at a really weird mock up of this minigame.

http://img201.imageshack.us/img201/6427/colourkeyjq9.png[/IMG]
http://img308.imageshack.us/img308/2531/gomokumockupep3.png[/IMG]
You will notice the rather simple design of this script. This is mainly due to the fact that I'm going two hours on this request (making images as I go...). Anyway, there are four primary functions to this system. Let's look at them in some detail:

Command : New Game

New game is exactly that. When the player selects "New Game", a new game will ensue with his/her opponent. Simple enough right? Here are the restrictions to starting a new game.
  • When the player initially enters the minigame to face his/her opponent in a good old game of Gomoku, the switching will behave normally.
  • Player selects "New Game" and the cursor should automatically move down to "Move". The "New Game", "Gamble" and "Resign" commands become disabled.
  • The player is forced to move once on the board before commands "Gamble" and "Resign" are enabled. "New Game" is still disabled.
  • If the player wants to continue playing the game against his/her opponent, he/she must make a wager.
  • After wager as been entered, the frozen commands (with the exception of "New Game") will once again become active.
  • "New Game" remains frozen until the game is completed.
  • This process repeats itself until the game is completed.
Command : Move

The move command is quite simple. Once the player selects "Move", the cursor should move over onto the board so the player can play a piece.

http://img164.imageshack.us/img164/377/movelm0.png[/IMG]
Command : Gamble (AKA "Betting System")

Considering I want this to be a gambling game in my project, I've added the betting feature to the request. I would assume this to be fairly easy considering it is just like betting on blackjack.

http://img267.imageshack.us/img267/9245/gamblemy0.png[/IMG]
  • When the player selects the "Gamble" command, a new window should pop up just to the side of the initial command window.
  • In this window it should show the player's total "gold" and a number input box that would allow the player to bet money on the game.
  • Once the player has decided on an amount, he/she will then press 'Enter', which will bring up a confirmation box just below the the "Total Bet" window.
  • If the player chooses "Yes", then the amount he/she entered in the number input box would be deducted from his/her total gold.
  • If the player chooses "No", the number input box resets back to '0' so he/she can choose a different amount.
The gain and loss system for gambling is also fairly simple. Since the computer does not make a wager (EVER), the numbers solely depend on whether or not the player actually wins or loses the Gomoku game.
  • AI does not bet money.
  • If the player loses against the AI, the total amount of money the player bet will be lost.
  • If the player wins against the AI, the total amount of money the player bet will be doubled. So, if the player bet 500 gold on a game of Gomoku and won, the player would get 1000 gold in return. Make sense?

Command : Resign

When the player starts a new game and then wants to quit, he/she is going to have to go through the "Resign" command. Resigning a game works only one way:
  • If the player has already made a wager on a current game and decides to resign, the player will lose the money he/she bet.
  • The player then exits out of the minigame and back to the real game.
http://img238.imageshack.us/img238/5577/resignpj5.png[/IMG]
Woohoo! That takes care of the layout and features explanation! We are almost done here so hang in there with me for a little while longer.

Computer AI (Artificial Intelligence)

Scripters seem to hate the words "Artificial Intelligence". I can understand why so I'm going to make this brief.

There should only be one difficulty level for this game. What I had in mind was something like..."I shouldn't have moved there, shit" sort of AI. Intermediate. Not too easy and not too hard. Just in the middle. Sound good? GOOD! (I'm sorry for the lame explanation, I just don't know anything about AI).

Conclusion

Once again, I thank you for taking the time to read this request. If there is any point that may need more detail, or you are confused as to what I am asking, feel free to speak up.

~Ciao




 

Thank you for viewing

HBGames is a leading amateur video game development forum and Discord server open to all ability levels. Feel free to have a nosey around!

Discord

Join our growing and active Discord server to discuss all aspects of game making in a relaxed environment. Join Us

Content

  • Our Games
  • Games in Development
  • Emoji by Twemoji.
    Top