Discussion - recommended standards for newgrf (OTTD)

Discussions about the technical aspects of graphics development, including NewGRF tools and utilities.

Moderator: Graphics Moderators

Post Reply
User avatar
andythenorth
Tycoon
Tycoon
Posts: 5705
Joined: 31 Mar 2007 14:23
Location: Lost in Music

Discussion - recommended standards for newgrf (OTTD)

Post by andythenorth »

Without wanting to enforce anything on authors, it would be useful if there were common standards (or conventions) for certain aspects of newgrfs.

I put some up for discussion on the ottd wiki: http://wiki.openttd.org/NewGRF_Recommended_Standards

The intention is to make life easier and better for players, especially the thousands of bananas users who (as far as I can see) are not forum visitors or participants in the relatively smaller newgrf community. Newgrf spec is very flexible in many areas, and the experience with newgrf is far from seamless. Much of that depends on decisions by newgrf authors, and can't be 'fixed' by openttd.

That page is not linked anywhere but here yet; it would be useful to get feedback / suggestions.

cheers,

Andy
User avatar
Bob_Mackenzie
Chairman
Chairman
Posts: 823
Joined: 25 Mar 2010 13:36

Re: Discussion - recommended standards for newgrf (OTTD)

Post by Bob_Mackenzie »

Having read it that's quite an intimidating list for a noob who is just starting out
User avatar
AndersI
Tycoon
Tycoon
Posts: 1732
Joined: 19 Apr 2004 20:09
Location: Sweden
Contact:

Re: Discussion - recommended standards for newgrf (OTTD)

Post by AndersI »

Light in TTD graphics comes from the bottom right of the screen.
Is this some kind of 'accepted truth' or your own idea?

Airplanes are lighted by a light coming from about 1 o'clock (at least the ground shadow is), tiles have the sun at 2-3 o'clock (see which slope is the brightest), the statue has it at 4-5 (that's your 'bottom right'). trees at 3, Houses are more difficult to see, could be anywhere between 2 to 5, I think.

So why use the one extreme (5) when you can be in the middle with 3? As in 'Light comes from the right, high up in the air'. That will minimize the 'error' in the different shadows.
User avatar
andythenorth
Tycoon
Tycoon
Posts: 5705
Joined: 31 Mar 2007 14:23
Location: Lost in Music

Re: Discussion - recommended standards for newgrf (OTTD)

Post by andythenorth »

@Andersl - I was looking at buildings + vehicles. Good point about the plane shadow.

As there is no single light, the advice needs rewording, to be specific about which things are lit from which direction.
User avatar
FooBar
Tycoon
Tycoon
Posts: 6553
Joined: 21 May 2007 11:47
Location: The Netherlands
Contact:

Re: Discussion - recommended standards for newgrf (OTTD)

Post by FooBar »

If a newer version of your grf is not savegame-compatible with an older version of your grf, use action 14 to provide a check. Do not change the grfid to handle savegame compatibility
I always thought that the grfid should be bumped if savegame-compatibility is broken. Has that changed since action14? If not, please elaborate why this is...


I agree with the rest of the text, but didn't light come from the right (i.e. the middle of the right side of the screen)?
EDIT: looking at the terrain, this is indeed correct.

EDIT2: here's airplanes (bottom right). It's easier to program this way; if you wanted the same angle as the terrain, the shadow accelerate and decelerate faster/slower than the airplane on takeoff and landing. I'd say the image linked above is correct.
Attachments
Untitled-1.png
Untitled-1.png (9.84 KiB) Viewed 4558 times
User avatar
wallyweb
Tycoon
Tycoon
Posts: 6102
Joined: 27 Nov 2004 15:05
Location: Canada

Re: Discussion - recommended standards for newgrf (OTTD)

Post by wallyweb »

This would seem to assume that all NewGRFs are for OTTD. Keep in mind that TTDPatch is still very much in use by many players who favour it's simpler implementation and other than your very valid Action14 comments, the balance of your suggestions could easily be applicable to TTDPatch as well. Rather than limit this to the OpenTTD wiki, it could be included in the new TTWiki.
If your set is large and provides many vehicles or objects, consider identifying 'core' and 'extra' items, with parameters to turn them on or off. Consider defaulting to 'off' for the extra items - this is useful to admins of multiplayer servers.
To a certain extent, I had suggested something similar where the 'core' items would fit the limited TTDPatch ID range. Perhaps this could be considered thus giving us a greater selection of [UNIV] material.
User avatar
AndersI
Tycoon
Tycoon
Posts: 1732
Joined: 19 Apr 2004 20:09
Location: Sweden
Contact:

Re: Discussion - recommended standards for newgrf (OTTD)

Post by AndersI »

After seeing your explanation of the plane (and studying it closer when passing a hill) I'm with you on that one, but...
FooBar wrote:looking at the terrain, this is indeed correct.
I have difficulties buying that, as the surface 1 is darker than 2, and 2 and 3 have the same brightness. This gives me the following image which is also supported by the trees (actually, the tiles indicate a light coming more from the top than the bottom):
Attachments
Ex29.png
Ex29.png (6.48 KiB) Viewed 4535 times
User avatar
andythenorth
Tycoon
Tycoon
Posts: 5705
Joined: 31 Mar 2007 14:23
Location: Lost in Music

Re: Discussion - recommended standards for newgrf (OTTD)

Post by andythenorth »

light_1.png
light_1.png (22.31 KiB) Viewed 4503 times
light_2.png
light_2.png (28.2 KiB) Viewed 4503 times
The lighting in these is (as Andersl wrote above) from about (EDIT) 4.30pm, and 'high'.

So the documentation needs to be clear that there are multiple prevailing angles, depending on what you're drawing.
It would be helpful to make a nice clear explanation of this for authors ;)
Last edited by andythenorth on 14 Jun 2011 13:27, edited 1 time in total.
User avatar
FooBar
Tycoon
Tycoon
Posts: 6553
Joined: 21 May 2007 11:47
Location: The Netherlands
Contact:

Re: Discussion - recommended standards for newgrf (OTTD)

Post by FooBar »

AndersI wrote:I have difficulties buying that, as the surface 1 is darker than 2, and 2 and 3 have the same brightness. This gives me the following image which is also supported by the trees (actually, the tiles indicate a light coming more from the top than the bottom):
The 'opposing' tile of 1 (the northernmost tile of the hill) is dark. If light would come exactly from the right as you draw it, this tile would have to be exactly the same colour as tile 1. As that isn't the case it leads me to believe that light comes from a little lower than the exact right. Somewhere between your image and my image with the airplane.

At least that's what I see in it.
User avatar
AndersI
Tycoon
Tycoon
Posts: 1732
Joined: 19 Apr 2004 20:09
Location: Sweden
Contact:

Re: Discussion - recommended standards for newgrf (OTTD)

Post by AndersI »

FooBar wrote:The 'opposing' tile of 1 (the northernmost tile of the hill) is dark. If light would come exactly from the right as you draw it, this tile would have to be exactly the same colour as tile 1. As that isn't the case it leads me to believe that light comes from a little lower than the exact right. Somewhere between your image and my image with the airplane.
Described in that way, I can only agree with you. 4:30 pm, it is, then :-)
Post Reply

Return to “NewGRF Technical Discussions”

Who is online

Users browsing this forum: No registered users and 8 guests