Transport Tycoon Forums

The place to talk about Transport Tycoon
It is currently Sat Dec 16, 2017 6:42 pm

All times are UTC




Post new topic  Reply to topic  [ 8 posts ] 
Author Message
 Post subject: Sprite Aligner
PostPosted: Fri Feb 20, 2015 8:55 am 
Offline
Tycoon
Tycoon
User avatar

Joined: Sat Nov 27, 2004 3:05 pm
Posts: 5004
Location: Canada
I am using OpenTTD 1.5.0-beta1 and I am working on a bridge.
It has been well over a year since I last used the sprite aligner tool.
I noticed that the x-rel and y-rel values were rather high (see image), but the tools never lie, do they?
Attachment:
sprite_aligner.png
sprite_aligner.png [ 4.6 KiB | Viewed 1966 times ]

I spent a week trouble shooting my code, all to no avail. :P
After many screenshots and much trouble shooting, I figured it out. THE TOOL LIED! :twisted:
Here is the code that goes with the image:
Code:
9 C:\mps\_tools\grfcodec7\sprites\UrbanTransit0Btest.pcx 80 16 09 31 45 -21 -4 // 2438 86 09

The true x-rel / y-rel values are -21 -4
The sprite aligner inflates these values by 4.

I hope this information helps someone else who may find themselves in sprite aligner Hell. :mrgreen:

_________________
wallyweb on tt-forums: Screenshots - Projects - Releases
wallyweb on Simuscape: Projects - Releases
Other Stuff: TTDPatch 2.6 "Nightly" download - cirdan's OpenTTD branch (New Map Features)
Screenshot Of The Month Contest Winner: August 2015 - Tied May 2016


Top
   
 Post subject: Re: Sprite Aligner
PostPosted: Fri Feb 20, 2015 9:03 am 
Offline
OpenTTD Developer
OpenTTD Developer
User avatar

Joined: Wed Nov 07, 2007 10:44 pm
Posts: 9025
Location: Sol d
wallyweb wrote:
I am using OpenTTD 1.5.0-beta1 and I am working on a bridge.
It has been well over a year since I last used the sprite aligner tool.
I noticed that the x-rel and y-rel values were rather high (see image), but the tools never lie, do they?
Attachment:
sprite_aligner.png

I spent a week trouble shooting my code, all to no avail. :P
After many screenshots and much trouble shooting, I figured it out. THE TOOL LIED! :twisted:
Here is the code that goes with the image:
Code:
9 C:\mps\_tools\grfcodec7\sprites\UrbanTransit0Btest.pcx 80 16 09 31 45 -21 -4 // 2438 86 09

The true x-rel / y-rel values are -21 -4
The sprite aligner inflates these values by 4.

I hope this information helps someone else who may find themselves in sprite aligner Hell. :mrgreen:


OpenTTD does give the alignment values of the cropped sprites when you encode your newgrf using nml's or grfcodec's cropping feature (as they remove the extra blue pixels and how can one tell what was the original value. Decode your grf and compare with those values instead of those withing your original code).
Additionally it shows the values for the zoom level you are currently using - information which you conveniently cropped from your screenshot-snippet.

_________________
Image
OpenTTD: manual | online content | translations | Wanted contributions and patches
#openttdcoop: blog | wiki | public server | DevZone | NewGRF web translator
DevZone - home of the free NewGRFs: OpenSFX | OpenMSX | OpenGFX | Swedish Rails | OpenGFX+ Trains|RV|Industries|Airports|Landscape | NML


Top
   
 Post subject: Re: Sprite Aligner
PostPosted: Fri Feb 20, 2015 11:57 am 
Offline
Tycoon
Tycoon
User avatar

Joined: Sat Nov 27, 2004 3:05 pm
Posts: 5004
Location: Canada
planetmaker wrote:
OpenTTD does give the alignment values of the cropped sprites when you encode your newgrf using nml's or grfcodec's cropping feature (as they remove the extra blue pixels and how can one tell what was the original value.
As you can see from this sprite
Attachment:
cropped_sprite.png
cropped_sprite.png [ 1.07 KiB | Viewed 1945 times ]
which is the exact one that the sprite aligner was pointed to, there are no excess blue pixels. There never were. I have no need of a cropping tool or feature mainly because I never leave anything to crop.
Quote:
Decode your grf and compare with those values instead of those withing your original code).
Wouldn't it be much simpler if the aligner simply displayed the real value, the way it used to do?
Quote:
Additionally it shows the values for the zoom level you are currently using - information which you conveniently cropped from your screenshot-snippet.
Considering that I did experiment before starting this topic and that I found the values remained the same for every zoom level, the conveniently cropped zoom level would have been redundant and perhaps even confusing.

I am sure that there must have been a good reason to make changes to the sprite aligner such that it now provides the fine tuning of one click per quarter pixel and displays values in quarter pixels. I simply do not know that reason. Perhaps someone could point me to the documentation.

_________________
wallyweb on tt-forums: Screenshots - Projects - Releases
wallyweb on Simuscape: Projects - Releases
Other Stuff: TTDPatch 2.6 "Nightly" download - cirdan's OpenTTD branch (New Map Features)
Screenshot Of The Month Contest Winner: August 2015 - Tied May 2016


Top
   
 Post subject: Re: Sprite Aligner
PostPosted: Fri Feb 20, 2015 12:30 pm 
Offline
Transport Coordinator
Transport Coordinator

Joined: Mon Nov 07, 2011 7:32 pm
Posts: 316
Location: PL
In my opinion displaying relative offsets for sprites would be the best way in many cases. It means that all not shifted sprites should have (0, 0) offsets in sprite aligner tool. If you obtain the best results with (-2, -1) offsets, you should simply add these values to your offsets, without caring about cropping.

Real sprite offsets are important only if you want to replace original sprite with its original positions.

Maybe the switch real/relative would be a good idea?

_________________
Image


Last edited by TadeuszD on Fri Feb 20, 2015 12:38 pm, edited 1 time in total.

Top
   
 Post subject: Re: Sprite Aligner
PostPosted: Fri Feb 20, 2015 12:37 pm 
Offline
Tycoon
Tycoon
User avatar

Joined: Tue Apr 24, 2007 9:37 am
Posts: 2898
Location: Straya
Quote:
I am sure that there must have been a good reason to make changes to the sprite aligner such that it now provides the fine tuning of one click per quarter pixel and displays values in quarter pixels. I simply do not know that reason. Perhaps someone could point me to the documentation.


This bug has happened before. I remember experiencing it right after the closer zoom levels were first introduced.

_________________
--Stuff I made (or helped make)--
ImageImageImageImage

--My Award-Winning Screenshots and Videos--


Top
   
 Post subject: Re: Sprite Aligner
PostPosted: Sat Feb 28, 2015 7:51 am 
Offline
President
President
User avatar

Joined: Tue Feb 01, 2011 11:22 am
Posts: 905
Location: Beer
Aligning sprites is hell, I always do it this way:

1. open aligner

2. open all sprites I want to align, one by one - and write down the values for X Y offsets it says to an excel spreadsheet

3. I align stuff until happy

4. I write down the final values in the spreadsheet

5. I make a difference between them in the spreadsheet

6. I write down code values to the spreadsheet

7. I add the difference to code values -> I get values I should put into the code again.

Tedious, but works. What TadeuszD suggests would at least remove steps 1-5 which I would very much like.

With the "recent" change of making all of the values in x4 zoom, it became hard to align x1 as it is all times 4. Is it possible to add three buttons - x4, x2, x1 to the sprite aligner?

It made aligning x4 zoom possible, with x1 still being possible but tedious as you have to recalculate everything times 4 in your mind.

_________________
ImageImageImage


Top
   
 Post subject: Re: Sprite Aligner
PostPosted: Fri Jan 22, 2016 3:51 pm 
Offline
Tycoon
Tycoon
User avatar

Joined: Fri Oct 21, 2005 9:26 am
Posts: 962
Location: Birmingham, England
I've just spent hours trying to align a few sprites. I wish I had seen this earlier today...

Maybe I can finally get them lined up this evening.


Top
   
 Post subject: Re: Sprite Aligner
PostPosted: Sat Jan 23, 2016 4:22 pm 
Offline
Tycoon
Tycoon
User avatar

Joined: Tue Apr 24, 2007 9:37 am
Posts: 2898
Location: Straya
I'll continue to use the simplest solution: to use 1.4.4 instead of a more current version for sprite alignment purposes

_________________
--Stuff I made (or helped make)--
ImageImageImageImage

--My Award-Winning Screenshots and Videos--


Top
   
Display posts from previous:  Sort by  
Post new topic  Reply to topic  [ 8 posts ] 

All times are UTC


Who is online

Users browsing this forum: No registered users and 3 guests


You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot post attachments in this forum

Search for:
Jump to:  
Powered by phpBB © 2000-2017 phpBB Limited

Copyright © Owen Rudge/The Transport Tycoon Forums 2001-2017.
Hosted by Zernebok Hosting.