-
-
Notifications
You must be signed in to change notification settings - Fork 1.2k
Description
Required skills: Cython, Python
Difficulty: Easy
The terrain textures in AoC and SWGB are stored as isometric* tiles (see #141 for an example). In the converter, we merge all these tiles together to get the cartesian projection of the texture (also used in the HD Edition: see #141 (comment)). The cartesian projection has many advantages, the main one being that the image size is halved and the generated texture file smaller.
An algorithm for terrain merging has already been implemented here using Cython. You main goal is to improve the speed of the conversion by reducing the Python overhead of the function and adjusting the algorithm. Cython will generates a file that shows the overhead of the source file in bin/openage/convert/processor/export/texture_merge.html
when you build the project. We want the Python overhead of the merge function to be as small as possible.
For your conveniance,we have made a list of things that could be improved. You should probably have a look at the code first though.
- The image rotation in line 142 uses a numpy function that could be implemented directly in our code.
- Currently, the algorithm is split into two steps: First all terrain tiles are merged into one big tile, then this tile is projected to cartesian. The initial merging step requires an alpha blend. We can skip the initial merging step by projecting each tile to cartesian directly and directly placing it in the correct position in the final image. This would halve the number of required pixel copy operations.
-
texture.frames
in theTexture
currently stores the terrain tiles asTextureImage
objects. The tiles could be instead be stored as numpy arrays which can be accessed faster with Cython's memoryviews.
You can test your changes with the singlefile media converter.
Further reading:
* Technically, the projection is a dimetric (or game isometric) projection. Keep that in mind, when you search the internet for it.
Metadata
Metadata
Assignees
Labels
Type
Projects
Status
Status