Jump to content




Stratego: Science Fiction edition

game wireless

7 replies to this topic

#1 KnightMiner

  • Members
  • 61 posts
  • Locationattempt to index "location" (a nil value)

Posted 28 September 2015 - 05:12 PM

Stratego is a game where two armies of equal size fight, with higher numbers beat lower numbers, and neither team knows the identities of the other team's pieces. Now it is available in ComputerCraft, with this program being based off the Science Fiction versions, meaning you only have 30 pieces per team, along with having the unique spotter pieces.

Download

To download Stratego version 2.1, simply type the following command into a computer.

pastebin get YHSUmz42 stratego

Requirements
  • ComputerCraft version 1.74 or later
  • Two computers. Supported types including normal, pocket, and turtle, along with standard and advance computers. The two computers do not have to be the same type
  • A modem to connect the two computers, either wireless or wired works
Setup

To start the game, simply run the game with a first parameter of either "host" or "join", and a second parameter of the game name. If you are the host, you can provide an additional optional parameter between the first and second to load a save file. That save file will either contain pieces, or options for setup. If a file is loaded and it has pieces, the pieces and turn are loaded from that file, otherwise both players will be given the option to setup their pieces.

When setting up, simply click a space in the first three rows on your side, then type the piece to place there (it will write in the log how many pieces you have remaining of each type and total). You can also click a piece you already places to swap it for a different piece. Some pieces support alternate names, such as you can additionally use "!" for the 10, "F" for the flag, "B" or "*" for a bomb, and "1" for the spotter. If you want to remove a piece you placed, simply click it and send a blank string, and it will be removed. Once you finish, simply press the + button or type "done" into the console.

Using custom options, it is possible to change the locations of the lakes, the total amount of pieces, the total pieces to place, the required amount of flags, the amount of rows players can place pieces in, and even whether you play on the long or short side of the board. For a full list of available options and defaults, see here.

Once both teams are setup, the game will begin with red going first (or white on a standard computer). Red team will always be the host.

Rules

On your turn, you may move up to one of your pieces one space in any direction, simply by clicking it then clicking the destination. If you decide you don't want to move a piece after clicking, simply click it again and it will deselect. Pieces cannot move onto lakes or pieces on the same team, and if they move onto a space with an opponent's piece, the two will battle. In battles, the piece with the higher rank will win, defeating the other piece. If the two pieces have equal ranks, they both will die.

Some pieces have special abilities:
  • The flag cannot move and has a rank of -1. If your flag is captured, you lose the game
  • Bombs also cannot move, but they defeat nearly every other piece, having a rank of 11
  • Spies have a rank of 0, but can defeat the 10 if they are the attacker
  • 3's can defuse bombs, rather than being defeated like all other pieces
  • 2's can move as many spaces as wanted in one direction, though they cannot move over lakes or other pieces
  • The spotter has a rank of 1, but he has a special "spot" ability. If there is a piece in front of him either before or after his move (but not after a battle), you will be prompted to call the piece in front of him. If you are correct, the piece is defeated, no matter what its rank. If you fail, nothing happens, save your spotter's location being revealed. If you don't want to use this ability even though a piece is in front of the spotter, simply send a blank string as the call.
For more information, see this PDF of the rules.

Notes
  • If you are using a standard computer, you will be prompted to type in coordinates rather than be able to click the spaces
  • At the beginning of your turn, you may click the "+" button (or type either "menu" or "button" on a standard computer), and it will bring up the menu. If you type "quit", the game will quit. If you type "forfeit", you will lose the game (in case you run out of moves). If the string is blank, it will return you to the previous dialog. If you are the host, you have an additional option of "save" to save the game to a file then return to playing, or will be prompted to save the game if either you or the guest choose to quit.
  • I have not extensively tested this game, so there may still be bugs, hence the game being in a Beta stage. Please report any bugs you find to this thread, along with detailed steps to reproduce it.
  • This game does prevent some hacking, but it still may be easy to work around, as it is designed to be a fun game to play with friends.
  • The game supports configuration using a file named "stratego.cfg", which must be located in the directory you boot the game from (if anyone know a good way to check for the file in the same directory as the game instead, please let me know). Inside this file you can change the colors used by the game, the locations of elements and borders, names of teams and pieces, and a default file to load upon startup. For a full list of configuration options, see here.
Screenshots

Posted Image

More screenshots

Edited by KnightMiner, 12 December 2015 - 12:30 AM.


#2 Dahknee

  • Members
  • 1,808 posts
  • Location/home/da

Posted 28 September 2015 - 09:29 PM

I LOVE YOU FOR THIS

Can I help you make this online? so via http?????:D I love this game OMG, PM me if you want to?:D

#3 KnightMiner

  • Members
  • 61 posts
  • Locationattempt to index "location" (a nil value)

Posted 29 September 2015 - 04:41 PM

View PostDannySMc, on 28 September 2015 - 09:29 PM, said:

I LOVE YOU FOR THIS

Can I help you make this online? so via http????? :D I love this game OMG, PM me if you want to? :D
Thanks!

Online is an interesting idea, and it should work to just replace all rednet calls with an HTTP one (and poke the delays a bit). A place in between to store the data to send would be important, as sending it directly to another person's computer sounds like a bad idea.

#4 Dahknee

  • Members
  • 1,808 posts
  • Location/home/da

Posted 29 September 2015 - 10:49 PM

View PostKnightMiner, on 29 September 2015 - 04:41 PM, said:

View PostDannySMc, on 28 September 2015 - 09:29 PM, said:

I LOVE YOU FOR THIS

Can I help you make this online? so via http????? :D I love this game OMG, PM me if you want to? :D
Thanks!

Online is an interesting idea, and it should work to just replace all rednet calls with an HTTP one (and poke the delays a bit). A place in between to store the data to send would be important, as sending it directly to another person's computer sounds like a bad idea.

Not exactly, it would run async so you run requests and catch the events. so it would feel pretty much instant because you can send about send and receive about 4 requests a second? From my last test (my internet is pretty bad). But yeah just send me a message on here and we can talk about it!

#5 KnightMiner

  • Members
  • 61 posts
  • Locationattempt to index "location" (a nil value)

Posted 06 October 2015 - 12:34 AM

I just released an update to fix a bug where the game would freeze after setting up the pieces (due to lag). It also will now prompt to save the game if the host chooses "quit", in case you accidentally type "yes" instead of "save".

Edited by KnightMiner, 06 October 2015 - 12:42 AM.


#6 ExplosiveFerrets

  • Members
  • 51 posts
  • LocationSweden

Posted 04 November 2015 - 01:59 PM

Fun, you should really add HTTP instead of Rednet.

#7 KnightMiner

  • Members
  • 61 posts
  • Locationattempt to index "location" (a nil value)

Posted 12 November 2015 - 10:52 PM

View PostExplosiveFerrets, on 04 November 2015 - 01:59 PM, said:

Fun, you should really add HTTP instead of Rednet.
I'm planning on doing so, though I wanted to rewrite the turn structure a bit first (see below). Danny even offered to help above, so I think I will take him up on his offer.




I just released version 2.0 of Stratego, with some major rewrites and useful new features. Specific changes include:
  • The X button is now the + button, as it acts as a menu now rather than a quit prompt. The save option will no longer quit the game, rather it saves then lets you keep playing. It also includes a forfeit button in case you run out of legal moves.
  • Pieces now show when they are selected, and can be deselected by clicking them again.
  • Setup is revamped. Clicking a space with a piece and sending a blank string will remove the piece, and you have to click the + button (or type "done") to finish setup.
  • The game supports loading an options file to play a custom game type. Options include locations of lakes, amounts of pieces, whether a flag is required, and more. See the thread OP for more information.
  • The game now has an optional configuration file, which allows you to change the colors, change the locations of windows, choose a file to load on startup, define names for things, and more. See the thread OP for more information.
  • Some internal changes, such as the turn structure now sends just one rednet message per turn rather than per action, the input box is a window rather than coordinates, and lakes are internally stored as pieces, allowing the configuration stuff I mentioned eariler. Also more comments, I went a little crazy with the comments.

Edit: Updated to version 2.1 to fix a couple derps, specifically a crash when using a pocket or turtle computer and incorrect input box widths on the same systems (you can tell I did all my testing on standard computers). It also adds support for the game to be run in a multishell tab, as before the borders and log messed up a bit.

Edited by KnightMiner, 15 November 2015 - 10:11 PM.


#8 Dahknee

  • Members
  • 1,808 posts
  • Location/home/da

Posted 12 November 2015 - 11:19 PM

View PostExplosiveFerrets, on 04 November 2015 - 01:59 PM, said:

Fun, you should really add HTTP instead of Rednet.

I am going to help him add it :P As I made an online multiplayer API for my old RPG multiplayer game! :D





1 user(s) are reading this topic

0 members, 1 guests, 0 anonymous users