Sharing Your Simulations
This tutorial will describe how you can share your simulations in a zero-install setting. Note that this tutorial applies to the browser (HTML) simulations only, since command line (node) simulations do require installation of libraries and are therefore not zero-install.
Step 1: Create a self-contained directory
For sharing, we will make a directory that contains all required components. Anyone who has that folder and opens your simulation in that folder will be able to see your model in its full glory, as long as they don't mess with the directory structure or move/remove any files.
Assuming you have created an empty directory
mySimulation, now add the
following files to it:
MySimulation.html, the html file containing your simulation;
artistoo.js, the script with the Artistoo code (don't just make a link, but actually copy the code into this folder);
If you're using the
fpsmeter, you also need to add the
fpsmeter.min.js file from here
(the same goes for any other scripts you are loading from your HTML file).
Step 2: Adjust relative paths
In your HTML file
MySimulation.html, adjust any paths to scripts you
are loading so that they refer to the local copy in your self-contained folder.
To check that it all works, open the HTML file in your browser — the simulation should
run. If it doesn't, right click, select 'inspect' > 'console' to see any error messages
that come up (if your simulation worked before you moved it, any error messages are
probably due to a missing file or a path that needs updating).
Just to be sure, move the directory to some other place on your computer and check if the simulation still runs. If it does, you're good to go.
Step 3: Share
Once you have a working simulation in a self-contained directory, you can zip that directory and send it to someone else. They can unpack the folder on their own computer and double click the HTML file to run in their own browser.
Alternatively, you can copy the folder to your own server and make your simulation available via a URL. Another option is to set up a Github repository with Github Pages. To see an example, check out the small website we made to accompany the Artistoo manuscript: https://github.com/ingewortel/artistoo-supplements (from this repository, you can see the actual website through the link in the README).