H4ResourceEditor

The old Heroes games developed by New World Computing. Please specify which game you are referring to in your post.
User avatar
iLiVeInAbOx05
Equilibris Team
Equilibris Team
Posts: 773
Joined: 21 Jul 2014

Re: H4ResourceEditor

Unread postby iLiVeInAbOx05 » 19 Apr 2018, 15:40

A small additional update: I have successfully created and displayed an animated gif with the sawmill object. Now I need to actually pair up the shadow frames with the non shadow frames so that they are one single frame each, rather than just animating each frame in order from the object file, which was just part of the test to actually create an animated gif :D

User avatar
Steven Aus
War Dancer
War Dancer
Posts: 350
Joined: 08 Feb 2006
Location: Perth, Australia
Contact:

Re: H4ResourceEditor

Unread postby Steven Aus » 22 Apr 2018, 04:43

:tsup: :applause: :yes: :up: :hug: :tsup: Great Stuff on Your Hero's Journey of Love, Passion and Indominatable Spirits!
My Life Purpose Is To Teach The World To Fish For Life. I AM Steven Russell Lynch Abundance That I AM. Empowerment And Fostering Self-Responsibility Is My Game.

Lethalogica
Leprechaun
Leprechaun
Posts: 3
Joined: 30 Apr 2018

Re: H4ResourceEditor

Unread postby Lethalogica » 02 May 2018, 05:00

Really excited for this, with the right mods tools and modders heroes iv can be the best of the series, really happy I'm not the only one who is still interested

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

Re: H4ResourceEditor

Unread postby iLiVeInAbOx05 » 02 May 2018, 16:54

Glad to hear it and welcome Lethalogica! Trying to get to the point where we can create our own objects using this tool. I think we have enough information about the format of adventure objects to make it doable. I need to do a couple more things, such as display flag location for flaggable objects and make it adjustable, then I can work on taking an image and breaking it up into the adventure object format.

I have a couple things to do still to finish up with displaying adventure objects, such as converting image pixels to pixels where the image is displayed (when the image is resized) so that I can line up the passability, entrance info, and flag location.

Just need some time to work on it!

Here's a resized gif of the sawmill:

Image

I still haven't done any work with pixel blending and using the apha data, but I'll get to that eventually.

Also, there are some little artifacts floating around, but they are actually contained in the object image data. Alpha and blending may take care of those.
Last edited by iLiVeInAbOx05 on 02 May 2018, 16:56, edited 1 time in total.

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

Re: H4ResourceEditor

Unread postby iLiVeInAbOx05 » 17 May 2018, 17:56

Still working on lining everything up over the image, but I have been making some progress.

I think I need to actually start with the image at its exact size and get everything lined up, rather than just starting with a scaled image and trying to properly scale all of the values to their correct locations.

So far, the flag location is just a tiny bit off. The starting point for the passability and entrance data seems to be really close, but I need to restudy how I'm drawing it so that it lines up with that particular point.

Getting close though. I don't really need these things done to make the passability starting point editable, so I'll probably work on adding number spinners for that.

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

Re: H4ResourceEditor

Unread postby iLiVeInAbOx05 » 19 May 2018, 21:16

I got the passability and entrance info lined up with the image. Turns out I had the scaling correct, I just forgot about my code centering the passability and entrance info on the image. Once I removed that, things were in the right place.

Also, I've added number spinners to enable editing of the location of the footprint info. Actually it's the x and y offsets to draw the image onto the footprint, which is why the numbers are negative. A y value of 0 lines the top of the image with the top point of the footprint info. There are some restrictions with the x value, however, which possibly has to do with the width of the image versus the width of the footprint. Haven't done too much testing here yet.

In the image below, I have modified the y value of the footprint (I haven't made it so changes on the panel will show in the image immediately, yet).

Image

Here is the result in the editor.

Image

We're getting close to importing our own images :D There are a few more things I need to understand first.

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

Re: H4ResourceEditor

Unread postby iLiVeInAbOx05 » 21 May 2018, 18:56

Also the flag x and y offsets are actually offsets from the upper tip of the footprint, not the center of the image as I originally thought.

I've also fixed a few bugs in my code for displaying non-animated images that I broke while working on the animated ones.

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

Re: H4ResourceEditor

Unread postby iLiVeInAbOx05 » 26 May 2018, 18:58

Added a toolbar on the adventure panel with buttons to switch between editing the passability and interactive data.

Time to start working on converting an image into H4 format!

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

Re: H4ResourceEditor

Unread postby Pol » 27 May 2018, 20:47

Das is great!
"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: 773
Joined: 21 Jul 2014

Re: H4ResourceEditor

Unread postby iLiVeInAbOx05 » 19 Jun 2018, 04:56

So it seems that the problem was just that I needed to center the width of the image on the footprint (and make the image width small enough to mostly fit on the width of the footprint.

So, to replace an image, open up the adventure object of your choice. I have been playing with the sawmill, so I used that. Select File->import:

Image

Select the image, currently I am just working with png files.

Image

Save the object and then place it into the data folder. Add to the palette to use in the map and drop it on.

Image

The weirdness near the bottom middle of the object is probably me just not doing something quite right when creating the acceleration mask.

There also seems to be something I need to update in order to be able to actually select the object to move it around, etc. With my Starcraft 2 forge, there are only a couple pixels that will allow me to actually select the object. Maybe the offset information at the end of the file?

Anyway, still moving forward!

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

Re: H4ResourceEditor

Unread postby iLiVeInAbOx05 » 20 Jun 2018, 22:09

By the way, please send me a private message if you're interested in helping me test this tool. You'll need a gmail account or one associated with gmail since I use google drive to host / share my files!

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

Re: H4ResourceEditor

Unread postby iLiVeInAbOx05 » 23 Jun 2018, 18:34

Got it!

The problem turned out to be - yet again - the fact that Java only uses signed values whereas pretty much everything in H4 is unsigned. I just needed to use bigger containers until the point where I need to actually save the data in H4 format.

Image

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

Re: H4ResourceEditor

Unread postby Pol » 23 Jun 2018, 22:09

Starcraft?
"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: 773
Joined: 21 Jul 2014

Re: H4ResourceEditor

Unread postby iLiVeInAbOx05 » 24 Jun 2018, 02:16

Haha yes, I used a forge image I found with google. Starcraft is the game I've played more than any other, so I decided I would use an image from it to help test the resource editor.

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

Re: H4ResourceEditor

Unread postby iLiVeInAbOx05 » 28 Jun 2018, 22:00

Currently I'm working on some resizing options since the H4 Editor sometimes gets upset if the image has pixels which are drawn to far outside of the footprint width.

Here are some resizing options which I plan to make available with the H4 Resource Editor:

1) Resize frame to grid. This means resize the entire image, not taking into account transparent pixels which could pad to the left or right of the non-transparent pixels, to the width of the grid.

2) Resize data to grid. This means find the width of the actual pixels that are non-transparent, and resize that width to the width of the grid. If you can think of a better name for this other than "data," please let me know.

3) Enter a width and height in pixels.

Also, any other ideas for resizing options are welcome.
Last edited by iLiVeInAbOx05 on 29 Jun 2018, 18:09, edited 1 time in total.

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

Re: H4ResourceEditor

Unread postby iLiVeInAbOx05 » 04 Jul 2018, 16:35

I have created the form for entering resizing options. Currently working are: No resizing, resize the frame to the grid's width, and custom entering of the width and height in pixels.

Now I just need to work on the slightly more difficult case of cropping out transparent pixels on the left and right of the image, and then resizing the remaining image to the width of the grid.

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

Re: H4ResourceEditor

Unread postby iLiVeInAbOx05 » 24 Jul 2018, 15:55

So, as mentioned by Radmutant, when importing an image into an existing object, you should keep the image frame and - usually - the image height the same as what is already in the object.

I started updating my code last night to always keep the same frame dimensions when importing into an existing object, but there is still a bit more work to do concerning the resizing options that have been discussed.

I've updated the options a little:
1) Fit image to object's frame
2) Fit data to object's frame (crop out transparent pixels on the left / right / top / bottom)
3) Fit image to grid (while leaving the frame the same size)
4) Fit data to grid (while leaving the frame the same size)
5) Custom (while leaving the frame the same size) If the custom dimensions are bigger than the frame, adjust them to the size of the frame.

I think those are what I have currently for the resizing options.

Also mentioned by Radmutant, the optional info at the end of the file (which can be turned on or off by another field in the header) seems to have something to do with the width and height of the image frame for the object, but we don't yet know how the information is packaged up in the data at the end of the file. If the info is turned off, there seems to be much more leeway in image sizings (and hopefully in the footprint offset).

User avatar
Karmakeld
CH Staff
CH Staff
Posts: 1126
Joined: 12 Nov 2011

Re: H4ResourceEditor

Unread postby Karmakeld » 25 Jul 2018, 08:43

Hopefully a lot of CH users will find this tool useful. I wish more ppl. would share their thoughts about this project/tool, but I for one have to play around some more witj the already added features.. keep it up mate..
I'm silent in seven languages - and I got all my familys fear.
Everytime you throw dirt, you loose a little ground

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

Re: H4ResourceEditor

Unread postby iLiVeInAbOx05 » 25 Jul 2018, 19:49

Yeah it would be nice to get some more thoughts and feedback, but that's okay. It will still be quite useful :D
Last edited by iLiVeInAbOx05 on 01 Aug 2018, 21:30, edited 1 time in total.

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

Re: H4ResourceEditor

Unread postby iLiVeInAbOx05 » 30 Jul 2018, 23:23

Well, well, well. Radmutant was correct. Simply updating the field to indicate there is no additional info at the end of the file has yielded the desired results. In the image below I have unset that field on the mirrored labyrinth and adjusted the footprint to where it should be.

Image

Then I open the editor (which already had this object in my test map) and voila!

Image

I also just retested importing an image into an object that I couldn't get to work before (cliff nest). I just turned off the end of file offsets and it was good to go!


Return to “Heroes I-IV”

Who is online

Users browsing this forum: No registered users and 23 guests