Advanced Conveyor Belt Help

Hey everyone, I am kind of stumped and can’t find any resources of the topic, but how would I go about making a conveyor belt system similar to Factorio? By that I mean a conveyor belt that can only hold a specific amount of items on it, and when the items on the belt have no where to go (the belt ends, the machine/inventory they are being fed into is full, the belt ahead is full) then they will stop moving until they are able to again.

This would allow for some nice things in the factory game I am working on, namely for logistics.

If anyone has any ideas, please let me know!

1 Like

you can use hitboxes or raycasting, maybe data structures to do this, thing you wan’t to make is to stop putting items on conveyor belt when it’s full, you can determine capacity of the belt by using some math like: beltLenght/segments or something like that, you have to find which solution is the best

Use a loop to determine the amount of objects on the conveyor belt:

local Amount = 0
for i, v in pairs(ObjectsInConveyorFolder:GetChildren() do
   Amount += 1
   if Amount >= limit then 
       -- your logic
   end

Tell me if this doesn’t work. The ObjectsInConveyorFolder are basically objects that are touching the conveyor or on the conveyor. You can do this by checking for parts that touch the conveyor and clone a certain object with their name into the folder.

1 Like

Finding how many objects are on the belt isn’t the hard part, more so how do I make it so adjacent belts can’t put more items on a full belt, and have items on belts that have no where to go stop and start moving the items again seamlessly between belts/machines :thinking: (@MikeartsRBLX forgot to hit reply on your comment lol)

Can you explain it further?

zzzz


Im looking to make my belts behave like this ^
Notice how on the lanes where the belt ends, the items stop moving and stack up/buffer on the conveyors and the ones behind the blockage. I’m trying to figure out how I can get this functionality. I want it to be able to happen when there is any sort of blockage (belt ends, the machine they are being fed into is full, or the belt ahead of the current one is full and stopped).

I mainly just need help figuring out how to make the items “stack” neatly on the conveyor like in this gif, and how to make them stop and start moving seamlessly whenever the flow of items is blocked/unblocked.

Ok so I was brainstorming on it for a while and I think I figured out the basics of how it should work:

I could divide each conveyor into 4 square nodes. Each node can hold 1 item, and has a given direction. When there is an empty node in front of the node an item is in, I can tween animate the item model to the next node, otherwise, it stays put.

I am open to suggestions as to how I could accomplish this optimally :slight_smile:

Edit: Also, how could I go about preventing 2 items from entering a node if they both arrive at, and attempt to enter a node simultaneously? I was thinking maybe I can give a bias to the “main” direction, meaning that somehow if an ore is going down a conveyor, and a conveyor from the side tries to move an ore in, the ore coming in from the side would have to wait for the ore on the receiving conveyor if they both meet at the node at the same time.

1 Like

man this is some good thinking!!! :coefficients:
did you figure it out? just curious