Jump to content
bluejay

Help Programming Text Adventure in BASIC

Recommended Posts

I've started programming a text adventure game on my VIC-20 with BASIC, and I have little details(some big ones too) that I might need help on. For example, how can I make it so that if a player tries to use the "get" command in an empty field, how do I make it so that the game answers something like "There's nothing to get!"?

Share this post


Link to post
Share on other sites

Text adventures are best programmed as an engine, meaning a parser that takes input and breaks it up into actions and objects for the classic two-word game. Your data ideally are stored in DATA statements which are loaded into matrices on initialization. The data will consist of names of locations, possible exits and index to which items are available in each place, plus a separate list of actual items. When you initialize the game, everything ends up in those matrices, and as you pick something up, it moves from the matrix telling which objects are in a certain place to your inventory.

 

A little hard to explain by words, but either you could look around for engines or I could post an example engine I used to use which I found rather decent.

  • Like 1

Share this post


Link to post
Share on other sites

That's a great way to do it! I've always tried to treat it like a Choose Your Own Adventure book, & have never gotten that far.

 

10....

20 INPUT N$

30 IF N$ = "GO NORTH" THEN GOTO 175

Share this post


Link to post
Share on other sites
2 hours ago, pacman000 said:

10....

20 INPUT N$

30 IF N$ = "GO NORTH" THEN GOTO 175

This is exactly what I'm trying to do...

Yeah. Maybe I should use different methods.

Share this post


Link to post
Share on other sites

You don't have to use a two command system; you could give players a menu of options. If they choose "Search Area," & nothing's there, display "Nothing Found."

Share this post


Link to post
Share on other sites

My biggest, still not fully debugged and never released, text adventure on the C64 was about 60 locations. Implementing it as a CYOA book with tons of repeated IF statements and spaghetti code would have been an even bigger nightmare than it really was.

 

You could list some typical BASIC adventures or look up one of many tutorials in how to make one. Eventually I'll have some time to tidy up my code and be able to post it here, though I'm not saying I have the perfect solution.

  • Like 2

Share this post


Link to post
Share on other sites

You might want to checkout archive.org for some old digitized programming books designed for beginners/kids. These books give good examples of how you could design a BASIC game parser (standard 2-word verb, noun variety), how all the parts work together, and even includes a Haunted House game listing as an example of a working prototype.

 

There were several books within the series, with Write Your Own Adventure Program probably covering exactly what you would like to do.

 

https://archive.org/details/write-your-own-adventure-programs/page/n1

 

 

  • Like 1

Share this post


Link to post
Share on other sites

 

There is also:

Creating Adventure Games on Your Computer
Golden Flutes & Great Escapes: How to Write Adventure Games

http://69.60.118.202/generic/generic-books-games.htm

 

I had both Creating Adventure Games on Your Computer and Write Your Own Adventure Programs in print back in the 1980s. The first book is really good -- it develops a sample adventure game, adding more features and complexity with each chapter. 

 

 

With the Vic-20, you may quickly encounter issues with the screen size and the limited RAM, especially as the game grows larger. You may wish to consider an alternative platform before spending too much time on this.  (I had a Coco BITD, and the 32-column screen was a serious impediment to porting/playing adventure games originally developed on other systems.)

 

Edited by jhd

Share this post


Link to post
Share on other sites

I wasn’t looking that closely. The Vic-20 only has 3583 bytes available after basic loads. Your text adventure game is going to have to be pretty small, with very short descriptions for the rooms.

Share this post


Link to post
Share on other sites

Changed plans. I accidentally erased the files of the game(damn sound effect program!), and since it's already all gone, why not just make it on a CoCo2?

Now I have about 11k of free data to play with, and a much better(imo) version of BASIC!

My cassette drive doesn't exactly work fine, so I'll have to leave it on for a few days...

Share this post


Link to post
Share on other sites

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Paste as plain text instead

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

Loading...

  • Recently Browsing   0 members

    No registered users viewing this page.

×
×
  • Create New...