On this site a fellow with the username "ibol" describes his new game, designed in the spirit and style of old text-based 8-bit games and modelled specifically after the classic game "Rogue." He had made what he called a "rogue-like" game in only 20 lines of Dark Basic code. Here's an example of his first few lines of code:
DIFF=0 : set display mode 1024,768,32 : set text font "copperplate gothic bold" : set text size 32 : hide mouse : sync on : sync rate 0 : sync : dim L(10,4) : restore : for t=1 to 10 : for u=1 to 4 : read a : L(t,u)=a : next u : next t : dim m$(14,2) : for t=1 to 14 : read a$,b$ : m$(t,1)=a$ : m$(t,2)=b$ : next t : DIM w$(20) : for t=1 to 20Since I'm always on the lookout for ways to expand the limited software library of the MC-10, I thought it would be nice to add a "rogue-like" game to its stable of programs. Since it was only 20 lines of Basic, I though it shouldn't be too difficult to convert. The picture of the game also boded well, as it only used text symbols and was not that wide.
read a$ : w$(t)=a$ : next t : depth=0 : rank=1 : XP=0 : Gold=0 : Wep=10 : Arm=10 : HP=40 : Kills=0 : center text 512,240,"GRAIL OF THE GODS" : center text 512,600,"press any key to begin!" : sync : wait key : cls : for t=1 to 10 : ink rgb(L(t,2),L(t,3),L(t,4)),0 : read a$ : text 100,t*50,chr$(l(t,1))+" - "+a$ : next t : text 100,600,"use arrow keys to move" : sync : wait key
come_here: : inc depth : fail=0 : dim m(22,22) : dim n(22,22) : for x=1 to 20 : for y=1 to 20 : n(x,y)=0 : if x=1 or x=20 or y=1 or y=20 : m(x,y)=1 : else : m(x,y)=0 : endif : next y : next x : repeat : repeat : inc fail : x=rnd(19)+2 : y=rnd(19)+2 : p=0 : q=0 : for t=x-1 to x+1 : for u=y-1 to y+1
if m(t,u)=1 : inc q,(2^p) : endif : inc p : next u : next t : if q=2 or q=3 or q=6 or q=7 or q=8 or q=9 or q=32 or q=36 or q=72 or q=73 or q=128 or q=192 or q=288 or q=292 or q=384 or q=448 : m(x,y)=1 : fail=0 : EXIT : endif : until fail>500 : until fail>500
The dungeon itself was only 20 characters wide, leaving 12 characters on an MC-10 screen for the text on the left hand side. The first thing I had to do was take the code and convert it to all uppercase (using MSWord's change case menu function), provide line numbers and limit each line of code to the 128 max line length of the MC-10's version of Basic (the Coco has 255 characters to play with). Second I had to convert the more advanced control structures like WHILE/WEND and IF/THEN/ELSE/ENDIF to their interpreted basic equivalents. Third, ibol made extensive use of the MOD/% command function (Modulus=only the decimal remainder of a the division of two numbers), which the MC-10 lacks, so I had to search out what this function was and how to recreate in Microcolor Basic. Finally, I had to weed out all the special commands dark basic has, which make it a special game development language, such as commands that update the screen in a single action after a sequence of commands that manipulate the screen have been executed. I also had to, in the end, fiddle with the size of the dungeon a little in the vertical axis, as it is 20X20 in the original, which obviously would not fit the MC-10's 32X16 screen size.
At the core of the game was a neat little algorithm for generating the random mazes, with a pattern that allows access from the centre of the maze to all outside edges of the maze. This is a difficult kind of maze to generate, and ibol had figured out a neat way for doing this quickly. However, it was not so speedy an algorithm that an original 8-bit machine could calculate a new maze in a reasonable amount of time. No matter how much I used my techniques (described in prior posts) to wring speed from interpreted basic (no ifs, just on/goto/gosub statements, etc.) I couldn't get the time below 5 minutes at regular speed. This was not so much of a problem in the development stage because I generally use Emucompboy's excellent MC-10 emulator, which allows me to massively bump up the speed of my virtual MC-10. This is normally a great benefit because it allows me to make changes to the basic source code I work from in MS Wordpad, then use the "quick-type" function to read that text files quickly and directly into the emulator, type run and see the results of my changes without any of the normal delays as would happen on an original 8-bit machine (from declaring and loading variables, screen prep, etc). This makes developing programs for the MC-10 just like using the MS QuickBasic or Borland's Turbo Basic, which I have used quite extensively over the years. So, in order to make a game that was actually usable on the MC-10 I had to run the algorithm multiple times and generate a dozen maze maps as DATA statements, which then simply get randomly populated with stuff (monsters, treasure), rather than having fresh mazes made for each level. This was acceptable to me, as it is simply a part of the process of creating or adapting software to a beloved old 8-bit machine to have to accept certain limitations and quirks. The end result was a variation of ìbol's "Grail of the Gods" game that looks like this:
When it came time to develop my game DUNGEON CRAWL I was able to draw on some of the elements of this game, such as the way weapons get "used up" over time, the impact of armour on attacks, and its multiple levels. In the end, I found ibol's settings in regard to the impact of weapons and armour and the achievement of rank to be a little too generous, so I adjusted these to make the game a little less forgiving. Since doing that, I haven't won the game (I like my games to be challenging), but then again I haven't played it much since making these final changes. I would certainly appreciate any feedback on whether the game has been made too challenging. It can be found in Coco form in the file JGGAMES5.DSK or for the MC-10 at: https://github.com/jggames