0.9.2
Pre-releaseBug Fixes and Improvements
This document outlines the bug fixes and improvements I made to the Bash script game during its development process. These changes focused on enhancing the user experience, providing clearer feedback, and ensuring the game functions as intended.
Core Issues and Fixes
-
Messages Disappearing Too Quickly:
-
Problem: Game messages (such as earning money, buying items, event outcomes) would disappear almost instantly because they were immediately followed by
clear_screenor a return to the main menu loop. Players had no time to read the results of their actions. -
Solution:
- Initially,
sleepcommands were used to add pauses, but this did not give the user control over when to continue. - I switched to using
read -n 1 -s -rafter each message that needed to be paused. This command reads a single character and waits for a key press, effectively pausing the script until the user presses any key. - I then replaced
read -n 1 -s -rwithread -p "Press Enter to continue..."giving the user a clear prompt on how to continue.
- Initially,
-
-
Inconsistent or Unclear Messages:
-
Problem: Some game messages were vague, inconsistent, or didn't provide enough context for the player. For example, "Not enough cash to buy a gun" didn't specify which gun.
-
Solution:
- Refined messages to be more consistent in tone and formatting, aiming for clarity and conciseness.
- Added more context and specifics in messages, like specifying which gun the player was trying to buy.
- Used more direct language in prompts (e.g., "Enter your choice (number):" instead of just "Enter your choice:").
- Included additional details in messages (e.g., the outcome of the race, the damage the player took, the amount of money the player earned).
-
-
Error Handling for Invalid Inputs:
-
Problem: If a player entered text instead of a number when asked for a menu choice, the game would either break or not provide clear feedback.
-
Solution:
- Added validation checks to ensure that the user entered a number when a number was expected. For example, before using a choice, I use
if ! [[ "$choice" =~ ^[0-9]+$ ]], which tells the user if the input is invalid. - Included a "Press Enter to continue" after the error message so that the player can continue the game.
- Added validation checks to ensure that the user entered a number when a number was expected. For example, before using a choice, I use
-
Other Minor Fixes:
- Removal of unnecessary sleeps: In order to streamline the game flow, I removed most of the
sleepcommands in favor of thereadcommand that prompts the user to continue. - More specific messages: Error messages like "Not enough cash to buy a gun" were changed to include the gun name, so the user knows what they are trying to buy.
Summary
The bug fixes I implemented were focused on three main areas:
- Messaging: I ensured messages are clear, consistent, and provide enough context for the player to understand their actions and the game's state.
- Pauses: I used read commands so that the messages are readable instead of disappearing immediately.
- Input Validation: I added input validation and feedback to prevent the player from getting stuck because of invalid input.
By addressing these issues, I significantly improved the user experience, making the game more understandable, playable, and enjoyable.
Full Changelog: 0.8.9...0.9.2