Zephyris's newGRF examples guide

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
Zephyris
Tycoon
Tycoon
Posts: 2897
Joined: 16 May 2007 16:59

Zephyris's newGRF examples guide

Post by Zephyris »

Vehicle GRF Tutorials/Examples - Common GRF Coding Challenges
Richard Wheeler (Zephyris) 2008


Attached is the first draft of an document I have been working on over the last few months when I have been bored.

This is a good thing to read once you have finished the tutorials at the TTDPatch wiki. Currently it covers vehicle coding including:
* action 1
* action 2
_* loading stage graphics
_* moving/loading graphics
_* variational action2
_* randomised action2
* action 3
_* multiple cargo types
_* livery override
* callbacks
_* articulated vehicles

There are mistakes, please let me know if you find one!
It is a Google docs document, so If you would like to contribute just ask!
Attachments
GRF Code Examples.pdf
(151.22 KiB) Downloaded 568 times
User avatar
FooBar
Tycoon
Tycoon
Posts: 6553
Joined: 21 May 2007 11:47
Location: The Netherlands
Contact:

Re: Zephyris's newGRF examples guide

Post by FooBar »

I think this is very useful. Now I finally understand the bit-shift and AND-mask stuff. So thanks for explaining! :mrgreen:


One general remark:
In an example, I'd use a real vehicle ID instead of **. Right now, people who just started coding NFO, might think they really need to put ** in there. For a theoretical explanation, ** is just fine, but for an example I would just use a random number. :wink:
User avatar
AndersI
Tycoon
Tycoon
Posts: 1732
Joined: 19 Apr 2004 20:09
Location: Sweden
Contact:

Re: Zephyris's newGRF examples guide

Post by AndersI »

If the tutorial is really ambitious, it should have an accompanying .pcx file and make real examples. Nothing is better than seeing the fruits of one's labour running around inside the game!

Anyway, it's already a good read and will hopefully grow. But why a PDF? Why not add pages in the Wiki?

Now all that's needed is a parallel document with the same questions and GRFMaker answers. But that's a question for the GRFMaker thread (http://www.tt-forums.net/viewtopic.php? ... &start=340), and not much seems to be happening there :-(
User avatar
Zephyris
Tycoon
Tycoon
Posts: 2897
Joined: 16 May 2007 16:59

Re: Zephyris's newGRF examples guide

Post by Zephyris »

I find it easier to write something without trying to fit it into the wiki structure, but the text can be transplanted if wanted...
User avatar
lead@inbox
Transport Coordinator
Transport Coordinator
Posts: 377
Joined: 28 Dec 2007 04:35
Location: Serge, Russia, Vladivostok
Contact:

Re: Zephyris's newGRF examples guide

Post by lead@inbox »

Zephyris - Excellent work! 8)
Trond
Tycoon
Tycoon
Posts: 973
Joined: 25 Jan 2008 07:32
Location: Gamle Ørnenuten

Re: Zephyris's newGRF examples guide

Post by Trond »

I echo the rest! Superb job Zeph!
..: Trond :.. because you deserve it! Image

The whole problem with the world is that fools and fanatics are always so certain of themselves,
and wiser people so full of doubts.
Bertrand Russell

MyGRFs: Norwegian Funny Town Names 4 | LOTR & WoW Town Names 2 | Islandic Town Names 1 | Random Norwegian Town Names
Favorites: GRFCrawler | ISR | WIKI | Now Playing: OpenTTD 1.3.2 w/YAPP 3.0-RC3.9ish
Post Reply

Return to “Graphics Development”

Who is online

Users browsing this forum: Bing [Bot] and 14 guests