March MyGiantBrain magazine cover
Illustration of a boy looking at a giant cybernetic brain
  • © 2024 KrellStudios 0

MGB March Magazine

"WAR!"...it's just a card game

"WAR!" Is a simple card game that was inspired by a BASIC program from the late 70's.
The original source code is named "war.bas" and is contained in "BASIC Computer Gamed", edited by David Ahl and published in 1978. At the time microcomputers were becoming available for home use and most of them had some version of the BASIC programming language available. These games generally were completely text based and ran directly in an interpreted environment. Computer's like the Apple II and others introduced color graphics and AppleSoft BASIC, for example, included ways to combine text and graphics on the screen.

"WAR!" Is a simple game, but the goal here is to take a vintage game, study its logic and program flow, then try to recreate it in LIveCode. Since the game is quite trivial it almost begs for adding embellishments. In this first outing the game will emulate vintage game play in as simple a way as possible. The only real embellishments in this LiveCode version was to add a graphic image that serves as the splash screen when the game opens and to include a short menu in the menubar.

Here is the game screen for the current version:

MGB WAR! Game Screen

For this game it was helpful to write a specification outline. The following is the initial outline for this game:

Design the UI:

Stack Size: Set the stack size to 1024x768 pixels.
Card Display: Create a control (e.g., a field or an image) to represent the card for the player and the computer.
Input/Output Fields: Create fields for displaying messages, instructions, and scores.
Buttons: Create a "Start Game" button and a "Reset Game" button.
Initialize the Deck: Replicate the deck of cards using an appropriate data structure (e.g., an array).
Game Logic:
  • Shuffling the Deck: Implement a shuffling algorithm to randomize the card order.
  • Dealing Cards: Write the logic to deal cards to the player and the computer
  • Comparing Cards: Implement the logic to compare card values to determine the winner of each round.
Score Keeping: Keep track of the player's and computer's scores.
User Interaction:
  • Starting the Game: The "Start Game" button should initialize the game, shuffle the deck, and start the first round.
  • Resetting the Game: The "Reset Game" button should reset all scores and states to start a new game.
  • Continuing the Game: Implement prompts asking the user if they wish to continue after each round, as seen in the BASIC code.
Finalizing:
  • End of Game: Detect when the deck is empty or when the player chooses not to continue, then display the final score.
  • Polishing: Add any additional UI/UX enhancements, such as card animations, sound effects, or visual feedback for wins, losses, or ties.

Following this outline I was able to code most of the game fairly quickly.

Of course there is the endless tweak of layouts and adding niceties, but in relatively quick order I had an acceptable game. I consider this an "alpha" version for a number of reasons;

1. The game runs fine within the LiveCode IDE, but it has not been compiled as a standalone.
2. The game is designed only for a 1024 x 768 pixel stack size, so it has no code to make it responsive for other environments beyond what the LiveCode environment provides.
3. It has not been field tested outside of the local development environments (Silicon Mac and Intel Mac)

Future Goals:

Since this is a relatively small game in terms of code size it may be included in a larger game that allows the user to select from an assortment of games that are similar in size and scope. Several graphical enhancements in keeping with the 70's retro look of the game are enticing. A priority will be to include some type of mini graphical display, similar to pinball machines, where I can display a graphical representation of the state of game play in an entertaining fashion.

If you have the LiveCode development environment and would like to try out this game then go to the downloads page for the .zip archive: "WAR!".zip