Tutorials:Adding Games: Difference between revisions

From LANCommander
No edit summary
No edit summary
 
Line 59: Line 59:
| A list of tags for the game
| A list of tags for the game
| Tag List
| Tag List
|}
==== Game Types ====
If you have a game that requires another game to be installed, you may have to specify the game type to modify the behavior of the installation.
{| class="wikitable"
|-
! Type
! Description
|-
| Main Game
| The game requires no special treatment. It is not dependent on any other game being installed. Most games will utilize this type.
|-
| Expansion
| This "game" is an expansion for another game. When starting a game, the base game and expansion actions are selectable in Playnite. The expansion's archive is extracted to the same directory as the base game.
|-
| Standalone Expansion
| This game entry is displayed separate from the base game in the game library. Installing a standalone expansion will initiate the install of the base game. The archive files are extracted to the expansion's own directory.
|-
| Mod
| The contents of the archive are extracted to the same location as the base game and installed when the base game is installed. Actions are merged and displayed on the client.
|-
| Standalone Mod
| The contents of the archive are extracted to the same location as the base game, but the mod is presented as a separate game in the library. Installing a standalone mod will trigger the install of the base game.
|}
|}



Latest revision as of 00:33, 22 February 2024

LANCommander does not provide or distribute any copyright protected works. This tutorial will only guide you through running the game using your own licensed copy of the game using legitimate CD keys

At the core of LANCommander, games are distributed to clients as ZIP files with optional PowerShell scripts. An authenticated Playnite extension upon installation of a game will download the archive, extract it, and then run any post-install script. Currently the extension runs install, key change, and name change scripts post-extraction. This tutorial will walk through how to add the game Call of Duty (2003) as it requires almost all features of LANCommander for a proper installation.

Adding A Game

Before continuing, it is strongly recommended that you link LANCommander to an IGDB account for automatic metadata retrieval. See Tutorials:Settings for more details.

Within LANCommander, navigate to Games in the top navigation bar. Then click Add Game at the top of the page.

A blank form will now appear. Enter the name Call of Duty into the Title field and click Lookup. A modal will appear with a list of games matching the title. Select the entry for Call of Duty, 10/29/2003, Infinity Ward and click the Select button.

The general form will now be populated with metadata pulled from IGDB. Click Save at the top of the page and you will be presented with the full editing form for the game.

General

The "General" panel of the game editor contains most of the metadata fields for a game. These are fields that can be used in the client extension to sort and filter games as well as providing a richer display of information for the game.

Field Description Data Type
Title The display name of the game String
Sort Title Optional title to change the sorting of games. Useful for games in a collection e.g. Call of Duty 1 String
Icon The .exe or .ico that exists in the archive to use as the game's icon String
Description A description about the game String
Released On The release date for the game DateTime
Singleplayer Denotes the game has a singleplayer mode Checkbox
Developers The list of developers that worked on the game Tag List
Publishers The list of publishers for the game Tag List
Genres The list of genres for the game Tag List
Tags A list of tags for the game Tag List

Game Types

If you have a game that requires another game to be installed, you may have to specify the game type to modify the behavior of the installation.

Type Description
Main Game The game requires no special treatment. It is not dependent on any other game being installed. Most games will utilize this type.
Expansion This "game" is an expansion for another game. When starting a game, the base game and expansion actions are selectable in Playnite. The expansion's archive is extracted to the same directory as the base game.
Standalone Expansion This game entry is displayed separate from the base game in the game library. Installing a standalone expansion will initiate the install of the base game. The archive files are extracted to the expansion's own directory.
Mod The contents of the archive are extracted to the same location as the base game and installed when the base game is installed. Actions are merged and displayed on the client.
Standalone Mod The contents of the archive are extracted to the same location as the base game, but the mod is presented as a separate game in the library. Installing a standalone mod will trigger the install of the base game.

Actions

This is a table-based form for defining actions for a game. Actions are the entry points to your game. For example, for Call of Duty we can specify two actions: singleplayer and multiplayer. The game has two separate executables (CoDSP.exe and CoDMP.exe respectively) for launching the game. By adding two separate actions, we can allow the user to choose either of these when launching the game from Playnite. Add two actions and populate them with the following information:

Name Path Arguments Working Directory Primary
Call of Duty (Multiplayer) CoDMP.exe {InstallDir} True
Call of Duty (Singleplayer) CoDSP.exe {InstallDir} True

Multiplayer

The multiplayer panel is used to denote the types of multiplayer available for the game. This is purely additional metadata. Defining these can make it extremely useful in LAN scenarios where you can find the right game for your session's player count. Enter the following modes for Call of Duty:

Name Path Arguments Working Directory Primary
Call of Duty (Multiplayer) CoDMP.exe {InstallDir} True
Call of Duty (Singleplayer) CoDSP.exe {InstallDir} True

Saves

LANCommander has the ability to store save games similar to how cloud saves work in other launchers. These saves are compressed into a ZIP file and stored into the logged in user's profile on the server after the game has been closed. They will be restored on every game launch, if accessible. Save paths can point to either the registry or a file path on disk. Enter the following save paths for Call of Duty:

Type Path
Registry HKLM:\SOFTWARE\WOW6432Node\Activision\Call of Duty
File {InstallDir}/Main/config_mp.cfg

Keys

One of the biggest pains of setting up games in a LAN party (besides running through installers) is the management of CD keys. With this in mind, LANCommander has the ability to store and allocate keys without requiring the user to see or enter the key. The keys panel of the game editor is used to define and store a list of keys that will be available to your players. In the next section, Scripts, you will see an example of how we can populate the key using a Key Change Script.

For obvious reasons, we can't distribute actual CD keys in this tutorial. You will have to source your own!

To add your own keys, click the Edit button and a new modal will appear. Enter each of your CD keys as a new line in the text editor, then hit the OK button. The table will now populate with all of your keys, though obscured from prying eyes as a password field. There are a few columns in this table that will be populated once a key is allocated to a player. Currently, LANCommander will only allocate keys based on the network MAC address of the computer used to install the game.

Scripts

The scripts panel is probably the part of the game editing that's the most technically involved as it involves knowledge of PowerShell and how a game may request other parts of the system. Visit the Games section of the wiki to see examples of games that may utilize scripts, as well as the tutorial pages for the script types:

For Call of Duty, here are some sample scripts that may be useful:

Name Change Script

This script simply changes the id Tech 3 variable "name" in the multiplayer config file.

$NewName = $args[0]
$InstallDir = $PSScriptRoot

function Write-ReplaceContentInFile([string]$Regex, [string]$Replacement, [string]$FilePath)
{
    $content = (Get-Content $FilePath) -replace $Regex, $Replacement
    [IO.File]::WriteAllLines($FilePath, $content)
}

Write-ReplaceContentInFile -Regex '^seta name (.+)' -Replacement "seta name ""$NewName""" -FilePath "$InstallDir\Main\config_mp.cfg"

Key Change Script

This script requires admin access to function properly

This script will take the key allocated by LANCommander and create the proper registry entry. Call of Duty keys are stored in the registry without the separating hyphens, so we strip those out on line 2.

$Key = $args[0]
$Key = $Key.Replace("-", "")

# Non-destructively creates path in registry
New-Item -Path "HKLM:\SOFTWARE\WOW6432Node\Activision"
New-Item -Path "HKLM:\SOFTWARE\WOW6432Node\Activision\Call of Duty"

# Creates or updates a key in the registry
New-ItemProperty -Path "HKLM:\SOFTWARE\WOW6432Node\Activision\Call of Duty" -Name "codkey" -Value $Key -Force

Archives

The final, but most important, step of creating a game in LANCommander is uploading the archive for the game. You will need to make a ZIP archive from the game files from a Call of Duty installation. At this point in the process it is worth checking out the wonderful PCGamingWiki for any patches or game fixes that might be needed for modern systems.

Once you have your ZIP archive, click on the Upload Archive button. A modal will pop up where you can specify the version of the archive, a changelog (if needed), and then you can select your archive. Once a valid file is chosen, click the Upload button and your archive will begin uploading to the server.

Final Steps

This tutorial has walked you through how to take a game and add it to LANCommander. If you have done everything correctly, you should now be able to see the game listed in Playnite after a library sync.

This tutorial used a fairly basic example of the type of game that LANCommander was built to work for. Games can get complicated depending on their use of configs and registry entries. On this wiki we have a fairly extensive list of games that you can use as reference. If you're adding a game that's not on our list, feel free to contribute!

Also feel free to check out any other tutorials! Over time this section will become more populated with useful tools, script development tips, and common practices used by game installers.