Thursday 1 July 2021

Walter Bright's "Empire" in Basic: Updates

Once again I'm indebted to my son Charlie for making invaluable suggestions for the improvement of the game.  The main one is that he pointed out some inconsistencies in the movement of units.  I hadn't made it so that an attack on a unit was counted as a "move."  Nor had I made it so that an attacking piece, if possible was to occupy the space of the defeated unit.  In our first attempt at a real game together, Charlie pointed out that this would allow a unit to launch an attack, and then effectively outrun any attempt at pursuit by nearby enemy units.  So I made some major revisions that now mean when an attack is launched, the winning piece will, if possible,  occupy the space of the unit being attacked.  Also, for units with higher than 1 Str, attacks will continue until a resolution of combat has been determined.

Of course this also pointed towards other issues.  If an attack was launched by an Army unit from the shore on a sea unit, what happens?  The rule document I was working from noted this possibility.  It explicitly states that even if an army unit is victorious over a naval unit, it is "drown."  So I added that feature too.  The naval unit, of course, in reverse, can't occupy an army's space, but a move is at least registered for it.

A similar problem of movement was also noted by Charlie.  I hadn't registered it as a move when an army was disembarked from a Transport onto the shore.  Each army started with a fresh move count.  But as he pointed out to me, this could mean that an army could be disembarked to reveal areas of coastline, then reembarked, the Transport moved down the coast, and repeat.  It's little things like these that I often overlook, but Charlie, with his mathematical mind,  notices right away.

Charlie also requested and contributed some aesthetic changes.  Not having been raised on the MC6807 screen, he didn't like the fact that the normal uppercase characters of the first player blended into the green colour of the ground.  He felt this was like ships "carrying around" pieces of ground with them. It also made it hard to distinguish where channels were.  So I changed to the alternate text colour set.  This way the units of both players are separate from the green land colour, and the message bar at the bottom of the screen is also distinguished from the land.  Of course, because of quirks of the MC-10, this makes playing sounds problematic, because their use automatically switches the VDG back to the regular text mode.  So I changed the beep I had been using to provide feedback for key presses. This beep was necessary because sometimes minor delays could make it seem like a key press hadn't registered.  So I used POKE commands for a key click that doesn't switch the VDG back to regular text mode.  Charlie also provided some musical refrains for victories and defeats.  So the screen flashes back to regular mode briefly for these.

Finally, Charlie pointed out that if two players were physically present with each other during play, they would be able to glimpse the screen of the opposing player between turns, after a player had hit Y to the "End Turn" prompt.  So now, there is an intermediate pause screen, which also prompts the user with the possibility of quitting and saving the game.  This addition was good, because previously I had not given any notification of the game save feature.

I was able to have memory space for all these changes because I had noticed that I had assigned the main string array elements directly using their numbered variable elements, like this:

M$(30,2)="......

Instead, I switched to DATA statements, which I just READ at the beginning using a simple FOR/NEXT loop:

DATA"....

I had forgotten that Microsoft Color Basic is smart enough to assign strings initialized in this way, simply by pointing to the original READ location of the string, rather than using string space.  Then, when I POKE these strings with new information, the string in the DATA statement in the source code is modified in memory.  This change gave me an extra 500 bytes or so, which allowed for more elaborate messaging, and the updates described above.

All these updates can be viewed on my Github:

https://github.com/jggames/trs80mc10/tree/master/quicktype/Strategy%20%26%20Simulation/Empire

Thanks to Charlie, who is off to Halifax to look for work and begin his life away from home. I'll miss his invaluable contributions to my programming efforts, but he's off to pursue programming efforts of his own.  God speed my boy!

The game "EMPIRE" can be played online here: http://faculty.cbu.ca/jgerrie/MC10/JG_MC10.html


No comments:

Post a Comment