Speed up converter terrain merging with Cython #1369
Labels
Projects
Comments
|
Hello, can I take this? |
|
Sure, you can just submit an early pull request and get help in the chatroom :) |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
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.htmlwhen 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.
texture.framesin theTexturecurrently stores the terrain tiles asTextureImageobjects. 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.
The text was updated successfully, but these errors were encountered: