Answered step by step
Verified Expert Solution
Link Copied!

Question

1 Approved Answer

working on Milestone 2 for this client server hangman game in java: Milestone 2 : The concept of Payloads will continue to be utilized Base

working on Milestone 2 for this client server hangman game in java:
Milestone 2:
The concept of Payloads will continue to be utilized
Base Payload for applicable items that only need client id, message, and type
PointsPayload for syncing points of players
Each payload will be presented by debug output
On session start (i.e., after ready check)
GameRoom loads the word list into memory from a text file for later use
On round start randomly pick word from list to guess
The correct word is chosen and removed from the in-memory list
The blanks are shared with all players
The strikes/hangman resets
Trigger Turn Start
On Turn Start
Pick next Player
Initially random, then round-robin
GameRoom Turn timer begins
During the turn
Client-side commands will process the users intention
Note: Commands will extract the data, wrap it in a Payload (or subclass) and pass it to the ServerThread
Note: ServerThread will interpret the payload, extract the data, and pass it to the necessary GameRoom method
Note: GameRoom will do the actual command process
Note: The Client initiating the command will see the original message
/guess word
GameRoom will check against the correct word
If it matches (exactly)
The guesser will receive points for each missing letter and bonus points for solving (2x points for each empty space)
Points will be stored on the Player object
Sync the points value of the Player to all Clients
A message will be relayed that X guessed the correct word {word} and got {points} points.
The round should end
If it doesnt match
A strike will be incurred and synced to all Clients
A message will be relayed that X guessed {word} and it was wrong
Their turn should end
/letter letter
GameRoom will check the occurrences of the letter that havent been guessed this round
If any matches
The guesser will receive points for each slot the letter appears in if its not been previously guessed for this word
I.e. points times number of matched letters
Points will be stored on the Player object
Sync the points value of the Player to all Clients
A message will be relayed X guessed {letter} and there were {number}{letter}s which yielded {points} points.
Their turn should end
If no matches,
A strike will be incurred and synced to all Clients
A message will be relayed X guess {letter} letter, which isnt in the word
If strikes reach the limit the round ends
If strikes dont reach the limit the current Players turn ends
/skip
Skips the players turn if its their turn
Ends their turn
On turn end
Condition 1: Turn ends when Player guesses a letter or word
Condition 2: Turn ends Turn Timer expires
Condition 3: Turn ends when the current Player Skips their turn
Trigger turn start logic (if session end condition not met)
On round end
Condition 1: Round ends when word is completed
Condition 2: Round ends when Hangman Strikes reach limit
Send the in-progress scoreboard to all clients sorted by highest points to lowest
For this milestone itll just be a basic message
Trigger round start logic (if session end condition not met)
On session end
Condition: Session ends when X rounds have passed
Send the final scoreboard to all clients sorted by highest points to lowest
For this milestone itll just be a basic message
Include a game over message
Reset the player data for each client server-side and client-side (do not disconnect them or move them to the lobby)
A new ready check will be required to start a new session
I have many of the files just edits on where to make them is confusing

Step by Step Solution

There are 3 Steps involved in it

Step: 1

blur-text-image

Get Instant Access to Expert-Tailored Solutions

See step-by-step solutions with expert insights and AI powered tools for academic success

Step: 2

blur-text-image

Step: 3

blur-text-image

Ace Your Homework with AI

Get the answers you need in no time with our AI-driven, step-by-step assistance

Get Started

Recommended Textbook for

Concepts of Database Management

Authors: Philip J. Pratt, Joseph J. Adamski

7th edition

978-1111825911, 1111825912, 978-1133684374, 1133684378, 978-111182591

More Books

Students also viewed these Databases questions

Question

=+a) What is the maximin choice?

Answered: 1 week ago

Question

When should you avoid using exhaust brake select all that apply

Answered: 1 week ago