Skip to content

Commit

Permalink
initial commit
Browse files Browse the repository at this point in the history
  • Loading branch information
aditya2712 committed Sep 24, 2021
0 parents commit 90a290c
Show file tree
Hide file tree
Showing 16 changed files with 6,493 additions and 0 deletions.
1 change: 1 addition & 0 deletions .gitignore
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
node_modules
18 changes: 18 additions & 0 deletions .vscode/launch.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,18 @@
{
"version": "0.2.0",
"configurations": [
{
"name": "Debug",
"type": "pwa-node",
"request": "launch",
"args": ["src/index.js"],
"cwd": "${workspaceRoot}",
"internalConsoleOptions": "openOnSessionStart",
"resolveSourceMapLocations": [
"${workspaceFolder}/**",
"!**/node_modules/**"
],
"skipFiles": ["<node_internals>/**", "node_modules/**"]
}
]
}
29 changes: 29 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,29 @@
# Welcome to Colyseus!

This project has been created using [⚔️ `create-colyseus-app`](https://github.com/colyseus/create-colyseus-app/) - an npm init template for kick starting a Colyseus project in TypeScript.

[Documentation](http://docs.colyseus.io/)

## :crossed_swords: Usage

```
npm start
```

## Structure

- `index.js`: main entry point, register an empty room handler and attach [`@colyseus/monitor`](https://github.com/colyseus/colyseus-monitor)
- `src/rooms/MyRoom.js`: an empty room handler for you to implement your logic
- `src/rooms/schema/MyRoomState.js`: an empty schema used on your room's state.
- `loadtest/example.js`: scriptable client for the loadtest tool (see `npm run loadtest`)
- `package.json`:
- `scripts`:
- `npm start`: runs `node index.js`
- `npm test`: runs mocha test suite
- `npm run loadtest`: runs the [`@colyseus/loadtest`](https://github.com/colyseus/colyseus-loadtest/) tool for testing the connection, using the `loadtest/example.js` script.
- `tsconfig.json`: TypeScript configuration file


## License

MIT
1 change: 1 addition & 0 deletions arena.env
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
NODE_ENV=production
15 changes: 15 additions & 0 deletions client/index.html
Original file line number Diff line number Diff line change
@@ -0,0 +1,15 @@
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="UTF-8">
<meta http-equiv="X-UA-Compatible" content="IE=edge">
<meta name="viewport" content="width=device-width, initial-scale=1.0">
<link rel="stylesheet" href="./public/css/style.css">
<title>Roomy Tic-tac-toe</title>
</head>
<body>
Tic-tac-toe
<script src="https://unpkg.com/colyseus.js@^0.14.0/dist/colyseus.js"></script>
<script src="./public/js/script.js"></script>
</body>
</html>
3 changes: 3 additions & 0 deletions client/public/css/style.css
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
*{
background-color: wheat;
}
2 changes: 2 additions & 0 deletions client/public/js/script.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
var client = new Colyseus.Client('ws://localhost:2567');

2 changes: 2 additions & 0 deletions development.env
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
NODE_ENV=development
SOMETHING=true
23 changes: 23 additions & 0 deletions loadtest/example.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,23 @@
export function requestJoinOptions (i) {
return { requestNumber: i };
}

export function onJoin () {
console.log(this.sessionId, "joined.");

this.onMessage("*", (type, message) => {
console.log(this.sessionId, "received:", type, message);
});
}

export function onLeave () {
console.log(this.sessionId, "left.");
}

export function onError (err) {
console.log(this.sessionId, "!! ERROR !!", err.message);
}

export function onStateChange (state) {
console.log(this.sessionId, "new state:", state);
}
Loading

0 comments on commit 90a290c

Please sign in to comment.