nicholas-maltbie / Godot-OpenKCC

Godot Open-Source Kinematic Character Controller

Home Page:https://openkcc.nickmaltbie.com

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

OpenKCC Godot

Style Guide

Style guides used for project by language:

Linting

C++ formatting via clang-format. Can be installed format via pip.

# Install
python -m pip install clang-format

# Find formatting via clang-format
clang-format src/*.cpp --dry-run
clang-format src/*.h --dry-run

# Fix formatting via clang-format
clang-format src/*.cpp -i
clang-format src/*.h -i

GDScript linting via godot-gdscript-toolkit with the gdlint command

# Install gdlint via pip
pip3 install gdtoolkit

# Run gdlint on openkcc files
gdlint openkcc/addons/openkcc openkcc/scripts openkcc/tests

Note: still in progress C# linting via dotnet format can be installed via dotnet in repo.

# Install via dotnet, uses .config/dotnet-tools.json
dotnet tool restore

# Run dotnet-format command via dotnet tool run
dotnet tool run dotnet-format .\openkcc\GodotOpenKCC.sln --check

Note: still in progress Markdown linting via markdownlint can be installed via npm.

# Install cli version via npm
npm install -g markdownlint-cli

# Run on local repo
markdownlint .

Project Setup

Install Godot v4.2-stable, then make sure to setup the build tools for the project. Setup guide for required tools by platform: Building from Source

Using the GDExtensions to develop with C++, see GDExtension C++ example for details.

Note install godot via Scoop for windows, see Command Line Tutorial from Godot's docs for more details.

# Setup godot-cpp
git -C godot-cpp submodule update --init

# Setup build platform tools for windows and web environment
scons --directory godot-cpp

# Build openkcc libraries for your development platform.
scons
scons target=editor

# Note, I ran into some issues with the build and multi threading and
#  some of the build dependencies attaching a flag such as -j1 at the end
#  seemed to resolve those errors.

Tests

Run tests for project with GUT

godot -d -s --path openkcc addons/gut/gut_cmdln.gd

Build

Build project export using godot via cli or via the editor.

Build Windows Platform

See setup guide Compiling for Windows with godot.

# Build libraries for openkcc
scons --directory godot-cpp platform=windows
scons platform=windows target=template_release

# Optional: Download redit tool
$url = "https://github.com/electron/rcedit/releases/download/v1.1.1/rcedit-x64.exe"
$out = "external\rcedit-x64.exe"
Invoke-WebRequest -Uri $url -OutFile $out

# Export debug windows-desktop build
godot -v -e --path openkcc --headless --quit-after 100
mkdir -p builds/Windows
godot --path openkcc --headless --export-release windows-desktop

Build Web Platform

See setup guide Compiling for Web with godot.

Requires a custom extension built Compiling for the Web: GDExtension

The default export templates do not include GDExtension support for performance and compatibility reasons. See the export page for more info.

You can build the export templates using the option dlink_enabled=yes to enable GDExtension support:

# Build libraries for openkcc
scons --directory godot-cpp platform=web
scons platform=web target=template_release

# Export debug web build
godot -v -e --path openkcc --headless --quit-after 100
mkdir -p builds/WebGL
godot --path openkcc --headless --export-release web
cp openkcc/coi-serviceworker.min.js builds/WebGL/coi-serviceworker.min.js

Host website for local testing via python -m http.server

python -m http.server --directory builds/WebGL

Documentation

Documentation for the project is stored in the doc directory and built using DocFx.

Generate documentation using godot cli tool --doctool and --gdscript-docs. Use gddoc2yml tool for generating docfx docs.

# install gddoc2yml
python3 -m pip install gddoc2yml

# Install docfx if needed
dotnet tool restore

#  Load project in editor at least once
godot -v -e --path openkcc --headless --quit-after 100

# Build xml based documentation
mkdir -p openkcc/doc/godot
godot --path openkcc --doctool doc/godot
godot --path openkcc --doctool doc/classes --gdscript-docs res://scripts

# Convert docs to yml
gdxml2yml --filter openkcc/doc/classes openkcc/doc/classes openkcc/doc/godot doc/api

# Create site with docfx
dotnet tool run docfx doc/docfx.json --serve

About

Godot Open-Source Kinematic Character Controller

https://openkcc.nickmaltbie.com

License:MIT License


Languages

Language:GDScript 98.4%Language:Shell 0.9%Language:C++ 0.5%Language:Python 0.2%Language:C 0.0%