Introduction for developers - jjppof/goldensun_html5 GitHub Wiki
The project has basically two important folders: assets
and base
. All the source code is located inside base
folder. All the game assets (images, database files, sounds, etc) are located inside assets
folder. An engine user will only modify the assets
folder. Any modification in assets
folder files will automatically be reflected in the game after a single restart, at least.
In order to bootstrap the game, GSHTML5 uses the Phaser methods that control the game state.
GoldenSun.ts is the starting point to understand how the code works. It's the engine's main class. When the game starts, it will load database files in assets/dbs folder in order to instantiate the main classes of the game like Hero, Collision, Map, MainMenu, Audio, CursorManager etc.
For API reference, check the docs.
General class overview in game:
Here is an overview of the engine (open the image in a new tab):
What you need to know to contribute
- Have some knowledge of JavaScript or TypeScript.
- Understand minimally how Phaser 2 works.
- Played at least one time the original Golden Sun games.
- Regarding the engine, you can check the docs or ask me anything in order to make your understanding faster.
Running GS-HTML5 in your machine (developers)
- Download nodejs here
- Install it using the default configurations (if not already checked, add node.js to the system path).
- Download git here
- Install it using the default configurations (if not already checked, add git to the system path).
- Create an empty folder to store the project.
- Open your terminal and navigate to this folder:
- cd
your/path/to/gshtml5
- In the terminal, type:
git clone https://github.com/jjppof/goldensun_html5.git .
(please note the dot in the end). - In the terminal, type:
npm install
- In the terminal, type:
npm start
- The browser should open. Please wait.
- Now change anything you want in the
assets
folder or change the code in thebase
folder.
Some coding guidelines
- I strongly recommend using Visual Studio Code to develop.
- Use
npm run format
to format your code before your last commit when opening a PR. - I use camel case to define types. For all the other names I use snake case.
- Avoid as much as possible using literals. Whenever you have internal states, please create an
enum
for holding them. - Now the engine supports TS, so make sure you type variables as much as you can.
- Whenever creating a new class, is not a problem to pass
game: Phaser.Game
and/ordata: GoldenSun
to it in order to have easier access to game data and functionalities. - I don't have any branching or commit comments guidelines.
- I really enjoy being verbose when giving names to variables. Please avoid using abbreviations.
- Please avoid using third-party packages with few stars in github.