Factorio like Mobile Game

Things that are not directly connected with Factorio.
Atahan
Manual Inserter
Manual Inserter
Posts: 3
Joined: Mon Jan 06, 2020 10:06 pm
Contact:

Factorio like Mobile Game

Post 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!
Last edited by Atahan on Tue Jan 07, 2020 9:28 pm, edited 1 time in total.

User avatar
Klonan
Factorio Staff
Factorio Staff
Posts: 5246
Joined: Sun Jan 11, 2015 2:09 pm
Contact:

Re: Factorio like Mobile Game

Post 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

Atahan
Manual Inserter
Manual Inserter
Posts: 3
Joined: Mon Jan 06, 2020 10:06 pm
Contact:

Re: Factorio like Mobile Game

Post 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.

Xeorm
Fast Inserter
Fast Inserter
Posts: 206
Joined: Wed May 28, 2014 7:11 pm
Contact:

Re: Factorio like Mobile Game

Post 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.

Post Reply

Return to “Off topic”