Page 6 of 12

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

Posted: 01 Aug 2016 08:01
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. :)

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

Posted: 01 Aug 2016 08:38
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.

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

Posted: 01 Aug 2016 10:57
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.

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

Posted: 01 Aug 2016 16:20
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?

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

Posted: 01 Aug 2016 18:39
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.

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

Posted: 05 Aug 2016 05:33
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.

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

Posted: 05 Aug 2016 06:33
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.

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

Posted: 05 Aug 2016 20:08
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!

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

Posted: 08 Aug 2016 10:21
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.

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

Posted: 17 Sep 2016 16:35
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));
			}
		}
	}
}

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

Posted: 18 Sep 2016 07:16
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.

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

Posted: 18 Sep 2016 10:39
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

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

Posted: 18 Sep 2016 21:26
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.

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

Posted: 20 Sep 2016 19:24
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.

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

Posted: 13 Oct 2016 22:07
by Maddog45353
This still being updated or maintained?

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

Posted: 14 Oct 2016 02:29
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.

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

Posted: 14 Oct 2016 07:12
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:

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

Posted: 14 Oct 2016 18:25
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?

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

Posted: 12 Jun 2017 21:45
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?

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

Posted: 12 Jun 2017 22:54
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.