Haven-res.jar hit-box fix. Fixed after multiple attempts.

Forum for alternative clients, mods & discussions on the same.

Moderator: Phades

Re: Haven-res.jar hit-box fix. Fixed after multiple attempts

Postby Xcom » Sun Jul 07, 2013 4:23 pm

The issue with the non edited hitbox data is that the numbers are some mysterious size that I cant even make heads or tails out of. I think Jorb and Loftar uses a tool to create there hitbox data and that data is some weird number. The game the does the s2m conversion and fixes that size so they become an easy information java can handle by using rectangles.

The conversion Resources.java does converts them afterwards to the useful info so they can be used like this.

Rectangle rect;
rect = new Rectangle(object.x + bc.x, object.y + bc.y, bs.x, bs.y);

This being the conversion

Code: Select all
      bc = MapView.s2m(bc);
      
      bs = MapView.s2m(bs).add(bc.inv());


The bc is the offset so the rectangle can be calculated from the top left if you give the objects center point and the bs becoming the rectangles size.

The number examples you have given might be the hitbox data before the conversion so that's why it makes no sense.
User avatar
Xcom
 
Posts: 1105
Joined: Wed Dec 14, 2011 1:43 pm

Re: Haven-res.jar hit-box fix. Fixed after multiple attempts

Postby mvgulik » Sun Jul 07, 2013 8:28 pm

Xcom wrote:The issue with the non edited hitbox data is that the numbers are some mysterious size that I cant even make heads or tails out of.

Not sure what you mean with "non edited hitbox data". The data I'm revering to is the data in the NEG-res files.
In the case of the hitboxes for tree's, bc.y and bs.y here(!) can be seen as just the Y(vertical) size/distance/offset in pixels of the top and bottom corners of the hitbox iso-diamond (related to the default iso-tile size the game uses. 44x22.)

I don't know that happens to the NEG bc and bs values while, and after, they are processed. And I also don't know if there are any res files that actually use the NEG bc.x and bs.x slots (have not build a res data database for easy searching).
mvgulik
 
Posts: 3742
Joined: Fri May 21, 2010 2:29 am

Re: Haven-res.jar hit-box fix. Fixed after multiple attempts

Postby Xcom » Sun Jul 07, 2013 10:18 pm

Best way for me to explain it would be to show an example.

This is the neg info found using boshaw's layer util. I extracted the info from the haven-res.jar and then opened the neg_0.data of a random res that have a hitbox, in this case a cauldron.

Code: Select all
#NEG LAYER FOR RES: out///gfx\terobjs\cauldron.res
#Coord cc
36
52
#Coord bc
0
-10
#Coord bs
0
10
#Coord sz
583
65
#Byte en
0


What I call the non edited hitbox data can be seen here to be bc = (0,-10); bs = (0,10).

To me this makes no sense other then some random numbers. They look to start at 0,0 and end at -10,10. I just know they are the hitbox data before the isometric conversion done inside the Resourse.java converting them from what ever these numbers are to the numbers that are useful in being able to use them as rectangles. These numbers get very confusing when things get a bit more complicated like in some ridges.

I also found that its impossible to make any edits to these numbers as rounding errors skips accuracy causing even more issues trying to fix the hitboxes of some rare objects with faulty hitbox data.

When I was editing the faulty hitboxes I basically took the bc and bs of the ingame numbers (not the data found in the neg but the data after the data had been converted using that s2m function) and added or subtracted numbers to get the proper hitboxes. I also found that it was impossible to edit the original neg data to get a proper hitbox after the s2m function as the s2m function does rounding to the numbers causing it to become inaccurate.

In short. All these non edited or rather, original neg bc and bs numbers, are just useless. They need to be converted to the isometric number system used inside the game. Then you can edit them with ease and skip that conversion algorithm done inside Resource.java.

This is what the cauldron looks like after the conversion using the s2m function.

Code: Select all
#NEG LAYER FOR RES: out///gfx\terobjs\cauldron.res
#Coord cc
36
52
#Coord bc
-5
-5
#Coord bs
10
10
#Coord sz
583
65
#Byte en
0


Now this is useful info.

The bc = (-5,-5) is the offset and bs = (10,10) the size.

When the server send the info to the client they are received as a bunch of coordinates and a resname to go along with them. The client take the resname of each object and designates a bunch of info to the objects. One of the info is neg info it attaches to the object. To make a hitbox rectangle of the object you need to designate it start point so thats where bc comes in. If you take the object coord and add the bc to it you get the start location of the rectangle. The size of the rectangle is then the bs completing the data to make a Java Rectangle.

What was needed to make the jobb easier to edit the faulty hitboxes was to edit all res files to convert from the original neg data to the converted s2m data. Then you could easily edit the neg data where it was needed by editing the bs and bc. Then remove the conversion needed in the Resource.java to skip that step and get the data directly. It would be impossible to make some hitboxes match by editing the bc and bs if it was in its original form.
User avatar
Xcom
 
Posts: 1105
Joined: Wed Dec 14, 2011 1:43 pm

Re: Haven-res.jar hit-box fix. Fixed after multiple attempts

Postby Xcom » Sun Jul 07, 2013 11:02 pm

Here is a link to get the edited neg files. There is also a zip with short walls, cheese racks and cupboards.

Download haven-jar.res with edited neg files:
http://www.sendspace.com/file/gy1y6v

Download short walls, cheeseracks, cubs with edited neg files:
http://www.sendspace.com/file/02bkgm

To use it simply replace the haven-res.jar with the one in the ender directory.

To get the the short walls, cheeseracks, cubs. Simply extract them into the custom_res folder.

Here is the full list of filter names:
Code: Select all
gfx/terobjs/blood
off=-5,-5
sz=11,11
gfx/terobjs/herbs/chantrelle
off=0,0
sz=0,0
gfx/tiles/wald/flavobjs/f1
off=0,0
sz=0,0
gfx/tiles/fen/flavobjs/f10
off=0,0
sz=0,0
gfx/tiles/moor/flavobjs/f1
off=0,0
sz=0,0
gfx/tiles/moor/flavobjs/f2
off=0,0
sz=0,0
gfx/tiles/moor/flavobjs/temp/f3
off=0,0
sz=0,0
gfx/tiles/moor/flavobjs/temp/f4
off=0,0
sz=0,0
gfx/tiles/heath/flavobjs/f1
off=0,0
sz=0,0
gfx/tiles/heath/flavobjs/f2
off=0,0
sz=0,0
gfx/terobjs/ridges/grass/ss
off=-10,-4
sz=14,7
gfx/terobjs/ridges/grass/e
off=-2,-12
sz=7,24
gfx/terobjs/ridges/grass/e2s
off=0,-22
sz=25,25
gfx/terobjs/ridges/grass/es
off=-5,-6
sz=7,16
gfx/terobjs/ridges/grass/ee
off=-4,-10
sz=7,14
gfx/terobjs/ridges/mountain/we
off=-11,0
sz=22,11
gfx/terobjs/ridges/mountain/ws
off=-11,-11
sz=22,11
gfx/terobjs/ridges/mountain/ne
off=-11,-11
sz=11,22
gfx/terobjs/ridges/mountain/ns
off=0,-11
sz=11,22
gfx/terobjs/ridges/mountain/ss
off=-10,0
sz=10,11
gfx/terobjs/ridges/mountain/ee
off=0,-10
sz=11,10
gfx/terobjs/furniture/coffer
off=-5,-4
sz=10,8
gfx/terobjs/furniture/leanto
off=-9,-5
sz=21,10
gfx/terobjs/furniture/wardrobe
off=-8,-3
sz=20,9
gfx/terobjs/furniture/bed-sturdy
off=-8,-5
sz=18,13
gfx/terobjs/furniture/cclosed
off=-3,-3
sz=7,4
gfx/terobjs/furniture/copen
off=-3,-3
sz=7,4
gfx/terobjs/vclaim
off=-12,-4
sz=27,8
gfx/terobjs/htable
off=-2,-5
sz=7,12
gfx/terobjs/crate
off=-6,-3
sz=14,7
gfx/terobjs/trough
off=-7,-4
sz=21,10
gfx/terobjs/dframe2
off=-3,-8
sz=4,18
gfx/terobjs/mining/ladder
off=-4,-1
sz=9,2
gfx/terobjs/lbox
off=-6,-7
sz=10,15
gfx/arch/gates/brick-ns
off=-5,-11
sz=10,21
gfx/arch/gates/fence-ns
off=-5,-11
sz=10,21
gfx/arch/gates/palisade-ns
off=-5,-11
sz=10,21
gfx/arch/gates/brick-we
off=-11,-5
sz=21,10
gfx/arch/gates/fence-we
off=-11,-5
sz=21,10
gfx/arch/gates/palisade-we
off=-11,-5
sz=21,10
gfx/arch/stairs-inn
off=-7,-11
sz=12,23
gfx/arch/door-inn
off=-11,-2
sz=19,5
gfx/kritter/plow/s
off=-3,-3
sz=6,6
gfx/kritter/cow/s
off=-4,-4
sz=11,11
gfx/kritter/cart/s
off=-5,-5
sz=10,10
gfx/kritter/rat/s
off=0,0
sz=1,1
gfx/kritter/deer/s
off=-4,-4
sz=11,11
gfx/kritter/bear/s
off=-8,-8
sz=16,16
gfx/kritter/fox/s
off=-3,-3
sz=7,7
gfx/kritter/troll/s
off=-8,-8
sz=16,16
gfx/kritter/moth/neg
off=0,0
sz=0,0
gfx/terobjs/ridges/grass/s2w
off=-11,-11
sz=22,23
gfx/terobjs/claim
off=0,0
sz=0,0
gfx/terobjs/anthill-r
off=0,0
sz=0,0


As stated before these hitboxes still display incorrectly:
Logs
Dragonflys
Rats
Frogs
Blood
Chickens / Hens / Chicks
Moth
All types of farm crops (e.g. wheat, flax, pumpkins, grapes)
Last edited by Xcom on Tue Jul 09, 2013 12:18 am, edited 2 times in total.
User avatar
Xcom
 
Posts: 1105
Joined: Wed Dec 14, 2011 1:43 pm

Re: Haven-res.jar hit-box fix. Fixed after multiple attempts

Postby mvgulik » Mon Jul 08, 2013 3:36 am

Seems where looking at something from two completely different viewpoints. Dropping subject as there not really related.

PS:
Code: Select all
...
gfx/terobjs/ridges/grass/e
off=-2,-13
sz=8,25
...
gfx/terobjs/ridges/grass/e
off=-2,-11
sz=5,21
...
mvgulik
 
Posts: 3742
Joined: Fri May 21, 2010 2:29 am

Re: Haven-res.jar hit-box fix. Fixed after multiple attempts

Postby Xcom » Mon Jul 08, 2013 11:59 pm

mvgulik wrote:Seems where looking at something from two completely different viewpoints. Dropping subject as there not really related.

PS:
Code: Select all
...
gfx/terobjs/ridges/grass/e
off=-2,-13
sz=8,25
...
gfx/terobjs/ridges/grass/e
off=-2,-11
sz=5,21
...


Thanks for mentioning this. Somehow everything gone haywire in my filter list. I need to have a look through that list and update it. Its related to the ridge hitbox fixes loftar did to fix ridge jumping early world in W7. Some of them are really out of wack to.

Edit: There checked the ridges that was in that list and made sure they are in order. Edited the filter list on that post above so they match now.
User avatar
Xcom
 
Posts: 1105
Joined: Wed Dec 14, 2011 1:43 pm

Re: Haven-res.jar hit-box fix. Fixed after multiple attempts

Postby mvgulik » Mon Aug 10, 2015 8:58 am

Just in case stuff: (hafen coming up and such)
While reading up on hitbox's and Java stuff ... Java "(int) some_float" truncates.

-|0|+
Floor: <-|0|<-
Ceil: ->|0|->
Trunc: ->|0|<-
mvgulik
 
Posts: 3742
Joined: Fri May 21, 2010 2:29 am

Re: Haven-res.jar hit-box fix. Fixed after multiple attempts

Postby long123 » Tue Aug 11, 2015 7:25 am

The neg files would have to be manually edited one by one.
long123
 
Posts: 6
Joined: Wed Jul 29, 2015 10:55 am

Previous

Return to The Wizards' Tower

Who is online

Users browsing this forum: No registered users and 2 guests