Tuesday, 19 September 2023

"Third World War" by Free Game Blot (1985)

This game is a conversion of a BASIC program made by "Free Game Blot" for the Matra Alice to its cousin system, the TRS-80 MC-10.  The game is called "World War 3" in its docs, but "Third World War" on the game title screen. The original program used high resolution graphic images to represent tanks and artillery units, although the artillery symbols really look more like infantry rifles, which leads me to think that the documentation and programming teams were quite separate entities at Free Game Blot. I have replaced the high res symbols in my version with low res graphic characters. I used an L-shaped block character for tanks, and diagonal line block character for artillery units.The flag graphics from the intro screen have also been re-rendered using low res semigraphic-4 character graphics.

Fancy hires unit display of Alice version

The game is a kind of combination of Risk and Battleship. Like Risk, you must maneuver military units on a map, combine and split units, and engage in combat with enemy units to conquer spaces on the map. Like Battleship, the map takes the form of a grid and you cannot see the enemy units.  Instead you must rely on the limited reports of scouts and captured soldiers, who can tell you about specific spaces.  Also unique to the game, units can have different levels of morale, which influences their effectiveness

In addition to the graphics, the computer uses musical refrains to indicate which of the sides is victorious.  Since the Alice shares with the MC-10 only the simple Microsoft BASIC SOUND command it was not very difficult to translate those refrains.  However, the Alice uses a much more feature-rich but complex Thomson graphics chip that also allows 40X24 and 80X24 text screens. Many machine language subroutines had to be used to allow these graphics to be displayed on the Alice.  After much trial and error I was able to strip out these routines and replace them with a simpler set of PRINT@ commands using low res block graphics of the MC-10's 32X16 text screen (and the Alice, when it is in 32X16 "MC-10 mode").

To figure out the conversion process I had to translate (with the help of Google) the instruction sheet from French (The Alice was an early French 8-bit home computer developed from the Tandy MC-10). Here are those instructions (with some added notes by me in red):


WORLD WAR THREE 

By Free Gameblot

Au debut de chaque bataile, vouse et votre ennemi (l'ordinateur) disposez de 18 unités chacun. Vospositions, artillerie et chars sont dessinees sure un échiquier de 45 cases reérees verticament de A a E et horizontalment de 1 a 9. Seuls vost poistions sont visible a l'ecran, celles de l'ennemi demeurent invibles. Le but de jeu consiste a aneantir toutes less armées adveses en ayant le minimum de perts possible.


1) Description des unités: 1. l'artilerie, reprsentée par les fusils; 2. les blindés, par chars.  Moral des troupes: a chaque unité est associé un niveau de moral: N: moral normal; F: moral fort. Le moral des troupes est déterminant dans un combat. Par example, deux artilleries avec un moral fort ont beaucoup de chance de remporter un compat face à une unité de blindés au moral normal. Le moral de vos unités est variable en fonction des combats livrés. Si une troup au moral normal remporte une bataille, son moral devient automatiquement fort. Inversement, si une troupe au moral fort perd une bataile, son moral devient normal.

Les combats se font avec les déplacements de vos unités. Il n'est donc possible de déplacer au maximum que le nombre d'unités inqiqué sur une position de l'échiquier.


2) Déplacement des troupes.

Les positions sont repérpées horizontaiement et verticalement. Il est donc possible de déplacer ses unités latéeralement, verticaiment ou en diagonale, mais toujours à partir d'une case contigue.

Pour déplacer les unités, indiquez d'abord la position d'origine (lettre puis chiffre), puis la position finale (lettre puis chiffre).

Enfin, indiquez par un chiffre 1 de à 4 le nombre d'unités à déplacer.

Ce nombre doit être inférieur ou égal au nombre d'unités indiqué sur la position concernée.

Il est possible de regrouper vos unités sur une même position, mais à condition de ne jamais dépasser 4 unités par case.

Les regroupements de troupes ne peuvent se faire qu'avec des troupes de même arme, c'est-à-dire artillerie avec artillerie ou blindés.

Les regroupements avec des unités au moral différent (F et N) entrainent automatiquement des unités au moral normal (N).


3) Les Eclaireurs.

Avant chaque déplacement, vous devez envoyer un éclaireur sur l'échiquier pur essay de repérer les positions ennemies. Il est prudent d'envoyer l'éclaireur à proximté de vos positions pur déjourer toute tentative ennemie. Ses indications sont précieuses: 

- Nothing to report: Rien à signaier, pas d'unité ennemie sur la case désignée.

- Champs de mine: tout déplacement sur cette case entrainera une destruction de votre unité déplacée.

- Une position ennemie, l'enemi a des troupes sure cette case, l'éclaireur vous indque alors le nombre d'unités, le type de l'armée (artillerie ou blindés), et le moral des troupes.

- Un prisonnier a parlé: vous avez capturé un prisonnier qui vous révele less positions de l'ennemi, mais sans doner de quantité.


4) Les coups de main et les accrochages.

Les coups de mainadverses peuvent survenir à tout moment et se soldent par des gains si des perts d'unités pour vous et votre adversaire.

Si vous restez maitre du terrain, vous conservez la position acquise. Si l'ennemi gagne cette bataille, vos troupes disparaissent de la case et celles de l'ennemi prenent leur place sur l'échiquier.

Si vos unités remportent une bataille, leur moral se renforce. Dans le case contraire, il devient (ou il resté) normal.


5) Fin du Jeu.

La guerre se poursuit jusqu'à la destruction totale de vos unités ou de celles de votre ennemi.

A vous de déplacer judicieusment vos troupes au bon moment pour détruire le maximum d'unités ennemies. Mais attention aux contre-attaques de votre adversaire... Bon Courage!


ENGLISH INSTRUCTIONS

At the start of each game, you and your enemy (the computer) have 18 units each. Your positions, artillery and tanks are drawn on a board of 45 squares labelled vertically from A to E and horizontally from 1 to 9. Only your positions are visible on the screen, those of the enemy remain invisible. The goal of the game is to annihilate all the opposing armies with the minimum possible losses.


1) Description of units:

1. artillery, represented by an upper angled graphic piece;

2. armored vehicles, represented by lower angled (L-shaped) graphic piece.

Troop morale: each unit is associated with a morale level: N: normal morale; S: strong morale. The morale of the troops is decisive in a fight. For example, two artillery units with strong morale have a good chance of winning a match against an armor unit with normal morale. The morale of your units varies depending on the battles fought. If a troop with normal morale wins a battle, its morale automatically becomes strong. Conversely, if a troop with strong morale loses a battle, its morale becomes normal. (Note: This instruction is confusing as all battles are resolved with one side or the other being annihilated in the particular square of the grid. In other words, there is no possibility for units to "become normal" again after "losing.")

Combat takes place with the movements of your units. It is therefore only possible to move a maximum of the number of units indicated on a position on the board.


2) Troop movement.

The positions are marked horizontally and vertically. It is therefore possible to move your units laterally, vertically or diagonally, but always from a contiguous square.

To move the units, first indicate the original position (letter then number), then the final position (letter then number).

Finally, indicate with a number from 1 to 4 the number of units to move.

This number must be less than or equal to the number of units indicated on the position concerned.

It is possible to group your units in the same position, but on condition that you never exceed 4 units per square (Note: My son and I noticed in examining the code and playing the game that this limit doesn't appear to apply to the computer.  We both have seen groupings of 5 artillery-- a case of do as I say, not as I do?  Perhaps it is a accommodation to help compensate for the computer's weak AI?)

Troop groupings can only be done with troops of the same weapon, that is to say artillery with artillery or armored vehicles with armored vehicles.

Groupings with units with different morale (S and N) automatically result in units with normal morale (N). (Note: I have found that the game allows strong morale units to join with normal morale units with the high morale preserved, but if normal morale units join with strong morale units, the morale returns to normal-- I am not sure if this is a bug or a feature)


3) The Scouts.

Before each move, you must send a scout onto the board to try to locate enemy positions. It is prudent to send the scout near your positions to thwart any enemy attempts. His indications are vital:

- Nothing to report: Nothing to report, no enemy unit on the designated square.

- Mine fields: any movement on this square will result in the destruction of your moved unit.

- An enemy position, the enemy has troops on this square, the scout then tells you the number of units, the type of army (artillery or armored vehicles), and the morale of the troops.

- A prisoner has spoken: you have captured a prisoner who reveals the enemy's positions to you, but without giving any quantity.


4) Hard strikes and skirmishes.

Main attacks can occur at any time and result in unit gains or unit losses for you and your opponent.

If you remain in control of the terrain, you retain the position acquired. If the enemy wins this battle, your troops disappear from the square and those of the enemy take their place on the board.

If your units win a battle, their morale increases. Otherwise, it becomes (or remains) normal.


5) End of the Game.

The war continues until the total destruction of your units or those of your enemy.

It's up to you to carefully move your troops at the right time to destroy as many enemy units as possible. But watch out for your opponent's counterattacks...

Courage!



ADDENDUM:

I think I found a bug in the code. A couple actually, although the first isn't really a bug as such, but perhaps more a calibration and game testing issue. I found the game impossibly/unfairly hard to win on levels 2 and 3. I thought this was just me being a crappy player, but having played quite a bit now and figured out some simple strategies (basically seeking local preponderance of force wherever and whenever possible, otherwise avoid combat), I realized the AI was just unfairly advantaged at level 2 and 3. The raw level numbers were used to weight the formula for determining the outcomes of battles and also in a latter check about who won (there's some "compounding weighting," as my son Charlie put it, going on). But on level 2 and 3 the scale is tipped way too far in favour of the computer AI. I found that 1, 1.3 and 1.6 worked better as a scale factor. On level 1 it  can be won by novices, 2 is a tough slog, and I haven't won 3 yet, although I think I came close once.  Charlie recommended getting rid of the double weighting, but I felt my re-scaling changed the game the least from the original, which is more in keeping with my preservationist goals, so I'm  sticking with it (for the time being).  Here's the edit:

350 A$="CHOOSE LEVEL (1,2 OR 3)?":JJ=7:II=4:FA=0:NM=128:GOSUB30000:A(0,0)=3:GOSUB9500
355 IFN<1ORN>3THEN360
356 NV=1:IFN=2THENNV=1.3
357 IFN=3THENNV=1.6
358 GOTO420

We also noticed that there is a compounding element to the combat formula involving a turn counter that slowly makes it more difficult to defeat the computer as the game goes on. This seems to be a way of encouraging making bold strikes at the beginning of the game, and discouraging simply meticulously avoiding combat until you can build a local preponderance of force.

The real bug in the code resulted in enemy units disappearing from the board. Random numbers for possible next move coordinates were generated, but the routine used a division by 2 operation that would sometimes result in .5 on some coordinate numbers. These would just get INTed out when used in checking the board array.  However, in some checks done to throw out coordinates, such as the one comparing the current coordinates with the newly generated ones to make sure they were not simply the same, they would sometimes not be discerned as being the same because some new coordinates would have a decimal number in them. This would allow a move to the very same location and then erase the old location (which was that same location) essentially wiping the units from the board. So I simply added INTs to the new random coordinate generator lines of the subroutine.  Here is the new code:

REM RANDOMLY MOVE ENEMIES
2100 S1=INT(S+(RND(8)-3)/2)
2110 IFS1<1ORS1>5THEN2100
2120 T1=INT(T+(RND(8)-3)/2)
2130 IFT1<1ORT1>9THEN2120
2140 IFS=S1ANDT=T1THEN1072
2150 IFTD(S1,T1)<>TD(S,T)ANDTD(S1,T1)<>0THEN1072
2160 D(S1,T1)=D(S1,T1)+D(S,T)
2170 TD(S1,T1)=TD(S,T):D(S,T)=0
2180 TD(S,T)=0:XD(S,T)=0:GOTO1072

I also fixed an improperly exited set of  FOR/NEXT loops, as this always worries me as possibly causing problems. And an unRETURNed GOSUB after you win.  The game would restart by jumping to the start of the main part of the program. I made it reRUN that line number instead so all variables and unreturned GOSUBs would be reinitialized.  Otherwise, if you played enough you might blow the lid off the RETURN stack.

I'll keep testing a little more to ensure that my fixes have worked and there aren't other bugs. On the whole, I'm a little underwhelmed with Game Blot's quality control and game testing performance. It seems this game had most of its effort poured into its fancy graphic interface, rather than the game itself.  Which is sad, because it's a simple but fun little text game when it works, even if its AI is, as Charlie puts it, a wee bit "stochastic parrot," whatever that means.