Ludeon Forums

Ludeon Forums

  • December 09, 2019, 04:06:12 PM
  • Welcome, Guest
Please login or register.

Login with username, password and session length
Advanced search  
Pages: 1 ... 11 12 [13]

Author Topic: [MOD] (Alpha 8) A2B: conveyor belts & co. [v0.8.0]  (Read 78898 times)

Rock5

  • Colonist
  • ***
  • Posts: 748
  • Schizoid
    • View Profile
Re: [MOD] (Alpha 8) A2B: conveyor belts & co. [v0.8.0]
« Reply #180 on: February 16, 2015, 09:46:41 AM »

Nice.

Which reminds me, I had an issue with the Splitters I wanted to bring up. This is with the old 2 way splitter. I don't know if it was changed in the 3 way splitter. I haven't tested it.

Currently the way a Splitter works, I believe, is to alternate sending items to each output. If an output is blocked it sends the item to the unblocked output. This is good but... if both outputs are blocked I think it assigns the item to one of the blocked outputs anyway. Then if an output becomes free and it's not the one the splitter chose to send the item then the splitter becomes stuck until the other output clears.

Hm... That might be hard to follow. Let me go through a scenario.
  • Splitter receives an item and sends it left.
  • It receives another and sends it right. Right becomes blocked.
  • It receives another and sends it left.
  • It receives another. Right is blocked so it sends it left. Left becomes blocked.
  • It receives another. Both are blocked. Right was to be next so it waits to send it right.
  • Left becomes clear but the splitter is still waiting for right to become clear.
It would be better if the splitter didn't pre decide which way it is going to send the item but instead waited to see which way becomes free first then send it that way.

What do you think?
Logged
Rock5 [B18] Mods
- Butchers Can Count Meat
- Sun Lamp Planner
- JTZoneButtons
- RimSearch
- JTExport

TehJoE

  • Muffalo
  • *
  • Posts: 15
  • Heaven Piercer
    • View Profile
Re: [MOD] (Alpha 8) A2B: conveyor belts & co. [v0.8.0]
« Reply #181 on: February 16, 2015, 10:04:53 AM »

Currently the way a Splitter works, I believe, is to alternate sending items to each output. If an output is blocked it sends the item to the unblocked output. This is good but... if both outputs are blocked I think it assigns the item to one of the blocked outputs anyway. Then if an output becomes free and it's not the one the splitter chose to send the item then the splitter becomes stuck until the other output clears.

I didn't write the original splitter code, but I did alter the routing code of the splitter significantly in the 0.8.1 version. The bolded is certainly the way the splitter is meant to work. I haven't personally experienced them clogging in the way you describe in 0.8.0 or 0.8.1 (I didn't actually use the 2-way splitter much), but I wouldn't be surprised if that issue was inadvertently addressed by the changes I made. If you run into the same issue in 0.8.1, let me know and I'll see if I can find what causes it.
Logged
Do you remember, how many breads have you eaten in your lifetime?

Rock5

  • Colonist
  • ***
  • Posts: 748
  • Schizoid
    • View Profile
Re: [MOD] (Alpha 8) A2B: conveyor belts & co. [v0.8.0]
« Reply #182 on: February 16, 2015, 12:26:28 PM »

I don't have time to test it right now. I'll try to test it tomorrow.

I don't really know C# but I had a quick look at the code (). It looks like the Splitter GetDestinationForThing function always returns a destination regardless of whether all the outputs are full or not. So I think it would still have the same problem. For it to work properly it would have to skip trying to move the item if all the outputs are full and keep checking GetDestinationForThing until it returns a destination which should happen when an output is finally clear. But, like I said, I don't know C#, so I could be wrong.
Logged
Rock5 [B18] Mods
- Butchers Can Count Meat
- Sun Lamp Planner
- JTZoneButtons
- RimSearch
- JTExport

TehJoE

  • Muffalo
  • *
  • Posts: 15
  • Heaven Piercer
    • View Profile
Re: [MOD] (Alpha 8) A2B: conveyor belts & co. [v0.8.0]
« Reply #183 on: February 16, 2015, 12:42:12 PM »

For it to work properly it would have to skip trying to move the item if all the outputs are full and keep checking GetDestinationForThing until it returns a destination which should happen when an output is finally clear.

As far as I know, that's what it does:
Code: [Select]
        public void Tick()
        {
            (...)

            foreach (var thing in Contents.Where(ShouldIncreaseCounter))
            {
                _thingCounter[thing]++;
            }
        }

        private bool ShouldIncreaseCounter([NotNull] Thing thing)
        {
            (...)
            var destination = _parentComponent.GetDestinationForThing(thing);

            var belt = destination.GetBeltComponent();

            // If no belt items, then move things only if this is an unloader
            if (belt == null)
            {
                if (_parentComponent.IsUnloader())
                {
                    // If this is an unloader always increment the counter
                    return destination.CanPlaceThing(thing);
                }

                return false;
            }

            // If there is a belt, only move things if it can accept them from us
            if (!belt.CanAcceptFrom(_parentComponent))
                return false;

            return belt.Empty;
        }

But then, I've made some changes to routing code since the 0.8.1 version so this may not represent what's actually released. (I'm still tweaking a few things here and there so the version I have running on my machine is a little different from the one currently released) I'll make a note to test the splitter for the clogging issue when I test other changes.

EDIT: Just tested for and fixed the clogging issue. It turns out the splitter was being re-checked for a good destination, but the splitter wouldn't consider any others until its item changed.
« Last Edit: February 16, 2015, 01:26:34 PM by TehJoE »
Logged
Do you remember, how many breads have you eaten in your lifetime?

noone

  • Drifter
  • **
  • Posts: 98
  • Refugee
    • View Profile
Re: [MOD] (Alpha 8) A2B: conveyor belts & co. [v0.8.0]
« Reply #184 on: February 16, 2015, 05:03:17 PM »

Just to add my two cents on the splitter clogging issue: I delayed fixing it because I saw it as a fun unintentional feature - it's a less advanced equipment than the selector, and so sometime it's not quite perfect. Also, I liked the idea of the users pesting against malfunctioning A2B software, having to draft a colonist to un-clog the belt ... :)

This being said, I won't complain the issue is gone. Thanks for all your input TehJoE ! It is genuinely much appreciated.
Logged

Rock5

  • Colonist
  • ***
  • Posts: 748
  • Schizoid
    • View Profile
Re: [MOD] (Alpha 8) A2B: conveyor belts & co. [v0.8.0]
« Reply #185 on: February 16, 2015, 07:43:35 PM »

Another one of your features Grrr. LoL.

Except in this case I don't "draft a colonist to un-clog the belt" but have to manually prioritize hauling from the clogged side of the splitter. The belts are supposed to automate things, not make us do thing manually.

TehJoe, glad to hear you fixed it.
Logged
Rock5 [B18] Mods
- Butchers Can Count Meat
- Sun Lamp Planner
- JTZoneButtons
- RimSearch
- JTExport

noone

  • Drifter
  • **
  • Posts: 98
  • Refugee
    • View Profile
Re: [MOD] (Alpha 8) A2B: conveyor belts & co. [v0.8.0]
« Reply #186 on: February 21, 2015, 01:42:08 AM »

A2B has evolved into a fully fledged corporation. The new thread is here:
https://ludeon.com/forums/index.php?topic=10644.0

With this change, we at A2B hope to secure a bright future for the mod while allowing easy contributions from the community.

This thread is now closed.
Logged
Pages: 1 ... 11 12 [13]