Commit Graph

8 Commits

Author SHA1 Message Date
Aaron Tidwell 9cd87f8906 Map generator -verbose and -performance flags (#2721)
Resolves #2718

## Description:

Adds go-style error log levels, with an additional ALL log level.

- WARN/ERROR - Only success output
- INFO - Existing output
- DEBUG - New output
- ALL - New output (includes the logs from when removal/performance is
enabled)

In addition

- Add `-verbose` (`-v`), `-log-level`, `-log-removal`, and
`-log-performance` flags to map generator
- No changes to default behavior of `go run .` without the new flags
- excludes test maps from performance warnings (test maps already skip
the removal steps)
- updates readme with the different flags and how they impact the logger

Default run (matches existing)
`go run . >> output.txt 2>&1`

[output.txt](https://github.com/user-attachments/files/24365745/output.txt)

Default run w/ `-verbose` (log level DEBUG)
`go run . -v >> output.txt 2>&1`

[output.txt](https://github.com/user-attachments/files/24365812/output.txt)

Default run w/ `-log-performance`
`go run . -log-performance >> output.txt 2>&1`

[output.txt](https://github.com/user-attachments/files/24365971/output.txt)

Run of just africa w/ all new logging enabled
`go run . -maps=africa -log-level=all >> output.txt 2>&1`

[output.txt](https://github.com/user-attachments/files/24365724/output.txt)


## Please complete the following:

- [X] I have added screenshots for all UI updates
- [X] I process any text displayed to the user through translateText()
and I've added it to the en.json file
- [X] I have added relevant tests to the test directory
- [X] I confirm I have thoroughly tested these changes and take full
responsibility for any bugs introduced

## Please put your Discord username so you can be contacted if a bug or
regression is found:

tidwell

---------

Co-authored-by: coderabbitai[bot] <136622811+coderabbitai[bot]@users.noreply.github.com>
2026-01-15 22:40:45 +00:00
FloPinguin 464a4a817a Remove hardcoded numPlayersConfig, calculate it based on the maps land tiles 🔧 (#2874)
## Description:

The calculation is based on: 50 players per 1_000_000 land tiles,
limited at 125 players because of performance
Second number is 75% of that, third one 50%
That way, the player counts are staying mostly the same
Look at the "Dynamic Config" column, these are the new player counts:
(The 125 players limit is missing in that column, only relevant for the
twolakes map)

<img width="930" height="1033" alt="Screenshot_2026-01-12_152758"
src="https://github.com/user-attachments/assets/e1791740-e263-47b3-8b27-4f9aa358d381"
/>
<img width="926" height="324" alt="Screenshot_2026-01-12_152814"
src="https://github.com/user-attachments/assets/78d6789b-374f-4f8b-b50f-f6f08395572b"
/>

This PR also removes `MapDescription` from `Maps.ts` because its unused.
And this PR updates the map-generator `README.md` to reflect the changes

## Please complete the following:

- [X] I have added screenshots for all UI updates
- [X] I process any text displayed to the user through translateText()
and I've added it to the en.json file
- [X] I have added relevant tests to the test directory
- [X] I confirm I have thoroughly tested these changes and take full
responsibility for any bugs introduced

## Please put your Discord username so you can be contacted if a bug or
regression is found:

FloPinguin
2026-01-12 21:18:47 -08:00
Aaron Tidwell 63acbf1043 Update map-generator readme (output files & tile count) (#2709)
## Description:

- clarify the map generator readme size recommendation is for land tile
count, not px size (and that it is for performance, not a hard limit).
Add note about average map land tile count to provide more context.
- Add output files list to provide reference for where to find land tile
count (for some reason the script doesn't output it, will probably open
a new PR to add it to the output of the generator)

I must have missed some context when first documenting this, oops!

## Please complete the following:

- [X] I have added screenshots for all UI updates
- [X] I process any text displayed to the user through translateText()
and I've added it to the en.json file
- [X] I have added relevant tests to the test directory
- [X] I confirm I have thoroughly tested these changes and take full
responsibility for any bugs introduced

## Please put your Discord username so you can be contacted if a bug or
regression is found:

tidwell
2025-12-28 13:32:20 -08:00
Aaron Tidwell 9ab1319126 Map Generator Go Code Documentation (#2656)
Resolves #2602

## Description:
tldr: `npm run docs:map-generator`

Adds documentation to the `map-generator` go code.

This has no functional changes, other than the renaming of the package.
I used the github url, though this can be set to anything as long as it
contains a `.` so that the docs parse it correctly. Go doc best
practices seem a little verbose and terse, but attempted to comply

Future Facing (to get these docs viewable without running locally):
- Wait until the -http issue is sorted, then these are easy to
statically host alongside builds
- Could use the legacy `godoc`
- Could do formatting after outputting the `txt` output


## Change List:

- Add documentation to all types/fns in map-generator go code
- Ensure this outputs correctly with `go doc`
- Add `docs:map-generator` command to package.json. This runs `go doc`
in `map-generator` w/ appropriate flags to generate full documentation.
(see notes in readme)
- rename `map-generator` module to work around pkgsite assuming all
packages without a . are stdlib (this makes `-http` work at all)
- Add new sections to README and update existing sections
- Add additional references to locations in the primary code base where
things can be found
- Update documentation in the ts theme files to add output color
mappings - this ensures that everything needed to trace the input file
-> in game rendered asset is fully documented.


## Please complete the following:

- [X] I have added screenshots for all UI updates
- [X] I process any text displayed to the user through translateText()
and I've added it to the en.json file
- [X] I have added relevant tests to the test directory
- [X] I confirm I have thoroughly tested these changes and take full
responsibility for any bugs introduced

## Please put your Discord username so you can be contacted if a bug or
regression is found:

tidwell
2025-12-21 14:00:54 -08:00
FloPinguin e554ffb1b0 Cleanup nations (Part 3) 🧹 Remove nation strength (#2649)
## Description:

This PR removes the nation strength. Reasoning:

- It is currently unused. The backstory can be found in #2498
- It forces map-makers to do balancing work, which is probably not a
good idea
- It increases map-making work
- It increases nation balancing complexity by a lot (we need to have all
the json files in mind)
- It makes humans avoid map areas completely because there is always
that one, same, strong nation
- The map lead Nikola123 wants to "not deal with the stupid nations and
their balancing"

If the goal of nation strength was to make them feel different I would
suggest a nation personality system. Nations that love to boat, love to
ally, love to nuke, love to fullsend, etc.

Link to a discord discussion about nation strength:


https://discord.com/channels/1359946986937258015/1360078040222142564/1450973197251117218

## Please complete the following:

- [X] I have added screenshots for all UI updates
- [X] I process any text displayed to the user through translateText()
and I've added it to the en.json file
- [X] I have added relevant tests to the test directory
- [X] I confirm I have thoroughly tested these changes and take full
responsibility for any bugs introduced

## Please put your Discord username so you can be contacted if a bug or
regression is found:

FloPinguin
2025-12-19 19:10:01 -08:00
Aaron Tidwell afe072f7d0 Add map-generator --maps flag to process a subset of maps (#2595)
Resolves #2594

## Description:

- Added an optional `--maps` flag to the map-generator that allows
passing a subset of maps to process.
- Updated `README.md` w/ documentation for using the new flag

Used the [go/flag](https://pkg.go.dev/flag) package.

Running without the flag, or with no arguments matches existing behavior
of processing all the maps defined in `main.go`

`go run .`
`go run . --maps=`

New behavior is triggered to process a subset of maps by passing the
`--maps` flag. Multiple maps are defined in a comma-separated list

`go run . --maps=world,africa`

Or a single map (useful for map development)

`go run . --maps=fourislands`

If an invalid map is passed, the process aborts and renders the error

```bash
go run . --maps=invalidmapname
Error generating terrain maps: map "invalidmapname" is not defined
exit status 1
```

By using the default flag package, we get `--help` for free:

```bash
go run . --help
Usage of <path-to-exe>/exe/map-generator:
  -maps string
    	optional comma-separated list of maps to process. ex: --maps=world,eastasia,big_plains
```

I do not write GO often.  Gemini contributed to this syntax.

## Please complete the following:

- [X] I have added screenshots for all UI updates
- [X] I process any text displayed to the user through translateText()
and I've added it to the en.json file
- [X] I have added relevant tests to the test directory
- [X] I confirm I have thoroughly tested these changes and take full
responsibility for any bugs introduced

## Please put your Discord username so you can be contacted if a bug or
regression is found:

tidwell
2025-12-10 10:23:39 -08:00
Aaron Tidwell 2bfe245a72 Add format:map-generator command (#2563)
I'd like to submit some PRs in the future to add additional options for
logging and debugging to the map-generator, however I don't want to
introduce any code style changes in feature requests.

## Description:

I noticed there was not any style guide or formatting being done for the
go files, and went with the simplest built-in approach w/ [go
fmt](https://go.dev/blog/gofmt)

- Adds a `format:map-generator` npm command that will run the default
`go fmt` in the `map-generator` directory to format the go code.
- Runs the formatter and commits the changes to `main.go` and
`map_generator.go`
- Updates the `map-generator` README:
  - Updated location for generated files
  - Updated Links to use markdown links
  - Add `info.json` example
  - Add in-game enabling instructions with list of files to modify
  - Add development tools section with format command

## Please complete the following:

- [X] I have added screenshots for all UI updates
- [X] I process any text displayed to the user through translateText()
and I've added it to the en.json file
- [X] I have added relevant tests to the test directory
- [X] I confirm I have thoroughly tested these changes and take full
responsibility for any bugs introduced

## Please put your Discord username so you can be contacted if a bug or
regression is found:

tidwell
2025-12-09 19:46:13 -08:00
evanpelle 8bb3e64cb8 Move map generator into main repo (#2006)
## Description:

Move the MapGenerator repo into OpenFrontIO so we don't need to copy
generated map files over.

## Please complete the following:

- [x] I have added screenshots for all UI updates
- [x] I process any text displayed to the user through translateText()
and I've added it to the en.json file
- [x] I have added relevant tests to the test directory
- [x] I confirm I have thoroughly tested these changes and take full
responsibility for any bugs introduced

## Please put your Discord username so you can be contacted if a bug or
regression is found:

evan
2025-09-04 18:45:41 -07:00