Commodore 64 Role Playing Games

The series continues with discussing and analyzing old school role playing games in general from the Commodore 64 Marathon Game series. One of the earliest Basic RPG games was called Template of Ashphai. I found this game interesting since it followed pretty much the same rules for RPG (Role Playing Game) adventures where you navigate through a world, take out conflicting enemies, utilize magic, and accumulate points for experience.

The second game I reviewed is Ultima IV Quest of the Avatar. This was created by Lord British and Origin Systems in the early 80’s. It became so popular that it was ported to many different systems which included the Apple, Atari, Tandy, and even the PC computers of that age. The crossover was incredible for a game in that generation.

Some of the concepts I like about this game is that it has a view-port where the character can navigate through a map, utilizes animation, has character interaction, keeps stats active on the screen, background music, and even contains a built in parser that keeps track of input from the user. As the character moves the location scrolls in the input panel.

The last game that I focused on was Telengard. This was yet another game that became famous and was programmed for many other systems for that era due to its’ popularity. My goal is try to emulate and extract various components from other RPGs, while finding a new direction of creativity as well.

Telengard made heavy use of Commodore’s multi color sprites, while the other games utilized character graphics instead. It also allows direct communication with the keyboard to control outcomes for the player. What was especially interesting however, was that the game stats that were common with role playing adventures of that time, were constantly displayed on the screen. The player could also go up and down stairs, and even succumb to falling into a hole once in a great while.

I hope so far that the Commodore 64 Marathon Game is interesting. Feel free to leave comments below. 🙂

Commodore 64 Marathon Game Explained

Now it’s time to begin writing some more code. In this example I wanted to utilize the ability to save game stats to disk so they could be retrieved later. This also allows a player to start back off at a saved location instead of starting from scratch.

So first let’s initialize the screen colors and setup the game variables. The first sample code is here.

10 REM EXAMPLE 3
15 REM 2/10/19
20 :
30 PRINT “{clear}”:POKE53280,2:POKE53281,0
40 NM$=”STEVE”:RN$=”OFFICER”:SS=320:DX=250:IN=200:SK=1:PO=1:KN=3
55 GOSUB600:GOSUB810

The variables are defined as follows:

NM$ – Name of Player
RN$ – Rank of Player
SS – Player’s strength
DX – Dexterity of Player
IN – Intelligence of Player
SK – Skill Level
PO – Potions obtained
KN – Knowledge of Player

Next I started setting up the main display to show the game player’s statisics.

600 PRINT “{home}{white color}”
610 PRINT “{down arrow}{down arrow}NAME: “NM$
620 PRINT “{down arrow}{down arrow}RANK: “RN$
625 PRINT “{down arrow}{down arrow}STRENGTH: “SS
630 PRINT “{down arrow}{down arrow}DEXTERITY: “DX
640 PRINT “{down arrow}{down arrow}INTELLIGENCE: “IN
650 PRINT “{down arrow}{down arrow}SKILL: “SK
660 PRINT “{down arrow}{down arrow}POTIONS: “PO
670 PRINT “{down arrow}{down arrow}KNOWLEDGE: “KN
700 RETURN

Commodore 64 Get command

After this I decided to spice up the look of the Commodore 64 Marathon Game by adding game colors to the text displays. Also there is a key input routine that waits for the user to press the space bar before continuing. The code is below

810 PRINTTAB(8)”{down arrow}{yellow}PRESS SPACE TO CONTINUE”
820 GETA$:IFA$=” ” THEN RETURN
830 GOTO820

Commodore 64 I/O Errors

Next I needed to keep track of Commodore’s I/O (Input/Output) error messages since the program was accessing files on the disk drive.
60 OPEN15,8,15
65 GOSUB500:REM CHECK FOR ERRORS
500 INPUT#15,EN,EM$,ET,ES
510 IFEN>0THENPRINTEN,EM$,ET,ES:STOP
520 RETURN

Then I began the writing process for the game data as seen below:

70 OPEN2,8,2,”@0:ROLEDATA,S,W”
80 PRINT#2,NM$:PRINT#2,RN$
82 PRINT#2,SS:PRINT#2,DX
83 PRINT#2,IN:PRINT#2,SK
84 PRINT#2,PO:PRINT#2,KN
85 PRINT”{clear}”:PRINT
90 PRINT”WRITING…”NM$
92 PRINT”WRITING…”RN$
93 PRINT”WRITING…”SS
94 PRINT”WRITING…”DX
95 PRINT”WRITING…”IN
96 PRINT”WRITING…”SK
97 PRINT”WRITING…”PO
98 PRINT”WRITING…”KN

Clearing Commodore 64 Game Variables

The next thing to do was to setup an area where the game variables can be wiped from memory. That was utilized to ensure that the game data is being saved and can be restored for later usage.

110 REM CLEAR VARIABLES & CLOSE FILE
112 NM$=””:RN$=””:SS=0:DX=0:IN=0:SK=0:PO=0:KN=.
113 CLOSE2

Reading Commodore 64 files from Disk

Since we have recorded our game statistics in a recorded format on a disk, we will now learn how to recover that data and read it back into our program’s memory. The Commodore 64 allows you to create a separate sequential (SEQ) file for this.

114 REM READ FILE
115 :
120 OPEN2,8,2,”0:ROLEDATA,S,R”
130 GOSUB500:REM CHECK FOR ERRORS
140 INPUT#2,NM$:INPUT#2,RN$
142 INPUT#2,SS:INPUT#2,DX
143 INPUT#2,IN:INPUT#2,SK
144 INPUT#2,PO:INPUT#2,KN

After the variables have been successfully read back into memory, we can finally display them to the user.

150 PRINT”{clear}”
160 PRINT”{up arrow}READ VARIABLES BACK INTO MEMORY”:PRINT
170 PRINT”{yellow}YOUR NAME IS {white} “NM$ “.”
175 PRINT”{yellow}YOUR RANK IS {white} “RN$ “.”
176 PRINT”{yellow}STRENGTH IS {white} “SS “.”
180 PRINT:PRINT”{yellow}YOU HAVE A DEXTERITY OF {white}”DX “{yellow}AND POSSESS A SKILL OF {white}”SK
182 PRINT”INTELLIGENCE LEVEL: “IN
183 PRINT”{yellow}POTIONS ON HAND {white}”PO
184 PRINT”{yellow}KNOWLEDGE IS CURRENTLY AT {white}”KN
190 CLOSE2
200 END

In this lesson you learned how to create variables that could be written to a diskette, recovered, and displayed on the screen afterward. I hope you learned something new today. As always please be sure to bookmark this page, share it with your friends, and leave any comments below in the Facebook area. Thank you.

Get Connected!
Come and join our community. Expand your network and get to know new people!
No posts found.
No posts found.