Page 1 of 1

train stop "read train contents" filter

Posted: Sat Dec 05, 2020 11:38 am
by oleg4f
Hi.

It would be nice if we have a filter with wagon numbers in train stop "read train contents" feature. With switch for "white list" and "black list" like in filter inserter. Thus we will be able to say to send only content of first wagon or all except first wagon.

Re: train stop "read train contents" filter

Posted: Sun Dec 06, 2020 8:28 am
by ssilk
Hi, I’m not sure how that should work.

I mean, wagons have already filters, now you seem you want to set those filters from outside. And what I really struggle to understood is how blacklisted wagons should function. They make no sense.

Perhaps it is better to explain: What do you want to do?

Re: train stop "read train contents" filter

Posted: Sun Dec 06, 2020 11:06 am
by BaggyK
I read it as he wants to filter the output of the read train contents by wagon. So he could say tell me the contents of the first wagon of the train.

Re: train stop "read train contents" filter

Posted: Mon Dec 07, 2020 8:44 am
by ssilk
Ah! At first I thought to https://mods.factorio.com/mod/Inventory%20Sensor
But that works only for whole trains.

I think the gameplay value for this suggestion is quite low...

Re: train stop "read train contents" filter

Posted: Mon Dec 07, 2020 11:47 am
by oleg4f
BaggyK wrote: Sun Dec 06, 2020 11:06 am I read it as he wants to filter the output of the read train contents by wagon. So he could say tell me the contents of the first wagon of the train.
Exactly!
ssilk wrote: What do you want to do?
In setups where we have 1 supply train for several stations or 1 supply train for 1 station(with complex set of items in wagons) it better to have a possibility to send from train stop to circuit net not a content of whole train, but just content of several wagons or all except these wagons. This is need for configure station logic with combinators for smart upload/download of a train.

Re: train stop "read train contents" filter

Posted: Mon Dec 07, 2020 11:51 am
by oleg4f
For example, in this scheme - viewtopic.php?f=194&t=92539 - the content of a payload wagon is leaked in a circuit net. When we need only a content of a wagon with markers. This problem can be solved with train stop filter or/with filter combinator.

Re: train stop "read train contents" filter

Posted: Tue Dec 08, 2020 6:04 am
by ssilk
Understood. But as said: very low chance of implementation, because low general gameplay value and high added complexity.

From my experience I found those setups a) oversimplified (sometimes you need just one item, but the train loads other items, too) b) slow (especially when it needs to supply some outposts).

This is in my eyes a typical use case for LTN mod, I would use that in this case just for the supply. It’s hard to change that in an existing map and learn how to use it, but I think when it suddenly works you will say, why didn’t we do that earlier. :)

Re: train stop "read train contents" filter

Posted: Tue Dec 08, 2020 8:54 am
by oleg4f
ssilk wrote: Tue Dec 08, 2020 6:04 am Understood. But as said: very low chance of implementation, because low general gameplay value and high added complexity.\
I see. That's sad. About complexity - i didn't see the game source code, but filtering on the *wagon* basis don't seem complex.

Re: train stop "read train contents" filter

Posted: Wed Dec 09, 2020 5:57 am
by ssilk
oleg4f wrote: Tue Dec 08, 2020 8:54 am but filtering on the *wagon* basis don't seem complex.
Oh, I meant with complex here not just complex in the sense of programming, but for the player.
Let’s play it through.

Assuming we add two extra signals:
- contents-of-wagon-number
- contents-of-wagons-except-number

So to get content of first wagon of an LLCCCC-train you need to send:
contents-of-wagon-number: 3
Because that is the third entity in the train.

Open question here: what if both signals are set? Not logical self-explained, which is difficult for players.

But except for that it looks simple, also for the blacklisted signals, but as developer I would think: that is really an effort, because it needs extra buffers, because otherwise it needs to sum all wagons each tick. And with very long trains this is a bit of performance issue.
And why not doing the blacklisting yourself, because that is the content of the whole train, minus the content of the wagon. So you need just to read train content, remember that and then read wagon content and subtract it. Takes two ticks.

I mean, that are legit thoughts, because the use-case of the blacklisted contents, they are really so rare and it would remove this illogical conflicting signal-state, if both is set, when it would not be implemented.

Oh, and what I forgot: this cries for implementation as mod. Really not so difficult I think.

Re: train stop "read train contents" filter

Posted: Thu Dec 10, 2020 10:33 am
by oleg4f
ssilk wrote: Wed Dec 09, 2020 5:57 am Oh, I meant with complex here not just complex in the sense of programming, but for the player.
This is as simple as filter inserter. I don't see any difficulties.
Open question here: what if both signals are set? Not logical self-explained, which is difficult for players.
What are these both signals? I don't understand you. In my view this should be *the same* settings as in the filter inserter. A player choose two things:
- white or black list switch
- the content of chosen list

But content is wagon numbers, instead of items(like in filter inserter). That's it. What difficulties can be here for player?
But except for that it looks simple, also for the blacklisted signals, but as developer I would think: that is really an effort, because it needs extra buffers, because otherwise it needs to sum all wagons each tick. And with very long trains this is a bit of performance issue.
The talk about an implementation is meaningless, because i didn't see the source. But. We already done sum of all items from all wagons. And white filter can make this process even faster. For examle:

Code: Select all

void
calc_sum(struct train *tr, uint64_t* tsfwmask)
{
	uint64_t wagon_mask[MAX];
	
	// set wagons mask from a train stop filter wagon mask
	for(int i = 0; i < MAX; i++)
		wagon_mask[i] = 0xffffffffffffffff & tsfwmask[i];
	for(int i = 0; i < tr->wagon_cnt; i++)
		if ((wagon_mask[i / 64] & (1 << (i%64)))
			train_add_wagon_items_to_sum(tr, i);
}
And why not doing the blacklisting yourself, because that is the content of the whole train, minus the content of the wagon. So you need just to read train content, remember that and then read wagon content and subtract it. Takes two ticks.
Ok. But how should i know the content of the wagon :-)?
I mean, that are legit thoughts, because the use-case of the blacklisted contents, they are really so rare and it would remove this illogical conflicting signal-state, if both is set, when it would not be implemented.
I don't understand what is this "both" and how can you set it.
Oh, and what I forgot: this cries for implementation as mod. Really not so difficult I think.
May be you are right.

Re: train stop "read train contents" filter

Posted: Fri Dec 11, 2020 6:34 am
by ssilk
oleg4f wrote: Thu Dec 10, 2020 10:33 am What are these both signals? I don't understand you. In my view this should be *the same* settings as in the filter inserter. A player choose two things:
- white or black list switch
- the content of chosen list

But content is wagon numbers, instead of items(like in filter inserter). That's it. What difficulties can be here for player?
We seem to have a communication problem, because you haven’t written that till yet.

You:
- You need a special signal for the wagon number
- you set the mode of operation in the train stop (none, blacklist, whitelist)
- you get the contains of what you selected,
- you can’t automate changing that mode
- limited to a very special use-case only (yours)
- simple to blacklist things

Me:
- I need a new special signal for the wagon number
- when set it returns the contents of that loco/train only
- no need to set the mode in the stop
- can be automated: if signal present returns contains of that wagon, if not then returns the whole train as yet
- has multiple use cases (e.g. enough train fuel yet? No? Then wait)
- a little bit complex to calculate the blacklist (needs two measures, one for the whole train and one for the to be blacklisted
The talk about an implementation is meaningless, because i didn't see the source. But. We already done sum of all items from all wagons. And white filter can make this process even faster. For examle:

Code: Select all

void
calc_sum(struct train *tr, uint64_t* tsfwmask)
{
	uint64_t wagon_mask[MAX];
	
	// set wagons mask from a train stop filter wagon mask
	for(int i = 0; i < MAX; i++)
		wagon_mask[i] = 0xffffffffffffffff & tsfwmask[i];
	for(int i = 0; i < tr->wagon_cnt; i++)
		if ((wagon_mask[i / 64] & (1 << (i%64)))
			train_add_wagon_items_to_sum(tr, i);
}
Ahh, you meant that as MASK. And the mask works like in LTN-mod. Changes everything, now I understand this, but, man, why didn’t you explain that not from beginning? 8-)

Re: train stop "read train contents" filter

Posted: Fri Dec 11, 2020 10:06 am
by oleg4f
ssilk wrote: Fri Dec 11, 2020 6:34 am We seem to have a communication problem,
Yeah. A little bit :-).
because you haven’t written that till yet.
All info in the first post :-): filter with wagon numbers and white & black list; like in filter inserter. Sorry for the bad explanation.

Re: train stop "read train contents" filter

Posted: Sat Dec 12, 2020 9:04 am
by ssilk
Indeed, you wrote it. But the step to imagine how the current filter inserter looks like and to convert that how the station GUI then might look was too far for me. :D

And with a mask you don’t need blacklist/whitelist.

Re: train stop "read train contents" filter

Posted: Mon Dec 14, 2020 11:08 am
by oleg4f
ssilk wrote: Sat Dec 12, 2020 9:04 am And with a mask you don’t need blacklist/whitelist.
No-no. A mask - is an internal representation. Blacklist/whitelist switch is for user interface. A mask is too complex and uncomfortable for use. User choose blacklist or whitelist and then write a wagon numbers(it can use negative numbers to represent wagons from a train tail). Then for performance reasons, "train stop" convert this to a mask.