APuddle210 67af4b06ab TerrainMapGenerator General Cleanup (#234)
> There were 4 separate implementations of getting neighboring
coordinates for a given x,y pair, 3 completely unique implementations.
These were found in neighbors(), processOcean(), processDistToLand(),
and getArea(), with processOcean() and processDistToLand() having
essentially identical implementations. Created new function
getNeighborCoords() with implementation closely resembling that found in
neighbors().

Revised aforementioned functions to utilize the new getNeighborCoords()
instead, with revised implementations being much more consistent across
the impacted functions.

> Revised getArea() to correctly assess the area, was previously likely
to overestimate the area as it included all coordinates it check
regardless of their terrainType. getArea() now also explicitely
implements the Coord[] interface, allowing for standardized
implementation syntax in all functions which call getArea().

Also removed the parameter targetType as all calls to getArea()
targetted the same TerrainType as was present at the passed x, y
position. getArea() will now assess targetType based on the passed x, y
values.

Reordered the parameters of getArea() so that it conformed with the
ordering used elsewhere in the script (x, y, map, visited). Updated all
calling locations accordingly.

> Revised processOcean() to make use of getArea() instead of using its
own reimplementation of area checking. This coupled with the use of the
new getNeighborCoords() significantly reduced the size of processOcean
and improved comprehensibility.

Also removed unnecessary check of waterBody.size that would always
return TRUE in that context.

> Removed checks against and setting of Terrain.ocean values in the
removeSmallIslands() and removeSmallLakes() functions as these functions
are called prior to processOcean() making the checking
redundant/unncessary, and the setting potentially problematic.

Revised Terrain class to default ocean to false, to address compiler
warning, and since processOcean() handles setting this property to true
explicitly.

Reduced total lines from 417 to 372.
2025-03-13 06:02:30 -07:00
2025-03-07 15:45:29 +00:00
2025-03-06 15:50:29 -08:00
2025-03-11 15:44:45 -07:00
2025-02-12 08:38:56 -08:00
2025-03-07 16:37:39 +00:00
2025-03-05 08:04:12 -08:00
2025-03-06 15:50:29 -08:00
2025-02-18 17:23:37 -08:00
2025-03-07 16:51:15 +00:00
2025-03-06 20:52:40 -08:00
2025-02-12 08:38:56 -08:00
2025-02-14 14:03:22 -05:00
2025-03-12 12:29:08 -07:00
2025-02-12 08:38:56 -08:00
2025-03-10 19:46:51 -07:00
2025-03-07 15:53:23 +00:00
2025-02-20 00:48:45 +02:00
2025-02-12 08:38:56 -08:00
2025-03-06 09:41:28 -08:00

OpenFrontIO

OpenFrontIO Logo

Prettier Check

OpenFront is an online real-time strategy game focused on territorial control and alliance building. Players compete to expand their territory, build structures, and form strategic alliances in various maps based on real-world geography.

This is a fork/rewrite of WarFront.io. Credit to https://github.com/WarFrontIO.

🌟 Features

  • Real-time Strategy Gameplay: Expand your territory and engage in strategic battles
  • Alliance System: Form alliances with other players for mutual defense
  • Multiple Maps: Play across various geographical regions including Europe, Asia, Africa, and more
  • Resource Management: Balance your expansion with defensive capabilities
  • Cross-platform: Play in any modern web browser

📋 Prerequisites

  • Bun.js (v1.2.4 or higher)
  • A modern web browser (Chrome, Firefox, Edge, etc.)

🚀 Installation

  1. Clone the repository

    git clone https://github.com/openfrontio/OpenFrontIO.git
    cd OpenFrontIO
    
  2. Install dependencies

    bun i
    

🎮 Running the Game

Development Mode

Run both the client and server in development mode with live reloading:

bun run dev

This will:

  • Start the webpack dev server for the client
  • Launch the game server with development settings
  • Open the game in your default browser

Client Only

To run just the client with hot reloading:

bun run start:client

Server Only

To run just the server with development settings:

bun run start:server-dev

🛠️ Development Tools

  • Format code:

    bun run format
    
  • Lint code:

    npm run lint
    
  • Lint and fix code:

    npm run lint:fix
    

🏗️ Project Structure

  • /src/client - Frontend game client
  • /src/core - Shared game logic
  • /src/server - Backend game server
  • /resources - Static assets (images, maps, etc.)

📝 License

This project is licensed under the terms found in the LICENSE file.

🤝 Contributing

Contributions are welcome! Please feel free to submit a Pull Request.

  1. Fork the repository
  2. Create your feature branch (git checkout -b amazing-feature)
  3. Commit your changes (git commit -m 'Add some amazing feature')
  4. Push to the branch (git push origin amazing-feature)
  5. Open a Pull Request
S
Description
Languages
TypeScript 91.2%
GLSL 2.5%
JavaScript 2%
HTML 1.6%
Go 1.1%
Other 1.5%