Skip to content

Commit

Permalink
Merge branch 'master' into cgtsleeptalk
Browse files Browse the repository at this point in the history
  • Loading branch information
KrisXV authored Nov 18, 2024
2 parents 4121b74 + a054876 commit a6c9e8a
Show file tree
Hide file tree
Showing 470 changed files with 68,108 additions and 157,932 deletions.
2 changes: 1 addition & 1 deletion .gitignore
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
/config/*
!/config/formats.ts
/logs/*
/logs/**/*
/test/modlogs
/test/replays/*.html
/node_modules
Expand Down
28 changes: 19 additions & 9 deletions ARCHITECTURE.md
Original file line number Diff line number Diff line change
Expand Up @@ -3,11 +3,19 @@ Pokemon Showdown architecture

At the highest level, PS is split into three parts:

- Client
- Login server
- Game server
- Game server (**[smogon/pokemon-showdown](https://github.com/smogon/pokemon-showdown)**)
- Client (**[smogon/pokemon-showdown-client](https://github.com/smogon/pokemon-showdown-client)**)
- Login server (**[smogon/pokemon-showdown-loginserver](https://github.com/smogon/pokemon-showdown-loginserver)**)

The game server is in this repository, **[smogon/pokemon-showdown](https://github.com/smogon/pokemon-showdown)**, while the client and login server are in **[smogon/pokemon-showdown-client](https://github.com/smogon/pokemon-showdown-client)**. All three communicate directly with each other.
All three communicate directly with each other.

A user starts by visiting `https://play.pokemonshowdown.com/`. This is handled by an Apache server (in the Client), which serves mostly static files but uses some PHP (legacy, intended to be migrated to Loginserver).

The user's web browser (running Client code) will then communicate with the Login server (mounted at `https://play.pokemonshowdown.com/api/` to handle logins mostly, or otherwise interface with the Client databases one way or another).

The user's web browser will also connect to the Game server, through SockJS. The Game server handles the chat rooms, matchmaking, and actual battle simulation.

The Game server also communicates with the Login server, to handle replay uploads (and, for the main server, ladder updates).


Game server
Expand All @@ -25,22 +33,24 @@ Its entry point is [server/index.ts](./server/index.ts), which launches several

- [server/chat.ts](./server/chat.ts) sets up `Chat`, which handles chat commands and messages coming in from users (all client-to-server commands are routed through there)

`Rooms` also includes support for battle rooms, which is where the game simulation itself is done. Game simulation code is in [sim/](./sim/).
`Rooms` also includes support for battle rooms, which is where the server connects to the game simulator itself. Game simulation code is in [sim/](./sim/).


Client
------

The client is built in a mix of TypeScript and JavaScript, with a mostly hand-rolled framework built on Backbone. There’s a rewrite to migrate it to Preact but it’s very stalled.

Its entry point is [index.template.html](https://github.com/smogon/pokemon-showdown-client/blob/master/index.template.html).
Its entry point is [index.template.html](https://github.com/smogon/pokemon-showdown-client/blob/master/play.pokemonshowdown.com/index.template.html)

It was written long ago, so instead of a single JS entry point, it includes a lot of JS files. Everything important is launched from [js/client.js](https://github.com/smogon/pokemon-showdown-client/blob/master/js/client.js).
It was written long ago, so instead of a single JS entry point, it includes a lot of JS files. Everything important is launched from [js/client.js](https://github.com/smogon/pokemon-showdown-client/blob/master/play.pokemonshowdown.com/js/client.js)


Login server
------------

The client’s login server, which handles logins and most database interaction, is written in PHP, with a rewrite to TypeScript in progress. The backend is split between a MySQL InnoDB database and a Percona database, with a migration to Postgres planned.
The client’s login server, which handles logins and most database interaction, is written in TypeScript. The backend is currently split between a MySQL InnoDB database (for users, ladder, and most other things) and a Postgres (technically Cockroach) database (for Replays).

Its entry point is [server.ts](https://github.com/smogon/pokemon-showdown-loginserver/blob/master/src/server.ts).

Its entry point is [action.php](https://github.com/smogon/pokemon-showdown-client/blob/master/action.php).
It's intended to replace all of the old PHP code in the Client, but that migration is only halfway done at the moment.
3 changes: 1 addition & 2 deletions CODEOWNERS
Validating CODEOWNERS rules …
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
config/formats.ts @KrisXV @Marty-D
data/mods/*/random-teams.ts @AnnikaCodes
data/mods/ssb/ @HoeenCoder @KrisXV
data/mods/gen9ssb/ @HoeenCoder @HisuianZoroark @KrisXV
data/random-sets.json @MathyFurret @ACakeWearingAHat @livid-washed @adrivrie
data/random-teams.ts @AnnikaCodes @KrisXV @MathyFurret @ACakeWearingAHat @livid-washed @adrivrie
data/text/ @Marty-D
Expand All @@ -24,7 +24,6 @@ server/chat-plugins/sample-teams.ts @KrisXV
server/chat-plugins/scavenger*.ts @xfix @sparkychildcharlie @PartMan7
sever/chat-plugins/teams.ts @mia-pi-git
server/chat-plugins/the-studio.ts @KrisXV
server/chat-plugins/trivia/ @AnnikaCodes
server/friends.ts @mia-pi-git
server/private-messages/* @mia-pi-git
server/chat-plugins/username-prefixes.ts @AnnikaCodes
Expand Down
4 changes: 2 additions & 2 deletions CONTRIBUTING.md
Original file line number Diff line number Diff line change
Expand Up @@ -128,14 +128,14 @@ BAD:

```ts
// if ten seconds have passed and the user is staff
if (now > then + 10_000 && '&@%'.includes(user.tempGroup)) {
if (now > then + 10_000 && '~@%'.includes(user.tempGroup)) {
```
GOOD:
```ts
const tenSecondsPassed = now > then + 10_000;
const userIsStaff = '&@%'.includes(user.tempGroup);
const userIsStaff = '~@%'.includes(user.tempGroup);
if (tenSecondsPassed && userIsStaff) {
```
Expand Down
2 changes: 1 addition & 1 deletion LICENSE
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
The MIT License (MIT)

Copyright (c) 2011-2022 Guangcong Luo and other contributors http://pokemonshowdown.com/
Copyright (c) 2011-2024 Guangcong Luo and other contributors http://pokemonshowdown.com/

Permission is hereby granted, free of charge, to any person obtaining a copy of
this software and associated documentation files (the "Software"), to deal in
Expand Down
2 changes: 1 addition & 1 deletion PROTOCOL.md
Original file line number Diff line number Diff line change
Expand Up @@ -40,7 +40,7 @@ Messages from the user to the server are in the form:

`ROOMID` can optionally be left blank if unneeded (commands like `/join lobby`
can be sent anywhere). Responses will be sent to a PM box with no username
(so `|/command` is equivalent to `|/pm &, /command`).
(so `|/command` is equivalent to `|/pm ~, /command`).

`TEXT` can contain newlines, in which case it'll be treated the same
way as if each line were sent to the room separately.
Expand Down
2 changes: 1 addition & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -89,7 +89,7 @@ Staff
- Andrew Werner [HoeenHero] - Development
- Annika L. [Annika] - Development
- Chris Monsanto [chaos] - Development, Sysadmin
- Kris Johnson [Kris] - Development
- Kris Johnson [dhelmise] - Development
- Leonard Craft III [DaWoblefet] - Research (game mechanics)
- Mathieu Dias-Martins [Marty-D] - Research (game mechanics), Development
- Mia A [Mia] - Development
Expand Down
13 changes: 3 additions & 10 deletions config/config-example.js
Original file line number Diff line number Diff line change
Expand Up @@ -555,7 +555,7 @@ exports.chatlogreader = 'fs';
*/
exports.grouplist = [
{
symbol: '&',
symbol: '~',
id: "admin",
name: "Administrator",
inherit: '@',
Expand All @@ -565,7 +565,7 @@ exports.grouplist = [
console: true,
bypassall: true,
lockdown: true,
promote: '&u',
promote: '~u',
roomowner: true,
roombot: true,
roommod: true,
Expand Down Expand Up @@ -651,7 +651,7 @@ exports.grouplist = [
timer: true,
modlog: true,
alts: '%u',
bypassblocks: 'u%@&~',
bypassblocks: 'u%@~',
receiveauthmessages: true,
gamemoderation: true,
jeopardy: true,
Expand All @@ -660,13 +660,6 @@ exports.grouplist = [
modchat: true,
hiderank: true,
},
{
symbol: '\u00a7',
id: "sectionleader",
name: "Section Leader",
inherit: '+',
jurisdiction: 'u',
},
{
// Bots are ranked below Driver/Mod so that Global Bots can be kept out
// of modjoin % rooms (namely, Staff).
Expand Down
Loading

0 comments on commit a6c9e8a

Please sign in to comment.