Bay 12 Games Forum

Please login or register.

Login with username, password and session length
Advanced search  
Pages: 1 [2] 3

Author Topic: More Embark Dwarves v2: 0.31.21 compatible  (Read 20429 times)

Sutremaine

  • Bay Watcher
  • [ETHIC:ATROCITY: PERSONAL_MATTER]
    • View Profile
Re: More Embark Dwarves v2: 0.31.21 compatible
« Reply #15 on: March 11, 2011, 05:30:26 pm »

But, yes, I also thought 224 dwarves for embark is more than a bit excessive. I mean, just configuring their skills on the embark screen would be a tedious ordeal.
I'd find it useful for determining how the caste ratios fall when you have really rare ones. And for experiments on how much FPS drop is down to dwarves and how much is down to all the crap that accumulates over the time it takes.

btw, the calculator in Windows 7 (and XP) can convert between hex and decimal (View > Programmer. Then select Dec mode, put in the number, and switch back to Hex mode).
Logged
I am trying to make chickens lay bees as eggs. So far it only produces a single "Tame Small Creature" when a hen lays bees.
Honestly at the time, I didn't see what could go wrong with crowding 80 military Dwarves into a small room with a necromancer for the purpose of making bacon.

0x517A5D

  • Bay Watcher
  • Hex Editor‬‬
    • View Profile
Re: More Embark Dwarves v2: 0.31.21 compatible
« Reply #16 on: March 11, 2011, 06:23:57 pm »

Has anyone done this with the Linux version?

I don't think so.

The big problem is that two different compilers are used for the Windows and Linux versions, with full optimization turned on for both.  Think of it like two different dialects of a language.  You can say the same thing in both, but both accents and word choices will be different.

Because of the optimizations, it's very hard to match up sequences of code between the two versions.

But I just spent an hour staring at disassemblies, cross-referencing whatever I could, and I found what I think is the right patch point for .21 Linux.

Search df_linux/libs/Dwarf_Fortress for  C7 44 24 30 07 00 00 00.  Change the 07 to the number of dwarves you want.

How to make the change?  I don't know.  I'd probably resort to using Perl or hexedit or something to patch the actual executable file instead of messing around attempting to get a debugger to patch a readonly code segment of a running program.

Edit: I probably should have put this in the other thread.
« Last Edit: March 11, 2011, 06:27:03 pm by 0x517A5D »
Logged

Arekis

  • Bay Watcher
    • View Profile
Re: More Embark Dwarves v2: 0.31.21 compatible
« Reply #17 on: March 11, 2011, 06:41:45 pm »

Somewhat off-topic, but I take it figuring out how to limit the number of dwarves in a migration wave in a similar manner is next-to-impossible?
Logged

Jeoshua

  • Bay Watcher
  • God help me, I think I may be addicted to modding.
    • View Profile
Re: More Embark Dwarves v2: 0.31.21 compatible
« Reply #18 on: March 11, 2011, 06:51:47 pm »

Looking at that hex, it's probably possible to have more than 255 dwarves, you know.  07 00 00 00 is one number.  FF 00 00 00 would be 255, but 00 01 00 00 would be 256.
Logged
I like fortresses because they are still underground.

Artanis00

  • Bay Watcher
    • View Profile
Re: More Embark Dwarves v2: 0.31.21 compatible
« Reply #19 on: March 11, 2011, 08:03:23 pm »

The big problem is that two different compilers are used for the Windows and Linux versions, with full optimization turned on for both.  Think of it like two different dialects of a language.  You can say the same thing in both, but both accents and word choices will be different.

Because of the optimizations, it's very hard to match up sequences of code between the two versions.

But I just spent an hour staring at disassemblies, cross-referencing whatever I could, and I found what I think is the right patch point for .21 Linux.

For that, you have my eternal gratitude. :)

Search df_linux/libs/Dwarf_Fortress for  C7 44 24 30 07 00 00 00.  Change the 07 to the number of dwarves you want.

How to make the change?  I don't know.  I'd probably resort to using Perl or hexedit or something to patch the actual executable file instead of messing around attempting to get a debugger to patch a readonly code segment of a running program.

The change is easy as pie. Hex editor in the Ubuntu repos works quite well.

I can confirm that the byte search works in .21 linux, and also in .19 linux.

Again, thank you very much.

Looking at that hex, it's probably possible to have more than 255 dwarves, you know.  07 00 00 00 is one number.  FF 00 00 00 would be 255, but 00 01 00 00 would be 256.

I can confirm this behaviour, so if anyone has need of several thousand dwarves this is what you'll need.

I also (attempted to) check 00 00 01 00 which is (65536 if I'm doing my math right (this is my first real encounter with endian-ness, and I can't shake the feeling that this is backwards, which is throwing me off something fierce)). I presume that had I let it consume my RAM in flash of fire and a puff of silicon smoke, I would have had an embark with 2^16 dwarves in it. I am not checking the next one.
Logged
Git - fast, efficient, distributed version control system
Github - Free public repositories, issue tracking, wikis, downloads...

Jeoshua

  • Bay Watcher
  • God help me, I think I may be addicted to modding.
    • View Profile
Re: More Embark Dwarves v2: 0.31.21 compatible
« Reply #20 on: March 11, 2011, 10:48:04 pm »

Brandstone, you should release the next version of MEDv2 with new options:

144 dwarves: Gross.exe
255 dwarves: Good luck.exe
16.7 million dwarves: Yourcomputerdieinafire.exe
Logged
I like fortresses because they are still underground.

PTTG??

  • Bay Watcher
  • Kringrus! Babak crulurg tingra!
    • View Profile
    • http://www.nowherepublishing.com
Re: More Embark Dwarves v2: 0.31.21 compatible
« Reply #21 on: March 11, 2011, 11:39:50 pm »

Just verifying this works. 200 Dorf embark, here I come.

You may want to edit your "starting points" in the worldgen settings by some suitable number to afford new skills, ect.
Logged
A thousand million pool balls made from precious metals, covered in beef stock.

0x517A5D

  • Bay Watcher
  • Hex Editor‬‬
    • View Profile
Re: More Embark Dwarves v2: 0.31.21 compatible
« Reply #22 on: March 12, 2011, 01:39:10 pm »

Somewhat off-topic, but I take it figuring out how to limit the number of dwarves in a migration wave in a similar manner is next-to-impossible?

Hum.  No, should be possible.  All of the size-of-wave inputs have to eventually mix together and digest into a low limit and a high limit.  Find those, override them, and you're done.  Or find the actual random number roll, override that, and get exactly as many as you want, every time.

It's just nobody has ever done it.
Logged

Arekis

  • Bay Watcher
    • View Profile
Re: More Embark Dwarves v2: 0.31.21 compatible
« Reply #23 on: March 12, 2011, 03:03:38 pm »

Somewhat off-topic, but I take it figuring out how to limit the number of dwarves in a migration wave in a similar manner is next-to-impossible?

Hum.  No, should be possible.  All of the size-of-wave inputs have to eventually mix together and digest into a low limit and a high limit.  Find those, override them, and you're done.  Or find the actual random number roll, override that, and get exactly as many as you want, every time.

It's just nobody has ever done it.

I'd think that there are some sort of hard limits in there, the obvious being zero for the low.  The high would be something in the 20s?  I've never seen a wave bigger than 23 or so dwarves, but how would one go about finding what those are and where they happen to be?
Logged

0x517A5D

  • Bay Watcher
  • Hex Editor‬‬
    • View Profile
Re: More Embark Dwarves v2: 0.31.21 compatible
« Reply #24 on: March 12, 2011, 05:05:39 pm »

Somewhat off-topic, but I take it figuring out how to limit the number of dwarves in a migration wave in a similar manner is next-to-impossible?

Hum.  No, should be possible.  All of the size-of-wave inputs have to eventually mix together and digest into a low limit and a high limit.  Find those, override them, and you're done.  Or find the actual random number roll, override that, and get exactly as many as you want, every time.

It's just nobody has ever done it.

I'd think that there are some sort of hard limits in there, the obvious being zero for the low.  The high would be something in the 20s?  I've never seen a wave bigger than 23 or so dwarves, but how would one go about finding what those are and where they happen to be?

I would personally start by putting a breakpoint on the increase-experience routine, tripping only on gains of 500 points.  (When new units are created with nonzero skills, they get multiples of 500.  Except during embark, when they get exactly enough to hit the minimum for the skill level you choose.)  I've found that routine in the past, I could find it again pretty easily.

Then I'd wait for a wave.  Ignoring traders, diplomats, thieves/snatchers, and invading armies, which will also trip that breakpoint.

Statistically, it's pretty much guaranteed that one of the immigrants will trip the breakpoint.  From that, I get a call stack which gets me a tree of caller routines.  Then I just disable the 500 exp breakpoint and set new breakpoints on about 5 levels of the call tree, at the entry point of each procedure.

Then I just break&run until I get a sense of which routines get called for each new unit.

Find the topmost routine that is called to create each new unit, then look at its caller.  There should be a loop right there.  Find the loop control variable, look at how it gets set, figure out the random number generation (which, due to optimization, is very hard to do), and the two inputs to that are the low and high limits.

There would be difficulties along the way, but that's basically what I envision.
Logged

Thundercraft

  • Bay Watcher
    • View Profile
Re: More Embark Dwarves v2: 0.31.21 compatible
« Reply #25 on: March 13, 2011, 03:57:20 am »

Sorry, last I checked embarking with fewer than 7 causes the game to crash. Haven't tried with the new version, but I doubt that it has changed.
I recently read of a strategy to embark with less than 7 dwarves. It was mentioned in the old Friendship Enhancer thread:
PPS: looks like embark hack needs at least 7 creatures... So no hermits :( Try adding cats instead of dwarves.

The Friendship Enhancer is outdated now and was succeeded by the DFusion, which has Friendship Enhancer functionality (and much more). I haven't tried it, but perhaps one can use DFusion to change 6 of the 7 starting dwarves into dogs (or some other pet) to allow an embark with just 1 dwarf without crashing?

For that matter, DFusion already includes a "Simple_embark" tool which allows one to "modify your starting dwarf count" without huge .exe downloads or manual hex editing. So I'm not even sure if this download package is necessary.
Logged

dagger

  • Bay Watcher
  • Sniffin' glue
    • View Profile
Re: More Embark Dwarves v2: 0.31.21 compatible
« Reply #26 on: March 26, 2011, 05:48:47 pm »

I like this download package and hopes it gets updated to .23. I am not really sure how to use DFusion.....:)


Logged

Befenismor

  • Bay Watcher
  • Skype: witcher1701
    • View Profile
Re: More Embark Dwarves v2: 0.31.21 compatible
« Reply #27 on: April 20, 2011, 06:56:10 am »

Does it work for elves?
Logged
1024: You brag about your golden goblin ejaculator.

Jeoshua

  • Bay Watcher
  • God help me, I think I may be addicted to modding.
    • View Profile
Re: More Embark Dwarves v2: 0.31.21 compatible
« Reply #28 on: April 20, 2011, 07:16:55 am »

If you hack the exe and modify the raws... yes.  You can embark with more elves, too.
Logged
I like fortresses because they are still underground.

Befenismor

  • Bay Watcher
  • Skype: witcher1701
    • View Profile
Re: More Embark Dwarves v2: 0.31.21 compatible
« Reply #29 on: April 20, 2011, 07:23:03 am »

hack the exe?.. yeah, nevermind.
Logged
1024: You brag about your golden goblin ejaculator.
Pages: 1 [2] 3