# /vrg/ crawler

If you're just here to use this modpack, see [the website](https://crawler.vrg.party).

This is all the glue code and infrastructure to make the pack work. Read on if
you want the gory details.

## Goals

- Turn minecraft into an acceptable VR co-op dungeon crawler.
- Smooth over as many of the implementation details (including the fact it's a
  minecraft mod pack) as much as possible.
  - Auto-update clients automatically from the server config
  - Auto-update the canonical server from this repo.
  - Patch around the awful steamVR bindings setup experience.

## How It Works

This repo is primarily a [packwiz](https://packwiz.infra.link/)-based mod pack.
All the mods are pinned to specific Modrinth versions and the configs (client
and server) are versioned directly in the modpack. A deploy script on the
webserver syncs this repo state to <https://crawler.vrg.party/pack.toml>.

### MultiMC instance

The MultiMC / PolyMC / Prism Launcher compatible instance zip is put together
with minimal configuration in the `multimc-instance` dir. The instance uses
[packwiz-installer](https://packwiz.infra.link/tutorials/installing/packwiz-installer/)
as a pre-launch task to fetch the pack.toml file and actually download all the
mods for you, including updating/removing mods as needed.

The pack currently also autojoins the crawler.vrg.party server on launch. I _think_
this is nice and saves a few clicks, but could be convinced otherwise.

### Default Minecraft / Vivecraft Config

We include default `options.txt` and `optionsviveprofiles.txt` which unfuck some of
the conflicting keybinds and bad default Vivecraft settings, and have Vivecraft
radial menu bindings for some of the need-to-have things in the mod pack (like
the voice chat UI and the skills tree).

The defaults are only applied once by including them in the multimc instance zips,
rather than in the packwiz pack (which would overwrite whatever the user changes).
I think this is acceptable; if the user wants new defaults they can reimport the
entire instance and probably not lose anything important.

### SteamVR Bindings

The SteamVR bindings are awful, and even worse for non-steam games like Vivecraft; the
bindings are supposed to be in the workshop, but they're not. Plus you still have to click
through a bunch of things even if it was there.

Thus, we bundle the bindings json file in the pack, downloaded by packwiz, and
include the `setup-steamvr-bindings.ps1` script to copy the bindings file to the
`<documents>/steamvr/input/imports` directory, and then call the HTTP API that
steamVR uses internally in the bindings UI to click the button for you.

And also there's the `setup-steamvr-bindings.vbs` wrapper script, since ps1
scripts don't seem to run on double-click by default, but VBS does.

So you still have to do some stuff manually, but it's way less hassle than it'd be
otherwise.

Ideally the multiMC script would run the script on boot, but the packwiz-installer
already runs there. Might be able to make a wrapper to call both though.

### Mod Descriptions

Somehow, there is no existing tool that really shows you what's in a giant
modpack like this one. Sure you can stare at the multimc mods UI, or even look
at the flat list of mods in a modrinth modpack, but that's not very helpful;
it's at best an alphabetical list, all the library mods you don't really care
about are mixed in there, and it's hard to tell what's actually important.

So, I made `collect-mod-descriptions.py` to gather and update mod descriptions
into a nice html page. It involves manually categorizing all the mods by their
modrinth slug, which is a bit of a pain, but it's way more useful than a flat
list (or even the author-provided modrinth tags, which aren't that good).

To run it, first setup the environment:

```sh
python3 -m venv venv
pip install -r requirements.txt
```

Then run:

```sh
python3 collect-mod-descriptions.py mods mods.html
```

The script will complain if some of the mods in packwiz aren't tracked in the
python file itself (for manual categorization).

## Server

Since this is packwiz, you can use [itzg Minecraft Docker
image](https://docker-minecraft-server.readthedocs.io/en/latest/mods-and-plugins/packwiz/)
to (relatively) easily deploy a server using this pack.

One difficulty is that this pack uses [Simple Voice Chat](https://modrinth.com/mod/simple-voice-chat)
which needs UDP 24454 exposed to work. With docker-compose you can use:

```yaml
services:
  mc:
    ports:
    - 25565:25565 # minecraft TCP
    - 24454:24454/udp # simple voice chat UDP
```

to do this.

## Web Deployment

I set up a forgejo workflow to run on push to master. The workflow just sends
an HTTP POST to the webserver, where I set up a CGI script (through nginx and
fcgiwrap) that does the dirty work (git pull, update the multimc zip file); I
didn't want to give direct SSH access to the server for this since it's not
well isolated. Janky setup, but works for me.

## Contributing

If you'd like to contribute to this modpack or suggest changes, post in [the
thread](https://vrg.party). We'll see it. Upload your `git patch` output to
pastebin or whatever, if you're autistic enough to do that.
