# MineDoJo ## Content - [Record](#Record) - [Setup](#Setup) - [Other](#Other) - [MineDojo筆記](https://hackmd.io/@tommyforwork07/BydIbznMn/edit) ## Record ### 0408 - 麥塊效率農耕 - 依據不同氣候、地形、農作進行產量分析 - 預期結果:模型能根據現有資源 進行產率最佳化的種植 - Reference - [minedojo](https://github.com/MineDojo/MineDojo) - [MineRL](https://minerl.readthedocs.io/en/latest/index.html) - [minecraft python api](https://github.com/martinohanlon/mcpi) - [Serene season mod](https://www.curseforge.com/minecraft/mc-mods/serene-seasons) - [不同形式的水能灌溉的土地範圍](https://read01.com/2Kmn43o.html#.ZDI0KtJBxH5) - [想過的其他主題](https://hackmd.io/@tommyforwork07/ry-or1wGh/edit) ### 0412 - 安裝MineDojo及虛擬環境 - [用conda建立及管理python虛擬環境](https://medium.com/python4u/%E7%94%A8conda%E5%BB%BA%E7%AB%8B%E5%8F%8A%E7%AE%A1%E7%90%86python%E8%99%9B%E6%93%AC%E7%92%B0%E5%A2%83-b61fd2a76566) - 尋找可以用的模組 - [four season](https://www.curseforge.com/minecraft/mc-mods/serene-seasons) - [four season github](https://github.com/Glitchfiend/SereneSeasons/blob/SS-public/src/main/java/sereneseasons/api/season/SeasonChangedEvent.java) - 嘗試架設模組伺服器 - [server.jar](https://www.minecraft.net/zh-hant/download/server) ### 0414 - 決定了之後要用的[模組(Terrafirmacraft)](https://www.curseforge.com/minecraft/mc-mods/terrafirmacraft) - Terrafirmacraft 需要同時搭配另一個模組[Patchouli](https://www.curseforge.com/minecraft/mc-mods/patchouli/download/3846086)才能使用 - 模組安裝且測試完成 - 外網伺服器因為穎沛Linux壞掉(4/15更新 : 已修好) 只能暫時用公開至局網測試 - [1.19.4 forge](https://files.minecraftforge.net/net/minecraftforge/forge/index_1.19.4.html) - [1.18.2 forge](https://files.minecraftforge.net/net/minecraftforge/forge/index_1.18.2.html) - [MineDojo安裝教學](https://docs.minedojo.org/sections/getting_started/install.html) - [RLcraft(溫度)](https://www.curseforge.com/minecraft/modpacks/rlcraft) - 額外連結 - [Minecraft 指令](https://minecraft.fandom.com/wiki/Commands) - [Minecraft random time tick command](https://beebom.com/how-change-tick-speed-minecraft/) ### 0419 - 楊森 mac 本地端安裝測試通過 - 穎沛 linux docker 安裝測試通過 - [yt範例 留言區有教學](https://www.youtube.com/watch?v=K0hFMMbrPg8&t=32553s) - [Run GUI app in linux docker container on windows host](https://dev.to/darksmile92/run-gui-app-in-linux-docker-container-on-windows-host-4kde) - [Xserver install](https://dev.to/) - 調整工作分配 - docker裡的minedojo如何部屬到外網的伺服器中? ### 0422 - MineDojo - How show the GUI in docker - 先不用server了 太難和minedojo整合 ## Setup ### To host mod server 1. Requirements - openjdk version >= 17 - use ```java -version ``` to check version - use ``` sudo apt install openjdk-17-jdk openjdk-17-jre ``` to install - [forge 1.18.2](https://files.minecraftforge.net/net/minecraftforge/forge/index_1.18.2.html) - mods - put in the mod folder generated by forge (server version) - [Terrafirmacraft](https://www.curseforge.com/minecraft/mc-mods/terrafirmacraft) - [Patchouli](https://www.curseforge.com/minecraft/mc-mods/patchouli/download/3846086) 2. Run the VPN - Network ID : ai454 - password : ai454 - Hamachi - [.deb file](https://www.vpn.net/linux) - ```java -jar logmein-hamachi_2.1.0.203-1_amd64.deb``` - [GUI version tutorial](https://forum.gamer.com.tw/Co.php?bsn=18673&sn=692280) 4. Run the server - Linux - use ```./run.sh``` to start - Windows - double click ```run.bash``` ### To join mod server 1. Join the Hamachi VPN - Network ID : ai454 - password : ai454 2. Join the server with the IP address provided by the host ### Mods - [1.18.2 forge](https://files.minecraftforge.net/net/minecraftforge/forge/index_1.18.2.html) - [Terrafirmacraft](https://www.curseforge.com/minecraft/mc-mods/terrafirmacraft) - [Patchouli](https://www.curseforge.com/minecraft/mc-mods/patchouli/download/3846086) - [Terrafirmacraft API](https://terrafirmacraft.github.io/Documentation/) ### Minedojo - [Mine Dojo官網](https://minedojo.org/) - [MineDojo安裝教學](https://docs.minedojo.org/sections/getting_started/install.html) - Linux採坑紀錄 - lxml pkg : [ImportError: cannot import name 'etree' from 'lxml'](https://juejin.cn/s/importerror%20cannot%20import%20name%20'etree'%20from%20'lxml'%20python%203.8) - lxml pkg : [TypeError: tostring() got an unexpected keyword argument 'pretty_print'](https://stackoverflow.com/questions/31942385/typeerror-write-got-an-unexpected-keyword-argument-pretty-print) - Docker - [Docker Image installation and startup](https://docs.minedojo.org/sections/getting_started/install.html#docker-image) - [Nvidia driver](https://ivonblog.com/posts/ubuntu-install-nvidia-drivers/#contents:1-%E5%AE%89%E8%A3%9Dnvidia%E5%B0%88%E6%9C%89%E9%A9%85%E5%8B%95) - Mac採坑紀錄 - getch沒有python 3, 所以會報錯 - Building wheel for getch (setup.py) ... error error: subprocess-exited-with-error ### API - [mcpi](https://pypi.org/project/mcpi/) - [連接伺服器 yt教學](https://www.youtube.com/watch?v=BWk3OZQ5TAw&t=322s****) - [pycraft](https://pypi.org/project/PyCraft/) - 採坑紀錄 - self.socket.connect((address, port)) ConnectionRefusedError: [Errno 111] Connection refused ### ZeroTier VPN - [教學](https://ivonblog.com/posts/setup-zerotier/) ### Access to GUI in the docker - Get the IP and the port of the container - ```docker inspect ID``` - [參考網址](https://stackoverflow.com/questions/43904562/docker-how-to-find-the-network-my-container-is-in) - ```--net=host``` - ```-v /tmp/.X11-unix:/tmp/.X11-unix``` - ```docker run -it --net=host -e DISPLAY=$DISPLAY --gpus all -d bfa72d27806f tail -f /dev/null``` ## Other ### 工作分配 - MineDojo(2人): 負責主要AI訓練程式碼 - 數據分析(1人): 整理並分析得到數據,做報告圖表 - 其他(視情況而定): - java(2人): 修改模組,得到我們想要結果 - 雜項(能者多勞): 蒐集整理得到數據資料 ### Deploy agent - 先部屬出一個agent在minecraft中 - docker不能存取本地的資料夾 須想辦法將minedojo的agent 連結到伺服器 - 難度由低到高 1. 把agent部屬到minedojo內建的世界 2. 把agent部屬到模組伺服器 3. 把agent部屬到minedojo內建的世界 並加入模組 ### 模組數據 - TFC模組農作物資訊整理(by chatGPT) | 作物 | 生長溫度 | 土壤要求 | 濕度要求 | 生長時間 | |:----:|:--------:|:------------:|:--------:|:-------:| | 小麥 | 5-30°C | 黏土或淤泥土 | 80%以上 | 約20天 | | 玉米 | 10-35°C | 淺土或淤泥土 | 70%以上 | 約30天 | | 大豆 | 15-35°C | 黏土或淤泥土 | 60%以上 | 約20天 | | 土豆 | 10-25°C | 淺土或淤泥土 | 70%以上 | 約30天 | | 番茄 | 15-35°C | 淺土或淤泥土 | 60%以上 | 約20天 | | 黃瓜 | 15-35°C | 淺土或淤泥土 | 70%以上 | 約15天 | | 南瓜 | 20-35°C | 淺土或淤泥土 | 60%以上 | 約40天 | | 稻米 | 20-35°C | 淺水或泥土 | 90%以上 | 約40天 |