Bay 12 Games Forum

Please login or register.

Login with username, password and session length
Advanced search  

Show Posts

This section allows you to view all posts made by this member. Note that you can only see posts made in areas you currently have access to.

Messages - Optimizt

Pages: [1] 2
1
DF Dwarf Mode Discussion / Re: Hypothetic Budget Increase for Toady
« on: June 09, 2009, 05:06:03 pm »
Toady could buy a compile farm.

Vroom vroom.

2
DF General Discussion / Re: What Song
« on: June 03, 2009, 03:31:15 pm »
The intro to "Six Degrees of Inner Turbulence" by Dream Theater. The whole song is 42 minutes long :P

Covers a wide variety of Dwarven situations, from peaceful farming to glorious combat.

The somewhat poor quality version on YouTube:
http://www.youtube.com/watch?v=7Am_guS7WFM

The good quality live orchestral version on YouTube:
http://www.youtube.com/watch?v=tpK4HZegTD8

Or anything on "A Night at the Opera" by Blind Guardian. I mean, come on, look at the album cover.
Spoiler (click to show/hide)
The song "And Then There Was Silence" from the album is good for an epic HFS fight.
Spoiler (click to show/hide)
http://www.youtube.com/watch?v=snwvpJ7DxyY

And then there's "Harvest of Sorrow", also by Blind Guardian, appropriate when your fort is crumbling to its end because you pulled the irrigation lever without first sealing the farm up.
http://www.youtube.com/watch?v=lWXlHn4aKOQ



3
DF Dwarf Mode Discussion / Re: Cakelie: there's science to do!
« on: May 19, 2009, 02:19:00 pm »
Mod in a deadly gas that kills anything it touches.

Everyone likes neurotoxin.

4
DF General Discussion / Re: Sims 3 programmers play dwarf fortress
« on: May 19, 2009, 02:14:49 pm »
As much industry attention as DF is getting, I wish a company would throw a bunch of money, programmers, and artists at Tarn and Zach to expedite development.

Oh well, a man can dream.

5
DF Dwarf Mode Discussion / Re: Achievement Unlocked (IMG heavy)
« on: May 19, 2009, 01:54:50 pm »






6
Trying to multithread DF's pathfinding isn't going to work without almost a complete rewrite of how DF works, I'm afraid. That's something for T1 to attempt in DF 2.0, what we need now is route caching. Not only is it easier to implement, but it will provide a greater performance increase for all but a few trivial cases.
Multithreading isn't as hard as you think. In many cases, making an algorithm run parallel is as simple as a few function calls to the appropriate library.

If A* pathfinding is implemented in DF like I think, it would not be hard at all to spread the pathfinding load between processors with little effort. That's what I'm working on right now ;)

Also, I was thinking of splitting the map into a quadtree.  The quadtree algorithm can be summarized as follows:
  • Take a region with dimensions 2^n x 2^n, where n is any integer
  • If contents of that region are not uniform, divide it into four new regions and repeat for each of the four regions.
Since the map is already represented as 16x16 blocks, it is possible to split up a block like this:

The red shaded areas are regions that are blocked, and the green shaded areas can be walked on. The red outline denotes the four regions under the central node, the green outlines denote the regions under that region, etc. The good thing is that giant expanses of similar regions can be stored as a single node in a tree, saving memory and processing time.

7
So we only can assume you just plan on putting down framework to have the pathing system multi-threaded, and not any improvements other than more paths calculated at once?
Right now, yes. Like I said, I don't know exactly how Toady has the map and creatures represented and handled internally, so any optimizations beyond more crunching may or may not be helpful. I'm trying to develop my framework so that it is a little similar to KQ as DF uses a modified KQ engine. Toady is a little busy with other matters and can't create a Battle Champs type example, so right now we'll just have to make do.

When I get done with the basic framework, I'll release the source so that any other coders can see what they can come up with.

Are you manually setting the number of worker threads or is it dynamic?  I ask because I know the windows APIs will report WAY more threads than the processor can actually handle.
Manually right now.  I'm concerned with keeping the game cross-platform, so I'm not doing any Windows API magic so that Mac dwarfers can take advantage of any optimizations, too.


8
I dunno, I think you guys are looking too deep into this. The way I'm working on it, the main thread creates (n - 1) worker threads, where n is the number of threads requested. The main thread does its share of computation no different than the worker threads. For example, on a quad core, the main thread would compute a fourth of the paths and the three worker threads would also compute a fourth of the paths.

9
DF General Discussion / Re: Voxel-based 3D program for fortress planning
« on: January 10, 2009, 07:37:28 pm »
Wait, what?

...Do you even know what Lego is?
I think he means building a real-life fort in Lego and simulating a game of DF.

10
As much as I love credit, I think you mean "Baughn and Kardos." I have been absolutely worthless in this thread. Though that is mostly because that while I understand the basic concepts involved in what coders like yourself are talking about, the implementation makes my head spin in five different directions. But keep on keeping on!
Whoops, yeah. Stupid confusing topic summary box!

11
DF General Discussion / Re: How many copies of DF do you have?
« on: January 09, 2009, 11:42:58 pm »
Typically I start a new copy of DF when I reformat, so I've got 5 or 6 sitting around.

12
Baughn and Kardos, those are really good suggestions and similar to something I had in mind:

Toady mentioned that the map is broken down into 16 x 16 x 1 sections of tiles. If each section could keep track of what other section it is linked to through open tiles, ramps, or stairs it would be possible to calculate which sections creature must go through before it worries about what tiles to go through. The only issue I can see with this is that though section X might be linked to section Y and Z, it may not be able to go from section Y to section Z through section X on the tile scale, if that makes sense.

Another optimization I had in mind is breaking the fort down into a tree, which is pretty much the same as the node idea. Most forts are subdivided into smaller sections (rooms, halls, burial grounds filled with noble warriors struck down by the HFS). Still thinking about the best way to do that, though.

Anyways, I've begun coding a little benchmark I'm calling "Cat Fortress." (Why cats? If you're asking this question, go allow cats to breed in your fort a while and come back to this thread when you're frustrated ;) ) It will allow you to place tons of cats and have them path to random points or points you select. You will be able to manipulate the walls, floors, and stairs of various z-levels... basically a really, really, really, really, really, really, REALLY primitive DF. The map will be adjustable and size, and will pretty much present the basic problem of pathing in DF minus flows, enemies, etc. The hope is that I will be able to implement multi-threaded CPU pathfinding and CUDA pathfinding, which would pretty much eliminate the problem of pathfinding lag for GeForce 8, 9, and 200 card owners.

Hopefully I'll finish by the end of next week. After that, I might flow on over to optimizing something else ;)

13
Just got an email reply from Toady. Basically he mentions that the pathfinding code uses a different algorithm in DF (A*) than KQ's (Dijkstra). The algorithm switch isn't the problem, I'm familiar with both. Toady mentions that there are some specific peculiarities with DF's pathfinding code versus a simple A* implementation and that creating a test program à la Battle Champs would be a bit more involved.  Still, I think I get the gist of how it is implemented in DF and will see what I can work with.

14
DF General Discussion / Re: Sea kittens
« on: January 09, 2009, 03:00:13 pm »
Great, fish are going to scratch up my couch and leave presents under my bed now too?

15
Does KQ have the same time system as DF, where there's numerous 'ticks' between when one critter moves and another one moves?  It's a very minor complication to parallelizing your pathfinding but it's an important one, because it means unless you play with the time a little, you might not have as many things to run in parallel as you would like.
I don't think that would be a problem.  The main issue is computing the actual path, which would be sped up by threading. Every creature that needs a path recalculation would put a request in a "queue" saying "I want to get here, please tell me how." The pathfinding handler would wait for every creature to put their request into the queue, crunch the numbers, and then tell each creature the appropriate path after it finishes.

Things to keep in mind about the Dwarf Fortress pathfinding:

-It should be able to handle multiple z-levels
-It is dynamic, not static (because building walls and locking doors messes things up).
-It should know when an job is innaccessable

Also, the title doesn't seem too helpfull.

1. I've thought about the z-level problem. Basically, even though the system appears to be 3d, it can be represented as a single 2D graph (the graph theory kind, not the y=3x kind) with edges connecting where the stairs/ramp/etc. should be.
2 and 3. It seems that creatures already recalculate their path every time they move, so that wouldn't be a problem. All the pathfinding algorithm needs to know is if a spot is passable or not; it doesn't care if it's impassible because of a door, wall, or cave-in that conveniently destroyed a caravan of elves.

Also, about the title: I was trying to be clever (beating the dead pathfinding horse) but those crazy Dwarves don't have a word for "path."

Pages: [1] 2