Page 1 of 2

Friday Facts #121 - Path Finder Optimisation II

Posted: Fri Jan 15, 2016 4:52 pm
by slpwnd
Today Oxyd gives more details on our path finder improvements efforst: http://factorio.com/blog/post/fff-121

Re: Friday Facts #121 - Path Finder Optimisation II

Posted: Fri Jan 15, 2016 5:08 pm
by Smarty
WHOOOO! Congratz klonan :D

Re: Friday Facts #121 - Path Finder Optimisation II

Posted: Fri Jan 15, 2016 5:09 pm
by ske
Does that patch caching mean that all enemies coming from one area going to another area take the same path for the most part?

Or is the cached path(part) used as starting point for a path optimization?

Re: Friday Facts #121 - Path Finder Optimisation II

Posted: Fri Jan 15, 2016 5:50 pm
by SomeDuder
Damnit, finish the story! Does the lonely biter eventually find his friends or does he die of old age, friendless and bitter?

Re: Friday Facts #121 - Path Finder Optimisation II

Posted: Fri Jan 15, 2016 5:51 pm
by fireant
Regarding pathfinding optimization:
I suppose you have seen this already, but I will post it just in case: Jump Point Search https://harablog.wordpress.com/2011/09/ ... nt-search/ is a great optimization for pathfinding on uniform grids (what Factorio is afaik).
Tynan Sylvester did a great video on optimizing pathfinding in his game Rimworld: https://www.youtube.com/watch?v=RMBQn_sg7DA, while probably not aplicable to Factorio as both are trying to achieve bit different things it still can be quite an interresting watch.

Re: Friday Facts #121 - Path Finder Optimisation II

Posted: Fri Jan 15, 2016 5:54 pm
by DasMonzta
I would love to see the bitters actually try to find paths like ants do :-)
I think that would be really realistic, since it seems not logical that every bitter knows his paths already.
And it is computationally not that kind of a bad idea and your approach is not that far away from those strategies :-)
I mean swarm intelligence just sounds like bitters stuff :p
https://en.wikipedia.org/wiki/Ant_colon ... algorithms

Re: Friday Facts #121 - Path Finder Optimisation II

Posted: Fri Jan 15, 2016 5:55 pm
by Koub
SomeDuder wrote:Damnit, finish the story! Does the lonely biter eventually find his friends or does he die of old age, friendless and bitter?
Damn a bitter biter ? :mrgreen:

Re: Friday Facts #121 - Path Finder Optimisation II

Posted: Fri Jan 15, 2016 6:05 pm
by Mion
About Negative Cache:
If item that blocks a path will be destroyed (for example, biter spawner), will information in cache be updated? Because if not, hypothetically effective paths will no be used after changes on the map.

UPD: information in negative cache.

Re: Friday Facts #121 - Path Finder Optimisation II

Posted: Fri Jan 15, 2016 6:05 pm
by _aD
SomeDuder wrote:Damnit, finish the story! Does the lonely biter eventually find his friends or does he die of old age, friendless and bitter?
This is your doing!

Re: Friday Facts #121 - Path Finder Optimisation II

Posted: Fri Jan 15, 2016 6:06 pm
by Xterminator
The pathfinding logic seems quite interesting. :D It definitely makes sense to have to it use paths that are already in place instead of making an entirely new one each time. I can see for sure how this would reduce the number of things going on in the background while playing. Awesome work as always!

Also, huge congrats to Klonan! :D

Re: Friday Facts #121 - Path Finder Optimisation II

Posted: Fri Jan 15, 2016 6:20 pm
by Oxyd
SomeDuder wrote:Damnit, finish the story! Does the lonely biter eventually find his friends or does he die of old age, friendless and bitter?
He dies a quiet and lonely death. No one comes to mourn him or bury him, because he's unreachable.

Re: Friday Facts #121 - Path Finder Optimisation II

Posted: Fri Jan 15, 2016 7:12 pm
by Jonathan88
DasMonzta wrote:I would love to see the bitters actually try to find paths like ants do :-)
What might be an idea is to create 'paths' on the sections where biters walk the most (a bit like animal runs https://littlesundog.files.wordpress.co ... l-path.jpg)
This would make it more realistic and it could be useful in determining where the biters attack the most :D )

Re: Friday Facts #121 - Path Finder Optimisation II

Posted: Fri Jan 15, 2016 7:49 pm
by Koub
Or the way ants tend to go where other ants from the hive have walked, following the pheromone path left behind.

Re: Friday Facts #121 - Path Finder Optimisation II

Posted: Fri Jan 15, 2016 8:23 pm
by YotaXP
We haven't yet figured if all the experimental updates will go to Steam, or what exactly will be the model, but we are working on that.
Pretty sure you can upload multiple branches to Steam. Players can choose which branch they want to play from the "Betas" tab of the game's property page.

Re: Friday Facts #121 - Path Finder Optimisation II

Posted: Fri Jan 15, 2016 10:49 pm
by Talguy
Just wanted to say congratulation to Klonan :)

Re: Friday Facts #121 - Path Finder Optimisation II

Posted: Fri Jan 15, 2016 11:14 pm
by Overread
Mion wrote:About Negative Cache:
If item that blocks a path will be destroyed (for example, biter spawner), will information in cache be updated? Because if not, hypothetically effective paths will no be used after changes on the map.

UPD: information in negative cache.
This is what I'm wondering as well; especially with regard to how Biters regard player built features as accessible or inaccessible. Otherwise, in theory, the player could build key structures behind a barrier of sufficient size to make biters avoid it as a pathway and then demolish the structures and the biters would still think it impossible to reach.

Re: Friday Facts #121 - Path Finder Optimisation II

Posted: Sat Jan 16, 2016 12:38 am
by Drury
Well like I said before, Steam allows developers to upload various releases as separate "betas" and the users to pick which beta to opt into, and a special "latest" beta selected by default which you as a dev just update with the latest patch and have everyone automatically update to. You can have a beta for each version of Factorio, effectively allowing Steam users to downgrade at their leisure at any time and instantly. Euro Truck Simulator does this and it's awesome.

Image

The Steam version can just have the autoupdater disabled by default (which I think is the actual default behavior anyway?) and just download the updates from Steam. I believe for most users this is the most convenient solution, since they can update without launching the game and using Steam's bandwidth limiter in case they need it.

Of course I take it you want to keep the game DRM-free, so you can keep the autoupdater in the game for non-Steam users or Steam users who change their mind on Steam, no problem. There's no reason to have a special dedicated Steam version with this model as far as I know.

Re: Friday Facts #121 - Path Finder Optimisation II

Posted: Sat Jan 16, 2016 3:19 am
by Antaios
I remember I've used an area code system before to solve the problem of invalid path finds.

Essentially every tile is assigned an area number, areas that aren't connected are assigned different (unique) numbers. Then if a path-find has start and end points with different area numbers, the path is invalid.

Whenever placing or removing objects that can obscure paths, the boundary of the object is checked for obstacles. If all boundary blocks meet up, nothing needs updating. If they don't then the boundary check continues along the obstacle edges until either they meet or distinct region/s are found.
The number of areas directly surrounding the object earlier can be used to determine when all boundary regions have been found (# of areas - 1). So if there's a placed object with three obstacles spaced out around it, there would be three areas directly adjacent, and two distinct regions need to be found.
once the regions are found the tiles inside can be updated with unique area numbers. A few methods would need testing to try and only change the area number of the smaller areas, rather than accidentally updating the entire map.

It's quick for determining that a path is invalid, but updating the list can become slow when enclosing large areas. unfortunately this might start happening frequently in a large enclosed base where biters destroy walls and they're replaced by bots often.


Just a thought.

Re: Friday Facts #121 - Path Finder Optimisation II

Posted: Sat Jan 16, 2016 12:09 pm
by lordjoda
Jonathan88 wrote:
DasMonzta wrote:I would love to see the bitters actually try to find paths like ants do :-)
What might be an idea is to create 'paths' on the sections where biters walk the most (a bit like animal runs https://littlesundog.files.wordpress.co ... l-path.jpg)
This would make it more realistic and it could be useful in determining where the biters attack the most :D )
I wanted to suggest exactly the same thing! Possibly the "path" would also increase the movement speed a bit making it even more likely that a npc will use this path and therefore maybe save even more calculation time? (I think Settlers 3 is a good example, though I'm not sure if it did increase movements speed)

Re: Friday Facts #121 - Path Finder Optimisation II

Posted: Sat Jan 16, 2016 4:10 pm
by Marconos
I'm really looking forward to this optimization. In my current game (max biter settings) my ups/fps drops to low 20's from upper 40's when I engage most hives. Really curious to see how that can affect this as the game play seems really weird when you have solo motion for all combat.