[OTTD] 2cc TrainsInNML - Current version: 3.0

Find and discuss all the latest NewGRF releases for TTDPatch and OpenTTD here.

Moderator: Graphics Moderators

Post Reply
User avatar
Voyager One
Tycoon
Tycoon
Posts: 11204
Joined: 28 Dec 2009 09:47
Location: Rijeka, Croatia

Re: [OTTD] 2cc TrainsInNML - Current version: 2.0-alpha1

Post by Voyager One »

NekoMaster wrote:As I'm working on my own GRF set for OpenTTD, NARS Add-on Set, I was wondering if it'd be ok to use sprites from the 2cc Train Set.
All my sprites are always freely available to all who simply ask. :)
Leon

Image Image Image Image
"... all I ask is a tall ship and a star to steer her by..." - John Masefield
Transportman
Tycoon
Tycoon
Posts: 2781
Joined: 22 Feb 2011 18:34

Re: [OTTD] 2cc TrainsInNML - Current version: 2.0-alpha1

Post by Transportman »

Diesel Power wrote:Just spotted the 4th Gen box cars do the same thing. The 5th Gen box cars, the graphics are swapped for all cargoes
I'll just check all box cars one day, based on your reports it seems that there are some things mixed up there.
NekoMaster wrote:I'd like to thank Transportman and all the artists of 2cc Trains for making this set a possibility. Its always nice to have a variety of locomotives to play with :D

As I'm working on my own GRF set for OpenTTD, NARS Add-on Set, I was wondering if it'd be ok to use sprites from the 2cc Train Set. I understand giving credit and I believe I need to have my set licensed under the same license as 2cc Set (Which I believe is GPL v2?)
I'm no license expert, but that is the summary for GPL v2. And it is not necessary to make your whole set GPL v2 if you use parts of the 2cc Set, but only the parts you use should be GPL v2.
Coder of the Dutch Trackset | Development support for the Dutch Trainset | Coder of the 2cc TrainsInNML
User avatar
NekoMaster
Tycoon
Tycoon
Posts: 4001
Joined: 16 Aug 2008 22:26
Skype: neko-master
Location: Oshawa, Ontario, CANADA

Re: [OTTD] 2cc TrainsInNML - Current version: 2.0-alpha1

Post by NekoMaster »

Voyager One wrote:
NekoMaster wrote:As I'm working on my own GRF set for OpenTTD, NARS Add-on Set, I was wondering if it'd be ok to use sprites from the 2cc Train Set.
All my sprites are always freely available to all who simply ask. :)
Well I hope you don't mind if I use your sprites. I made sure to save space on my sprite sheets to credit people (and add a avatar or logo if available). Though I mostly plan on using 2cc Train Sprites as functional place holders until they can be replaced with NARS style graphics, when ever that will be for some things.
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!
User avatar
Voyager One
Tycoon
Tycoon
Posts: 11204
Joined: 28 Dec 2009 09:47
Location: Rijeka, Croatia

Re: [OTTD] 2cc TrainsInNML - Current version: 2.0-alpha1

Post by Voyager One »

NekoMaster wrote:I made sure to save space on my sprite sheets to credit people
Nah, don't worry about that. You've asked politely, you're welcome to have them. That's all that's required if you ask me. :wink:
Transportman wrote:based on your reports it seems that there are some things mixed up there.
Graphics-wise or code-wise?
Leon

Image Image Image Image
"... all I ask is a tall ship and a star to steer her by..." - John Masefield
Transportman
Tycoon
Tycoon
Posts: 2781
Joined: 22 Feb 2011 18:34

Re: [OTTD] 2cc TrainsInNML - Current version: 2.0-alpha1

Post by Transportman »

Voyager One wrote:
Transportman wrote:based on your reports it seems that there are some things mixed up there.
Graphics-wise or code-wise?
Quick check indicates that it is code-wise, the Type 2 switches point to the Type 1 sprites for some cargoes.
Coder of the Dutch Trackset | Development support for the Dutch Trainset | Coder of the 2cc TrainsInNML
NeutralHavoc
Engineer
Engineer
Posts: 3
Joined: 27 Jul 2016 00:13

Re: [OTTD] 2cc TrainsInNML - Current version: 2.0-alpha1

Post by NeutralHavoc »

Hey, I've been using this GRF in combination with FIRS, and one thing i've noticed is that first and second generation tankers (don't know about the other gens, haven't tested on those) load up/drop off their cargo instantly (at least for Oil and Petroleum, also haven't tested on other kinds of liquid cargoes).

Just wanted to report this issue and give a big thank you to everyone involved in the making of this train set, as it has been the most enjoyable out of the ones i have tried. Cheers.
Transportman
Tycoon
Tycoon
Posts: 2781
Joined: 22 Feb 2011 18:34

Re: [OTTD] 2cc TrainsInNML - Current version: 2.0-alpha1

Post by Transportman »

That is the result of the "low" capacities of those vehicles compared to their loading speed. All cargo wagons have the same loading speed of 20, and with capacities around that, you'll get instant load and unload. I might need to tweak those loading speeds a bit.
Coder of the Dutch Trackset | Development support for the Dutch Trainset | Coder of the 2cc TrainsInNML
NeutralHavoc
Engineer
Engineer
Posts: 3
Joined: 27 Jul 2016 00:13

Re: [OTTD] 2cc TrainsInNML - Current version: 2.0-alpha1

Post by NeutralHavoc »

Transportman wrote:That is the result of the "low" capacities of those vehicles compared to their loading speed. All cargo wagons have the same loading speed of 20, and with capacities around that, you'll get instant load and unload. I might need to tweak those loading speeds a bit.
Nice, glad to see that you've already found the root of the problem. Thanks!
Transportman
Tycoon
Tycoon
Posts: 2781
Joined: 22 Feb 2011 18:34

Re: [OTTD] 2cc TrainsInNML - Current version: 2.0-alpha1

Post by Transportman »

NeutralHavoc wrote:
Transportman wrote:That is the result of the "low" capacities of those vehicles compared to their loading speed. All cargo wagons have the same loading speed of 20, and with capacities around that, you'll get instant load and unload. I might need to tweak those loading speeds a bit.
Nice, glad to see that you've already found the root of the problem. Thanks!
I found the root, but I'm not sure on whether it will be fixed, and if it will be fixed, how it would be fixed and when that would be done.

First solution that sprints to my mind, would be to use (fixed) loading times, instead of fixed loading speeds. Now all cargo wagons have the same loading speed (same for coached, which have a fixed loading speed depending on passenger type). I think that would be the best solution, although it would require some rewrites which would take some time. However, those rewrites I already had in mind that they should happen at some point, so that would not mean a lot of extra work.
Coder of the Dutch Trackset | Development support for the Dutch Trainset | Coder of the 2cc TrainsInNML
Kogut
Tycoon
Tycoon
Posts: 2493
Joined: 26 Aug 2009 06:33
Location: Poland

Re: [OTTD] 2cc TrainsInNML - Current version: 2.0-alpha1

Post by Kogut »

I am not sure what went wrong, but this newgrf is configured to inform AIs that all train engines can pull solely passenger carriages.

https://noai.openttd.org/api/trunk/clas ... 7405eb0f14 is not promised to be always right, but I never encountered trainset that would give so wrong information.

I attached test AI listing what this function gives to AI.

To run it put archive into

Code: Select all

content_download/ai
folder.

Start OpenTTD, start game with 2cc in NML newgrf, use ~ to enable console, type

Code: Select all

start_ai TEST
press enter.

AI will deliberately crash to show log window. Note that all engines are listed as able to handle solely passengers.

For reference: AI log loop.

Code: Select all

{
	local cargo_list=AICargoList();
	local engines = AIEngineList(AIVehicle.VT_RAIL);

	for (local engine = engines.Begin(); !engines.IsEnd(); engine = engines.Next()) {
		if(AIEngine.IsWagon(engine)){
			continue;		
		}
		for (local cargo = cargo_list.Begin(); !cargo_list.IsEnd(); cargo = cargo_list.Next()) {
			local state = "is not able";
			if(AIEngine.CanPullCargo(engine, cargo)){
				state = "is able";
				AILog.Info(AIEngine.GetName(engine) + " " + state + " to pull " + AICargo.GetCargoLabel(cargo));
			}
		}
	}
}
Attachments
2cc.sav
(102.63 KiB) Downloaded 118 times
trainset_lister.tar
(101 KiB) Downloaded 138 times
Selection_001.png
Selection_001.png (34.17 KiB) Viewed 1703 times
Correct me If I am wrong - PM me if my English is bad
AIAI - AI for OpenTTD
Transportman
Tycoon
Tycoon
Posts: 2781
Joined: 22 Feb 2011 18:34

Re: [OTTD] 2cc TrainsInNML - Current version: 2.0-alpha1

Post by Transportman »

Kogut wrote:I am not sure what went wrong, but this newgrf is configured to inform AIs that all train engines can pull solely passenger carriages.

https://noai.openttd.org/api/trunk/clas ... 7405eb0f14 is not promised to be always right, but I never encountered trainset that would give so wrong information.

I attached test AI listing what this function gives to AI.

To run it put archive into

Code: Select all

content_download/ai
folder.

Start OpenTTD, start game with 2cc in NML newgrf, use ~ to enable console, type

Code: Select all

start_ai TEST
press enter.

AI will deliberately crash to show log window. Note that all engines are listed as able to handle solely passengers.

For reference: AI log loop.

Code: Select all

{
	local cargo_list=AICargoList();
	local engines = AIEngineList(AIVehicle.VT_RAIL);

	for (local engine = engines.Begin(); !engines.IsEnd(); engine = engines.Next()) {
		if(AIEngine.IsWagon(engine)){
			continue;		
		}
		for (local cargo = cargo_list.Begin(); !cargo_list.IsEnd(); cargo = cargo_list.Next()) {
			local state = "is not able";
			if(AIEngine.CanPullCargo(engine, cargo)){
				state = "is able";
				AILog.Info(AIEngine.GetName(engine) + " " + state + " to pull " + AICargo.GetCargoLabel(cargo));
			}
		}
	}
}
I guess the problem is that the ai_special_flag is set to AI_FLAG_PASSENGER for all vehicles (at least, I assume that CanPullCargo looks at that flag). It would indeed be better to set it to AI_FLAG_CARGO for engines that are really meant for cargo.

Nice use of the AI functionality BTW.
Coder of the Dutch Trackset | Development support for the Dutch Trainset | Coder of the 2cc TrainsInNML
Kogut
Tycoon
Tycoon
Posts: 2493
Joined: 26 Aug 2009 06:33
Location: Poland

Re: [OTTD] 2cc TrainsInNML - Current version: 2.0-alpha1

Post by Kogut »

Transportman wrote:I guess the problem is that the ai_special_flag is set to AI_FLAG_PASSENGER for all vehicles (at least, I assume that CanPullCargo looks at that flag). It would indeed be better to set it to AI_FLAG_CARGO for engines that are really meant for cargo.
It seems quite likely. CanPullCargo checks solely whatever engine is passenger only (except cases of passenger cargo). To be more exact it is also checked whatever engine is valid, is engine a train vehicle, is cargo valid - but it is neither interesting nor causing problems here.

So I would expect that fixing AI_FLAG_PASSENGER will fix the issue.

Code: Select all

/* static */ bool ScriptEngine::CanPullCargo(EngineID engine_id, CargoID cargo_id)
{
	if (!IsValidEngine(engine_id)) return false;
	if (GetVehicleType(engine_id) != ScriptVehicle::VT_RAIL) return false;
	if (!ScriptCargo::IsValidCargo(cargo_id)) return false;

	return (::RailVehInfo(engine_id)->ai_passenger_only != 1) || ScriptCargo::HasCargoClass(cargo_id, ScriptCargo::CC_PASSENGERS);
}
from /trunk/src/script/api/script_engine.cpp
Correct me If I am wrong - PM me if my English is bad
AIAI - AI for OpenTTD
Kogut
Tycoon
Tycoon
Posts: 2493
Joined: 26 Aug 2009 06:33
Location: Poland

Re: [OTTD] 2cc TrainsInNML - Current version: 2.0-alpha1

Post by Kogut »

I just encountered description of exactly the same bug in 2cc 6 years ago - viewtopic.php?f=65&t=49096

http://dev.openttdcoop.org/issues/1067 with http://dev.openttdcoop.org/projects/2cc ... ngine.tnfo fix are relevant.
Correct me If I am wrong - PM me if my English is bad
AIAI - AI for OpenTTD
Transportman
Tycoon
Tycoon
Posts: 2781
Joined: 22 Feb 2011 18:34

Re: [OTTD] 2cc TrainsInNML - Current version: 2.0-alpha1

Post by Transportman »

Thanks for all the information. I made an issue for it to keep track of it. The flag just got copied over from vehicle to vehicle, I did not think the value really mattered.
Coder of the Dutch Trackset | Development support for the Dutch Trainset | Coder of the 2cc TrainsInNML
User avatar
Maddog45353
Engineer
Engineer
Posts: 112
Joined: 26 Jun 2013 09:00

Re: [OTTD] 2cc TrainsInNML - Current version: 2.0-alpha1

Post by Maddog45353 »

This still being updated or maintained?
LoneBlackWolf
User avatar
Sylf
President
President
Posts: 957
Joined: 23 Nov 2010 21:25
Location: ::1

Re: [OTTD] 2cc TrainsInNML - Current version: 2.0-alpha1

Post by Sylf »

Seeing that the last non-translation update to the project was made less than a month ago, my best guess is yes, it is still maintained.
User avatar
Voyager One
Tycoon
Tycoon
Posts: 11204
Joined: 28 Dec 2009 09:47
Location: Rijeka, Croatia

Re: [OTTD] 2cc TrainsInNML - Current version: 2.0-alpha1

Post by Voyager One »

Maddog45353 wrote:This still being updated or maintained?
Of course it is, this is still WIP. Unfortunately, real life comes first and you just need to wait a bit... :wink:
Leon

Image Image Image Image
"... all I ask is a tall ship and a star to steer her by..." - John Masefield
Transportman
Tycoon
Tycoon
Posts: 2781
Joined: 22 Feb 2011 18:34

Re: [OTTD] 2cc TrainsInNML - Current version: 2.0-alpha1

Post by Transportman »

Maddog45353 wrote:This still being updated or maintained?
Yes, this set is still being updated/maintained, but as Voyager One already indicated, real life comes first, and real life is very busy.

Most issues that are currently repored on the DevZone are not really high impact, but just require a larger chunk of time. They do need to be done at some point, it just is that I'm busy and it is not really hurting that they are not fixed immediately. Issues that are very easy to fix or are really breaking stuff I will try to fix ASAP, but the rest is currently on some kind of holding pattern.

Just curious, why are you asking?
Coder of the Dutch Trackset | Development support for the Dutch Trainset | Coder of the 2cc TrainsInNML
Cadde
Transport Coordinator
Transport Coordinator
Posts: 290
Joined: 07 Oct 2004 12:51

Re: [OTTD] 2cc TrainsInNML - Current version: 2.0-alpha1

Post by Cadde »

IIRC, 2cc trainset (the non NML version) had variable running costs based on current consist speed. If the vehicle was stopped, running costs were low whereas if the consist went faster than one of it's wagons design speeds (required wagon speed limits to be off), running costs would exponentially increase with overspeeding.
Is there any chance of this happening in the NML version?

Or, can someone better versed in NML explain to me how to set up that particular callback because i looked around and the documentation is unclear at best on that particular subject. I.E, where does the declaration for "running_cost_factor" go when one wants to use a callback? I assume in the "graphics" block.
And how do i access the current vehicle speed from within the callback?
User avatar
supermop
Tycoon
Tycoon
Posts: 1104
Joined: 21 Feb 2010 00:15
Location: Fitzroy North - 96

Re: [OTTD] 2cc TrainsInNML - Current version: 2.0-alpha1

Post by supermop »

Cadde wrote:IIRC, 2cc trainset (the non NML version) had variable running costs based on current consist speed. If the vehicle was stopped, running costs were low whereas if the consist went faster than one of it's wagons design speeds (required wagon speed limits to be off), running costs would exponentially increase with overspeeding.
Is there any chance of this happening in the NML version?

Or, can someone better versed in NML explain to me how to set up that particular callback because i looked around and the documentation is unclear at best on that particular subject. I.E, where does the declaration for "running_cost_factor" go when one wants to use a callback? I assume in the "graphics" block.
And how do i access the current vehicle speed from within the callback?
Just add a line for "running_cost_factor" in the graphics block, with the result of a switch like so:

Code: Select all

graphics {
	running_cost_factor:			switch_overspeed;
	
Of course you can name the switch whatever you want, but then above the properties block, add a switch, with that name, that tests for 'current_speed', like so:

Code: Select all

	switch (FEAT_TRAINS, SELF, switch_overspeed, (current_SPEED)) { 
		0..160:		return 200;
		161..200: 		return 300;
		201..65000: 	return 800;
		default: 		return 200;
	}
Where you use whatever speeds and costs you want. You'd probably want one switch for each general design speed you have, so one for all the 100kmh wagons, one for all the 160kmh wagons, etc. Someone else may have a better way to do this, but the above should work.
Post Reply

Return to “Graphics Releases”

Who is online

Users browsing this forum: Google Adsense [Bot] and 7 guests