How about playing Crosswords against your friends over the Internet during the pandemic?
In order to test my network communication component (DzSocket) in certain circumstances, I developed a crossword puzzle in Delphi.
The game works in Client / Server mode, where one player must be the server, and the other players must connect to the server.
Thus, the server must have the TCP port on which the game operates released over the internet and also through the firewall.
The rest of the players will enter the remote server address and then connect to it.
It is also possible to play directly within a local network, without release external ports.
The game works as follows:
Once all players have logged in, the server commands the start of the game.
While waiting for the players, the server also has the option of defining some rules of the game, such as the size of the board and the number of letters that each player will keep in hand.
An important rule to be defined is whether or not there will be a player turn timeout. If there is no timeout, the player can take as long as it wants to make its move.
Once the game has started, the system will randomize the order of the players.
All players receive the same number of letters, which was previously defined in the rules.
The goal is to form as many words as possible, to make more points. When any player reaches the number of points also defined in the rules, the game is over and we have a winner.
At the end of their move, all other players must command acceptance of the words placed.
At this point there is a difference when playing with timeout enabled or disabled:
Timeout rule enabled: Any opponent who rejects the words will return the play to you, but you cannot change anything else, but simply indicate whether you agree or disagree with the rejection you received. It is also possible to argue via chat to reach consensus.
If you agree with the rejection, all the letters you have entered are removed from the board and returned to your hand, and you do not score any points. Your turn ends.
If you disagree with the rejection, return the question to all your opponents about accepting your words. During these steps, you can communicate via chat to reach common sense.
Timeout rule disabled: Any opponent who rejects the words will return the play to you, so you can revise the words, change or remove them until it is in line with what your opponents asked for.
When the player finishes his turn, he will receive back the same number of letters he used, always having the same number of letters in his hand again.
The game has a disconnect control, to avoid losing the entire game if any player loses the connection. If this occurs, the game is automatically paused, waiting for connections to be reestablished by the absent players.
Each connected user receives a code. If it loses the connection, it can return by entering this code when reconnecting. It is possible to obtain this code on the screen of users disconnected in the server environment. If the connection is lost, but the application does not close, this code will also be automatically filled in on the connection screen.
You can download the game and run it directly through Releases, or obtain and study the source code.
Send me suggestions or problems found. I will be happy to help.
Good day
I am doing a delphi PAT in grade 10 for my school…I was just wondering what tool you used for the grid/background
Thank you!
Hello,
I’m using canvas to paint game grid (background), drawing lines until making rectangles.
You can look at source code and search by canvas term.
Best regards