Page 1 of 1

I think I've built myself into a corner.... well 4.

Posted: Mon Jul 03, 2017 4:26 am
by PhatzDomino
So I've started to build my first large factory and I've hit a wall with rapidly falling FPS/UPS. From a bit of research I've done, it seems to be because of my train system being a massive loop. As you can see from the screenshot a redesign at this point (300+ hours) is looking impossible unless some of the more experienced among you have any ideas?

I know belt optimisations are on the cards but are there any coming for trains also? If not, has anyone got any tips on queezing some extra FPS/USP out of my system?

Image

Re: I think I've built myself into a corner.... well 4.

Posted: Mon Jul 03, 2017 4:34 am
by evildogbot100
Press f5 and see the train update value. I heard that trains are not as significant computationally.

Re: I think I've built myself into a corner.... well 4.

Posted: Mon Jul 03, 2017 4:42 am
by PhatzDomino
evildogbot100 wrote:Press f5 and see the train update value. I heard that trains are not as significant computationally.
It's fluctuating between 1.000/0.310/23.310 & 4.000/0.310/23.310


I assume thats the number you're after?

Re: I think I've built myself into a corner.... well 4.

Posted: Mon Jul 03, 2017 5:50 am
by evildogbot100
It seems pretty significant, cutting away unused areas might work for a while.

Re: I think I've built myself into a corner.... well 4.

Posted: Tue Jul 04, 2017 5:04 pm
by ledow
A* pathfinding is expensive. And every track section is another node to check. That sounds about right, because even a moderate amount of nodes can bring a top end computer to its knees.

Even bots just aim for their destination without obstacles, but trains have to do all sorts of pathing.

Re: I think I've built myself into a corner.... well 4.

Posted: Tue Jul 04, 2017 10:15 pm
by Frightning
I've long wondered about how train pathing works 'under-the-hood'. Because I would expect it to be extremely computationally efficient compared to things like belts or even bots, but it apparently isn't in some cases? I would think the smart way to do it would be to pre-compute and store a directed graph style representation of the rail network, and then use that, along with other information (which blocks are occupied or not, and such) to choose paths for trains running on the network.

Re: I think I've built myself into a corner.... well 4.

Posted: Tue Jul 04, 2017 11:21 pm
by SQLek
I think this factory represents edge case.

Lest hypothesize algorithm similar to A*.
  • We start on current track block.
  • We add block that are accessible to our block list.
  • If we hit destination station, job done.
  • If not, we repeat for *some* newly discovered blocks.
About some:

We can check all and get slow but always best result.

We can check N best but it will give strange results with stations that are of the same name but in different paths.

We can check best and every alternatives that are no worse than lets say 75% of best. Seams great but will give much more recurrence if You have many paths with similar score.

And now tell how many "almost best" paths You see in Your base from left up to bottom right corner.

Did i see correctly that You use runabouts on grid intersection? Hard to see from map. If yes then You can replace them with crossings, should help. How much i don't know.
viewtopic.php?f=5&t=50025 for some inspirations

Re: I think I've built myself into a corner.... well 4.

Posted: Wed Jul 05, 2017 4:08 am
by Xterminator
While the trains do seem to be a significant amount, there are quite a few other things you can do to increase overall performance. :)

- Keep your robot networks small and separated opposed to massive networks that stretch across multiple production areas.
- Solar Power over Nuclear or steam. I'm guessing you're using Nuclear/Steam or an infinite power source because I don't see any solar fields. However, solar essentially all combines into one entity so is almost completely non-existent as far as game performance is concerned. Whereas Steam and Nuclear can get pretty substantial at larger scales due to fluid/pipe stuff and just the sheer amount of entities that aren't all combined together. By the way, how much power are you using?
- Similar to the first point, use as much direction insertion as possible to avoid robots having to transfer as much stuff around.

Back to the trains thing, having your a system as large as yours as one big loop definitely can't help things. Perhaps making it not all one huge loop could help a fair bit. :)

Hope some of that helps!

Re: I think I've built myself into a corner.... well 4.

Posted: Wed Jul 05, 2017 10:52 am
by ratchetfreak
ledow wrote:A* pathfinding is expensive. And every track section is another node to check. That sounds about right, because even a moderate amount of nodes can bring a top end computer to its knees.

Even bots just aim for their destination without obstacles, but trains have to do all sorts of pathing.
A* with a good heuristic is pretty fast. A square grid like in the OP is actually one of the best case scenarios for A* assuming the heuristic isn't too optimistic.

A* works by expanding each node that has the best potential path calculated by adding the cost from the starting point (which is known exactly) to the heuristic which is the best guess the path will take from there.

Re: I think I've built myself into a corner.... well 4.

Posted: Wed Jul 05, 2017 11:25 am
by mergele
Kill the biters. At the point in the game you are at they are irrelevant anyways. Unless you want some achievements just cheat all the biter and their nests dead. Should give you quite a bit of UPS buffer.