Riven engine overview
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)
- ospit (Gehn's office)
- pspit (prison island)
- gspit (garden island)
- rspit (rebel age)
- tspit (temple island).
- t_Data.mhk (Riven 5CD)
- t_Data1.mhk, t_Data2.mhk (Riven DVD)
- jspit (jungle island)
- bspit (boiler island)
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|
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:
Such association seems to be defined in the Riven.ini file, in particular from its "StackNumber" section.