Author Topic: "Sierra Gets Creative" by Jimmy Maher  (Read 24989 times)

0 Members and 2 Guests are viewing this topic.

Offline lskovlun

Re: "Sierra Gets Creative" by Jimmy Maher
« Reply #45 on: October 21, 2016, 06:12:42 AM »
And he said that there were never two different systems and that King's Quest was only ever built on AGI. He doesn't rule out the possibility that it may have been known by another name early on.
But that does mean we still have an unanswered question. How did the code snippet in that Donald Trivette article end up looking like that? I mean it certainly isn't the classic AGI syntax.

Offline lance.ewing

Re: "Sierra Gets Creative" by Jimmy Maher
« Reply #46 on: October 21, 2016, 08:23:14 AM »
Not sure how it ended up looking like that, but I guess we have to assume that they sent the code snippet to him. It would be difficult to relate over the phone. The article mentions that he called Sierra, but I'd imagine that there was some follow up to that call and that Sierra provided him with the rather technical detail that that article contains.

Such a format might be easier to compile in to AGI bytecode. As you hinted at earlier, it appears to be a primitive syntax for essentially the same thing. Let's take a look at what was in the article:


This can be written in the more familiar AGI syntax as follows:

Code: [Select]
if (!isset(has.goat) && (obj.hit.edge == 14) && (edge.obj.hit == 1) && !isset(goat.gone) && !isset(showcarrot)) { = 11;

The following from the AGI.DOC file:

 If non-zero, indicates that an object (other than ego) hit the edge of
 the picture. The value of the var is the number of the object.

 When non-zero, indicates the edge of the screen that the object hit.
    top 1
    right 2
    bottom 3
    left 4

Object 14 is the goat. Not certain that the edge constant values are in alignment. On a first read of this logic, it would seem to be the bit of code that handles the goat walking from room 10 in to room 11. It seems to be Donald's assessment as well. But if that is the case (which it probably is), then the edge being tested should be the right edge and not the top edge.

I've found the equivalent code in the AGIv2 PC version using AGI Studio:

Code: [Select]
  if (v5 == 2) {
    v111 = 11;

This would appear to confirm that the edge should indeed by right (i.e. 2). v5 is edge.obj.hit. The code obviously isn't exactly the same. The additional checks in the if are instead handled further up. Obviously the clearing of f20 isn't in the magazine version. So either that really wasn't there, or they gave him an example that wasn't actually complete (or perhaps had a bug in it).

Offline NewRisingSun

Re: "Sierra Gets Creative" by Jimmy Maher
« Reply #47 on: October 22, 2016, 11:28:17 AM »
I have now stepped through KQ1's virtual machine enough to gain a basic understanding of how it works, and what the logic file format is like.

There are only two directories: rooms, and views. The directory is in absolute sector number 10, which in most disk images is at file offset 0x1400. The room directory is in the first 512 bytes, the view directory in the second 512 bytes. Each entry is of double-word size, containing the absolute start sector number, the number of sectors, and the starting offset into the start sector number. A room begins with the logic resource, directly followed by the picture resource. Resources have no headers, unlike AGI, where they start with 0x12 0x34 volume sizeLo sizeHi.

The first four words of the logic resource contain the four lengths, in bytes, of the four blocks of a logic resource. The game finds the picture resource simply by adding those four values together, thus seeking past the logic resource. The four blocks are:
  • Action subroutines
  • Test commands evaluated continously
  • Test commands and parser word tokens evaluated when a line is entered
  • Text strings
The test command blocks contain only a sequence of test commands (and, in the case of 3., parser word tokens), each followed by an offset into the Action subroutine block that is executed if the test evaluates positively. There seem to be only three test commands: equaln, not equaln, and posn. From what I have seen, there are only vars, no flags.

The string block has no pointers, only zero-terminated strings. Their offsets into the string block are hard-coded as parameters of the action commands themselves, instead of using message numbers.

There is no separate directory for sound resources. Room numbers 90 and up only contain sound resources, four in each room. The four words that in a normal room resource would contain the length of the four logic blocks here contain the length of each of the four sound resources that make up the "room" resource.

I suppose it's a matter of definition whether to call this thing AGI or not. The action and test commands do not match their respective AGI opcode numbers at all. For example, the functional equivalent to is command 0x04, and is command 0x37. Given all these differences, I'm more inclined to keep calling KQ1's language GAL, even as it is tempting to see the similarities.  Maybe if the logic format of the AGI version 1 interpreter were fully known, one would see more of a continuity between GAL and AGI version 2.

Knowing the structure of the logic resource as well as the length of all opcodes, but lacking knowledge of the meaning of the variables and some of the opcodes, where the disassembly is too obtuse, the next step for me will be to write a small decompiler of the logic resources. That will allow me to compare the output to AGIv2 KQ1.
Quote from: lskovlun
What that looks like to me, is a routine coded in assembly being wrapped to make it callable from a HLL.
No, that's not what it is. Wrapping an assembly routine to be HLL-callable would look something like this:
Code: [Select]
CLoadRoom proto c, roomNumber: word

CLoadRoom proc near
push bp
mov bp, sp
mov ax, [bp+4]
call AsmLoadRoom
pop bp
CLoadRoom endp

AsmLoadRoom proc near
; call with: AX=new room number
shl ax, 1
shl ax, 1
mov bx, ax
mov ax, [roomDirectory+bx]
AsmLoadRoom endp
What we have in KQ1 instead is the calling procedure establishing a stack frame, and all the BP references of the callee being relative to the stack frame that the caller has set up. That's extremely unusual.

It's also somewhat unusual to reserve room for local variables using "SUB SP, xx" before the "MOV BP, SP". It makes each argument's relative offset a function of the number of local variables. Normal compilers, including the one used to compile both AGI v1 and v2, subtract from SP after "MOV BP, SP". That way, arguments can be identified by BP+x, while locals are BP-x. That is the standard behavior, so standard that Intel turned into its own machine language instruction (ENTER) on their 1982's 80286 processor.
Quote from: lskovlun
From what I've seen there is no oddness here, only a mixture of C and ASM,
I suggest you look at my first example more closely. The caller function does not start with the PUSH BP; that occurs right in the middle of it.
« Last Edit: October 22, 2016, 12:19:17 PM by NewRisingSun »

Offline lance.ewing

Re: "Sierra Gets Creative" by Jimmy Maher
« Reply #48 on: October 23, 2016, 04:03:33 PM »
Well, the snippet is supposedly from KQ1, and it being the very first AGI game in existence I could well understand ithe language looking a bit... primitive. But still...

Looking further into it, the source is an article in Compute! That article calls the language Game Adaptation Language at this point. AGI is not mentioned at all, the protagonist's name is Sir "Grahame" and so on. So this is very early indeed.

But that raises another question - because we know that KQ1/AGI was published in several versions (including non-booter, AGIv2 ones). So did they have to change code/rewrite for this, or was this syntax always accepted?

I sent an email to Donald B. Trivette, the author of the February 1985 article on King's Quest linked to above. Today he replied with some answers.

He can't remember a lot of the specific details, but this is basically a summary of what he told me:

He liked the game, called and talked to the three principals at Sierra, those being Ken Williams, Roberta Williams and John Williams. He didn't speak to any of the technical staff. So all of that technical information about how the priority bands, controls lines, save areas, and logic scripts work would have come from one of these three people. The only communication he had with Sierra to get this information was over the phone, so it is amazing actually that he managed to capture such detail. He must have been quite specific with his questioning and I guess kept asking questions until he understood how it worked. This was, after all, the purpose of his phone call to them, i.e. to understand how such a game had been created.

It is interesting that he claims to have never heard of Jeff Stephenson.

Donald believes that he wrote the article all in the space of 4 to 5 days. There was no long lead time. He would write an article and submit it before the due date. It would then get published the next month. I'm guessing the Compute! magazine needed time after the "due date" to properly prepare the magazine as well. As I've noted previously, his reference to the scheduled Tandy 1000 release in January 1985 suggests that he wrote those words before January 1985. But it would seem that he didn't write the article much before that. I think our best guess would therefore be in December 1984, which is when King's Quest was really moving up the charts.

My final question to Donald was regarding the Game Adaptation Language. His answer was "I called it what ever Ken Williams called it, which must have been Game Adaptation Language".

So there we have it. He is pretty sure they told him that name.
« Last Edit: October 24, 2016, 06:56:23 AM by lance.ewing »

Offline lance.ewing

Re: "Sierra Gets Creative" by Jimmy Maher
« Reply #49 on: October 24, 2016, 04:24:41 PM »
He liked the game, called and talked to the three principals at Sierra, those being Ken Williams, Roberta Williams and John Williams. He didn't speak to any of the technical staff.

I sent an email to John Williams yesterday about the above and received a reply back today. He has quite an amazing memory actually. The questions that others are a bit vague on, he seems to recall quite a bit of the details.

I think we might have to bring Jeff Stephenson back in to the mix for AGI. John claims that Jeff has always been modest, and that he remembers Jeff having his fingers in everything that was part of the IBM development back then. I think HomeWord was an IBM related project, which Jeff certainly states that he was busy working on back in 1983, but Jeff doesn't give himself much credit for King's Quest, since I guess he wasn't part of the core team.

The picture I'm getting from talking to various people is that the King's Quest project was a team effort. Ken Williams had quite a guiding hand on the King's Quest project. People basically did what Ken wanted done, and Ken himself was very hands on with that project. We can understand why, because this project for IBM really needed to be a success. But John wouldn't call Ken the architect, since in John's words there were many pieces to that project and a lot of people deserve the credit. Certainly John wouldn't give Abraham and Tingley sole credit for the engine. Tingley, for example, was a good programmer and a key coder on the project, but he wasn't the architect either; he was just one of the team. Everyone felt free to toss ideas around and comment on everything. 

Neither Abraham nor Tingley left Sierra on good circumstances apparently..

I'm not sure where that leaves us really with regards to who originally wrote the AGI engine. It seems that we should give the team the credit.

Regarding the name Game Adaptation Language and the article that Donald B. Trivette published in February 1985, here is what John has to say:

"I remember Don Trivette and spoke to him many times. I know he spoke with Ken and got technical information and in fact we packaged that article in with some of our games for a while. The "first" meaning of AGI was "advanced graphics interpreter."   Moving games from system to system wasn't the big goal of the creation for the toolset.  It was really designed so that artists and musicians could be part of the development process - something that really wasn't possible at the time.   It was actually changed to "Game Adaption Language" at some point when we started using it to port games from machine to machine but at first it was really a workflow tool so that our artists could share work, do testing, etc. in the same system the programmers were working in. "

In response to this, I asked if he recalls Game Adaptation Language being renamed to Adventure Game Interpreter. He says that he does remember it being renamed to that at some point, and then went on to say that they were quite sloppy with their marketing back then, for which he takes full responsibility since he ran the marketing.  He says they were all basically a bunch of kids back then.

Offline lskovlun

Re: "Sierra Gets Creative" by Jimmy Maher
« Reply #50 on: August 15, 2017, 06:38:03 AM »
Throwback to this thread:

"the original coder" of what must be GAL in prison for kiddie porn?

Offline Collector

Re: "Sierra Gets Creative" by Jimmy Maher
« Reply #51 on: August 15, 2017, 09:22:18 AM »
Who is she referring to?
KQII Remake Pic

Offline lskovlun

Re: "Sierra Gets Creative" by Jimmy Maher
« Reply #52 on: August 15, 2017, 04:34:01 PM »

Offline Collector

Re: "Sierra Gets Creative" by Jimmy Maher
« Reply #53 on: August 16, 2017, 08:41:43 AM »
I have never heard of him before.
KQII Remake Pic

Offline lance.ewing

Re: "Sierra Gets Creative" by Jimmy Maher
« Reply #54 on: August 16, 2017, 02:18:22 PM »
He's been mentioned several times earlier in this thread.

Edit: I realised after posting the above that you've probably chosen to forget him. I've been doing the same over the past year after learning from Laine where he was and why. Part of the reason I didn't mention it here.
« Last Edit: August 16, 2017, 02:34:29 PM by lance.ewing »

Offline Collector

Re: "Sierra Gets Creative" by Jimmy Maher
« Reply #55 on: August 16, 2017, 07:28:29 PM »
I guess I should have been more clear that my remark was meant to be snarky.
KQII Remake Pic

Offline MusicallyInspired

Re: "Sierra Gets Creative" by Jimmy Maher
« Reply #56 on: August 17, 2017, 12:46:45 AM »
We need SCI-themed emotes here. :P
Brass Lantern Prop Competition

Offline Kawa

Re: "Sierra Gets Creative" by Jimmy Maher
« Reply #57 on: August 17, 2017, 08:14:07 AM »
We need SCI-themed emotes here. :P
I dunno about SCI-themed, but I can get you Larry.

Offline OmerMor

Re: "Sierra Gets Creative" by Jimmy Maher
« Reply #58 on: August 17, 2017, 02:07:27 PM »

Offline Kawa

Re: "Sierra Gets Creative" by Jimmy Maher
« Reply #59 on: August 17, 2017, 02:30:53 PM »
I don't see any non-red accounts in the queue, OmerMor.

SMF 2.0.19 | SMF © 2021, Simple Machines
Simple Audio Video Embedder

Page created in 0.133 seconds with 24 queries.