Transport Tycoon Forums

The place to talk about Transport Tycoon
It is currently Thu Oct 18, 2018 3:03 pm

All times are UTC




Post new topic  Reply to topic  [ 1236 posts ]  Go to page Previous 158 59 60 61 62
Author Message
PostPosted: Thu Sep 07, 2017 5:50 pm 
Offline
Engineer
Engineer
User avatar

Joined: Sun Oct 31, 2004 12:43 pm
Posts: 36
Location: Slovakia - Bratislava
Actually the #2 is not really what I wanted to achieve.

At the end of WWII many German buses were taken by the armies and these were later distributed by the ministry of transportation. So basically what happened was that the companies got various buses as a compensation for buses that were in desolate condition (during WWII there was not enough tires and spare parts as all were sent to the armies), and as a compensation for buses taken by the German forces at the end of war for evacuation of German families, officers, etc.

So basically the company sent an order to the ministry and they got buses from a certain pool, not really able to decide what capacity, age or producer/type they will be.

I know, that several railway carriages sets have several variations of the same carriage (like several different liveries) and as you buy it will randomly pick the livery. My question was rather if this can be used on road vehicles and if yes, if it can be used to not only pick the livery, but attributes like running costs, # of passengers, top speed, loading speed, etc.

_________________
Woof !


Top
   
PostPosted: Thu Sep 07, 2017 5:53 pm 
Offline
Engineer
Engineer
User avatar

Joined: Sun Oct 31, 2004 12:43 pm
Posts: 36
Location: Slovakia - Bratislava
andythenorth wrote:
No, the vehicle can be built, but can't be given any station orders (vehicles fitted for pax can't route to truck stations and vice versa).


So, a bus station can't load mail? As if you build a bus station next to a train station, you will have mail and passengers there. So the mail is on the station and the bus will stop at the bus station, which contains mail.

_________________
Woof !


Top
   
PostPosted: Thu Sep 07, 2017 6:31 pm 
Offline
Tycoon
Tycoon
User avatar

Joined: Thu Mar 19, 2009 7:25 pm
Posts: 2619
Location: Kent
Greyfur wrote:
andythenorth wrote:
No, the vehicle can be built, but can't be given any station orders (vehicles fitted for pax can't route to truck stations and vice versa).


So, a bus station can't load mail? As if you build a bus station next to a train station, you will have mail and passengers there. So the mail is on the station and the bus will stop at the bus station, which contains mail.


Yep thats Openttd 101. Buses dont stop at Truck stops and vice versa, regardless of what cargo is waiting

_________________
Image


Top
   
PostPosted: Fri Sep 08, 2017 12:49 pm 
Offline
Tycoon
Tycoon
User avatar

Joined: Sat Jan 18, 2014 6:10 pm
Posts: 1082
andythenorth wrote:
Greyfur wrote:
1) Have a bus transport both passengers and mail at once?

No, the vehicle can be built, but can't be given any station orders (vehicles fitted for pax can't route to truck stations and vice versa).
[I tried it once] :)

Of course they can, just build all scheduled stations as universal freight/passenger stops (bus stop adjacent to truck stop). I tried it many times :)

_________________
My experimental openTTD server: 149.156.194.203:3979 non-standard client, now testing: JGRPP http://tiny.pl/ggnch
Projects: Reproducible Map Generation patch, NewGRFs: Manpower industries, PolTrams, Polroad, 600mm narrow gauge, preindustrial houses, wired, ECS industry extension.
Addicted to freeciv longturn.


Top
   
PostPosted: Fri Sep 15, 2017 9:49 am 
Offline
Engineer
Engineer
User avatar

Joined: Thu Sep 14, 2017 11:59 am
Posts: 10
hello guys,

I recently made an attempt to create my first grf file using the nml language. I am not a good programmer, but with the help of some examples from both the wiki and the forums I succeeded in creating a grf which adds a few fictional planes and other air vehicles for gameplay.

One of these planes is the Arwing from Starfox which has an maximum speed of 5130 km/h. At first I wasn't able to apply this speed to the vehicle, because the maximum speed is 3280 km/h when the property speed is set to 255. After reading several posts of the forums I figured out that this limitation can be lifted with the use of a callback. After applying this to the vehicle I however experienced a problem: due to the enormous speed, the aircraft keeps circling around an airport when trying to land even if the runway is empty.

So my question is: Is there a simple way to make the aircraft slow down when it has reached the airport of destination so that it can land?


Attachments:
ezgif-4-d85d3e9185.gif
ezgif-4-d85d3e9185.gif [ 3.91 MiB | Viewed 1553 times ]
Top
   
PostPosted: Thu Apr 26, 2018 12:46 pm 
Offline
Tycoon
Tycoon
User avatar

Joined: Fri Oct 17, 2008 12:17 pm
Posts: 2385
Location: Virgo Supercluster
I have a question about snow-awareness and animation - I'm always doing it the same way for my tiles:
Code:
spritelayout spritelayout_emptytile_12 {
    ground {
        sprite: 4023;
    }
   building {
        sprite: LOAD_TEMP(1);
      hide_sprite: (terrain_type != TILETYPE_SNOW);
    }
}

So there's the groundtile and if it's above the snowline this switch I copied from somewhere says what other groundtile to draw:
Code:
switch (FEAT_OBJECTS, SELF, switch_emptytile_1_object, [
        //tile slope offset in storage register 0
        STORE_TEMP(slope_to_sprite_offset(tile_slope), 0),
        //terrain type in storage register 1
        STORE_TEMP(GROUNDSPRITE_NORMAL, 1),
      STORE_TEMP( (nearby_tile_terrain_type(0,0) == TILETYPE_DESERT) * GROUNDSPRITE_DESERT, 1),
      STORE_TEMP( LOAD_TEMP(1) + (LOAD_TEMP(1) == 0) * 4512 * (nearby_tile_terrain_type( 1, 0) == TILETYPE_DESERT), 1),
      STORE_TEMP( LOAD_TEMP(1) + (LOAD_TEMP(1) == 0) * 4512 * (nearby_tile_terrain_type(-1, 0) == TILETYPE_DESERT), 1),
      STORE_TEMP( LOAD_TEMP(1) + (LOAD_TEMP(1) == 0) * 4512 * (nearby_tile_terrain_type( 0, 1) == TILETYPE_DESERT), 1),
      STORE_TEMP( LOAD_TEMP(1) + (LOAD_TEMP(1) == 0) * 4512 * (nearby_tile_terrain_type( 0,-1) == TILETYPE_DESERT), 1),
      STORE_TEMP( LOAD_TEMP(1) + (LOAD_TEMP(1) == 0) * GROUNDSPRITE_NORMAL, 1),
      STORE_TEMP(terrain_type == TILETYPE_SNOW   ? GROUNDSPRITE_SNOW : LOAD_TEMP(1), 1),
      STORE_TEMP(snowline_height == 0xFF ? 0xFF : nearby_tile_height(0,0) - snowline_height, 255),
      STORE_TEMP((LOAD_TEMP(255) == -1) ? GROUNDSPRITE_SNOW_1_4 : LOAD_TEMP(1), 1),
      STORE_TEMP((LOAD_TEMP(255) ==  0) ? GROUNDSPRITE_SNOW_2_4 : LOAD_TEMP(1), 1),
      STORE_TEMP((LOAD_TEMP(255) ==  1) ? GROUNDSPRITE_SNOW_3_4 : LOAD_TEMP(1), 1)
        ]) {
    switch_emptytile_1_view;
}

(slope isn't actually needed here but whatever). Anyway, this works reliably, as far as I've found.

But when I do the same thing for an animated ground tile:
Code:
spritelayout spritelayout_field_41 {
   ground {
      sprite: 4202 + (animation_frame * 19);
   }
   building {
      sprite: LOAD_TEMP(1);
      hide_sprite: (terrain_type != TILETYPE_SNOW);
   }

It doesn't work and instead always draws the non-snow groundtile.

However, if I just use the "simple" method:
Code:
spritelayout spritelayout_field_41 {
   ground {
      sprite: 4202 + (animation_frame * 19);
   }
   building {
      sprite: GROUNDSPRITE_SNOW;
      hide_sprite: (terrain_type != TILETYPE_SNOW);
   }

and draw the snow-tile like this (disregarding the transitions) ... it does actually work again.

I've tried a bunch of variations and the results are always the same. Can't "hide" the ground sprite 'cause that causes glitches. Reversing the order of groundsprite and animated sprite doesn't help either. I might have overlooked a possible combination of groundsprites, childsprites, buildings, in various orders, but I've fiddled around quite a bit ^^;

So, basically: why does the load_temp-switch method work for non-animated ground tiles but not for animated ones? And why does it still work if the tile in question is directly given? ^^;
Or, heck, I don't care so much about the "why", and I suppose just losing the snowy transitions isn't such a big deal - but if anyone has a solution I'd still be interested (or maybe there's generally a flaw in the method that could be fixed/improved ;) ).


Top
   
PostPosted: Mon Apr 30, 2018 2:52 pm 
Offline
Tycoon
Tycoon
User avatar

Joined: Fri Oct 17, 2008 12:17 pm
Posts: 2385
Location: Virgo Supercluster
Alright, an easier(?) question.

I thought about doing a date-aware item, and looked at VAST on how to do that with animations, but it's too incomprehensible. Basically he's made some switch that controls animations and then magic happens and it works.
So I decided to just go with what I know and simply hide sprites:
Code:
building { //FRUIT
      sprite: spriteset_fruit(0);
      xoffset: 8;
      yoffset: -8;
      zoffset: 48;
      xextent: 8;
      yextent: 8;
      zextent: 8;
   }
   childsprite {
      sprite: spriteset_fruit(1);
      hide_sprite: current_month != 3;
   }
   childsprite {
      sprite: spriteset_fruit(2);
      hide_sprite: current_month != 4 && current_month != 5 && current_month != 6 && current_month != 7;
   }
   childsprite {
      sprite: spriteset_fruit(3);
      hide_sprite: current_month != 8 && current_month != 9;
   }

And that works, mostly, except that sprites don't update reliably. That never seemed to be an issue if I do the same thing for example for snow-awareness - as soon as the snow is there, the sprite updates. But here date changes and sometimes something happens and sometimes nothing does, unless I zoom in and out, then it refreshes and works properly.

I guess it has something to do with objects not being redrawn randomly all the time, to help performance or whatever, but is there anything I can do about that? Otherwise I guess I'll have to try and figure out how that animation thing actually works ^^;


Top
   
PostPosted: Wed May 02, 2018 7:51 am 
Offline
Tycoon
Tycoon

Joined: Wed Jan 17, 2007 12:14 am
Posts: 7159
basically, you cannot rely on the sprite being redrawn at a specific time, and you cannot trigger that from your NewGRF. The game redraws the tile every 256 ticks ("tileloop"), or whenever it was invisible due to something else (like a window drawn over it, or a vehicle passing by). this works with snow-awareness, because changing snow levels is also done in the tieloop, so it's redrawn then anyway, but you cannot use "current_month" in your calculation, because that changes at different times.

what you instead could do is put your date calculation into the animation callback, and use the animation frame for drawing

_________________
You might not exactly be interested in Ferion, but if you are, have fun :)


Top
   
PostPosted: Tue Sep 18, 2018 9:31 pm 
Offline
Engineer
Engineer

Joined: Fri Aug 09, 2013 6:31 am
Posts: 16
Following the tutorial, I'm trying to make an articulated road vehicle. The vehicle and trailer appear ingame, but for some reason, the trailer sprites don't show up correctly in some views. Let me show you.
Image
That's the expected behaviour, trailer sprite appears above the truck

Image
In this case, the trailer should overlap part of the truck, but it doesn't.

Please check the code. Am I missing something?

[+] Spoiler
Code:
//DEFAULT
spriteset (SpS_TRUCK, "gfx/TRUCKS.png") { TMP_32px_A (0,820) }
spriteset (SpS_TRAILER_000, "gfx/TRUCKS.png") { TMP_32px_A (0,860) }
spriteset (SpS_TRAILER_100, "gfx/TRUCKS.png") { TMP_32px_B (0,860) }

spritegroup SpG_TRAILER {
   loading: [SpS_TRAILER_000, SpS_TRAILER_100];
   loaded:  [SpS_TRAILER_000, SpS_TRAILER_100];
}
//set default gfxs
switch (FEAT_ROADVEHS, SELF, SWI_TRUCK_PartsGFx, position_in_consist ) {
    0: return SpS_TRUCK;
    1: return SpG_TRAILER;
    return SpS_TRUCK;
}

//set number of articulated parts
switch (FEAT_ROADVEHS, SELF, SWI_TRUCK_NumberParts, extra_callback_info1) {
    0: return ITEM_TRUCK;
   1: return ITEM_TRAILER;
    return CB_RESULT_NO_MORE_ARTICULATED_PARTS;
}
//set capacity of each part
switch (FEAT_ROADVEHS, SELF, SWI_TRUCK_PartCap, position_in_consist ) {
    0: return 0;
   1: return 30;
    return 30; //default
}
//to adjust veh length
switch (FEAT_ROADVEHS, SELF, SWI_TRUCK_Length, position_in_consist) {
    0: return 4;
    return 8;
}

item (FEAT_ROADVEHS, ITEM_TRAILER) {
    property {
      sprite_id:                      SPRITE_ID_NEW_ROADVEH;       
       name:                           string(STR_NAME_TRAILER);
        climates_available:             NO_CLIMATE;
        refittable_cargo_classes:       bitmask(CC_PIECE_GOODS);
        non_refittable_cargo_classes:   bitmask();
      cargo_allow_refit:             [];
      cargo_disallow_refit:         [];
      default_cargo_type:            GOOD;
        loading_speed:                  5;
        cost_factor:                    0;
        running_cost_base:              RUNNING_COST_NONE;
      running_cost_factor:            0;
      refit_cost:                     25;
      cargo_age_period:            185;
      power:                          0 hp;
        weight:                         0 ton;
      tractive_effort_coefficient:   0;
      air_drag_coefficient:         0;
      cargo_capacity:                 30;
        sound_effect:                   SOUND_TRUCK_START;
        misc_flags:                     bitmask(ROADVEH_FLAG_2CC, ROADVEH_FLAG_AUTOREFIT);
}
   graphics {
   default: SpG_TRAILER;
   }
}
item (FEAT_ROADVEHS, ITEM_TRUCK) {
    property {
      sprite_id:                      SPRITE_ID_NEW_ROADVEH;       
       name:                           string(STR_NAME_TRUCK);
        climates_available:             ALL_CLIMATES;
        introduction_date:              date(2001,01,01);
        model_life:                     30;
        vehicle_life:                   20;
        reliability_decay:              20;
        refittable_cargo_classes:       bitmask(CC_PIECE_GOODS);
        non_refittable_cargo_classes:   bitmask();
      cargo_allow_refit:             [];
      cargo_disallow_refit:         [];
      default_cargo_type:            GOOD;
        loading_speed:                  5;
        cost_factor:                    20;
        running_cost_base:              RUNNING_COST_ROADVEH;
      running_cost_factor:            125;
      refit_cost:                     25; // Refitting is free (25% purchase cost)
      cargo_age_period:            185;
        speed:                          98 km/h;
      power:                          480 hp;
        weight:                         15 ton;
      cargo_capacity:                 30;
        sound_effect:                   SOUND_TRUCK_START;
        misc_flags:                     bitmask(ROADVEH_FLAG_2CC, ROADVEH_FLAG_AUTOREFIT);
}
   graphics {
   default: SWI_TRUCK_PartsGFx;
   articulated_part: SWI_TRUCK_NumberParts;
   length: SWI_TRUCK_Length;
   cargo_capacity: SWI_TRUCK_PartCap;
   purchase: SpS_TRUCK_Purchase;
   additional_text: string(STR_INFO_TRUCK);
   }
}


Top
   
PostPosted: Tue Sep 18, 2018 10:53 pm 
Offline
Tycoon
Tycoon

Joined: Wed Jan 17, 2007 12:14 am
Posts: 7159
you need to be careful with overlaps, as the game has a rather primitive algorithm of using bounding boxes to decide which sprite must be drawn on top

_________________
You might not exactly be interested in Ferion, but if you are, have fun :)


Top
   
PostPosted: Wed Sep 19, 2018 6:13 pm 
Offline
Director
Director
User avatar

Joined: Mon Apr 17, 2017 4:52 pm
Posts: 618
Location: Western Ile-de-France Region
In this case, the truck's bounding box is in front of the trailer's, so the truck is drawn on top.


Top
   
PostPosted: Sat Oct 06, 2018 7:52 pm 
Offline
Engineer
Engineer
User avatar

Joined: Wed Jul 18, 2018 5:26 pm
Posts: 21
Location: Germany
Hey,
This might be a slightly out of place (in the meaning of wrong thread or forum) question, but will there be any future Updates on Stations (or even any of the other missing Features (0x04, 5, 6, 7, C, E))?

I am currently looking through the code and seeing if I could help out a bit. From the wiki and in the code, I see that only the Action0 Properties are missing for Stations, same Information I get when trying to compile a NML File with an item (FEAT_STATIONS). (And I have never done anything in NFO either, though it doesnt seem to be that hard)

action0properties.py:
Code:
#
# Feature 0x04 (Stations)
#

properties[0x04] = {
   'station_type'                     : [{'size': 4, 'num': 0x08, 'value_function': default_station}, {'size': 4, 'num': 0x08, 'value_function': waypoint}],
   'sprite_layout'                     : {'size': 5, 'num': 0x09},
   'copy_sprite_layout'               : {'size': 1, 'num': 0x0A},
   'callback_flags'                  : {'size': 1, 'num': 0x0B},
   'number_of_disabled_platforms'         : {'size': 1, 'num': 0x0C},
   'number_of_disabled_platforms_length'   : {'size': 1, 'num': 0x0D},
   'custom_layout'                     : {'size': 5, 'num': 0x0E},
   'copy_layout_by_station_id'            : {'size': 1, 'num': 0x0F},
   'lots_threshold'                  : {'size': 2, 'num': 0x10},
   'pylon_placement'                  : {'size': 1, 'num': 0x11},
   'cargo_type_sprites'               : {'size': 4, 'num': 0x12},
   'general_flags'                     : {'size': 1, 'num': 0x13},
   'overhead_wire_placement'            : {'size': 1, 'num': 0x14},
   'allow_train_to_enter'               : {'size': 1, 'num': 0x15},
   'animation_info'                  : {'size': 2, 'num': 0x16},
   'animation_speed'                  : {'size': 1, 'num': 0x17},
   'animation_triggers'               : {'size': 2, 'num': 0x18},
   # 19 Road Routing not yet implemented
   'register_modifiers'               : {'size': 5, 'num': 0x1A},
}


global_constants.py:
Code:
# Stations Callback Flags
   'AVAILABLE_CONSTRUCTION':         0,
   '':                           1,
   '':                           2,
   '':                           3,
   '':                           4,

   # Stations General Flags
   'DIFFERENT_GROUND_SPRITES':         0,
   'SIMULATE_CARGO_OVER_TILES':      1,
   '':                           2,
   'CUSTOM_FOUNDATION_ON_SLOPE':      3,
   'USE_EXTENDED_FOUNDATION_ON_SLOPE':   4,

   #Stations Animation triggers
   'STATION_PART_IS_BUILT':         0,
   'NEW_CARGO_AT_STATION':            1,
   'CARGO_REMOVED_FROM_STATION':      2,
   'TRAIN_ENTERS_STATION':            3,
   'TRAIN_LEAVES_STATION':            4,
   'TRAIN_LOADS_CARGO':            5,
   'REGULAR_RELOAD':               6,

   #Stations Custom layout
   'PLAIN_PLATFORM':               0x00;
   'PLATFORM_WITH_BUILDING':         0x02;
   'PLATFORM_WITH_ROOF_LEFT':         0x04;
   'PLATFORM_WITH_ROOF_RIGHT':         0x06;


Some of this might be wrong, or not work, so any Info and Help on how to continue would be nice :D
Also it would be great if any of the Devs that already know how nml works, continue adding the missing features and I would be happy to help!
Also, I haven't quite figured out how to compile yet, if anyone could show how to that would be great!
Thanks


Top
   
PostPosted: Mon Oct 15, 2018 7:09 am 
Offline
Engineer
Engineer
User avatar

Joined: Sun Oct 31, 2004 12:43 pm
Posts: 36
Location: Slovakia - Bratislava
Is it possible to do new graphics for stations in NML? The online wiki page says it is not, but it also says it has not been updated for 6 years...

Thank you!

_________________
Woof !


Top
   
PostPosted: Mon Oct 15, 2018 10:49 am 
Offline
Director
Director
User avatar

Joined: Mon Apr 17, 2017 4:52 pm
Posts: 618
Location: Western Ile-de-France Region
No, you cannot yet code stations with NML.


Top
   
PostPosted: Mon Oct 15, 2018 11:51 am 
Offline
Tycoon
Tycoon
User avatar

Joined: Sat Feb 14, 2015 12:44 am
Posts: 2531
Location: Newcastle, Australia
If any one want to build stations .. can be done in NFO.

Quast65 has a tutorial in Simuscape at
http://www.simuscape.net/simutalk/viewt ... e6a57974f2

Step by step guide making platforms and station buildings both track and non-tracks.

_________________
Soot Happens
All my projects are GPLv2 License.
AuzTrains & NSWTrains: http://www.tt-forums.net/viewtopic.php?f=26&t=74193
AuzInd (Industry Set): http://www.tt-forums.net/viewtopic.php?f=26&t=74471
AuzObjects: viewtopic.php?f=26&t=75657
AuzBridges: viewtopic.php?f=26&t=75248
AuzStations: viewtopic.php?f=26&t=76390
AuzTracks: viewtopic.php?f=26&t=82691


Top
   
PostPosted: Mon Oct 15, 2018 9:21 pm 
Offline
Director
Director
User avatar

Joined: Mon Apr 17, 2017 4:52 pm
Posts: 618
Location: Western Ile-de-France Region
m4nfo is also a language that I have tried for coding stations and it seems to work quite well... If only I could have some help from the developer...


Top
   
Display posts from previous:  Sort by  
Post new topic  Reply to topic  [ 1236 posts ]  Go to page Previous 158 59 60 61 62

All times are UTC


Who is online

Users browsing this forum: No registered users and 2 guests


You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot post attachments in this forum

Search for:
Jump to:  
Powered by phpBB © 2000-2018 phpBB Limited

Copyright © Owen Rudge/The Transport Tycoon Forums 2001-2018.
Hosted by Zernebok Hosting.