Git Product home page Git Product logo

age-of-empires-ii-grid-generator's Introduction

Description

Adding grid lines to the ground textures in AoE2 helps placing buildings and judging distance. A popular mod on the Steam Workshop providing this is Alignment Grid.

However different mods modifying the same ground texture are not compatible and one has to take priority over the other. If a player wants to use a custom terrain which does not come with a grid they need to bug the author to make another version. On the other hand all mod authors that want to provide a grid need to go through the same manual process.

This project aims to solve both problems by adding grid lines to any existing mod or the base game in an automatic fashion. Players can add a grid to any terrain mod on their own and mod authors have to do less work if they do want to provide a grid in their mods.

Additionally the look of the grid is customizable with the defaults closely resembling the previously linked Alignment Grid mod.

This readme is written with the HD version in mind but should work with the original as well by moving folders around manually. Since I do not have the original I am not sure about the exact steps.

Installation

To run the python source Python 3 and Pillow are needed. Alternatively a stand-alone executable can be found under Releases here on Github.

Usage

This is a command line application without graphical user interface. Running it with --help gives a description of all the arguments.

After running the application a new mod called Grid Generator will appear in the Steam Workshop menu in the game. This mod contains the generated grid terrain. Make sure it has a higher priority than the other terrain altering mods.

Arguments

  • --game-dirAlways needs to be provided. This is the installation directory of AoE2. To find this right click on the game in steam and select properties -> local files -> browse local files.
  • --mod-dir Installation directory of an existing mod to which the grid will be added to. To find this open the Steam Workshop menu in the game, select the mod and click on Open Directory.
  • --alpha The opacity of the grid lines as a number between 0 and 1 where 1 is totally opaque and 0 is totally transparent (invisible).
  • --width The width of the grid lines in pixels.
  • --color The color of the grid lines in RGB format.
  • --preview Show a rough preview of the grid without creating any files.
  • --clean Clean the installation directory before creating new files. This will remove all .png files in the directory. Existing files will still be overwritten even if the option is not given.

On Windows it might help to replace back with forward slashes in case a path to a directory is not recognized.

Examples

Add the default grid to a mod:

grid_generator --game-dir "C:\Program Files (x86)\Steam\steamapps\common\Age2HD" --mod-dir "C:\Program Files (x86)\Steam\steamapps\workshop\content\221380\176712202"

default grid Create a custom grid using the base game as the source terrain:

grid_generator --game-dir "C:\Program Files (x86)\Steam\steamapps\common\Age2HD" --alpha 1.0 --width 5 --color 255 0 0

custom grid alpha 1.0, width 5, color 255 0 0

Building

To make a release install PyInstaller and run

pyinstaller --clean --onefile grid_generator.py

age-of-empires-ii-grid-generator's People

Contributors

e00e avatar

Stargazers

 avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar

age-of-empires-ii-grid-generator's Issues

Small suggestions

coordinates = [int(spacing * i) for i in range(11)]

I suggest casting to int in line 18. Currently, spacing is 51.2 which creastes a tiny offset of 1 pixel when i > 5.

The HD edition tiles have a size of 53x53 pixels. They overlap by 2 tiles, which creates the 512x512 resolution for the whole terrain file (512 = (10 * 53) - (9 * 2)). The reason for this is the isometric algorithm they use which requires these overlaps. Ideally, the grid is located where the tiles overlap, so it's ideal if spacing == 51.

if original.size != (512, 512):

This is a problem for older version than HD. Legacy AoC has a terrain of size 481x481 (or 490x490 for some modding tools). Upscaling can cause issues with older modding tools. I suggest you either just leave the resulting image at the original size or add a new argument --upscale.

result.rotate(45, resample=Image.LANCZOS, expand=True).show()

For an ingame isometric view, you can use the transform algorithm of the openage repo.

SFTtech/openage-modding#8

It's the inverse_transform() that you want to do. We call it "dimetric transform", but that's just the scientific term for the isometric transformation used in games. The transformation might also help you if you want to create terrain files for legacy versions of AoC (e.g. the one used for Voobly).

License

Does this project has a license or do you intend to add one?

I'm asking because it might be nice to add this script to here :)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.