From 540aefb6e9f8a50414f3a76511fac6a4f67d0fcf Mon Sep 17 00:00:00 2001 From: cpojer Date: Sun, 5 May 2024 15:48:11 +0900 Subject: [PATCH] README updates. GitOrigin-RevId: c8ca3fa438281864298dfe2ac5f37ba26b8a1ecf --- .gitignore | 4 +- .vscode/extensions.json | 10 +++ .vscode/settings.json | 22 ++++++ CODE_OF_CONDUCT.md | 131 ++++++++++++++++++++++++++++++++ README.md | 111 +++++++++++++++++++++++++-- deimos/public/athena-crisis.svg | 1 + infra/assets/crowdin.svg | 1 + infra/assets/hetzner.svg | 1 + infra/assets/null.svg | 1 + infra/assets/polar.svg | 1 + package.json | 3 +- 11 files changed, 279 insertions(+), 7 deletions(-) create mode 100644 .vscode/extensions.json create mode 100644 .vscode/settings.json create mode 100644 CODE_OF_CONDUCT.md create mode 100644 deimos/public/athena-crisis.svg create mode 100644 infra/assets/crowdin.svg create mode 100644 infra/assets/hetzner.svg create mode 100644 infra/assets/null.svg create mode 100644 infra/assets/polar.svg diff --git a/.gitignore b/.gitignore index a574cdb6..f38b34b8 100644 --- a/.gitignore +++ b/.gitignore @@ -3,6 +3,8 @@ **/node_modules/ /dist/ /node_modules/ +/package-lock.json +/yarn.lock ares/.enum_manifest.json ares/.src_manifest.json ares/**/__generated__ @@ -11,9 +13,9 @@ ares/vite.config.ts.timestamp-* artemis/prisma/pothos-types.ts coverage electron/demo +electron/log-output electron/offline electron/out -electron/log-output halting-problem-failure.json source_strings.json tests/testSetup diff --git a/.vscode/extensions.json b/.vscode/extensions.json new file mode 100644 index 00000000..0ede3b68 --- /dev/null +++ b/.vscode/extensions.json @@ -0,0 +1,10 @@ +{ + "recommendations": [ + "dbaeumer.vscode-eslint", + "esbenp.prettier-vscode", + "styled-components.vscode-styled-components", + "sysoev.vscode-open-in-github", + "usernamehw.errorlens", + "wix.vscode-import-cost" + ] +} diff --git a/.vscode/settings.json b/.vscode/settings.json new file mode 100644 index 00000000..03eb8d5e --- /dev/null +++ b/.vscode/settings.json @@ -0,0 +1,22 @@ +{ + "editor.formatOnSave": true, + "files.insertFinalNewline": true, + "files.trimFinalNewlines": true, + "editor.codeActionsOnSave": { + "source.fixAll.eslint": "explicit" + }, + "[javascript]": { + "editor.defaultFormatter": "esbenp.prettier-vscode" + }, + "[typescriptreact]": { + "editor.defaultFormatter": "esbenp.prettier-vscode" + }, + "[typescript]": { + "editor.defaultFormatter": "esbenp.prettier-vscode" + }, + "[json]": { + "editor.defaultFormatter": "esbenp.prettier-vscode" + }, + "typescript.updateImportsOnFileMove.enabled": "always", + "typescript.reportStyleChecksAsWarnings": false +} diff --git a/CODE_OF_CONDUCT.md b/CODE_OF_CONDUCT.md new file mode 100644 index 00000000..10ad39bd --- /dev/null +++ b/CODE_OF_CONDUCT.md @@ -0,0 +1,131 @@ +# Contributor Covenant Code of Conduct + +## Our Pledge + +We as members, contributors, and leaders pledge to make participation in our +community a harassment-free experience for everyone, regardless of age, body +size, visible or invisible disability, ethnicity, sex characteristics, gender +identity and expression, level of experience, education, socio-economic status, +nationality, personal appearance, race, caste, color, religion, or sexual +identity and orientation. + +We pledge to act and interact in ways that contribute to an open, welcoming, +diverse, inclusive, and healthy community. + +## Our Standards + +Examples of behavior that contributes to a positive environment for our +community include: + +- Demonstrating empathy and kindness toward other people +- Being respectful of differing opinions, viewpoints, and experiences +- Giving and gracefully accepting constructive feedback +- Accepting responsibility and apologizing to those affected by our mistakes, + and learning from the experience +- Focusing on what is best not just for us as individuals, but for the overall + community + +Examples of unacceptable behavior include: + +- The use of sexualized language or imagery, and sexual attention or advances of + any kind +- Trolling, insulting or derogatory comments, and personal or political attacks +- Public or private harassment +- Publishing others' private information, such as a physical or email address, + without their explicit permission +- Other conduct which could reasonably be considered inappropriate in a + professional setting + +## Enforcement Responsibilities + +Community leaders are responsible for clarifying and enforcing our standards of +acceptable behavior and will take appropriate and fair corrective action in +response to any behavior that they deem inappropriate, threatening, offensive, +or harmful. + +Community leaders have the right and responsibility to remove, edit, or reject +comments, commits, code, wiki edits, issues, and other contributions that are +not aligned to this Code of Conduct, and will communicate reasons for moderation +decisions when appropriate. + +## Scope + +This Code of Conduct applies within all community spaces, and also applies when +an individual is officially representing the community in public spaces. +Examples of representing our community include using an official email address, +posting via an official social media account, or acting as an appointed +representative at an online or offline event. + +## Enforcement + +Instances of abusive, harassing, or otherwise unacceptable behavior may be +reported to the community leaders responsible for enforcement at coc@nakazawa.dev. +All complaints will be reviewed and investigated promptly and fairly. + +All community leaders are obligated to respect the privacy and security of the +reporter of any incident. + +## Enforcement Guidelines + +Community leaders will follow these Community Impact Guidelines in determining +the consequences for any action they deem in violation of this Code of Conduct: + +### 1. Correction + +**Community Impact**: Use of inappropriate language or other behavior deemed +unprofessional or unwelcome in the community. + +**Consequence**: A private, written warning from community leaders, providing +clarity around the nature of the violation and an explanation of why the +behavior was inappropriate. A public apology may be requested. + +### 2. Warning + +**Community Impact**: A violation through a single incident or series of +actions. + +**Consequence**: A warning with consequences for continued behavior. No +interaction with the people involved, including unsolicited interaction with +those enforcing the Code of Conduct, for a specified period of time. This +includes avoiding interactions in community spaces as well as external channels +like social media. Violating these terms may lead to a temporary or permanent +ban. + +### 3. Temporary Ban + +**Community Impact**: A serious violation of community standards, including +sustained inappropriate behavior. + +**Consequence**: A temporary ban from any sort of interaction or public +communication with the community for a specified period of time. No public or +private interaction with the people involved, including unsolicited interaction +with those enforcing the Code of Conduct, is allowed during this period. +Violating these terms may lead to a permanent ban. + +### 4. Permanent Ban + +**Community Impact**: Demonstrating a pattern of violation of community +standards, including sustained inappropriate behavior, harassment of an +individual, or aggression toward or disparagement of classes of individuals. + +**Consequence**: A permanent ban from any sort of public interaction within the +community. + +## Attribution + +This Code of Conduct is adapted from the [Contributor Covenant][homepage], +version 2.1, available at +[https://www.contributor-covenant.org/version/2/1/code_of_conduct.html][v2.1]. + +Community Impact Guidelines were inspired by +[Mozilla's code of conduct enforcement ladder][Mozilla CoC]. + +For answers to common questions about this code of conduct, see the FAQ at +[https://www.contributor-covenant.org/faq][FAQ]. Translations are available at +[https://www.contributor-covenant.org/translations][translations]. + +[homepage]: https://www.contributor-covenant.org +[v2.1]: https://www.contributor-covenant.org/version/2/1/code_of_conduct.html +[Mozilla CoC]: https://github.com/mozilla/diversity +[FAQ]: https://www.contributor-covenant.org/faq +[translations]: https://www.contributor-covenant.org/translations diff --git a/README.md b/README.md index 9a4af30f..67048a95 100644 --- a/README.md +++ b/README.md @@ -1,17 +1,118 @@ # Athena Crisis +

+ + Athena Crisis Logo + +

+ +[Athena Crisis](https://athenacrisis.com) is an Open Core video game developed by [Nakazawa Tech](https://nkzw.tech) and published by [Null](https://null.com). The source code in this repository is licensed under the [MIT License](./LICENSE.md) and can be used to improve Athena Crisis, build additional tools, study game development with JavaScript or create entirely new turn-based strategy games. + +Content like the single-player campaign, multiplayer, art and music are not open source. You can try a demo at [athenacrisis.com](https://athenacrisis.com) and you can wishlist or purchase [Athena Crisis on Steam Early Access](https://store.steampowered.com/app/2456430/Athena_Crisis/) or [buy Athena Crisis directly](https://app.athenacrisis.com/checkout) to play the full game. + +If you like Athena Crisis, [please consider a sponsorship to support its development](https://github.com/sponsors/cpojer). + + + Athena Crisis Gameplay + + +## Setup + +Athena Crisis requires [Node.js](https://nodejs.org/en/download/package-manager) and the latest major version of [`pnpm`](https://pnpm.io/installation). + +```bash +pnpm install && pnpm dev:setup +pnpm dev +``` + +Visit [localhost:3002](http://localhost:3002/) to see the landing page. + ## Packages -- `apollo` → Data structures and algorithms for manipulating _game_ state (_client/server_). -- `art` → Handling of assets (_client/build_). +The codebase is split into multiple packages to enforce the separation of concerns. We suggest starting with these packages to get an end-to-end overview: + - `athena` → Data structures and algorithms for manipulating _map_ state (_client/server_). -- `codegen` → Run `pnpm codegen` when changing game `Actions` or `ActionResponses` to generate encoded actions and formatters (_build_). +- `apollo` → Data structures and algorithms for manipulating _game_ state (_client/server_). +- `hera` → Game engine and rendering (_client_). +- `ui` → Design system (_client_). - `deimos` → Landing page (_client_). + +These are secondary packages focused on specific domains: + +- `art` → Handling of assets (_client/build_). +- `codegen` → Run `pnpm codegen` when changing game `Action`s or `ActionResponse`s to generate encoded actions and formatters (_build_). - `dionysus` → AI code (_client/server_). - `hephaestus` → Iterator and Immutable data structures (_client/server_). -- `hera` → Game engine and rendering (_client_). - `hermes` → Campaign related data structures and algorithms (_client/server_). - `i18n` → Internationalization (_client/build_). - `offline` → Offline splash screen for app (_client_). - `tests` → e2e tests. -- `ui` -> Design system (_client_). + +# Q&A + +## What is open source and what isn't? + +About 75% of all non-content related Athena Crisis code is open source, including the core data structures, algorithms, game engine, rendering, AI, landing page and the map editor. Backend implementations such as user management, database, APIs, multiplayer, realtime spectating, translations, third-party integrations like Discord, server configuration and application wrappers for Steam or app stores are not open source. We aim to open source more of the game over time, but the content will remain the intellectual property of Nakazawa Tech KK and therefore not be open source. You can buy and enjoy [Athena Crisis on Steam Early Access](https://store.steampowered.com/app/2456430/Athena_Crisis/) or [buy it on athenacrisis.com](https://app.athenacrisis.com/checkout). + +## Why did you open source Athena Crisis? + +[Nakazawa Tech](https://nkzw.tech) is an Open Core company. See [the Athena Crisis is Now Open Source blog post](https://cpojer.net/posts/athena-crisis-open-source) for more information. + +## How is this codebase used at Nakazawa Tech? + +We use a monorepo for Athena Crisis at Nakazawa Tech and are syncing a portion of the codebase to this repository. Code merged into this open-source repository is automatically synced to the internal monorepo, and vice versa. Athena Crisis always runs the latest version of code from this repository in production. + +### Why are some folders almost empty? + +To simplify dependency management with [`pnpm`](https://pnpm.io/), most of the internal `package.json` files and the `pnpm-lock.yaml` are public. This makes it easier to share code between the internal monorepo and this repository, but also means that there are some placeholders in this repository, most notably the `ares` and `artemis` packages. + +## Why are packages named after Greek gods? + +Why not!? At some point it became necessary to split the codebase into multiple packages to share code between the client and server. The first package was named `athena`, and it was hard to come up with meaningful names for the other packages. We decided to name them after Greek gods because it seemed cute. + +Over time many pieces are expected to be extracted into separate packages and published on npm under the `@nkzw` organization. Please send a Pull Request if you find a piece of code that you think should be extracted into a separate package. + +## How do assets work in this codebase? + +Assets are not part of this codebase. For testing, development and browsing, all assets are loaded remotely from the Athena Crisis servers. + +## I would like to build a commercial project based on this codebase. Can I? + +Yes, you can. However, any content such as art, music, story, characters and their descriptions are not open source and are the intellectual property of Nakazawa Tech KK. You can use the codebase to build your own game, but you must replace all content with your own. For example, you have to replace all references to assets in [`Images.tsx`](https://github.com/nkzw-tech/athena-crisis/blob/main/hera/render/Images.tsx) or change character descriptions in [`Unit.tsx`](https://github.com/nkzw-tech/athena-crisis/blob/dc1c06b7f033e4c52a29db1524dc08226eacf63a/athena/info/Unit.tsx) if you want to publish your own game. + +If you'd like to use content from Athena Crisis for commercial or non-commercial purposes, you must obtain a license from Nakazawa Tech KK by emailing license@nakazwa.dev. + +# Contributing + +We welcome contributions to Athena Crisis. Here are some guidelines to get you started: + +- The style guide is enforced through tests and linting. Please run `pnpm test` to run all checks. If they pass, you are good to send a Pull Request. +- Check out [The Perfect Development Environment](https://cpojer.net/posts/the-perfect-development-environment) and [Fastest Frontend Tooling](https://cpojer.net/posts/fastest-frontend-tooling-in-2022) for tips on how to optimize your environment setup. +- We suggest adding tests to Pull Requests. You can find many examples in the [`tests` folder](https://github.com/nkzw-tech/athena-crisis/tree/main/tests). + +Here are some types of contributions which we greatly appreciate: + +- Bug fixes. +- AI improvements. +- New game features. +- Balancing improvements. +- Tests to cover untested functionality. +- Performance Improvements to core data structures. +- Separation of concerns into smaller libraries that can be published on npm and consumed by other projects. + +# More information + +Check out these videos to learn more about the tech behind Athena Crisis: + +- [How NOT to Build a Video Game](https://www.youtube.com/watch?v=m8SmXOTM8Ec) +- [Building the AI for Athena Crisis](https://www.youtube.com/watch?v=0V9XaIK0xlQ) + +# Supporters + +| Hetzner | Crowdin | +| ---------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- | ---------------------------------------------------------------------------------------------------------------------------------------------------------- | +| Polar | Null | + + + Athena Crisis Keyart + diff --git a/deimos/public/athena-crisis.svg b/deimos/public/athena-crisis.svg new file mode 100644 index 00000000..e3044bbb --- /dev/null +++ b/deimos/public/athena-crisis.svg @@ -0,0 +1 @@ + diff --git a/infra/assets/crowdin.svg b/infra/assets/crowdin.svg new file mode 100644 index 00000000..20fdb9eb --- /dev/null +++ b/infra/assets/crowdin.svg @@ -0,0 +1 @@ + \ No newline at end of file diff --git a/infra/assets/hetzner.svg b/infra/assets/hetzner.svg new file mode 100644 index 00000000..55d610ae --- /dev/null +++ b/infra/assets/hetzner.svg @@ -0,0 +1 @@ + \ No newline at end of file diff --git a/infra/assets/null.svg b/infra/assets/null.svg new file mode 100644 index 00000000..ada19bc7 --- /dev/null +++ b/infra/assets/null.svg @@ -0,0 +1 @@ + \ No newline at end of file diff --git a/infra/assets/polar.svg b/infra/assets/polar.svg new file mode 100644 index 00000000..5ae2d930 --- /dev/null +++ b/infra/assets/polar.svg @@ -0,0 +1 @@ + \ No newline at end of file diff --git a/package.json b/package.json index 2f7ac2d9..a190a17f 100644 --- a/package.json +++ b/package.json @@ -20,6 +20,7 @@ "build:splash": "rm -rf ./dist/deimos && pnpm vite build --outDir ../dist/deimos -c ./deimos/vite.config.ts ./deimos/", "build:steam-i18n": "rm -rf ./dist/steami18n && node --no-warnings --experimental-specifier-resolution=node --loader ts-node/esm ./ares/scripts/translateStorepage.js", "codegen": "node --no-warnings --experimental-specifier-resolution=node --loader ts-node/esm ./codegen/generate-all.tsx", + "dev": "node --no-warnings --experimental-specifier-resolution=node --loader ts-node/esm ./deimos/deimos.tsx", "dev:setup": "pnpm prisma generate && pnpm relay && pnpm codegen && pnpm fbt", "dev:update-deps": "rm -rf pnpm-lock.yaml node_modules/ **/node_modules && pnpm dev:setup", "disable-canvas": "jq '.pnpm.neverBuiltDependencies = [\"canvas\"]' package.json > package-canvas.json && mv package-canvas.json package.json && git restore pnpm-lock.yaml", @@ -77,7 +78,7 @@ "vitest": "^1.6.0" }, "engines": { - "node": ">=21.5.0", + "node": ">=20.0.0", "pnpm": ">=9.0.1" }, "pnpm": {