**Purpose**:
This document outlines some of the prerequisites as well as deployment process for an ARK: Survival Ascended Server

## Prerequisites
We need to install the Visual C++ Redistributable for both x86 and x64

- [Download Visual C++ Redistributable (x64)](https://aka.ms/vs/17/release/vc_redist.x64.exe)
- [Download Visual C++ Redistributable (x86)](https://aka.ms/vs/17/release/vc_redist.x86.exe)


## Run Unreal Engine Certificate Trust Script
There is an issue where if you run a dedicated server, part of that requires API access to Epic Games and that will not work without installing a few certificates.  The original Github page can be found [here](https://github.com/Ch4r0ne/UnrealEngine_Dedicated_Server_Install_CA/tree/main), which details the reason for it in more detail.

!!! note "Run as Administrator"
    You need to run the command as an administrator.  This command will download the script automatically and temporarily bypass the script execution policy to run the script:
    ```
    PowerShell -ExecutionPolicy Bypass -Command "irm 'https://raw.githubusercontent.com/Ch4r0ne/UnrealEngine_Dedicated_Server_Install_CA/main/Install_Certificate.ps1' | iex"
    ```

## SteamCMD Deployment Script
You will need to make a folder somewhere on the computer, such as the desktop, and name it something like "ARK Updater", then put the following script into it.  You will need to run this script before you can proceed to the next step.

```jsx title="C:\Users\nicole.rappe\Desktop\ARK_Updater\Update_Server.bat"
@echo off
set STEAMCMDDIR="C:\SteamCMD\"
set SERVERDIR="C:\ASAServer\"
set ARKAPPID=2430930
cd /d %STEAMCMDDIR%
del steamcmd.exe
timeout /t 5 /nobreak
curl -o steamcmd.zip https://steamcdn-a.akamaihd.net/client/installer/steamcmd.zip
powershell Expand-Archive -Path .\steamcmd.zip -DestinationPath .\
start "" /wait steamcmd.exe +force_install_dir "%SERVERDIR%" +login anonymous +app_update %ARKAPPID% validate +quit
exit
```

## Launch Script
Now you need to configure a launch script to actually start the dedicated server.  This can be placed anywhere, but I suggest putting it into `C:\asaserver\ShooterGame\Saved` along with the world save data.

```jsx title="C:\asaserver\ShooterGame\Saved\Launch_Server.bat"
@echo off
start C:\asaserver\ShooterGame\Binaries\Win64\ArkAscendedServer.exe ScorchedEarth_WP?listen?SessionName=BunnyLab?Port=7777?QueryPort=27015?ServerPassword=SomethingSecure?ServerAdminPassword=SomethingVerySecure -WinLiveMaxPlayers=50 -log -crossplay-enable-pc -crossplay-enable-wingdk -mods=928548,928621,928597,928818,929543,937546,930684,930404,940022,941697,930851,948051,932365,929420,967786,930494
exit
```

!!! tip "Adding Mods"
    When you are adding mods, you will notice they are found on [CurseForge](https://www.curseforge.com/ark-survival-ascended).   When you are looking for the mod ID, it is actually listed under CurseForge as the `Project ID`.  Just copy that number and put it in a comma-separated list such as what is seen in the example above. 

## Dump Configuration .ini Files
At this point, you will want to launch the server and have someone join it so it can generate the necessary world files / configuration data.  Then you will run the following commands in the console (from the server hosting the ARK server) in order to dump the configuration (ini) files to disk.

```
enablecheats <AdminPassword>
cheat SaveWorld
cheat DoExit
```

You will find the dumped configuration files at `C:\asaserver\ShooterGame\Saved\Config\WindowsServer`.  The files you care about are `Game.ini` and `GameUserSettings.ini`.

!!! warning "Do not modify while server is running"
    If you modify these configuration files while the server is running, it will overwrite the values when the server is stopped again.  Be sure to either set the variables in-game via the console so it dumps them to disk, or wait until the server is stopped to make configuration ini file changes.

!!! info "Optional: Generate Files from Singleplayer World"
    You may want to start a singleplayer world and set all of the configuration variables to your desired values, then load into the world.  Once you have made landfall, quit out of the game to shut down the singleplayer world.

    From this point, you can find your `Game.ini` and `GameUserSettings.ini` files in `steamapps\common\ARK Survival Ascended\ShooterGame\Saved\Config\Windows`.  Simply copy these two files into your server's configuration folder located at `C:\asaserver\ShooterGame\Saved\Config\WindowsServer` and launch the server.