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 - King Mir

Pages: 1 ... 72 73 [74] 75 76
1096
Assuming Toady is using more or less typical data structures and algorithms, I imagine the memory access patterns are reasonable.  What's DF programmed in anyway?  C++?  He's probably using STL or Boost containers if so, and they're very well written to keep that in line.  Of course, if they're sufficiently large and he doesn't organize them well, that doesn't matter...
I'm sure the containers are decently implemented, but cache use optimization isn't as simple as making sure to use good STL implementations. It's more about size and organisation. The fact that DF manages to use 2GB sometimes doesn't help, because it means you can't use more memory for speedup.

One change I thought of would be to have a separate 'display' fork from the running code. Simply turn the 'do stuff' DF process into a server that puts state changes into a queue along with reading from a command queue (things like 'build' or 'designate' that force a halt to the running 'do stuff' thread).

Then you would have a separate thread who's mission is simply to display state changes, interpret 'change display' requests (level up/ down, move display in a compass direction, alter display size). Even if your 'do stuff' thread had a frame-rate of 10 FPS, your display thread (running on its own core) would cheerfully display at 50 FPS, and if you gave it a 'build/ designate/ pause' command, it would receive the command right away and be able to throw a HALT signal to the 'do stuff' process. The processes could run separate cores and with totally separate memory. They would have a common I/O queue to communicate state changes and command. Both processes would still have to be aware of what memory they have to work with, so as to not CTD on the memory boundary.

Just ideas. I really don't know what the hell I'm talking about. Other than... it bites hitting a CTD on 2 GB of memory on a 9 GB machine with plenty of open real memory space.
That may be a good idea, but as a separate thread, not process, because of the need to share large amounts of data. Which means it wouldn't help with the 2GB limit. It could potentially help the frame rate though.

1097
Speeding up the processor cores in general will benefit DF, but I'm betting it's memory bound.  Almost everything is memory bound.  Many modern processor optimizations are finding ways to do useful work while waiting for the memory system to return data you're asking for.  As to how DF could be reworked to improve this... heaven alone knows.  Cache coherency is going to be a problem, and there's probably a point where it goes kablooie when one of the game's many internal memory tables gets too large to fit nicely into the processor cache.
Yeah, there are several levels of cache, and an application can potentially be bound by any one of them, or the speed of the memory itself (and the motherboard chipset, which needs to support the high speed memory). I suspect DF is bound by the latter. It depends on the locality of sequential memory access; if DF tends to jump all over it's memory, or access blocks at a time.

But I do think that there would be some benefit from multithreading, despite the heavy memory access time dependence. Enough to justify considering making it multithreaded as a performance priority. 

1098
All this is very definitely out of my area of expertise.

I just know that CTDs are a category of HFS that is way more fun than I care to allow myself. :) The only warning when trying to do a 16 x 16 embark is about 'lag'. Options that are physically impossible due to the lack of available memory should be blocked with a warning, "Only X amount of space is available, alter Y and/ or Z for more of X". CTDs, especially due to memory should be exception handled, hopefully with a 'crash save in /crash' for a hope-in-hell recovery.

Everything else is in the 'if wishes were fishes'.

If a 64-bit compile were even considered, that only pushes the problem down the road rather than resolving the problem. Pushing the CTD issue down the road another 5 years works for me, so long as there is the understanding it is not a good long-term solution.

If the problem can be isolated, a dollar figure put on it, and a pot we can throw money into, I will commit to throwing $50 into the pot in two payments. I know it's not enough money, but it's what I can do. Any problem you can solve with money you have at your disposal is no problem. Hopefully memory CTDs are annoying enough for people they'd want to throw sufficient money at it so Toady can make them go away, and stay gone. 4 GB, 8 GB, 16 TB, 256-bit OS platforms with 1024 cores... whatever. CTD's be gone! :D
Well It would be relatively easy to change the CTD to a crash-to-title screen. Anything more would be non-trivial. Trying to save the problem map may not be possible, or useful, since the map would use the same amount of memory when loaded back up.

It would be possible for Toady to guess when an embark is large enough that it could run into the memory issue and include a warning message, but it would not be more than what is already known by the community. It would be helpful to newcomers, but it would be as good a guess as you can already make, so it won't help you.

As for pushing the problem down the road, the fact is, 8TB is 4000 times more than 2GB. And in theory 64 bit addresses could access Exabytes of memory. If DF manages to use that much memory, the other problems will come much much sooner than running out of memory, even with ever faster and larger memories promised by Moore's law. Out of memory CTDs will not be a problem on a 64 bit version of DF.

1099
Not so good a solution without prep work, in my opinion.
  • If you have a 64-bit OS with only 4 GB including virtual memory, and DF wants 4.1 GB (well way before that because of the OS, but by way of example...) if you have Crash-To-Desktop (CTD) now, you'll have it then too. Memory handling so as to avoid CTD is required, or a 64-bit release would be agony *anyway*.
I'm not aware of any 64 bit system that so strangely limits virtual memory to 4GB. Switching to 64 bit will mean the CTD will occur much later. 8TB later.

Quote
  • Toady either has to abandon the 32-bit 'flavor', or support *two* 'flavors' on each platform (Linux, Windows). It would be best to have him focus on making DF better, since simply fixing CTD would allow you to nearly double memory usage ability anyway and stay 32-bit
I agree that supporting multiple versions does open up complications. But it's likely that the program would not need to be very different when compiled in 64 bit instead of 32 bit mode. It may even be as trivial as recompiling it under different setting.

Quote
  • Multi-threading would be more useful than a 64-bit compile, in my opinion. Right now, DF is locked to a single core. If DF could properly handle the nightmare of forking multiple threads, my OS may use up to 8 CPU cores. You can have display and interface on one core so even if your framerate drops below 5 to 1 frame per second, you can still have 50 fps graphics display and have the game respond. How fast you choose to display would not need to impact how fast the 'do stuff' frame process runs, as it would be on a different core.
I agree but proper multi-threading is much harder to do than a 64 bit compile. It requires changes in the logical flow of the program, and in managing memory access. I expect a 64 bit compiler sooner than multi-threading support, because a 64 bit compile is much easier to do.

Quote
  • I've been thinking of how DF could be bound to a database such as MySQL instead of all internal memory. Suppose you no longer had to choose how much embark space... the size of the world would be how much space you permitted that world to occupy on your hard drive. How large your fort was within that would would be a function of 'how much land you can grab AND HOLD. No more 'embark size' issues. You may find having a smaller size fort is easier to manage while keeping the frame-rate where you tolerate it. Not to mention your ability to deal with HFS, sieges, and so on. I've not quite fleshed out the notion, but breaking DF out of memory to a disk based database stored on the drive might take DF up to the next level the same way breaking DF out of 2D took DF up a notch. I'm still fleshing out ideas for a proposal to suggest on that one.
You post this after you said that Toady should be focusing on multithreading? It's a sound idea, but it's harder than a 64 bit compile. Perhaps not as hard as hard as multi-threading. I'm also not sure that the fps bottleneck is CPU bound. If it's memory access time bound, then switching to a database would make the problem worse.

Quote
I don't think a 64-bit compile is a 'quick/ easy' thing to do. I would not mind having a 64-bit compile, I can run it. But a 64-bit compile that still CTDs, or takes away from the Toady One's focus and passion for DF would be undesirable, in my opinion.
I don't know about quick and easy, but it's quicker and easier than any alternatives. CTD is not a problem if it only occurs at 8TB.

1100
there is some cool techy term for this... but i remember when master and commander came out that it crashed on me because I was running 32bit and it just wanted to many memory locations.

I agree though that, especially if the development of this game is going to cover the next decade, that some long term plan needs adopted. Though for all we know maybe Toady has one.
Yes, you're making me cringe at "too many memory locations." "want too much memory" would be correct. So would "run out of memory."

There is really only one reasonable solution to the problem: release a 64 bit version.

1101
2GB is an OS limit on single 32bit applications. 64bit apps have a larger limit.

Never heard of that 2GB limit, before.  I had to read up on it.  I know many BIOs set a physical limit on RAM that a controller cannot exceed, but that's different with ea chipset.   I did hear that Vista accessed RAM in a more efficient manner, it was one of its selling points.  But I can't remember what that was called.  Here is a nice link to limits.

http://msdn.microsoft.com/en-us/library/windows/desktop/aa366778(v=vs.85).aspx

DF accesses no virtual memory?  Bummer.  *sigh*  I guess there is a good reason for it, although I can't understand why.  Most RTS games access virtual memory, as a result of there continously expanding design needs, demand for it.

Knutor
The link is correct, but you're misunderstanding it. DF does use virtual memory as needed (in fact it doesn't have much choice to). But the OS limits the (virtual) address space for a single 32 bit app to 2GB. Strictly a 32 bit address in x86 can point to a larger address space, which is why a 32 bit OS can benefit from 4GB RAM.

thisisjimmy is right, but the clincher is the OS limit, not the pointer limit, since the OS limit is smaller. But the reason for the OS limit has to do with the address space limits.

1102
DF Suggestions / Re: Considering Races' Roles
« on: December 09, 2011, 08:10:30 pm »
Humans are always the odd ball in fantasy like this, and SirHoneyBadger makes a some interesting points about modding them out.

However, DF is a fantasy generator, not a static fantasy setting, and it has the concept of Ages, which are dictated by who dominates the world. This allows for the setting to evolve to fit rather different kinds of fantasy. In the age of legends, humans are the odd one out, but in the age of heroes humans are the race to be, and stories like Beowulf could be told. You can't have Beowulf without humans; a Beowulf dwarf would not be as awesome. If I read more of Treetoes stories I might be able sight an example from there of a story that could not be told to the same effect without humans.

1103
2GB is an OS limit on single 32bit applications. 64bit apps have a larger limit.

1104
I think giving people the power to resurrect like that is too strong, and not a popular enough fantasy trope. It's also a more complicated role, because resurrecting someone would not automatically make them friendly, so the reasons for doing it would be more complex than razing a zombie.


I do like the idea of entities that live through possession though. There need to be more variations of such powers.

1105
DF Suggestions / Re: I proppose a new-ish fluid sistem.
« on: November 23, 2011, 01:17:14 pm »
Did you guys like totally not even read what I just said?

Anyway, tile swaping IS a dumb idea. One tile can have 7 units of ANY kind of liquid at once. Dont you understand. This means that the tiles dont have to "swap", the water and oil can just mix on a tile basis. They wont create a new liquid but they will mix in one tile. the 7/7 water will go over the 1/7 tiles of oil and the oil will be on the top.
I was responding to harborpirate alternative of having mixing work like a block level cellular automaton.

Given how pressure works in DF, it wouldn't be easy to make water push other liquids. So you may as well do it right and layer them.
The effect of pushing occurs as a natural outcome of the scenario I described. Nothing special has to occur other than the one look behind/attempt to combine step.

I'm not so sure that layering alleviates all the problems of pressure calculations in the presence of multiple liquids. You'd at least have to calculate the sum of the total depth stored in the new data structure prior to making every pressure calculation.

Its really hard to say just how painful each of these options would be without seeing the details of the code; and we know that isn't going to happen.

That said, I have to agree that the biggest issue with tile swapping is the one you mentioned a couple of posts ago, where depth doesn't match and tiles can't be combined; like a 1/7 oil tile moving around a reservoir full of 7/7 water. It would just look strange.
But how would it know to attempt to combine? A simple swap would involve only two tiles, the 7/7 and the 1/7. That's simple. Checking that there are additional 1/7 tiles around so that the liquids could balance out at 4/7+3/7+2/7 would not be as trivial.

And we can estimate how hard it is to code something. We don't know about the state of Toady's code, but we can estimate how hard it would be to code from scratch. Also, we know how water currently behaves. It's unlikely Toady coded it is a strange way, so we can guess at the current code pretty well too.

Re: layering
I agree that that's the right way to do it, but that does add it's own mixing challenges. For instance: if shallow water and oil mix then the two can just spread out independently. However, if you have two adjacent tiles with no air gap you would still want the oil to spread out.

1106
DF Suggestions / Re: Banners
« on: November 23, 2011, 12:48:14 pm »
As far as I'm aware, Toady uses a library like ncurses, which just uses native terminal api to print text with specified foreground and background colors. That's not graphics.

1107
DF Suggestions / Re: Banners
« on: November 23, 2011, 10:06:58 am »
Tri-color tiles are impossible[...]
I just have to say: Currently.

Not that I'm particularly calling for it, but it might represent a solution to all kinds of things.
It's not a matter of dwarf fortress. There isn't any software library that's able to display multicolored letters without graphics for letters. Anywhere.

A Tri-color font would require a someone to do a major rework of how fonts work, and provide terminal support for it on every popular platform. No one's going to bother with that. Ever. It's useless. People who need multicolored font use graphics.

1108
DF Suggestions / Re: Proximity breeding
« on: November 23, 2011, 09:11:25 am »
That sounds really good, but do you mean that only animals in pastures will breed?
That is not exactly what I meant and I think it would be too big of a change to the current situation.
To make sure animals do breed you might indeed need some sort of job for the male animal to actively seek out a female of the same species. In case of horses and donkeys this might even be one of a different species.
This would also stop catsplosions as far as they have not been outcoded yet. Male cats and female cats need to actively seek eachother and get close to eachother to be able to breed.
The way I imagine it, pastures would act like burrows. Free animals would be able to breed. Restraints are tricky, and whatever applies to them should apply to cages for consistency.

I agree it's a bigger change than you are suggestion, but if you're going to improve a system like this, then you might as well do it right.

1109
DF Suggestions / Re: I proppose a new-ish fluid sistem.
« on: November 22, 2011, 04:44:37 pm »
Given how pressure works in DF, it wouldn't be easy to make water push other liquids. So you may as well do it right and layer them.

1110
DF Suggestions / Re: Proximity breeding
« on: November 22, 2011, 03:16:21 pm »
I imagine you would want the male to seek out an eligible female in the same pasture every once in a while. Probably by having the female generate a work order for male members of it's race only.

Pages: 1 ... 72 73 [74] 75 76