H4ResourceEditor

The old Heroes games developed by New World Computing. Please specify which game you are referring to in your post.

Moderator: Moderators

User avatar
iLiVeInAbOx05
Equilibris Team
Equilibris Team
Posts: 645
Joined: 21 Jul 2014

Re: H4ResourceEditor

Postby iLiVeInAbOx05 » Nov 18 2020, 3:40

Another update has been uploaded. What's new?

- I've added a mass import feature for .ora files. This is to significantly speed up importing sprites if you have a lot of h4d objects that you are replacing the sprites for.

You will be prompted to select three directories: 1) A directory where your .ora files are located, 2) a directory where your .h4d files are located, and 3) a directory to store the output (each file chooser will have a title to tell you which directory you are choosing if you forget).

The directory for .ora and .h4d files can be the same directory, but the output directory must be different.

Naming: If you have "actor_sequence.archangel.combat.melee.e.h4d", you will need "actor_sequence.archangel.combat.melee.e.ora" with the only difference being the extension.

All of the ora files will be imported into their respective h4d files and then saved to the specified output directory.

- I've finally added support for importing and exporting png files.

How it works: For exporting, each of the frames is drawn onto an image which is the size of the overall canvas, not just the size of the frame itself.

When importing, the H4 Resource Editor will expect each of the pngs being imported to be the size of the overall canvas with the frames drawn in the correct location.

.png files are more difficult to handle since they don't contain the offset info for each of the individual frames, so there will unfortunately need to be more restrictions on importing / exporting.

You will also need to make sure the png files are properly named (frame 001, frame 002, etc. for actor sequences and adventure objects).

User avatar
Pol
Admin
Admin
Posts: 9594
Joined: 29 Nov 2005
Location: IN SOMNIS VERITAS
Contact:

Re: H4ResourceEditor

Postby Pol » Nov 18 2020, 21:23

@iLiVeInAbOx05
Thanks, you need to remind me. I have just one head. And pretty busy sometimes. Added. ;)
"We made it!"
The Archives | Collection of H3&WoG files | Older albeit still useful | CH Downloads
PC Specs: A10-7850K, FM2A88X+K, 16GB-1600, SSD-MLC-G3, 1TB-HDD-G3, MAYA44, SP10 500W Be Quiet

User avatar
iLiVeInAbOx05
Equilibris Team
Equilibris Team
Posts: 645
Joined: 21 Jul 2014

Re: H4ResourceEditor

Postby iLiVeInAbOx05 » Nov 18 2020, 22:20

Pol wrote:@iLiVeInAbOx05
Thanks, you need to remind me. I have just one head. And pretty busy sometimes. Added. ;)
Thanks Pol!

Might I request a sticky here as well? ;)

Also just added another small update:

- Can now preview battlefield_preset_maps.

- Can now preview (many) combat_objects.

User avatar
Pol
Admin
Admin
Posts: 9594
Joined: 29 Nov 2005
Location: IN SOMNIS VERITAS
Contact:

Re: H4ResourceEditor

Postby Pol » Nov 19 2020, 7:30

Stickied ;)
"We made it!"
The Archives | Collection of H3&WoG files | Older albeit still useful | CH Downloads
PC Specs: A10-7850K, FM2A88X+K, 16GB-1600, SSD-MLC-G3, 1TB-HDD-G3, MAYA44, SP10 500W Be Quiet

User avatar
iLiVeInAbOx05
Equilibris Team
Equilibris Team
Posts: 645
Joined: 21 Jul 2014

Re: H4ResourceEditor

Postby iLiVeInAbOx05 » Nov 19 2020, 16:43

Pol wrote:Stickied ;)
Thanks Pol!

Added the viewing panels for battlefield_preset_maps and combat_objects, so those can be opened up to look at their other info now (though I may have forgotten to upload to google drive).

User avatar
iLiVeInAbOx05
Equilibris Team
Equilibris Team
Posts: 645
Joined: 21 Jul 2014

Re: H4ResourceEditor

Postby iLiVeInAbOx05 » Nov 23 2020, 4:28

More updates:

- battlefield_preset_maps are now viewable and editable (I haven't tested importing, but it should work).

- combat_objects are now viewable and editable (same as above, I haven't actually tested swapping out images). There are some combat objects that I can't open at the moment, so there is more work to be done there.

- Added threading for some of the bigger tasks like the mass import feature and importing a folder of png's.

- Finally discovered what the end of file offsets for adventure objects represents. Basically, these offsets correspond to the 3-dimensional height of the object. A larger negative number means a larger 3-dimensional height. A value of 0 means it is flat on the ground.

Each offset applies from left to right across the object, and helps the game determine which object should display on top when objects overlap.

- Got major / minor / sub type codes mapped to their names for the adventure objects in heroes.h4r. This and figuring out the offsets are two big steps toward creating objects from scratch.

I think after I make the footprint size editable, we will be extremely close to creating objects from scratch.

- Castle objects are now viewable. These contain the various offsets for various parts of the castles.

User avatar
iLiVeInAbOx05
Equilibris Team
Equilibris Team
Posts: 645
Joined: 21 Jul 2014

Re: H4ResourceEditor

Postby iLiVeInAbOx05 » Dec 5 2020, 4:15

The H4 Resource Editor has been updated again (link in the original post).

What's new?

- New Mod Manager feature. This particular feature is still pretty new and doesn't have a lot of functionality, but it's intended to help package various mod files (h4r). For example, Karmakeld's object package has been included and the mod manager can pack it into new.h4r, which you can then place into the data folder.

If you have your own h4r file, you can package yours and Karmakeld's object file into a single h4r file to place into the data folder (you would need to put your h4r file in the mod directory of your H4ResourceEditor installation).

The plan is to eventually be able to pack up any number of h4r files with different types of objects, create new.h4r, and install it into the data folder for you.

Also, there will be restrictions on what you should and should not put into an h4r file that you place into the mod folder, since packaging up multiple h4r files can have conflicts if the same file is in both places. Currently I have only very basic outlines for this, but as I get further with this feature I will be able to provide a better outline for the format.

Basically any h4r to be placed in the mod folder should be for associated types of files, such as files needed to replace a creature, or files needed to replace a town screen and the buildings for example.

- Town screen viewing and editing has been implemented.

How it works: Open up heroes4.h4r and expand layers, town, faction. For whichever faction you expanded, double click the "layout" layer file. It might take a few seconds, but the town screen with all of the buildings will pop up. Make the window full screen to get a better view.

You can switch between the different backgrounds, and you can edit the location of the buildings by selecting the building or shadow and then updating the number spinners. You will see the building move on screen.

You can extract backgrounds here (a couple options for this), or extract the buildings layer (using File->save).

You can import your own background town screen. I haven't yet included an option to import the same background to the town screen for each terrain, so you have to do it one at a time if you want to use the same one for all. These can be png or ora.

You can import your own buildings now, and use the number spinners to move them where you want them. These can also be png or ora. If png, you should make sure the png is the size of the background image with your building placed at the correct location. Otherwise it will be placed at 0, 0 (top left corner) and you will need to use the number spinners to move it in place.

Note. if the building you are trying to replace has an animation, then when you view the town in game the old object will appear (because the animation is displaying).

There is still more work and testing to be done to see if packing an empty animation.h4d file (meaning an image consisting of all transparency) will override the one in heroes4.h4r so that nothing shows.

Of course, if someone wanted to help out and test that out, I would appreciate it :D

- The footprint for adventure objects can now be changed. Caveat on the footprint size being adjustable: Namerutan never got around to figuring out the size of the passability / interactivity mask array for objects with 5x2 and 2x5 footprints, so if you happen to resize to one of those, the resource editor will throw an exception and you may need to restart it. At the very least you'll need to reopen the adventure object.

Bug Fixes:

- So I found a color Quantizing algorithm that seems to be significantly better than the first one I found, and I've updated to use that one now.

The old one had trouble quantizing larger numbers of colors, so it had trouble quantizing images such as Nimostar's pirate town screen.

User avatar
iLiVeInAbOx05
Equilibris Team
Equilibris Team
Posts: 645
Joined: 21 Jul 2014

Re: H4ResourceEditor

Postby iLiVeInAbOx05 » Dec 6 2020, 6:48

Just put out another small update:

- Added the ability to update combat actor action groups (the names of the actor sequences for various actions such as melee, ranged, spell_cast, etc.)

- Added the ability to rename individual layers in layers type objects. Simply open up the layers file, switch the combo box to the layer you want to update the name for, edit the text in the combo box to what you want, and hit enter.

At the moment the combo box will default back to the first element, but that's a minor annoyance that I'll look into. (Just fixed this minor annoyance as well).

User avatar
iLiVeInAbOx05
Equilibris Team
Equilibris Team
Posts: 645
Joined: 21 Jul 2014

Re: H4ResourceEditor

Postby iLiVeInAbOx05 » Dec 6 2020, 19:20

Edit. For anyone that was interested, I pushed all of my changes to the open source repository (link in the original post).

***********************************************************************

Another small update:

- Added the ability to update adventure action groups (the names of the actor sequences for various actions on the adventure map).
Last edited by iLiVeInAbOx05 on Dec 7 2020, 3:55, edited 1 time in total.

User avatar
iLiVeInAbOx05
Equilibris Team
Equilibris Team
Posts: 645
Joined: 21 Jul 2014

Re: H4ResourceEditor

Postby iLiVeInAbOx05 » Dec 16 2020, 16:25

Another small update:

- Added support for viewing and modifying table and strings files.

User avatar
iLiVeInAbOx05
Equilibris Team
Equilibris Team
Posts: 645
Joined: 21 Jul 2014

Re: H4ResourceEditor

Postby iLiVeInAbOx05 » Dec 30 2020, 20:30

Small update:

- For the mod manager feature, added a check box to install the packed new.h4r file into the H4 data directory when checked, and added another check box to launch the game when checked.

User avatar
iLiVeInAbOx05
Equilibris Team
Equilibris Team
Posts: 645
Joined: 21 Jul 2014

Re: H4ResourceEditor

Postby iLiVeInAbOx05 » Jun 15 2021, 17:38

Another small update:

- Added a mass export feature for actor sequences. This is similar to the extract sequence feature, except it extracts the sprites for each actor sequence into ora files.

- Fixed a bug in the mass export feature where the filenames did not remove the h4d extension before appending the ora extension.

- Added mega dragon, mermaid, and sea monster to the list of dwelling options.

Bug fixes:

- Fixed a bug where loading an object in the resource frame did not update the title to the name of the file that was opened.

- Fixed a bug where any frame with "animation" in it was getting set to blending mode 0, when it should have been "animation_offset"
Last edited by iLiVeInAbOx05 on Jun 18 2021, 4:27, edited 2 times in total.

User avatar
iLiVeInAbOx05
Equilibris Team
Equilibris Team
Posts: 645
Joined: 21 Jul 2014

Re: H4ResourceEditor

Postby iLiVeInAbOx05 » Jul 15 2021, 22:28

Next big update!

Features:
- Implemented mass extraction for any object type via right clicking the node in question, and selecting "mass extract"

- Implemented mass exporting of .ora files at the object type level. So you can export .ora files for actor_sequence and adv_obj. I plan to extend this feature to any object type that contains a sprite.

- Implemented mass exporting of png folders. Like the mass exporting .ora feature, but for pngs instead. This will create a directory named after the object being exported from, and in that directory will be the png files named for their layer.

- Implemented mass importing of folders containing the layers as png files. Works like mass importing for ora format, but the directory containing the png files must be named the same as the h4d object you with to import into.


Bug Fixes:
- Fixed a bug with animation objects where sometimes the additional offsets can still be present when the bit map layer field is 0x01.

- Fixed a bug for mass extracting actor_sequence.hero where having two sequences with the same name but different cases was causing issues (Windows no likey same directory name with different cases).

User avatar
Pol
Admin
Admin
Posts: 9594
Joined: 29 Nov 2005
Location: IN SOMNIS VERITAS
Contact:

Re: H4ResourceEditor

Postby Pol » Jul 16 2021, 16:21

Well done! :D
"We made it!"
The Archives | Collection of H3&WoG files | Older albeit still useful | CH Downloads
PC Specs: A10-7850K, FM2A88X+K, 16GB-1600, SSD-MLC-G3, 1TB-HDD-G3, MAYA44, SP10 500W Be Quiet

User avatar
iLiVeInAbOx05
Equilibris Team
Equilibris Team
Posts: 645
Joined: 21 Jul 2014

Re: H4ResourceEditor

Postby iLiVeInAbOx05 » Aug 4 2021, 21:56

iLiVeInAbOx05 wrote:- Implemented mass exporting of .ora files at the object type level. So you can export .ora files for actor_sequence and adv_obj. I plan to extend this feature to any object type that contains a sprite.
This feature is now extended to the various object types with a sprite. This was working for mass png extraction, but I had forgotten about two object types: battlefield preset map and combat object, so these are now included as well.

Bug fixes:
- Fixed a bug with using the correct table in h4r files. As a shortcut, I had been assuming the table always directly followed the header (that the table offset was always 8 bytes into h4r files). This was not the case.

Now all of the files in the h4r files can be viewed and extracted, where some h4r files would only show a subset. Also updates.h4r can now be opened by the Resource Editor.
Last edited by iLiVeInAbOx05 on Aug 4 2021, 22:00, edited 1 time in total.

User avatar
iLiVeInAbOx05
Equilibris Team
Equilibris Team
Posts: 645
Joined: 21 Jul 2014

Re: H4ResourceEditor

Postby iLiVeInAbOx05 » Aug 27 2021, 15:06

Latest update!

Features:
  • Terrain files are now viewable and can be exported as an ora file or a folder of png files. I plan to add import options as well.
  • Ability to easily add or remove height offsets for adventure objects. This is actually pretty huge as it enables you to quickly and easily figure out the correct number of height offsets for any particular image you've imported. Simply add one and save, or remove one and save, and then test adding the object to the editor's palette until it works.
  • Create adventure objects from scratch! From the main H4 Resource Editor window, select File->New, and then select Adventure Object.

    From there, import your animation, set the footprint size to match, and move the footprint to match the animation base location.

    Set the object type to the desired one, and add a flag if the object should be flaggable.

    You'll need to figure out the number off height offsets by adding / removing them until you find the correct number.
  • Mass exporting png files to a single directory has been implemented. The filenames are in the following format: objectName#frameName.png

    When mass exporting, you will be shown a dialogue to select either "Keep Directory Structure," or "Single Directory". The single directory option will use the objectName#frameName.png naming format.
  • Mass importing png files from a single directory into their corresponding h4d files.

    There will be an additional prompt to select the input format of the png files: either the object name is the parent directory where png files are found, or the png files are of the objectName#frameName.png naming format.

    This method will still look in sub folders as well as the selected folder for png files, but it assumes the names are in the objectName#frameName.png naming format

    Note. objectName does not contain ".h4d" though it probably doesn't matter since it's the resource editor that exports in this naming format.

    The purpose of this feature is for anyone wanting to do png batch editing (editing all of the files in the same way at once). Apparently things programs Photoshop are unable to look in sub folders.
Bug Fixes:
  • Fixed an issue handling adventure object codes that mapped to more than one adventure object type
  • Fixed a threading issue when importing ora files.
  • Fixed a bug with adding rows to table objects.
  • Fixed a bug with adding / removing a flag from an adventure object.
  • You can now save over an h4r file you have opened. A side effect of this fix is that opening an h4r large file like heroes4.h4r will take a second or two, and also the entire file will be held in memory.

    This isn't really an issue for any of the h4r files other than heroes4.h4r

    If anyone has issues with this update, just let me know so I can take a look.
Last edited by iLiVeInAbOx05 on Aug 27 2021, 22:53, edited 2 times in total.


Return to “Heroes I-IV”

Who is online

Users browsing this forum: No registered users and 13 guests