Difference between revisions of "Riven engine overview"

From A look inside The Link @ wiki
Jump to: navigation, search
(added link to the debug shell page)
(adding stack ID conversion for saved games)
Line 66: Line 66:
 
|-
 
|-
 
|tspit||392||ospit||1
 
|tspit||392||ospit||1
 +
|}
 +
 +
== Stack ID's in Saved Games ==
 +
In saved games, the "[[Riven variables#currentstackid|currentstackid]]" variable holds what the current stack is by a number. This table shows what stack each number represents:
 +
 +
{| border=1 cellpadding=4 cellspacing=0 style="border:1px #000 solid;border-collapse:collapse;"
 +
|- style="background:#CCC"
 +
! ID !! Stack
 +
|-
 +
|1||ospit
 +
|-
 +
|2||pspit
 +
|-
 +
|3||rspit
 +
|-
 +
|4||tspit
 +
|-
 +
|5||bspit
 +
|-
 +
|6||gspit
 +
|-
 +
|7||jspit
 +
|-
 +
|8||aspit
 
|}
 
|}

Revision as of 18:27, 14 July 2008

A Riven scenario is made of virtual objects called stacks and each stack is a list of virtual objects called cards. This may remember HyperCard: it's the same approach. Each card has an associated script, a sequence of commands to be executed in response of events happening to the card (for example, card creation). The player interacts with the game by means of invisible buttons, placed within cards and called hotspots. Hotspots have associated scripts too, responding to events different than cards (for example, mouse clicks). Within cards can also be placed bitmaps and movies. Finally, sounds can be played.

Riven stacks are named

  • aspit (main menu, books, setup screens)
    • a_Data.mhk
    • a_Sounds.mhk
  • ospit (Gehn's office)
    • o_Data.mhk
    • o_Sounds.mhk
  • pspit (prison island)
    • p_Data.mhk
    • p_Sounds.mhk
  • gspit (garden island)
    • g_Data.mhk
    • g_Sounds.mhk
  • rspit (rebel age)
    • r_Data.mhk
    • r_Sounds.mhk
  • tspit (temple island).
    • t_Data.mhk (Riven 5CD)
    • t_Data1.mhk, t_Data2.mhk (Riven DVD)
    • t_Sounds.mhk
  • jspit (jungle island)
    • j_Data1.mhk
    • j_Data2.mhk
    • j_Sounds.mhk
  • bspit (boiler island)
    • b_Data.mhk
    • b_Sounds.mhk

Physically, a stack is described by a set of data blocks called resources. Resources are identified by a 4-char type and an integer ID. Optionally they can also have a name, but it seems completely ignored by the engine. The resource type tells what kind of data is stored in the resource; see the resource type list for types used in Riven.

Resources belonging to a certain stack are archived inside an arbitrary number of Mohawk files (listed above under their respective stacks). The file "riven.cfg" tells which files compose each stack by associating stack and file names.

Saved games are Mohawk archives too, and they contain additional resource types as described in the resource type list.

The Riven engine has a secret, interesting debug shell.

Notes on stack switching

The current stack can be changed from scripts using script command 27. For example, when the player activates a MagLev, first the car movie is played, and then command 27 is called to change the current stack to the new island. This command is also used in the "Play Riven" button. However, most linking books actually change stack simply by moving to another card which has no buttons and no scripts. Apparently, there is some hardcoded mechanism inside the engine which triggers the stack change when one of these "special" cards is entered. These cards are listed here.

Stack Card ID Target stack Target card
bspit 447 ospit 1
gspit 178 ospit 1
jspit 228 rspit 3
jspit 344 ospit 1
ospit 58 pspit 43
ospit 62 jspit 341
ospit 67 gspit 175
ospit 72 bspit 444
ospit 76 tspit 387
pspit 46 ospit 1
rspit 13 jspit 215
tspit 392 ospit 1

Stack ID's in Saved Games

In saved games, the "currentstackid" variable holds what the current stack is by a number. This table shows what stack each number represents:

ID Stack
1 ospit
2 pspit
3 rspit
4 tspit
5 bspit
6 gspit
7 jspit
8 aspit