Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[WIP] Conversion to Godot 4.2 #75

Open
wants to merge 31 commits into
base: main
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
31 commits
Select commit Hold shift + click to select a range
adf9a90
Perform minimally viable conversion to Godot 4.1.1
ephread Aug 29, 2023
e82f97c
Update CI configuration
ephread Sep 10, 2023
87e6947
Update documentation and add flag preventing template registration
ephread Sep 13, 2023
470c734
Fix Godot 4.2 compilation error
ephread Oct 23, 2023
3128681
Update README.md
ephread Oct 23, 2023
06da2d3
Migrate C# glue to Godot 4
ephread Oct 26, 2023
e634159
Fix broken test
ephread Dec 8, 2023
8e94d01
Rename more files
ephread Dec 8, 2023
f47dae1
Migrate NativeFunctionCall node to static calls
ephread Dec 8, 2023
56b01d7
Migrate StaticJSON node to static calls
ephread Dec 8, 2023
9e3e9d8
Bump GUT to 9.1.1
ephread Dec 8, 2023
34537bd
Update copyrights and README
ephread Dec 8, 2023
88441d6
Fix C# tests
ephread Dec 9, 2023
c71f215
Work around C# issue
ephread Jan 26, 2024
7a8d3ab
Re-enable C# CI job
ephread Jan 26, 2024
7a516dd
Fix Godot executable path
ephread Jan 26, 2024
377fa66
Fix Godot executable paths
ephread Jan 26, 2024
b79ac28
Fix Godot executable path
ephread Jan 26, 2024
ffaee6a
Fix Godot executable path
ephread Jan 26, 2024
fd7da7f
Fix ink download path
ephread Jan 26, 2024
bfaea48
Update csproj version to match the given version
ephread Jan 26, 2024
cd67b72
Fix syntax error
ephread Jan 26, 2024
bdb2a94
Install dependencies
ephread Jan 26, 2024
c7755ba
Ensure script executes in the correct directory
ephread Jan 26, 2024
ade0625
Add missing environment
ephread Jan 26, 2024
3c7eb9e
Update MSBuild command
ephread Jan 26, 2024
50e1f6f
Reimport assets in mono steps as well
ephread Jan 26, 2024
c392e18
Update matrix
ephread Jan 26, 2024
3536ebf
Fix typo in CI configuration file
ephread Jan 26, 2024
bd7f4c1
Switch import step
ephread Jan 26, 2024
fea9098
Re-enable inkgd plugin
ephread Jan 28, 2024
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
127 changes: 87 additions & 40 deletions .github/workflows/continuous-integration.yml
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,7 @@ on:
- main
- github-actions
- mono
- godot4
pull_request:
branches:
- main
Expand All @@ -17,10 +18,12 @@ jobs:

strategy:
matrix:
destination:
- "3.3.4"
- "3.4.5"
- "3.5.2"
version:
- "4.2"
- "4.2.1"
flavor:
- "vanilla"
- "mono"

steps:
- name: "(Shared) Check out the repository"
Expand All @@ -32,58 +35,102 @@ jobs:
- name: "(Shared) Install test dependencies"
run: |
sudo apt-get update
sudo apt-get -y install wget zip unzip
sudo apt-get -y install wget zip unzip libxml2-utils

- name: "(Shared) Inject export preset"
run: |
mv inkgd/ci_export_presets.cfg inkgd/export_presets.cfg

- name: "(Vanilla) Install Godot"
if: ${{ matrix.flavor == 'vanilla' }}
env:
VERSION: ${{ matrix.destination }}
VERSION: ${{ matrix.version }}
run: |
wget -q https://downloads.tuxfamily.org/godotengine/${VERSION}/Godot_v${VERSION}-stable_linux_headless.64.zip
unzip Godot_v${VERSION}-stable_linux_headless.64.zip
mv Godot_v${VERSION}-stable_linux_headless.64 godot
wget -q https://downloads.tuxfamily.org/godotengine/${VERSION}/Godot_v${VERSION}-stable_linux.x86_64.zip
unzip Godot_v${VERSION}-stable_linux.x86_64.zip
mv Godot_v${VERSION}-stable_linux.x86_64 godot
chmod +x godot

# This step exports a dummy PCK to force reimportation.
#
# The export is done twice, because it won't import all the required
# assets at first, since inkgd won't run properly at first due to…
# … missing assets.
- name: "(Shared) Reimport Assets"
- name: "(Vanilla) Reimport Assets"
if: ${{ matrix.flavor == 'vanilla' }}
run: |
./godot --path "inkgd" --export-pack "HTML5" dummy.pck
./godot --path "inkgd" --export-pack "HTML5" dummy.pck
./godot --headless --path "inkgd" --export-pack "HTML5" dummy.pck
./godot --headless --path "inkgd" --export-pack "HTML5" dummy.pck

- name: "(Vanilla) Run tests"
if: ${{ matrix.flavor == 'vanilla' }}
run: |
./godot -d -s --path "inkgd" "addons/gut/gut_cmdln.gd"

# - name: "(Mono) Install Godot"
# env:
# VERSION: ${{ matrix.destination }}
# run: |
# wget -q https://downloads.tuxfamily.org/godotengine/${VERSION}/mono/Godot_v${VERSION}-stable_mono_linux_headless_64.zip
# unzip Godot_v${VERSION}-stable_mono_linux_headless_64.zip
# mv Godot_v${VERSION}-stable_mono_linux_headless_64 godot_mono
# mv godot_mono/Godot_v${VERSION}-stable_mono_linux_headless.64 godot_mono/godot_mono
# chmod +x godot_mono/godot_mono

# - name: "(Mono) Install Ink Runtime"
# run: |
# wget -q https://github.com/inkle/ink/releases/download/v1.0.0/inklecate_windows.zip
# unzip inklecate_windows.zip
# mv ink-engine-runtime.dll inkgd/addons/inkgd/mono/assemblies/ink-engine-runtime.dll

# - name: "(Mono) Compile C# solution"
# run: |
# ./godot_mono/godot_mono --quit --path "inkgd"
# cd inkgd
# msbuild inkgd.sln /restore /t:Build /p:Configuration=Debug
# cd ..

# - name: "(Mono) Run tests (Mono)"
# run: |
# ./godot_mono/godot_mono -d -s --path "inkgd" "addons/gut/gut_cmdln.gd"
./godot --headless -d -s --path "inkgd" "addons/gut/gut_cmdln.gd"

- name: "(Mono) Install Godot"
if: ${{ matrix.flavor == 'mono' }}
env:
VERSION: ${{ matrix.version }}
run: |
wget -q https://downloads.tuxfamily.org/godotengine/${VERSION}/mono/Godot_v${VERSION}-stable_mono_linux_x86_64.zip
unzip Godot_v${VERSION}-stable_mono_linux_x86_64.zip
mv Godot_v${VERSION}-stable_mono_linux_x86_64 godot_mono
mv godot_mono/Godot_v${VERSION}-stable_mono_linux.x86_64 godot_mono/godot_mono
chmod +x godot_mono/godot_mono

- name: "(Mono) Install Ink Runtime"
if: ${{ matrix.flavor == 'mono' }}
run: |
wget -q https://github.com/inkle/ink/releases/download/v1.1.1/inklecate_windows.zip
unzip inklecate_windows.zip
mv ink-engine-runtime.dll inkgd/addons/inkgd/mono/assemblies/ink-engine-runtime.dll

- name: "(Mono) Patch project file to match version"
if: ${{ matrix.flavor == 'mono' }}
env:
VERSION: ${{ matrix.version }}
run: |
VERSION_COMPONENTS=(${VERSION//./ })
NUMBER_OF_COMPONENTS=${#VERSION_COMPONENTS[@]}

# Assuming that if the number of version components is not 3,
# then it's 2, therefore we add a zero at the end.
if [[ "$NUMBER_OF_COMPONENTS" = "3" ]]; then
SEMANTIC_VERSION="$VERSION"
else
SEMANTIC_VERSION="$VERSION.0"
fi

cd inkgd

xmllint --shell inkgd.csproj <<EOF
cd /Project/@Sdk
set Godot.NET.Sdk/${SEMANTIC_VERSION}
save
EOF

cd ..

# This step exports a dummy PCK to force reimportation.
#
# The export is done twice, because it won't import all the required
# assets at first, since inkgd won't run properly at first due to…
# … missing assets.
- name: "(Mono) Reimport Assets"
if: ${{ matrix.flavor == 'mono' }}
run: |
./godot_mono/godot_mono --headless --path "inkgd" --export-pack "HTML5" dummy.pck
./godot_mono/godot_mono --headless --path "inkgd" --export-pack "HTML5" dummy.pck

- name: "(Mono) Compile C# solution"
if: ${{ matrix.flavor == 'mono' }}
run: |
./godot_mono/godot_mono --headless --quit --path "inkgd"
cd inkgd
dotnet msbuild inkgd.sln /restore /t:Build /p:Configuration=Debug
cd ..

- name: "(Mono) Run tests (Mono)"
if: ${{ matrix.flavor == 'mono' }}
run: |
./godot_mono/godot_mono --headless -d -s --path "inkgd" "addons/gut/gut_cmdln.gd"
2 changes: 2 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
@@ -1,5 +1,7 @@
# Godot-specific ignores
.import/
*.import
.godot/
export.cfg
export_presets.cfg
*.pck
Expand Down
20 changes: 16 additions & 4 deletions .gut_editor_config.json
Original file line number Diff line number Diff line change
@@ -1,16 +1,19 @@
{
"background_color": "ff262626",
"compact_mode": false,
"config_file": "res://.gutconfig.json",
"dirs": [
"res://test/unit",
"res://test/integration/runtime",
"res://test/integration/player"
],
"disable_colors": false,
"double_strategy": "partial",
"double_strategy": 1,
"errors_do_not_cause_failure": false,
"font_color": "ffcccccc",
"font_name": "AnonymousPro",
"font_size": 30,
"gut_on_top": true,
"hide_orphans": false,
"ignore_pause": false,
"include_subdirs": false,
Expand All @@ -19,6 +22,17 @@
"junit_xml_timestamp": false,
"log_level": 1,
"opacity": 100,
"paint_after": 0.1,
"panel_options": {
"font_name": "CourierPrime",
"font_size": 30,
"hide_output_text": false,
"hide_result_tree": false,
"hide_settings": false,
"output_font_name": "CourierPrime",
"output_font_size": 30,
"use_colors": false
},
"post_run_script": "",
"pre_run_script": "",
"prefix": "test_",
Expand All @@ -28,8 +42,6 @@
"should_maximize": false,
"show_help": false,
"suffix": ".gd",
"tests": [

],
"tests": [],
"unit_test_name": null
}
17 changes: 17 additions & 0 deletions .gut_editor_shortcuts.cfg
Original file line number Diff line number Diff line change
@@ -0,0 +1,17 @@
[main]

run_all=Object(Shortcut,"resource_local_to_scene":false,"resource_name":"","events":[Object(InputEventKey,"resource_local_to_scene":false,"resource_name":"","device":0,"window_id":0,"alt_pressed":false,"shift_pressed":false,"ctrl_pressed":false,"meta_pressed":false,"pressed":false,"keycode":0,"physical_keycode":0,"key_label":0,"unicode":0,"echo":false,"script":null)
],"script":null)

run_current_script=Object(Shortcut,"resource_local_to_scene":false,"resource_name":"","events":[Object(InputEventKey,"resource_local_to_scene":false,"resource_name":"","device":0,"window_id":0,"alt_pressed":false,"shift_pressed":false,"ctrl_pressed":false,"meta_pressed":false,"pressed":false,"keycode":0,"physical_keycode":0,"key_label":0,"unicode":0,"echo":false,"script":null)
],"script":null)

run_current_inner=Object(Shortcut,"resource_local_to_scene":false,"resource_name":"","events":[Object(InputEventKey,"resource_local_to_scene":false,"resource_name":"","device":0,"window_id":0,"alt_pressed":false,"shift_pressed":false,"ctrl_pressed":false,"meta_pressed":false,"pressed":false,"keycode":0,"physical_keycode":0,"key_label":0,"unicode":0,"echo":false,"script":null)
],"script":null)

run_current_test=Object(Shortcut,"resource_local_to_scene":false,"resource_name":"","events":[Object(InputEventKey,"resource_local_to_scene":false,"resource_name":"","device":0,"window_id":0,"alt_pressed":false,"shift_pressed":false,"ctrl_pressed":false,"meta_pressed":false,"pressed":false,"keycode":0,"physical_keycode":0,"key_label":0,"unicode":0,"echo":false,"script":null)
],"script":null)

panel_button=Object(Shortcut,"resource_local_to_scene":false,"resource_name":"","events":[Object(InputEventKey,"resource_local_to_scene":false,"resource_name":"","device":0,"window_id":0,"alt_pressed":false,"shift_pressed":false,"ctrl_pressed":false,"meta_pressed":false,"pressed":false,"keycode":0,"physical_keycode":0,"key_label":0,"unicode":0,"echo":false,"script":null)
],"script":null)

4 changes: 2 additions & 2 deletions .inkgd_ink.cfg
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
[inkgd]

stories=[ {
stories=[{
"source_file_path": "res://examples/ink/the_intercept/the_intercept.ink",
"target_file_path": "res://examples/ink/the_intercept/the_intercept.ink.json",
"watched_folder_path": "res://examples/ink/the_intercept/"
Expand All @@ -16,7 +16,7 @@ stories=[ {
"source_file_path": "res://examples/ink/not_a_halloween_game/not_a_halloween_game.ink",
"target_file_path": "res://examples/ink/not_a_halloween_game/not_a_halloween_game.ink.json",
"watched_folder_path": "res://examples/ink/not_a_halloween_game"
} ]
}]

[format]

Expand Down
20 changes: 18 additions & 2 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -1,8 +1,24 @@
# Change Log
Important changes to _inkgd_ will be documented in this file.

## [0.6.0](https://github.com/ephread/inkgd/releases/tag/0.6.0)
Released on 2023-XX-XX.

### Added
- Added support for Godot 4.1.1+

### Changed

#### ⚠️ **BREAKING CHANGE**
- Reorganized files internally and updated type names.
- [`InkStory`] Renamed `continue`, `continue_async` and `continue_maximally` to
`continue_story`, `continue_story_async` and `continue_story_maximally` due to keyword conflicts.
- [`InkVariableStates`] Renamed `get` and `set` to `get_variable` and `set_variable` due to keyword conflicts.
- [`InkPlayer`] Renamed `continue`, `continue_async`, `continue_maximally`, `get` and `set` to
`continue_story`, `continue_story_async`, `continue_story_maximally`, `get_variable` and `set_variable` due to keyword conflicts.

## [0.5.0](https://github.com/ephread/inkgd/releases/tag/0.5.0)
Released on 2024-08-28.
Released on 2023-08-28.

### Changed
- Added support for inklecate 1.1.1.
Expand All @@ -17,7 +33,7 @@ Released on 2024-08-28.
Released on 2022-08-07.

### Fixed
- Add missing `add_child` call in templates.
- Added missing `add_child` call in templates.

## [0.4.6](https://github.com/ephread/inkgd/releases/tag/0.4.6)
Released on 2022-07-31.
Expand Down
2 changes: 1 addition & 1 deletion LICENSE
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@ The MIT License (MIT)

Copyright (c) 2015-2021 inkle Ltd.
Copyright (c) 2018-2021 Paul Joannon
Copyright (c) 2019-2022 Frédéric Maquin <[email protected]>
Copyright (c) 2019-2023 Frédéric Maquin <[email protected]>

Permission is hereby granted, free of charge, to any person obtaining a copy
of this software and associated documentation files (the "Software"), to deal
Expand Down
39 changes: 24 additions & 15 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -2,18 +2,24 @@

[![build](https://github.com/ephread/inkgd/workflows/build/badge.svg)](https://github.com/ephread/inkgd/actions)
[![Documentation Status](https://readthedocs.org/projects/inkgd/badge/?version=latest)](https://inkgd.readthedocs.io/en/latest/?badge=latest)
![Version](https://img.shields.io/badge/version-0.5.0-orange.svg)
![Version](https://img.shields.io/badge/version-1.0.0-orange.svg)
![Godot Version](https://img.shields.io/badge/godot-3.3+-blue.svg)
![License](https://img.shields.io/badge/license-MIT-green.svg)

Implementation of [inkle’s Ink] in pure GDScript, with editor support.

⚠️ **Note:** While the implementation of the runtime is feature-complete and
passes the test suite, it’s unlikely to ever be considered “production-ready”.
_inkgd_ shines for rapid-prototyping in GDScript and small games, but for bigger
projects it’s likely to be too slow. If you need a more bulletproof solution
and don’t mind C#, you should consider using [godot-ink].
> [!NOTE]
> _inkgd_ shines for rapid prototyping in GDScript and small games.
> While the runtime implementation is feature-complete and passes the
> test suite, it’s slower than the original C# implementation. It is used
> in commercial games, but if you need a faster solution and don’t mind C#,
> you should consider using [godot-ink].

> [!IMPORTANT]
> _inkgd_ is compatible with Godot 4.2+, but has not official release yet.
> To use _inkgd_ with Godot 4.2+, fetch the [`godot4`] branch.

[`godot4`]: https://github.com/ephread/inkgd/tree/godot4
[inkle’s Ink]: https://github.com/inkle/ink
[godot-ink]: https://github.com/paulloz/godot-ink

Expand All @@ -24,14 +30,12 @@ and don’t mind C#, you should consider using [godot-ink].
* [Contributing](#asking-questions--contributing)
* [Asking Questions](#asking-questions)
* [Contributing](#contributing)
* [Installation](#installation)
* [Usage](#usage)
* [Example Project](#runtime)
* [Editor Plugin](#editor)
* [Installation & Getting Started](#installation--getting-started)
* [Editor Plugin](#editor-plugin)
* [Compatibility Table](#compatibility-table)
* [Acknowledgment](#acknowledgment)
* [Acknowledgement](#acknowledgement)
* [Code](#code)
* [Stories](#stories)
* [Ink Stories](#ink-stories)
* [License](#license)

## Features
Expand All @@ -41,14 +45,14 @@ and don’t mind C#, you should consider using [godot-ink].
- [x] Integrated story previewer

## Requirements
- Godot 3.3+
- Inklecate 1.0.0+
- Godot 4.1.1+
- Inklecate 1.1.1+

## Asking Questions / Contributing

### Asking questions

If you need help with something in particular, [start a discussion].
If you need help with something, [start a discussion].
If you want to report a problem, [open an issue].

[start a discussion]: https://github.com/ephread/inkgd/discussions/new
Expand Down Expand Up @@ -83,6 +87,7 @@ hosted on [Read The Docs].
| 0.3.0 | 1.0.0 | 3.2 – 3.4 |
| 0.4.0 – 0.4.7 | 1.0.0 | 3.3 – 3.5 |
| 0.5.0 | 1.1.1 | 3.3 – 3.5 |
| 1.0.0 | 1.1.1 | 4.2 |

## Acknowledgement

Expand Down Expand Up @@ -117,6 +122,10 @@ hosted on [Read The Docs].

[video series]: https://www.youtube.com/playlist?list=PLtepyzbiiwBrHoTloHJ2B-DWQxgrseuMB

## Sponsors

[![WILD WITS Games](docs/source/img/wild_wits_logo.webp)](https://wildwits.games)

## License

_inkgd_ is released under the MIT license. See LICENSE for details.
Loading