Bay 12 Games Forum

Please login or register.

Login with username, password and session length
Advanced search  

Author Topic: DFHack Script: Procedural Creature Hacking  (Read 2008 times)

Fayrik

  • Bay Watcher
    • View Profile
DFHack Script: Procedural Creature Hacking
« on: August 12, 2017, 03:11:23 pm »

For the past few days I've been pondering at a few little nagging problems. Problems like "How come Boogiemen are so tough for their tiny size?" and "Can my adventurer be a demon and breathe fire?"

So, after a few days of feeling irritated that I couldn't find the information I wanted in the game's available raw files, I started digging around in memory, and found that the entire creature raw files are cached in memory. A little bit of curiosity lead to these two new yet simple script files.

dumpraw: This script will save a creature's raw data to a .txt file, allowing you to see how that creature works. Unlike the game's actual raw files, this works on procedurally generated creatures like forgotten beasts and night creatures.
Spoiler: dumpraw.lua (click to show/hide)

loadraw: This script will take a saved raw txt file, and load it back into the game, allowing you to modify procedurally generated creatures. (Potentially regular creatures too, but I have not tested it to see if it takes priority over the main raw txt files.)
Spoiler: loadraw.lua (click to show/hide)

In order to run the scripts, you'll need to have a world loaded in fortress, adventure or legends mode. Legends mode does not save the game when exited, so loading in a raw in legends mode will have no effect, as you need to save the game and reload it before a loaded raw takes effect.
Both scripts use the raw-styled .txt files, you'll notice they're formatted a little differently - this is how they're formatted in memory, so if you are loading in a raw make sure to format it in the same way.

And in case it wasn't obvious, these scripts work on the game's memory, and they're not exactly polished, so I take no responsibility for the horrible things they could do to your save games. (Always back up your saves, and all that!)
Logged
So THIS is how migrations start.
"Hey, dude, there's this crazy bastard digging in the ground for stuff. Let's go watch."

Max™

  • Bay Watcher
  • [CULL:SQUARE]
    • View Profile
Re: DFHack Script: Procedural Creature Hacking
« Reply #1 on: August 12, 2017, 09:06:38 pm »

Seems like it would work well with this: https://github.com/maxthyme/scripts/blob/master/generventurated.lua (gener-ated adventurers, gener-ventur-ated) actually.
Logged

Clyybber

  • Bay Watcher
    • View Profile
Re: DFHack Script: Procedural Creature Hacking
« Reply #2 on: August 31, 2017, 03:43:17 pm »

This is awesome! I cant wait to boss battle against my own forgotten beast creation! Thanks!
Logged