Microsoft MakeCode

Presenting: Salvo!

This week, I offer to you: Salvo! This probably will be my last game for a while. I do need to start writing the course. :smiley: Mad props to one of my best friends, Solar, for drawing some amazing ships for me. Have fun!

Play-through video:

http://somup.com/cqhufNnEiW

Multiplayer is local; JACDAC is not currently supported. Hardware hates this game right now. I’ll open a separate thread on that. It works on hardware, now, too! (URL has been updated with version 1.4.)

More info on the to-do list in a later comment.

Rules

If you are familiar with Milton Bradley’s Battleship, then Salvo! will be familiar to you. Players first place their fleet on their own boards. Then, in each round, players select locations on opponents’ boards to send torpedoes.

In each round, a player can fire as many torpedoes as there are ships in the fleet. Each player starts with seven ships, so players start with seven torpedoes per round.

When a player’s torpedo hits an opponent’s ship, the hit is registered with all players. Similarly, when a ship is sunk, all players will know about it.

The game ends when one player has eliminated all others, or when no players have ships remaining. (Yes, a draw is possible.)

Players should keep their fleet locations secret. Shot selection also should be done in secret, although players can form alliances if they wish. Thus, when there are multiple human players, each player should be permitted privacy when operating the game.

Fleet Configuration

Standard Salvo Fleet

Quantity Ship Size
1 Aircraft Carrier 5
1 Battleship 4
1 Cruiser 3
2 Destroyer 2
2 Submarine 1

TODO

  • [ ] Improve the AI (refer to function takeAiTurn).
  • [ ] Allow for randomized turn order each round (refer to function setTurnOrder).
  • [ ] Allow player to select fleet type used in the game.
    • [ ] Add an option screen.
    • [ ] Modify global variable fleetStyle.
  • [ ] Add JACDAC support.
  • [ ] Allow players to choose a randomized fleet placement (difficult).
  • [X] Add legend to shot selection screen. (Done - version 1.0.)
  • [X] Give option to show player boards at the end of the game. (Done - version 1.0.)

I’ll edit this post as updates occur.

4 Likes

So, I’m thinking that advanced students can take this game and make improvements, using the to-do list for inspiration.

The AI is intentionally dumb in this game. It just fires random shots. Modify the takeAiTurn function found in main.ts to make the AI more intelligent. Some ideas are provided in comments in that function.

A really easy one is to modify the turn order each round. Simply modify the setTurnOrder function in main.ts to do so. You could rotate turn order, randomize the turn order each round, set the turn order based on the number of ships remaining, or anything else that your heart desires. :slight_smile: Turn order doesn’t carry that much importance with the current gameplay - although you could alter the gameplay a bit to make the turn order more significant.

With the current structure for a round, players launch their torpedoes simultaneously at the end of the round, and then the results are presented on the summary screen. A challenging alteration to the gameplay would be to assess the shots at the end of each player’s turn, registering hits to everyone at that time, which would make turn order more significant (since a hit scored by the first player would be known by the second player to take a turn in that round).

Another alteration is to allow the players to select the fleet type used in the game. Add a new screen to the OptionScreenCollection object, and then save the setting to the fleetStyle variable (both found in main.ts). This requires students to read and then use an API - a skill that we all use every day. Two alternate fleet styles are already built into custom.ts: “classic” and “modern,” which use fleet configurations from the Battleship board game.

JACDAC and randomized fleet placement are pretty difficult. Actually, the implementation of randomized fleet placement would be rather straightforward; the AI already uses randomized placement. Incorporating it into the current UI, though, would be a bit more challenging, since all six buttons are already used when placing the fleet. Maybe use @jwunderl’s excellent button combination extension? Or add a prompt ahead of time? Up to you. :slight_smile:

Just some ideas. Feel free to take this game and run with it. Most importantly, have fun! Happy Friday and, for those of us in the U.S., have a great Memorial Weekend!

This gives us a tremendous amount to work with, Alex ! I do not have any students at present working at this level of computing knowledge but to just be able to show what they could learn .

1 Like

We have this working on hardware, now, too! Game URL updated above. Before downloading to your hardware, be sure to set the HARDWARE flag to true in main.ts (line 52). As of version 1.4, this is no longer necessary, as the flag is now set automatically.

Many thanks to Joey (@jwunderl) for the assistance! (For version 1.4, thanks, too, to @mmoskal!)

1 Like

@AlexK could you update salvo and rename the “settings” variable to something else? It seems that it is clashing with a new package for storing data on the device.

Yup! Already did that for Lemonade Stand; forgot about that for Salvo. I’ll upload a new version of both games this weekend that is compatible with beta.

Thanks for the heads-up!

@AlexK we are ready to upgrade the beta. Is your upgrade ready?

Yup! URL updated.

Thanks for updating the settings to allow me to edit. :slight_smile:

1 Like