Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Some HUD textures missing (red cross) when converting from AoE 2 HD #912

Open
rehmsen opened this issue Sep 19, 2017 · 15 comments
Open

Some HUD textures missing (red cross) when converting from AoE 2 HD #912

rehmsen opened this issue Sep 19, 2017 · 15 comments
Labels
area: assets Involved with assets (images, sounds, ...) area: ui Related to the graphical user interface (Qt) bug Behaving differently as it should behave

Comments

@rehmsen
Copy link

rehmsen commented Sep 19, 2017

Looks like this:

openage_2017-09-19_21-52-55_00

To reproduce:

  1. Convert textures from a AoE 2 HD Beta 4.3 (in my case, installed on Windows, but openage is run on Linux).
  2. Run openage, generate any game.
@TheJJ TheJJ added area: assets Involved with assets (images, sounds, ...) bug Behaving differently as it should behave area: ui Related to the graphical user interface (Qt) labels Sep 19, 2017
@TheJJ
Copy link
Member

TheJJ commented Sep 19, 2017

I can't tell right now where the problem originates from, but I suspect that some interface files are not found in the HD-4.3 files. Maybe some errors pop up during the conversion?

The extracted files are then postprocessed with our visgrep to get the repeatable pattern.

I think the extraction procedure works by using what's there, then, if ids match, they're further processed. So I'm pretty sure we won't see any messages about missing files during conversion, because they're named differently or just missing.

That said, we need to identify what file is missing and what its correct name is, or extract it differently if they changed the format of the hud graphics as well.

@VelorumS
Copy link
Contributor

I remember that with HD. I think it had only one HUD, so it worked for only one civilization. But I see some screenshots with different HUDs on the Internet.

@rehmsen
Copy link
Author

rehmsen commented Sep 20, 2017

I deleted my assets so that they were regenerated when I ran the game again, but there are not errors. I will see if I can find the id of those assets somewhere.

@rehmsen
Copy link
Author

rehmsen commented Sep 20, 2017

Looks like @ChipmunkV is right:
This seems to be where the HUD images are loaded:
https://github.com/SFTtech/openage/blob/master/assets/qml/IngameHud.qml#L25

As I read that code, it tries to load a an image with the name converted/interface/hudxxxx.slp.png where xxxx is a civIndex padded with zeroes to a lenth of 4. When I look into my assets/converted/interface/ folder, I only have an image hud0000.slp.png. So my guess is the civIndex is not 0 in our case, and AOC has more HUD images (or your converter finds more at least).

@rehmsen
Copy link
Author

rehmsen commented Sep 20, 2017

Indeed, when I set the civIndex to constant 0, the HUD loads fine.
Taking a look at where the converter gets the assets from:

I found this:
https://github.com/SFTtech/openage/blob/master/openage/convert/interface/hardcoded.py#L6

INGAME_HUD_BACKGROUNDS, 18 increasing ids. I searched for those strings in my AoE 2 HD installation, and found something interesting:

There are two files with the first id, 51141, suffixed .slp in two different folders:

  1. resources/_common/drs/gamedata_x2
  2. resources/_common/drs/interface

The other numbers are only in resources/_common/drs/gamedata_x2. So my working theory is that we are trying to load those from resources/_common/drs/interface, where we only find one of the HUD backgrounds.

And indeed interfaces seem to be loaded from there:
https://github.com/SFTtech/openage/blob/master/openage/convert/main.py#L47

@heinezen
Copy link
Member

Converting from AoC will get you hud0000.slp.png to hud0017.slp.png. The default openage Player 1 hud uses hud0001.slp.png and hud0002.slp.png for Player 2. In AoC they are all located in interfac.drs. The HD version has a extracted version of interfac.drs in resources/_common/drs/interface that lack the hud files. Maybe they are at another place than we expected and the asset managers notices that after a second conversion somehow?

@rehmsen
Copy link
Author

rehmsen commented Sep 20, 2017

Yes, they are indeed in a second location, see my post just above. I am trying to mount that aswell, so far with no luck. Debugging...

@TheJJ
Copy link
Member

TheJJ commented Sep 20, 2017

It should be as easy as:

        if GameVersion.age2_hd_rajas in game_versions:
            result['gamedata'].mount(srcdir['resources/_common/drs/gamedata_x2'])
            result['interface'].mount(srcdir['resources/_common/drs/gamedata_x2'])

@rehmsen
Copy link
Author

rehmsen commented Sep 20, 2017

I thought so too, but apparently after following the troubleshooting guide, my installation is now recognized as Forgotten Empires, not as Rise of the Rajas.

So instead for now I did not put it into an if, and then it does create a bunch more files, and the "missing textures" red X goes away - however now the cutter does not seem to work properly, because the pngs only have the top HUD element, not the one left and right, and the renderer just renders nothing in place.

Is there any way to look at the original *.slp to see how they might be structured differently in gamedata_x2 than the one in interface?

@TheJJ
Copy link
Member

TheJJ commented Sep 20, 2017

We, have this: https://github.com/SFTtech/openage/blob/master/doc/convert/interactive.md
It allows extraction and png-conversion of single slp files.

@rehmsen
Copy link
Author

rehmsen commented Sep 20, 2017

Thanks, that helps a lot. Indeed, the files in interface/ are 1280x1024, whereas the ones in gamedata/ are 1024x768.

Since we hard code where we search for the patterns and cut, this will not easily work:
https://github.com/SFTtech/openage/blob/master/openage/convert/interface/hardcoded.py#L33

I am a bit surprised that the HD version apparently uses lower resolution textures - I would have expected the opposite. I guess we can again parametrize that and figure out the right coordinates to use for 1024x768... not sure if there is a better way.

@rehmsen
Copy link
Author

rehmsen commented Oct 1, 2017

I got the cutting figured out and made it more readable and parameterized, but just mounting the gamedata_x2/ as interface/ (in order to grab these interface images from there) causes all of the files in gamegata_x2/ to also be converted to interface. I guess I need to specifically filter this to only grab the interface files...

@rehmsen
Copy link
Author

rehmsen commented Oct 1, 2017

Also, I need to correct my observation about the resolutions - the HD version actually has interfaces in 3 resolutions: 800x600, 1024x768, 1280x1024

800x600:
interface/51101.slp
gamedata_x2/511{19-23}.slp

1024x768:
gamedata_x2/511{31-53}.slp

1280x1024
gamedata_x2/511{61-83}.slp
interface/51141.slp

Those are all the ones I have found so far. There may be others.

The current logic cuts out 511{41-54, 57-60}.slp, and just converts the rest as it is. Interestingly 54 and 57-60 just do not exist in my version.

@rehmsen
Copy link
Author

rehmsen commented Oct 1, 2017

Currently, we seem to only use 1280x1024 versions from AoC. The importing code also renames those HUD files to hud{0000-00xx}.slp.png afterwards, so nowhere do we support any lower resolution. That might not be ideal long term, but then again there are probably hardly users with lower resolution these days. So all my cutting coordinates for lower res might not be necessary at the moment.

Here are the changes I think we need to make:

  1. Figure out the patch-level issue: The Troubleshooting Guide suggests to set the patch level to 4.3, which according to game_versions.py is somewhere between Forgotten Empires and African Kingdoms. This is a problem, because almost all of the HUD textures in HD are in gamedata_x2, which belongs to African Kingdoms (I believe). My understanding is that we need to go to 4.3 because at some point there the format changed- might be worth digging a bit where exactly it changed and what changed.

  2. Apparently we need to load some interface textures from gamedata_x2, so either
    a) we need to fix our loading, converting and renaming to grab the HUD files from where they are, but always output them to interface/hud{0000-00xx}.slp.png or
    b) we need to change the conversion step to leave the image where they are (e.g. in gamedata_x2) and fix our rendering to look up where to get them from.
    2a) feels a bit hacky, but maybe that is what we need to do to contain the version handling code to the asset import and not have it spread all over the engine. I will install a separate version of AoC non-HD to see where the assets are for that. I am still a bit surprised that they would have changed folders and numbering...

@TheJJ
Copy link
Member

TheJJ commented Oct 1, 2017

I think it's fine if we picked the largest resolution there is, the scale-down is then done by Qt.

The only problem we have with newer versions is that they removed the old terrain data: the perspective tiles were replaced by non-perspective ones. Our renderer does not yet support rendering the way aoe2hd does, the foundation for this is prepared in #850.

I'd go with explicit numbers to pick the interface files from. The real solution is to create a "mod pack" from the installation for just the files we need. The pack is fed into the engine (see #632).

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
area: assets Involved with assets (images, sounds, ...) area: ui Related to the graphical user interface (Qt) bug Behaving differently as it should behave
Projects
Status: 📋 Backlog
Development

No branches or pull requests

4 participants