Skip to content
Draft
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -11,3 +11,4 @@ resources/.DS_Store
.clinic/
CLAUDE.md
.idea/
site/
8 changes: 4 additions & 4 deletions API.md → docs/API.md
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
## API Usage
# API Usage

### List Game Metadata
## List Game Metadata

Get game IDs and basic metadata for games that started within a specified time range. Results are sorted by start time and paginated.

Expand Down Expand Up @@ -49,7 +49,7 @@ The response includes a `Content-Range` header indicating pagination (e.g., `gam

---

### Get Game Info
## Get Game Info

Retrieve detailed information about a specific game.

Expand Down Expand Up @@ -77,7 +77,7 @@ curl "https://api.openfront.io/public/game/ABSgwin6?turns=false"

---

### Get Player Info
## Get Player Info

Retrieve information and stats for a specific player.

Expand Down
6,678 changes: 6,678 additions & 0 deletions docs/client.md

Large diffs are not rendered by default.

Empty file added docs/contribute.md
Empty file.
Empty file added docs/core.md
Empty file.
38 changes: 38 additions & 0 deletions docs/develop.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,38 @@
# Development reference

If you would like to contribute, first, check out the [contribution page](contribute.md), and then check out the [Getting Started guide](getting_started.md) to learn how to set up a local copy of the repository.

## Introduction

This project started as a fork of WarFront (not to be confused with FrontWars), by evanpelle. It is written in TypeScript, which is like JavaScript, but with static typing. As of writing, the project is deployed as a website at openfront.io, with a planned release on Steam.

## Project Structure

- `/docs` - The documentation you're reading right now!
- `/resources` - Static assets (images, maps, etc.)
- `/proprietary` - Non free static assets (music)
- `/map-generator` - A tool used to create maps for the game
- `/tests` - [Jest](https://jestjs.io/) tests for [regression](https://en.wikipedia.org/wiki/Regression_testing) prevention
- `/src` - The source code
- `./core` - [Shared game logic](core.md)
- `./game` - Files managing in-memory game state, map loading, and utilities for game management
- `./configuration` - Different presets to be used by other parts of the code
- `./execution` - Logic controllers for different parts of the game
- `./worker` - Isolation of long-running or async tasks to a worker context
- `./pathfinding` - Different algorithms for navigation
- `./validations` - Utilities for sanitizing user content (like usernames)
- `./utilities` - Generic core helper functions
- `./client` - [Frontend game client](client.md)
- `./graphics` - 2D rendering
- `./components` - Custom HTML components
- `./styles` - CSS used by the client
- `./data` - json data accessed by the client (like countries)
- `./sound` - Sound management
- `./utilities` - Generic client helper functions
- `./server` - [Backend game server](server.md)

## Technologies used

- [Lit](https://lit.dev/) for creating usable html objects (usually `TemplateResult`) from strings.

![](./res/sample.png)
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

⚠️ Potential issue | 🟡 Minor

Add alt text to the image for accessibility.

The image is missing alt text, which is required for accessibility. Users with screen readers and others will not understand what the image depicts.

Apply this diff to add descriptive alt text:

-![](./res/sample.png)
+![Sample image showing project structure](./res/sample.png)

Adjust the alt text to accurately describe what the image shows.

📝 Committable suggestion

‼️ IMPORTANT
Carefully review the code before committing. Ensure that it accurately replaces the highlighted code, contains no missing lines, and has no issues with indentation. Thoroughly test & benchmark the code to ensure it meets the requirements.

Suggested change
![](./res/sample.png)
![Sample image showing project structure](./res/sample.png)
🧰 Tools
🪛 markdownlint-cli2 (0.18.1)

38-38: Images should have alternate text (alt text)

(MD045, no-alt-text)

🤖 Prompt for AI Agents
In docs/develop.md around line 38 the image tag lacks alt text which hinders
accessibility; update the markdown image to include a concise, descriptive alt
attribute (e.g., ![short descriptive text](./res/sample.png)) that accurately
describes the image content so screen readers can convey its meaning.

149 changes: 149 additions & 0 deletions docs/getting_started.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,149 @@
# Getting Started

## Prerequisites

- git
- npm (v10.9.2 or higher)
- A modern browser with developer tools
- github account
- discord account

Before you start, make sure you have all of these tools installed and ready to be used

Test by running in your terminal (or command prompt)

```bash
git --help
npm --help
```

You should see some help output. If you do, move on. If you don't try restarting your terminal, restarting your device, or reinstalling the tools.

## Discussing with the community

If you would like to make a change, especially a larger one (like a new feature, a large rewrite, or similar), you will need to discuss with the contributors and the maintainers on IF the change should be implemented, and potentially HOW it should be implemented. You may make a change without this discussion, but there is a much larger chance that it will require a lot of changes, or be straight up rejected.

The first step to becoming active in the community as a contributor is to request to join the development discord over at [https://discord.gg/K9zernJB5z]. It usually takes up to a few days to get accepted.

In the meantime while waiting, you can open an issue on the issues page. Make sure to fill it out thoroughly. You can then ask to be assigned in the comments of the issue.

Once you know what kind of changes you would like to make, you can move on to the next section.

## Making the change

If you are new to git, the first author of this file recommends you check out [this website](https://learngitbranching.js.org/?locale=en_US) for a visual way of learning how to use it.

### Setup

In github, fork [the repo](https://github.com/openfrontio/OpenFrontIO) onto your account.
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

⚠️ Potential issue | 🟡 Minor

Fix capitalization: "github" → "GitHub".

🧰 Tools
🪛 LanguageTool

[uncategorized] ~38-~38: The official name of this software platform is spelled with a capital “H”.
Context: ... learning how to use it. ### Setup In github, fork [the repo](https://github.com/ope...

(GITHUB)

🤖 Prompt for AI Agents
In docs/getting_started.md around line 38, change the lowercase "github" to the
correct capitalization "GitHub" in the sentence "In github, fork [the
repo](https://github.com/openfrontio/OpenFrontIO) onto your account." to fix the
branding/capitalization issue.


![the fork button on the github interface](res/github_fork.png)

Clone the repo, go into it, and set the upstream to the original repo.

```bash
git clone https://github.com/YourUsername/OpenFrontIO.git
cd OpenFrontIO
git remote add upstream https://github.com/openfrontio/OpenFrontIO.git
```

Install dependencies

```bash
npm i
```

Before making a change, make sure your local repo is up to date on the upstream and update your origin.

```bash
git checkout main
git fetch upstream --rebase
git push
```

If you would like to make a new change, create a new branch, and `checkout` into it

```bash
git checkout -b awesomefeature
```

### Editing files

You can now make a change and make a commit

```bash
git commit -m "add XYZ feature" path/to/file.ts
```

To test your change in-game, you can run any of the following

```bash
npm run dev
```

```bash
npm run start:client
```

```bash
npm run start:server-dev
```

### Cleaning up

Before publishing make sure to test your change manually, and then with npm, as you want to avoid creating regressions.

```bash
npm run test
```

Make sure your format also matches the one employed by the rest of the codebase

```bash
npm run format
```

or alternatively

```bash
npx prettier --write path/to/file
```

Lastly, make sure to lint your code

```bash
npm run lint
```

```bash
npm run lint:fix
```

Don't forget to commit your changes

```bash
git commit . -m "format"
```

### Publishing your change

Once you are happy with your commits, format your changes, and push them to origin. You cannot push directly to upstream (the official repo).

```bash
git push
```

Now, go to your repo on github, and create a pull request from your branch `YourUserName/OpenFrontIO/awesomefeature` to the main repo `OpenFrontIO/OpenFrontIO/main`.

Make sure to fill out the description properly before making a PR. If you are not ready to be reviewed yet, you can submit a "draft PR". As you push changes on your branch, the PR will be updated to match.

coderabbitai will then comment on your PR and suggest changes. If the changes are sensible, implement them.

Afterwards, if your PR is set as ready to be reviewed (not a draft) one of the maintainers will come and comment any needed changes. Discuss them further or implement the changes, and wait for another review.

Hopefully, afterwards, your change will be accepted, merged into main, and then later on, pushed out in an update to the live game!
Comment on lines +141 to +144
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

⚠️ Potential issue | 🟡 Minor

Use American English spelling: "Afterwards" → "Afterward".

Applies to both lines 138 and 141.

🧰 Tools
🪛 LanguageTool

[locale-violation] ~138-~138: In American English, ‘afterward’ is the preferred variant. ‘Afterwards’ is more commonly used in British English and other dialects.
Context: ... changes are sensible, implement them. Afterwards, if your PR is set as ready to be revie...

(AFTERWARDS_US)


[locale-violation] ~141-~141: In American English, ‘afterward’ is the preferred variant. ‘Afterwards’ is more commonly used in British English and other dialects.
Context: ...nd wait for another review. Hopefully, afterwards, your change will be accepted, merged i...

(AFTERWARDS_US)

🤖 Prompt for AI Agents
In docs/getting_started.md around lines 138 to 141, replace the
British/ambiguous "Afterwards" with the American English spelling "Afterward" on
both occurrences (line 138 and line 141) to ensure consistent American-English
usage; update the two words and run a quick spellcheck to confirm no other
instances remain.


## Next steps

- To learn more about our contribution guidelines, check out [the contribution page](contribute.md)
- To learn more about the structure of the codebase, go to [the development reference](develop.md)
13 changes: 13 additions & 0 deletions docs/index.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,13 @@
# OpenFront docs

[OpenFront.io](https://openfront.io) is an online RTS io game project.

This documentation serves as a place to learn about the internal workings of [this project](https://github.com/openfrontio/openfrontio), namely:

- [Using the API (API Reference)](API.md)
- [Contributing](contribute.md)
- [Orienting yourself in the project (Developer Reference)](develop.md)

For a quick guide on how to get the repository up and running with some of your first changes, visit the [Starting Guide](getting_started.md)!

In order to learn about game mechanics, check out the [community run wiki](https://openfront.miraheze.org), or even contribute to it!
Binary file added docs/res/github_fork.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added docs/res/sample.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Empty file added docs/server.md
Empty file.
12 changes: 12 additions & 0 deletions mkdocs.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,12 @@
site_name: OpenFront docs
nav:
- Home: index.md
- API reference: API.md
- Getting Started: getting_started.md
- Contributing: contribute.md
- Development reference: develop.md
- Client reference: client.md
- Server reference: server.md
- Core reference: core.md

theme: readthedocs
Loading