Recent

Author Topic: Programming your own adventure games in Pascal  (Read 7222 times)

Wysardry

  • Jr. Member
  • **
  • Posts: 69
Programming your own adventure games in Pascal
« on: June 07, 2019, 09:03:48 pm »
I recently saw a book on Amazon titled "Programming your own adventure games in Pascal" by Richard C. Vile, but it was written in 1984 and is only available in used condition.

Is this likely to be of any use for learning purposes?

Noodly

  • Jr. Member
  • **
  • Posts: 70
Re: Programming your own adventure games in Pascal
« Reply #1 on: June 07, 2019, 09:42:52 pm »
Short answer = no.

Longer answer = only if you want to look into archaic text only adventures.

In the late 70's and early 80's some home computers had very little memory and couldn't support graphic games. So text only games were the only feasible way to get any kind of complexity.

They would generally follow a question and answer format:

Computer - you have 3 magic stars and the sword of wirth and need 2 more stars to complete this level. You have reached a fork in the road and must choose left or right. Down one fork you will find the golden safe which must be cracked to release the stars. Which way, left or right?

Player - right.

Computer - wrong choice! You are now confronted by Thaddy who is in a grumpy mood!

Etc etc
Windows 10 Home, Lazarus 2.02 (svn 60954), FPC 3.04

Wysardry

  • Jr. Member
  • **
  • Posts: 69
Re: Programming your own adventure games in Pascal
« Reply #2 on: June 08, 2019, 03:18:32 am »
I get the impression that the book is about parser based text adventures, such as Adventureland by Scott Adams, rather than the multiple choice Choose Your Own Adventure type.

I am interested in learning more about how the former type are/were coded in Pascal. My main concern is whether the included code would work in Free Pascal and if it did, whether the methods used would still be considered good practice.

Noodly

  • Jr. Member
  • **
  • Posts: 70
Re: Programming your own adventure games in Pascal
« Reply #3 on: June 08, 2019, 08:07:11 am »
I get the impression that the book is about parser based text adventures, such as Adventureland by Scott Adams, rather than the multiple choice Choose Your Own Adventure type.

I am interested in learning more about how the former type are/were coded in Pascal. My main concern is whether the included code would work in Free Pascal and if it did, whether the methods used would still be considered good practice.

Without having read the book I would say that the code is very likely to work in free pascal with minimal modificationl. It's likely that the author used turbo pascal at the time and fp has very good backwards compatibility with it. In which case I change my original short answer to yes.
Windows 10 Home, Lazarus 2.02 (svn 60954), FPC 3.04

BobS

  • Full Member
  • ***
  • Posts: 153
Re: Programming your own adventure games in Pascal
« Reply #4 on: June 08, 2019, 09:08:18 am »
While written in a dialect of LISP, the source code to these old text adventures is interesting if you're into that:
https://github.com/historicalsource?before=Y3Vyc29yOnYyOpK5MjAxOS0wNC0xNlQwNDowMzo1NCswMTowMM4KzcIl&tab=repositories

lucamar

  • Hero Member
  • *****
  • Posts: 4219
Re: Programming your own adventure games in Pascal
« Reply #5 on: June 08, 2019, 09:30:12 am »
Interesting: prices on AbeBooks from around $12 to $1800 :o

BTW, the "Pascal" in the title is Apple Pascal, according to goodreads.com
« Last Edit: June 08, 2019, 09:33:26 am by lucamar »
Turbo Pascal 3 CP/M - Amstrad PCW 8256 (512 KB !!!) :P
Lazarus/FPC 2.0.8/3.0.4 & 2.0.12/3.2.0 - 32/64 bits on:
(K|L|X)Ubuntu 12..18, Windows XP, 7, 10 and various DOSes.

440bx

  • Hero Member
  • *****
  • Posts: 3944
Re: Programming your own adventure games in Pascal
« Reply #6 on: June 08, 2019, 09:48:45 am »
Interesting: prices on AbeBooks from around $12 to $1800 :o
What an amazing world we live in.. $1800 and shipping isn't free... gotta love it. 

I suppose the buyer should be thankful that the seller isn't asking another $1800 for shipping... LOL
(FPC v3.0.4 and Lazarus 1.8.2) or (FPC v3.2.2 and Lazarus v3.2) on Windows 7 SP1 64bit.

RAW

  • Hero Member
  • *****
  • Posts: 868
Re: Programming your own adventure games in Pascal
« Reply #7 on: June 08, 2019, 10:18:01 am »
Quote
I suppose the buyer should be thankful that the seller isn't asking another $1800 for shipping... LOL
I guess you didn't read it very well .... New Hardware is included ... OF COURSE !!!  :P
Windows 7 Pro (x64 Sp1) & Windows XP Pro (x86 Sp3).

Wysardry

  • Jr. Member
  • **
  • Posts: 69
Re: Programming your own adventure games in Pascal
« Reply #8 on: June 08, 2019, 05:36:51 pm »
I'm in the UK, so I don't have as many options for buying it. I've added it to my Amazon UK wish list, and will keep an eye on the price. Its currently a little under £30 (around $45), so will need to drop by quite a lot to be worth buying.

Most other books I've seen on the topic are based on a dialect of unstructured BASIC.

BobS: I already had that site bookmarked, as I used to enjoy the old Infocom games. I think there are even a couple of ZIL compilers available. Unfortunately, Infocom used to have a separate interpreter for their games, so most of the actual processing was done was by that.

kveroneau

  • Full Member
  • ***
  • Posts: 119
Re: Programming your own adventure games in Pascal
« Reply #9 on: June 08, 2019, 06:14:59 pm »
If you are looking for Pascal relics, I highly recommend searching through the Internet Archives maintained by Jason Scott.  While I am 100% sure that the content he archives is 100% legal, I got in trouble for posting a link before.  But I am quite sure most of you here know of Jason Scott and the Internet Archive, he has archived a lot of old text books, and books from the past.  This is where I found copies of the original Turbo Pascal books I read as a child.  So, depending on the current copyright status of this particular Pascal book, it might eventually end up in the Internet Archive along with the other relics of our computing past.

Personal, what'd I love to see is old original Apple and Turbo Pascal games and programs being open sourced by their original developers and published for everyone to see.  It would be awesome to read through how these developers back in the 80s were able to create some rather amazing programs for the time, considering the memory and CPU of those old machines.  Nowadays most developers don't give a rats butt on how much memory and CPU their programs take, as long as it works, they assume that everyone running their software has a super computer in their home...  I personally still try to code with maximum efficiency.  For example, if I want a smaller program size, and I know what I am trying to do doesn't require some advanced Pascal features, I refrain from using the Object Pascal classes, and just do it the old school way.  Unlike most modern languages, Free Pascal actually gives the programmer the choice to use the OOP, or not.  You can still code a program using traditional Turbo Pascal semantics in Free Pascal, if you choose.  Free Pascal is great for both the retro hobby programmer, and the modern day OOP programmer. :D  I'm still holding out for an Apple ][ and Commodore 64 target machine in Free Pascal.

Also, depending on new you are to either programming or Pascal, any Pascal book should be an asset, as Pascal hasn't changed much in terms of the basic dialect and syntax.  I am sure the book will be great in say teaching how to parse text, calculate scores, keep a player inventory in a very efficient manner, and text adventures and MUDs aren't entirely dead.  A lot of people still really enjoy these types of games, as it is more akin to reading a book, than playing a traditional video game and thus stimulates the mind and enforces creativity.  A sentence in a text adventure can create millions of different visual images in the brain of different readers.  Each reader will perceive the sentence differently.

Wysardry

  • Jr. Member
  • **
  • Posts: 69
Re: Programming your own adventure games in Pascal
« Reply #10 on: June 08, 2019, 08:45:32 pm »
It isn't so much that I'm deliberately seeking out Pascal relics, but more that there are so few new books on the subject. Most of the recent books on writing text adventures are for Python, it seems.

It's a shame that publishers don't republish more of their older books in electronic format. The distribution costs would be minimal, so they could charge less than $5 per book and still make a profit.

I also used to enjoy trying to program as efficiently as possible on the old 8-bit home computers. Level 9 Computing were probably the best at squeezing the largest amount of text into a machine with only 32 Kb of memory and a cassette player.

I'm not new to programming, but I haven't used Pascal before. From what I've learned so far, it seems to have all the features of ANSI Full BASIC plus a large selection of API libraries and it's much more cross platform.

marcov

  • Administrator
  • Hero Member
  • *
  • Posts: 11383
  • FPC developer.
Re: Programming your own adventure games in Pascal
« Reply #11 on: June 08, 2019, 10:40:29 pm »
I recently saw a book on Amazon titled "Programming your own adventure games in Pascal" by Richard C. Vile, but it was written in 1984 and is only available in used condition.

Is this likely to be of any use for learning purposes?

Probably only a bit, some algorithms and concepts don't change. However the implementations can change with time, specially such long times. Heavier computers make more possible.

I think the Pascal angle will be the least useful. The dialect will be ancient, and the libraries probably don't exist anymore, and were overly simplistic anyway.

Decent container types, graphics etc are all parts of the default install now, and the first few GB of memory are usually also not the problem. That was quite different in 1984.

I think a more recent book that focusses on concepts with e.g. pseudo code will be more worthwhile.

lucamar

  • Hero Member
  • *****
  • Posts: 4219
Re: Programming your own adventure games in Pascal
« Reply #12 on: June 09, 2019, 02:52:39 am »
It's a shame that publishers don't republish more of their older books in electronic format. The distribution costs would be minimal, so they could charge less than $5 per book and still make a profit.

It's not so much the publishers--though your "economics" are a little off for them--as the authors themselves. After all, for lots (most?) of the old books most the rights reverted to the authors quite some time ago. It's they that have almost forgotten they ever wrote a book for the Apple II--and even if they remember, who can read those old tapes/disks?  :)

Not all are lost, of course: witness, for example, Cortessi's books on CP/M and Z80 programming, which he published in the web some time ago; or Jeff Duntemann's Turbo Pascal from the Square One which he's slowly (but surely) turning into the free FreePascal from the Square One as a "thank-you" for the community. It's just a question of careful search to find them.
Turbo Pascal 3 CP/M - Amstrad PCW 8256 (512 KB !!!) :P
Lazarus/FPC 2.0.8/3.0.4 & 2.0.12/3.2.0 - 32/64 bits on:
(K|L|X)Ubuntu 12..18, Windows XP, 7, 10 and various DOSes.

Wysardry

  • Jr. Member
  • **
  • Posts: 69
Re: Programming your own adventure games in Pascal
« Reply #13 on: June 09, 2019, 07:02:37 am »
marcov: I'm not so sure that the methods used to create text adventures have changed that much over the years. For example, Inform 7 still has the option to export games in Z-machine format which was used for Infocom's text adventures up until 1989 or so.

I haven't seen any books on creating text adventures that aren't aimed at a specific programming language or platform.


lucamar: There are utilities available to read older disk formats, although I'm not sure how easy it is to buy new magnetic disk drives these days. There are also emulators for most 8-bit machines.

I already managed to find a PDF of FreePascal from the Square One, and even in its unfinished state, it has been helpful so far. I also bought a PDF version of Getting Started with Lazarus IDE from Packt Publishing, which I haven't looked at yet.

Also on my radar is Getting Started with Lazarus and Free Pascal for the Kindle, but I'm not sure if Pascal Made Simple (by P K McBride) would be a better choice.

lucamar

  • Hero Member
  • *****
  • Posts: 4219
Re: Programming your own adventure games in Pascal
« Reply #14 on: June 09, 2019, 07:55:08 am »
lucamar: There are utilities available to read older disk formats, although I'm not sure how easy it is to buy new magnetic disk drives these days. There are also emulators for most 8-bit machines.

Getting the drive--which can be quite difficult, let me tell you--is only half the problem. The other half  (not counting normal, everyday, standard disk errors) is exemplified by this: take an old disk (say an Apple II one, for example, or a 5'25 from an old PC) and a cotton-pad; now very softly and lovingly caress the surface of the disk with the cotton--note: just a caress, don't get rough with it!.

If the cotton doesn't come away tinged a redish-brown then either you're very, very lucky and have a good disk which was safely stored or an utterly destroyed disk. That redish tint? That's the oxide layer which, by now, is merely resting on the vinyl surface, waiting for the smallest whiff of air (or the contact with a drive's reading head/cleaning pad) to take it away to la-la-land.  ;D

I have quite a lot of experience with old disks (and tapes and what-nots) and I can tell you that from 60% to 70% of them are not only unreadable but actually harmful for the crumbling drives in which they run. If you're not very careful you can end up with your desk (and/or the innards of the computer) covered with a layer of conductive reddish dust.
Turbo Pascal 3 CP/M - Amstrad PCW 8256 (512 KB !!!) :P
Lazarus/FPC 2.0.8/3.0.4 & 2.0.12/3.2.0 - 32/64 bits on:
(K|L|X)Ubuntu 12..18, Windows XP, 7, 10 and various DOSes.

 

TinyPortal © 2005-2018