Help learning NML

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

Moderator: Graphics Moderators

oberhümer
Tycoon
Tycoon
Posts: 1283
Joined: 23 Oct 2009 19:35
Location: Here and there, sometime or another

Re: Help learning NML

Post by oberhümer »

The coordinates of the top left point of the first sprite in the set, which is also on the (top) left.

And there is no direct way to set the tractive effort, if you want a specific value x you need to set the coefficient to x / (10 * (weight of the vehicle in tons) * 255), keep in mind that the maximum is ten times the vehicle weight (i.e. (coefficient) = 255 1).
Last edited by oberhümer on 15 Jul 2011 20:21, edited 1 time in total.
--- Licenses: GNU LGPL, version 2 or newer, code and graphics. CC-By-SA, graphics, alternatively. If you're using any, I'd like to hear about it --- Call them "track types" ---
--- Mostly inactive developer for: NuTracks - Central European Train Set --- Running/compiling for: Linux (x86) - Android - Windows (32/64 bit) ---

--- Need a file packer? 7-Zip --- BOINC - use your computing power to benefit science --- Block trackers, not ads --- Unix in dispersible pellets, the formula for the future. ---
User avatar
NekoMaster
Tycoon
Tycoon
Posts: 4001
Joined: 16 Aug 2008 22:26
Skype: neko-master
Location: Oshawa, Ontario, CANADA

Re: Help learning NML

Post by NekoMaster »

Well I tried setting tractive_effort_coefficient to 1 and I got like... 2010 kN TE when the vehicle weight was 121 Tons (I think thats what a EMD E9 Weighs)

EDIT : I set the coordinates to 0, 0 and nothing happened, its still the Jubilie sprite in the game.
Last edited by NekoMaster on 15 Jul 2011 20:18, edited 1 time in total.
Image Proud Canadian Image
Nekomasters Projects! (Downloads available on BaNaNaS!) \(>^w^<)/
# NARS ADD-ON SET 2CC | 2cc Rapid Transit For Me! (2ccRTFM) | 2cc Wagons In NML (2ccWIN)
# NML Category System (Organize your GRFS!) <- TT-Forums Exclusive Download!
oberhümer
Tycoon
Tycoon
Posts: 1283
Joined: 23 Oct 2009 19:35
Location: Here and there, sometime or another

Re: Help learning NML

Post by oberhümer »

Whoops, sorry, I was thinking of NFO. In NML, you leave out the multiplication by 255, so 1 is actually the maximum value.

And if you want to use your own sprites, you need to set "sprite_id" to SPRITE_ID_NEW_TRAIN.
Last edited by oberhümer on 15 Jul 2011 20:26, edited 1 time in total.
--- Licenses: GNU LGPL, version 2 or newer, code and graphics. CC-By-SA, graphics, alternatively. If you're using any, I'd like to hear about it --- Call them "track types" ---
--- Mostly inactive developer for: NuTracks - Central European Train Set --- Running/compiling for: Linux (x86) - Android - Windows (32/64 bit) ---

--- Need a file packer? 7-Zip --- BOINC - use your computing power to benefit science --- Block trackers, not ads --- Unix in dispersible pellets, the formula for the future. ---
User avatar
NekoMaster
Tycoon
Tycoon
Posts: 4001
Joined: 16 Aug 2008 22:26
Skype: neko-master
Location: Oshawa, Ontario, CANADA

Re: Help learning NML

Post by NekoMaster »

Well how do i get a lower value then 1 if 1 is the max? I tried a negative and a decimal but nothing works.... im sure the EMD e9 didn't have 1205 kn TE
Image Proud Canadian Image
Nekomasters Projects! (Downloads available on BaNaNaS!) \(>^w^<)/
# NARS ADD-ON SET 2CC | 2cc Rapid Transit For Me! (2ccRTFM) | 2cc Wagons In NML (2ccWIN)
# NML Category System (Organize your GRFS!) <- TT-Forums Exclusive Download!
oberhümer
Tycoon
Tycoon
Posts: 1283
Joined: 23 Oct 2009 19:35
Location: Here and there, sometime or another

Re: Help learning NML

Post by oberhümer »

Use decimals, and show me how exactly your code looks at the moment.
--- Licenses: GNU LGPL, version 2 or newer, code and graphics. CC-By-SA, graphics, alternatively. If you're using any, I'd like to hear about it --- Call them "track types" ---
--- Mostly inactive developer for: NuTracks - Central European Train Set --- Running/compiling for: Linux (x86) - Android - Windows (32/64 bit) ---

--- Need a file packer? 7-Zip --- BOINC - use your computing power to benefit science --- Block trackers, not ads --- Unix in dispersible pellets, the formula for the future. ---
User avatar
NekoMaster
Tycoon
Tycoon
Posts: 4001
Joined: 16 Aug 2008 22:26
Skype: neko-master
Location: Oshawa, Ontario, CANADA

Re: Help learning NML

Post by NekoMaster »

Well I figured out how to do the decimals, it needs a 0.## not a .##

Though I still have that sprite problem

Code: Select all

grf {
   grfid : "NML1";
   name:      string(STR_GRF_NAME);
   desc:      string(STR_GRF_DESCRIPTION);
   version:   1;
   min_compatible_version:   5;
}

template template_train(x, y) {
   //[left_x,   upper_y,    width,    height,    offset_x,    offset_y]
   [x,        y,        10,      28,         -4,         -11]
   [x+ 20,    y,          26,      28,        -17,       -14]
   [x+ 50,    y,          36,      28,        -18,       -20]
   [x+ 90,    y,          26,      28,         -9,       -15]
   [x+120,    y,        10,      28,         -4,         -11]
   [x+140,    y,          26,      28,        -16,       -16]
   [x+170,    y,          36,      28,        -18,       -20]
   [x+210,    y,          26,      28,         -8,       -16]
}

spriteset(spriteset_train_graphics, "gfx/train.png") {
   template_train(0, 0)
}

spritegroup spritegroup_train_graphics {
   //graphics for loaded and not loaded are the same
   loading: spriteset_train_graphics;
   loaded: spriteset_train_graphics;
}

item (FEAT_TRAINS, rail_engine) {
   property {
      sprite_id:                  01;
      name:                     string(STR_NAME_TRAIN);
      climates_available:          ALL_CLIMATES;
      introduction_date:            date(1954,1,1);
      model_life:                  20;
      retire_early:               0;
      vehicle_life:               30;
      cost_factor:               226;
      running_cost_factor:         242;
      speed:                     177 km/h;
      power:                      2400 hp;
      weight:                   121 ton;
      cargo_capacity:             0;
      tractive_effort_coefficient:    0.01;
   }
   
   graphics {
      spritegroup_train_graphics;
   }
}
Image Proud Canadian Image
Nekomasters Projects! (Downloads available on BaNaNaS!) \(>^w^<)/
# NARS ADD-ON SET 2CC | 2cc Rapid Transit For Me! (2ccRTFM) | 2cc Wagons In NML (2ccWIN)
# NML Category System (Organize your GRFS!) <- TT-Forums Exclusive Download!
oberhümer
Tycoon
Tycoon
Posts: 1283
Joined: 23 Oct 2009 19:35
Location: Here and there, sometime or another

Re: Help learning NML

Post by oberhümer »

oberhümer wrote:[... 1 is actually the maximum value.]

And if you want to use your own sprites, you need to set "sprite_id" to SPRITE_ID_NEW_TRAIN.
You may also find that 0.01 is a bit low, the default is 0.3.
--- Licenses: GNU LGPL, version 2 or newer, code and graphics. CC-By-SA, graphics, alternatively. If you're using any, I'd like to hear about it --- Call them "track types" ---
--- Mostly inactive developer for: NuTracks - Central European Train Set --- Running/compiling for: Linux (x86) - Android - Windows (32/64 bit) ---

--- Need a file packer? 7-Zip --- BOINC - use your computing power to benefit science --- Block trackers, not ads --- Unix in dispersible pellets, the formula for the future. ---
User avatar
FooBar
Tycoon
Tycoon
Posts: 6553
Joined: 21 May 2007 11:47
Location: The Netherlands
Contact:

Re: Help learning NML

Post by FooBar »

As for the sprite problem, you need to tweak the left_x, width and height values. They are still from what I use in the Dutch Tram Set, but your sprite sheet is different. Width and height are the width and height of each sprite. The x+... values indicate the difference between the top left corner of the first sprite and the top left corner of the sprite you're at, so that will be x+16, x+48, x+96 etc.

When that's done you can use the ingame sprite aligner to figure out the offset_x and offset_y values. Ctrl+B also helps here to get the sprite in the middle of the bounding box. A good starting point is taking the negative of half the sprite width resp. height for offset_x resp offset_y.
Post Reply

Return to “NewGRF Technical Discussions”

Who is online

Users browsing this forum: No registered users and 19 guests