SFTtech / openage

Free (as in freedom) open source clone of the Age of Empires II engine 🚀
http://openage.dev
Other
12.63k stars 1.11k forks source link

Building foundation offset #57

Closed TheJJ closed 9 years ago

TheJJ commented 9 years ago

The hotspot of buildings sprites may be offset. The placement algorithm probably needs to be fixed, the calculation is done in the terrain_object class. This algorithm needs to be improved, the hotspot is not correctly aligned with the terrain grid.

Error example: openage

zaxozhu commented 9 years ago

As I understand, mouse cursor should be a center for a ground and a building sprite?

TheJJ commented 9 years ago

Mouse cursor placement is easy to fix, the main problem currently is the wrong center of the building texture hotspot, which does not equal the terrain tile grid placement. The calculation algorithm mentioned is likely to be wrong.

zaxozhu commented 9 years ago

You are right, algorithm needs to be fixed. However, I'm figured out how to place the ground properly.

zaxozhu commented 9 years ago

I have a question. Is start_pos should be a west corner?

TheJJ commented 9 years ago

currently, start_pos is indeed the west corner of the building foundation. This can of course be adjusted to be the center of the mouse click. But this does not fix the offset error of the foundation and the building texture.

franciscod commented 9 years ago

i think the game assets have the offset, we don't have to calc it

TheJJ commented 9 years ago

All graphical game assets have a hotspot, which is the center of the sprite. The challenge is to position this hotspot correctly, in this case the center position of odd and even foundation sizes has to be found.

franciscod commented 9 years ago

but are we using the hotspot whe placing the graphic atm?

zaxozhu commented 9 years ago

openage_2014-11-06_00-12-42_00 This bug is on every building. Edit: Gabe's hair is watching you.

franciscod commented 9 years ago

lol@house

franciscod commented 9 years ago

i improved the alignment with most buildings here #143

openage_2014-11-07_05-21-51_00

however, castles, houses and some other buildings are still misaligned.

i think we might have to deal with this at texture-hotspot-delta-zombine level instead of at tile level