beginner project - a text-based game for vic-20 ?

Basic and Machine Language

Moderator: Moderators

OBSysteme
Vic 20 Enthusiast
Posts: 156
Joined: Fri Jul 23, 2010 8:56 pm

beginner project - a text-based game for vic-20 ?

Post by OBSysteme »

Seeing the vitality of this community, It basically made me put the Commodore 64 in the cabinet along with the TI99/4a for a while. To hell with it, I officially chose the vic-20 as the computer I will learn BASIC on. As the propaganda goes: the vic-20 is the one to grow on? well i'm all grown up but never owned an 8-bit computer when young :roll: The clueless parents got us attari and nintendo consoles, so , as the other add goes, I did not end-up "owning the neighborhood". the first computer was a 486 PC (shows how my family was late into computers).

So I am almost a virgin to any form of programming (except for some statistical software languages). Months ago I had though of doing Sudoku in BASIC as a great way to learn programming (should not be too complex). I was doing research in the arctic at the time, with no electricity, living in tents, so I had begun sketching out at least the logical steps on paper. Coming to these forums have re-motivated the idea of having a "project" of my own but I see somebody already elegantly built a sudoku program for the vic-20.

So, in trying to find something more precise, I am thinking of doing a small text adventure as my first project.

Do you think it would be a good choice? I think this is a way in wich my imagination could make up for limited-starting programming skills. But I don,t know if people like text-based games anymore? It would be a text-based game with little to no graphics, but strong aphasis on music and noise for atmosphere, I think the vic-20 sounds are spooky, ideal for what I want to do. I have a background as a violin player so experimenting with melodies would not be too hard.

As a first creative step, I have the title and the setting.

Title of the game : Escape from Estrapad

Description: We are in the 1950's, following a deep depression and a downward spiral of alcohoolism and violent behaviour, you've been put in a top-security mental institution. Bitter, controlled, humiliated and Feeling mis-understood, your vow to do anything, and i mean anything it takes to escape the institution.

so it would be, like PG-13 ?? or PG-16 ??

Any feedback on the idea would be welcome! as I slowly learn the trade of programming, I can at least have a headstart in writing texts and concepts for the game.

as for myself, this would be my way of escaping the "end-user" cage.

lol!

cheers!
Last edited by OBSysteme on Fri Nov 18, 2011 11:21 pm, edited 1 time in total.
User avatar
orion70
VICtalian
Posts: 4341
Joined: Thu Feb 02, 2006 4:45 am
Location: Piacenza, Italy
Occupation: Biologist

Post by orion70 »

Writing a text adventure to learn BASIC seems a good idea. There are several kinds of them though: all-text with parser (input sentences), semi-graphic, multiple-choice (I'm currently working on the english VIC version of a C64 classic written in italian), mixed, etc.

I'd suggest to "study" the structure of a text adventure, then a couple of multiple-choice ones, just to learn how to organize routines...

BTW, the plot is original and intriguing :wink: .
OBSysteme
Vic 20 Enthusiast
Posts: 156
Joined: Fri Jul 23, 2010 8:56 pm

Post by OBSysteme »

Yes I will surely try to disect existing text adventures to see the inner-workigs.

So this thread will be my help line :)


so, the project got kicked-started in a very humble manner, with :

10 PRINT CHR$(147)
20 POKE 368,08
30 POKE 646,5

I guess my first real baby step yould be to program a title screen and a catchy little tune that does not take-up too much memory.


One first question: can you do a long-enought text game on an unexpanded VIC?
bokvamme
Vic 20 Afficionado
Posts: 311
Joined: Tue Dec 26, 2006 11:22 am

Post by bokvamme »

OBSysteme wrote: One first question: can you do a long-enought text game on an unexpanded VIC?
You may want to split the game up into parts..
At least the title screen/music and instructions as part 1, then the game in 1 or more parts...
vic20tapes.org - preservation of vic20 tapes.
Kananga
Vic 20 Afficionado
Posts: 317
Joined: Mon Mar 08, 2010 2:11 pm

Post by Kananga »

OBSysteme wrote: 20 POKE 368,08
Shouldn't that be
poke 36879,8
- set black backround?
Buy the new Bug-Wizard, the first 100 bugs are free!
User avatar
Mike
Herr VC
Posts: 4843
Joined: Wed Dec 01, 2004 1:57 pm
Location: Munich, Germany
Occupation: electrical engineer

Post by Mike »

So, what could be considered the minimal ingredients for a text adventure?

- Several rooms, with a description, connected in a way they can be reached by directional commands: N, S, E, W.
- Most probably not all of the rooms are reachable right from the beginning.
- There are objects located in the rooms, which can be picked up, dropped, and used: INVENTORY, GET, DROP, USE.
- Puzzles require the player to use the objects in another room than where the objects were found: keys open locked doors, torches enlighten dark surroundings, money gets another object/service in return from a non-player character.
- Limits should be enforced, like maximum number of "moves", maximum number of objects in inventory.

Also, one should not easily be able to guess the solution from the BASIC listing. At least some minimal form of encoding is called for. Like here:

Code: Select all

1 Q$="UISPX!HBSMJD":PRINT"YOU SEE DRACULA!":INPUT"WHAT NOW";A$:N=1
2 IFASC(MID$(A$,N,1))+1=ASC(MID$(Q$,N,1))THENN=N+1:IFN<=LEN(A$)ANDN<=LEN(Q$)THEN2
3 IFN=13THENPRINT"DRACULA FLEES!":END
4 PRINT"YOU'RE BITTEN."
Solution: 'THROW GARLIC'
Greetings,

Michael

P.S. The original of the above program once was published in the German 64'er magazine 1/85, as 'Shortest Text Adventure Ever'. ;)
OBSysteme
Vic 20 Enthusiast
Posts: 156
Joined: Fri Jul 23, 2010 8:56 pm

Post by OBSysteme »

Kananga: yes you are right, it should be "8" not "08" but 08 works as well. This was found by guess-work until I found the color I wanted, LOL. You see how much of a rookie I am? LOL!

Mike: thanks for the suggestions, Yes having some limits in the game is a nice idea.

I was thinking along the lines of Having health-hit points, also, instead of a time limit... have a "sanity" limit... which tends to fluctuate, but get dangerously lower in certian situations. Since you are a MENTAL case in an institution, it could be interesting... like if you try too much invalid commands too quickly... the character could start panicking (sanity lowers...). Calm down... think things through before trying out all kind of commands. Another situation in which the sanity could get lowered is if I have non-enemy NPC's in the game, like chatting for too long with another insane patient when trying to get information. Could be freaky and fun, but it remains if having to manage your sanity would be too annoying to the gamer ? Yet another important situation where your sanity could lower, is if you commit a violent act to solve a puzzle (so if you do... you cannot do it all the time at every opportunity because you would run out of sanity points a become insane/unfunctionnal, and get caught). The sanity hit-point could be a nice way to get the player anxious about the decisions he makes in the game and start feeling like he is in the game, especially if there are different options to the puzzles-conflicts.


Fore sure, I would like a limit the number of items in inventory, since you are basically running around in your institution pijamas, LOL !

keep the suggestions comming, If I can put my money were my mouth is and start achieving results, then I'll absolutely have to call it a Denial release (if it is good enough to be worthy of the name).
OBSysteme
Vic 20 Enthusiast
Posts: 156
Joined: Fri Jul 23, 2010 8:56 pm

Post by OBSysteme »

Mike: concerning Hiding code, that is also an excellent thing to keep in mind, I had found the following simple trick yesterday:

http://www.commodore.ca/gallery/magazin ... g_1982.pdf

but I have no idea if it works.
Boray
Musical Smurf
Posts: 4064
Joined: Mon May 03, 2004 10:47 am

Post by Boray »

Moved topic from Games to Programming
PRG Starter - a VICE helper / Vic Software (Boray Gammon, SD2IEC music player, Vic Disk Menu, Tribbles, Mega Omega, How Many 8K etc.)
OBSysteme
Vic 20 Enthusiast
Posts: 156
Joined: Fri Jul 23, 2010 8:56 pm

Post by OBSysteme »

I am looking into the folowing code by Safalra to use it to try and program a hi-res title screen image/page:

http://safalra.com/programming/vic-20-b ... -graphics/

I will reproduce it here for discussion purpose:
...The first line of the program should be GOSUB 1000. To plot a pixel, set X and Y to the x and y co-ordinates respectively (valid values range from 0 to 175) and GOSUB 1100.

999 END
1000 REM INITIALISE HI-RES
1001 PRINT CHR$(147)
1002 POKE 36879,8
1003 IF PEEK(36869)=253 THEN GOTO 1015
1004 POKE 36869,253
1005 POKE 36867,PEEK(36867) OR 128
1006 POKE 55,0
1007 POKE 56,19
1008 POKE 51,0
1009 POKE 52,19
1010 CLR
1011 PRINT CHR$(147);"INITIALISING HI-RES"
1012 FOR I=0 TO 2047
1013 POKE 5120+I,PEEK(32768+I)
1014 NEXT I
1015 RETURN
1100 REM PLOT PIXEL
1101 X%=X/8
1102 Y%=Y/8
1103 P=7680+X%+22*Y%
1104 Q=PEEK(P)
1105 IF Q>127 THEN GOTO 1114
1106 CN=CN+1
1107 S=5120+8*(127+CN)
1108 T=5120+8*Q
1109 FOR I=0 TO 7
1110 POKE I+S,PEEK(I+T)
1111 NEXT
1112 Q=127+CN
1113 POKE P,Q
1114 C=5120+8*Q+(Y AND 7)
1115 POKE C,PEEK(C) OR (2^(7-(X AND 7)))
1116 RETURN
There is one thing I have a problem with, on line 1115 there is a "exponential" symbol right after the the "2". How does one do an "exponential" symbol on the Commodore Keyboard? all I can think of is the "arrow-up" symbol on the "pie" key ?

I am assuming that if I put that image and game instructions as a separate program (bokvamme's suggestion)... then memory is a not a problem?

thanks.
User avatar
Mike
Herr VC
Posts: 4843
Joined: Wed Dec 01, 2004 1:57 pm
Location: Munich, Germany
Occupation: electrical engineer

Post by Mike »

OBSysteme wrote:I am looking into the following code by Safalra to use it to try and program a hi-res title screen image/page: [...]
That set of sub-routines doesn't get anywhere near providing full screen hi-res graphics. Especially not on an unexpanded VIC-20:

First of all, they make a copy of the complete character set. The copy allocates 2K in the middle of available RAM on an unexpanded VIC-20, leaving only 1K free for BASIC programs! Then, the second half (normally the inverse character set) is altered as necessary, replacing the currently displayed character with a user defined character, that has one, or more additional pixels set. It is only possible to set pixels, not delete them.

All in all, the routines allow for up to 128 redefined "tiles" being placed over the normal text screen - that does just cover 1/4 of the screen. And, as everything is done in BASIC, these routines are not exactly speed demons.
There is one thing I have a problem with, on line 1115 there is a "exponential" symbol right after the the "2". How does one do an "exponential" symbol on the Commodore Keyboard? All I can think of is the "arrow-up" symbol on the "pi" key?
Yes. That one it is.

...

If you want to do fast, full screen hi-res graphics without resorting to machine language, you should take a look at the MINIGRAFIK extension. It however at least requires a +8K RAM expansion.

And for designing a title screen, MINIPAINT might just be the right tool for the job. Pictures done in MINIPAINT can be loaded by programs using MINIGRAFIK commands.
OBSysteme
Vic 20 Enthusiast
Posts: 156
Joined: Fri Jul 23, 2010 8:56 pm

Post by OBSysteme »

thanks mike:

Actually, I've found a more usefully program-example than the one I cite above on doing Hi-resolution, its in the Vic-20 Programmers Reference Guide:

http://www.scribd.com/doc/725321/VIC-20 ... ence-Guide

there is a nice step by step example of how it works, so I will play around with it.

Thanks for the minipaint reference, I will look this up.

more reading about these things are in order for me, I'm like a baby that don't even know how to crawl yet, héhéh.

In the mean time, i've learned how to re-define where the cursor lives on the screen.

Concerning memory and speed issues, I will make up for it by trying to do a nice hi-res picture but that may be monochhrome (say, green on black or cyan on black), so, I would only need to POKE-in the green part and black stays black. If the design involves lines drawings more than coloring wide areas in green, than migh also ease things a bit?

thanks again, this is all very exciting !

:P
OBSysteme
Vic 20 Enthusiast
Posts: 156
Joined: Fri Jul 23, 2010 8:56 pm

project landing on the back-burner

Post by OBSysteme »

Hi folks, I'm still around but announcing not to expect much of this project for the near future.

Been simply too busy (ex: buying a house and moving out)....

Life & Work seem to much right now for me to undertake this project, so my Retro-cumputing hobby gets limited-back to Sound and Music programming (but I do keep interested in learning anything about programming the VIC & others).

The idea of this text-based game did however inspire a song that was supposed to be the theme song of the game (a simple-repetitive haunting tune called "my head hurts", that was supposed to take a minimum of code in the game).

Right now its still unfinished and implemented on a 486 computer... but I promise to try a pure Vic-20 version for you guys !!! ; )

You are likely to hear from me on the "sound" front. I also have a small Vic-20 restoration project that if I get to do, will post photo or video.

The great thing in ending up being a house owner is that all of a sudden, there is all this space to fill.... including an unfinished basement!! I guess i'll feel less guilty-worried (wife) at rescuing additional machines.

cheers!
OBSysteme
Vic 20 Enthusiast
Posts: 156
Joined: Fri Jul 23, 2010 8:56 pm

Project re-activated!

Post by OBSysteme »

Hey guys, just saying the project is active once again!

I am setup:
Image

This project idea kept resurfacing in my head and to remove the itch, I am starting to work periodically at it. Drawing lots of maps and descriptions for now, but will post occasional for news on progress or to summon help with the programming.

yes! VIC-20 is getting some love at last!

OBS
Last edited by OBSysteme on Thu Jun 30, 2011 11:33 pm, edited 1 time in total.
User avatar
tokra
Vic 20 Scientist
Posts: 1124
Joined: Tue Apr 27, 2010 5:32 pm
Location: Scheessel, Germany

Post by tokra »

What a nice clean VIC - no yellowing :-)

I would suggest however developing for the VIC on the PC. There are so many nice tools around to make life easier like CBM Prg Studio or BasEdit. You can instantly check your progress in VICE-emulation and when it's done see it in all its marvel on the original machine.

No need for teary eyes because of old TV-screens or cramps in your hands because of the "ergonomic" keyboard.

Unless you are "hard core" of course, and specifically WANT to do it on the original machine.
Post Reply