Help needed -compression, xrel, yrel

Discuss, get help with, or post new graphics for TTDPatch and OpenTTD, using the NewGRF system, here. Graphics for plain TTD also acceptable here.

Moderator: Graphics Moderators

Post Reply
User avatar
chrisgrant
Engineer
Engineer
Posts: 6
Joined: 15 Oct 2004 16:43
Location: Perth, WA

Help needed -compression, xrel, yrel

Post by chrisgrant »

Can anyone please explain what the compression, xrel, yrel properties
of a regular (non-pseudo) sprite mean?
I've checked through the Graphics forum and I've read through WIKI
but still have no idea. Other than that I'm getting the hang of NFO files
and everthing seems to work, but when my sprites appear in the game
weird and wonderful things happen!
Any help would be much appreciated.
BobDendry
Tycoon
Tycoon
Posts: 2215
Joined: 06 May 2004 09:10
Location: Sydney

Post by BobDendry »

Hmmm...
Xrel and Yrel are determined by a base equation of Xrel=-Xsize/2 and Yrel=-ysize/2 respectively.
Compression is how many pixels shorter the mdoel is, i think. not sure about it.
Formerly known as Lachie
DaleStan
TTDPatch Developer
TTDPatch Developer
Posts: 10285
Joined: 18 Feb 2004 03:06
Contact:

Post by DaleStan »

x/yrel define how far right and down[0] to move the sprite before drawing it. Another way of putting this is that x/yrel define the "center" of the sprite--the point the sprite rotates around. This may or may not actually be at the center of the sprite rectangle.

compression is poorly understood; check about two thirds of the way down the Action 1 page for what we do know about its meaning. Set it to one of 01, 03, 09, or 0B. I almost always use 01.

[0] Hence the negative numbers, usually you want to move the sprites left and up instead.
To get a good answer, ask a Smart Question. Similarly, if you want a bug fixed, write a Useful Bug Report. No TTDPatch crashlog? Then follow directions.
Projects: NFORenum (download) | PlaneSet (Website) | grfcodec (download) | grfdebug.log parser
User avatar
Siema
Traffic Manager
Traffic Manager
Posts: 176
Joined: 24 Oct 2004 23:36
Location: Warsaw, Poland
Contact:

Post by Siema »

See also:

Format of a GRF file

EDIT: Thing is quite easy: for vehicle sprites in views '_' '|' compression is 01 and for views '\' '/' it is 09. yrel and xrel is ysize/-2 and xsize/-2, as WhiteHand wrote, but mostly you must figure out by trying which position is good (look good in game).

and pic by eis_os:

(edit by eis_os)
Look here: http://www.tt-forums.net/viewtopic.php?t=8083 It would be nice if people would look before reattaching the same thing several times, thanks...

Sorry for that... :oops:
Last edited by Siema on 04 Apr 2005 10:27, edited 2 times in total.
User avatar
Korenn
Tycoon
Tycoon
Posts: 1735
Joined: 26 Mar 2004 01:27
Location: Netherlands
Contact:

Post by Korenn »

as a guideline for compression, I use the same compression as used in the original ttd files for a comparable sprite.

that way you don't have to know how it works :P
User avatar
eis_os
TTDPatch Developer
TTDPatch Developer
Posts: 3603
Joined: 07 Mar 2003 13:10
Location: Germany
Contact:

Post by eis_os »

Useing undefined compression code can result in breakage of TTD, so use only the ones TTD (trg1) use for the sprite type you are creating
TTDPatch dev in retirement ... Search a grf, try Grf Crawler 0.9 - now with even faster details view and new features...
Image
User avatar
chrisgrant
Engineer
Engineer
Posts: 6
Joined: 15 Oct 2004 16:43
Location: Perth, WA

Post by chrisgrant »

Thanks for the tips. I think 've got the basics of NFO's figured out, so now
all I have to do is come up with some decent graphics and I can post my vehicle in the newbie thread.
Post Reply

Return to “Graphics Development”

Who is online

Users browsing this forum: No registered users and 9 guests