Skip to content

Commit

Permalink
Add barebones remote input handler
Browse files Browse the repository at this point in the history
Add ZMQ

Worlds shittiest minetest interface

CI MacOS install zmq

Handshakes, plus send Screenshots back

cleanup

Extract all command names

Move remote handler into own file

hook mouse

.

non-working protobuf commit

switch to capnproto

Send image with capnp

Send reward

Multi keypress in the client

support all possible keys

Add environment.yml

Commit unmodified eluther gym env

Fail to close the inventory

Minetester define action and obs space

Gymnasium basic work

gym env check bounds

switch dummy client to pygame

More work on gym client

more progress

First working gym client

Rm old client

Combine isRemote() and isRandom()

Make client port configurable

fix camera mode and sneak

.

fix remote cli flag

vscode

Add basic reward mod

Parse reward from HUD in C++

.

Cmake changes to get Linux building

README: add linux packages for capnp

minor linux changes

save png HACK

.

Linux CI deps

tri again

tri again

gitmodules

submodules

submodules

.

First draft

env start xvfb

more headless

fix screenshot startup issue

add handshaker for debugging

create a new world when starting a game

Now `minetest --gameid <foo> --go` should work.
Previously it would fail because a world was not specified, and the
default one did not exist.

Change-Id: Ic6001f73713d59930e96c3f2a30395f5b0b8cbb9

Improve Irrlicht instructions (#14055)

Specify the version when cloning.
Move instructions from CMakeLists to docs/compiling/.

Check if liquid can flow into empty node before picking it as source (#14057)

Fix unittest failure for release versions (#14067)

GUIFormspecMenu: Fix race condition between quit event and cleanup in Game (#14010)

To not instantly free GUIFormSpec upon close/quit, Game periodically
cleans up the remaining instance on the next frame.

When a new formspec is received and processed after closing the previous formspec
but before the cleanup in Game, the formspec would be closed regardless.
This now re-creates the formspec when the old one is already pending for removal.

Add sound volume when unfocused setting (#14083)

This adds a new setting to set sound volume multiplier when Minetest window is unfocused/inactive (sound_volume_unfocused, located in Settings > Graphics and Audio > Audio > Volume when unfocused).

If the window is not focused, the sound volume will be multiplied by sound_volume_unfocused setting. The sound volume will be set back to sound_volume again when the window is focused.

Avoid movement jitter (#13093)

This allows the client and server to agree on the position of objects and attached players even when there is lag.

Try to fix safeWriteToFile producing empty files on Windows (#14085)

Use win32 APIs to write the temporary file before copying to the final
destination. Because we've observed the final file being empty, we
suspect that std::ostream::flush is not flushing.

Also add a test for it.

Remove use_texture_alpha compatibility code for nodeboxes & meshes (#13929)

Warning: inform about entity name when bug detected about attachement (#13354)

Clean up porting.h a bit

Improve clock_gettime usage

- correctly use value of _POSIX_MONOTONIC_CLOCK
- drop special path for macOS: it supports clock_gettime since macOS 10.12

Reduce test framework macrosity

Delete clang-format files and comments (#14079)

Fix Windows architecture reporting in sysinfo

Upload artifacts in MinGW CI

Get rid of VERSION_EXTRA for buildbot

This is probably a leftover of when CMake didn't automatically
detect the revision from git.

Hash-check buildbot dependencies

Inventory: prevent item loss when stacking oversized ItemStacks (#14072)

Remove usage of removed "PP" macro

This fixes a compilation error introduced by e7be135.

Allow running individual benchmarks

mirrors and reuses the option from 2f6a9d1

Try to benchmark common MapBlock usage

Allocate data seperately from MapBlock class again

This effectively reverts commit b3503e7.

Change MapBlock content cache to a vector

Get rid of parent pointer in MapBlock

Elide MapBlock::contents_cached

Reduce size of some MapBlock members

Also adds assertions to catch refcounting errors (on a debug build).

Reorder members of MapBlock for performance

Before and after as obtained via `pahole -C MapBlock bin/minetest`:
/* size: 336, cachelines: 6, members: 23 */
/* sum members: 329, holes: 4, sum holes: 7 */
vs.
/* size: 336, cachelines: 6, members: 23 */
/* sum members: 329, holes: 2, sum holes: 7 */

There is not much to be gained by packing but I made sure
to move the most important data (mainly for the client) into
the first cache line.

Update porting.h to fix build errors on macOS 14 / Xcode 15

Allow cheaper culling checks at a distance (#14073)

* Allow cheaper culling checks at a distance
* Pick a random ray, so that far missing block will eventually be shown

Extract Game::drawScene from Game::updateFrame

Add `touch_controls` boolean to `get_player_window_information()` (#14092)

MinGW toolchain refresh

Add dithering (#9014)

Android: Pause rendering while the app is paused (#14058)

Hand roll UTF-16 conversion in CGUITTFont (#14121)

Extend bone override capabilities (#12388)

Fix touch input on Linux

The code relied on touch IDs being consecutive. This is true on Android, but not on Linux.
Therefore, touch input on Linux was broken since 53886dc.

Enable segment heap on Windows

Fix TouchScreenGUI ignoring server-sent pitch changes

Manually configurable minimum protocol version (#14054)

Partially address #13483.  Server operators can set a minimum
protocol version to match the game requirements (or any other
restriction they may want), and it's applied as an additional
constraint on top of the baseline compatibility range, optional
strict_protocol_version_checking, and any kick-on-join used by
the game/mods.

Fix on_(grant|revoke) not being run by mods

Split windows from linux CI workflows

Fix set_bone_position regression (error on passing none)

Initial implementation of 'Godrays'

Make volumetric light effect strength server controllable

- Make volumetric light effect strength server controllable
- Separate volumetric and bloom shader pipeline
- Require bloom to be enable, scale godrays with bloom

Touchscreen: Make server-sent overrides of button textures work (#14145)

Support specifying game in config

In minetest.conf:

```
game_dir = /path/to/game
```

Change-Id: I790cc6ea91aa988e82e0a1fda23ab4ae2f8026a3

Link with -latomic

Rework server stepping and dtime calculation

Address some clang-tidy warnings

Update clang-tidy workflow

Fix minor issue with log_deprecated()

Remove non-existent textures from texture_packs.md

These textures were removed 5 years ago by 326eeca.

Make the loading screen progress bar respect "gui_scaling"

MacOS: Add codesigning instructions to docs (#14060)

Optimize and improve built-in PNG writer (#14020)

Update CMakeLists.txt to fix MacOS build (#14160)

Co-authored-by: sfan5 <[email protected]>

Support both mouse and touch input in GUIs in a single binary  (#14146)

Avoid short overflow with large viewing ranges (#14175)

Rename `hud_elem_type` to `type` (#14065)

Fix AsyncRunStep() skipping steps when dtime < 1 ms

Clean up OS-specific initialization

Clean up gettext initialization

Enable some runtime hardening on win32

Perform server occlusion check before a block is loaded or generated (#14148)

Do not emerge blocks in the active_object_send_range_blocks range (#14152)

The active object range is about active objects (not blocks). Activate blocks (and hence any object "in" them) in the cone define by the active object range (and fov) when they are loaded (i.e. visible), otherwise ignore them.

Extend sanity checks in ActiveBlockList::update

also fixes the space indentation

Add missing header for gcc-14

https://gcc.gnu.org/gcc-14/porting_to.html

Signed-off-by: Alfred Wingate <[email protected]>

Method add_pos for object/player (#14126)

Comply with base64 license terms (#14199)

Remove reference to defunct gitlab docker image

see #14164

Fix tonemapping effect

Apply saturation even if tonemapping is disabled

Legible Lua profiler (#14142)

Replace clientmap's MeshBufListList with a hashmap

Use AL_SOFT_direct_channels_remix extension for non-positional stereo sounds (#14195)

Don't apply gui_scaling & DPI twice to table[] / textlist[] scrollbar (#14206)

Remove server's address and port from pause menu (#14082)

Touchscreen: Recognize double-taps as double-clicks  (#14187)

Fix GameUI text staying visible during shutdown. (#14197)

Don't run CDB update_detector more than once (#14214)

Remove controls listed in the pause menu (no touchscreen) (#13282)

Add "--needed" to Arch command to avoid reinstalling packages

Fix logic in porting::attachOrCreateConsole()

No functional change but now the comment is actually correct.

Add unittest to check thread_local destructor brokenness

Avoid unused argument spam with MinGW-clang

Fix native thread handle usage on win32

Fix some console window behavior on Windows

Ensure deterministic client occlusion culling and minor improvements (#14212)

* Ensure deterministic client occlusion culling
* Increase culling optimize distance slightly
* More accurate culling when sampling

Android: Add selection dialog (drop down/combo box) (#13814)

- The handling of IGUIComboBox uses the new setAndSendSelected() method.
- getDialogState() is now getInputDialogState() and returns the state of the input dialog.
- getLastDialogType() is added and returns current/last shown dialog's type.
- getInputDialogState() now returns an enum instead of int.
- getAndroidUIInput() now returns void instead of bool.
- New data types (enum) are added:
  (1) GameActivity.DialogType (Java) and porting::AndroidDialogType (C++)
  (2) GameActivity.DialogState (Java) and porting::AndroidDialogState (C++)
- When showing a text input dialog, there is no custom accept button text any more.
- showDialog()/showDialogUI() for text input is now showTextInputDialog()/showTextInputDialogUI().
- showInputDialog()/showDialogUI() for text input is now showTextInputDialog()/showTextInputDialogUI().
- getDialogValue()/getInputDialogValue() is now getDialogMessage()/getInputDialogMessage().

Co-authored-by: Gregor Parzefall <[email protected]>

Extend capabilities of Address class

Some minor cleanups for UDPSocket class

Rework client connecting and enable fallback address use

Fix dividing by zero crashes in texture modifiers

slimmer gitignore

Bit of cleanup

ruff

First ZMQ Req returns image

.

add a basic env test

Document env setup

ci

ci

ci

ci

.

ci

ci

ci

ci

ci

make build a bit faster maybe

ci

ci

ci

ci

pytest

pytest again

add channels

pytest

forgot to setup env

cleanup minetest env

pytest timeout & logging

.

doc

.

pytest

Rm wrong comment & stdout printing

ci

ci

Better macos instructions

rm android and windows ci

rm docker ci

try fix macos ci

try fix clang tidy

ci

macos submodules

macos submodules

macos submodules 1

macos submodules 1

macos submodules 1

macos submodules 1

macos submodules 1

Add test world

macos submodules 11

macos build again

move reward mod

move world

.

no mdofi
  • Loading branch information
siboehm committed Jan 17, 2024
1 parent fd5597a commit 9e7d9e0
Show file tree
Hide file tree
Showing 66 changed files with 1,935 additions and 147 deletions.
56 changes: 0 additions & 56 deletions .github/workflows/android.yml

This file was deleted.

46 changes: 36 additions & 10 deletions .github/workflows/linux.yml
Original file line number Diff line number Diff line change
Expand Up @@ -125,6 +125,42 @@ jobs:
run: |
./util/test_multiplayer.sh
pytest:
runs-on: ubuntu-22.04
steps:
- uses: actions/checkout@v3
- name: Install deps
run: |
source ./util/ci/common.sh
install_linux_deps clang-14 gdb
- name: Build
run: |
./util/ci/build.sh
env:
CC: clang-14
CXX: clang++-14

- uses: conda-incubator/setup-miniconda@v3
with:
python-version: '3.11'
mamba-version: "*"
channels: conda-forge,nodefaults
activate-environment: minetest
environment-file: environment.yml

- name: Setup Minetest env
shell: bash -x -l {0}
run: |
pushd python && pip install -e . && popd
- name: Run pytest
shell: bash -l {0}
run: |
set -euo pipefail
timeout 5m pytest -v || find artifacts/log -type f -name '*.log' -exec cat {} \;
# Build with prometheus-cpp (server-only)
clang_9_prometheus:
name: "clang_9 (PROMETHEUS=1)"
Expand All @@ -151,13 +187,3 @@ jobs:
- name: Test
run: |
./bin/minetestserver --run-unittests
docker:
name: "Docker image"
runs-on: ubuntu-20.04
steps:
- uses: actions/checkout@v3
- name: Build docker image
run: |
docker build . -t minetest:latest
docker run --rm minetest:latest /usr/local/bin/minetestserver --version
21 changes: 11 additions & 10 deletions .github/workflows/macos.yml
Original file line number Diff line number Diff line change
Expand Up @@ -33,17 +33,18 @@ jobs:
- name: Build
run: |
git clone https://github.com/minetest/irrlicht lib/irrlichtmt --depth 1 -b $(cat misc/irrlichtmt_tag.txt)
mkdir build
cd build
cmake .. \
-DCMAKE_OSX_DEPLOYMENT_TARGET=10.14 \
cmake -B build -S . \
-DCMAKE_FIND_FRAMEWORK=LAST \
-DCMAKE_INSTALL_PREFIX=../build/macos/ \
-DRUN_IN_PLACE=FALSE -DENABLE_GETTEXT=TRUE \
-DINSTALL_DEVTEST=TRUE
cmake --build . -j$(sysctl -n hw.logicalcpu)
make install
-DCMAKE_INSTALL_PREFIX=build/macos/ \
-DRUN_IN_PLACE=FALSE \
-DENABLE_GETTEXT=TRUE \
-DCMAKE_BUILD_TYPE=Debug \
-DBUILD_HEADLESS=FALSE \
-GNinja \
-DSDL2_DIR= \
-DCMAKE_EXPORT_COMPILE_COMMANDS=1
cmake --build build
cmake --install build
- name: Test
run: |
Expand Down
7 changes: 5 additions & 2 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -25,8 +25,6 @@ gtags.files
.idea
# Codelite
*.project
# Visual Studio Code & plugins
.vscode/
build/.cmake/
# Fleet
.fleet
Expand Down Expand Up @@ -66,6 +64,7 @@ AppDir
/client/mod_storage/

## Configuration/log files
artifacts/
minetest.conf
debug.txt
debug.txt.1
Expand Down Expand Up @@ -126,3 +125,7 @@ lib/irrlichtmt

# Generated mod storage database
client/mod_storage.sqlite

# Python
*.egg-info
*.pyc
13 changes: 13 additions & 0 deletions .gitmodules
Original file line number Diff line number Diff line change
@@ -0,0 +1,13 @@
[submodule "lib/zmqpp"]
path = lib/zmqpp
url = https://github.com/zeromq/zmqpp.git
[submodule "games/minetest_game"]
path = games/minetest_game
url = https://github.com/minetest/minetest_game.git
[submodule "lib/SDL"]
path = lib/SDL
url = https://github.com/libsdl-org/SDL.git
[submodule "lib/irrlichtmt"]
path = lib/irrlichtmt
url = https://github.com/Astera-org/irrlicht
branch = headless
11 changes: 11 additions & 0 deletions .pre-commit-config.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,11 @@
repos:
- repo: https://github.com/astral-sh/ruff-pre-commit
rev: v0.1.2
hooks:
- id: ruff
args: [--fix, --exit-non-zero-on-fix]
types: [python]
exclude: '^util/'
- id: ruff-format
types: [python]
exclude: '^util/'
5 changes: 5 additions & 0 deletions .vscode/extensions.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
{
"recommendations": [
"greenxenith.minetest-tools"
]
}
3 changes: 3 additions & 0 deletions .vscode/settings.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
{
"editor.formatOnSave": false
}
3 changes: 3 additions & 0 deletions CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -39,6 +39,7 @@ endif()

# Configuration options
set(BUILD_CLIENT TRUE CACHE BOOL "Build client")
set(BUILD_HEADLESS TRUE CACHE BOOL "Build in headless mode")
set(BUILD_SERVER FALSE CACHE BOOL "Build server")
set(BUILD_UNITTESTS TRUE CACHE BOOL "Build unittests")
set(BUILD_BENCHMARKS FALSE CACHE BOOL "Build benchmarks")
Expand Down Expand Up @@ -303,6 +304,8 @@ endif()
find_package(GMP REQUIRED)
find_package(Json REQUIRED)
find_package(Lua REQUIRED)
find_package(Zmq REQUIRED)
find_package(Zmqpp REQUIRED)
if(NOT USE_LUAJIT)
add_subdirectory(lib/bitop)
endif()
Expand Down
3 changes: 3 additions & 0 deletions builtin/settingtypes.txt
Original file line number Diff line number Diff line change
Expand Up @@ -1728,6 +1728,9 @@ deprecated_lua_api_handling (Deprecated Lua API handling) enum log none,log,erro
# Enable random user input (only used for testing).
random_input (Random input) bool false

# Enable input via remote message queue (for AI agent training).
remote_input (Remote input) string

# Enable mod channels support.
enable_mod_channels (Mod channels) bool false

Expand Down
10 changes: 10 additions & 0 deletions cmake/Modules/FindZmq.cmake
Original file line number Diff line number Diff line change
@@ -0,0 +1,10 @@
mark_as_advanced(ZMQ_LIBRARY ZMQ_INCLUDE_DIR)

find_path(ZMQ_INCLUDE_DIR NAMES zmq.h)
message(STATUS ${ZMQ_INCLUDE_DIR})

find_library(ZMQ_LIBRARY NAMES zmq)
message(STATUS ${ZMQ_LIBRARY})

include(FindPackageHandleStandardArgs)
find_package_handle_standard_args(Zmq DEFAULT_MSG ZMQ_LIBRARY ZMQ_INCLUDE_DIR)
41 changes: 41 additions & 0 deletions cmake/Modules/FindZmqpp.cmake
Original file line number Diff line number Diff line change
@@ -0,0 +1,41 @@
option(ENABLE_SYSTEM_ZMQPP "Use ZMQPP from system" TRUE)
mark_as_advanced(ZMQPP_LIBRARY ZMQPP_INCLUDE_DIR)
set(USE_SYSTEM_ZMQPP FALSE)

message(${CMAKE_SOURCE_DIR})


if(ENABLE_SYSTEM_ZMQPP)
find_library(ZMQPP_LIBRARY NAMES zmqpp)
find_path(ZMQPP_INCLUDE_DIR NAMES zmqpp.hpp PATH_SUFFIXES zmqpp)

if(ZMQPP_LIBRARY AND ZMQPP_INCLUDE_DIR)
message (STATUS "Using ZMQPP provided by system.")
set(USE_SYSTEM_ZMQPP TRUE)
else()
message (STATUS "Detecting ZMQPP from system failed.")
endif()

endif()

if(NOT USE_SYSTEM_ZMQPP)
message(STATUS "Using ZMQPP submodule")
find_path(ZMQPP_INCLUDE_DIR NAMES zmqpp/zmqpp.hpp
PATHS
${CMAKE_SOURCE_DIR}/lib/zmqpp/src/
PATH_SUFFIXES zmqpp)

find_library(ZMQPP_LIBRARY NAMES zmqpp
PATHS ${CMAKE_SOURCE_DIR}/lib/zmqpp/build)

message(${ZMQPP_INCLUDE_DIR})
message(${ZMQPP_LIBRARY})

if(ZMQPP_LIBRARY AND ZMQPP_INCLUDE_DIR)
message(STATUS "Using ZMQPP provided by the submodule.")
else()
message(FATAL_ERROR "ZMQPP submodule detection failed, please navigate to lib/zmqpp, initialize the submodule with \"git submodule update --init\", and then use \"make\" to build zmqpp")
endif()
endif()
include(FindPackageHandleStandardArgs)
find_package_handle_standard_args(Zmqpp DEFAULT_MSG ZMQPP_LIBRARY ZMQPP_INCLUDE_DIR)
12 changes: 6 additions & 6 deletions doc/compiling/linux.md
Original file line number Diff line number Diff line change
Expand Up @@ -18,25 +18,25 @@

For Debian/Ubuntu users:

sudo apt install g++ make libc6-dev cmake libpng-dev libjpeg-dev libxi-dev libgl1-mesa-dev libsqlite3-dev libogg-dev libvorbis-dev libopenal-dev libcurl4-gnutls-dev libfreetype6-dev zlib1g-dev libgmp-dev libjsoncpp-dev libzstd-dev libluajit-5.1-dev gettext
sudo apt install g++ make libc6-dev cmake libpng-dev libjpeg-dev libxi-dev libgl1-mesa-dev libsqlite3-dev libogg-dev libvorbis-dev libopenal-dev libcurl4-gnutls-dev libfreetype6-dev zlib1g-dev libgmp-dev libjsoncpp-dev libzstd-dev libluajit-5.1-dev gettext libcapnp-dev

For Fedora users:
For Fedora users (not checked):

sudo dnf install make automake gcc gcc-c++ kernel-devel cmake libcurl-devel openal-soft-devel libpng-devel libjpeg-devel libvorbis-devel libXi-devel libogg-devel freetype-devel mesa-libGL-devel zlib-devel jsoncpp-devel gmp-devel sqlite-devel luajit-devel leveldb-devel ncurses-devel spatialindex-devel libzstd-devel gettext

For openSUSE users:
For openSUSE users (not checked):

sudo zypper install gcc cmake libjpeg8-devel libpng16-devel openal-soft-devel libcurl-devel sqlite3-devel luajit-devel libzstd-devel Mesa-libGL-devel libXi-devel libvorbis-devel freetype2-devel

For Arch users:
For Arch users (not checked):

sudo pacman -S --needed base-devel libcurl-gnutls cmake libxi libpng sqlite libogg libvorbis openal freetype2 jsoncpp gmp luajit leveldb ncurses zstd gettext

For Alpine users:
For Alpine users (not checked):

sudo apk add build-base cmake libpng-dev jpeg-dev libxi-dev mesa-dev sqlite-dev libogg-dev libvorbis-dev openal-soft-dev curl-dev freetype-dev zlib-dev gmp-dev jsoncpp-dev luajit-dev zstd-dev gettext

For Void users:
For Void users (not checked):

sudo xbps-install cmake libpng-devel jpeg-devel libXi-devel mesa sqlite-devel libogg-devel libvorbis-devel libopenal-devel libcurl-devel freetype-devel zlib-devel gmp-devel jsoncpp-devel LuaJIT-devel libzstd-devel gettext

Expand Down
26 changes: 10 additions & 16 deletions doc/compiling/macos.md
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@
Install dependencies with homebrew:

```
brew install cmake freetype gettext gmp hiredis jpeg jsoncpp leveldb libogg libpng libvorbis luajit zstd gettext
brew install cmake freetype gettext gmp hiredis jpeg jsoncpp leveldb libogg libpng libvorbis luajit zstd gettext zeromq zmqpp
```

## Download
Expand All @@ -20,32 +20,26 @@ git clone --depth 1 https://github.com/minetest/minetest.git
cd minetest
```

Download Minetest's fork of Irrlicht:

```bash
git clone --depth 1 --branch "$(cat misc/irrlichtmt_tag.txt)" https://github.com/minetest/irrlicht.git lib/irrlichtmt
```

## Build

```bash
mkdir build
cd build
If `conda` is installed, it's a good idea to `conda deactivate` to make sure no conda env (not even base) is active, else it may lead to errors with `iconv` during linking.

cmake .. \
```bash
cmake -B build -S . \
-DCMAKE_FIND_FRAMEWORK=LAST \
-DCMAKE_INSTALL_PREFIX=../build/macos/ \
-DSDL2_DIR= \
-DBUILD_HEADLESS=FALSE \
-DRUN_IN_PLACE=FALSE -DENABLE_GETTEXT=TRUE

make -j$(sysctl -n hw.logicalcpu)
make install
cmake --build build
cmake --install build

# M1 Macs w/ MacOS >= BigSur
codesign --force --deep -s - macos/minetest.app
```

## Run

```
open ./build/macos/minetest.app
```bash
./build/macos/minetest.app/Contents/MacOS/minetest
```
18 changes: 18 additions & 0 deletions environment.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,18 @@
name: minetest
channels:
- conda-forge
- nodefaults
dependencies:
- python=3.11
- numpy
- pyzmq
- pre-commit
- gymnasium
- pytest
# for dummy client only
- pygame
- pillow
# more requirements
- pip
- pip:
- pycapnp # not available on conda-forge for M1 macs
1 change: 1 addition & 0 deletions games/minetest_game
Submodule minetest_game added at a3b171
Loading

0 comments on commit 9e7d9e0

Please sign in to comment.