Jump to content

PST or BG small areas handling


Isaya

Recommended Posts

On the post announcing version 0.7, the bigg mentions some WeiDU script to check for ideas on patching various files for small areas in PST or BG.

I'm not familiar with WeiDU and the absence of comments doesn't help. I couldn't figure out whether these files were patterns to apply to area files or whether they were merely examples on how to write patches with WeiDU. So I decided to try and understand the issue with these areas, find a solution using whatever friendly tools are available to edit them then finally worry about how to automate the process with WeiDU.

I didn't make so much progress so far but I would like to share my views so far. I do expect corrections and suggestions.

 

My understanding it that small areas need to be expanded in order to match the chosen size of the display (possibly minus the left, right and bottom panes). This implies expanding the graphics, then the files that link doors, points of interests, transitions to other areas, ... to the graphics.

I didn't find an introduction to areas in the IESDP (maybe I should check a tutorial for IETME or DLTCEP for such details) so I'm not sure I didn't forget anything.

 

Graphics are stored in a TIS file, in tiles. To increase the size, additional tiles need to be added around the effective area graphics using a neutral color (this color can be picked from any TIS file about a building, in the borders). The simplest is to add tiles to the right and to the bottom (so that positions for anything from doors to creatures, if relative to the top left corner as I believe, can remain unchanged in other files). This is not that simple already as tiles need to be inserted at the end of every "line", so in the middle of the TIS file. Furthermore, the potential presence of door or overlay tiles (at the end, I assume) require special handing.

 

The WED file contains informations for doors, overlays, walls, ... It must be adjusted for proper tile reference due to insertion of tiles in the TIS file. If the area is not expanded only to the right and to the bottom, all X and Y positions need to be adjusted with a suitable offset. This file is the most obscure to me for now.

 

The search map is a BMP file. There is a color for "obstacle" that could be used for the expanded area. As it also tells whether there is an exit to the worldmap with a special color, maybe that particular color shall be expanded instead of the "obstacle" color in the specified direction.

 

Finally the ARE file contains positions of creatures, info points, spawn points, ... in the area. If the expansion is made only to the right and to the bottom, maybe there would be little work in that file. Otherwise all the X and Y positions shall be incremented with appropriate offsets.

 

To me it is not clear whether all areas could be simply expanded only to the right and to the bottom. I'm not sure if special cases, such as a worldmap exit may not require the area to be aligned to the side where such exit is present.

 

That's all for now. Please feel free to correct me or add information on other requirements I missed. Thanks.

Link to comment

There are no comments because

- Areas are 2 dimensional, and for some reason I can't get my head around rows and columns, so I'm not really sure if the code I write is actually correct or not until I get around to run and test it, and comments like "I don't know what this does" are useless.

- By the time you know enough WeiDU and coding to be able to understand what goes on, you have enough experience to read a 100 lines TP2 file without need for comments.

Anyway, the files that deal with area extension are widescreen/libsmall/patch_{are,wed,tis,bmp}.tpa, in particular patch_wed and patch_tis; you might also want to remove the nag screen from widescreen/libsmall/game_config.tpa. {x,y}MaxWed is the current area size in tiles, {x,y}Req is the target size; the rest of the variables is easy to figure out with IESDP.

 

What I try to do is to expand areas by adding a black border, so that I don't need to update door/actor/object coordinates.

Among other fields, a WED contains a lookup index in the TIS file, so I don't need to have the tiles in `pure' left-to-right, top-to-bottom oder, I can simply add one additional black tile and reference it multiple times from the WED.

BMP areas (Light, Height, Search) are expanded with a proportional black margin as well (and black is the 'impassable' color).

I run my tests at 1680x1050 (since that's what my monitor does). In BG1, some areas work when expanded (E.G. AR0002) and some others do not (E.G. AR0103). In PST, it appears that I even need to biff at least some graphical resources (when I drop a TIS in the override, it asks for CD 0xff).

Link to comment

Thanks for your quick answer and all the explanations about what the scripts are trying to perform.

 

What I couldn't figure out what whether or not the scripts already did the conversion job or if they were samples to start with in order to patch the needed files. Now I understand that they already implement some conversion but the resulting areas do not always work properly.

 

I could help identifying which areas do not work properly in Baldur's Gate and maybe try to understand why.

 

I can test only in 1280x1024 or possibly 1366x768 (TV).

 

I just checked the two areas you mentioned using MoveToArea. Both areas displayed properly.

AR0103 had fog of as the save game I started from was prior to chapter 5. It's clear it's expanded as there is a wide black band on the right and on the bottom. It's probably bigger than needed on my setup (maybe you increase the height regardless of the presence of the bottom pane. The map displayed properly in this area. I can move the green rectangle to change the view (this is consistent with the scroll capability in the main window) however the game does not handle very well removing the green rectangle when I move it around. Initially the black area (the expanded one beyond the screen size) does not appear until I move the green rectangle.

AR0002 crashed when I tried to open the map view from the character view. I had the assert for file InfScreenMap.cpp at line 2320. When I ran the game again and tried to get the map from the main view, it had time to change view and display the area map properly (without the green selection rectangle) then crashed immediately with the same assert.

I wonder if the small refresh problem in the map view (for AR0103) and the crash for AR0002 are due to the absence of a modified MOS file for the area map matching the increased size of the area. AR0002 is originally smaller than AR0103 but is still bigger than the 640x480 screen so I fail to figure out a simple explanation for the difference.

 

I'll go on checking: increasing the size of the MOS file for instance, to see if it changes anything. Thanks for getting me started. I hope I can help after a while.

Link to comment
I just checked the two areas you mentioned using MoveToArea. Both areas displayed properly.

Then it's either resolution dependent, or I remember the wrong area... I'm sure one of the following causes crashes:

ar1010 ar0002 ar0101...5

 

EDIT: at 1280x1024 AR0103 crashed the game, at native resolution (1680x1050) it hanged the game.

AR0103 had fog of as the save game I started from was prior to chapter 5. It's clear it's expanded as there is a wide black band on the right and on the bottom. It's probably bigger than needed on my setup (maybe you increase the height regardless of the presence of the bottom pane. The map displayed properly in this area. I can move the green rectangle to change the view (this is consistent with the scroll capability in the main window) however the game does not handle very well removing the green rectangle when I move it around. Initially the black area (the expanded one beyond the screen size) does not appear until I move the green rectangle.

Yes, I extend the area to fit the whole window... otherwise if you hide the interface it might crash. `Minor' glitches are unavoidable, sadly. Besides, why do you need to use the map if the whole area is already smaller than your screen? :p

 

AR0002 crashed when I tried to open the map view from the character view. I had the assert for file InfScreenMap.cpp at line 2320. When I ran the game again and tried to get the map from the main view, it had time to change view and display the area map properly (without the green selection rectangle) then crashed immediately with the same assert.

I wonder if the small refresh problem in the map view (for AR0103) and the crash for AR0002 are due to the absence of a modified MOS file for the area map matching the increased size of the area. AR0002 is originally smaller than AR0103 but is still bigger than the 640x480 screen so I fail to figure out a simple explanation for the difference.

 

I'll go on checking: increasing the size of the MOS file for instance, to see if it changes anything. Thanks for getting me started. I hope I can help after a while.

 

EDIT: after placing MOS editing in place, AR0105 and AR0002 do crash when opening the map. Use this as your widescreen/libsmall/patch_tis.tpa:

COPY_EXISTING ~%source_res%.tis~ ~override~
READ_LONG 0x08 cnt
READ_LONG 0x0c tiles_len
READ_LONG 0x10 off
READ_LONG 0x14 tile_siz
INSERT_BYTES off + cnt * tiles_len  tiles_len * xReq * (yReq - yMaxWed)
INSERT_BYTES off + cnt * tiles_len  tiles_len * yMaxWed * (xReq - xMaxWed)
WRITE_LONG 0x08 cnt + xReq * yReq - xMaxWed * yMaxWed

ACTION_IF FILE_EXISTS_IN_GAME ~%source_res%.mos~ BEGIN
COPY_EXISTING ~%source_res%.mos~ ~override~
	READ_ASCII 0 sig (4)
	READ_SHORT 0x8 mosX
	READ_SHORT 0xa mosY
	EXTEND_MOS BOTTOM (mosY * yReq) / yMaxWed
	EXTEND_MOS RIGHT (mosX * xReq) / xMaxWed
ACTION_IF ~%sig%~ STRING_COMPARE ~MOS ~ BEGIN
	PRINT ~%SOURCE_RES% %sig%~
	FAIL ~BAMC~
END
END

Link to comment

How can you be so fast to answer? :)

 

I used your code for the MOS file and it did wonders on my installation! AR0002 and AR0103 are now perfect! No more crash or glitches on the map view.

I suggest to use the MOS patch for the next version. At least on my setup, it improved things significantly.

 

AR0101 to AR0105 work fine here. AR1010 indeed crashed (crash to desktop with a Windows XP error, no assert).

 

A few words about my setup, just in case it can help:

Windows XP Pro SP2

Athlon XP3000

1 Gb

ATI X1950 Pro AGP

LCD screen 1280x1024

Baldur's Gate 6 CD, European version (French for files)

BGMain2.exe version 1.3.5512 (version 1.3.5521 was not recognised the first time I tried the mod, so I'm staying with 5512 until otherwise suggested)

 

I have a full set of save games from the first time I played BG. I'm using it to reach areas or now I also use MoveToArea to test the ones you mentioned. I often have a problem when loading a save game in an area that was modified by Widescreen. To name a few I checked, that happened for AR0139, AR0601, AR0702, AR0706. The crash triggers an assert, in "CVisibility.cpp" at line 1484.

Another same game I used many times up to now, in AR2301, loads properly. It happens that this area is not modified by Widescreen (or at least on my setup, maybe due to the screen size). There may be a pattern in that behaviour.

Moreover, when I MoveToArea() from AR2301 to AR0706 (starting from a save game prior to entering Baldur's Gate, so AR0706 was never visited and is not in the save game), it loads properly.

 

My assumption is that the game crashes in AR0706 because of something in the save game that does not match the modified files for the area. My guess is the block in the ARE structure that keep track of the discovered part of the area (called Explored bitmap in Near Infinity). This part is empty (size 0, offset shared with other unused blocks) in the ARE file on disk (or BIF). In the save game, it's not empty. There could be other culprits of the same kind (animation, tiled objects, spawns points, ...) but that is the only block that is modified in AR0706 structure in the save game (well, not exactly, as there are more actors, for instance, but it seems unrelated to the modifications of the area by Widescreen).

I modified the save game with Near Infinity, setting the Explored bitmap size of AR0706 to 0. That only change allowed me to load my save game properly (at the cost of a fog of war in the area :D ).

 

This is pure speculation, but I wonder if such behaviour could explain why you may have crashes that I don't get, even in areas that are modified in my setup.

After that, I checked whether I had the AR1010 area in my save game, but no such luck. So there must be another explanation for that one.

Link to comment

I reply quickly because I'm a nerd and spend too much time on the net. Today I was late - got a Wii :)

 

IIRC, save games contain a copy of the search map (for tracking the fog of war). That must be what's causing bugs.

 

Besides, AR1010 seems to be broken even in the 'standard' game (no WED file, I overwrite it with a known-to-work, very large one). Can you CLUA there without WSM installed? I can't, for example.

 

Unfortunately, I get crashes on both AR0103 and AR0105, so there must be something strange behind that. To compare, do you also get broken transparencies (E.G. the border of the Fog of War and the black boxes in the buttons in this screenshot)?

 

XP SP2

E6750 (2.66 Ghz, 1333 FSB, 4Mb Cache)

2Gb no-brand DDR2 RAM

8800 GTS (640 Mb)

1680x1050 and 1280x1024 both tested

'international' 5512

 

...Er, now that you mention it, that was off the Mission Pack Save that ships with TotSC. Perhaps in a 'new' game the areas will work correctly - edit-reporting quickly :D

 

EDIT: indeed, from a fresh new game it doesn't have troubles.

Link to comment

I am spending too much time on the net too...

 

I had forgotten to check AR1010 in the unmodded game. It crashes also. Near Infinity pretends to have a WED for it but reports an error when you try to open it. Other parts of the ARE are also broken. IESDP refers to this area as un unused one in the ice island (in TotSC). It's the one that BG Unfinished Business is restoring (the mod adds the WED and the BMP files for it).

 

Assuming the way is clear, I started checking all areas starting from AR0002. I am using the list from IESDP as a reference for all areas to check (except AR1010 of course). So far I'm only at AR0600. But I had no problem so far. The only unusual thing is the fact that AR0148 does not have any map view, but nothing to do with Widescreen.

I can confirm that the death screen works well as a level 1 character out of Candlekeep do not fare well when jumping into baddies through teleportation. :) The area movies are working well too.

 

I'll keep you informed when I'm done. If everything is ok, I suppose you'll be able to add TotSC to the supported games.

 

I installed the mod on Torment (I had to remove a copy about an unexisting area, AR0123, in libsmall/patch_are.tpa to complete the installation. Maybe this is intentional until a solution is found?).

As I have no experience of the game I don't even know out to get the console. And I don't want to spoil the game by visiting the areas first. I hope you find someone else to help as progress on my side will be very slow.

 

Cheers

 

Edit: I forgot to answer about the fog of war. It's properly displayed on my game.

However I have an issue with the part of the view in the fog of war (not the black part, the one already visited but "shawed"): it's flickering. The same flickering occurs on the mage spell book (my character cannot use mage spells) although the left and right panes are not flickering. On the cleric spell page (my character is cleric), I get this behaviour when the game asks whether I want to remove a spell after clicking on it: this time all the screen, except the small window asking it, is flickering. The same thing happens anytime the game displays a small confirmation window actually. I guess it's a refresh problem with the video driver or the screen. This problem does not happen with the original game. I tried adjusting the refresh rate in the Baldur.ini (as described in Baldur's Gate II "Power Users.txt") but this has no effect in Baldur's Gate, it seems. I'll check other IE games. As I changed the graphic card very recently the problem could be due to this change. New cards and drivers are sometimes a pain for older software.

Link to comment
Assuming the way is clear, I started checking all areas starting from AR0002. I am using the list from IESDP as a reference for all areas to check (except AR1010 of course). So far I'm only at AR0600. But I had no problem so far. The only unusual thing is the fact that AR0148 does not have any map view, but nothing to do with Widescreen.

I can confirm that the death screen works well as a level 1 character out of Candlekeep do not fare well when jumping into baddies through teleportation. :) The area movies are working well too.

 

I'll keep you informed when I'm done. If everything is ok, I suppose you'll be able to add TotSC to the supported games.

I wouldn't worry too much about testing all existing areas. The only problem I can think of is that the "leave area and get to the worldmap" function is broken on the bottom and left sections, because the cyan zone must be on the border, it can't be in the middle of the search area.

The only solution I can think of is to put the cyan zone to the border and leaving there a black, walkable 'corridor' that leads you to the cyan tiles (difficulty 3 to me). It sucks as a solution, so if someone can brainstorm something smarter I'd be happy.

 

I installed the mod on Torment (I had to remove a copy about an unexisting area, AR0123, in libsmall/patch_are.tpa to complete the installation. Maybe this is intentional until a solution is found?).

I'm aware that it needs to be removed. Sadly, the optimal way to do that passes through the coming-up-soon WeiDU 203 (otherwise WSM 0.8 would be on the server already).

 

As I have no experience of the game I don't even know out to get the console. And I don't want to spoil the game by visiting the areas first. I hope you find someone else to help as progress on my side will be very slow.

AFAIK, there's no CLUAConsole(or equivalent) in PST. Unfortunately, what little tests I can do without the cheats seem to point out that (in the best case) I need to biff the tis/bmp/wed resources.

Link to comment

While you were answering me, I added a final note on my post about your fog of war question, in case you want to read it. You're too fast for me. :)

 

I wouldn't worry too much about testing all existing areas. The only problem I can think of is that the "leave area and get to the worldmap" function is broken on the bottom and left sections, because the cyan zone must be on the border, it can't be in the middle of the search area.

The only solution I can think of is to put the cyan zone to the border and leaving there a black, walkable 'corridor' that leads you to the cyan tiles (difficulty 3 to me). It sucks as a solution, so if someone can brainstorm something smarter I'd be happy.

I think that all areas leading to the world map are quite big in Baldur's Gate. Even Ulgoth's beard must be big enough for people with 30" screens. The main issue would then be the encounter areas which are usually small. Quite often in these areas, there is a limited number of exits so with a bit of luck they may not be on the bad sides. Otherwise as long as there is an exit up or left, that wouldn't be a problem. I will check these areas and see if I can find an idea.

I understand you're preparing a new WeiDU release in order to implement game specific patches. Would it open the door to game specific files to workaround such problems? That could be a last resort solution.

 

AFAIK, there's no CLUAConsole(or equivalent) in PST. Unfortunately, what little tests I can do without the cheats seem to point out that (in the best case) I need to biff the tis/bmp/wed resources.

I didn't know. That won't help testing indeed. Especially if the game behaves likes Baldur's Gate when you use a save game with an already visited area whose size has been changed.

Link to comment
While you were answering me, I added a final note on my post about your fog of war question, in case you want to read it. You're too fast for me. :D

Read it now. I guess I can blame it on the technology progress :)

 

I think that all areas leading to the world map are quite big in Baldur's Gate. Even Ulgoth's beard must be big enough for people with 30" screens. The main issue would then be the encounter areas which are usually small. Quite often in these areas, there is a limited number of exits so with a bit of luck they may not be on the bad sides. Otherwise as long as there is an exit up or left, that wouldn't be a problem. I will check these areas and see if I can find an idea.

Yes, I was mostly worried about 'ambush' areas. I recall one that has exits on NE but not on SW, which is just plain lucky. Besides, I fear that patching for 30'' screens would fail at the "extend TIS files" anyway - WeiDU has an hardcoded limit and cannot deal normally with files that are larger than 16 and some megabytes, and (maybe due to suboptimal patching) TIS files at the 1920*1200 mark are already too big (not to mention 2560*1600). This could be adjustable, if somebody bribes me with a 24+'' monitor and a SLI machine to feed that :D

 

I understand you're preparing a new WeiDU release in order to implement game specific patches. Would it open the door to game specific files to workaround such problems? That could be a last resort solution.

Game specific code is included thanks to GAME_IS and INCLUDE abuse. What I did was simply to make ALLOW_MISSING ~ar1010.wed~ work - in 202, it still crashes the executable because said file is in the chitin.key, but the biff that should contain it doesn't have enough room for it.

 

I didn't know. That won't help testing indeed. Especially if the game behaves likes Baldur's Gate when you use a save game with an already visited area whose size has been changed.

Yes, it sucks. However, fast playing got me a save just fresh off the Mortuary next to a 'too small' area, and then I can use the scientific "try just one area" testing method :D

Link to comment
Edit: I forgot to answer about the fog of war. It's properly displayed on my game.

However I have an issue with the part of the view in the fog of war (not the black part, the one already visited but "shawed"): it's flickering...

The Icewind Dale HoW and TotLM with the latest patch(at least I think my game has that) has the same kinds of problem, although it's playable.

 

Hooray! I'm uploading 0.8 with beta WeiDU...
Hooray! It's up.
Link to comment

Congratulations for the new release, especially for the PST solution I was really looking forward to. :D

 

Regarding Baldur's Gate, I checked the random encounters areas using Near Infinity. It seems all of them have a size of 1280x960 (20x15 tiles) so this could a problem for many expanded resolutions such as yours. However all the areas have at least one exit to the north or to the west (many have four exits) so everyone shall be able to leave the area using a normal way out.

 

Now you can go back finishing WeiDU 203 and playing the Wii. :)

 

Cheers

Link to comment

Archived

This topic is now archived and is closed to further replies.

×
×
  • Create New...