diff --git a/docs/Creating_a_Package.md b/docs/Creating_a_Package.md index c1e2e9d34..0b705e98d 100644 --- a/docs/Creating_a_Package.md +++ b/docs/Creating_a_Package.md @@ -4,13 +4,13 @@ Please note that reverse-engineering projects are not supported for this project ## Structure -Each package has a folder with the build scripts and any static assets, such as a launcher script or custom configuration files for the game. These are located in the `engines` folder, so if you wanted to create a package for the dhewm3 engine, the path would be `engines/dhewm3`. For any dependencies that are needed by the engine, use vcpkg where possible. See fs2open/vcpkg.json for an example. +Each package has a folder with the build scripts and any static assets, such as a launcher script or custom configuration files for the game. These are located in the `engines` folder, so if you wanted to create a package for the dhewm3 engine, the path would be `engines/dhewm3`. For any dependencies that are needed by the engine, use vcpkg where possible. See `fs2open/vcpkg.json` for an example. The structure of an engine folder is as follows: * `env.sh` - Contains the steam app id list for the games that this engine applies to, as well as the path to the license file from the engine repository, if exists. If there are multiple app ids, then each one should be separated by a space. * `build.sh` - Script that will pull down the source repository, run any necessary configuration, and then build the engine. -* `assets/*` - If needed, an assets folder can be created for any static assets needed for the engine. If any scripts need to be run as part of setup or run, ensure that zenity is used with "$STEAM_ZENITY". +* `assets/*` - If needed, an assets folder can be created for any static assets needed for the engine. ## Build Script Explanation @@ -21,43 +21,51 @@ Phase where any necessary repositories are cloned and the correct branch or hash A simple clone phase can look like the following. The engine should always be cloned into the `source` directory - # CLONE PHASE - git clone https://github.com/dhewm/dhewm3.git source - pushd source - git checkout 3a763fc6 - popd +```bash +# CLONE PHASE +git clone https://github.com/dhewm/dhewm3.git source +pushd source +git checkout 3a763fc6 +popd +``` For engines with submodules, it can look like the following: - # CLONE PHASE - git clone https://github.com/Try/OpenGothic source - pushd source - git checkout -f b6a1260 - git submodule update --init --recursive - popd +```bash +# CLONE PHASE +git clone https://github.com/Try/OpenGothic source +pushd source +git checkout -f b6a1260 +git submodule update --init --recursive +popd +``` ### `BUILD PHASE` Phase where the building of the engine occurs. This would be where the engine's make scripts could be run. - # BUILD PHASE - pushd source/neo - mkdir build - cd build - cmake -DCMAKE_INSTALL_PREFIX=../../../tmp .. - make -j "$(nproc)" - make install - popd +```bash +# BUILD PHASE +pushd source/neo +mkdir build +cd build +cmake -DCMAKE_INSTALL_PREFIX=../../../tmp .. +make -j "$(nproc)" +make install +popd +``` ### `COPY PHASE` Phase where the copying of the binaries and libraries occur, to create the final package. The path to copy into should follow this template: `$diststart//dist/`, replacing `` with the app id necessary. If an engine supports multiple games, then the files would need to be copied into each app id, as shown below. - # COPY PHASE - cp -rfv tmp/bin/* "$diststart/9050/dist/" - cp -rfv tmp/lib/dhewm3/* "$diststart/9050/dist/" - cp -rfv tmp/bin/* "$diststart/9070/dist/" - cp -rfv tmp/lib/dhewm3/* "$diststart/9070/dist/" +```bash +# COPY PHASE +cp -rfv tmp/bin/* "$diststart/9050/dist/" +cp -rfv tmp/lib/dhewm3/* "$diststart/9050/dist/" +cp -rfv tmp/bin/* "$diststart/9070/dist/" +cp -rfv tmp/lib/dhewm3/* "$diststart/9070/dist/" +``` ## How-To @@ -67,58 +75,76 @@ The path to copy into should follow this template: `$diststart//dist/`, r 3. Create env.sh file, using the following template. - #!/bin/bash +```bash +#!/bin/bash - export STEAM_APP_ID_LIST="9050 9070" - export LICENSE_PATH="./source/COPYING.txt" - export ADDITIONAL_LICENSES="./source/LICENSE.DejaVu ./boost/LICENSE_1_0.txt ./glm/copying.txt ./data/LICENSE" +export STEAM_APP_ID_LIST="9050 9070" +export LICENSE_PATH="./source/COPYING.txt" +export ADDITIONAL_LICENSES="./source/LICENSE.DejaVu ./boost/LICENSE_1_0.txt ./glm/copying.txt ./data/LICENSE" +``` 4. Create build.sh, using the following template. - #!/bin/bash - - # CLONE PHASE - git clone https://github.com/dhewm/dhewm3.git source - pushd source - git checkout 3a763fc6 - popd - - # BUILD PHASE - pushd source/neo - mkdir build - cd build - cmake -DCMAKE_INSTALL_PREFIX=../../../tmp .. - make -j "$(nproc)" - make install - popd - - # COPY PHASE - cp -rfv tmp/bin/* "$diststart/9050/dist/" - cp -rfv tmp/lib/dhewm3/* "$diststart/9050/dist/" - cp -rfv tmp/bin/* "$diststart/9070/dist/" - cp -rfv tmp/lib/dhewm3/* "$diststart/9070/dist/" - +```bash +#!/bin/bash + +# CLONE PHASE +git clone https://github.com/dhewm/dhewm3.git source +pushd source +git checkout 3a763fc6 +popd + +# BUILD PHASE +pushd source/neo +mkdir build +cd build +cmake -DCMAKE_INSTALL_PREFIX=../../../tmp .. +make -j "$(nproc)" +make install +popd + +# COPY PHASE +cp -rfv tmp/bin/* "$diststart/9050/dist/" +cp -rfv tmp/lib/dhewm3/* "$diststart/9050/dist/" +cp -rfv tmp/bin/* "$diststart/9070/dist/" +cp -rfv tmp/lib/dhewm3/* "$diststart/9070/dist/" +``` 5. Set the appropriate permisions on the scripts. - chmod +x env.sh - chmod +x build.sh +```bash +chmod +x env.sh +chmod +x build.sh +``` 6. Test building the new package, using the instructions on the [Testing a Package](Testing.md) document. 7. Update `metadata/packages.json` to reflect the new package, using the following template. The information object will be used to display any necessary metadata on the packages list webpage. The download array will be created once the package has been built for the first time. - "9050": { +```json + { "game_name": "DOOM 3", - "download": [], - "command": "./dhewm3", - "engine_name": "dhewm3" + "download": [ + { + "name": "dhewm3", + "url": "https://github.com/luxtorpeda-dev/packages/releases/download/dhewm3-52/", + "file": "dhewm3-common-52.tar.xz", + "cache_by_name": true + } + ], + "command": "./run-dhewm3.sh", + "engine_name": "dhewm3", + "cloudAvailable": true, + "cloudSupported": true, + "app_id": "9050" } +``` - Engines that need further setup can use the following template: - - "13230": { +Engines that need further setup can use the following template: + +```json + { "game_name": "Unreal Tournament 2004: Editor's Choice Edition", "download": [ { @@ -147,12 +173,15 @@ The path to copy into should follow this template: `$diststart//dist/`, r "license_path": "../System/License.int" }, "command": "./run-ut2004.sh", - "use_original_command_directory": true + "use_original_command_directory": true, + "app_id": "13230" } +``` - Engines that need choices can look like the following: - - "7650": { +Engines that need choices can look like the following: + +```json + { "game_name": "X-COM: Terror from the Deep", "download": [ { @@ -181,9 +210,22 @@ The path to copy into should follow this template: `$diststart//dist/`, r "command": "./openxcom-oxce/run-tftd.sh", "download": ["openxcom-oxce"] } - ] + ], + "app_id": "7650" } +``` + +9. At the root level of packages.json, there is an engines key. Inside here is all of the engine information. A new engine should contain a new element inside engines, following the format of the others. For your app_id information, engine_name can be used to associate a game with a particular engine. + +10. Make sure to add the engine metadata as well as the game information. + +11. Once done with the new package, create a new pull request. Each pull request should only have one engine. + +## Steam Input Templates + +A `steam_input_template.vdf` can be provided in the engine assets, where the client expects it to be in the directory of the game before launching. This will then be imported to steam, where it can be found in the Search section, like below. + +Further details about creating the template can be found here: https://www.steamcontrollerdb.com/home/about/ -8. At the root level of packages.json, there is an engines key. Inside here is all of the engine information. A new engine should contain a new key inside engines, following the format of the others. For your app_id information, engine_name can be used to associate a game with a particular engine. +![image](https://github.com/luxtorpeda-dev/packages/assets/4337981/3a733fbf-21e8-485e-b9a1-18516413d1fb) -9. Once done with the new package, create a new pull request. Each pull request should only have one engine.