Jump to content

Mod Added Area Compatability for BG2 and BG2EE in 2019?


cmorgan

Recommended Posts

4 hours ago, subtledoctor said:

Worth noting, just since this thread seems to be generally about the subject, that different versions of the EE games use different kinds of .pvrz files.  To use mods with new area and similar graphics (UI, stuff like that) on iOS or Android, currently players either 1) find and convert the .pvrz files in a mod, and then install the mod; or 2) install all mods, then convert all pvrz files in their override folder.

I wrote an unofficial WeiDU wrapper for an external conversion tool some time ago to make dealing with iOS/Android texture format exceptions easier. You can find it attached to this post.

(Note: Because of patent issues the tool may not work correctly on macOS or Linux. I don't know if this issue has already been solved in more recent versions of the tool. Afaik, patent protection for the responsible texture formats should have expired some time ago.)

 

2 hours ago, jastey said:

Wasn't the mos-file for the EE supposed to be bigger than for the original? Did that change with one of the patches or is it no longer needed?

MOS files for maps are no longer needed since EE patch 2.0. For earlier EE patch versions MOS image dimensions were slightly bigger than for the original games (about 166.67% of original size to be precise).

Link to comment

Generally any large area is a master area, and all of the homes/caves/etc. inside of it are not.

Say you're in the Docks in BG2, ar0300, which is a master area. Wherever you visit in the Docks--Sea's Bounty, Thieves Guild, Harper HQ, etc.--the Docks area script is always running, and will keep running until you visit a new master area. There are some other factors--IIRC master areas also force auto-saves when leaving and determine current weather--but the area script is the big one for modders. You may also need it to be a master area to work on the Worldmap, but on that I'm not so sure.

 

Link to comment

Hi, thanks for the good guide how to convert old TIS files for vanila to PVRZ-based TIS  files. I still have some questions, though.

I am currently adapting a BG2 mod to work with EE, I have converted old style TIS files to PVRZ-based TIS files using NI, cause tile2ee tool didn't work for me (under linux), but there are still black lines on some maps occasionally.

1. What currently is the best way to convert old style TIS files to PVRZ-based TIS not to have black lines? Does somebody have tile2ee binary file, so I can try it?

2. The mod I am working on is huge mainly because I have to keep both old style TIS and PVRZ-based TIS files. For instance without old style TIS files the size of the mod dropped two times. Is there a way to convert TIS files or TIS+PVZR files to each others' format "on the fly" during the weidu mod installation, so I can keep only one version of TIS files?

Thanks in advance.

Link to comment
50 minutes ago, paladin84 said:

Hi, thanks for the good guide how to convert old TIS files for vanila to PVRZ-based TIS  files. I still have some questions, though.

I am currently adapting a BG2 mod to work with EE, I have converted old style TIS files to PVRZ-based TIS files using NI, cause tile2ee tool didn't work for me (under linux), but there are still black lines on some maps occasionally.

1. What currently is the best way to convert old style TIS files to PVRZ-based TIS not to have black lines? Does somebody have tile2ee binary file, so I can try it?

2. The mod I am working on is huge mainly because I have to keep both old style TIS and PVRZ-based TIS files. For instance without old style TIS files the size of the mod dropped two times. Is there a way to convert TIS files or TIS+PVZR files to each others' format "on the fly" during the weidu mod installation, so I can keep only one version of TIS files?

Thanks in advance.

1. I did TIS to PNG , then PNG to TIS+PVRZ coversion in NI.

2. I think tile2ee has this functionality but I think this is the question for @argent77

Link to comment
1 hour ago, Arkie said:

1. I did TIS to PNG , then PNG to TIS+PVRZ coversion in NI.

2. I think tile2ee has this functionality...

1. Using NI for palette-based TIS -> PVRZ-based TIS conversion is currently the best approach. Both conversion via Mass Exporter or selecting individual TIS files and choosing the option "Export... -> as PVRZ-based TIS" work equally well. The conversion through an intermediate format, such as PNG, doesn't work as well since it loses WED tile layout information in the process (which is responsible for the black lines after conversion).

2. The best way of using tile2ee is to include PVRZ-based tilesets in the mod and use the tool to convert them back to palette-based tilesets on-the-fly for the original games. This script from my Djinni Companion mod uses this approach, for example.

Link to comment
12 hours ago, argent77 said:

1. Using NI for palette-based TIS -> PVRZ-based TIS conversion is currently the best approach. Both conversion via Mass Exporter or selecting individual TIS files and choosing the option "Export... -> as PVRZ-based TIS" work equally well. The conversion through an intermediate format, such as PNG, doesn't work as well since it loses WED tile layout information in the process (which is responsible for the black lines after conversion).

I tried both approaches with NI (to and from png and directly TIS files from the installed mod on classic BG2 to TIZ + PVRZ) but I still have glitches. To be clear, they are not everywhere (as if install classic version TIS files on BGEE). For instance, there are couple of glitches like on the attached image for the huge map (5120x3392).

12 hours ago, argent77 said:

2. The best way of using tile2ee is to include PVRZ-based tilesets in the mod and use the tool to convert them back to palette-based tilesets on-the-fly for the original games. This script from my Djinni Companion mod uses this approach, for example.

Thank you, I see you have the binaries for tile2ee for all the operations systems. I will try to use this approach for my mod once I solve the problem with glitches.

Screenshot_20230926_173605.png

Edited by paladin84
Link to comment
On 9/27/2023 at 4:57 AM, paladin84 said:

I tried both approaches with NI (to and from png and directly TIS files from the installed mod on classic BG2 to TIZ + PVRZ) but I still have glitches. To be clear, they are not everywhere (as if install classic version TIS files on BGEE). For instance, there are couple of glitches like on the attached image for the huge map (5120x3392).

Even with the optimized texture layout imposed by the NI conversion there may still be some glitches around the dynamic parts of tilesets. That's probably the best result possible with the currently available tools.

Link to comment
2 hours ago, argent77 said:

Even with the optimized texture layout imposed by the NI conversion there may still be some glitches around the dynamic parts of tilesets. That's probably the best result possible with the currently available tools.

Thank you for the answer. Yes, as far as I can tell there are glitched only at the dynamic parts of tilesets. Hopefully NI can convert this properly one day.

Link to comment

I think I found a good solution to get rid of such glitched at dynamic parts of tilesets. The idea is coming from this message by @Weigo : https://www.gibberlings3.net/forums/topic/37063-water-layer-corruption-in-pvrztis-file/#comment-326283
I needed to fix 100+ areas with dynamic parts and water overlays, but I wasn't ready to work (to define individual tile positions) in PVRZ directly. The idea is: if EE engine sometimes takes extra pixel lines from the adjacent tiles for secondary tiles (the ones that are responsible for water overlays or second state of the door), they should be reorganized to have transparent or "proper" pixel lines next to them. It will make secondary tiles to be located more "sparse" (it is probably not a big issue, cause PVRZ is a compressed file and adding "empty" tiles here and there would not change the size of the all the PVRZ files for the area), but will solve the issue.


For this, I wrote a simple python script that parse WED file, split secondary tiles by groups, place them as compact as possible (or just use a "chess-like pattern) with "empty" tiles around groups and change secondary tile references in the WED file. The script works for fireplaces, doors and water overlays - so it should be able to fix all the glitches.

Disclaimer: ithe script was written for myself, it is not very beautiful and I cannot guarantee that it will work for all the cases. However, if you find that it doesn't work, let me know and I will fix it.

The script itself: https://github.com/abalabokhin/translate_tra/blob/main/convert_wed_png_for_ee.py
Example of area image "before": https://github.com/abalabokhin/translate_tra/blob/main/map_res/NW1000_in.PNG
Example of area image "after": https://github.com/abalabokhin/translate_tra/blob/main/out_map_res/NW1000_grouping.PNG
Another variant "after": https://github.com/abalabokhin/translate_tra/blob/main/out_map_res/NW1000_chess.PNG

Updated: removed mentioning  that script doesn't work with "fireplaces", now script works with series of tiles (how fireplaces are implemented).

Edited by paladin84
Link to comment

Great work with the script. 😀👍


Fireplaces are added with tiles. In overlay_0 several tiles are added to the tilemap_count at the location of the tilemap.
eg: BG0169 tilemap 30 has 6 tilemap_counts. This means that the engine looks up the next 6 tilemap numbers in the tilemap_index. (77-82) These tilemap numbers are the positions in the tis file.

Link to comment
5 hours ago, Weigo said:

Fireplaces are added with tiles. In overlay_0 several tiles are added to the tilemap_count at the location of the tilemap.
eg: BG0169 tilemap 30 has 6 tilemap_counts. This means that the engine looks up the next 6 tilemap numbers in the tilemap_index. (77-82) These tilemap numbers are the positions in the tis file.

Thanks, I finally figured how to work with "fireplaces". In the current version of the script, everything should work (I updated the original post to reflect this).

Link to comment

Hm, I wonder if this method fix horizontal lines in example - new locations for pstee?

Chyux5Y.jpg

 

Right now, the way to get rid of these: is to disable linear scaling (in game options), which makes the graphics quality slightly worse.

Link to comment
19 minutes ago, szef said:

Hm, I wonder if this method fix horizontal lines in example - new locations for pstee?

No, it looks like something different. I was assuming that the main image is shown ok, but dynamic parts (doors, water, fireplaces) are not. Here the main image is shown with glitches.

Link to comment

Join the conversation

You are posting as a guest. If you have an account, sign in now to post with your account.
Note: Your post will require moderator approval before it will be visible.

Guest
Reply to this topic...

×   Pasted as rich text.   Paste as plain text instead

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • Create New...