I'm an aspiring developer, and I have a question for you all. I am trying to make a mobile game with the feel of Factorio but the basic systems of Factory Idle. I am at the very early stages, and trying just to make a nice belt system that will work very efficiently on mobile systems.
Move items move!
Instead of Factorio's distance/rails based system, I wanted to opt to a slot based conveyor belt system, so that I can update it a lot less, and have time fast forwarding mode that is really hard to do with Factorio's system.
But slot based systems have their own problems:
The items here don't move as they should be!
Main problem with a slot system is the update order. If you get careless about your items, you can update the same item twice in a loop:
If you keep track of the items you've moved before, you can get rid of that issue, but now they will stop at that same intersection point and you lose belt compression:
If you put yet another mark on the items, you can even fix that:
But none of those systems really work with a completely filled loop:
I have some ideas to fix the loop, but they all increase the complexity/processing cost a lot.
And at his point we are making 3 different passes on each of the belt section.
- Do a normal pass and mark things that don't move
- Do a second pass, moving only marked objects
- Clear the marks
So the question becomes, does anyone have a "conveyor belt" algorithm that can solve this problem efficiently? Right now my system is pretty much O(n), but I am not sure if actual slot system will be faster than Factorio's system. If any Factorio dev can drop in to say if they ever considered a system like this I would be grateful I don't even know if this problem have a more legit name (like the Trapping Rain Water problem) so I can't search online... Also would the increased complexity and time cost worth the gameplay opportunities?
For the time being I will continue developing with the 3rd system and see if I get to a performance bottleneck in 'normal' gameplay. Thanks everyone for their input!