Page 1 of 1

Factorio like Mobile Game

Posted: Tue Jan 07, 2020 12:20 am
by Atahan
Hello everyone!

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.

Image
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:
Image
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:
Image

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:
Image

If you put yet another mark on the items, you can even fix that:
Image

But none of those systems really work with a completely filled loop:
Image

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.
  1. Do a normal pass and mark things that don't move
  • Do a second pass, moving only marked objects
  • Clear the marks
At this point I am considering either dropping loop support (like Factory Idle, where you simply can't built looped belts), or just going with the bugged loops as they are not that big of a problem, given I would expect loops to be used very rarely (I never even realized you can't do loops in Factory Idle until I read it somewhere).

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!

Re: Factorio like Mobile Game

Posted: Tue Jan 07, 2020 2:15 pm
by Klonan
Atahan wrote:
Tue Jan 07, 2020 12:20 am
Instead of Factorio's collision 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.
Factorio hasn't used a collision system for over 4 years,
We have some blog posts on the optimizations we did:

https://factorio.com/blog/post/fff-82
https://factorio.com/blog/post/fff-176

Re: Factorio like Mobile Game

Posted: Tue Jan 07, 2020 9:28 pm
by Atahan
Thank you Klonan!

I actually did search for all of the FFFs beforehand for belt optimizations, and did know about the #176, but #82 apparently evaded my search. Thank you for pointing that out. I love the FFFs by the way, keep them coming :)

Still I would love to hear your comments about a slot based system.

PS: I fixed the post.

Re: Factorio like Mobile Game

Posted: Sat Feb 15, 2020 11:49 pm
by Xeorm
Not sure how well it'd work in practice, but I'd guess a good solution would be to treat loops as a special case when coding, rather than with the generic one size fits all algorithm you're currently using.