Community

General and Everything Else => The Games and other Sierra Adventure stuff => Topic started by: gumby on June 13, 2010, 04:30:24 PM

Title: Port of text adventure games to SCI
Post by: gumby on June 13, 2010, 04:30:24 PM
I've been working on a project for about the last month or so on porting text adventure games (specifically z-machine games - more specifically, Infocom games) to SCI.   

My approach is to take a compiled z-machine game, decompile it, parse it and generate all the bits and pieces needed for an SCI game - all programatically.  I'm starting with Zork and so far I've created all the rooms and have the 'cardinal' navigation worked out (N S E W directions) & preserved all the original room descriptions.

So the gist of the project is that I'm creating a tool that one could point any z-machine game at and out pops a usable SCI game with all the game logic.  Obviously, there are some things that cannot be generated automatically - namely the artwork.

I'm doing this for the programming challenge - I don't believe that these games will in any way be superior to their originals.  I grew up with Infocom & Sierra games and they stand on their own merits - I just want to see if this is possible.

I figured I'd reach out to the SCI community and see if there would be interest in this.  If there is enough interest, I'd probably create a website for tracking the current status of the project, etc.

-Gumby
Title: Re: Port of text adventure games to SCI
Post by: Cloudee1 on June 13, 2010, 04:49:08 PM
That is quite possibly the coolest idea I have heard in a while. If we could get Troflip to swing by then maybe he could bmp conversion stuff. Sounds like a real challenge. Good luck.
Title: Re: Port of text adventure games to SCI
Post by: Cloudee1 on June 13, 2010, 08:42:49 PM
But then again I don't know if his converter is up to text description conversion quite yet. You say Zork I hear Loom.
Title: Re: Port of text adventure games to SCI
Post by: Collector on June 14, 2010, 12:05:02 AM
Nice idea, but it would be far more complex than that. You would have to also add in everything that the sprites interact with, walk paths, hotspots or any event that would be triggered by proximity. It might be nice to automate the conversion of what it can, like dialog trees, etc.
Title: Re: Port of text adventure games to SCI
Post by: Cloudee1 on June 14, 2010, 11:29:01 AM
Not really, since you are starting with a text adventure, a text adventure would hopefully pop out.  Especially if one room is equivalent to one roo. It would be up to someone rewriting a game to convert the text room to one with images. but a working game "map" and the text descriptions and commands already in place would be pretty cool.
Title: Re: Port of text adventure games to SCI
Post by: gumby on June 14, 2010, 09:04:56 PM
Exactly, all the game logic would hopefully be ported and complete.  Rooms map one-to-one between the original and the new game. 

I'm actually hopeful that if a large enough library of views for props (a sword, lantern, sack lunch, etc) were created, these could also be 'injected' into the correct holding room.  These same objects could be used between games.  Of course, the end-game developer would probably want to make their own pics, but it would be a great starting point.

I've put in 108 'stub' rooms (the # of rooms in Zork) and when you enter the room and type 'Look', it will give you the original description from the game (pretty cool).  That's the meat of what I've completed so far.

I'm currently working on the 'oddball' room navigations (north-east, north-west, south-east, southwest).  I've settled on utilizing autodoors in the corresponding corner of the room and then editing the room's control view (not manually of course).  I've been getting quite chummy with my favorite hex editor & picture resources...




Title: Re: Port of text adventure games to SCI
Post by: gumby on August 07, 2010, 04:31:42 PM
Figured it was about time for a progress update:

Game: The game I'm using to develop my tool is Zork.  So I'll probably see complete development of a Zork port to the bitter end.

Rooms: Rooms currently consist of a common background (I chose the boxart from the original game) & directional arrows to aid in navigating the ego.  All rooms are in & can be navigated with the ego with 'simple' directions (N/S/E/W NE/NW/SE/SW).  Up, down, enter, exist still need to be handled (as well as any code-based navs).  Room descriptions from the original game are displayed in the background of each room, and are also printed to the screen when player types 'look'.

Objects:  Top level objects are in place (no nested objects yet - no 'items contained in other items').  Objects cannot currently be interacted with, I'm still working on the take/drop functionality.  Objects are kept track of globally & added dynamically upon entry of a room (to support movement of objects between rooms via take/drop).

I'm currently working on putting in the Said statements for single-word sentences (single verb).  Then I'll move on to the verb/prep/adj/noun sentences.

When I get to a good stopping point, I'll upload the Zork game that I've created thus far so those interested can better relate to all the questions & gibbering I've been doing...
Title: Re: Port of text adventure games to SCI
Post by: MusicallyInspired on August 08, 2010, 01:49:28 AM
Oooo. That is interesting. I've never played a Zork game before (other than Return).
Title: Re: Port of text adventure games to SCI
Post by: Cloudee1 on August 08, 2010, 01:59:02 AM
Really it sounds like things are progressing pretty well.
Title: Re: Port of text adventure games to SCI
Post by: gumby on October 25, 2010, 07:27:20 PM
Update:

Not much has changed since my last update, except I've just tidied up a bit with the code generation.  For those interested in giving it a whirl, I've uploaded a demo to the 'fan games' page.  

At this point, all you can do is navigate the ego between rooms and see some objects & room descriptions.  To get to all the rooms, teleporting will be necessary.  Some single-verb words work ('look', 'scream', 'back', 'barf', 'say', a few others) - but they really don't do much.  Oh, and all resources are currently 'external' to the game (pics, texts, views, etc) - not embedded into the resource.001 file.

I'm glad this is to a point where the community can have a look at what I've been putting together - I'd appreciate any feedback!
Title: Re: Port of text adventure games to SCI
Post by: Cloudee1 on October 25, 2010, 07:58:16 PM
Alright, the game has been approved and is now available for download. I still need a screenshot, but I can't do that where I am at right now so I will take care of that tomorow hopefully. I can't even try it out yet, but I will when I can.
Title: Re: Port of text adventure games to SCI
Post by: Cloudee1 on October 30, 2010, 02:00:46 PM
Uh oh, out of heap in the clearing. So I've played through it a little and are you sure you need an ego to move around. with the text descriptions and the arrows, It seems to make more sense just to let me click on arrows to travel. maybe a nice gui, I'll try to sketch something up, that would be easier than describing it.
Title: Re: Port of text adventure games to SCI
Post by: gumby on October 30, 2010, 03:43:35 PM
Out of heap already?  Damn.  That'll be fun to fix...  You are right, you don't necessarily need the ego to move around - I was thinking about going with a 'traditional' SCI game.  However, in many respects it would be easier just to use a PNC 'compass' on the screen.

You are making me totally rethink this.  It would be tons easier if I didn't incorporate an ego & went 'first person'.  Similar to the game '7th Guest' maybe.
Title: Re: Port of text adventure games to SCI
Post by: Cloudee1 on October 30, 2010, 11:32:57 PM
I'm actually in the middle of a first person project myself. Given the source of your game, I would think first person would be ideal. Also all these pic resources. Reallistically, is there going to be a different image created for a room, if not why not just use pic001 and hardcode that into every room instead of a seperate pic for each script.
Title: Re: Port of text adventure games to SCI
Post by: gumby on October 30, 2010, 11:50:47 PM
Pic resources:  Didn't know I could use a single pic for all rooms.  However, I was thinking that every room would have it's own pic (this would be one of the responsibilities of the final game designer).  I figured that putting in the stubs & referencing them in each corresponding room script would be easier in the end.

Speaking of the end-game designer - making this first person really makes it easy.  All that would be needed from a development perspective would be pics & props, that's it.  Not only that, I'd bet it's just the 'visual' screen that would be necessary; I'm hoping that I could put in enough smarts so that control/priority could be handled automatically.

I should also add that *nothing* of what you see would be there in the final game (with the exception of the status line).  Everything visually there is to aid in the development of the artwork in the game (the room pic, the room description, the arrows).  Obviously, the props are just stubs as well, awaiting artwork.  I was thinking of preserving the room descriptions when the 'look' verb was called...
Title: Re: Port of text adventure games to SCI
Post by: Collector on October 31, 2010, 01:55:52 PM
Keep in mind that 1st person adventures are generally disliked among adventure gamers. Yes, I know that there are some well known examples of 1st person games, but from several adventure forums where the subject has come up the overwhelming consensus has been in favor of 3rd over 1st.
Title: Re: Port of text adventure games to SCI
Post by: gumby on October 31, 2010, 04:05:19 PM
Good point Collector.  Probably many gamers just write off 1st person gameplay for the shooters.  Which I get to some degree.

Here is my (new) current plan:

1.  Parser-only game.  No graphics (yeah, this means taking a slight step back from what is already done).
2.  First person implementation.
3.  3rd person implementation.

In my mind this goes from lowest-to-highest difficultly of completion.  I intend to keep each previous implementation when a new one is introduced (which I think is very feasible).  So in the end, all 3 options would be available for gameplay.

This helps me better define the requirements at each step & keeps me more focused (which I definitely need).
Title: Re: Port of text adventure games to SCI
Post by: gumby on January 15, 2011, 09:03:04 AM
Update: I've abandoned/scrapped the majority of what I put together so far for Zork. I'm going to take the approach of completely recreating a text adventure 'as-is' in SCI - then move on to making it a graphically-oriented game.

I've been translating the Zork decompiled z-machine source code to SCI over the past few months. Things are progressing, and I can *almost* compile everything (SCI code is nearly syntactically correct - then the bug hunt begins).

I've abandoned the z-machine parser & command loop code, as well as a dozen or so functions that can be replaced with builtin SCI logic. I still have to split the code out into multiple files. Right now all the code is in a single room script (about 280K) - I know that will choke the interpreter.

Title: Re: Port of text adventure games to SCI
Post by: gumby on February 27, 2011, 03:58:06 PM
Yes!  I have compilation (sort of)!  Just the port of the existing game logic (no room scripts yet).  I've got just over 400 'procedural' scripts, a single procedure in each.  Was able to choke Studio a few times with some really bad code - it just got hung up and never completed during a compile.

I've mapped each room to a room script (similar to what I had before - a little over 100 rooms) - but they are all boilerplate rooms, the only reason I need them is to keep the memory under control.

Found some new bugs, but should be able to squash them over the next few weeks.  Then I need to figure out how to get the whole thing 'fully integrated' into the game, basically the tie-in to getting the parser hand-off to the procedural code (if that makes sense).
Title: Re: Port of text adventure games to SCI
Post by: gumby on February 11, 2012, 11:11:31 AM
Update:  Zork I and Zork II are compiling within Studio!  Just the procedural scripts, but it's quite a milestone.
Title: Re: Port of text adventure games to SCI
Post by: MusicallyInspired on February 11, 2012, 12:34:32 PM
Nice! That's quite a feat!
Title: Re: Port of text adventure games to SCI
Post by: JRedant on February 11, 2012, 07:24:51 PM
I'll add in my two cents, since I'm doing the same thing myself.

I think it all has to do with balance. It's good to stay faithful and true to the game. However, you should give yourself some allowance and creative freedom. For me the programmers for "Island of Secrets" probably has a far different version than me. If all you are given for a room description is "You are at the southern edge of the forest", that could mean just about anything.

At some point you are going to have to break away from the original game and give it your own element.

Think of it this way: There are two Spiderman stories...one by Stan Lee and Steve Ditko, and one by Sam Raimi.

In the same way, there are two "Island of Secrets"...one by Usborne Publications, and one by me.

That's what keeps it fun and interesting!
Title: Re: Port of text adventure games to SCI
Post by: Collector on February 11, 2012, 09:05:54 PM
It seems like that compiling those scripts has been hanging you for a while.
Title: Re: Port of text adventure games to SCI
Post by: Cloudee1 on February 11, 2012, 09:35:56 PM
That's true, there's always room for another interpretation... But in this instance, correct me if I'm wrong, Gumby isn't doing a room by room recreation, he is taking the original games and basicly dumping them through a code converter that creates an sci game from the original text game. Granted it might have been quicker to do a room by room remake lol, but wouldn't have been near the programming challenge which is half the fun
Title: Re: Port of text adventure games to SCI
Post by: gumby on February 11, 2012, 11:59:49 PM
you are going to have to break away from the original game and give it your own element.
I agree - but from my standpoint its a genre-change that is the element.  Converting a text game to a graphical one.  That is the creative element I am hoping to eventually get to.  Keep all the original text descriptions & augment them with graphics & animation.  There are a lot of opportunities for innovation - combat scenes especially come to mind.  Also the 'avoiding' the enemy technique by quickly exiting the current screen.

Also, I'm not just porting a single game - ultimately, I'm hoping to create a framework where any Infocom (or Inform) game skeleton would be created in SCI.  It very well might take me forever but it sure is fun :).

It seems like that compiling those scripts has been hanging you for a while.
Yeah, took me a year (with time off) to finally get to the point where it's nearly fully automated - just need to compile Main.sc & one other script then I can do a 'Compile All'.

Granted it might have been quicker to do a room by room remake lol
Too true.  I now know that I could be so much further along if I took the 'traditional' approach. 

JRedant, I'm truly envious of your rapid progress - I can't wait until I'm actually at the creative stage.
Title: Re: Port of text adventure games to SCI
Post by: JRedant on February 12, 2012, 01:17:25 PM
Don't be too envious, gumby, my friend.

[Edit: With "Island of Secrets", I actually happen to have the book in PDF format. The creative work has already been done. The monsters, places, map, quest, clues and information has already been laid out. The illustrations have been done. You're actually doing a lot more creative work and research than me]

As it happens, I work in medical research and am facing a huge bunch of paid downtime. Not the one to lay down and vacation or whatever, I decided to put a lot of my creative energy into this. But that's a different topic altogether.

Point is, in the five days of work, I put together five rooms. That's about seven hours on a room. That is a lot of work. I still have to work with script files. This is a big undertaking. It's huge. And not everyone is in my position.

All this needs is dedication! Make the Zork happen! I want to see the fruits of that undertaking!
Title: Re: Port of text adventure games to SCI
Post by: gumby on February 12, 2012, 08:52:14 PM
All this needs is dedication! Make the Zork happen! I want to see the fruits of that undertaking!
Agreed, it does take dedication.  For me, the only way to stay on track is to keep at it, every day.  Even if it's only for twenty minutes or so.  If I put my script down for too long, it becomes harder and harder to return to.

Speaking of 'the script', it's pretty much one single monstrous Perl script, currently just under 3500 lines long, and keeps growing.  It's laced with comments & debug commands, probably making up half the file content.

My goal is to make sure the script works with *all* the Z-machine Infocom games (that's 34 games by my count, from Zork I in 1980 to Sherlock: Riddle of the Crown Jewles in 1988).  Working through Zork III now.  With each game, I'm finding it's taking less and less time to get compilation.  I'm really hoping that things 'level off' and after the first 5 or 6 games, the rest will 'just work' without any additional coding.
Title: Re: Port of text adventure games to SCI
Post by: Collector on February 13, 2012, 02:28:08 AM
For me, the only way to stay on track is to keep at it, every day.  Even if it's only for twenty minutes or so.  If I put my script down for too long, it becomes harder and harder to return to.

When you've been away from a script for too long, it can be almost as hard to pick up as someone else's script. You have to read through it to figure out what you were trying to do and how you were doing it. You might recognize your style and personal shortcuts, but you still have to wrap your head around it. I usually try to comment my scripts as if I expect someone else to pick it up, even if it is not likely.
Title: Re: Port of text adventure games to SCI
Post by: JRedant on February 13, 2012, 03:50:35 PM
The old rule of computer programming still rings true....document, document, document. (I should be doing that, actually)
Title: Re: Port of text adventure games to SCI
Post by: gumby on February 15, 2012, 11:04:36 PM
Update.  Zork 3 complete plus recompilation of Zork 1 & 2 to make sure that I didn't break anything.  Now moving on to the Enchanter series.
Title: Re: Port of text adventure games to SCI
Post by: gumby on February 18, 2012, 10:25:25 PM
Enchanter & Sorcerer are compiling!  Good news is that the time between compilations is accelerating & I think I'm very close to a fully working, although incomplete, code-porting tool :).  Still lots of gaps, but the logic that can be ported, has been.  

It was a good thing that I started with Zork - so far, it's the one that has the most compete symbol file.  As I've progressed, each game seems to have gotten worse & worse with the de-compilation data due to progressively more incomplete symbol files.  The result is still usable, it's just there is a large amount of code with non-descript code segments (variables, procedure names, etc).

I've just hit a brick wall with Spellbreaker.  The number of scripts exceeds 1000, exceeding the limitations of Studio (and Companion).  I was working off of the model of 'one script per procedure', and I guess at this point I'll just have to arbitrarily 'double-up' procedures within a single script to get below the maximum.  That ought to complicate things sufficiently to put a speed-bump in my progress.

I suspect that the more recent games will contain a total number of procedures that will push me over the max.

In order to not lose forward momentum, I will attempt to find other games that will compile under the current procedure-per-script model.
Title: Re: Port of text adventure games to SCI
Post by: JRedant on February 18, 2012, 11:19:41 PM
You will find this true with any software development interface. There will always be "that one" that goes beyond the capable limits of what's available. Pitfall II for the Atari 2600, for example.

This brick wall is calling upon you to see how far you can stretch your own limits.
Title: Re: Port of text adventure games to SCI
Post by: Collector on February 19, 2012, 03:25:21 AM
I've just hit a brick wall with Spellbreaker.  The number of scripts exceeds 1000, exceeding the limitations of Studio (and Companion).  I was working off of the model of 'one script per procedure', and I guess at this point I'll just have to arbitrarily 'double-up' procedures within a single script to get below the maximum.

How about a tool to automate concatenating scripts?
Title: Re: Port of text adventure games to SCI
Post by: gumby on February 19, 2012, 09:06:47 AM
How about a tool to automate concatenating scripts?
I like that idea.  I could separate the concat logic into into it's own utility, keeping the complexity outside of the code porting tool; a post-processing step.

I don't think that such a tool would be useful in any other scenario - due to memory constraints it makes sense to keep things in separate scripts as much as possible.
Title: Re: Port of text adventure games to SCI
Post by: Collector on February 19, 2012, 02:22:17 PM
Also, the fact that you are the first to run into the limit shows that it is not normally a factor.
Title: Re: Port of text adventure games to SCI
Post by: gumby on March 12, 2012, 09:59:58 PM
Update:  I've run through all the games.  Here's the list of games that are currently compiling:

    Deadline
    Enchanter
    Hitchhikers Guide to the Galaxy
    Hollywood Hijinx
    Infidel
    Planetfall
    Sorcerer
    Starcross
    Stationfall
    Suspect
    Suspended
    Zork I
    Zork II
    Zork III

The rest are not working, mostly because of the number of scripts.  A few have other issues that I have yet to resolve.  It is looking unlikely that this tool will support z-machine version 6 files (Arthur, Journey, Shogun & Zork Zero).

The good news is that I've got a workaround for excessive script issue by utilizing unused script numbers.  Currently, I start the procedural scripts at #300, instead of immediately after the last room number.  The room numbers are also not 'dense', so there are gaps - the reason for this is that the room numbers follow the order in which they appear in the decompilation & the gaps are other objects (it's a hierarchical presentation with regard to nesting - rooms are the top-level objects).  These two things, coupled with the fact that on average I'm only over the limit of scripts by 50, I can get another 9 games working.

Beyond Zork, Bureaucracy, Sherlock & Trinity blow completely through the script # limit and require combining scripts to get below the limit.  I may just skip these games and come back to them another time, if ever.

I have identified a game that I think I'll be able 'decompile' and include with the release of my tool, because it was given away by Activision.  Zork - The Undiscovered Underground, but I don't have a symbol file for it, so I'll have to create one.

When symbol files are 'barebones', the majority of the procedures are generically named, so I'm seeing opportunity to apply additional processing to attempt to identify what their names should be, largely based on cross-comparison of games.
Title: Re: Port of text adventure games to SCI
Post by: Collector on March 13, 2012, 12:47:44 AM
So the limitation is with script "slots" rather than actual number of scripts themselves. I assume this is more of a Companion and or Studio issue than of SCI0 itself.
Title: Re: Port of text adventure games to SCI
Post by: gumby on March 13, 2012, 08:50:43 AM
There is a limitation with the maximum number that you can assign to a script (999).  They must be numbered 1 to 999, but not necessarily sequentially.  Basically, I should have been smarter up front on how I assigned the numbers to my scripts.

EDIT:  0 and 999.  Main.sc in the template game is script 0.

Collector, I think you are right regarding this is a limitation of Studio/Companion.  I thought there was an LSL2 script # that was over 1000, but I could be wrong.
Title: Re: Port of text adventure games to SCI
Post by: gumby on March 21, 2012, 09:45:51 PM
I just found out that the BBC held a competition to create pictures to go along with Infocom's Hitchhikers Guide to the Galaxy, back in 2005.

http://www.bbc.co.uk/radio4/hitchhikers/game.shtml

What they did was similar to what I was thinking for my implementation of phase 2 of my project.  An image of the room, a compass rose for movement, the game text itself, and an input line; basically a text adventure with some graphical elements.  I'm not a fan of the BBC's interface, but it certainly illustrates what I was envisioning.
Title: Re: Port of text adventure games to SCI
Post by: Collector on March 21, 2012, 10:29:45 PM
Sounds like the old Legend interface.

http://www.mobygames.com/game/dos/eric-the-unready/screenshots/gameShotId,27964/
Title: Re: Port of text adventure games to SCI
Post by: gumby on March 22, 2012, 09:06:56 AM
Sounds like the old Legend interface.

http://www.mobygames.com/game/dos/eric-the-unready/screenshots/gameShotId,27964/
Yes, that's pretty close.  I think that the Legend interface is a bit closer to what I was thinking of, at least from a usability standpoint. The way the BBC put the input line above the text was horrible.
Title: Re: Port of text adventure games to SCI
Post by: Collector on March 22, 2012, 01:42:56 PM
The BBC interface also takes up too much of the screen. That was one of the things that I always hated about the LA interface, too. It was absurd that it took up a full third of the screen.
Title: Re: Port of text adventure games to SCI
Post by: gumby on March 25, 2012, 09:26:49 PM
Update:  The additional games that could fit within the script limit now compile.  These are:

   Ballyhoo
   Borderzone
   Cutthroats
   Leather Goddess of Phobos
   Lurking Horror
   Moonmist
   Nord and Bert
   Plundered Hearts
   Seastalker
   Spellbreaker

This brings the total count of compiled games to 24.

Wishbringer additionally could not compile due to the excessive number of scripts.  Witness has a problem with decompilation which I haven't addressed yet.
Title: Re: Port of text adventure games to SCI
Post by: Collector on March 25, 2012, 09:49:28 PM
Are you referring to compiling with Omni's build of SCI Studio?

There is a limitation with the maximum number that you can assign to a script (999).  They must be numbered 1 to 999, but not necessarily sequentially.  Basically, I should have been smarter up front on how I assigned the numbers to my scripts.

EDIT:  0 and 999.  Main.sc in the template game is script 0.

Collector, I think you are right regarding this is a limitation of Studio/Companion.  I thought there was an LSL2 script # that was over 1000, but I could be wrong.

I just realized that the limit may be an SCI0 limitation. Sierra developed in DOS, meaning that they were limited to the DOS 8.3 naming convention. Thus, SCRIPT.000 to SCRIPT.999. It might also be part of the reason that the naming convention changed in later versions of SCI. Use of the extension to identify the resource instead of the name would allow scripts from 0.SCR to 99999999.SCR. Not to suggest that later versions of SCI supported that many scripts, but that the OS no longer placed a limit on the number.
Title: Re: Port of text adventure games to SCI
Post by: gumby on March 26, 2012, 06:24:42 PM
Are you referring to compiling with Omni's build of SCI Studio?

No.  Studio had this limitation prior to Omni's build.  As does Companion.

Interesting guess as to the limit: the DOS restricted file names.  It makes sense, and I also bet that Sierra never thought there would be a need for more scripts than 1000.  Makes me wonder what the average script count is for an SCI0 game.
Title: Re: Port of text adventure games to SCI
Post by: Collector on March 27, 2012, 01:58:44 AM
Here you go, minus demos and things like the Hoyle games:

Codename- ICEMAN    - 234
Conquests of Camelot - 226
King's Quest 1 SCI    - 146
King's Quest 4      - 159
The Colonel's Bequest   - 244
Leisure Suit Larry 2   - 118
Leisure Suit Larry 3   - 124
Police Quest 2      -   98
Hero's Quest      - 291
Quest for Glory 2   - 247
Space Quest 3      - 113

As I suspected, the QfG games required the most. And without counting actual numbers of scripts in specific games, later SCI games seem to have a limit of 65,000, in addition to the fact that they split the scripts (SCR) from the heap management (HEP).
Title: Re: Port of text adventure games to SCI
Post by: gumby on March 27, 2012, 09:00:52 AM
So on average 181 scripts per game.  I think on average I'm probably quadruple that number.
Title: Re: Port of text adventure games to SCI
Post by: gumby on March 27, 2012, 07:59:54 PM
So, I've figured out how to handle the grammar/parsing conversion.  It's interesting: the way that Inform & the Sierra interpreter parse is in a very similar fashion.  The only difference that I can see (on the surface) is that Sierra's interpreter allows for a maximum of 3 parts, whereas the Inform let's you use as many parts as you want; each command is ultimately broken into a maximum of 3 pieces, however it let's you 'chain' multiple commands together.

Here is an example of a grammar segment in pseudo-inform:
Code: [Select]
Verb 'attack' 'fight' 'hit' 'hurt' 'injure'
    * animate(in_room,on_ground) 'with'/'using'/'thru'/'through' weapon(held,carried,have) -> Attack

This can be easily rewritten as:
Code: [Select]
(if(Said('(attack,fight,hit,hurt,injure)<(with,using,thru,through)/*/*'))
      AttackSub()
)

The only difference is Inform's ability to use attributes of objects as part of the parse (animate, weapon) - but typically these are also handled in 'preactions' or at the beginning of the action (in this case, 'Attack' is the action being called).

The way that the Inform language names the three parts are 'verb', 'noun' and 'second' (in that order).  The same names apply equally well in SCI as well - in fact I think it assists in understanding just what should go in each section of a Said()
Title: Re: Port of text adventure games to SCI
Post by: gumby on March 31, 2012, 05:57:02 PM
I've got Zork bootstrapped into using the decompiled logic.  It's correctly parsing all the input commands and calling the correct handling procedures.  Most of the 'simple' commands work, where the called procedure is just generating a single Print(), but the more complex ones are still full of bugs.

But it's definitely working!
Title: Re: Port of text adventure games to SCI
Post by: gumby on April 26, 2012, 10:26:30 PM
Update:

The Print() output was previously all 'ad-hoc'.  You'd type a command and it would throw multiple print statements to the screen before ultimately returning the input back to the user, which makes good sense when your application is printing characters to a console window, but looked pretty silly in SCI.  I ended up queuing up all the printed output by appending everything to a string, and then when the command returned, flushed the output to the screen with one Print().

I've successfully implemented 'object properties'.  This was quite difficult - basically the Inform language allows for any object to have any property & that they can be changed throughout the progress of the game.  A torch might have a property of 'flammable', but once it's burnt out the object would not have the property any more and it would be removed.  My first attempt was to define each object (rooms and all) as having a property of each referenced property within the game.  This ended up being 350 objects with 70 properties each, causing heap errors.  The problem is also that the object/property combination was fairly sparse; most objects did not need most properties.

The solution:  I created a text resource for each property - 70 text resources.  The index within each text resource corresponds to an object number, the value is the value of the property (sometimes boolean, sometimes other values).  This only works to represent the initial state of the objects.  Then I created a list, which contains any 'state changes' to the object/property combinations.  So my logic is to check the list first for the referenced property/object value & if it doesn't exist then go to the text resource.
Title: Re: Port of text adventure games to SCI
Post by: Cloudee1 on April 28, 2012, 03:22:17 AM
It sounds like everything is really starting to come together. Hopefully I'll get to play Zork soon
Title: Re: Port of text adventure games to SCI
Post by: gumby on November 02, 2012, 06:01:25 PM
Update:  I've spent the last week updating Zork with the 'robust parse' techniques that I've posted about in the past, which is helping bridging the gaps between SCI and zMachine.

Using the 'The Zork Psychological Test' (http://hunternuttall.com/blog/2010/03/the-zork-psychological-test/) as a test plan, I've got my parse success rate to 73% (56 out of 76).

Still a long way off, plenty of heap errors & still cannot leave the first room.
Title: Re: Port of text adventure games to SCI
Post by: gumby on December 12, 2012, 10:24:22 AM
Based on the Zork Psychological Test, I'm only failing 2 or 3 tests and these I will probably not fix them in the near future.  Inputs like 'drop all' don't work, you'll have to take/drop objects individually.

Moving between rooms works for most cases, and the heap errors have been mitigated.  Manipulation of the 'object tree' is somewhat broken, so taking/dropping objects sometimes makes them disappear completely.  I suspect this has to do with object 'sibling' relationships, but not certain yet.

As soon as I can debug one last movement scenario & correct the object tree code I'll upload and you guys can see how it's shaping up.
Title: Re: Port of text adventure games to SCI
Post by: Cloudee1 on December 14, 2012, 11:37:47 PM
Read the psychological test, pretty amusing really.

It sounds like you are getting real close to be there Gumby. Are you going to know what to do with yourself when you finally stamp this project done?
Title: Re: Port of text adventure games to SCI
Post by: gumby on December 16, 2012, 03:22:18 PM
I doubt I'll ever be done with this project :)

I've uploaded a new version.  As indicated, nearly all inputs from the psychology test work.  You can score up to 44 points (out of 350).  Navigating between rooms works correctly as well as interacting with objects (picking up, putting down, viewing in inventory, etc).

Some objects are still 'invisible' (there but can't be readily seen), I think this is a bug in handling 'supporters' - the kitchen table for example is classified as a supporter, supporting several items on it's surface that don't make themselves readily apparent to the player for some reason.

Heap errors are still quite common, so don't be surprised when you run into them.

Cloudee (or Doan) please replace the existing Zork demo that I uploaded eons ago with this latest version.
Title: Re: Port of text adventure games to SCI
Post by: Cloudee1 on December 18, 2012, 08:07:08 PM
The game has been loaded onto the fan games page and is now ready for scrutiny.

I know the feeling about never being done, I looked at spongebob the other day and realised that I started it back in 2004.
Title: Re: Port of text adventure games to SCI
Post by: gumby on January 19, 2013, 09:27:51 PM
I've finally resolved my serious heap issues with Zork.  I was tracking property state changes for objects in a Set (a subclass of the Collect class).  Somehow, the Set code would freak out under some circumstance and eat half my heap in a single call to it (from 16K to 8K).

I tried to isolate what the problem was with the Set code, but couldn't.  I even set up a simple template game to see if I could figure out, but I couldn't reproduce it (no heap issues arose).  Within Zork, I examined my Set after the heap was decimated and the Set appeared fine.  So it wasn't like I was inadvertently adding a thousand items to the set, or even adding nodes into the set that were ridiculously large - I was just add tuples of integers, my set had only two nodes in it.

I switched the code to use arrays instead of the Set and now the issue is gone.  I'm a little irked because I've been trying to alleviate this heap issue for over two years now.  I woke up this morning convinced it was indeed the Set code that was causing the issue, ripped it out, and within a half hour had an array equivalent coded up and working perfectly.
Title: Re: Port of text adventure games to SCI
Post by: Cloudee1 on January 20, 2013, 12:34:07 AM
Excellent work. Sometimes all it takes is the willingness to scrap an idea and try a new one.
Title: Re: Port of text adventure games to SCI
Post by: gumby on January 21, 2013, 12:26:36 AM
Cheating is implemented!

I've augmented the 'alt-debugging' in the main script to do some pretty cool things, inspired (okay, technically ripped) from the Perl Rezrov project (see http://search.cpan.org/~edmonson/Games-Rezrov-0.20/rezrov).

Now we can teleport to any room, which admittedly was already in the main script but I needed to modify it slightly to support Zork.  I added another debug command for showing all the rooms on screen with their corresponding number so the user doesn't have to guess.

Additionally, I did the same thing for obtaining any object in the game with a debug command, and did another debug command for showing all the objects on screen (just like the 'show rooms' debug command).

Finally, I added debugs for manipulating object properties.  One command give the 'light' property to any object (just in case you forgot your lamp!). Another weaponizes any object.  You can now kill the troll with a leaflet or any other object you choose (note: the combat code isn't working yet with the troll, but you can inflict damage on yourself).   I'm considering showing all the property numbers on-screen like the rooms & objects, and then creating a more generic object/property manipulator, but I'm not sure going this far is really necessary.

There are a couple more cheats that I'm going to probably implement (remove weight constraints of objects & making containers able to hold an infinite number of objects), but for now this seems sufficient.
Title: Re: Port of text adventure games to SCI
Post by: gumby on February 10, 2013, 07:55:32 PM
Combat is partially working.  Currently the only enemy that is 'fightable' is the troll (due to hardcoding of the villain) and he doesn't fight back.  But he takes damage, occasionally is disarmed or is knocked unconscious, and can be killed.
Title: Re: Port of text adventure games to SCI
Post by: gumby on March 02, 2013, 01:26:58 PM
Moved all the parser logic references out of the room scripts and into a single locale script.  This is much cleaner and takes all the repetitive logic and consolidates it in one place.

I'm also currently re-working the logic in the 'Loud Room'.  It's a bit tricky because in zcode this script conditionally bypassed the parsing routines in order to achieve the desired functionality in the room - those familiar with Zork will understand.  

I've already done something similar with the handling of the 'say' command, so that you can say anything in-game, like:
Code: [Select]
say 'gibber-jabber'                      (Nothing happens)
say I don't want to play anymore         (Nothing happens)
say "I'm taking my ball and going home"  (Nothing happens)

Good inputs are still possible & parseable:
Code: [Select]
say xyzzy     (A hollow voice says 'Fool')
say 'zork'    (At your service!)

Basically, I instructed the game to allow un-parseable inputs following the 'say' command which avoids the problem of needing every possible word in the vocab.  I'll need to do something similar, but only in that particular room.

Title: Re: Port of text adventure games to SCI
Post by: gumby on March 08, 2013, 07:20:37 PM
Just scored over 100 points ;D

Loud room is now functioning correctly.  Fixed a bug which now allows visiting the Temple and Maintenance rooms - I had a temporary array variable sized too small.  Canyon View can now be visited, similar issue with a another array variable sized too small to hold the room description.
Title: Re: Port of text adventure games to SCI
Post by: Cloudee1 on March 09, 2013, 12:16:01 PM
I was reading through some of the stuff on the cpan link you provided a couple of posts ago. I haven't done anything with SCI's file handling, but how hard would it be to create something like the #reco feature that they have incorporated in their interperter. I think when it comes to testing and trying to duplicate memory errors, a log of all of the userevents from the start of the game till presumebly right biefore the error would come in pretty handy. Controlled simply by a boolean in the main script, createCommandFile or whatever. If it's set then inputs are written to a text file. Any thoughts on this?
Title: Re: Port of text adventure games to SCI
Post by: gumby on March 09, 2013, 03:41:42 PM
Yeah, I've been kicking this idea around for months.  I'm primarily interested in creating file-based transcripts that could be 'replayed' within the SCI virtual machine.  This would be wonderful for automated testing for example, utilizing a modified transcript file to include expected responses.  Ultimately, I'd like to include all in-game events like mouse-clicks and keypresses (not just parser commands) coupled with some sort of timecode.

So you could start a game up, use a menu option like 'Replay transcript', pick your transcript file and then the game would play itself.
Title: Re: Port of text adventure games to SCI
Post by: Collector on March 09, 2013, 04:33:22 PM
Sounds like it could be useful for debugging. Seeing the exact sequence of events leading to an error would make it easier to track down causes. Could such a thing be crossed indexed against what was in heap and hunk?
Title: Re: Port of text adventure games to SCI
Post by: gumby on July 21, 2014, 07:30:09 PM
Okay, I'm back :).  Caught an awful case of Montezuma's Revenge while on vacation, and as a result I was able to put a lot of work into Zork.  I've uploaded a new version of the 'demo', though at this point I guess it's not really a demo anymore.

Here's a list of what's fixed in the latest version:

- Completely rewrote and fully implemented the Queue and QueueInterrupt functions (this is what makes the 'daemons' or 'timers' work)
- Fixed Random() function implementation, it was generating negative numbers but code was expecting only positive ones
- Fixed parsing of preposition 'at'
- Fixed JigsUp (death handler) functionality - wasn't referring to correct text res # to pull the values from
- Array-driven print functionality had their parameter values swapped
- Fixed printing random values from text res when index contained mathematical operation (LeakDaemon)
- Cosmetic:  Changed room scripts to be named the actual room instead of 'rmXXX'
- Fixed issue with attempting to print a single integer with the AppendMsgBuffer routine
- Vocabulary:  When a word is both a noun and an adjective, only give it the noun class.  Otherwise parsing was failing under certain scenarios (this was a fun one, I'll have to do a write-up on it at some point)

Out of heap errors are less frequent too.  I was able to score upwards of 150 points in this version before the game crashed on me.

The one bug that is really irritating is that sometimes the 'state' of things seemingly gets reset.  The kitchen window will occasionally close itself, sometimes treasures disappear from the trophy case.  Sometimes the 'visited' property gets reset so you'll get the initial description of an object even though you've seen it before.
Title: Re: Port of text adventure games to SCI
Post by: Collector on July 21, 2014, 07:45:08 PM
Welcome back! Too bad that we can't have a "managed" SCI with an automatic garbage collector. I can't think of anyway to do that from the template game or some add-in. Perhaps from a new compiler? It would be one hell of a thing to program, but if there were some script analyzer to look through the scripts for things like references to nonexistant resources and anything unused remaining in heap. It would probably have to be able to add code to defragment free heap.
Title: Re: Port of text adventure games to SCI
Post by: Cloudee1 on July 25, 2014, 08:11:33 AM
Ok, the game entry has been updated.
Title: Re: Port of text adventure games to SCI
Post by: gumby on July 25, 2014, 07:57:02 PM
Zork in French (screenshot below).  This has been one of my goals of this project from the very beginning.  A French version of this game does not exist, so I'll be doing all the translations with the help of my wife & mother-in-law (oh yeah and Google Translate).
Title: Re: Port of text adventure games to SCI
Post by: Collector on July 25, 2014, 08:47:00 PM
You're on Win8 now?
Title: Re: Port of text adventure games to SCI
Post by: gumby on July 25, 2014, 09:26:09 PM
Yeah.  The border gave it away (I have no idea)?  And extremely unhappy about it.  Laptop, Windows 8 with no touchscreen can kiss my...
Title: Re: Port of text adventure games to SCI
Post by: Collector on July 25, 2014, 10:36:36 PM
Have you tried Classic Shell (http://www.classicshell.net/)? Also, it looks like MS is going to try to bury 8 faster than they did Vista. http://www.computerworld.com/s/article/9249971/Microsoft_wants_you_to_forget_Windows_8?taxonomyId=125&pageNumber=1
Title: Re: Port of text adventure games to SCI
Post by: gumby on February 13, 2016, 07:04:47 PM
Ok, I'm seriously considering ditching all my previous efforts on this project and starting from scratch.  It kills me to do so, but I don't think I can overcome the heap consumption issues.

I love the parser, but I'm thinking about going the point and click route.  What worries me is the simplification of the game and how many different interactions that I need to make a cohesive game.  On the surface it sure seems like the standard set of PNC actions should work (walk, talk, look, use).  Still, I'm apprehensive.  The one thing that I am considering is making it in first person because of all the navigation that needs to take place in the game.  There's a lot of moving between screens and I would hate to have the player spend an inordinate amount of time just walking around the world getting from place to place.

Feedback would be greatly appreciated.
Title: Re: Port of text adventure games to SCI
Post by: Kawa on February 13, 2016, 08:17:43 PM
I don't see why you couldn't do it first person, really. The closeup portraits in the Larry games come to mind. Just don't call SetUpEgo for starters, heh.
Title: Re: Port of text adventure games to SCI
Post by: Collector on February 13, 2016, 09:20:00 PM
What about dialog trees, la QfG? Still simplified from a parser, but at least it allows more interaction and misdirection that just point and click. You could decompile QfG3 for some examples.
Title: Re: Port of text adventure games to SCI
Post by: gumby on February 20, 2016, 02:38:33 PM
That's a good idea Collector.  I can think of about 3 places in Zork where this might work where I really need the game player to say something specific to another actor in the game.  The good news is that there isn't any back-and-forth conversations between characters so I wouldn't need to do a lot of work here.  Now for a game like Deadline or Witness this would definitely be the way to go.
Title: Re: Port of text adventure games to SCI
Post by: gumby on February 27, 2016, 11:45:37 AM
Some small progress being made.  I've programatically created the .shm files for all immovable items (essentially props) for each of the rooms.  Wasn't too difficult, just needed to identify the correct items per room.

Here's what the file for the 1st room in Zork looks like:

Code: [Select]
;;; Sierra Script 1.0 - (do not remove this comment)
;304.shm (west_of_house)

;NOUNS
(define N_FRONT_DOOR_OBJ 1)
(define N_BOARD_OBJ 2)
(define N_WHITE_HOUSE_OBJ 3)

I build these lists of objects based on the decompiled property of 'scenery'.  Some items got missed because of this - in this example the mailbox.  I'll have some one-offs that I'll need to manually address.

Next  I need to create the 'global' equivalent .shm for all objects which can be moved in/out of inventory or between rooms.  Guessing this needs to be in 0.msg, but haven't looked into it as of yet.
Title: Re: Port of text adventure games to SCI
Post by: gumby on June 22, 2017, 09:14:22 PM
Making good progress.  I've worked out item take/drop functionality, 'containers' (like the mailbox), and conditional functionality.  Really standard stuff except for how I implemented take/drop.  No graphics work yet -
 avoiding it because I find it excruciatingly hard.

So far I've got good completion on the house region, mostly done up to the Living Room.