Skip to content

Commit

Permalink
Update repo for upload feature
Browse files Browse the repository at this point in the history
  • Loading branch information
ValdoTR committed Jul 4, 2024
1 parent 5cb86dd commit f15228d
Show file tree
Hide file tree
Showing 7 changed files with 36 additions and 24 deletions.
7 changes: 2 additions & 5 deletions .env
Original file line number Diff line number Diff line change
Expand Up @@ -8,10 +8,7 @@ TILESET_OPTIMIZATION=false
TILESET_OPTIMIZATION_QUALITY_MIN=0.9
TILESET_OPTIMIZATION_QUALITY_MAX=1.0

# You can set your upload mode to MAP_STORAGE or GH_PAGES
# By default it will be MAP_STORAGE, if not set but you can change it to GH_PAGES to upload your map on Github Pages. If you are self hosting your map, you can remove it.
# You can check the documentation for more information and tutorials on how to upload your map : https://docs.workadventu.re/map-building/tiled-editor/
# If you have any questions, feel free to ask on WorkAdventure : https://play.staging.workadventu.re/@/tcm/workadventure/wa-village

# Here you can set your upload strategy. Simply comment the option you don't want to use.
# Learn more reading the 'Upload your map' section in the README.
UPLOAD_MODE=MAP_STORAGE
# UPLOAD_MODE=GH_PAGES
37 changes: 26 additions & 11 deletions README.md
Original file line number Diff line number Diff line change
@@ -1,26 +1,33 @@
# WorkAdventure Map Starter Kit

![map](./map.png)
![map](./office.png)

This is a starter kit to help you build your own map for [WorkAdventure](https://workadventu.re).

To understand how to use this starter kit, follow the tutorial at [https://docs.workadventu.re/map-building/tiled-editor/](https://docs.workadventu.re/map-building/tiled-editor/).

If you have any questions, feel free to ask in [WorkAdventure office](https://play.staging.workadventu.re/@/tcm/workadventure/wa-village).

## Upload your map

In the .env file you can set your upload strategy to `MAP_STORAGE` (default) or `GH_PAGES`. Simply comment the option you don't want to use.

Uploading a map using the [WA map storage](https://docs.workadventu.re/map-building/tiled-editor/publish/wa-hosted) will host your project in the WA servers.

Uploading a map using [Github Pages](https://docs.github.com/pages) will host your project in the Github servers.

## Structure

We recommend following this file structure:

* *public/*: Static files like PDFs or audio files
* *src/*: Scripts files or design source files
* *tilesets/*: All PNG tilesets
* *map.tmj*: Map file
* *map.png*: The map thumbnail used as meta-data

If you want to use more than one map file, just add the new map file in the root folder ( we recommend creating a copy of *map.tmj* and editing it, in order to avoid any mistakes).

We recommend using 512x512 images for the map thumbnails.

If you are going to create custom websites to embed in the map, please reference the HTML files in the `input` option in *vite.config.js*.
> **Pro tips**
> If you want to use more than one map file, just add the new map file in the root folder (we recommend creating a copy of *office.tmj* and editing it, in order to avoid any mistakes).
> We recommend using 512x512 images for the map thumbnails.
> If you are going to create custom websites to embed in the map, please reference the HTML files in the `input` option in *vite.config.js*.
## Requirements

Expand All @@ -47,17 +54,25 @@ npm run build
npm run prod
```

You can manually upload your map to the map storage by running:

```sh
npm run deploy
```

## Licenses

This project contains multiple licenses as follows:

* [Code license](./LICENSE.code) *(all files except those for other licenses)*
* [Map license](./LICENSE.map) *(`map.tmj` and the map visual as well)*
* [Map license](./LICENSE.map) *(`office.tmj` and the map visual as well)*
* [Assets license](./LICENSE.assets) *(the files inside the `src/assets/` folder)*

### About third party assets

If you add third party assets in your map, do not forget to:

1. Credit the author and license with the "tilesetCopyright" property present in the properties of each tilesets in the `map.tmj` file
2. Add the license text in LICENSE.assets
1. Credit the author and license of a tileset with the "tilesetCopyright" property by etiding the tileset in Tiled.
2. Add the tileset license text in *LICENSE.assets*.
3. Credit the author and license of a map with the "mapCopyright" property in the custom properties of the map.
4. Add the map license text in *LICENSE.map*.
4 changes: 2 additions & 2 deletions conference.tmj
Original file line number Diff line number Diff line change
Expand Up @@ -325,7 +325,7 @@
{
"name":"exitUrl",
"type":"string",
"value":"map.tmj#from-conference"
"value":"office.tmj#from-conference"
}],
"rotation":0,
"visible":true,
Expand Down Expand Up @@ -483,7 +483,7 @@
{
"name":"mapImage",
"type":"string",
"value":"map.png"
"value":"office.png"
},
{
"name":"mapName",
Expand Down
8 changes: 4 additions & 4 deletions index.html
Original file line number Diff line number Diff line change
Expand Up @@ -17,12 +17,12 @@
path = path.substr(path, path.length - 'index.html'.length);
}
const instanceId = Math.random().toString(36).substring(2, 15);
const url = `https://play.workadventu.re/_/${instanceId}/${host}${path}map.tmj`;
const url = `https://play.workadventu.re/_/${instanceId}/${host}${path}office.tmj`;
document.getElementById('testMapURL').href = url;
document.getElementById('testMapBtnURL').href = url;
document.getElementById('testMapURL').innerText = url;

const tmjURL = window.location.protocol + '//' + window.location.host + path + 'map.tmj';
const tmjURL = window.location.protocol + '//' + window.location.host + path + 'office.tmj';
document.getElementById('tmjURL').innerText = tmjURL;

const gettingStartedLink = 'https://workadventu.re/getting-started?name=Map&mapUrl=' + tmjURL;
Expand Down Expand Up @@ -150,8 +150,8 @@
<section>
<h2>Test my map</h2>
<p><a id="testMapURL" href="#" class="url"></a></p>
<p class="tips">(In order to test another map, locate "map.tmj" at the end of the URL and replace it by another file name)</p>
<img src="/map.png" alt="Map thumbnail" class="map">
<p class="tips">(In order to test another map, locate "office.tmj" at the end of the URL and replace it by another file name)</p>
<img src="/office.png" alt="Map thumbnail" class="map">
<p><a id="testMapBtnURL" href="#" class="button">Test my map</a></p>
</section>

Expand Down
2 changes: 1 addition & 1 deletion map.tmj
Original file line number Diff line number Diff line change
Expand Up @@ -559,7 +559,7 @@
{
"name":"mapImage",
"type":"string",
"value":"map.png"
"value":"office.png"
},
{
"name":"mapName",
Expand Down
File renamed without changes
2 changes: 1 addition & 1 deletion package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "workadventure-map-starter-kit",
"version": "3.3.14",
"version": "3.3.15",
"license": "MIT",
"type": "module",
"scripts": {
Expand Down

0 comments on commit f15228d

Please sign in to comment.