Skip to content

Commit

Permalink
Merge pull request #10 from FreezePhoenix/Nexus
Browse files Browse the repository at this point in the history
Merge (Incorporated Prettier and ESLint)
  • Loading branch information
NexusNull authored Nov 11, 2023
2 parents 21bb258 + 369979a commit 1b49935
Show file tree
Hide file tree
Showing 15 changed files with 20,155 additions and 11,365 deletions.
17 changes: 17 additions & 0 deletions .github/workflows/code_quality.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,17 @@
name: Code Quality

on:
- pull_request
- push

jobs:
eslint:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
- name: Install dependencies
run: npm ci
working-directory: node
- name: Run ESLint
run: npm run lint
working-directory: node
3 changes: 3 additions & 0 deletions .vscode/extensions.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
{
"recommendations": ["dbaeumer.vscode-eslint", "esbenp.prettier-vscode"]
}
13 changes: 13 additions & 0 deletions .vscode/settings.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,13 @@
{
"editor.defaultFormatter": "esbenp.prettier-vscode",
"prettier.configPath": "./node/.prettierrc",
"prettier.printWidth": 120,
"prettier.tabWidth": 2,
"prettier.trailingComma": "all",
"prettier.semi": true,
"prettier.useTabs": true,
"editor.formatOnSave": true,
"editor.codeActionsOnSave": {
"source.fixAll.eslint": true
}
}
22 changes: 21 additions & 1 deletion README.md
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
# Adventure Land - The Open Source CODE MMORPG

https://adventure.land

The Source Code is now available to anyone, even for commercial use! (License applies)
Expand All @@ -12,16 +13,19 @@ Consider using the #development channel on Discord or messaging me directly on D
## Installation

Clone the game files into the adventureland folder:

```sh
git clone https://github.com/kaansoral/adventureland adventureland
```

Clone a modified copy of Python2 App Engine Local App Server into the python folder along with an initialized database with map files:

```sh
git clone https://github.com/kaansoral/adventureland-appserver appserver
```

Set up secrets files and remember to change secret keys!

```sh
cp adventureland/useful/template.secrets.py adventureland/secrets.py
cp adventureland/useful/template.variables.js adventureland/node/variables.js
Expand All @@ -31,6 +35,7 @@ cp adventureland/useful/template.live_variables.js adventureland/node/live_varia
You'll need to download Python2.7 and use the command that comes along with it - it could be ./python or python.exe depending on your setup method
Here's the download page: https://www.python.org/downloads/release/python-2718/
For Linux:

```sh
apt update
apt upgrade -y
Expand All @@ -45,31 +50,36 @@ pip2.7 check
For MacOS pyenv makes sense as it prevents clash between Python versions and allows local versioning by just adding a .python-version to the folder https://github.com/pyenv/pyenv

Make sure to install lxml afterwards:

```sh
pip2.7 install lxml
```

Run the Python2.7 backend - includes an HTTP server, datastore, various utilities - emulates Google App Engine:

```sh
python2.7 appserver/sdk/dev_appserver.py --storage_path=appserver/storage/ --blobstore_path=appserver/storage/blobstore/ --datastore_path=appserver/storage/db.rdbms --host=0.0.0.0 --port=80 adventureland/ --require_indexes --skip_sdk_update_check
```

Set up the NodeJS game server:

```sh
npm install adventureland/node/
```

Edit the paths in `adventureland/node/variables.js` if you want to run the server from any path

Enter the path of the NodeJS server:

```sh
cd adventureland/node
```

Run a server:

```sh
node server.js EU I 8022
```
```

You should be able to access the game at: http://0.0.0.0/

Expand All @@ -80,12 +90,14 @@ The **useful/** folder has useful commands
## Network

Add these to your /etc/hosts file:

```sh
0.0.0.0 thegame.com
0.0.0.0 www.thegame.com
```

And setup nginx with a conf such as:

```sh
worker_processes 3;

Expand Down Expand Up @@ -140,6 +152,14 @@ I suggest you go live with this development codebase and approach development in

The main problem with traditional MMORPG's is people seeking power and while an offline game can provide this for everyone, an online game cannot. Pretty soon new players will avoid such MMORPG's and existing players will also dwindle. In my opinion there are 2 solutions, you could introduce a decay mechanic to overcome this, or concentrate your innovations and additions to make a more social game rather than a game for power hungry people. Originally I intended to add a lot more social integrations, for example browser notifications integrated to the social hub of the game and easy drop ins to friends playing the game etc. So making a more idle and more social game, with new custom art and a new direction could also be a good option, it's definitely the more serene option that anyone can pursue.

## Code formatting

This project uses [Eslint](https://eslint.org/) and [Prettier](https://prettier.io/).
For now, this is only used inside the game servers (`/node/` folder).
If you use VSCode, please install the recommended extensions for [eslint](https://marketplace.visualstudio.com/items?itemName=dbaeumer.vscode-eslint) and [prettier](https://marketplace.visualstudio.com/items?itemName=esbenp.prettier-vscode). The formatting will be automatically done on save.
If you have suggestions regarding the formatting, feel free to open an issue or discuss it on Discord. [Here is the history](https://discord.com/channels/238332476743745536/1163453037126357074) of the conversation regarding the formatting.
As you might notice, several eslint rules have been marked as warnings instead of errors. This is to allow a smooth and iterative transition. Make sure your new code respects the rules, even the warnings. If you want to submit a PR to fix a specific warning in a specific part of the code, feel free to do so.

## Freelancers

Adventure Land's map designer is available for freelance work or for hire. Contact: markjlacandula@gmail.com
Expand Down
25 changes: 25 additions & 0 deletions node/.eslintrc
Original file line number Diff line number Diff line change
@@ -0,0 +1,25 @@
{
"extends": ["eslint:recommended", "eslint-config-prettier"],
"env": {
"node": true
},
"parserOptions": {
"ecmaVersion": 10
},
"plugins": ["prettier"],
"rules": {
"no-constant-condition": "off",
"no-dupe-else-if": "off",
"indent": "off",
"no-empty": "warn",
"no-inner-declarations": "warn",
"no-unreachable": "warn",
"no-undef": "warn",
"no-unused-vars": "warn",
"no-redeclare": "warn",
"curly": "error",
"prettier/prettier": "error",
"one-var": ["error", "never"],
"no-sequences": "error"
}
}
10 changes: 10 additions & 0 deletions node/.prettierrc
Original file line number Diff line number Diff line change
@@ -0,0 +1,10 @@
{
"tabWidth": 2,
"singleQuote": false,
"printWidth": 120,
"trailingComma": "all",
"semi": true,
"bracketSpacing": true,
"arrowParens": "always",
"useTabs": true
}
Loading

0 comments on commit 1b49935

Please sign in to comment.