Open IAmTraffic opened 1 year ago
Thanks for this, fixed the issue for me. I just updated INK_VERSION_CURRENT to 21 and it works now. I was going mad trying to work out why the demo files worked and mine didn't no matter how simple I made the story. Edit: Ok it only seems to help with the preview, Story_player.gd still seems to be causing me problems even if I comment out the return.
I believe support for Ink 1.1.1 is a work in progress : https://github.com/ephread/inkgd/pull/69
I just ran into this problem myself. The odd thing is: I import stories written by Inky 0.14.1, which internally uses inkjs
2.1.0: https://github.com/inkle/inky/blob/0.14.1/app/package-lock.json#L1187-L1191
It is inkjs
which writes this version field. But this version of inkjs should write v20 JSON: https://github.com/y-lohse/inkjs/blob/v2.1.0/src/engine/Story.ts#L53
Yet, suddenly Inky generates v21 JSON and I run into this crash. This has only happened recently, and I have no idea what changed.
Any ideas what's going on here?
I just ran into this problem myself. The odd thing is: I import stories written by Inky 0.14.1, which internally uses
inkjs
2.1.0: https://github.com/inkle/inky/blob/0.14.1/app/package-lock.json#L1187-L1191It is
inkjs
which writes this version field. But this version of inkjs should write v20 JSON: https://github.com/y-lohse/inkjs/blob/v2.1.0/src/engine/Story.ts#L53Yet, suddenly Inky generates v21 JSON and I run into this crash. This has only happened recently, and I have no idea what changed.
Any ideas what's going on here?
@mttkay Hey mate,
inkjs
uses inklecate
under the hood which is what's generating the version number when you compile https://github.com/y-lohse/inkjs/blob/b0b9e4d0308404f67a78aff7a8f70034826d326e/src/tests/compile.js#L56
It doesn't matter what version of Inky you wrote the stories in, it's all about what version of inklecate
you used to compile it - the latest version of inkjs
looks to be using v1.1.1 of inklecate which uses v21 of their json structure(?), so it sounds like that's what you've also used to compile your ink to json. Looks like inkjs
also has a compatability table https://github.com/y-lohse/inkjs#compatibility-table for reference on which versions match together.
But remember, inkjs
has nothing to do with this plugin (unless you're using it to compile, even then) - it's inklecate
that compiles it. That's my understanding to the best of my knowledge!
inkjs uses inklecate under the hood which is what's generating the version number when you compile https://github.com/y-lohse/inkjs/blob/b0b9e4d0308404f67a78aff7a8f70034826d326e/src/tests/compile.js#L56
Are you sure about that? The file you point to is just a test. And you can see here that it also supports a different compiler backend, inks-compiler: https://github.com/y-lohse/inkjs/blob/1a79adf99cbcd15f1da7e13ab2504ef7f4dcc7e6/src/tests/compile.js#L10
When searching for inklecate and inkjs, I found a discussion around inklecate going away at some point and being replaced by something called inkjs-compiler
, IIUC. Inklecate seems to be dead too; its package was last updated 3 years ago: https://www.npmjs.com/package/inklecate
Plus, I don't have inklecate installed on my machine:
~ which inklecate
/usr/bin/which: no inklecate
so I am not sure how Inky would be able to shell out to it? :thinking:
That all said, if Inky does not package its own copy of inklecate, and if it's not installed on my system, then where is it called from and how did it suddenly update to emit different file formats?
Pretty confusing ecosystem!
Ah, I think I understand better now how these tools relate to each other.
So inklecate
is actually part of the ink
project itself, and it's written in C#: https://github.com/inkle/ink/tree/master/inklecate
Meaning, you can't use it directly in JavaScript and Inky is an Electron app so is written in JS. So that NPM module is just a JS wrapper that shells out to the inklecate
binary.
That leaves the question: where is this inklecate binary installed, and by which process did this suddenly update without my intervention? Again, the version of Inky I use hasn't been updated in a while but the difference in file formats emitted started only happening a few weeks ago. So there must be some moving parts here that I fail to understand.
Or maybe Inky doesn't actually shell out to inklecate at all, and uses the native JS compiler instead, inkjs-compiler. But then again, that one is bundled with Inky and locked in package.json, so I am not sure either how that could suddenly start writing out v21 JSON.
This is where Inky invokes inklecate: https://github.com/inkle/inky/blob/master/app/main-process/inklecate.js
I am not familiar with Electron, but it looks like it packages binaries for Mac, Windows and Linux? :thinking:
Describe the bug I was trying to set up a super basic Ink scene to get started and I kept getting an error spiral. A lot of stuff under story.gd would randomly be Null.
To Reproduce Here's the Ink JSON I was using:
{"inkVersion":21,"root":[["^Hello World!","\n",["done",{"#f":5,"#n":"g-0"}],null],"done",{"#f":1}],"listDefs":{}}
Expected behavior I didn't change anything about the Ink handler script (besides adding the correct filepath), so I was expecting it to print `Hello World!
The End `
Solution Turns out (to the best of my knowledge) that inkgd noticed that root_object["inkVersion"] was 21, while INK_VERSION_CURRENT was 20, so it would throw an error and crash. Since story generation is done in a separate thread, the error never showed up and the main thread continued as usual, but without an actual story to be working off of.
I ended up commenting out the return call on line 164 of story.gd so that it would be forced to continue with story creation even if the Ink version was higher than expected. I imagine there's more elegant solutions, but I wanted to drop this here in case some future soul has a similar experience.
Environment: