PhaserJS 2.4 released with integrated Creature support!

Discuss issues pertaining to the various game/web runtimes of Creature here.
chong
Posts: 1178
Joined: Thu Feb 19, 2015 2:21 am

Re: PhaserJS 2.4 released with integrated Creature support!

Post by chong » Tue Sep 26, 2017 3:36 pm

Hello,

That means the flat data was not loaded properly. Either the flat data you provided was invalid or something else is going on.
The pointsArray() wasn't found in the flat data file.

zampano
Posts: 70
Joined: Wed Jun 07, 2017 3:37 pm

Re: PhaserJS 2.4 released with integrated Creature support!

Post by zampano » Tue Sep 26, 2017 3:45 pm

What can I do about that?
The file is from the same export as a working json file. I also tried manually converting it as described in the documentation. The json works, the flatdata doesn't. If the code is correct, I don't know what I could do..

chong
Posts: 1178
Joined: Thu Feb 19, 2015 2:21 am

Re: PhaserJS 2.4 released with integrated Creature support!

Post by chong » Tue Sep 26, 2017 3:47 pm

You do not need to run any manual conversion process, the flat data file already exists in your export folder.
Open up your export folder when you exported out your game assets, you should see a flat data file with the extension called ".bytes".
Use that file as your flat data file.

zampano
Posts: 70
Joined: Wed Jun 07, 2017 3:37 pm

Re: PhaserJS 2.4 released with integrated Creature support!

Post by zampano » Tue Sep 26, 2017 3:48 pm

Yup, as I said, I tried that one first...

chong
Posts: 1178
Joined: Thu Feb 19, 2015 2:21 am

Re: PhaserJS 2.4 released with integrated Creature support!

Post by chong » Tue Sep 26, 2017 3:50 pm

So I just tried exporting out a Flat Data and loading it in Phaser with no issues, I am not sure what is going on at your end.
Do you mind sending me over in a zip just your Creature Project on the cloud?

Thanks

chong
Posts: 1178
Joined: Thu Feb 19, 2015 2:21 am

Re: PhaserJS 2.4 released with integrated Creature support!

Post by chong » Tue Sep 26, 2017 3:55 pm

Oh wait one more thing,

Do you do the following to load your binary flat data:

Code: Select all

        function preload () {
            game.load.binary('solBin', 'soldier_character_data.bytes', binaryLoadCallback, this);   
	    game.load.image('solTexture', 'soldier_character_img.png');
        }

        function binaryLoadCallback(key, data) {
    		//  Convert our binary file into a Uint8Array
    		//  We must return the data value or nothing will be added to the cache, even if you don't modify it.
		    return new Uint8Array(data);
	}


Did you have a binaryLoadcallback to convert your flatData into a Uint8Array?

Then when actually loading:

Code: Select all

			var actual_data = CreatureModuleUtils.LoadCreatureFlatData(game.cache.getBinary('solBin'));			
			new_creature = new Creature(actual_data, true);

zampano
Posts: 70
Joined: Wed Jun 07, 2017 3:37 pm

Re: PhaserJS 2.4 released with integrated Creature support!

Post by zampano » Tue Sep 26, 2017 4:01 pm

Okay, no, this I didn't do. Let me try.

zampano
Posts: 70
Joined: Wed Jun 07, 2017 3:37 pm

Re: PhaserJS 2.4 released with integrated Creature support!

Post by zampano » Tue Sep 26, 2017 4:05 pm

That did it. Great, thanks!

Maybe you should add that to the documentations, or did I overlook something? :D

chong
Posts: 1178
Joined: Thu Feb 19, 2015 2:21 am

Re: PhaserJS 2.4 released with integrated Creature support!

Post by chong » Tue Sep 26, 2017 5:23 pm

Hello,

Great to know it runs. Actually, this is the standard way you should load binary data in Phaser:
https://github.com/photonstorm/phaser-e ... %20file.js

I assumed the user already understands the standard way of doing it. For the web, you should always convert it into a Uint8Array when loading a binary ( standard practice ). Please take a look at Phaser's official example.

zampano
Posts: 70
Joined: Wed Jun 07, 2017 3:37 pm

Re: PhaserJS 2.4 released with integrated Creature support!

Post by zampano » Tue Sep 26, 2017 5:31 pm

Ah, I see.
I searched for it in the phaser docs and used the loadBinary function but didn't look at the example to see that it wouldn't suffice, my bad.

Post Reply