Folders and build process

Let's analyze the folder structure

For this, we are going to check the skeleton project, which is how your project will look:

After you installed Reldens following the steps in the skeleton or if you did it manually (by requiring the package and running the installation commands), what you are going to see is the following:

  • [project-root]/theme/default
    This is the default theme of the Platform. It's used on the demo and we keep it there for the base installation of the project.
    If you look at the platform repository (/theme/default) this is the only theme folder you will see.
    In the skeleton repository we included some build scripts in the package file to help developer with the project initialization.
  • [project-root]/theme/packages
    This is where all your custom project classes should go.
    This also can be found as the only packages folder in the platform repository (/theme/packages).
    In this folder you will find the client and server JS file where you can define all your custom classes. By default you will see all the demo examples of each class group (objects, inventory, skills, for now).
    In the future we will probably move the entire "packages" folder inside the "theme", so the custom classes can be game/theme related and each theme have it's own custom logic.
  • [project-root]/theme/custom-game-theme-test
    As you can see this folder doesn't exists in the platform repository (/theme), and that's because it's created just as an example on how you could create your own themes. You can see the build script in the package.json file.
  • [project-root]/dist
    This is where the default bundler (Parcel) will generate the project public files. This is the generated "client-side" of your project.

I've installed everything, now what?

Followed up the guides to create new game contents:

I have made changes, how can I see them?

Here is where the fun starts, since you placed everything in the "theme/your-game-theme" folder you need to bundle everything, need to get the SCSS compiled, the JS bundled, and the assets copied.

For that you can use the package.json build scripts in this order (replace linux/window as you need):

  • $ npm run linuxBuildCss --theme=your-game-theme
  • $ npm run linuxCopyCustomAssets --theme=your-game-theme
  • $ npm run linuxBuildClient --theme=your-game-theme

Internally, these commands will run Parcel for you (it's important you have Parcel installed as global for this), for example the build client in the package will run:

$ parcel build theme/${npm_config_theme}/index.html --no-source-maps --out-dir dist

$ parcel build theme/your-game-theme/index.html --no-source-maps --out-dir dist

Side note, if you forked the skeleton repository you could edit the package.json file and change the hardcoded "custom-game-theme-test" references by your own theme and then you can simplify everything by running: npm run linuxBuildSkeleton.

That's it! your client is ready and you can run the server, just go crazy:

$ npm start