• RuntimesBugs
  • Phaser runtime failed to load Binary format. ( only JSON format load )

Exported with latest stable version of spine to target 4.1, runtime is also 4.1. I tried to load two spine export but both failed at different call stacks. However, it can load the JSON exports correctly. Only the load binary function will fail.

Here is the log when load fail:

Uncaught RangeError: offset is outside the bounds of the DataView
    readUnsignedByte SkeletonBinary.ts:1114
    readString SkeletonBinary.ts:1168
    readSkeletonData SkeletonBinary.ts:225
    getSkeletonData SpinePlugin.ts:245
    createSkeleton SpinePlugin.ts:254
    SpineGameObject SpineGameObject.ts:219
    addSpineGameObject SpinePlugin.ts:127

Another error from another export:

Uncaught Error: Physics constraint data name must not be null.
    readSkeletonData SkeletonBinary.ts:226
    getSkeletonData SpinePlugin.ts:245
    createSkeleton SpinePlugin.ts:254
    SpineGameObject SpineGameObject.ts:219
    addSpineGameObject SpinePlugin.ts:127

The spine project I tested is just a fresh project without even any rigging.

package.json :

"@esotericsoftware/spine-canvas": "4.1.51",
"@esotericsoftware/spine-core": "4.1.51",
"@esotericsoftware/spine-phaser": "4.1.51",
"@esotericsoftware/spine-webgl": "4.1.51",

"phaser": "3.60.0",

Sample exported file in case you need to test it:

Related Discussions
...

Based on the information provided and the contexts from the Spine forums, it seems like the issue you're encountering with loading binary exports in Phaser with Spine 4.1 might be related to a couple of potential factors. Firstly, ensure that both your Spine editor and the Phaser Spine runtime are indeed compatible and both are using version 4.1, as mismatches between editor and runtime versions can lead to issues like the ones you're experiencing. The Phaser runtime for Spine is designed to work with exports from the corresponding version of the Spine Editor, as indicated in the context from the Spine forums about version compatibility.

The error messages you're seeing, such as "offset is outside the bounds of the DataView" and "Physics constraint data name must not be null," suggest that there might be an issue with how the binary data is being interpreted by the runtime. This could be due to a discrepancy in the expected format between the exported data and what the runtime is capable of parsing, possibly because of a recent update or change in the binary export format in Spine.

Given that JSON exports are working correctly, this further points towards a specific issue with the binary export or loading process rather than a general compatibility issue between your Spine assets and the Phaser runtime. It's also worth noting that during beta phases, as mentioned in one of the contexts, there can be changes to export formats that might not yet be supported by all runtimes, although you mentioned using the stable version of Spine.

To troubleshoot this issue, you might want to:

  • Double-check the versions of both your Spine Editor and Phaser Spine runtime to ensure they are indeed compatible and both are version 4.1.
  • Consider using JSON exports as a temporary workaround if they are working correctly for your needs, as suggested in one of the forum contexts.
  • Keep an eye on updates to both the Spine Editor and Phaser Spine runtime for any fixes or changes that might address this issue.

Unfortunately, without specific details on updates to the binary format or known issues with the Phaser runtime for Spine 4.1, it's challenging to provide a definitive solution. However, these steps should help in narrowing down the cause of the problem.

I was able to load both .skel files using the 4.1 Skeleton Viewer. This means either there is a bug in the binary loader (SkeletonBinary) for spine-ts or there is a runtime mismatch (eg you accidentally use 4.0 or 4.2-beta). Since you showed your package.json it seems like it may be a spine-ts bug. We'll dig into it and update you here soon.

I've tried both .skel files using spine-webgl and spine-phaser and they load fine. Please show us the code you use to load the .skel file(s).

Oops sorry. I don't know if I have turned off email notification myself or it turned off after the forum upgrade long time ago. I didn't realize there are more replies.

Anyway after the error occurs, I did a little more testing. It works after I changed to use the 'spine-player' dependency. I also realize I don't really need to use Phaser in this project at all. Now I no longer have the original code that cause those errors.

Thanks