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

Export web not working? #96

Open
laurentlb opened this issue Feb 23, 2025 · 3 comments
Open

Export web not working? #96

laurentlb opened this issue Feb 23, 2025 · 3 comments

Comments

@laurentlb
Copy link

Hi,

I'm using inkgd with Godot 4 (using the godot4 branch of inkgd).

This works well when I run my project inside Godot and when I export it to a Windows Desktop app.
However, inkgd fails when I do a Web export.

#@onready var _ink_player = InkPlayer.new()
@onready var _ink_player = $InkPlayer

func _ready() -> void:
	# _ink_player.ink_file = load("res://stories/grocery.ink.json")
	print("ink_file: ", _ink_player.ink_file.json)
	_ink_player.connect("loaded", _story_loaded)
	_ink_player.connect("prompt_choices", _prompt_choices)
	_ink_player.connect("continued", _continued)
	_ink_player.create_story()

func _story_loaded(successfully: bool):
	# this is never called
	pass

The print call above shows that _ink_player correctly has the compiled json file.
However, _story_loaded is not called.

When I call _ink_player.continue_story(), I get an error (in the JS console):

USER ERROR: The _story is 'null', was it loaded properly?

I'm new to Godot and to inkgd. Did I miss something, or is it a bug?
I've tried loading _ink_player in two different ways, but the same problem happens.

Environment:

Thanks!

@francoisdlt
Copy link
Contributor

did you add the export rule for JSON files ? (by default they are not exported)
Look under the "Resources" tab in the export settings

@laurentlb
Copy link
Author

Yes, I tried with *.json (and other alternatives).
I wanted to check if it was a problem with my project, so I've tried the example in this repository.

Here's what I get:
Image

Image

Is it working for you?

@pipejakob
Copy link

I just started a new project to test this using Godot 4.4 (just released).

In order to get my Web export to work, I needed to enable thread support in the export template, since it is now off by default in newer versions of Godot:

Options -> Variant -> Thread Support = On (checked)

I don't know if this is expected (I am new to inkgd and ink in general), but it worked for me. There are caveats that come with having threading support turned on in Web exports, so I don't know if there's a better solution if you'd rather leave threading disabled.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants