Browse Source

Updated documentation

Iñigo Valentin 4 days ago
parent
commit
abed90e6d1
6 changed files with 96 additions and 10 deletions
  1. 9 1
      README.md
  2. 22 2
      doc/BUILD.md
  3. 55 0
      doc/CHANGELOG.md
  4. 3 1
      doc/INSTALL_DATA.md
  5. 3 2
      doc/STYLE.md
  6. 4 4
      doc/TODO.md

+ 9 - 1
README.md

@@ -71,13 +71,21 @@ The world map is playable, and it runs on the original world scripts, so it foll
 
 
 The installer turns your copy of the game into data that V-Gears can use. Point it to the ISO image of the PC install disk, choose a folder, and let it work. It converts the sounds, the music and the videos (with the help of FFmpeg and TiMidity; the videos come from the three game disks), and then it can verify the result and launch the game.
 The installer turns your copy of the game into data that V-Gears can use. Point it to the ISO image of the PC install disk, choose a folder, and let it work. It converts the sounds, the music and the videos (with the help of FFmpeg and TiMidity; the videos come from the three game disks), and then it can verify the result and launch the game.
 
 
+It also works from the command line, without needing a display:
+
+```bash
+v-gears-installer --iso ff7install.iso
+```
+
+You can choose which parts to install, start again from a clean directory, and check an installation afterwards. The installer keeps a record of what it installed, so the game can warn you when some data has to be installed again.
+
 |**Installer**|**Advanced options**|
 |**Installer**|**Advanced options**|
 |--|--|
 |--|--|
 |[<img src="https://v-gears.inigovalentin.com/img/screenshot/installer.png" alt="Installer" width="250"/>](https://v-gears.inigovalentin.com/img/screenshot/installer.png "Installer")|[<img src="https://v-gears.inigovalentin.com/img/screenshot/installer_advanced.png" alt="Advanced options" width="250"/>](https://v-gears.inigovalentin.com/img/screenshot/installer_advanced.png "Advanced options")|
 |[<img src="https://v-gears.inigovalentin.com/img/screenshot/installer.png" alt="Installer" width="250"/>](https://v-gears.inigovalentin.com/img/screenshot/installer.png "Installer")|[<img src="https://v-gears.inigovalentin.com/img/screenshot/installer_advanced.png" alt="Advanced options" width="250"/>](https://v-gears.inigovalentin.com/img/screenshot/installer_advanced.png "Advanced options")|
 
 
 ## Under the hood
 ## Under the hood
 
 
-V-Gears is written in C++14, with [Ogre](https://www.ogre3d.org/ "Ogre") for the graphics and LuaJIT for the scripts. The original field and world scripts are decompiled into Lua during the installation, and the battles and menus are written in Lua too, so a lot of the game can be read and changed without recompiling.
+V-Gears is written in C++14, with [Ogre](https://www.ogre3d.org/ "Ogre") for the graphics and LuaJIT for the scripts. The original field and world scripts are decompiled into Lua during the installation, and the battles and menus are written in Lua too, so a lot of the game can be read and changed without recompiling. The [building guide](doc/BUILD.md#source-layout "Source layout") shows how the source code is organized.
 
 
 When the original behaviour isn't documented, it is worked out from the game itself: damage formulas, camera scripts, summon effects and more come from studying the original executable and data files.
 When the original behaviour isn't documented, it is worked out from the game itself: damage formulas, camera scripts, summon effects and more come from studying the original executable and data files.
 
 

+ 22 - 2
doc/BUILD.md

@@ -58,11 +58,31 @@ ctest --output-on-failure
 
 
 There are two test programs:
 There are two test programs:
 
 
-- `v-gears-tests`, the tests of the engine and of the script decompiler. It links the engine library, so it takes a while to build the first time, and it needs the same dependencies as V-Gears.
-- `v-gears-installer-tests`, the tests of the installer logic (the option rules, the installation layout, the verifier, the log, the tool finder and the movie camera data) and of the data directory and Ogre plugin lookup. It doesn't need the rest of the engine, so it builds quickly.
+- `v-gears-tests`, the tests of the engine, the file formats, the data extractors of the installer and the script decompiler. It links the engine library, so it takes a while to build the first time, and it needs the same dependencies as V-Gears.
+- `v-gears-installer-tests`, the tests of the installer logic (the option rules, the command line, the installation layout and record, the clean installation, the verifier, the log, the external tools and the movie camera data) and of the data directory and Ogre plugin lookup. It doesn't need the rest of the engine, so it builds quickly.
 
 
 To build and run only one of them, pass just its name to `--target` and run it from the build directory, for example `./bin/v-gears-installer-tests`.
 To build and run only one of them, pass just its name to `--target` and run it from the build directory, for example `./bin/v-gears-installer-tests`.
 
 
+## Source layout
+
+You don't need this to build V-Gears, only to change it.
+
+| Directory | What's in it |
+|--|--|
+| `src/app/` | The entry point of the game, the application and the game loop. |
+| `src/common/` | Files, logger, strings, types and other utilities used by all the programs. |
+| `src/formats/` | Readers and writers of the file formats, by kind: `lgp/`, `field/`, `model/`, `texture/` and `worldmap/`. |
+| `src/engine/` | The engine, by subsystem: `audio/`, `config/`, `entity/`, `graphics/`, `input/`, `particles/`, `save/`, `script/`, `ui/` and `xml/`. |
+| `src/modules/` | The game modules: `battle/` and `worldmap/`. |
+| `src/installer/` | The data installer: `gui/` (window), `cli/` (command line), `steps/` (installation process), `extractors/` (data conversion), `decompiler/` (field and world scripts to Lua), `formats/`, `support/` and `tables/`. |
+| `src/third_party/` | Code from other projects. |
+| `test/` | The tests, in the same layout as `src/`. |
+| `data/` | The files that come with V-Gears: Ogre configuration, `engine/` (scripts, screens, fonts, texts, shaders) and `defaults/` (initial game configuration). No data of the original game. |
+
+The directories of the first five rows go from the lowest layer to the highest: `common`, `formats`, `engine`, `modules` and `app`. A layer never includes headers of a higher one. The engine reaches the application and the modules through its interfaces (`src/engine/*Interface.h`).
+
+Sources are not found automatically. Each folder of `src/` and `test/` lists its files in its own `CMakeLists.txt`, so add new files there, and add a new folder with `add_subdirectory()`.
+
 ## Make packages (optional)
 ## Make packages (optional)
 
 
 V-Gears can be packaged for Linux as a `.deb` package and as a `.tar.gz` archive. None of them includes data from the original game: the player still needs the data installer and their own copy of the game.
 V-Gears can be packaged for Linux as a `.deb` package and as a `.tar.gz` archive. None of them includes data from the original game: the player still needs the data installer and their own copy of the game.

+ 55 - 0
doc/CHANGELOG.md

@@ -1,5 +1,60 @@
 # Changelog
 # Changelog
 
 
+## Unreleased
+
+Changes since 0.4.0. Most of the work is in the data installer and in reorganizing the code, with the bugs found along the way.
+
+**The game data has to be installed again.**
+
+### Installer
+
+**Command line**
+- The installer also works from the command line (`v-gears-installer --iso <file>`), with presets and parts to choose what to install, `--verify` to check an installation, and exit statuses for scripts.
+- Installing doesn't need a display, a window or a graphics driver.
+- In a terminal it shows a single progress line, with the warnings and errors above it. Ctrl+C says that the installation didn't finish.
+
+**Installing**
+- Clean install works: it deletes the data of a previous installation and keeps your saves, settings and videos.
+- The installer keeps a record of the installation (`install.info`). The verifier and the game report unfinished installations and outdated data.
+- The extracted disk and the original files are deleted at the end, unless Preserve original data is selected, which is now off by default.
+- The progress covers the whole installation, including the extraction of the disk, and the window can install again without being closed.
+- Two installations of the same disk produce identical files.
+- A failed extraction of a file of the disk now fails the installation. Damaged disk images are handled safely.
+- The verifier looks for the Ogre plugins where the game looks for them.
+- Skipping the kernel data no longer skips the images and the fonts, and skipping the field models no longer says that the field maps were skipped.
+- Fixed crashes when no field had been converted or there were no field models, warnings about the language of the French releases, and the escaped characters in the log of the window.
+
+**Converted data**
+- Enemy attacks are no longer duplicated with broken animations.
+- Enemies drop and have the right items to steal: armors and accessories became other items.
+- Attacks that target all rows are read correctly, as are the formation flags of the enemies (the game doesn't apply them yet).
+- Each character is listed once in the character list, with its different models.
+- Fields are no longer skipped on purpose, and fields without texts are converted.
+- Fixed the textures of effect models, empty battle models, truncated animations and the garbage in some field tile images.
+- Fixed the third gateway and ladder arrows and the images of the "level" and "status" texts.
+
+### Installation directory
+- New layout: `engine/` (the files of V-Gears), `defaults/`, `game/` (converted game data, by area), `user/` (settings, controls, saves and screenshots) and `logs/`. Saves, settings and videos of older installations are moved to their new places.
+- The shipped files are replaced on every installation. Your settings are kept.
+- The Japanese and Russian languages are removed, as the font of the game can't show them.
+
+### Saving
+- Saving no longer keeps items, materia and data that were gone since the last save.
+- Saving to one slot no longer changes the others.
+- The key items, the learned enemy skills, the control key and the slot are read correctly.
+
+### Field and engine
+- Texts set by scripts are no longer cut after a tag.
+- Invalid texts no longer crash the game.
+- Fixed the scroll limits at the start of a field.
+- A map jump to a walkmesh triangle that doesn't exist uses the triangle under the position.
+
+### Code, build and documentation
+- The source code is organized by layer and subsystem, large classes and functions are split, and unused code is removed.
+- Each source folder has its own `CMakeLists.txt`.
+- Removed the data of the original game that was in the repository. The installer builds the fonts from the files of the game.
+- New tests, and a rewritten data installation guide.
+
 ## 0.4.0
 ## 0.4.0
 
 
 Changes since 0.3.5. Most of the work is in the battle and menu modules (rules, cameras, shops and materia), and in fixes from playing through the fields and the world map.
 Changes since 0.3.5. Most of the work is in the battle and menu modules (rules, cameras, shops and materia), and in fixes from playing through the fields and the world map.

+ 3 - 1
doc/INSTALL_DATA.md

@@ -217,7 +217,7 @@ The window and the command line don't share settings: the command line doesn't u
 
 
 | Window option | Command line part | What it is | Needs |
 | Window option | Command line part | What it is | Needs |
 |---|---|---|---|
 |---|---|---|---|
-| Extract game data | `kernel` | The kernel data: items, materia, characters, the initial savemap, the fonts. | |
+| Extract game data | `kernel` | The kernel data: items, materia, characters, the initial savemap. | |
 | Extract field maps | `fields` | The field maps, their scripts, backgrounds and texts. | |
 | Extract field maps | `fields` | The field maps, their scripts, backgrounds and texts. | |
 | Extract field 3D models | `field-models` | The models of the characters in the fields. | `fields` |
 | Extract field 3D models | `field-models` | The models of the characters in the fields. | `fields` |
 | Extract world map data | `world-map` | The world map. | the field maps, installed now or before |
 | Extract world map data | `world-map` | The world map. | the field maps, installed now or before |
@@ -229,6 +229,8 @@ The window and the command line don't share settings: the command line doesn't u
 | Extract music tracks | `music` | The music. | FFmpeg and TiMidity |
 | Extract music tracks | `music` | The music. | FFmpeg and TiMidity |
 | Extract videos | `videos` | The videos. They are not on the install disk: see [Extract the videos](#extract-the-videos). | FFmpeg |
 | Extract videos | `videos` | The videos. They are not on the install disk: see [Extract the videos](#extract-the-videos). | FFmpeg |
 
 
+The fonts are not a part: they are built from the game files in every installation from the install disk, because the game can't show text without them.
+
 A part can't be chosen without what it needs. In the window its option is disabled, and in the command line `--with field-models` alone is an error. When a part is removed, the parts that need it are removed too.
 A part can't be chosen without what it needs. In the window its option is disabled, and in the command line `--with field-models` alone is an error. When a part is removed, the parts that need it are removed too.
 
 
 ### Presets
 ### Presets

+ 3 - 2
doc/STYLE.md

@@ -35,6 +35,8 @@ Do not use non-standard extensions, such as GNU extensions. They are very specif
 
 
 Source files must have the extension `.cpp`.
 Source files must have the extension `.cpp`.
 
 
+Each folder lists its source files in its own `CMakeLists.txt`, so every new file must be added there. See the [source layout](BUILD.md#source-layout "Source layout") for where it belongs.
+
 ## Header Files
 ## Header Files
 
 
 In general, every `.cpp` file should have an associated `.h` header file. There are some exceptions to this rule:
 In general, every `.cpp` file should have an associated `.h` header file. There are some exceptions to this rule:
@@ -340,8 +342,7 @@ Filenames start with a capital letter and have a capital letter for each new wor
 * `ANiceLibrary.h`
 * `ANiceLibrary.h`
 * `Utilities.cpp`
 * `Utilities.cpp`
 
 
-For test files, use the same scheme, but with `test_` before the name:
-*   `test_MyUsefulClass.cpp`
+Test files have the same name as the file they test, in the same path under `test/`. For example, `test/formats/model/AFile.cpp` tests `src/formats/model/AFile.cpp`.
 
 
 C++ source files should end in `.cpp` and header files should end in `.h`. Files that rely on being textually included at specific points should end in `.inc`, but try to avoid them.
 C++ source files should end in `.cpp` and header files should end in `.h`. Files that rely on being textually included at specific points should end in `.inc`, but try to avoid them.
 
 

+ 4 - 4
doc/TODO.md

@@ -11,7 +11,7 @@ Suspects:
 
 
 - The script scheduling in `ScriptManager::Update`: a script that yields with `wait(0)` now lets the
 - The script scheduling in `ScriptManager::Update`: a script that yields with `wait(0)` now lets the
   next script of its entity run in the same cycle.
   next script of its entity run in the same cycle.
-- The priority of the talk script, `INTERACT_SCRIPT_PRIORITY` in `EntityManager.cpp`.
+- The priority of the talk script, `INTERACT_SCRIPT_PRIORITY` in `EntityTriggers.cpp`.
 - The durations of `WAIT` and `script:wait` that the installer converts (frames to seconds).
 - The durations of `WAIT` and `script:wait` that the installer converts (frames to seconds).
 
 
 First step: play the scene with log level 3 and look at the time between the `dialog_open` and
 First step: play the scene with log level 3 and look at the time between the `dialog_open` and
@@ -45,11 +45,11 @@ Not done yet (kernel data in ff7.exe, ids 170-176, see `get_special_limit` in `b
 
 
 ## World map: culling of the terrain geometry
 ## World map: culling of the terrain geometry
 
 
-The terrain of WM0 is built as one `ManualObject` per texture for the whole map (`CreateWorldMap`), so
+The terrain of WM0 is built as one `ManualObject` per texture for the whole map (`WorldmapTerrain::Load`), so
 its bounding box is the whole map and Ogre never culls it: every frame draws all of its ~142,000
 its bounding box is the whole map and Ogre never culls it: every frame draws all of its ~142,000
 triangles in ~320 batches, however little of it the camera sees. With the entity debug off it runs at
 triangles in ~320 batches, however little of it the camera sees. With the entity debug off it runs at
 about 110-140 fps in the tests. The search of the triangle under a position was the bigger problem and
 about 110-140 fps in the tests. The search of the triangle under a position was the bigger problem and
-is solved (spatial grid, `BuildTerrainIndex`).
+is solved (spatial grid, `WorldmapTerrain::BuildIndex`).
 
 
 Not planned for now. If it is needed: build the geometry per block or mesh (one object per mesh and
 Not planned for now. If it is needed: build the geometry per block or mesh (one object per mesh and
 texture), so the frustum culling skips the ones that are out of view, and measure the number of batches
 texture), so the frustum culling skips the ones that are out of view, and measure the number of batches
@@ -104,7 +104,7 @@ to the player, repeat) until the scene ends, which is intended: the way out is t
 and then to SOTCH. Their speed was measured (about 0.22 units/s against 0.7 of the player walking), so
 and then to SOTCH. Their speed was measured (about 0.22 units/s against 0.7 of the player walking), so
 they should not catch a moving player, but the player has been trapped a couple of times in the game
 they should not catch a moving player, but the player has been trapped a couple of times in the game
 (probably surrounded by solid models). Left as is. If it is looked at again: check how the player
 (probably surrounded by solid models). Left as is. If it is looked at again: check how the player
-collides with several solid NPCs that stop around it (`CheckSolidCollisions`).
+collides with several solid NPCs that stop around it (`WalkmeshMovement::CheckSolidCollisions`).
 
 
 ## Field: pillar_3, Ren not visible (to test)
 ## Field: pillar_3, Ren not visible (to test)