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:
https://github.com/damian-pastorini/reldens-skeleton
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.
https://github.com/damian-pastorini/reldens-skeleton/blob/master/package.json - [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:
- How to create a new Room/Scene?
- How to create different World Objects?
- How to create items in Reldens?
- How to create new classes and skills? (coming soon...)
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 custom scripts from the skeleton:
$ node ./scripts/reldens-commands.js buildCss custom-game-theme-test
$ node ./scripts/reldens-commands.js buildClient custom-game-theme-test
$ node ./scripts/reldens-commands.js copyCustomAssets custom-game-theme-test
Internally, these commands will run Parcel for you (Parcel included as dependency on the platform as default builder for the client).
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.
That's it! your client is ready and you can run the server, just go crazy:
$ RELDENS_LOG_LEVEL=9 node --trace-warnings .