From 40dbc85f5d1f5f3f0caed39b2f3aa2913fa27686 Mon Sep 17 00:00:00 2001 From: cpojer Date: Sun, 5 May 2024 12:00:16 +0900 Subject: [PATCH] README updates and sync. GitOrigin-RevId: c8ca3fa438281864298dfe2ac5f37ba26b8a1ecf --- .gitignore | 4 +- .vscode/extensions.json | 10 ++ .vscode/settings.json | 22 +++ CODE_OF_CONDUCT.md | 131 ++++++++++++++++++ README.md | 111 ++++++++++++++- athena/info/Tile.tsx | 2 +- athena/lib/getAttributeRange.tsx | 41 +++++- deimos/public/athena-crisis.svg | 1 + hera/campaign/CampaignEditor.tsx | 4 +- .../panels/CampaignEditorControlPanel.tsx | 9 +- .../panels/CampaignEditorSettingsPanel.tsx | 9 +- hera/card/BuildingCard.tsx | 7 +- hera/card/Range.tsx | 106 +++++++++++--- hera/card/TileCard.tsx | 4 +- hera/card/UnitCard.tsx | 8 +- hera/card/lib/CoverRange.tsx | 18 ++- hera/character/Portrait.tsx | 22 +-- hera/render/Images.tsx | 3 +- hera/ui/GameDialog.tsx | 7 +- hera/ui/MapInfo.tsx | 9 +- infra/assets/crowdin.svg | 1 + infra/assets/hetzner.svg | 1 + infra/assets/null.svg | 1 + infra/assets/polar.svg | 1 + package.json | 3 +- ui/controls/setupKeyboard.tsx | 5 +- vitest.config.ts | 2 +- 27 files changed, 460 insertions(+), 82 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/athena/info/Tile.tsx b/athena/info/Tile.tsx index 9c2b9e08..15012162 100644 --- a/athena/info/Tile.tsx +++ b/athena/info/Tile.tsx @@ -1441,7 +1441,7 @@ export const Iceberg = new TileInfo( `Unknown`, TileTypes.Sea, { - cover: 0, + cover: 30, movement: new Map([ [MovementTypes.Air, 1], [MovementTypes.AirInfantry, 1], diff --git a/athena/lib/getAttributeRange.tsx b/athena/lib/getAttributeRange.tsx index 5e41d4ae..b15885b4 100644 --- a/athena/lib/getAttributeRange.tsx +++ b/athena/lib/getAttributeRange.tsx @@ -1,10 +1,18 @@ import maxBy from '@deities/hephaestus/maxBy.tsx'; -export type AttributeRangeValue = 1 | 2 | 3 | 4 | 5; +export type AttributeRange = 1 | 2 | 3 | 4 | 5; +export type AttributeRangeWithZero = 0 | 1 | 2 | 3 | 4 | 5; +export type LargeAttributeRangeWithZero = + | AttributeRangeWithZero + | 6 + | 7 + | 8 + | 9 + | 10; export function validateAttributeRange( value?: number | null, -): value is AttributeRangeValue { +): value is AttributeRange { return !!value && value >= 1 && value <= 5; } @@ -12,15 +20,16 @@ export default function getAttributeRange( list: ReadonlyArray, extract: (entry: T) => number, min: number = 0, + length: number = 5, ) { const entry = maxBy(list, extract); if (!entry) { return []; } - const step = (extract(entry) - min) / 4; + const step = (extract(entry) - min) / (length - 1); return Array.from( - { length: 5 }, + { length }, (_, index) => min + index * step - (index > 0 ? step / 2 : 0), ); } @@ -28,7 +37,25 @@ export default function getAttributeRange( export function getAttributeRangeValue( range: ReadonlyArray, value: number, -): AttributeRangeValue { - const index = range.findIndex((item) => item >= value); - return (index === -1 ? range.length : index + 1) as AttributeRangeValue; +) { + if (value < range[0]) { + return 0; + } + + const index = range.findLastIndex((item) => item <= value); + return (index === -1 ? range.length : index + 1) as AttributeRangeWithZero; +} + +export function getLargeAttributeRangeValue( + range: ReadonlyArray, + value: number, +) { + if (value < range[0]) { + return 0; + } + + const index = range.findLastIndex((item) => item <= value); + return ( + index === -1 ? range.length : index + 1 + ) as LargeAttributeRangeWithZero; } 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/hera/campaign/CampaignEditor.tsx b/hera/campaign/CampaignEditor.tsx index d59378c8..a0362621 100644 --- a/hera/campaign/CampaignEditor.tsx +++ b/hera/campaign/CampaignEditor.tsx @@ -1,6 +1,6 @@ import { Scenario } from '@deities/apollo/Effects.tsx'; import { - AttributeRangeValue, + AttributeRangeWithZero, validateAttributeRange, } from '@deities/athena/lib/getAttributeRange.tsx'; import { DoubleSize, TileSize } from '@deities/athena/map/Configuration.tsx'; @@ -101,7 +101,7 @@ export default function CampaignEditor({ const [, startTransition] = useTransition(); const [hasChanges, setHasChanges] = useState(!data.id); const [mapHasChanges, setMapHasChanges] = useState(false); - const [difficulty, setDifficulty] = useState( + const [difficulty, setDifficulty] = useState( validateAttributeRange(data.difficulty) ? data.difficulty : 0, ); const [description, setDescription] = useState( diff --git a/hera/campaign/panels/CampaignEditorControlPanel.tsx b/hera/campaign/panels/CampaignEditorControlPanel.tsx index 0110ebe9..4c56b0cc 100644 --- a/hera/campaign/panels/CampaignEditorControlPanel.tsx +++ b/hera/campaign/panels/CampaignEditorControlPanel.tsx @@ -1,4 +1,7 @@ -import { AttributeRangeValue } from '@deities/athena/lib/getAttributeRange.tsx'; +import { + AttributeRange, + AttributeRangeWithZero, +} from '@deities/athena/lib/getAttributeRange.tsx'; import UnknownTypeError from '@deities/hephaestus/UnknownTypeError.tsx'; import { TypeaheadDataSource } from '@deities/ui/Typeahead.tsx'; import BottomDrawer from '../../bottom-drawer/BottomDrawer.tsx'; @@ -32,14 +35,14 @@ export default function CampaignEditorControlPanel({ campaignExists: boolean; campaignName: string; description: string; - difficulty: AttributeRangeValue | 0; + difficulty: AttributeRangeWithZero; exportMaps: () => void; isAdmin?: boolean; playStyle: PlayStyleType | null; saveCampaign: (type?: 'Export') => void; setCampaignName: (name: string) => void; setDescription: (description: string) => void; - setDifficulty: (rating: AttributeRangeValue) => void; + setDifficulty: (rating: AttributeRange) => void; setPlayStyle: (playStyle: PlayStyleType | null) => void; setTags: (tags: ReadonlyArray) => void; setUsers: (users: ReadonlyArray) => void; diff --git a/hera/campaign/panels/CampaignEditorSettingsPanel.tsx b/hera/campaign/panels/CampaignEditorSettingsPanel.tsx index 6bc432ec..369bd1ac 100644 --- a/hera/campaign/panels/CampaignEditorSettingsPanel.tsx +++ b/hera/campaign/panels/CampaignEditorSettingsPanel.tsx @@ -1,4 +1,7 @@ -import { AttributeRangeValue } from '@deities/athena/lib/getAttributeRange.tsx'; +import { + AttributeRange, + AttributeRangeWithZero, +} from '@deities/athena/lib/getAttributeRange.tsx'; import { DoubleSize } from '@deities/athena/map/Configuration.tsx'; import Box from '@deities/ui/Box.tsx'; import InlineLink from '@deities/ui/InlineLink.tsx'; @@ -49,14 +52,14 @@ export default function CampaignEditorSettingsPanel({ campaignExists: boolean; campaignName: string; description: string; - difficulty: AttributeRangeValue | 0; + difficulty: AttributeRangeWithZero; exportMaps: () => void; isAdmin?: boolean; playStyle: PlayStyleType | null; saveCampaign: (type?: 'Export') => void; setCampaignName: (name: string) => void; setDescription: (description: string) => void; - setDifficulty: (rating: AttributeRangeValue) => void; + setDifficulty: (rating: AttributeRange) => void; setPlayStyle: (playStyle: PlayStyleType | null) => void; setTags: (tags: ReadonlyArray) => void; setUsers: (users: ReadonlyArray) => void; diff --git a/hera/card/BuildingCard.tsx b/hera/card/BuildingCard.tsx index 2c9836ef..6f9f6483 100644 --- a/hera/card/BuildingCard.tsx +++ b/hera/card/BuildingCard.tsx @@ -68,7 +68,11 @@ const costRange = getAttributeRange( extractCost, minBy(createableBuildings, extractCost)?.configuration.cost || 0, ); -const defenseRange = getAttributeRange(buildings, ({ defense }) => defense); +const defenseRange = getAttributeRange( + buildings, + ({ defense }) => defense, + 0.01, +); export default memo(function BuildingCard({ biome, @@ -161,7 +165,6 @@ export default memo(function BuildingCard({ {limit > 0 ? ( <> diff --git a/hera/card/Range.tsx b/hera/card/Range.tsx index f5640a75..542cadde 100644 --- a/hera/card/Range.tsx +++ b/hera/card/Range.tsx @@ -1,4 +1,8 @@ -import { AttributeRangeValue } from '@deities/athena/lib/getAttributeRange.tsx'; +import { + AttributeRange, + AttributeRangeWithZero, + LargeAttributeRangeWithZero, +} from '@deities/athena/lib/getAttributeRange.tsx'; import Breakpoints from '@deities/ui/Breakpoints.tsx'; import { SquareButtonStyle } from '@deities/ui/Button.tsx'; import { applyVar } from '@deities/ui/cssVar.tsx'; @@ -26,6 +30,16 @@ const StarEmpty = ( /> ); +const StarHalf = ( + `, + height: 24, + width: 24, + }} + /> +); + const StarFull = ( ); +const toValue = (value: AttributeRangeWithZero) => (value === 0 ? 1 : value); + +const starIcon = (value: number, boundary: number) => + value >= boundary ? StarFull : StarEmpty; + +const halfStarIcon = (value: number, boundary: number) => + value >= boundary ? (value >= boundary + 1 ? StarFull : StarHalf) : StarEmpty; + export default memo(function Range({ end, invert, invertColors, value, wide, - zero, }: { end?: true; invert?: true; invertColors?: true; - value: AttributeRangeValue; + value: AttributeRangeWithZero; wide?: true; - zero?: true; }) { if (invert) { - value = (6 - value) as AttributeRangeValue; + value = (6 - toValue(value)) as AttributeRange; } + const style = { - color: colors[invertColors ? ((6 - value) as AttributeRangeValue) : value], + color: + colors[ + (invertColors ? 6 - toValue(value) : toValue(value)) as AttributeRange + ], }; + return (
- {value >= 1 && (!zero || value > 1) ? StarFull : StarEmpty} + {starIcon(value, 1)} +
+
+ {starIcon(value, 2)} +
+
+ {starIcon(value, 3)} +
+
+ {starIcon(value, 4)} +
+
+ {starIcon(value, 5)} +
+
+ ); +}); + +export const LargeRange = memo(function LargeRange({ + end, + value, +}: { + end?: true; + value: LargeAttributeRangeWithZero; +}) { + const style = { + color: colors[toValue(Math.ceil(value / 2) as AttributeRange)], + }; + + return ( + +
+ {halfStarIcon(value, 1)}
- {value >= 2 ? StarFull : StarEmpty} + {halfStarIcon(value, 3)}
- {value >= 3 ? StarFull : StarEmpty} + {halfStarIcon(value, 5)}
- {value >= 4 ? StarFull : StarEmpty} + {halfStarIcon(value, 7)}
- {value >= 5 ? StarFull : StarEmpty} + {halfStarIcon(value, 9)}
); @@ -92,15 +154,13 @@ export const RangeSelector = memo(function RangeSelector({ value: initialValue, }: { invert?: true; - onSelect: (value: AttributeRangeValue) => void; - value?: AttributeRangeValue | 0; + onSelect: (value: AttributeRange) => void; + value?: AttributeRangeWithZero; }) { const [isActive, setIsActive] = useState(false); - const [value, setValue] = useState( - initialValue || 0, - ); - const color = (value: AttributeRangeValue) => - colors[invert ? ((6 - value) as AttributeRangeValue) : value]; + const [value, setValue] = useState(initialValue || 0); + const color = (value: AttributeRange) => + colors[invert ? ((6 - value) as AttributeRange) : value]; return ( setValue(1)} style={{ color: color(1) }} > - {value >= 1 ? StarFull : StarEmpty} + {starIcon(value, 1)}
setValue(2)} style={{ color: color(2) }} > - {value >= 2 ? StarFull : StarEmpty} + {starIcon(value, 2)}
setValue(3)} style={{ color: color(3) }} > - {value >= 3 ? StarFull : StarEmpty} + {starIcon(value, 3)}
setValue(4)} style={{ color: color(4) }} > - {value >= 4 ? StarFull : StarEmpty} + {starIcon(value, 4)}
setValue(5)} style={{ color: color(5) }} > - {value >= 5 ? StarFull : StarEmpty} + {starIcon(value, 5)}
); diff --git a/hera/card/TileCard.tsx b/hera/card/TileCard.tsx index 9bf7b70e..187656d5 100644 --- a/hera/card/TileCard.tsx +++ b/hera/card/TileCard.tsx @@ -43,7 +43,7 @@ import CardTitle, { CardInfoHeading } from './CardTitle.tsx'; import CoverRange from './lib/CoverRange.tsx'; import tileFieldHasDecorator from './lib/tileFieldHasDecorator.tsx'; import MovementBox from './MovementBox.tsx'; -import Range from './Range.tsx'; +import Range, { LargeRange } from './Range.tsx'; import TilePreview from './TilePreview.tsx'; const tiles = getAllTiles(); @@ -120,7 +120,7 @@ export default memo(function TileCard({ {coverName ? `${coverName}: ${cover}` : cover} - + {vision === -1 ? ( <> diff --git a/hera/card/UnitCard.tsx b/hera/card/UnitCard.tsx index 0bd9224f..59ed623d 100644 --- a/hera/card/UnitCard.tsx +++ b/hera/card/UnitCard.tsx @@ -213,7 +213,7 @@ const visionRange = getAttributeRange( ({ configuration: { vision } }) => vision, 1, ); -const defenseRange = getAttributeRange(units, ({ defense }) => defense); +const defenseRange = getAttributeRange(units, ({ defense }) => defense, 0.01); const supplyRange = getAttributeRange( units, extractFuel, @@ -345,11 +345,7 @@ export default memo(function UnitCard({ Defense
{defense}
- + Movement diff --git a/hera/card/lib/CoverRange.tsx b/hera/card/lib/CoverRange.tsx index ce040719..d4dbc23b 100644 --- a/hera/card/lib/CoverRange.tsx +++ b/hera/card/lib/CoverRange.tsx @@ -1,10 +1,20 @@ import { getAllTiles } from '@deities/athena/info/Tile.tsx'; import getAttributeRange from '@deities/athena/lib/getAttributeRange.tsx'; +import minBy from '@deities/hephaestus/minBy.tsx'; + +const tiles = getAllTiles().filter( + ({ configuration: { cover } }) => cover < Number.POSITIVE_INFINITY, +); + +const min = + (minBy( + tiles.filter(({ configuration: { cover } }) => cover > 0), + ({ configuration: { cover } }) => cover, + )?.configuration.cover || 0) - 0.01; export default getAttributeRange( - getAllTiles().filter( - ({ configuration: { cover } }) => cover < Number.POSITIVE_INFINITY, - ), + tiles, ({ configuration: { cover } }) => cover, - 0, + min, + 10, ); diff --git a/hera/character/Portrait.tsx b/hera/character/Portrait.tsx index 14350758..5795a378 100644 --- a/hera/character/Portrait.tsx +++ b/hera/character/Portrait.tsx @@ -30,8 +30,8 @@ export default memo(function Portrait({ unit: UnitInfo; variant?: number; }) { - const hasSprites = useSprites('portraits'); - const sprite = hasSprites + const hasPortraits = useSprites('portraits'); + const sprite = hasPortraits ? spriteURL('Portraits', encodeDynamicPlayerID(player)) : ''; @@ -51,14 +51,16 @@ export default memo(function Portrait({ zoom: scale, }} > - + {sprite && ( + + )} ); }); diff --git a/hera/render/Images.tsx b/hera/render/Images.tsx index 82c7e3c6..697e9a8a 100644 --- a/hera/render/Images.tsx +++ b/hera/render/Images.tsx @@ -96,7 +96,8 @@ const FireworksSprite = 'https://art.athenacrisis.com/v9/assets/Fireworks.png'; const HealSprite = 'https://art.athenacrisis.com/v9/assets/Heal.png'; -const NoiseSprite = 'https://art.athenacrisis.com/v9/assets/Noise.png'; +const NoiseSprite = + 'data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAAGQAAABkCAQAAADa613fAAAACXBIWXMAAAsTAAALEwEAmpwYAAAT4klEQVR42t3b15PVxdbG8c8EGHISCUqSDCIiIAhIxiEJCAgjgqQBlBwkxwOckYMkFZHkCJJBAUmSRHIYguScc1AGRNLAwLwX+4IL6/0H9qrq2lV90fWr/q61nlpP1w5J9ycRV6h9l3PnWNIIGZmxEFHw7/huPwNToAgJO7n8OwaxbCexxxDN8wk8LE6polQqgrukuYjcAJyYzf6miABqzCYqLwdKMrY6dvhXvDSUZZ8jPWtqcG4SeSYSKkgiZNhOSr7DkHWoCVRsS4pMPP0FZ9h6k3lpKL6bmef4NC9NthG7j+mjUIS4gjgFbDlO9muoDhzbiKoAwPnWRE2lagzNX6Z1Iw70IzoVB+qxZTWterKwCBKB1mNocoehjTm5DCOALquCiEj49uIIoVgMpUviD/zAn48wFjg/mkNLyL2Vyu9xazQl38cQdk9icyw52yKElB3ou43X1gJ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diff --git a/hera/ui/GameDialog.tsx b/hera/ui/GameDialog.tsx index e369bd8a..e483c102 100644 --- a/hera/ui/GameDialog.tsx +++ b/hera/ui/GameDialog.tsx @@ -69,8 +69,7 @@ const MapInfoPanel = memo(function MapInfoPanel({ info: MapInfoState; map: MapData; }) { - const { building, unit } = info; - const tile = info.tile; + const { building, tile, unit } = info; const { buildingState, leaderState, states, tileState, unitState } = useMemo(() => { const unitState = unit @@ -93,7 +92,7 @@ const MapInfoPanel = memo(function MapInfoPanel({ : null; const tileState = tile ? ({ - tile: info.tile, + tile, type: 'tile', } as const) : null; @@ -104,7 +103,7 @@ const MapInfoPanel = memo(function MapInfoPanel({ tileState, ].filter(isPresent); return { buildingState, leaderState, states, tileState, unitState }; - }, [unit, building, tile, info.tile]); + }, [unit, building, tile]); const [panel, setPanel] = useState( unitState || buildingState || tileState || { type: 'none' }, ); diff --git a/hera/ui/MapInfo.tsx b/hera/ui/MapInfo.tsx index 26a29c3e..fe4e3ad8 100644 --- a/hera/ui/MapInfo.tsx +++ b/hera/ui/MapInfo.tsx @@ -3,7 +3,7 @@ import { TileField, TileInfo, } from '@deities/athena/info/Tile.tsx'; -import { getAttributeRangeValue } from '@deities/athena/lib/getAttributeRange.tsx'; +import { getLargeAttributeRangeValue } from '@deities/athena/lib/getAttributeRange.tsx'; import { Biome } from '@deities/athena/map/Biome.tsx'; import Building from '@deities/athena/map/Building.tsx'; import { @@ -38,7 +38,7 @@ import { css, cx } from '@emotion/css'; import React, { useEffect, useMemo, useRef } from 'react'; import BuildingTile from '../Building.tsx'; import CoverRange from '../card/lib/CoverRange.tsx'; -import Range from '../card/Range.tsx'; +import { LargeRange } from '../card/Range.tsx'; import Map from '../Map.tsx'; import Tick from '../Tick.tsx'; import { State } from '../Types.tsx'; @@ -104,10 +104,9 @@ const Tile = ({ Cover:
-
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": { diff --git a/ui/controls/setupKeyboard.tsx b/ui/controls/setupKeyboard.tsx index 5022f547..30c30a2c 100644 --- a/ui/controls/setupKeyboard.tsx +++ b/ui/controls/setupKeyboard.tsx @@ -162,7 +162,10 @@ export default function setupKeyboard() { setup = true; document.addEventListener('keydown', keydownListener); document.addEventListener('keyup', keyupListener); - if (process.env.NODE_ENV !== 'development') { + if ( + process.env.NODE_ENV !== 'development' && + !process.env.IS_LANDING_PAGE + ) { document.addEventListener('contextmenu', preventDefault); } } diff --git a/vitest.config.ts b/vitest.config.ts index c1af28e2..74055ee4 100644 --- a/vitest.config.ts +++ b/vitest.config.ts @@ -9,6 +9,6 @@ export default defineConfig({ test: { globalSetup: ['./tests/viteServer', './tests/playwrightServer'], setupFiles: ['./tests/setup'], - testTimeout: (process.env.CI ? 1.5 : 1) * 25_000, + testTimeout: (process.env.CI ? 2 : 1) * 25_000, }, });