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 - Razzim

Pages: [1]
1
DF Community Games & Stories / Re: The 10,000 Dwarf Challenge.
« on: March 23, 2023, 06:36:58 am »
It might be very possible with the use of cages, but eh feels cheaty.

2
This is really interesting. For me the question is if some of the costly calculations could just be delayed to happen only every X frames and maybe even staggered by number of Dwarfs and dynamically less regular as FPS worsens or if the game breaks down completely if that happens.

Like putnam specified LOS checks and family interactions took most of the CPU time in one of his tests. How often do those currently happen and it is crucial that they happen all the time or would the game break down if they happen half as much and could there be some failsafe to account for any frozen state that could occur because of it?

I think it might create more problems than solutions, but who knows.

And I need to correct myself - los skips do appear to work on z-levels. They are tricky though, as the additional pathing often counterweights the gain from los skip. And one has to keep in mind that when dorf is going down the stairway, then whole level can still calculate him for that 26 z-levels. Horizontal spread is better, z-levels work when you isolate the groups completely.

Also, there is a pretty easy way to make everyone in the fortress blind and then return them back to normal with a dfhack script. Ill post a script here on how its done after work, and Ill try to make it into a plugin for a dfhack release - it might be very helpful in times when you encounter an fps death, to get that additional fps needed.

Edit: something like that worked for me, its a full lua script

Code: [Select]
local utils = require('utils')

function blindify()
    local unit = {}

    for i, unit in pairs( df.global.world.units.all ) do
        if dfhack.units.isCitizen(unit) then
            unit.flags2.vision_missing = true
            unit.flags2.vision_good = false
        end
    end   
end

blindify()

To restore the vision, just change the variables and run the script again.

3
DF Community Games & Stories / Re: The 10,000 Dwarf Challenge.
« on: March 23, 2023, 05:59:01 am »
There's a little description under the screen in the spoiler on how it's done, in case someone wants to try on their own terms without spoiling the fun of discovery.

In case someone wants to read more, I covered my science on huge forts in this topic http://www.bay12forums.com/smf/index.php?topic=181498.0 and I used the conclusions of it heavily in the challenge.

It's not really a functional fort, their needs are covered by various debug tools:
- debug_noberserk
- debug_nodrink
- debug_noeat
- debug_nomoods
- debug_nosleep

I think their names are self-explainatory.

But hey, the challenge was to get as many dorfs with any hackery possible, not to create a fully functional fort. For a fully functional fort I think the limit would be 2-3k, but I'm still testing that.

4
DF Community Games & Stories / Re: The 10,000 Dwarf Challenge.
« on: March 22, 2023, 07:35:03 pm »
You can edit population cap in the files pretty easily.

Oh you are right, actually I didn't even bother to check that after I heard it's impossible. Changing variables in DFHack's d_init structure was enough.

5
DF Community Games & Stories / Re: The 10,000 Dwarf Challenge.
« on: March 22, 2023, 06:58:07 pm »
Result of my attempt - 4987 dorfs at 10fps:

Spoiler (click to show/hide)

That's the max amount of dorfs I was able to get. To add more someone would need to figure out how to increase the population limit past 5000 - it might not be possible (most probably a limit set in code, according to very knowledgeable people). And I have little to no intention to look for a way to increase it - I'm already at 10 fps after all.

DFHack was used only to speed up the setup process and to surpass the embark size limit. All dorfs are fully functional and have their eyes intact (I tried though, it did not change fps at all). In case I decide to set my PC on fire I very well might send them all at once to raid some goblins.

Bit surprised it was actually possible to get that far.

6
Fun new data found recently:

32x1 embark is considerably better for handling both 500 dorfs (160fps vs 140fps) and 1000 dorfs (~50fps vs 64fps) than 16x1

50x1 embark is worse than 32x1 and comparable to 16x1 at 500 dorfs (135fps), but its still better than 16x1 at 1000 dorfs (58fps).

63x1 embark did not work at all, unfortunately. Crash on embark.

Edit: Nope, the performance advantage drops after a year or so, presumably because activity in the caverns.

7

Sounds very cool if by short-circuit you mean the los skip. But if its really just one variable I'd reduce it to, lets say, 10 and do a test first. We might be hyping over it and who know, maybe it won't change all that much because reasons.

And regarding the impact of pathing through a completely dug-out z-level, well fps gets considerably lower when I dig out everything, but nothing too crazy. Still much better than 1x1.

8
I've acctidentally made something in a shape of an ultimate pathing nightmare. 1000 dwarves constantly bumping into eachother, walking in circles and recalculating their paths. I think it would take about a century for a single dwarf to go from one end of 16x1 embark to the other side. But despite that, fps seems to be perfectly reasonable. 130 fps with 500 dorfs, 40 fps with 1000 dorfs. I think it confirms pretty well how insignificant pathing is for performance, considering that checkerboard hardly goes higher than 140fps/50fps. And the fps drop might very well be because of a bit worse LoS breaking than a checkerboard.


9
Putnam clarified in this thread that:  The bounding box for skipping the calculation is a cube, and that the early-out is for greater-than 26.  So dwarfs on level N can consider dwarfs on level N+26 for further evaluation, but not on level N+27.

With 26 empty z-levels between they have at least 27 levels difference, something like 1st area z-level 0, 2st area z-level 28. And there are certainly more than 26 levels apart between 1st and 3rd and 4th area.

10
Is there a typo?  Reading these two statements:

Quote
2. The most performance efficient embark for my testing conditions is 16x1 (and probably 1x16, but I haven't tested that one). It exploits the 26 tile skipping mechanism the most while still having relatively small amount of land to calculate/path around. With 1000 dwarves and their migrated animals on 16x1 embark i get around ~50 fps

Quote
3. 26 tile skipping doesn't work on z-dimension. On my recent test day I made 4 areas as in point I.5. separated by 26 z-levels, and spread 1000 dorfs on those areas resulting in roughly 250 dorfs on each of them, then removed stairs connecting them. FPS results are absolutely the same as with single 16x1 z-level.

If 16x1 checkerboarded was the best-performing configuration, and separating 4x occupied levels by 26 floors performed the same as just one level of a 16x1 embark then why do you say that the distance check doesn't work?  Doesn't that imply that the distance check is also sensitive to the vertical dimension?

In at least one other context (work scheduling) Putnam reported that the distance used for scheduling weight was max(dx, dy) + dz.  That's a little weird, but it would account for the vertical.

I... don't know what to think anymore, honestly. On one hand, all testing scenarios seemed to point at the 26+ tile skipping mechanism being the most fps profitable. But Putnam says that it works irrelevant to direction, so it should work on z-level too... yet I can't find a scenario where it does. If it doesn't work at all, then why 1x1 embark with 1000 dwarves on 16 different z-levels is so terrible, when it should be perfect for conventional LoS breaking? Im puzzled.

I prepared 2 scenarios with a lower amount of dwarves. I think that would be the fastest way for somebody to point a flaw in my testing methodology and understanding of the results.

Scenario1 - 500 dwarves on a single checkerboarded 16x1 level
https://dffd.bay12games.com/file.php?id=16525

Scenario2 - 500 dwarves spread on 4 different checkerboarded 16x1 levels
https://dffd.bay12games.com/file.php?id=16526

On both of them I get the same fluctuating 130-140 fps

Maybe... Maybe 140 fps on 500 dwarves, or 50 fps with 1000 dwarves is the maximum amount the game can handle with optimal conditions and better designs just can't improve it further?

I guess the next test I have to do is something like 4x1 embark, then adding 26+ separated z-levels to the point I achieve the performance of 16x1.

11
Inspired by the famous revelation from Putnam regarding the pathing impact, since 2 months I've been doing series of experiments on impact of different embark/population configurations on FPS.

I. The setup

1. Most of my experiments are made with a population of 1000 dwarves, to make the tests as consistent as possible, and to focus even more on just units impact on fps.

2. Most worlds are generated as small or medium regions with default settings, as I found them the most consistent.

3. Most of testing is made on 16x1 embarks (a so called noodle-embark), because its the only embark size which has the ability to handle 1000 dwarves. More on that later.

4. Most of my test designs are open. A wholy dug checkerboarded single z-levels. Something like:

XOX
OXO
XOX

X - dig
O - wall

5. To spread the dwarves evenly throughout areas, I create perperdicular stripes of meeting halls, separated by around one screen length (not because its the most efficient, but because its the easiest and fastest to setup multiple times). Roughly looks like this:

MXOXOXOMXOXOXOXOXMOXOXOXOXMXOXOXOMXOXOXOXOXMOXOXOXOXM
MOXOXOXMOXOXOXOXOMXOXOXOXOMOXOXOXMOXOXOXOXOMXOXOXOXOM
MXOXOXOMXOXOXOXOXMOXOXOXOXMXOXOXOMXOXOXOXOXMOXOXOXOXM

X - dig
O - wall
M - meeting hall

6. All of my tests are made without zooming, as it's proven to affect performance. So 2x zoom out from max zoom.

7. My recent test embarks are only on deserts without any vegetation, to avoid trees/herbs interfering with the results

8. All testing worlds have all 3 caverns enabled.

9. Most of the testing made on v50.07.

Relevant info about my PC:
- i7-12700k at stock clock
- 32gb of 6000mhz, cl34 ram

II. To make my science as much uninterfered with various variables, I use considerable amount of cheating, which include:

1. Debug tools in df.global structure:
- debug_noberserk
- debug_nodrink
- debug_noeat
- debug_nomoods
- debug_nosleep
- debug_fastmining

2. "fastdwarf 1 1" DFHack command to quickly dig the huge areas required for experimenting, changed to "fastdwarf 0 0" after setup is done.

3. "migrants-now" DFHack command to quickly pool huge amounts of dwarves in a matter of days, to count out any world changes impacting the fps

Thanks to all the cheats, absolutely 0 produced items interfering with the results.

III. The results

100% certain as of now, proven through countless different embarks now:

1. The feature of skipping interactions between dwarves if they are 26 or more tiles apart is by far the most impactful on performance. Its the mechanism that allows to have 1000 dwarves in a single embark with reasonable fps (at one point even 65 fps after culling all migrated animals!)

2. The most performance efficient embark for my testing conditions is 16x1 (and probably 1x16, but I haven't tested that one). It exploits the 26 tile skipping mechanism the most while still having relatively small amount of land to calculate/path around. With 1000 dwarves and their migrated animals on 16x1 embark i get around ~50 fps.

Not 100% certain, tested but not across every possible scenario:

1. I found checkerboarding of big areas beneficial for the fps, but for counterintuitive reasons. With the same setup as in point I.5. above, but with just digging out an entire z-level I get 35 fps, compared to ~50 with checkerboarding. Why? I thought because checkerboarding limits LoS - nope.
Turns out checkerboarding just makes the dwarves more spread on y-dimension, so more chances for dwarves to escape the 26 tile calculation area. Bonus is less spreading of mist/miasma/dust.

2. 4x4 embark gives considerably lower fps compared to 16x1, despite having the same amount of land - see the 26 tile spread rule. 16x2 embark is a bit slower than 16x1 - I've got ~45 fps, probably because of more land/pathing to calculate. But I've done only one 16x2 test.

3. 26 tile skipping doesn't work on z-dimension. On my recent test day I made 4 areas as in point I.5. separated by 26 z-levels, and spread 1000 dorfs on those areas resulting in roughly 250 dorfs on each of them, then removed stairs connecting them. FPS results are absolutely the same as with single 16x1 z-level.

4. 1x1 embark is terrible for fps with a lot of dwarves. I made 2 versions of 1x1 fort. One with stairs connecting 16 different, checkerboarded z-levels, second one with ramps going left-right, to spread the dwarves evenly on each of 16 z-levels. Result? At 1000 dorfs 17 fps with stairs, 18 fps with ramps, despite having 16 areas of 48x48, so roughly the same as with single 16x1 z-level, and the advantage of potentially more LoS-breaks, as there were floors between each z-level.
Fun fact - 16x1 simple checkerboard z-level handles 2100 dorfs at 16 fps. Yep, 1x1 forts are pretty bad.

5. Both small and medium region embarks start with roughly the same fps. Small region suffers no changes to fps after 10 years of world development post-embark. Medium world fps gets cut in half in about 3 years, and stays like this - but i only tested 10 years, and on limited amount of worlds, so it might be heavily dependent on RNG.

6. Increased RAM frequency helps significantly with handling big amounts of dorfs in a small area, and falls in importance with more optimal fort designs (would need a lot more testing though).


As a bonus - a save with 1000 dorfs to test your PC capabilities. Enabling debug mode advised (for advanced users, description in the link), but should run for a bit before dorfs kill eachother. I get 52-54 fps on it. Also it gives a good view on my testing methodology.
https://dffd.bay12games.com/file.php?id=16524

12
Utilities and 3rd Party Applications / DFHack script: Autosquad
« on: February 28, 2023, 06:40:50 pm »
Hi! After some frustration and quite a few tries to tinker with DF squad assginment UI behaviour, especially to remove the the not so fun feature of the assignment list scrolling itself to the very top after each assigned position I've kinda given up.

But instead of changing the UI I've made a little script which assigns squadless dorfs into all existing squads automatically.

Works with any squad sizes and any dorf amounts (I think). So far I tested it by assigning ~1000 dorfs to 11 squads 100 positions each all at once. Went smoothly (and quite surprisingly game didn't even crash when I sent all of them to raid some humans).

If you want to clad everyone in iron to forget about making new clothes or if you want to toughen your population and satisfy their need to develop martial skills... Help yourself!

https://github.com/Razzim/Autosquad/blob/main/autosquad.lua

It's surely not perfect, I started working on DFHack scripts very recently. Any feedback would be appreciated.

I have some plans to develop it further into something in a shape of military/raiding manager, a proper parametrizable gui tool which would make military forts more pleasant to manage. What features would you like to see in such a tool? Would you like to see such tool at all?

Pages: [1]