Jump to content


Photo

NearInfinity


  • Please log in to reply
1168 replies to this topic

#841 Roxanne

Roxanne

    Modder

  • Member
  • 3564 posts

Posted 07 October 2017 - 08:38 AM

It looks like OH9360.ARE doesn't contain a rest encounter structure (rest encounter offset is 0). fj_are_structure seems to set the rest offset to a non-zero value without adding a rest encounter structure. As a result NI attempts to read non-existing data which triggers an error.

I can probably avoid this error by adding more checks, but that's only a hack. Ideally fj_are_structure should be fixed to ensure that offsets pointing to non-existing single structure elements (such as songs or rest encounters) are set to zero.
 

Maybe not worth it. I assume it is something unique to those Black Pit areas. It sems to have no real impact on the gameplay as such. The only issue I found was in NI when I tried to quickly look up something during mod creation. Unless you think it is a more widespread problem. I have used the same fl_are technique to add exit or entry to numerous original areas and there is never any problem.


The Sandrah Saga

another piece of *buggy, cheesy, unbalanced junk*

 


#842 Argent77

Argent77
  • Administrator
  • 1434 posts

Posted 07 October 2017 - 08:49 AM

I found several areas without resting encounter structures outside of Black Pits in BG1EE, and in classic BG1 as well (e.g. AR0608). But all of them had their offsets set to 0. Classic BG1 seems to crash if you set the offset to non-zero. BG1EE handles these structures gracefully.



#843 Miloch

Miloch

    Barbarian

  • Modder
  • 6579 posts

Posted 13 October 2017 - 06:07 PM

Ideally fj_are_structure should be fixed to ensure that offsets pointing to non-existing single structure elements (such as songs or rest encounters) are set to zero.

I am surprised it does not. It has a lot of similar checks anyway.


Infinity Engine Contributions
Aurora * BG1 NPC * BG1 Fixpack * Haiass * Infinity Animations * Level 1 NPCs * P5Tweaks
PnP Free Action * Thrown Hammers * Unique Containers * BG:EE * BGII:EE * IWD:EE
================================================================
Player & Modder Resources
BAM Batcher * Creature Lister * Creature Checker * Creature Fixer * Tutu/BGT Area Map & List * Tutu Mod List
================================================================
"Infinity turns out to be the opposite of what people say it is. It is not 'that which has nothing beyond itself' that is infinite, but 'that which always has something beyond itself'." -Aristotle


#844 Mike1072

Mike1072
  • Modder
  • 539 posts

Posted 25 October 2017 - 11:38 PM

I'm looking for a way to generate an animated image (such as a GIF) from a BAM cycle. I looked around and didn't see anything that does this already.

The closest I've come so far has been the 'Export all frames as graphics' option in Near Infinity, which outputs all of the frames in a PNG format with transparency. However, the information about the center of the frames is lost, which makes makes it hard to reassemble the animation seen in the game. (I tried creating a GIMP script to offset the images but couldn't get it working.)

I was wondering if something could be done in the export to make this easier.  An option to output cycles directly to animated GIF would be handy, but just outputting the frames on a larger canvas, centered, would be enough.

I have a little diagram and some pseudocode for centering the frames.

eG2dzJq.png
 
Given a list of frames with a known width, height, and center coordinates, we need to determine the dimensions for a canvas that could fit all frames within its borders when they are centered. Then, we need to create a canvas of that size for each frame and center the frame upon the canvas.
 
leftAmount = 0
rightAmount = 0
topAmount = 0
bottomAmount = 0

for each frame in frames
  leftAmount = max(leftAmount, frame.centerX)
  rightAmount = max(rightAmount, frame.width - frame.centerX)
  topAmount = max(topAmount, frame.centerY)
  bottomAmount = max(bottomAmount, frame.height - frame.centerY)
end

canvasWidth = leftAmount + rightAmount
canvasHeight = topAmount + bottomAmount

for each frame in frames
  canvas = createCanvas(canvasWidth, canvasHeight)
  positionX = leftAmount - frame.centerX
  positionY = topAmount - frame.centerY
  canvas.place(frame, positionX, positionY)
  canvas.save()
end

Edited by Mike1072, 26 October 2017 - 03:08 AM.


#845 Argent77

Argent77
  • Administrator
  • 1434 posts

Posted 26 October 2017 - 03:04 AM

Something similar is already implemented for the preview of BAM animations (in both viewer and converter).

Java doesn't provide an animated GIF exporter by its own, so I don't how complicated it would be to implement such a functionality. However, I could add another output filter to the BAM Converter that expands the canvas of each frame relative to the center point. The resulting BAM could be exported with the "Export all frames as graphics" option to produce images that are suitable for creating GIF animations.



#846 Mike1072

Mike1072
  • Modder
  • 539 posts

Posted 26 October 2017 - 03:09 AM

That would be perfect for my needs.

#847 Sam.

Sam.
  • Administrator
  • 1337 posts

Posted 26 October 2017 - 07:05 AM

The closest I've come so far has been the 'Export all frames as graphics' option in Near Infinity, which outputs all of the frames in a PNG format with transparency. However, the information about the center of the frames is lost, which makes makes it hard to reassemble the animation seen in the game. (I tried creating a GIMP script to offset the images but couldn't get it working.)

I was wondering if something could be done in the export to make this easier.  [...], but just outputting the frames on a larger canvas, centered, would be enough.

Given a list of frames with a known width, height, and center coordinates, we need to determine the dimensions for a canvas that could fit all frames within its borders when they are centered. Then, we need to create a canvas of that size for each frame and center the frame upon the canvas.

In case you're interested in an alternate solution, bamresize can batch process this for BAMs in-mass.  Syntax is something like:

python.exe bamresize.py -p 100 -q 100 -u 1 -t 0 -e png *.bam

It doesn't set the background (Green) color to transparent, but that is easy enough to do when converting the resulting padded frames to animated GIF with an external tool (such as ImageMagick).  This step can also be easily automated.  Note that BAM Workshop and BAM Workshop II can export sequences in a variety of formats including animated GIF also.


Edited by Sam., 26 October 2017 - 07:06 AM.

"Ok, I've just about had my FILL of riddle asking, quest assigning, insult throwing, pun hurling, hostage taking, iron mongering, smart-arsed fools, freaks, and felons that continually test my will, mettle, strength, intelligence, and most of all, patience! If you've got a straight answer ANYWHERE in that bent little head of yours, I want to hear it pretty damn quick or I'm going to take a large blunt object roughly the size of Elminster AND his hat, and stuff it lengthwise into a crevice of your being so seldom seen that even the denizens of the nine hells themselves wouldn't touch it with a twenty-foot rusty halberd! Have I MADE myself perfectly CLEAR?!"

--<CHARNAME> to Portalbendarwinden

--------------------

post-10485-0-15080600-1348188745.jpg
___________Old pen and paper modules of the 70s and 80s.___________

CA Forums CA Homepage


#848 Mike1072

Mike1072
  • Modder
  • 539 posts

Posted 26 October 2017 - 03:49 PM

Thanks, Sam.

#849 Argent77

Argent77
  • Administrator
  • 1434 posts

Posted 27 October 2017 - 05:13 AM

Update: NearInfinity v2.1-20171027

Changes:

  • Lots of changes in BAM Converter:
    • Sets a default output name automatically.
    • Adds a list of recently used BAM sessions for quick access.
    • Improved feedback when an export operation failed.
    • Added filter category to filter names.
    • Added new transform filter "Center BAM frames" which expands the dimension of all frames to a fixed size.
    • Added new output filter "GIF output" which exports BAM cycles into animated GIFs.
    • Added new output filter "Image output" which exports all BAM frames into separate images (PNG or BMP).
  • Updated some CRE fields and flag labels.
  • Added SPL primary type (school) 'Wild Mage'.
  • Updated 'Special' field for opcodes 25, 39, 98 and 213.
  • ARE > Song > Reverb uses entries from REVERB.2DA if available.
  • Turned list of script states for opcode 282 (Modify script state) into a static list.
  • Improved color value selection controls used by opcode 7 (Set color) or 342 (Override creature data).
  • Resource types VEF and VVC should not be available for PRO > Area effect > Spread/Ring animation fields.
  • Removed BMP type from ITM description image field (not used anymore by recent game patch versions).
  • Improved ARE resource reader to prevent errors if Song or Rest Encounter structures are missing.
  • Wild Mage kit id won't be displayed as negative value in resource fields anymore.
  • Fixed incorrect order when copying and pasting multiple removable structures at once.
  • Fixed opcode 140 projectile references being off by 1.
  • Fixed auto-comments for several script actions and triggers.
  • Many more internal fixes and improvements.


#850 Argent77

Argent77
  • Administrator
  • 1434 posts

Posted 27 October 2017 - 12:01 PM

Update: NearInfinity v2.1-20171027-rev2

This release fixes a nasty bug from the previous release that resulted in empty IDS lists for resource fields which reference IDS entries. It also fixes a minor import issue with the BAM Converter filter 'Center BAM frames'.



#851 Mike1072

Mike1072
  • Modder
  • 539 posts

Posted 27 October 2017 - 04:14 PM

Awesome, this works great.

Quick tutorial:

  • Open BAM file
  • Click Edit BAM
  • Click on the Post-processing tab
  • Under filters, select Transform: Center BAM Frames and click Add
  • Under filters, select Output: GIF output (BAM v1 only) and click Add
  • Click on Save output file... and enter any filename (the output will be a number of .gif files regardless of the extension listed in the filename)

If you want to, you can add additional filters, like changing colours, enlarging the image, or mirroring it. Make sure to add them after the Transform: Center BAM Frames filter.


Edited by Mike1072, 27 October 2017 - 04:17 PM.


#852 Creepin

Creepin
  • Administrator
  • 1676 posts

Posted 28 October 2017 - 01:36 AM

Thank a lot Mike1072, handy tutorial :) Is there equally simple way to get one single BMP for item description where all 4 parts will be already centered correctly to form whole picture?

The Old Gold - v0.2 WIP (mod for BGT/BWP/BWS)


#853 Argent77

Argent77
  • Administrator
  • 1434 posts

Posted 28 October 2017 - 01:40 AM

Thank a lot Mike1072, handy tutorial :) Is there equally simple way to get one single BMP for item description where all 4 parts will be already centered correctly to form whole picture?

The output filter "Single frame BAM output" does exactly that, merging all frames into a single frame.



#854 Creepin

Creepin
  • Administrator
  • 1676 posts

Posted 28 October 2017 - 01:50 AM

This generates BAM as a result, which I then had to open in NI again and export as single frame bmp/png. True that this is already simpler than manually adjusting 4 parts in Photoshop, thank you for that improvement, but ideally I hope for a single step export resulting in bmp/png with a whole picture, is that possible?

Edited by Creepin, 28 October 2017 - 01:52 AM.

The Old Gold - v0.2 WIP (mod for BGT/BWP/BWS)


#855 Argent77

Argent77
  • Administrator
  • 1434 posts

Posted 28 October 2017 - 02:04 AM

No, that's not possible. Output filters don't stack since they process the source BAM directly (after applying all selected color and transform filters).



#856 Miksip

Miksip
  • Member
  • 50 posts

Donator

Posted 28 October 2017 - 10:28 PM

I got error compressing saves - they are broken after that. what information do you need to look for problem?


P.S. Don't listen to The Imp - it is voice of the Devil.


#857 Argent77

Argent77
  • Administrator
  • 1434 posts

Posted 29 October 2017 - 01:52 AM

I got error compressing saves - they are broken after that. what information do you need to look for problem?

Can you reproduce the error? The debug console may show some useful information related to the issue (open via menu Tools > Show Debug Console). If that's not the case, then a step-by-step instruction how to reproduce the error would be helpful. Maybe attach the save in question if it's only triggered by a specific save.



#858 Miksip

Miksip
  • Member
  • 50 posts

Donator

Posted 29 October 2017 - 10:39 AM

It happens with every save i have.

Here is debug info:

Spoiler

 

And here are 2 save files:Attached File  saves.7z   206.99K   185 downloads - 1 broken and 1 normal.

 


P.S. Don't listen to The Imp - it is voice of the Devil.


#859 Argent77

Argent77
  • Administrator
  • 1434 posts

Posted 29 October 2017 - 11:22 AM

Thanks for the saves. I could track the error to an empty file (DEFAULT.TOT) within the save. NI appears to have problems compressing empty files. It'll be fixed in the next release.

 

For now you can avoid this bug by storing a custom message in DEFAULT.TOT (e.g. by adding a map marker to an area or a user note to the journal) and save the game. Otherwise you have to remove DEFAULT.TOT (and possibly DEFAULT.TOH as well) from BALDUR.SAV in NI before compressing the file.


Edited by Argent77, 29 October 2017 - 11:23 AM.


#860 Miksip

Miksip
  • Member
  • 50 posts

Donator

Posted 29 October 2017 - 07:53 PM

@Argent77

Thank you!


P.S. Don't listen to The Imp - it is voice of the Devil.