VIBORAS.bat: A multi-player version in color of Snake game

Discussion forum for all Windows batch related topics.

Moderator: DosItHelp

Post Reply
Message
Author
Aacini
Expert
Posts: 1596
Joined: 06 Dec 2011 22:15
Location: México City, México

VIBORAS.bat: A multi-player version in color of Snake game

#1 Post by Aacini » 06 Jun 2018 00:15

Six years ago I posted the first version of my Snake game program. Perhaps you never had heard about it, but I wrote such a program more than one year before Dave posted his popular one... My original Snake.bat program was written as an example of use of my auxiliary .exe programs. You may review it in the last part of this long post. On the other hand, popular Dave's SNAKE.BAT is a program that just uses native Batch commands.

This is an entirely new version of the Snake game that includes a lot of new features. This program is based on the PowerShell engines to read keys and show text in color fully described at this thread; you should review such a topic for any detail related to the input and output parts of this program.

Although the most obvious point of this program is that the game is now displayed in color, the most important feature is that now there may be several snakes in the board! The new game may be played by up to four players that controls a different snake each: #1-Yellow snake, #2-Green snake, #3-Magenta snake and #4-Cyan snake. The keys used to control each snake are evenly distributed on the keyboard, so up to four hands can freely press them with no interference: the four arrow keys (Up,Left,Down,Right) for snake #1, "WASD" keys for snake #2, "GVBN" keys for snake #3 and "OKL;" keys (in English keyboards) for snake #4, although this key assignment may be easily changed.

This feature converts the old (boring) single-player game in a very interesting one with up to three opponents and several aspects that improves the competition. You really want to play the game with more than one snake to realize how different and fun it is when compared vs. the original game. Anyway, even a single-player game can be greatly improved using the additional features of this new program.

Image

I called "VIBORAS.bat" this game ("snakes" in Spanish) in order to avoid any variation of the same "snake" word that may confuse it with any other program, and also to indicate that this is a different game. The inter-relation of several víboras in the same board allows a new set of game possibilities. For example, when a food appear in the board, the snake that is closer will eat it and this food will give a speed advantage to reach the next food, excepting if it appears much closer to other snake. When the game begins, the winning (larger) snake most depends on luck (the random positions where the foods appear), but when the snakes are larger and faster, the player that choose the shorter paths to new foods will ultimately win the game. If a non-intrusive mechanism that compensate the loosing snake is introduced, the game may be really fun!

If a snake unexpectedly turns into the path of another one, the other snake will crash and die if the player that controls it is not ready for this sudden change. If two snakes arrives to the same position at same time, the program logic moves the lower numbered one first; this detail may produce different results depending on other factors. For example, in a frontal collision of two snakes, if the number of positions between the snakes is odd, the lower numbered snake will arrive first to the center/collision point and the other snake will crash into it and die, but if the number of separating positions is even, then the lower numbered snake will crash into the other one and it will die instead. A large snake may kill another one if encloses it in a trap, so the other snake have not any free space to keep moving. All these situations may be further enriched or avoided introducing additional features in the game. I selected my own ideas for the method used to implement these features, like the possibility to stop or reverse the snake movement, or introducing different types of food that provides the snakes with new abilities.

The environment in which VIBORAS.bat program run requires a few manual adjustments in order to get the best experience. Although some adjustments could programatically be completed via code, the final result could not be satisfactory, so it's not worth to write such a code.

The main adjustments are the font selected in the cmd.exe window and the size of the playing board, but these adjustments depends on each other. Smaller fonts allows to use larger boards, but it could be difficult to visually identify individual lines and columns with such a small characters. Larger fonts are easier to view, but they limits the size of the board. The maximum possible size for the board is 128x63. Besides, these adjustment also depends on the maximum resolution of the screen in pixels.

You should always select a square font, like the preinstalled 8x8 raster font. You may also use "Terminal 12x12.FNT" or "Terminal 16x16.FNT" raster font files included in the VIBORAS.zip game package. To install these files copy them into "\Windows\Fonts" folder and answer Yes to "Terminal font is already installed. Replace it?" question.

There are a lot of new features in VIBORAS.bat program. The full documentation is in file VIBORAS.html. You should carefully read such a file in order to get the most of this program. However, you don't need to read anything to use the game in its basic form, just download the next .zip file, extract it and run VIBORAS.bat!

VIBORAS.bat version 1.0.zip
(35.05 KiB) Downloaded 136 times

Note that this is work in progress and that the current VIBORAS.bat program is a preliminary version. There are several planned features that are not yet implemented. Also, there are several obvious features that are missing, like the record of highest scores or the storage of a game in a disk file in order to continue it later. All these features should appear in future versions.

UPDATE 2018/06/11: The new VIBORAS.bat version 1.1 is ready. These are the changes in this version:
- A pause in the animation when a food is eaten was fixed
- Snake head character was added
- In "Terminal 12x12.FNT" and "Terminal 16x16.FNT" files the "<>^V" characters were modified
- The operation rules on food creation was simplified
- Turbo food was implemented
- Reverse food was implemented

VIBORAS.bat version 1.1.zip
(38.35 KiB) Downloaded 91 times

UPDATE 2018/06/30: Version 1.2 is here. These are the new features of this version:
- "exit" variable was implemented
- Snake reproduction was implemented
- Gate food planned feature was cancelled
- Lapse food was implemented
- "timeOut" variable new feature for food creation was added
- Simplified users manual in Spanish was added

The last planned features currently in development are Wall and Coral foods.

VIBORAS.bat version 1.2.zip
(50.55 KiB) Downloaded 97 times

UPDATE 2018/08/31: Version 1.3 with these new features:
- Several minor modifications that improves the efficiency was completed
- Multi-language messages (starting in English and Spanish) was added
- Create specification game files via an in game menu was added

VIBORAS.bat version 1.3.zip
(54.8 KiB) Downloaded 114 times

Please, report any bug or comment about this program you wish.

Enjoy it! :D 8)

Antonio

Aacini
Expert
Posts: 1596
Joined: 06 Dec 2011 22:15
Location: México City, México

Re: VIBORAS.bat: A multi-player version in color of Snake game

#2 Post by Aacini » 11 Jun 2018 12:08

A new version of VIBORAS.bat program is ready. These are the changes in the new version 1.1:
  • A pause in the animation when a food is eaten was fixed
  • Snake head character was added
  • The operation rules on food creation was simplified
  • Turbo food was implemented
  • Reverse food was implemented
Also, in "Terminal 12x12.FNT" and "Terminal 16x16.FNT" files the "<>^V" characters were modified. These characters are used in the snake head so it is suggested to install the new fonts and use they in the cmd.exe window for the best game experience, but before doing that be sure to unselect in cmd.exe any font that will be replaced, even if it is not open.

The new VIBORAS.bat version 1.1 files are placed in the first post of this thread, as usual.

Antonio

Aacini
Expert
Posts: 1596
Joined: 06 Dec 2011 22:15
Location: México City, México

Re: VIBORAS.bat: A multi-player version in color of Snake game

#3 Post by Aacini » 30 Jun 2018 22:40

The new VIBORAS.bat version 1.2 is here with several new features.

Image

The download .zip file is at end of the first post in this thread, as usual.

Antonio

PS - Is anybody out there? :| I would like to know about the bugs in this program!

penpen
Expert
Posts: 1669
Joined: 23 Jun 2013 06:15
Location: Germany

Re: VIBORAS.bat: A multi-player version in color of Snake game

#4 Post by penpen » 01 Jul 2018 23:44

Hi Antonio: Nice game!
(No bugs found so far in version 1.2.)

I think an ingame menue for setting up things like the player names, the amount of players, ... would be more intuitive instead of using game definition .txt files only; you could use a config file to define the actual setting (== active game definition file).
In addition you also could also create those game definition files from an ingame menue.

The "Movement control/modes" part in the "User's Manual" is confusing (to me):
"cursor: down - up" for "Turbo", "Normal" and "Slow"?


penpen

Aacini
Expert
Posts: 1596
Joined: 06 Dec 2011 22:15
Location: México City, México

Re: VIBORAS.bat: A multi-player version in color of Snake game

#5 Post by Aacini » 31 Aug 2018 08:45

penpen wrote:
01 Jul 2018 23:44
Hi Antonio: Nice game!
(No bugs found so far in version 1.2.)

I think an ingame menue for setting up things like the player names, the amount of players, ... would be more intuitive instead of using game definition .txt files only; you could use a config file to define the actual setting (== active game definition file).
In addition you also could also create those game definition files from an ingame menue.

The "Movement control/modes" part in the "User's Manual" is confusing (to me):
"cursor: down - up" for "Turbo", "Normal" and "Slow"?


penpen
@penpen,

Thanks for your comments. I used they to improve the game in the new version 1.3. When I was planning the game, I really want not to use any kind of inline menu to define game parameters because this menu would be a very extensive one, but it would never manage all the possible options that could be defined via expressions in a much simpler way. Anyway, I finally did it...

I hope that this simpler way to define game parameters allows to a more larger number of users test and use the advanced features of VIBORAS.bat game.

The new VIBORAS.bat version 1.3 zip file is at end of the first post of this thread,as usual.

Antonio

Post Reply