[UNIV] NewObjects GRF Coding Guide * UPDATE

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

User avatar
wallyweb
Tycoon
Tycoon
Posts: 6102
Joined: 27 Nov 2004 15:05
Location: Canada

[UNIV] NewObjects GRF Coding Guide * UPDATE

Post by wallyweb »

Finally, newobjects are a reality. :D

UPDATE!!! Rubidium of OpenTTD Developer fame has completed OpenTTD implementation most admirably. :D

What are they? Eye-candy, pure and simple. They contribute absolutely nothing to game play other than costing money to build and occupying valuable real estate. They accept nothing and produce nothing. They are perfect for those who like to build good looking scenarios with an added touch of realism and grow those scenarios over time.

Newobjects can also be used to develop and preview structure sprites (aligning those pesky x-rels and y-rels) such as buildings, stations and industries before giving them properties and features and committing them to an appropriate set.

Credit must be given to Oskar for taking on my suggestion, to Lakie for furthering development and clearing up some bugs, to SAC for recognizing the potential, to Aegir for some early coding, to OzTrans for giving me the impetus to try my hand at some nfo coding and last but not least but more recently, Michael Blunck for inspiring some changes such as to the GUI (r2326 by eis_os). Thank you all. :D

To begin to use this feature, make sure that you have at least TTDPatch nightly r2360 and that newobjects is set to on in your ttdpatch configuration file. OpenTTD is supported as of v1.1.0-beta1 (aka nightly r21615).
The next post has some sample newobjects grf's to get you started, as well as links to some others in these forums.

The third post is a guide/tutorial should you wish to have a go at coding some of your own.
Last edited by wallyweb on 28 Dec 2010 10:19, edited 9 times in total.
User avatar
wallyweb
Tycoon
Tycoon
Posts: 6102
Joined: 27 Nov 2004 15:05
Location: Canada

[TTDX] NewObjects GRF Sample Downloads * UPDATED

Post by wallyweb »

The impossibility of building TTDX's lighthouse and communications tower while playing a game has been an ongoing irritant to me. :x
Therefor, my first newobjects offering is a grf that features TTDX's lighthouse and communications tower. 8)
These files now include the TTDX rocks and feature the new GUI.

NOTE: Steep slopes are not supported.

I have produced a windows and a DOS version. Perhaps somebody with the DOS TTDPatch installed could kindly test the DOS version and report back. :wink:
The new GUI
The new GUI
newgui.png (31.77 KiB) Viewed 3162 times
TTD_landscapew.zip
Windows version
(17.94 KiB) Downloaded 975 times
ttdldscd.zip
DOS version
(17.69 KiB) Downloaded 417 times
Links to other downloads:

Wallyweb's Objects
SAC's Objects
Last edited by wallyweb on 28 Dec 2010 12:31, edited 9 times in total.
User avatar
wallyweb
Tycoon
Tycoon
Posts: 6102
Joined: 27 Nov 2004 15:05
Location: Canada

[TTDX] NewObjects GRF Coding Guide

Post by wallyweb »

NOTE: Due to recent changes in the newobjects specifications and the addition of OpenTTD support, the coding guide WILL BE REVISED, just as soon as I get around to it.

NOTE: IT IS ASSUMED THAT THE CODER IS FAMILIAR WITH GRF NFO CODING.
THIS TUTORIAL IS MERELY A STRATEGY GUIDE FOR CODING NEWOBJECTS.
TTDPatch.cfg (minimum r2330) must have newobjects on

Rather than repeat a lot of information that is available elsewhere, I have extensively commented the nfo file which includes links to the appropriate TTDPatch wiki Action discussion ... simply copy and paste into your browser's address line.

Anybody familiar with house, industry and/or station coding should be comfortable with this presentation.

The Action0 property 08 is a special case and is discussed in the following post.

The sprites are coloured and numbered cubes which will aid in recognizing how it all goes together.

NOTE: The code below has benefited from a little revision suggested (with thanks :D ) by Michael Blunck and eis_os.
In the Action 0 properties 09 and 0A, D4 was changed to D0.
In the Action 4, "Ð[text]" was changed to D0 "[text]".

Code: Select all

// Automatically generated by GRFCODEC. Do not modify!
// (Info version 7)
// Escapes: 2+ = 71 = D= = DR 2- = 70 = D+ = DF 2< = 7= = D- = DC 2> = 7! = Du* = DM 2u< = 7< = D* = DnF 2u> = 7> = Du<< = DnC 2/ = 7G = D<< = DO 2% = 7g = D& 2u/ = 7gG = D| 2u% = 7GG = Du/ 2* = 7gg = D/ 2& = 7c = Du% 2| = 7C = D% 2^ 2sto = 2s 2rst = 2r 2+ 2ror = 2rot
// Newobject Tutorial nfo file by Walter E. Bamberger
// With the assistance of Lakie who shall receive cookies
// Format: spritenum pcxfile xpos ypos compression ysize xsize xrel yrel
    0 * 4	 47 00 00 00

//=====================================================================================
// NOTE: IT IS ASSUMED THAT THE CODER IS FAMILIAR WITH GRF NFO CODING.
// Link: http://wiki.ttdpatch.net/tiki-index.php?page=NewGraphicsSpecs
// THIS TUTORIAL IS MERELY A STRATEGY GUIDE FOR CODING NEWOBJECTS.
// TDPatch.cfg (r2321) must have newobjects on
//=====================================================================================

// Action 8 Define GRF ID, Name and Description
// Link: http://wiki.ttdpatch.net/tiki-index.php?page=Action8
// <sprite-number> * <length> 08 <version> <grf-id> <name> <description>
    1 * 63	 08 07 "WB" 99 10 "Wally's Newobjects Tutorial v1.2" 00 "© 2010 Walter Bamberger" 00
//=====================================================================================
//All of the code in this file is freely available from the TTDPatch NewGraphicsSpecs pages and may be copied and/or modified at will.
//The cube graphics were created by me but they are very generic and the pcx file may be copied and/or modified at will.
//Credit would be nice but is not required.
//=====================================================================================
// Action 0 Defining new graphics feature properties
// Link: http://wiki.ttdpatch.net/tiki-index.php?page=Action0
// Properties link: http://wiki.ttdpatch.net/tiki-index.php?page=Action0Objects
// <Sprite-number> * <Length> 00 <Feature> <Num-props> <Num-info> <Id> (<Property <New-info>)...
    2 * 161	 00 0F 09 07 00 
		08 "CUBE" "CBX2" "CBX2" "CBX3" "CBX3" "CBXX" "CBXX"
		09 00 D0  02 D0  02 D0  05 D0  05 D0  08 D0  08 D0
		0A 01 D0  03 D0  04 D0  06 D0  07 D0  09 D0  0A D0
		0B 01     01     01     01     01     01     01
		0C 11     12     21     13     31     22     33
		0D 0C     0C     0C     0C     0C     0C     0C
		0E 00 00 00 00  00 00 00 00  00 00 00 00  00 00 00 00  00 00 00 00  00 00 00 00  00 00 00 00
		0F 00 00 00 00  00 00 00 00  00 00 00 00  00 00 00 00  00 00 00 00  00 00 00 00  00 00 00 00
		10 00 00  00 00  00 00  00 00  00 00  00 00  00 00

//=====================================================================================
// Object
// Action 1 Define a set of real sprites
// Link: http://wiki.ttdpatch.net/tiki-index.php?page=Action1
// <Sprite-number> * <Length> 01 <feature> <num-sets> <num-ent>
    3 * 4	 01 0F 09 01
// Format: spritenum pcxfile xpos ypos compression ysize xsize xrel yrel
    4 C:\MPS\_tools\grfcodec\sprites/NewObjTutw.pcx 80 8 09 64 64 -31 -33 // 0 0
    5 C:\MPS\_tools\grfcodec\sprites/NewObjTutw.pcx 160 8 09 64 64 -31 -33 // 0 1
    6 C:\MPS\_tools\grfcodec\sprites/NewObjTutw.pcx 240 8 09 64 64 -31 -33 // 0 2
    7 C:\MPS\_tools\grfcodec\sprites/NewObjTutw.pcx 320 8 09 64 64 -31 -33 // 1 0
    8 C:\MPS\_tools\grfcodec\sprites/NewObjTutw.pcx 400 8 09 64 64 -31 -33 // 1 1
    9 C:\MPS\_tools\grfcodec\sprites/NewObjTutw.pcx 480 8 09 64 64 -31 -33 // 1 2 
   10 C:\MPS\_tools\grfcodec\sprites/NewObjTutw.pcx 560 8 09 64 64 -31 -33 // 2 0
   11 C:\MPS\_tools\grfcodec\sprites/NewObjTutw.pcx 640 8 09 64 64 -31 -33 // 2 1
   12 C:\MPS\_tools\grfcodec\sprites/NewObjTutw.pcx 720 8 09 64 64 -31 -33 // 2 2

// Action 2 for object
// Link: http://wiki.ttdpatch.net/tiki-index.php?page=Action2HousesIndustryTiles
// <Sprite-number> * <Length> 02 <Feature> <set-id> 00 <groundsprite> <buildingsprite> <xoffset> <yoffset> <xextent> <yextent> <zextent>
   13 * 17	 02 0F 00 00  8D 0F 00 00  00 80 00 80   00 00   0F 0F E5 // 0 0
   14 * 17	 02 0F 01 00  8D 0F 00 00  01 80 00 80   00 00   0F 0F E5 // 0 1
   15 * 17	 02 0F 02 00  8D 0F 00 00  02 80 00 80   00 00   0F 0F E5 // 0 2
   16 * 17	 02 0F 03 00  8D 0F 00 00  03 80 00 80   00 00   0F 0F E5 // 1 0
   17 * 17	 02 0F 04 00  8D 0F 00 00  04 80 00 80   00 00   0F 0F E5 // 1 1
   18 * 17	 02 0F 05 00  8D 0F 00 00  05 80 00 80   00 00   0F 0F E5 // 1 2
   19 * 17	 02 0F 06 00  8D 0F 00 00  06 80 00 80   00 00   0F 0F E5 // 2 0
   20 * 17	 02 0F 07 00  8D 0F 00 00  07 80 00 80   00 00   0F 0F E5 // 2 1
   21 * 17	 02 0F 08 00  8D 0F 00 00  08 80 00 80   00 00   0F 0F E5 // 2 2

//=====================================================================================
// Menu
// Action 1 Define a set of real sprites
   22 * 4	 01 0F 07 01
   23 C:\MPS\_tools\grfcodec\sprites/NewObjTutw.pcx 80 96 09 64 64 -31 -33 // Single
   24 C:\MPS\_tools\grfcodec\sprites/NewObjTutw.pcx 160 96 09 64 64 -31 -33 // E-W x 2
   25 C:\MPS\_tools\grfcodec\sprites/NewObjTutw.pcx 240 96 09 64 64 -31 -33 // N-S x 2
   26 C:\MPS\_tools\grfcodec\sprites/NewObjTutw.pcx 320 96 09 64 64 -31 -33 // E-W x 3
   27 C:\MPS\_tools\grfcodec\sprites/NewObjTutw.pcx 400 96 09 64 64 -31 -33 // N-S x 3
   28 C:\MPS\_tools\grfcodec\sprites/NewObjTutw.pcx 480 96 09 64 64 -31 -33 // 2 x 2
   29 C:\MPS\_tools\grfcodec\sprites/NewObjTutw.pcx 560 96 09 64 64 -31 -33 // 3 x 3

// Action 2 for menu
// <Sprite-number> * <Length> 02 <Feature> <set-id> 00 <groundsprite> <buildingsprite> <xoffset> <yoffset> <xextent> <yextent> <zextent>
   30 * 17	 02 0F 09 00   00 80 00 80   00 00 00 00   00 00   00 00 00 // Single
   31 * 17	 02 0F 0A 00   01 80 00 80   00 00 00 00   00 00   00 00 00 // E-W x 2
   32 * 17	 02 0F 0B 00   02 80 00 80   00 00 00 00   00 00   00 00 00 // N-S x 2
   33 * 17	 02 0F 0C 00   03 80 00 80   00 00 00 00   00 00   00 00 00 // E-W x 3
   34 * 17	 02 0F 0D 00   04 80 00 80   00 00 00 00   00 00   00 00 00 // N-S x 3
   35 * 17	 02 0F 0E 00   05 80 00 80   00 00 00 00   00 00   00 00 00 // 2 x 2
   36 * 17	 02 0F 0F 00   06 80 00 80   00 00 00 00   00 00   00 00 00 // 3 x 3

//=====================================================================================
// varAction2 - Assemble sprites
// Link: http://wiki.ttdpatch.net/tiki-index.php?page=VariationalAction2
// Variables link: http://wiki.ttdpatch.net/tiki-index.php?page=VarAction2Objects
// <Sprite-number> * <Length> 02 <feature> <set-id> <type> <variable> <varadjust> <nvar> (<set-id> <low-range> <high-range>){n} <default>
// The default sprite is always built first and is used for placing the object on the map.
// The numbers atop the cube sprites correspond to the coordinates listed below.
// Single
// Single cube - No assembly required
// E-W x 2
   37 * 14	 02 0F 10 81 40 10 FF 01
	  01 00  01 01
	  00 00
// N-S x 2
   38 * 14	 02 0F 11 81 40 10 FF 01
	  03 00  10 10
	  00 00
// E-W x 3
   39 * 18	 02 0F 12 81 40 10 FF 02
	  01 00  01 01
	  02 00  02 02
	  00 00
// N-S x 3
   40 * 18	 02 0F 13 81 40 10 FF 02
	  03 00  10 10
	  06 00  20 20
	  00 00
// 2 x 2
   41 * 22	 02 0F 14 81 40 10 FF 03
	  			01 00  01 01
	  03 00  10 10	04 00  11 11
	  00 00
// 3 x 3
   42 * 42	 02 0F 15 81 40 10 FF 08
	  			01 00  01 01	02 00  02 02
	  03 00  10 10	04 00  11 11	05 00  12 12	
	  06 00  20 20	07 00  21 21	08 00  22 22
	  00 00

//=====================================================================================
// varAction 2 - Callback 149 returns
// Link: http://wiki.ttdpatch.net/tiki-index.php?page=Callbacks#Land_slope_check_149_
// <Sprite-number> * <Length> 02 <feature> <set-id> <type> <variable> <varadjust> <nvar> (<set-id> <low-range> <high-range>){n} <default>
   43 * 18	 02 0F 16 81 10 00 FF 02 00 80 00 00 00 80 01 0E 09 80 // Single
   44 * 18	 02 0F 17 81 10 00 FF 02 00 80 00 00 00 80 01 0E 0A 80 // N-S x 2
   45 * 18	 02 0F 18 81 10 00 FF 02 00 80 00 00 00 80 01 0E 0B 80 // E-W x 2
   46 * 18	 02 0F 19 81 10 00 FF 02 00 80 00 00 00 80 01 0E 0C 80 // N-S x 3
   47 * 18	 02 0F 1A 81 10 00 FF 02 00 80 00 00 00 80 01 0E 0D 80 // E-W x 3
   48 * 18	 02 0F 1B 81 10 00 FF 02 00 80 00 00 00 80 01 0E 0E 80 // 2 x 2
   49 * 18	 02 0F 1C 81 10 00 FF 02 00 80 00 00 00 80 01 0E 0F 80 // 3 x 3

//=====================================================================================
// Action 2 - Return to graphics
// Link: http://wiki.ttdpatch.net/tiki-index.php?page=Action2
// <Sprite-number> * <Length> 02 <feature> <set-id> <num-ent1> <num-ent2> <entries...>
   50 * 17	 02 0F 1D 85 0C 00 FF FF 01 16 00 49 01 49 01 09 00 // Single
   51 * 17	 02 0F 1E 85 0C 00 FF FF 01 17 00 49 01 49 01 0A 00 // N-S x 2
   52 * 17	 02 0F 1F 85 0C 00 FF FF 01 18 00 49 01 49 01 0B 00 // E-W x 2
   53 * 17	 02 0F 20 85 0C 00 FF FF 01 19 00 49 01 49 01 0C 00 // N-S x 3
   54 * 17	 02 0F 21 85 0C 00 FF FF 01 1A 00 49 01 49 01 0D 00 // E-W x 3
   55 * 17	 02 0F 22 85 0C 00 FF FF 01 1B 00 49 01 49 01 0E 00 // 2 x 2
   56 * 17	 02 0F 23 85 0C 00 FF FF 01 1C 00 49 01 49 01 0F 00 // 3 x 3

//=====================================================================================
// Action 3 Associate with graphics set IDs
// Link: http://wiki.ttdpatch.net/tiki-index.php?page=Action3
// <Sprite-number> * <Length> 03 <feature> <n-id> <ids...> <num-cid> (<cargo-type> <cid>)... <def-cid>
// THE FOLLOWING WARNING SHOULD BE IGNORED
//!!Warning (142): <num-cid> must be 0 for this feature.
   57 * 10	 03 0F 01 00 01 FF 1D 00 00 00 // Single
   58 * 10	 03 0F 01 01 01 FF 1E 00 10 00 // N-S x 2
   59 * 10	 03 0F 01 02 01 FF 1F 00 11 00 // E-W x 2
   60 * 10	 03 0F 01 03 01 FF 20 00 12 00 // N-S x 3
   61 * 10	 03 0F 01 04 01 FF 21 00 13 00 // E-W x 3
   62 * 10	 03 0F 01 05 01 FF 22 00 14 00 // 2 x 2
   63 * 10	 03 0F 01 06 01 FF 23 00 15 00 // 3 x 3

//=====================================================================================
// Action 4 Define vehicle names or other texts
// Link: http://wiki.ttdpatch.net/tiki-index.php?page=Action4
// <Sprite-number> * <Length> 04 <feature> <language-id> <num-ent> <offset> <text>
   64 * 11	 04 48 FF 01 00 D0 "Cube" 00
   65 * 18	 04 48 FF 01 01 D0 "Single Cube" 00
   66 * 14	 04 48 FF 01 02 D0 "2 Cubes" 00
   67 * 18	 04 48 FF 02 03 D0 "E - W" 00 "N - S" 00
   68 * 14	 04 48 FF 01 05 D0 "3 Cubes" 00
   69 * 18	 04 48 FF 02 06 D0 "E - W" 00 "N - S" 00
   70 * 18	 04 48 FF 01 08 DO "Multi Cubes" 00
   71 * 18	 04 48 FF 02 09 D0 "2 x 2" 00 "3 x 3" 00
Here are the sprite sheet for the cubes and the grf for you to preview:
Attachments
NewObjTutw.pcx
The Sprite Sheet
(13.07 KiB) Downloaded 732 times
NewObjTutw.grf
The grf file - requires Windows
Rev 1.2 - July 26, 2010
(11.76 KiB) Downloaded 729 times
Last edited by wallyweb on 08 Oct 2010 13:21, edited 9 times in total.
User avatar
wallyweb
Tycoon
Tycoon
Posts: 6102
Joined: 27 Nov 2004 15:05
Location: Canada

[TTDX] NewObjects Action0 Property 08

Post by wallyweb »

From Action0 Property 08 Object Class:
Unlike Station Classes there is currently no default yet, planed are TRNS for transmitters and LIGH for lighthouses. (For special replacement later). You have to set this before any other property. As with station you can define several objects. Allowed characters: A-Z, 0-9.
Until a fixed set of object classes has been determined, I will maintain a listing here for your reference. These should prove critical to maintaining a reasonably navigable menu. Please post your submissions in this thread.

Used/Proposed to date:
"COMM" - Communications Towers
"LTHS" - Lighthouses
"TRNS" - Power Transmission Towers
"LITE" - Lights (Poles etc.)
"ROCK" - Rocks
User avatar
Nite Owl
Tycoon
Tycoon
Posts: 1889
Joined: 06 Mar 2007 19:32
Location: In The Dark

Re: [TTDX] NewObjects GRF Coding Guide

Post by Nite Owl »

Very nicely done and, as always, brilliantly presented.

If I take out my large two pronged barbecue fork who do I have to poke and/or jab in the ribs to get this fine feature into OpenTTD so we can all take advantage of that which has been wrought by wallyweb. And I mean "take advantage" in the nicest of ways.
Humor is the second most subjective thing on the planet
------------------------------------------------------------
Brevity is the soul of wit and obscenity is its downfall
--------------------------------------------------------
Good Night And Good Luck - Read You Soon
User avatar
planetmaker
OpenTTD Developer
OpenTTD Developer
Posts: 9432
Joined: 07 Nov 2007 22:44
Location: Sol d

Re: [TTDX] NewObjects Action0 Property 08

Post by planetmaker »

Very nice newgrf :-) and even more so a nice guide how to write these kind of newgf.
wallyweb wrote: Used/Proposed to date:
"COMM" - Communications Towers
"LTHS" - Lighthouses
"TRNS" - Power Transmission Towers
"LITE" - Lights (Poles etc.)
"ROCK" - Rocks
Did you add those to the newgrf wiki? You being the first to actually use this feature allows you to set standards ;-) In case of doubt people who code might look at the wiki first.
User avatar
wallyweb
Tycoon
Tycoon
Posts: 6102
Joined: 27 Nov 2004 15:05
Location: Canada

Re: [TTDX] NewObjects Action0 Property 08

Post by wallyweb »

Nite Owl wrote:Very nicely done and, as always, brilliantly presented.
planetmaker wrote:Very nice newgrf :-) and even more so a nice guide how to write these kind of newgf.
Thank you both. :bow:
Did you add those to the newgrf wiki?
Not yet, but a good point indeed. I might provide a link to this thread for now, until a more comprehensive list is assembled. What do you think?
You being the first to actually use this feature allows you to set standards ;-)
Does that make me a "standard bearer"? :lol:
Actually, Lakie is the dev of record (Oskar too as he did the original code) and he might want to take the lead. I'll chase him down and see what he suggests.
User avatar
wallyweb
Tycoon
Tycoon
Posts: 6102
Joined: 27 Nov 2004 15:05
Location: Canada

Re: [TTDX] NewObjects GRF Coding Guide * UPDATE

Post by wallyweb »

The download files have been updated to v1.1 here.

Rocky ground tiles have been added.
Oh look! Rocks!
Oh look! Rocks!
newobjectville_8.png (28.95 KiB) Viewed 26206 times
These are slightly different from what is usually seen in the game.
They are, however, a part of the TTDX graphic set.
It would seem that nobody knows why they were never implemented into the game.
Now you have them.

NOTE: Steep slopes are not supported by newobjects.
User avatar
wallyweb
Tycoon
Tycoon
Posts: 6102
Joined: 27 Nov 2004 15:05
Location: Canada

Re: [TTDX] NewObjects GRF Coding Guide * UPDATE

Post by wallyweb »

There have been internal changes and we are now at TTDPatch nightly r2330 and the NewObjTutw.grf rev is now at 1.2 . The user will see some minor changes in the menu GUI. The coder should now refer to the sample code posted here.
maquinista
Tycoon
Tycoon
Posts: 1828
Joined: 10 Jul 2006 00:43
Location: Spain

Re: [TTDX] NewObjects GRF Coding Guide * UPDATE

Post by maquinista »

I tryed to code the Lamoot radio tower as 8bpp graphic.

I have wrote the NFO code and converted the sprite to 8 bpp, but I can't load it in TTDPatch.
What I'm doing wrong? I have tried some combinations, but It doesn't work.

EDIT: I have fixed it, but I can't build one in game. I will find the problem tomorrow and I will as their author for permission. I have posted the new code:

Code: Select all

// Automatically generated by GRFCODEC. Do not modify!
// (Info version 7)
// Format: spritenum pcxfile xpos ypos compression ysize xsize xrel yrel
    0 * 4	 14 00 00 00
    1 * 142	 08 06 32 "OBJ" "New 8 & 32 bpp objects" 00
"New 8 & 32 bpp houses for OpenTTD & TTDPatch.
Note: the latest version of OpenTTD doesn't support these objects." 00
    2 * 1	 0C
    3 * 1	 0C
    4 * 1	 0C
    5 * 1	 0C
    6 * 1	 0C
    7 * 1	 0C
    8 * 1	 0C
    9 * 1	 0C
   10 * 1	 0C
   11 * 1	 0C
   12 * 1	 0C
   13 * 1	 0C


   14 * 4	 01 0F 01 01
   15 newobjects/Lamoot_radio_tower.pcx    0  0   09   163 52   -25 -132

   16 * 17	 02 0F    00    00    8D 0F 00 00    00 00 00 80    02 02 0C 0C 20

// Sprite for purchase screen, disabled.
//   17 * 17	 02 0F    01    00    8D 0F 00 00    00 00 00 80    02 02 0C 0C 20
   17 * 1	 0C
//  Action 3 disabled, because I don't use a purchase screen sprite for the moment.
//   18 * 10	 03 0F 01 00    01    FF 00 01    00 00
   18 * 7	 03 0F 01 00    00    00 00


   19 * 32	 00 0F    08 01    00
   08  "COMM" // Communications Towers
   0A  00 D4
   0B  0F // Climate availability (all)
   0C  11 // Size
   0D  02 // Build Cost
   0E  17 DE 0A 00
   0F  00 00 02 00
   10  02 00 // Anything Can Remove (2h)


   20 * 25	 04 0F    FF    01 00 D4 "Lamoot radio tower" 00
//   20 * 25	 04 48 FF 01 00 D0 "Lamoot radio tower" 00
Attachments
Lamoot_radio_tower.pcx
PCX file used.
(3.7 KiB) Downloaded 499 times
PNG preview.
PNG preview.
Lamoot_radio_tower.png (2.53 KiB) Viewed 25605 times
Last edited by maquinista on 02 Aug 2010 03:22, edited 4 times in total.
Sorry if my english is too poor, I want learn it, but it isn't too easy.[/list][/size]
User avatar
Lord Aro
Tycoon
Tycoon
Posts: 2369
Joined: 25 Jun 2009 16:42
Location: Location, Location
Contact:

Re: [TTDX] NewObjects GRF Coding Guide * UPDATE

Post by Lord Aro »

like the tower!
damn!, OTTD devs, hurry up with newobjects please! :mrgreen:
AroAI - A really feeble attempt at an AI

It is practically impossible to teach good programming to students that have had a prior exposure to BASIC: as potential programmers they are mentally mutilated beyond hope of regeneration. --Edsger Dijkstra
michael blunck
Tycoon
Tycoon
Posts: 5948
Joined: 27 Apr 2005 07:09
Contact:

Re: [TTDX] NewObjects GRF Coding Guide * UPDATE

Post by michael blunck »

maquinista wrote: [...] I can't build one in game
Your introduction date (prop0E) is later than the end-of-life date (prop0F).


In addition, your text-IDs have to be defined in the D000 range, i.e.:

- 20 * 25 04 0F FF 01 00 D0 "Lamoot radio tower" 00
- (-> action0, prop0A) "0A 00 D0"


Some more remarks:

- you should use a proper grf-ID,
- you should add a class name by prop09,
- flag for "anything can remove" is indeed bit2 (i.e. "4"). "2" (bit1) is "irremovable",
- text IDs should be defined before being referenced in action0.

HTH
regards
Michael
Image
maquinista
Tycoon
Tycoon
Posts: 1828
Joined: 10 Jul 2006 00:43
Location: Spain

Re: [TTDX] NewObjects GRF Coding Guide * UPDATE

Post by maquinista »

michael blunck wrote:
maquinista wrote: [...] I can't build one in game
Your introduction date (prop0E) is later than the end-of-life date (prop0F).


In addition, your text-IDs have to be defined in the D000 range, i.e.:

- 20 * 25 04 0F FF 01 00 D0 "Lamoot radio tower" 00
- (-> action0, prop0A) "0A 00 D0"


Some more remarks:

- you should use a proper grf-ID,
- you should add a class name by prop09,
- flag for "anything can remove" is indeed bit2 (i.e. "4"). "2" (bit1) is "irremovable",
- text IDs should be defined before being referenced in action0.

HTH
regards
Michael
Thanks, It works now.

Some suggestions: a vulcano (10×10), a waterfall, a windmill... These elements could help to avoid the overladnscaping made by the AI.
Attachments
Preview. I'm waiting if their author allows me to release it.
Preview. I'm waiting if their author allows me to release it.
radio_tower.png (31.87 KiB) Viewed 25414 times
Sorry if my english is too poor, I want learn it, but it isn't too easy.[/list][/size]
User avatar
Lakie
TTDPatch Developer
TTDPatch Developer
Posts: 1799
Joined: 26 May 2004 16:37
Location: Britain
Contact:

Re: [TTDX] NewObjects GRF Coding Guide * UPDATE

Post by Lakie »

Actually, the Action0 properties can be either 0xD000+x (same as action4) or 0xD400+x, (preferably the latter).
This said, the Action4 must use 0xD000+x to set the string (regardless of which of the above you use).

~ Lakie
TTDpatch Developer 2005 - 2010 ~ It all started because of shortened vehicle not loading correctly, now look where I've gone with it!
Grfs coded ~ Finnish Train Set (Teaser) | Bm73 (Release 3) | Emu 680 (Release 3)| Glass Station (Release 1) | UK Roadset (Version 1.1a) | New Water Coasts (Version 7)
Pikka: "Lakie's a good coder, but before he'll add any feature to TTDP you have to convince him that you're not going to use it to destroy the world as we know it."
maquinista
Tycoon
Tycoon
Posts: 1828
Joined: 10 Jul 2006 00:43
Location: Spain

Re: [TTDX] NewObjects GRF Coding Guide * UPDATE

Post by maquinista »

This is the Lamoot radio tower (Its author allowed me to release it). I will make some changes, like CC colours in the base or a red blinking light.
Attachments
newobjects_mq.grf
GRF file.
(3.06 KiB) Downloaded 816 times
Sorry if my english is too poor, I want learn it, but it isn't too easy.[/list][/size]
michael blunck
Tycoon
Tycoon
Posts: 5948
Joined: 27 Apr 2005 07:09
Contact:

Re: [TTDX] NewObjects GRF Coding Guide * UPDATE

Post by michael blunck »

maquinista wrote:This is the Lamoot radio tower
It´s not useful to have only one object (building, train, ...) per newgrf, with the exception of a "taster" from a work in progress.

I expect this is the case with yours. 8)

regards
Michael
Image
maquinista
Tycoon
Tycoon
Posts: 1828
Joined: 10 Jul 2006 00:43
Location: Spain

Re: [TTDX] NewObjects GRF Coding Guide * UPDATE

Post by maquinista »

michael blunck wrote:
maquinista wrote:This is the Lamoot radio tower
It´s not useful to have only one object (building, train, ...) per newgrf, with the exception of a "taster" from a work in progress.

I expect this is the case with yours. 8)

regards
Michael
For the moment, I'm adding the preview graphics in the same file, with the permission of the authors.


I have updated the file with the antenna:
http://www.tt-forums.net/viewtopic.php?p=894199#p894199

Maybe I could try to add this famous add used in Spanish roads:
http://commons.wikimedia.org/wiki/File: ... a_A-48.jpg

Also, some motorway signals (most of countries have green or blue signals) would be interesting.
Sorry if my english is too poor, I want learn it, but it isn't too easy.[/list][/size]
User avatar
WWTBAM
Moderator
Moderator
Posts: 3689
Joined: 02 Apr 2005 07:01
Location: Sydney NSW Antipodea
Contact:

Re: [TTDX] NewObjects GRF Coding Guide * UPDATE

Post by WWTBAM »

WallyWeb, I suggest you rename the DOS grf to fit the 8.3 filename limit.
Formerly known as r0b0t_b0y2003, robotboy, roboboy and beclawat. The best place to get the most recent nightly builds of TTDPatch is: http://roboboy.users.tt-forums.net/TTDPatch/nightlies/
User avatar
wallyweb
Tycoon
Tycoon
Posts: 6102
Joined: 27 Nov 2004 15:05
Location: Canada

Re: [TTDX] NewObjects GRF Coding Guide * UPDATE

Post by wallyweb »

robotboy wrote:WallyWeb, I suggest you rename the DOS grf to fit the 8.3 filename limit.
:oops: I forgot about that. I'm away from my home PC but I should have it done in a day or two. Thanks for the heads up.
Post Reply

Return to “Graphics Development”

Who is online

Users browsing this forum: No registered users and 30 guests