This example project shows how to setup a project to work with the current dev version of the qhun-engine.
- You need a nodejs environment on your development machine.
- The current target browser is Google Chrome. The first release of qhun-engine is targeted to all major up to date browsers.
- [Optional] Git compatible command line util for cloning this repository.
After checking that the above requirements are met, install the example project via:
$ cd path/to/your/destination/folder
$ git clone https://github.com/qhun-engine/example qhun-engine-exampleYou should now find a folder in your current working directory named qhun-engine-example. Cd into it:
$ cd qhun-engine-exampleThis is the root folder of the example project. You need to install the dependencies declared in package.json via the command:
$ npm installThis command creates a folder called node_modules where npm stores all dependencies. If everything works without errors, you are now ready to start the example game!
In order to start the example game, you should enter the following command:
npm startThis will call a script stored in the package.json file wich handles the transpiling process for TypeScript into JavaScript and the bundeling process to provide a single JavaScript file.
A new folder called dist has been creates containing the processed files and assets. You can think of this dist folder as a temp folder for storing static files that are outputted in the build process.
To access the example game, open your chrome browser and locate to http://localhost:7500. You should now see the example game ;)
There are two folders in the src directory. They contain frontend files (the game that is playable) and server files (HTTP controllers and asset providing).
The command npm start runs two parallel processes.
- The first transpiles your
frontendfolder into a playable version of your code and copies static assets from yourserver/publicfolder into thedistfolder. - An on the fly interpreting of your
serversourcecode to start up the HTTP server.
You need to know when to restart one of the two processes:
- When changing frontend related files or changing assets, you do not need to restart anything. Just reload the game.
- When adding new files, you must restart both processes. (Exit the currently open
npm startprocess and restart it). - When changing
serverrelated*.tsfiles, you must restart the HTTP server.
Updateing a dependency is as easy as typing:
$ npm update NAME_OF_DEPENDENCYThe qhun-engine is still in heavy developement process. To update these dependencies you can type:
$ npm update @qhun-engine/server @qhun-engine/engine @qhun-engine/baseNPM will pull the current master branch from the Github repository and extracts/builds all nessesary changes.