Skip to content

0ad-matters/boonGUI

Repository files navigation

boonGUI

User interface mod for the RTS game 0 A.D.



Thumbnail

Thumbnail

Thumbnail

Thumbnail

✨ Features

🕹 In-Game

  • Large round mini map
  • Extra in-game stats about the players
  • Rally points are visible for observers.
  • Bigger buttons for the construction panel
  • All player colors and fruits have more vivid colors.
  • Increased size for all weapon projectiles, chickens and garrison flags on every building.
  • All heroes have a large visible object flowing over their head, making them easier to see on the battlefield.
  • Individually selected units show attack and resistance values, relics show their auras and treasures show their contents.

🎯 Miscellaneous UI improvements

  • Camera: Change the camera settings in the options.
  • Lobby: Quick access buttons below the chat input.
  • Replays overview: Adding a button next to the replay path for quick access to the directory.
  • Trade: The trading probabilities for all resources are saved.

👨‍💻 Install

System Default location for the /0ad/mods/ folder
Linux ~/.local/share/0ad/mods/
macOS ~/Library/Application\ Support/0ad/mods/
Windows ~\Documents\My Games\0ad\mods\
  • Pick one of three ways to install the mod
    • GitHub
      • Clone it in your /0ad/mods/ folder.
    • Pyromod
      • Drag the file over the 0ad start icon or double click it.
      • The mod gets unpacked and placed automatically in your /0ad/mods/ folder.
    • ZIP
      • Unpack it in your /0ad/mods/ folder.
  • Start 0 A.D., click Settings and Mod Selection.
  • Double-click boonGUI, click Save Configuration and Start Mods.

💪 Contributing

  1. Fork it.
  2. Create a new feature branch: git checkout -b my-new-feature
  3. Commit your changes: git add . and git commit -m 'Add some feature'
  4. Push it to the branch: git push fork my-new-feature
  5. Submit a pull request.

👁 Code structure

Created with RepoVisualize, click to interact. image

🐛 Debug

  • Debugging is done by inserting logging functions into the suspected problematic code.
  • All custom debug methods of boonGUI are accessible through the bd object, see globalscripts/bd.js.
bd.assert(Object.getPrototypeOf(Object.prototype)); // "ASSERT FAIL: null"
bd.group(); // +++++ groupStart +++++
bd.groupEnd(); // ----- groupEnd -----
bd.log("test1", g_HotkeyTags); // ["test1", {color:"255 251 131"}]
bd.inter([1, 2, 3], [3, 4]); // [3]
bd.listProp(WeakMap.prototype); // ["constructor", "delete", "get", "has", "set"]
bd.slow("test1", g_HotkeyTags); // same as "log", but the interval is every 2s (useful in a loop)
bd.stack(); // stack trace
bd.symDiff([1, 2, 3], [3, 4]); // [1, 2, 4]
bd.temp(9344); // ["cavalry_archer_b", 9344] template name for entity number
bd.time("Math time");
// Math.pow(295, 109)
bd.timeEnd("Math time"); // Math time: 0.048ms
bd.trueTypeOf(["😀", "🤢", "💩", "🎃"]); // array
bd.union([1, 2, 3], [3, 4]); // [1, 2, 3, 4]

🔱 Git-Hook

Trivial problems in the code are handled with the pre-commit hook, customizations are set in the .pre-commit-config.yaml.

Pre-commit is a multi-language package manager for pre-commit hooks. You specify a list of hooks you want and pre-commit manages the installation and execution of any hook written in any language before every commit. Source: pre-commit introduction


  1. Install node and pre-commit for example through Homebrew.
brew install node pre-commit
  1. Install the dependencies from the package.json file. The pre-commit hooks are also set up. Done.
# Choose your favorite package manager: npm, pnpm or yarn
npm install
# Normal workflow
git add .
git commit -m "message"
# check repo dirty.........................................................Passed
# check for added large files..............................................Passed
# check docstring is first.............................(no files to check)Skipped
# check json...........................................(no files to check)Skipped
# ...
Detailed code information

Conventions

Commit message must conform with the Conventional commits standard.

- ci       # CI config and automatic tests
- chore    # Other changes
- docs     # Documentation only
- feat     # New feature
- fix      # Bug fix
- revert   # Revert commit

JavaScript

Mirroring the linting process from 0 A.D. by using ESLint and an adopted set of rules defined in the package.json file.

  • The .vscode settings are set up to automatically adjust your code to the rules when you save the document.
  • An optional installation of the VSCode ESLint extension runs ESLint on each file and display warnings and errors at once.
  • The alternative is to lint and auto fix all your code with the following commands.
# ESLint
brew install eslint
eslint . --fix

# pre-commit
brew install pre-commit
pre-commit run --all-files eslint

Pre-commit

  • Some additional commands that are good to know, though also not often used.
# Installs the hook scripts alongside any existing git hooks.
pre-commit install --hook-type commit-msg --hook-type pre-push
# Manually run all pre-commit hooks on a repository
pre-commit run --all-files
# To run individual hooks
pre-commit run < hook_id >
# Update the hooks to the latest tag on the default branch.
pre-commit autoupdate

Text validation

  • Typos
    • Finding and correcting spelling mistakes in the source code.
    • Rules are set in the .typos.toml file.
    • Auto-fix mistakes.
# Typos
brew install typos-cli
# Auto-fix obvious typos
typos -w

XML

Prettier for XML formats the files according to the rules set in package.json.

  • An optional installation of the Prettier - Code formatter extension automatically formats the XML file upon saving.
  • The following command formats all XML files with Prettier and runs a simple style sheet over them to ensure that the xsl:output attributes have the correct case and form.
npm run xmlStyle


🏆 Contributors

The motivation for this mod was to learn JavaScript by creating a utility tool for @mysticjim. There were a legion of contributors who helped create the mod.

  • The statistics overlay was written by @Islan.

  • Thanks to @Effervescent, @mysticjim, @Nobbi, @Palaiologos and @seeh for constantly testing and giving feedback.

  • Providing code and helping with problems: @andy5995, @kaaduu, @maroder, @Nescio, @Pretuer and @Schweini.

  • The developers of the game can be reached through their IRC channel #0ad-dev, among them are the following who helped the project to succeed: @elexis, @bb, @Imarok, @wraitii, @Freagarach, @vladislavbelov, @Silier and @Stan`.

  • Thanks to other modders:

If you want to contribute, give feedback or make suggestions, go ahead.

❤️