Skip to content
This repository has been archived by the owner on Nov 14, 2024. It is now read-only.

Commit

Permalink
Add motion matching.
Browse files Browse the repository at this point in the history
  • Loading branch information
fire committed Oct 28, 2024
1 parent 4cc99d0 commit 60df793
Show file tree
Hide file tree
Showing 152 changed files with 7,425 additions and 1,099 deletions.
254 changes: 127 additions & 127 deletions .github/workflows/build.yaml
Original file line number Diff line number Diff line change
@@ -1,127 +1,127 @@
name: Build Platform Target

on:
push:
branches: [main]
pull_request:
branches: [main]
types: [opened, reopened, edited, synchronize]

jobs:
build:
runs-on: ubuntu-latest
permissions:
pull-requests: write
actions: write
container:
image: fedora:39
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
BENCHER_API_TOKEN: ${{ secrets.BENCHER_API_TOKEN }}
GODOT_BASE_BRANCH: main
CACHE_NAME: v-sekai-world

strategy:
fail-fast: false
matrix:
platform: [macos, linux, windows, android, web]
target: [editor, template_release, template_debug]

concurrency:
group: ${{ github.workflow }}-${{ github.ref }}-${{ matrix.platform }}-${{ matrix.target }}
cancel-in-progress: true

steps:
- name: Set up dependencies
run: dnf install -y just git

- name: Checkout code
uses: actions/checkout@v4

- name: Cache SCons cache
uses: actions/cache@v4
if: always()
with:
path: |
.scons_cache
emsdk
osxcross
jdk
android_sdk
vulkan_sdk
mingw
key: ${{ env.CACHE_NAME }}-${{ env.GODOT_BASE_BRANCH }}-${{ github.ref }}-${{ github.sha }}-${{ matrix.platform }}-${{ matrix.target }}
restore-keys: |
${{ env.CACHE_NAME }}-${{ env.GODOT_BASE_BRANCH }}-${{ github.ref }}-${{ github.sha }}-${{ matrix.platform }}-${{ matrix.target }}
${{ env.CACHE_NAME }}-${{ env.GODOT_BASE_BRANCH }}-${{ github.ref }}-${{ github.sha }}
${{ env.CACHE_NAME }}-${{ env.GODOT_BASE_BRANCH }}-${{ github.ref }}
${{ env.CACHE_NAME }}-${{ env.GODOT_BASE_BRANCH }}-refs/heads/${{ env.GODOT_BASE_BRANCH }}
${{ env.CACHE_NAME }}-${{ env.GODOT_BASE_BRANCH }}
- uses: bencherdev/bencher@main

- name: Fetch dependencies and Build Platform Target
run: |
just install_packages
export PLATFORM_ARGS=""
case "${{ matrix.platform }}" in
android)
PLATFORM_ARGS="fetch-openjdk setup-android-sdk"
;;
web)
PLATFORM_ARGS="setup-emscripten"
;;
windows)
PLATFORM_ARGS="fetch-llvm-mingw"
;;
macos)
PLATFORM_ARGS="build-osxcross fetch-vulkan-sdk"
;;
*)
PLATFORM_ARGS="nil"
;;
esac
bencher run \
--project 'v-sekai-world' \
--adapter shell_hyperfine \
--branch '${{ github.event_name == 'pull_request' && github.head_ref || github.ref }}' \
--testbed ubuntu-latest \
--threshold-measure latency \
--threshold-test t_test \
--threshold-max-sample-size 64 \
--threshold-upper-boundary 0.99 \
--thresholds-reset \
--ci-id ${{ runner.os }}-scons-${{ matrix.platform }}-${{ matrix.target }} \
--err \
--token '${{ secrets.BENCHER_API_TOKEN }}' \
--github-actions '${{ secrets.GITHUB_TOKEN }}' \
--ci-only-on-alert \
--file results.json \
"hyperfine --show-output --runs 1 --export-json results.json 'just $PLATFORM_ARGS && just build-platform-target ${{ matrix.platform }} ${{ matrix.target }}'"
- name: Upload Artifacts
uses: actions/upload-artifact@v4
with:
name: build-${{ matrix.platform }}-${{ matrix.target }}
path: godot/bin/*

- name: Upload TPZ File
uses: actions/upload-artifact@v4
with:
name: Godot-${{ matrix.platform }}-${{ matrix.target }}.tpz
path: tpz

- name: Upload Godot Editor Files
uses: actions/upload-artifact@v4
with:
name: Godot-${{ matrix.platform }}-${{ matrix.target }}
path: editor

merge:
runs-on: ubuntu-latest
needs: build
steps:
- name: Merge Artifacts
uses: actions/upload-artifact/merge@v4
with:
name: v-sekai-world
delete-merged: true
name: Build Platform Target
on:
push:
branches: [main]
pull_request:
branches: [main]
types: [opened, reopened, edited, synchronize]
jobs:
build:
runs-on: ubuntu-latest
permissions:
pull-requests: write
actions: write
container:
image: fedora:39
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
BENCHER_API_TOKEN: ${{ secrets.BENCHER_API_TOKEN }}
GODOT_BASE_BRANCH: main
CACHE_NAME: v-sekai-world
strategy:
fail-fast: false
matrix:
platform: [macos, linux, windows, android, web]
target: [editor, template_release, template_debug]
concurrency:
group: ${{ github.workflow }}-${{ github.ref }}-${{ matrix.platform }}-${{ matrix.target }}
cancel-in-progress: true
steps:
- name: Set up dependencies
run: dnf install -y just git
- name: Checkout code
uses: actions/checkout@v4
- name: Cache SCons cache
uses: actions/cache@v4
if: always()
with:
path: |
.scons_cache
emsdk
osxcross
jdk
android_sdk
vulkan_sdk
mingw
key: ${{ env.CACHE_NAME }}-${{ env.GODOT_BASE_BRANCH }}-${{ github.ref }}-${{ github.sha }}-${{ matrix.platform }}-${{ matrix.target }}
restore-keys: |
${{ env.CACHE_NAME }}-${{ env.GODOT_BASE_BRANCH }}-${{ github.ref }}-${{ github.sha }}-${{ matrix.platform }}-${{ matrix.target }}
${{ env.CACHE_NAME }}-${{ env.GODOT_BASE_BRANCH }}-${{ github.ref }}-${{ github.sha }}
${{ env.CACHE_NAME }}-${{ env.GODOT_BASE_BRANCH }}-${{ github.ref }}
${{ env.CACHE_NAME }}-${{ env.GODOT_BASE_BRANCH }}-refs/heads/${{ env.GODOT_BASE_BRANCH }}
${{ env.CACHE_NAME }}-${{ env.GODOT_BASE_BRANCH }}
- uses: bencherdev/bencher@main
- name: Fetch dependencies and Build Platform Target
run: |
just install_packages
export PLATFORM_ARGS=""
case "${{ matrix.platform }}" in
android)
PLATFORM_ARGS="fetch-openjdk setup-android-sdk"
;;
web)
PLATFORM_ARGS="setup-emscripten"
;;
windows)
PLATFORM_ARGS="fetch-llvm-mingw"
;;
macos)
PLATFORM_ARGS="build-osxcross fetch-vulkan-sdk"
;;
*)
PLATFORM_ARGS="nil"
;;
esac
bencher run \
--project 'v-sekai-world' \
--adapter shell_hyperfine \
--branch '${{ github.event_name == 'pull_request' && github.head_ref || github.ref }}' \
--testbed ubuntu-latest \
--threshold-measure latency \
--threshold-test t_test \
--threshold-max-sample-size 64 \
--threshold-upper-boundary 0.99 \
--thresholds-reset \
--ci-id ${{ runner.os }}-scons-${{ matrix.platform }}-${{ matrix.target }} \
--err \
--token '${{ secrets.BENCHER_API_TOKEN }}' \
--github-actions '${{ secrets.GITHUB_TOKEN }}' \
--ci-only-on-alert \
--file results.json \
"hyperfine --show-output --runs 1 --export-json results.json 'just $PLATFORM_ARGS && just build-platform-target ${{ matrix.platform }} ${{ matrix.target }}'"
- name: Upload Artifacts
uses: actions/upload-artifact@v4
with:
name: build-${{ matrix.platform }}-${{ matrix.target }}
path: godot/bin/*
- name: Upload TPZ File
uses: actions/upload-artifact@v4
with:
name: Godot-${{ matrix.platform }}-${{ matrix.target }}.tpz
path: tpz
- name: Upload Godot Editor Files
uses: actions/upload-artifact@v4
with:
name: Godot-${{ matrix.platform }}-${{ matrix.target }}
path: editor
merge:
runs-on: ubuntu-latest
needs: build
steps:
- name: Merge Artifacts
uses: actions/upload-artifact/merge@v4
with:
name: v-sekai-world
delete-merged: true
5 changes: 3 additions & 2 deletions .vscode/launch.json
Original file line number Diff line number Diff line change
Expand Up @@ -11,8 +11,9 @@
"name": "Run the editor with V-Sekai game",
"type": "lldb",
"request": "launch",
"cwd": "${workspaceFolder}",
"program": "${workspaceFolder}/godot/bin/godot.macos.editor.double.arm64",
"cwd": "${workspaceFolder}",
"args": ["--path", "../godot-motion-matching-demo", "-e"],
"program": "${workspaceFolder}/godot/bin/godot.macos.editor.arm64",
"preLaunchTask": "Godot Engine",
},
]
Expand Down
2 changes: 1 addition & 1 deletion .vscode/tasks.json
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@
}
},
"command": [
"scons werror=no compiledb=yes dev_build=no generate_bundle=no precision=double target=editor tests=yes debug_symbols=yes"
"scons werror=no compiledb=yes dev_build=no generate_bundle=no precision=single target=editor tests=yes debug_symbols=yes"
],
},
]
Expand Down
2 changes: 1 addition & 1 deletion godot/.github/workflows/linux_builds.yml
Original file line number Diff line number Diff line change
Expand Up @@ -106,7 +106,7 @@ jobs:
# TODO: Figure out somehow how to embed this one.
- name: wayland-scanner dependency
run: |
sudo apt-get install libwayland-bin
sudo apt-get install libwayland-bin libegl-dev
- name: Free disk space on runner
run: |
Expand Down
4 changes: 2 additions & 2 deletions godot/.gitrepo
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@
[subrepo]
remote = https://github.com/V-Sekai/godot.git
branch = groups-staging-4.4
commit = 72728eab208b88681e4fe134e6803fd0c221338a
parent = 36f0f607371ee76888b532cf09ab705cfeca3267
commit = 9e6d59698e670a5a1c92b44f510b51eb351f4ce1
parent = b179b03a24b8f9ba53dde047436035d124b061a3
method = merge
cmdver = 0.4.6
6 changes: 6 additions & 0 deletions godot/core/config/engine.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -267,6 +267,12 @@ bool Engine::is_extra_gpu_memory_tracking_enabled() const {
return extra_gpu_memory_tracking;
}

#if defined(DEBUG_ENABLED) || defined(DEV_ENABLED)
bool Engine::is_accurate_breadcrumbs_enabled() const {
return accurate_breadcrumbs;
}
#endif

void Engine::set_print_to_stdout(bool p_enabled) {
CoreGlobals::print_line_enabled = p_enabled;
}
Expand Down
6 changes: 6 additions & 0 deletions godot/core/config/engine.h
Original file line number Diff line number Diff line change
Expand Up @@ -73,6 +73,9 @@ class Engine {
bool use_validation_layers = false;
bool generate_spirv_debug_info = false;
bool extra_gpu_memory_tracking = false;
#if defined(DEBUG_ENABLED) || defined(DEV_ENABLED)
bool accurate_breadcrumbs = false;
#endif
int32_t gpu_idx = -1;

uint64_t _process_frames = 0;
Expand Down Expand Up @@ -186,6 +189,9 @@ class Engine {
bool is_validation_layers_enabled() const;
bool is_generate_spirv_debug_info_enabled() const;
bool is_extra_gpu_memory_tracking_enabled() const;
#if defined(DEBUG_ENABLED) || defined(DEV_ENABLED)
bool is_accurate_breadcrumbs_enabled() const;
#endif
int32_t get_gpu_index() const;

void increment_frames_drawn();
Expand Down
15 changes: 15 additions & 0 deletions godot/core/core_bind.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -934,6 +934,19 @@ Dictionary Geometry2D::make_atlas(const Vector<Size2> &p_rects) {
return ret;
}

TypedArray<Point2i> Geometry2D::bresenham_line(const Point2i &p_from, const Point2i &p_to) {
Vector<Point2i> points = ::Geometry2D::bresenham_line(p_from, p_to);

TypedArray<Point2i> result;
result.resize(points.size());

for (int i = 0; i < points.size(); i++) {
result[i] = points[i];
}

return result;
}

void Geometry2D::_bind_methods() {
ClassDB::bind_method(D_METHOD("is_point_in_circle", "point", "circle_position", "circle_radius"), &Geometry2D::is_point_in_circle);
ClassDB::bind_method(D_METHOD("segment_intersects_circle", "segment_from", "segment_to", "circle_position", "circle_radius"), &Geometry2D::segment_intersects_circle);
Expand Down Expand Up @@ -968,6 +981,8 @@ void Geometry2D::_bind_methods() {

ClassDB::bind_method(D_METHOD("make_atlas", "sizes"), &Geometry2D::make_atlas);

ClassDB::bind_method(D_METHOD("bresenham_line", "from", "to"), &Geometry2D::bresenham_line);

BIND_ENUM_CONSTANT(OPERATION_UNION);
BIND_ENUM_CONSTANT(OPERATION_DIFFERENCE);
BIND_ENUM_CONSTANT(OPERATION_INTERSECTION);
Expand Down
2 changes: 2 additions & 0 deletions godot/core/core_bind.h
Original file line number Diff line number Diff line change
Expand Up @@ -326,6 +326,8 @@ class Geometry2D : public Object {

Dictionary make_atlas(const Vector<Size2> &p_rects);

TypedArray<Point2i> bresenham_line(const Point2i &p_from, const Point2i &p_to);

Geometry2D() { singleton = this; }
};

Expand Down
22 changes: 22 additions & 0 deletions godot/core/error/error_macros.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -107,6 +107,28 @@ void _err_print_error(const char *p_function, const char *p_file, int p_line, co
_global_unlock();
}

// For printing errors when we may crash at any point, so we must flush ASAP a lot of lines
// but we don't want to make it noisy by printing lots of file & line info (because it's already
// been printing by a preceding _err_print_error).
void _err_print_error_asap(const String &p_error, ErrorHandlerType p_type) {
if (OS::get_singleton()) {
OS::get_singleton()->printerr("ERROR: %s\n", p_error.utf8().get_data());
} else {
// Fallback if errors happen before OS init or after it's destroyed.
const char *err_details = p_error.utf8().get_data();
fprintf(stderr, "ERROR: %s\n", err_details);
}

_global_lock();
ErrorHandlerList *l = error_handler_list;
while (l) {
l->errfunc(l->userdata, "", "", 0, p_error.utf8().get_data(), "", false, p_type);
l = l->next;
}

_global_unlock();
}

// Errors with message. (All combinations of p_error and p_message as String or char*.)
void _err_print_error(const char *p_function, const char *p_file, int p_line, const String &p_error, const char *p_message, bool p_editor_notify, ErrorHandlerType p_type) {
_err_print_error(p_function, p_file, p_line, p_error.utf8().get_data(), p_message, p_editor_notify, p_type);
Expand Down
Loading

0 comments on commit 60df793

Please sign in to comment.