Examples descriptors

25 views
Skip to first unread message

Arian Fornaris Fernández

unread,
Jan 22, 2018, 12:34:51 PM1/22/18
to Phaser 3 Development
Since Phaser v3 is the land of configurations and descriptors I think a descriptor file for the examples will be very helpful for tools.

For example, you can say that all the examples are placed in its own folder, like this:


examples/
  assets/
  scripts/
    load an image/
    play a sound/

But each example will have an example.json file with some useful information about it:

example.json:

{
  name: "Load an Image",
  assets: [
     "images/einstein.png"
  ],
  scripts: [
    "load an image.js"
  ]
  updated: "1/1/2018"
}

This descriptor file allows tools to parse the examples and provide operations like run the example, download it, start a project based on it, etc...

For example, in the current site http://labs.phaser.io you can edit an example but also download it. However, the download only includes the script file, not the assets, so it is not going to work in localhost. So a descriptor file allows tools to rebuild all the examples automatically and generate zip files with the assets and the scripts, so the user can download the complete example.

Best regards,
Arian 

Richard Davey

unread,
Jan 22, 2018, 5:44:12 PM1/22/18
to Arian Fornaris Fernández, Phaser 3 Development
Hi,

What we could do is add something similar to a FrontMatter block to each example, giving it a version / author / description about what it does.

No external file info though, that would just be too much of a hassle to maintain I'm afraid!

We're going through and tidying up all the examples this week, purge out dead ones, fix broken ones, etc. So maybe could include this.

Cheers,

Rich

Photon Storm Ltd.

Skype: richard.davey
Twitter: @photonstorm

Registered in England and Wales.
Company ID: 8036404
VAT Number: 136 4333 27

--
You received this message because you are subscribed to the Google Groups "Phaser 3 Development" group.
To unsubscribe from this group and stop receiving emails from it, send an email to phaser3-dev+unsubscribe@googlegroups.com.
To post to this group, send email to phase...@googlegroups.com.
To view this discussion on the web, visit https://groups.google.com/d/msgid/phaser3-dev/a9dc2fcf-62a7-434a-8e18-80ff76e0370a%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.

Arian Fornaris Fernández

unread,
Jan 22, 2018, 5:59:22 PM1/22/18
to Phaser 3 Development
Hi,

I think the bigger effort is at the first time. In Phaser Editor we do it automatically, by comparing the file names of the assets with the strings used in the examples. It works for the ~90% of the current examples.  
Anyway, it is something I can do in a separate repository, and if it proves it has value for the Phaser website we can merge it later, or not :)

I plan to do this kind of "metadata" stuff for Phaser Editor v2 and the Phaser v3 Chains.

Thanks for the reply,
Arian
Reply all
Reply to author
Forward
0 new messages