Alone in the Dark (1-3)/Game Mechanics and Glitches
From SDA Knowledge Base
Contents
- 1 Alone in the Dark 1
- 2 ABOUT THE GUIDE
- 3 META
- 4 GAME
- 5 GAME WORLD
- 6 CAMERAS
- 7 OBJECTS AND ACTORS
- 8 MOVEMENT
- 9 ACTIONS
- 10 ITEMS/INVENTORY/MENUS
- 11 ENEMIES/FIGHTING
- 12 = HITFORCE/DAMAGE MANIPULATION
- 13 TIMERS/CHRONO/TIMER MANIPULATION
- 14 OOB/CLIPPING
- 14.1 SIDEWAYS CLIPPING
- 14.2 LAG MANIPULATION/LAG SNAP/LAG OOB
- 14.3 SNAPBACK CLIP
- 14.4 TRIGGER BOUNCE OOB
- 14.5 PUSHABLE OOB
- 14.6 CHAIN CLIPPING
- 14.7 PUSHABLE LAG OOB
- 14.8 PUSHABLE WEDGE OOB
- 14.9 PUSHABLE OOB OOB
- 14.10 PUSHABLE NARROW OOB
- 14.11 CLIMB OOB
- 14.12 FALL OOB
- 14.13 COLLISION OOB
- 14.14 PUSH CLIPPING/LIGHTWEIGHT CLIPPING
- 15 PRACTICAL TIPS/APPLIED
- 16 TAS-ONLY/GLITCHING/CRASHING/SOFTLOCKING/MEMORY CORRUPTION
- 17 MISCELLANEOUS
- 18 UNANSWERED QUESTIONS
- 19 Alone in the Dark 2
- 20 Alone in the Dark 3
- 21 Jack in the Dark
Alone in the Dark 1
ABOUT THE GUIDE
- Most of the information here is derived from testing the English CD-ROM version (GOG). If you want to study AitD 1 more, you should consider using a different version, since no other version has been tested nearly as thoroughly. The French CD version in specific is a good choice because of reasons explained under "known version differences".
- Mostly Emily was used in testing, there being no known reasons to go with Edward in a speedrun.
- The division into topics is sometimes quite arbitrary. Feel free to discuss the format on the discussion page (top left) so future guides may be better-organized. That having been said, to get well-enough versed in the game's/games' workings to be able to competently run them or build on the theory, you will have to cut through a very decent portion of the guide regardless of its exact structure.
- Inevitably some points are made more than once so edits should ideally happen in both, and even more vague and more detailed bullets may be given on the same topics. The notes were generally made from a segmented run's point of view, being able to abuse saving and loading at will with the small natural penalty segmented runs incur for this. Some save/load tricks may sound too optimistic though, and this is because I (LotBlind) made the false assumption the time in the menu before reaching the save menu would not be counted (which would have meant the penalty was diminutive).
- Because of some issues with file conversions, I may have been working with files that were at 25 FPS instead of 60 FPS (what you should use) sometimes when counting frames between events happening. Thus there may be a small amount of incorrect frame counts given in the guide. Please report this and any other mistakes.
- Feel free to contact the primary author of the guide (LotBlind) or tigrou (code-related and more technical questions) through the SDA forums for consultancy during any serious [speedrunning] endeavours. Also the guide is in a wiki format for a reason: it may be edited by anyone. Use the discussion page for relevant questions.
GLOSSARY
Game-internal terms
Game-internal terms | Meaning |
---|---|
object | the entities in the OBJETS.ITD file that have properties like BODY, LIFE, FOUNDLIFE etc., but in the guide this may have been used in the everyday sense as well |
actor | refers to any object that has been moved into the active actors' array in the RAM, but may have been confused with objects in some places |
FRAME | the game uses this to refer to keyframes, confusingly |
TRACK | pre-scripted movement, defined in LISTTRAK |
BODY | 3D models defined in the LISTBODY and LISTBOD2 files |
ANIM | animations defined in the LISTANIM and LISTANI2 files |
LIFE | the game's scripts are called LIFEs. The term "script" has been used sometimes. Stored in a file called LISTLIFE. |
LIFE_MODE | called LIFEMODE in the guide, determines if an actor is active at a given time based on focused actor location |
MOVE | movement mode |
TRACK_MODE | deprecated term for "MOVE" |
animActionType | an actor field, ACTIONTYPE in the guide |
HIT | This is all of: a possible actor ACTIONTYPE field value; the name of the command that causes an actor to enter the PRE_HIT and HIT ACTIONTYPEs (in the LIFEs); and an actor field that stores the ID of the actor that has just been HIT by it. |
IN_HAND | the item currently equipped, e.g. a weapon |
VAR/CVAR | the variables and constant variables the game writes into during gameplay |
ExRy | floor and room, as given in the game files and shown in the Room Viewer |
Example | Example |
Additional terms | Meaning |
---|---|
focused actor | actor that was set as the CAMERA_TARGET, usually the PC |
PC | player character |
EM/ED | Emily/Edward |
"having control" | VAR 0 being 1 |
INV | ALLOW_INVENTORY = inventory being accessible |
OOB | [to go] out-of-bounds (verb, noun, adjective...) |
IB | in-bounds |
desync | by default means desync of the ZV and ROOM Y-coordinates from their normal difference = vertical desync |
kf | keyframe inside an ANIM |
subframe | really sub-keyframe (one frame within a keyframe: what's normally called a "frame") |
hitbox | the box that is used to check whether a melee attack is connecting with another actor, displayed in red in the RV |
bbox | bounding box (also known as "zv"): the box used for collision checks with other actors and colliders, displayed in green (or white) in the RV |
transition | the PC hitting a floor/transition trigger to move onto another floor |
s/l | save and reload the same file |
slt | save/load turn |
ftt | deprecated term "first-time turn" referring to an incomplete slt |
Cx | camera with ID x |
ExCy | camera on floor x with ID y |
RV/Viewer | Room Viewer |
MV | Memory Viewer |
CV | Cache Viewer |
- LIFE, ANIM etc. numbers are given in the guide with a space in-between for clarity (ANIM 55, LIFE 112) even though in the scripts they're always spelled together. Also in the scripts CVAR is spelled C_VAR.
- All of the VARs, CVARs, ANIMs, BODYs etc. were named by LotBlind and those names are, as such, unofficial. All the names were written into a file called vars.txt. The game doesn't come with human-readable names for most things, except for items that you pick up which have the names shown in-game. Even those are only referred to by their IDs in the code if vars.txt was not present during decompiling LISTLIFE.ITD.
- Some variables and such may be referred to with different names/typography since during the project, tigrou may have renamed game-internal fields to be easier to understand, and in some cases, the original terminology was returned to afterwards. An attempt was made to conformize everything. Then again, the information is often too technical to get a perfect grasp of through this guide alone anyway.
META
USEFUL FILES
DOSBOX/EMULATORS
- While runs can only officially be recorded on whatever GOG or Steam copies are packaged with (unless the SDA rules have changed since writing this), other emulators may offer features beneficial to testing.
- While it would make a big difference in lag times, you're not allowed to change the default GOG CPU cycles setting of 11.000.
- If DOSBox has been left in the background while you're doing something else, it sometimes fails to refresh the window when you refocus it. Just minimize and un-minimize it until it shows right.
- ALT-F12 in DOSBox fast-forwards the game. This is not supposed to affect its functioning.
- DOSBox SVN-Daum has save states and other features that make it superior to DOSBox 1.4. It was not utilized at all.
- The state of PCem as a TAS-ready emulator should be kept an eye on. It seems the most likely candidate that could actually allow to TAS AitD for TASVideos.org.
ROOM VIEWER
- The Room Viewer (Viewer, RV) is a custom-made RAM watch utility, coded by tigrou, for Alone in the Dark series games that was gradually expanded on over the course of the segmented run project. Its functionalities are the widest in scope when used in conjunction with AitD 1. It comes with an attached readme for instructions but here are some additional notes as well.
- The RV has a built-in function (hit the "1" and "2" keys) to quickly test the workings of the two timers by winding them back 5 seconds at a time, and get specifically Timer 2 closer to a desired value. The game state that results, however, is not the same one it would have been had the timer been reset by rebooting the game, and so this is definitely not allowed during actual running.
- When recording runs and other material for AITD, please set up also recording two instances of the Room Viewer at the same time (one for the game world, one for the VARs), because this helps to analyse your work afterwards. In order to record both instances, you need two differently named copies of the Viewer. Recording your key presses will also help immensely. This can be done using NohBoard with THIS PRESET.
EDIT IN NOHBOARD AND THE PRESET FILE, MAKE SURE THE SECOND VERSION OF THE VIEWER IS PROVIDED?
- You might also find this Windows .bat file handy:
- ECHO "Remember Num Lock on!"
- You might also find this Windows .bat file handy:
PAUSE start "" "AITD room viewer" -screen-width 960 -screen-height 720 -screen-fullscreen 0 -speedrun start "" "AITD room viewer 2" -screen-width 1627 -screen-height 360 -screen-fullscreen 0 -speedrun start "" "NohBoard\NohBoard.exe"
- Just create a .bat file in the same folder as the .exes and that should work. Change the width and height to match your screen. The NUMLOCK reminder is there because NohBoard needs it to be on to see the keypad, but feel free to delete it. Also to make NohBoard see the inputs in the first place, you have to run it as administrator, which is a setting you can change through right-clicking and going to the compatibility tab.
- "-speedrun" makes the Viewer use default settings that make recording speedruns etc. more convenient and consistent: for example always making sure the extra info is shown on the bottom right with the player actor being focused. It may also cause some data to be displayed that wouldn't be otherwise.
- The Viewer cannot follow the player around during the intro cutscene unless you manually go to the right rooms. This is because it's set to track the actor that has TRACK_MODE 1 (manual movement) that only the PC has during regular gameplay.
- The Viewer's model viewer shows not only the BODYs but also can play ANIMs on top of them (indiscriminately). It also gives you the keyframe lengths and offsets.
- The warp command, even when just changing the actor's angle, can desync its coordinates. If it's happened to the PC, it should be reflected on by a new red bbox being drawn where the ROOM coordinates are. To avoid this, you should pause the game or make sure the actor isn't moving.
- You can only get some actors (most monsters and all pushables) to move between rooms, not e.g. any room script actors.
- The Viewer refreshes its memory (reads from the game process) at the same speed as your display refresh.
- There may be very small (e.g. one-frame) delays before a changed memory value shows in the Viewer. This may explain why it sometimes seems things that are supposed to happen on the same frame do not. You shouldn't always read too much into discrepancies of this size.
- The same goes for any keyboard visualizers you're using. I've seen the Room Viewer reacting to a key press before NohBoard did (which means the game reacted even quicker).
- There's information that will only be displayed in the RV for the CD-ROM release of AitD. This includes everything to do with timers.
- The delay/lag meter is set to only time occurences of lag of over 100ms long (i.e. loading lag).
- The Room Viewer gives you back the player character's information automatically if the currently selected thing is clicked on again to deselect it. This is so recording speedruns etc. is less likely to drop that information. However, if you never deselect that other entity before it's disappeared from memory (as when moving between floors), it will not revert to the player. This is because of another feature that's designed to make it easier to monitor some actor from the moment it's been loaded into memory.
- A small difference between holding the main ENTER key and keypad ENTER (see "lag manipulation") was only spotted late into the project. In the future the two keys should probably be tested separately but it seems very unlikely there's other differences. Similarly hitting 'I' to get to the inventory was initially overlooked, but is does the exact same thing as either ENTER key outside the inventory itself.
- SUB_KEYFRAMEs as shown in the RV are not reset when the game is reloaded. The field only exists in the RV, not in-game.
- Just in general, the RV does not directly know if the game has been reloaded.
- There is another branch of the RV called "highlighting" that highlights changes in all or most of the actor fields etc. shown in its window like they are in the VARs mode. This was deemed to make the screen too busy, and thus removed from the master.
- There are a few kinds of artifacts shown in the RV that look like the game glitches for a frame in a way that you can't see in the game's own window. Most of these are explained by the RV reading memory more frequently than the game updates it, thus showing mid-frame states as well as completed frame ones. The common trait is that you can't ever pause the game in the glitched state, which is how you can tell as well.
LIFEDISA/TRACKDISA/MEMORY VIEWER
CACHE VIEWER
FREE IN THE DARK HACK
GAME
GAME FILES
KNOWN VERSION DIFFERENCES
GENERAL
CONTROLS
MEMORY/CACHES/BUFFERS/SOUND SAMPLES
SAVING/LOADING
PAUSING
LIFE SCRIPTS
IMPORTANT/SPECIAL LIFES
IMPORTANT/SPECIAL VARS, CVARS, AND OTHER VARIABLES
INTERRUPTS
RENDERER
PALETTE
GAME WORLD
COLLIDER FLAGS
TRIGGERS
TRACKS
STAIRS/TRANSITIONS
DOORS
FRONT DOORS/JELLY
CAMERAS
CAMERA VIEWS
CAMERA DEFOCUS TRICK
WRONG PICKUPS/WRONG TRIGGERS
ROOM/VIEW DESYNC
OBJECTS AND ACTORS
OBJECTS
ACTORS/ACTIONTYPES
ACTOR SERIALIZATION INTO OBJECTS/OBJECT FIELDS/ACTOR FIELDS
BODYS
ANIMS/ANIMATIONS (GENERAL, NOT MOVEMENT)
ACTOR FLAGS
PLAYER CHARACTER
EMILY AND EDWARD DIFFERENCES (ANIMS)
PLAYER STATE
BODY/IN_HAND
BODY/IN_HAND DESYNC
SPACE
MOVEMENT
MODX/MODY/MODZ
ANIMATIONS (MOVEMENT)
EMILY AND EDWARD DIFFERENCES
SPEED
CORNERING
ROTATION
ACTIONS
(SPACE)