Skip to content

Instantly share code, notes, and snippets.

@shwang
Created October 19, 2020 23:15
Show Gist options
  • Save shwang/e1d9d8b508869e3e151d5a4a686f80bd to your computer and use it in GitHub Desktop.
Save shwang/e1d9d8b508869e3e151d5a4a686f80bd to your computer and use it in GitHub Desktop.
Reproduce caves recording/rendering bug
(Writted by Neel Alex)
1) A number of .yml files had to be changed to accomodate the new experiment:
* mcplugin/src/main/resources/experiments.yml
* mcplugin/src/main/resources/worlds.yml
* mcserver/plugins/HerobrainePlugin/experiments/experiments.yml
* mcserver/plugins/HerobrainePlugin/worlds.yml
2) Additional changes were made to java files
* mcplugin/src/main/java/io/github/herobraine/utils/ExperimentUtils.java
* mcplugin/src/main/java/io/github/herobraine/utils/MessageUtils.java
-> ArmorStand entities were causing errors with duplicate UUIDs on server start and shutdown - a special server setting in mcserver/paper.yml --> duplicate-uuid-resolver: nothing had to be set to prevent major errors.
* mcplugin/src/main/java/io/github/herobraine/utils/PortalUtils.java
3) New experiment specified in:
* mcplugin/src/main/java/io/github/herobraine/experiments/FindCavesExperiment.java
* Much of it is already specified in Experiment.java, and naturally implementing the abstract methods isn't tough.
* Basically gives the player a diamond block to start, then teleports them into a random* area in a large plains world. When player places the block, ends the experiment.
4) Build the plugin using maven install.
* A Java IDE should be able to detect the Maven config and set things up automatically for one-click compile - I don't really understand this.
* Once it's built, copy it to mcserver/plugins/Herobraine-0.0.1.jar
5) Start the server with java -jar paperclip.jar, or one of the launch commands they provide.
* If the server doesn't detect their downloadable worlds, it might try to generate new ones. This is annoying, and the easiest resolution is to find their new ones, then delete the new ones and paste in the old ones to the same directory, after shutting down the server.
6) Connect to the server with Minecraft + forge modloader
* You actually need Minecraft for this, AFAICT
* Minecraft default connects on port 25565 - if you're running the server on GCP, you need to set up a firewall rule to allow connections on 25565.
* Also, it needs to connect to a "user server" to authenticate your Minecraft id, so you need to also open port 8888 - but this isn't a problem locally
* Go to "Multiplayer", then "Direct Connect", then either enter "localhost" or the server external IP.
7) Play around. Either go to the portal for the caves experiment, or one of the other ones.
8) Press Escape/Disconnect to leave Minecraft.
9) Download the data.
* It might take a few minutes for the recorded packets to show up in s3
* Start with `aws s3 ls s3://pizza-party/2020 --profile minerl`, once you set up s3 keys to access the data.
* Sync the data you want to a directory matching their structure:
* IIRC, the way I did this was:
~/minerl.data/downloaded_sync/2020/09/24/16/player_stream_*
* I don't recall if the `minerl.data` and `downloaded_sync` names were necessary but probably better to assume they are.
* Actually, they do matter. If you want a different folder, you need to change minerl/minerl/data/util/constants.py
9.5) Technically, they have a download script available, but I haven't used them. YMMV. Anyway, the subsequent steps depend on their processing scripts, so might be worth familiarizing yourself.
* All their processing scripts are in:
minerl/minerl/data/pipeline
* You ought to be on minerllabs/minerl:master, or a branch up-to-date with their branch.
10) Merge the data.
* Ideally, you just run their merge.py scripts in the above folder.
* In practice...
* You may need to fiddle with their configs, or alter minerl/minerl/data/util/constants.py
11) Render the data.
* I _highly_ recommend going to minerl/minerl/data/util/constants.py and changing NUM_MINECRAFTS to be much lower unless you're running this on a big-CPU machine.
* You need to run make_minecrafts.py first.
* After running that, I think render.py ought to run
* ACTUALLY, it might not. It might throw OSErrors if it doesn't find folders - merge.py might do the same. If you just find the folder they were looking for and mkdir it so it's empty, you'll be fine. Nothing more involved is required.
12) Watch the rendered trajectories to see their early termination.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment