Author Topic: Importing a Character (a la Quest for Glory)  (Read 7888 times)

0 Members and 1 Guest are viewing this topic.

Offline Doan Sephim

Importing a Character (a la Quest for Glory)
« on: December 10, 2018, 09:10:10 PM »
How'd they do this? I assume it saved a file that contains values for certain variables, but what how would one accomplish actually importing this into another program?


Artificial Intelligence Competition

Offline MusicallyInspired

Re: Importing a Character (a la Quest for Glory)
« Reply #1 on: December 11, 2018, 09:16:56 AM »
I doubt it's a standard SCI save file. I haven't looked into it at all, but my guess is it's more likely a completely custom format in byte code that they scripted the games to understand. AGDI's QFG2VGA remake (made in AGS) will also understand these files and produce a new one for use in QFG3 onward.
Brass Lantern Prop Competition

Offline Kawa

Re: Importing a Character (a la Quest for Glory)
« Reply #2 on: December 11, 2018, 01:19:30 PM »
True enough on being a custom format.

Offline OmerMor

Re: Importing a Character (a la Quest for Glory)
« Reply #3 on: December 11, 2018, 03:59:31 PM »
I attached the original save and import scripts I could find.

Offline Charles

Re: Importing a Character (a la Quest for Glory)
« Reply #4 on: December 17, 2018, 04:31:20 PM »
It's interesting seeing these original scripts (especially since I think SCI Companion's decompiler has trouble decompiling those particular scripts).

I remember reading about one of the bugs in QFG2's exporting, related to one poor coder's misunderstanding of how boolean math works, but it's neat being able to see it in black and white.

Code: [Select]
;; Bits in svMiscEquip
(define  FINESWORD_BIT  $0001) ; fine sword
(define  FLAMESWORD_BIT $0002) ; flaming sword
(define  COMPASS_BIT    $0003) ; compass [NB, COMPASS_BIT == FINESWORD_BIT & FLAMESWORD_BIT]
(define  PIN_BIT        $0004) ; spahire pin
(define  LAMP_BIT       $0008) ; brass lamp
(define  TOKEN_BIT      $0010) ; EOF token
(define  GLASSES_BIT    $0020) ; X-Ray Glasses

; things transferred from "Quest for Glory 1"
(define  BABA_BIT       $0030) ; Flag set from QG1 [NB, BABA_BIT == TOKEN_BIT & GLASSES_BIT]
(define  SWORD_BIT      $0040) ; Sword
(define  CHAIN_BIT      $0080) ;
(define  PICK_BIT       $0100) ;
(define  TOOL_BIT       $0200) ;

I knew about the COMPASS_BIT, but the BABA_BIT is new to me.  It's interesting to see that the QFG3 import code also replicates the bug... I wonder if it just wasn't noticed as being wrong then. I imagine the AGD team had to leave that bug as is in QFG2VGA, because it's just too intwined to change, without breaking compatibility with QFG3/4.

Offline EricOakford

Re: Importing a Character (a la Quest for Glory)
« Reply #5 on: February 09, 2021, 12:34:39 PM »
And here are my recreations of the QFG3 Import and CharSave scripts! It's interesting that the game saves your inventory and whether you bought the blackbird from the junk dealers, since QFG4 doesn't use those at all (as you start with no items).

EDIT 2/10/2021: The import and export scripts for QFG4 are here! Also, I slightly updated the QFG3 scripts.
« Last Edit: February 10, 2021, 12:41:53 PM by EricOakford »
My SCI templates
SCI0 SCI0.1 SCI1.0 SCI1.1
SCI2.1 planned

Offline Kawa

Re: Importing a Character (a la Quest for Glory)
« Reply #6 on: February 10, 2021, 11:01:12 AM »
It's like Christmas in February.

Offline Doan Sephim

Re: Importing a Character (a la Quest for Glory)
« Reply #7 on: February 10, 2021, 12:14:30 PM »
It's like Christmas in February.
Agreed! I just wish I were capable of understanding more of this stuff.

Offline Kawa

Re: Importing a Character (a la Quest for Glory)
« Reply #8 on: February 10, 2021, 02:11:22 PM »
Agreed! I just wish I were capable of understanding more of this stuff.
That just means the code needs lots of comments!

Offline lskovlun

Re: Importing a Character (a la Quest for Glory)
« Reply #9 on: February 10, 2021, 05:14:40 PM »
That just means the code needs lots of comments!
And/or a design doc.

Offline Kawa

Re: Importing a Character (a la Quest for Glory)
« Reply #10 on: February 10, 2021, 06:05:21 PM »
And/or a design doc.
Imagine if the Coles followed in Lowe's footsteps and released the code for their games. There'd probably be either a fat document on hero importing, or a hefty comment block.

Offline OmerMor

Re: Importing a Character (a la Quest for Glory)
« Reply #11 on: February 11, 2021, 02:48:28 AM »
Imagine if the Coles followed in Lowe's footsteps and released the code for their games. There'd probably be either a fat document on hero importing, or a hefty comment block.

Unfortunately the Coles didn't keep most of their code. I do have a few character import/export scripts. Have I not released them here somewhere?

Offline OmerMor

Re: Importing a Character (a la Quest for Glory)
« Reply #12 on: February 11, 2021, 02:53:39 AM »
Have I not released them here somewhere?

Nevermind. Here they are.

Offline Kawa

Re: Importing a Character (a la Quest for Glory)
« Reply #13 on: February 11, 2021, 08:04:18 AM »
Huh. Surprisingly small amount of green in QfG3 RIMPORT there...

Offline lskovlun

Re: Importing a Character (a la Quest for Glory)
« Reply #14 on: February 11, 2021, 09:08:22 AM »
Huh. Surprisingly small amount of green in QfG3 RIMPORT there...
I'm not sure what you mean there. But it's definitely not the latest version of that script; it doesn't use the message system at all, which the final one of course does.
and yes, I've seen those before. I can't believe I haven't noticed this until now.


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

Page created in 0.034 seconds with 18 queries.