Bay 12 Games Forum

Please login or register.

Login with username, password and session length
Advanced search  
Pages: 1 ... 236 237 [238] 239 240 ... 652

Author Topic: The small random questions thread [WAAAAAAAAAAluigi]  (Read 973660 times)

Arx

  • Bay Watcher
  • Iron within, iron without.
    • View Profile
    • Art!
Re: The small random questions thread [I spoiled my pants]
« Reply #3555 on: April 04, 2017, 11:54:50 am »

Good pathfinding is computationally expensive. Dijkstra's Algorithm, which will find a perfect path, runs in O(E + V*log(V)). In layman's terms, if your world is represented by tiles, and computing moving between two tiles takes 0.05 seconds, then running Dijkstra over a 4x20 room would take about 30 seconds.

Quote from: Maths, in a sort of back-of-the-envelope fashion
(2*78 + 4*2 + 78*2 + 80*ln(80)) * 0.05

Of course, the computation runs much fast than that, but something like Rome: TW uses many more tiles. So people cut corners, usually with the A* algorithm, which can run a lot faster (a lot faster; Dijkstra is very slow, I just picked it because it produces an optimal path) depending on exactly how it's done. But of course, as you cut less corners, your time complexity goes up...

R:TW also has the quirk that as quite an old game, it was written for systems that would struggle to run expensive pathfinding algorithms. Your computer could probably handle significantly more complex pathfinding, but a ten (good grief, that's 2007? Alright, maybe 15) year old PC would grind.
Logged

I am on Discord as Arx#2415.
Hail to the mind of man! / Fire in the sky
I've been waiting for you / On this day we die.

Neonivek

  • Bay Watcher
    • View Profile
Re: The small random questions thread [I spoiled my pants]
« Reply #3556 on: April 04, 2017, 11:58:46 am »

One aspect is also that perfect pathfinding is also very... artificial. How many times when you watch people walk from point A to point B do you see them try to shave off every freeken inch?
Logged

Felissan

  • Bay Watcher
  • Hopefully not killing this game too
    • View Profile
Re: The small random questions thread [I spoiled my pants]
« Reply #3557 on: April 04, 2017, 02:06:21 pm »

Oh come one, there's nothing wrong with a whole legion walking on a same line.
Logged
Quote from: xkcd
I always figured you should never bring a gun to a gun fight because then you'll be part of a gun fight.

Helgoland

  • Bay Watcher
  • No man is an island.
    • View Profile
Re: The small random questions thread [I spoiled my pants]
« Reply #3558 on: April 04, 2017, 02:19:08 pm »

Actual human pathfinding is mostly local, no? And sort-of-local pathfinding should be less resource-intensive to boot. Maybe we should nag Toady about it...
Logged
The Bay12 postcard club
Arguably he's already a progressive, just one in the style of an enlightened Kaiser.
I'm going to do the smart thing here and disengage. This isn't a hill I paticularly care to die on.

scrdest

  • Bay Watcher
  • Girlcat?/o_ o
    • View Profile
Re: The small random questions thread [I spoiled my pants]
« Reply #3559 on: April 04, 2017, 02:32:36 pm »

Also, at least the way it seems to me, human local pathfinding is less focused on optimizing for least distance, and more on minimizing sharp turns or avoiding high-cost moves (although A* can and for the latter, does, handle that too).

Hell, most modern game AIs use A* for the AI, not the sensu stricte pathfinding.
Logged
We are doomed. It's just that whatever is going to kill us all just happens to be, from a scientific standpoint, pretty frickin' awesome.

wierd

  • Bay Watcher
  • I like to eat small children.
    • View Profile
Re: The small random questions thread [I spoiled my pants]
« Reply #3560 on: April 04, 2017, 02:40:56 pm »

Local pathing means recalcing the path many times as obstacles are encountered though. That means dwarves could get stuck trying to dodge each other in the hallway. It also means more compute cycles burned to derive a path in total.

In humans, each human has discrete computational capacity that does not impact other humans. Dwarves have a shared computing engine they get time slices on.

Very important difference here.
Logged

Helgoland

  • Bay Watcher
  • No man is an island.
    • View Profile
Re: The small random questions thread [I spoiled my pants]
« Reply #3561 on: April 04, 2017, 03:13:11 pm »

Ah, but one could simply make the dwarves dumber when the CPU starts running hot.
Logged
The Bay12 postcard club
Arguably he's already a progressive, just one in the style of an enlightened Kaiser.
I'm going to do the smart thing here and disengage. This isn't a hill I paticularly care to die on.

wierd

  • Bay Watcher
  • I like to eat small children.
    • View Profile
Re: The small random questions thread [I spoiled my pants]
« Reply #3562 on: April 04, 2017, 03:17:28 pm »

Or, suggest toady implement local pathing as a multi threaded process, since each dwarf is acting independently, and thus finally get some multicore love in DF. :)
Logged

Sergarr

  • Bay Watcher
  • (9) airheaded baka (9)
    • View Profile
Re: The small random questions thread [I spoiled my pants]
« Reply #3563 on: April 04, 2017, 04:09:40 pm »

Good pathfinding is computationally expensive.
It can be made to be memory expensive for the end user, by using pre-computed experience-derived heuristics, which should make the computation costs roughly linear to the distances involved while still resulting in optimal or nearly-optimal paths. And memory is much cheaper than computation at this point.
Logged
._.

Egan_BW

  • Bay Watcher
    • View Profile
Re: The small random questions thread [I spoiled my pants]
« Reply #3564 on: April 04, 2017, 04:13:10 pm »

Or, suggest toady implement local pathing as a multi threaded process, since each dwarf is acting independently, and thus finally get some multicore love in DF. :)
So, population limit = number of cores in your machine. Great. :P

Good pathfinding is computationally expensive.
It can be made to be memory expensive for the end user, by using pre-computed experience-derived heuristics, which should make the computation costs roughly linear to the distances involved while still resulting in optimal or nearly-optimal paths. And memory is much cheaper than computation at this point.
But, because in DF the map can be altered during play, you'd have to remake the map every time a single tile is mined out or built on.
« Last Edit: April 04, 2017, 04:14:51 pm by Egan_BW »
Logged
I would starve tomorrow if I could eat the world today.

Frumple

  • Bay Watcher
  • The Prettiest Kyuuki
    • View Profile
Re: The small random questions thread [I spoiled my pants]
« Reply #3565 on: April 04, 2017, 04:14:41 pm »

... that sounds like something that would balloon either RAM or hard drive requirements. Possibly do horrible things to loading times. Please don't give them ideas. Devs don't need yet another excuse to throw efficiency out the window ;_;

E: In question news, anyone happen to know of a way to auto-append stuff to the end of web addresses from specific sites? General would be nice, firefox specific would be good enough. The specific scenario is I'd like to be able to stop manually typing &nohtml5=1 at the end of youtube addresses, since something or another they did quite few months back left that the only consistent way to keep that bloody godawful html5 shit from trying to boot up, and the various extensions that intend to force flash for the site are... not very good.
« Last Edit: April 04, 2017, 04:32:53 pm by Frumple »
Logged
Ask not!
What your country can hump for you.
Ask!
What you can hump for your country.

Parsely

  • Bay Watcher
    • View Profile
    • My games!
Re: The small random questions thread [I spoiled my pants]
« Reply #3566 on: April 04, 2017, 04:31:46 pm »

Good pathfinding is computationally expensive.
It can be made to be memory expensive for the end user, by using pre-computed experience-derived heuristics, which should make the computation costs roughly linear to the distances involved while still resulting in optimal or nearly-optimal paths. And memory is much cheaper than computation at this point.
Lots of luck to the guy who gets to implement it.
Logged

Sergarr

  • Bay Watcher
  • (9) airheaded baka (9)
    • View Profile
Re: The small random questions thread [I spoiled my pants]
« Reply #3567 on: April 04, 2017, 05:49:47 pm »

Good pathfinding is computationally expensive.
It can be made to be memory expensive for the end user, by using pre-computed experience-derived heuristics, which should make the computation costs roughly linear to the distances involved while still resulting in optimal or nearly-optimal paths. And memory is much cheaper than computation at this point.
But, because in DF the map can be altered during play, you'd have to remake the map every time a single tile is mined out or built on.
Actually, no, you wouldn't have to remake anything. I'm not talking about pre-computed paths, I'm talking about pre-computed heuristics. Those are basically guiding functions that tell the pathfinding algorithm how long it'll take to reach point B from point A and, as long as the situation is close enough to what has been used during the pre-computation, it should remain valid with the map changes. At worst there'll be a minor increase in computation time as the pathfinding gets out of the newly created local minimum, but that's something the existing heuristics already deal with all the frikking time.

Good pathfinding is computationally expensive.
It can be made to be memory expensive for the end user, by using pre-computed experience-derived heuristics, which should make the computation costs roughly linear to the distances involved while still resulting in optimal or nearly-optimal paths. And memory is much cheaper than computation at this point.
Lots of luck to the guy who gets to implement it.
That's be probably Google. They've been moving quite fast with AI techniques, and their latest work, AlphaGo, has relied extensively on what was essentially a pre-computed heuristic, only instead of estimating a cost of the path remaining, it estimated the chances of victory. They should be able to easily move the results of their work into pathfinding proper.
Logged
._.

Andres

  • Bay Watcher
    • View Profile
Re: The small random questions thread [I spoiled my pants]
« Reply #3568 on: April 05, 2017, 04:41:26 am »

From an ideological point of view, why do nazis and communists hate each other?
Logged
All fanfics are heresy, each and every one, especially the shipping ones. Those are by far the worst.

Arx

  • Bay Watcher
  • Iron within, iron without.
    • View Profile
    • Art!
Re: The small random questions thread [I spoiled my pants]
« Reply #3569 on: April 05, 2017, 04:46:17 am »

Good pathfinding is computationally expensive.
It can be made to be memory expensive for the end user, by using pre-computed experience-derived heuristics, which should make the computation costs roughly linear to the distances involved while still resulting in optimal or nearly-optimal paths. And memory is much cheaper than computation at this point.

Fair enough. R:TW is still probably too old to have high-quality pathfinding available though. :P
Logged

I am on Discord as Arx#2415.
Hail to the mind of man! / Fire in the sky
I've been waiting for you / On this day we die.
Pages: 1 ... 236 237 [238] 239 240 ... 652