Transport Tycoon Forums

The place to talk about Transport Tycoon
It is currently Fri Aug 18, 2017 3:06 am

All times are UTC




Post new topic  Reply to topic  [ 1217 posts ]  Go to page Previous 157 58 59 60 61 Next
Author Message
PostPosted: Sat Nov 26, 2016 9:08 pm 
Offline
Tycoon
Tycoon
User avatar

Joined: Sat Feb 14, 2015 12:44 am
Posts: 1857
Location: Newcastle, Australia
Hi Pyoro and frosch,

I seem to have won and not getting any undefined string messages now. At least not see any visible.

What I done in the language files for instance like Pyoro mention I reduced the strings on many of the objects from this:

Code:
STR_reef4                  :Reef Large Rocks
STR_reef4_purchase_view1   :Reef Rocks
STR_reef4_purchase_view2   :Reef Rocks
STR_reef4_purchase_view3   :Reef Rocks
STR_reef4_purchase_view4   :Reef Rocks


to this

Code:
STR_reef4            :Reef Large Rocks


There would have been over 100 entries that I was able to change like that above and still some I can change in the other object sets I done and doing.

And in the NML file I delete the code for the string switch (switch (FEAT_OBJECTS, SELF, switch_add_text_STR_reef4, view) ...). Not needed anymore, obviously.

Also changed reference to the PURCHASE sprites.

Code:
spriteset (spriteset_reef4_PURCHASE) {
    template_building_low(0,0,"gfx/reef4.png")
}


I did this for all objects that the Purchase sprite was same size as the normal sprite.

frosch wrote:
About your sprite sharing: You can share sprites between different graphic chains and even different objects just fine. Sharing them reduces memory usage.


Good if I can do this, I will alter the class and classnames again so this will share same chains.

Thank you all kindly for your help in solving this problem.

Cheers fellas

Garry

_________________
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: http://www.tt-forums.net/viewtopic.php?f=26&t=74510
AuzBridges: viewtopic.php?f=26&t=75248
AuzStations: viewtopic.php?f=26&t=76390


Top
   
PostPosted: Wed Nov 30, 2016 11:36 am 
Offline
Tycoon
Tycoon
User avatar

Joined: Sun Oct 09, 2011 1:51 pm
Posts: 1372
Location: The Netherlands
Suggestion:
Not sure if it is at all possible (if not please ignore this ;-) )

I often like to make minute changes to other GRFs, replacing just certain graphics and keeping the rest as is. (for example I have edited the UK-roadset in my games in such a way that it displays sidewalks also on rural roads)
Now I do this by recompiling the edited GRF, just with a change to the original name and keeping the same GRF-ID, so I can easily find it in my unused GRF-list next to its original version and it will also not disrupt my save-games or scenarios.

However, in some cases depending on the license of the GRF, these kind of changes are not allowed to be publically released and one needs to contact the original creator(s) of the GRF and donate these sprites, hoping they will be implimented (or implimented as extra option via parameter). This process can take up some time as some creators cant be contacted easily or dont want to make the changes to their GRF.
An example I could give for this is with one of my own sets, the Fake Airport Objects. For the taxiways I use yellow lines, some people suggested that they would like these lines to be thinner/sharper. I dont agree ;-) Therefor I wont impliment this (not even as a parameter, I really dont like the look of it ;-) ). The set is GPL licensed though, so someone else could make these changes and re-release the set, but if they dont add it as a parameter they will need to release it as a completely separate set, including also graphics that havent been changed.
But hopefully that wont be necessary anymore if my suggestion is feasible....

Therefor I would like to know if it is possible to have an option to change graphics within a GRF, working a bit like Action-5 in NFO for replacing base set sprites not present in the original TTD.
For example, by combining the unique GRF-ID of a GRF with an offset to the graphics within it that you want to change.

Is this at all possible and if so, interesting enough to impliment?

_________________
Projects: viewtopic.php?f=26&t=57266
Screenshots: viewtopic.php?f=47&t=56959

Winner of the following screenshot competitions:
sep 2012, jan 2013, apr 2013, aug 2013, mar 2014, mar 2016
All my work is released under GPL-license (either V2 or V3), if not clearly stated otherwise.


Top
   
PostPosted: Sat Jan 07, 2017 10:36 pm 
Offline
Tycoon
Tycoon
User avatar

Joined: Sat Feb 14, 2015 12:44 am
Posts: 1857
Location: Newcastle, Australia
Bounding Boxes.

Can anyone tell me how to add bounding boxes to my coding?

Been told could be reason I having a few graphic issues in the object sets I doing.

Cheers

_________________
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: http://www.tt-forums.net/viewtopic.php?f=26&t=74510
AuzBridges: viewtopic.php?f=26&t=75248
AuzStations: viewtopic.php?f=26&t=76390


Top
   
PostPosted: Sun Jan 08, 2017 12:14 pm 
Offline
OpenTTD Developer
OpenTTD Developer

Joined: Wed Dec 20, 2006 1:31 pm
Posts: 972
Location: Aschaffenburg
Bounding boxes are mostly a myth. While there is a thing called "bounding boxes" in the game, I am 99% sure whoever hinted towards them did not know how bounding boxes work, and bounding boxes won't help fix your issues.
The purpose of bounding boxes is to sort sprites within a tile. But in case of NewObjects there is only one thing on the tile (your object), so there is not much to sort. People often think they can use bounding boxes to sort stuff against stuff on neighbouring tiles, however bounding boxes have hardly any influence on that. (mostly because bounding boxes only affect "how" to draw, but not "what" to draw)

Regarding bounding boxes:
For NewObjects the only part you may possibly want to adjust is "zextent" in the "building" part of your "spritelayout".
Set it to approximately reflect the height of your object. That helps in case of bridges next to your object.

Regarding glitches:
You need to distinguish two types of glitches:
* Glitches because sprites change the order they are drawn in. ("how" to draw)
* Glitches because sprites are skipped, and not drawn at all. ("what" to draw)

Bounding boxes help in the first case, but not in the second.
The most often glitch I see is the second case, when sprites extent over the left or right corner of the tile. In that case you have to cut the object more precisely. (Changing bounding boxes does not affect this, because this is an issue about "what" to draw, and bounding boxes have no influence on that)

_________________
⢇⡸⢸⠢⡇⡇⢎⡁⢎⡱⢸⡱⢸⣭⠀⢸⢜⢸⢸⣀⢸⣀⢸⣭⢸⡱⠀⢰⠭⡆⣫⠰⣉⢸⢸⠀⢰⠭⡆⡯⡆⢹⠁⠀⢐⠰⡁


Top
   
PostPosted: Sun Jan 08, 2017 12:28 pm 
Offline
Tycoon
Tycoon
User avatar

Joined: Sat Feb 14, 2015 12:44 am
Posts: 1857
Location: Newcastle, Australia
Thank you kindly frosch for explain that too me.

Much appreciated and a relief as not need to find out how to install it.

Cheers pal

_________________
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: http://www.tt-forums.net/viewtopic.php?f=26&t=74510
AuzBridges: viewtopic.php?f=26&t=75248
AuzStations: viewtopic.php?f=26&t=76390


Top
   
PostPosted: Thu Jan 12, 2017 9:17 am 
Offline
Tycoon
Tycoon
User avatar

Joined: Sat Feb 14, 2015 12:44 am
Posts: 1857
Location: Newcastle, Australia
I having a play around with my Industry set seeing if I can figure out what different codes do and where to find things.

I playing around with a Industry to open a certain date or close before a certain date.

When I insert this code:
Code:
/* Allow only within the availability years */
switch (FEAT_INDUSTRIES, SELF, timber_siding_check_availability, current_date) {
 date(1840,1,1) .. date(5000000,12,31): timber_siding_available_game_mode;
 return CB_RESULT_IND_NO_CONSTRUCTION;
}


I get this error:
Quote:
Unrecognized identifier 'timber_siding_available_game_mode' encounted


Can someone tell me what am I missing?

Thanks kindly

_________________
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: http://www.tt-forums.net/viewtopic.php?f=26&t=74510
AuzBridges: viewtopic.php?f=26&t=75248
AuzStations: viewtopic.php?f=26&t=76390


Top
   
PostPosted: Thu Jan 12, 2017 11:44 am 
Offline
OpenTTD Developer
OpenTTD Developer
User avatar

Joined: Wed Nov 07, 2007 10:44 pm
Posts: 9016
Location: Sol d
GarryG wrote:
I get this error:
Quote:
Unrecognized identifier 'timber_siding_available_game_mode' encounted


Can someone tell me what am I missing?


It is not defined in the code above. Does it exist or did you mis-spell it?

_________________
Image
OpenTTD: manual | online content | translations | Wanted contributions and patches
#openttdcoop: blog | wiki | public server | DevZone | NewGRF web translator
DevZone - home of the free NewGRFs: OpenSFX | OpenMSX | OpenGFX | Swedish Rails | OpenGFX+ Trains|RV|Industries|Airports|Landscape | NML


Top
   
PostPosted: Thu Jan 12, 2017 12:11 pm 
Offline
Tycoon
Tycoon
User avatar

Joined: Sat Feb 14, 2015 12:44 am
Posts: 1857
Location: Newcastle, Australia
checked and re-check spelling and all looks correct.

The code is what I copied from the Oil_Rigs and I just changed the file it reference to.

Seems like I left some other code out .. as you mentioned "It is not defined in the code above."

I'll sleep on it tonight and try again a fresh in morning.

Cheers and thanks for helping

_________________
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: http://www.tt-forums.net/viewtopic.php?f=26&t=74510
AuzBridges: viewtopic.php?f=26&t=75248
AuzStations: viewtopic.php?f=26&t=76390


Top
   
PostPosted: Fri Feb 24, 2017 12:40 am 
Offline
Tycoon
Tycoon

Joined: Wed Jan 17, 2007 12:14 am
Posts: 6916
going back to the bounding box discussion:

if you want to check your bounding boxes, you can enable newgrf developer tools in the console, and then press Ctrl+B ingame to have the game display them.

what you want to do is have your bounding box roughly the size of the object you draw, but avoid having two bounding boxes overlap (touch is usually fine, although there are some exceptions). that means, sometimes you can avoid glitches by making the bounding box smaller, instead of larger.

the game handles overlapping bounding boxes very poorly (and also, there is no good way to handle it. fixing it for one case will break it for other cases)

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


Top
   
PostPosted: Tue Mar 21, 2017 10:39 am 
Offline
Transport Coordinator
Transport Coordinator

Joined: Mon Nov 07, 2011 7:32 pm
Posts: 304
Location: PL
Hello!
How can I check in NML whether the leading vehicle in the train is engine or not?
I'm using some switches with PARENT argument to determine wagons appearance. But they generates some glitches when the train is waiting in the depot without engine. In this case variable date_of_last_service for the first vehicle (wagon) returns undefined value.
Is it posible to check engine-specific variable (for example: power) to determine vehicle type?

_________________
Image


Top
   
PostPosted: Tue Mar 21, 2017 5:33 pm 
Offline
Tycoon
Tycoon

Joined: Tue Feb 22, 2011 6:34 pm
Posts: 2551
TadeuszD wrote:
Hello!
How can I check in NML whether the leading vehicle in the train is engine or not?
I'm using some switches with PARENT argument to determine wagons appearance. But they generates some glitches when the train is waiting in the depot without engine. In this case variable date_of_last_service for the first vehicle (wagon) returns undefined value.
Is it posible to check engine-specific variable (for example: power) to determine vehicle type?

I think you have 4 options, based on needs, requirements and future plans:
1: You could check for vehicle_is_potentially_powered, if I read the spec right it should return false if the leading vehicle cannot deliver power, which defines a wagon. I'm not sure what would happen if you also use the power callback and that returns 0 in some cases for engines.
2: You check for a range of vehicle IDs, just like I do in the 2cc TrainsInNML to check if wagons can be attached to a train. The check itself has no potential side effects, as it only depends on one value that does not change unless you change it. Downside is that it would break compatibility if you already released your work and the ID grouping has not yet been implemented.
3: Define livery overrides for the wagons on the engines. This only makes sense if the wagons should normally not be used separately of engines and the properties depend on the engine that is in front of them.
4: Check for vehicle_is_in_depot and show some default graphics if that is the case.

_________________
Coder of the Dutch Trackset | Development support for the Dutch Trainset | Coder of the 2cc TrainsInNML


Top
   
PostPosted: Tue Mar 21, 2017 8:56 pm 
Offline
Transport Coordinator
Transport Coordinator

Joined: Mon Nov 07, 2011 7:32 pm
Posts: 304
Location: PL
Transportman wrote:
You could check for vehicle_is_potentially_powered, if I read the spec right it should return false if the leading vehicle cannot deliver power, which defines a wagon. I'm not sure what would happen if you also use the power callback and that returns 0 in some cases for engines.

Thank you, Transportman! I hope that vehicle_is_potentially_powered will be good way for better research. :D
Other methods looks like less usefull, because I have too many loco's and wagon's combinations in my set to prepare all livery overrides or to check all dependencies ID by ID (my engines are not grouped in the way easy to do it).

_________________
Image


Top
   
PostPosted: Sat Apr 08, 2017 2:46 pm 
Offline
Tycoon
Tycoon
User avatar

Joined: Fri Oct 17, 2008 12:17 pm
Posts: 2124
Location: Virgo Supercluster
I'm trying to figure out how to properly animate an object in NML, but the one example I found kinda didn't help me. Well, it did get me started:
First I got this:
Code:
spritelayout spritelayout_parking_11 {
    ground {
        sprite: LOAD_TEMP(1);
   }
   building {
        sprite: spriteset_parking_ground_1(0);
    }
   building {
        sprite: spriteset_parking_cars_1(animation_counter % 4);
    }
}

Nvm the lack of dimensions and such (unless that's the problem ^^).

And then define the object:
Code:
item (FEAT_OBJECTS, item_parking_1) {
    property {
        class:                  "PRLT";
      classname:            string(STR_PRLT);
        name:                   string(STR_PARKING_1);
        climates_available:     ALL_CLIMATES;
        size:                   [1,1];
        build_cost_multiplier:  1;
        remove_cost_multiplier: 1;
        introduction_date:      date(1111,1,1);
        end_of_life_date:       0xFFFFFFFF;
        object_flags:           bitmask(OBJ_FLAG_ANIMATED, OBJ_FLAG_REMOVE_IS_INCOME, OBJ_FLAG_ALLOW_BRIDGE, OBJ_FLAG_ANYTHING_REMOVE);
      animation_info:         [ANIMATION_LOOPING,4];
      animation_speed:      10;
      animation_triggers:      ANIM_TRIGGER_OBJ_TILELOOP;
        height:                 1;
        num_views:              4;
    }
    graphics {
        default:            switch_parking_1_object;
        purchase:           switch_parking_1_purchase;
        autoslope:          return(CB_RESULT_AUTOSLOPE);
        additional_text:    string(STR_PARKING_1_PURCHASE);
    }
}

The "only" problem is that the animation is incredibly fast and kinda glitchy, which I would've thought according to https://newgrf-specs.tt-wiki.net/wiki/N ... tion_speed it shouldn't be. But playing around with values and trying some different things didn't really get me anywhere. Didn't find much in the documentation about animation either :/

So as usual I don't really know what I'm doing here. I'd appreciate if someone could point me in the right direction ;)

edit: &$/$( Figured it out. Should have looked at OpenGFX landscapes first, but forgot it had an animated wind power thing. So I did the frames like that:
Code:
((animation_frame + nearby_tile_random_bits(0,0)) % 3)

And most importantly didn't forget the animation CBs for graphics:
Code:
      anim_control:    return CB_RESULT_NEXT_FRAME;
      anim_next_frame: return CB_RESULT_NEXT_FRAME;

I won't pretend I "get" everything but it works ;)


Last edited by Pyoro on Sat Apr 08, 2017 4:10 pm, edited 1 time in total.

Top
   
PostPosted: Sat Apr 08, 2017 4:09 pm 
Offline
Tycoon
Tycoon
User avatar

Joined: Sun Oct 09, 2011 1:51 pm
Posts: 1372
Location: The Netherlands
Have you tried changing
Code:
ANIM_TRIGGER_OBJ_TILELOOP

to
Code:
ANIM_TRIGGER_OBJ_BUILT


?

EDIT: Saw your edit, never mind the above ;-)

_________________
Projects: viewtopic.php?f=26&t=57266
Screenshots: viewtopic.php?f=47&t=56959

Winner of the following screenshot competitions:
sep 2012, jan 2013, apr 2013, aug 2013, mar 2014, mar 2016
All my work is released under GPL-license (either V2 or V3), if not clearly stated otherwise.


Top
   
PostPosted: Sat Apr 08, 2017 4:14 pm 
Offline
Tycoon
Tycoon
User avatar

Joined: Fri Oct 17, 2008 12:17 pm
Posts: 2124
Location: Virgo Supercluster
Quast65 wrote:
EDIT: Saw your edit, never mind the above ;-)

Sorry, bad timing ^^;

OBJ_BUILT had the fun effect of updating all parking lots whenever a new parking lot was built if I remember that right. Not exactly what I wanted in this case but who knows, might make sense for some obscure object of some kind (a counter-object ^^).


Top
   
PostPosted: Wed Apr 19, 2017 3:22 am 
Offline
Transport Coordinator
Transport Coordinator
User avatar

Joined: Mon Dec 19, 2011 7:54 am
Posts: 358
Location: Washington State, USA
So I'm trying to change a few properties based on chosen parameter settings (properties for which there are no callbacks), and instead of defining all-new items I tried using some kind of nested ternary operators, like so:

Code:
item(...) {
   property {
      speed_limit:                 ((param_difficulty == 0) ? 35 : ((param_difficulty == 1) ? 20 : 0)) mph;


It compiles fine, and seems to work just fine in the game, but is it "safe" to do something like this?

_________________
WSF Ferry Set [WIP] || American Road Replacement Set || NightGFX Base Graphics Set || Wasteland [WIP] || RATT Roads (NRT Only)


Top
   
PostPosted: Thu Apr 20, 2017 7:31 pm 
Offline
Tycoon
Tycoon

Joined: Tue Feb 22, 2011 6:34 pm
Posts: 2551
Why would it not be? It resolves to something constant while using it as changing parameters is a risk for the player.

_________________
Coder of the Dutch Trackset | Development support for the Dutch Trainset | Coder of the 2cc TrainsInNML


Top
   
PostPosted: Sat Apr 22, 2017 9:21 am 
Offline
Transport Coordinator
Transport Coordinator
User avatar

Joined: Mon Dec 19, 2011 7:54 am
Posts: 358
Location: Washington State, USA
Well, I wasn't sure because I've never seen or done anything like this before; I've always defined all properties explicitly except for callbacks. After reading a post about how ternary operators should be avoided I thought there might be some fault with it, so I wanted to make sure. :)

_________________
WSF Ferry Set [WIP] || American Road Replacement Set || NightGFX Base Graphics Set || Wasteland [WIP] || RATT Roads (NRT Only)


Top
   
PostPosted: Mon May 08, 2017 2:21 pm 
Offline
Chairman
Chairman
User avatar

Joined: Sat Jan 18, 2014 6:10 pm
Posts: 875
How to switch industry sounds off?
I tried to define it as empty array: random_sound_effects: [];
but it is not working (I can still hear sawmill sound in my logging camp)

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


Top
   
PostPosted: Mon May 08, 2017 5:55 pm 
Offline
OpenTTD Developer
OpenTTD Developer

Joined: Wed Dec 20, 2006 1:31 pm
Posts: 972
Location: Aschaffenburg
Nothing wrong with that. It should work as you described.

_________________
⢇⡸⢸⠢⡇⡇⢎⡁⢎⡱⢸⡱⢸⣭⠀⢸⢜⢸⢸⣀⢸⣀⢸⣭⢸⡱⠀⢰⠭⡆⣫⠰⣉⢸⢸⠀⢰⠭⡆⡯⡆⢹⠁⠀⢐⠰⡁


Top
   
Display posts from previous:  Sort by  
Post new topic  Reply to topic  [ 1217 posts ]  Go to page Previous 157 58 59 60 61 Next

All times are UTC


Who is online

Users browsing this forum: No registered users and 4 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-2017 phpBB Limited

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