Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Dungeon Crawl #13

Open
shakna-israel opened this issue Oct 24, 2018 · 14 comments
Open

Dungeon Crawl #13

shakna-israel opened this issue Oct 24, 2018 · 14 comments
Labels

Comments

@shakna-israel
Copy link

shakna-israel commented Oct 24, 2018

Entry Repository.

I've been kicking an idea around for a while, though I've not yet tried to implement it.

Procedurally generate a MUD-style world, and then send a series of adventurers through it, and log their progress.

Not very exciting, though perhaps vergining on readable which is sort of my goal.

There's the issue whereby adventurers may die, before we get the length of novel we want, because I rely so heavily on randomness for this sort of thing. Hence the series of adventurers.

Not sure if I want to keep trying until I get one of the right length, or send in new adventurers, and have the dead haunt whatever room they died in.

Tweaking how the NPCs, who write our story for us, behave would probably take the most amount of time.

@kleer001
Copy link

Ha, nice! I too am aiming for readability. I'll certainly be keeping an eye on your progress :)

@shakna-israel
Copy link
Author

Mmm. Your idea seems the closest one can get to readable without fullblown Natural Language Processing the entire work.

I'm a bit lazy for that, so I'll be relying less on a corpus, but more trying my hand at sentence construction. Hopefully with enough conditionals the reader won't be able to tell they're just reading the same thing repeatedly.

@LuRsT
Copy link

LuRsT commented Oct 27, 2018

I had a very similar idea, but simpler where I'd send adventurers down a single corridor fighting monsters, eventually dying and then another one would venture down. I might still do that, hopefully not too similar to yours 😄

@shakna-israel
Copy link
Author

@LuRsT It'll be different. Even if we had the exact same idea, programming is fairly creative, and even the RNG we use would be able to bring fair differences.

If it's any help, I'm probably going to see how much I can get away with just by using a shell script. It has basically all the things I want, whilst being fairly fast to write.

@shakna-israel
Copy link
Author

4 days til I can start. Might looking forward to this. Entry repository.

@cantino
Copy link

cantino commented Oct 31, 2018

Great idea! I'm thinking along similar lines.

You could run the simulation many times and then score the results based on some concept of a dramatic arc, selecting one that meets your search criteria.

@shakna-israel
Copy link
Author

I've started, I'll get around to uploading it eventually, but my local clock being futz'd because of the EU changes has kinda screwed with git's datetime stamps. Looking into fixing that now things are settling down.

But, here's an early sample, from an incomplete input:

Dungeon Crawl


Prologue


Grief has stricken the land. Horror sweeps over the night. Our princess has been stolen, and with her, her protection. No more magic to save us from the ghosts beyond the Demonwall. She was taken, by a great evil, and hidden away in a labyrinth beneath the ground. It was X'wa the Warrior who delved below, to save our hope.

X'wa the Warrior Fantastic Hope


A small stream runs down one wall of the cave.

Undaunted, the Warrior heads deeper.

X'wa the Warrior finds a Fantastic Hope


X'wa turns their gaze to the next narrow opening, that joins this cave, to the next.

Obviously, the low level fights, and the environment descriptors are the most pressing at the moment.

I'm being fairly linear - the hero/ine (going for a genderless hero, let the reader supply their own connection to the protagonist) will always reach the end of the story, but I've got about four states lined up for that, which each can take different descriptors... Me, being me means that only one of those four outcomes is actually 'happy'. Whoops.

Title descriptors for the chapters are craaaaaaaaaaaaaaaap, unfortunately. I'll need to rethink it. (I need something other than numbers, because of the way pandoc is generating chapter headings).

PDF output is the prettiest, as expected, but I'll upload a sample pdf, epub and html page when I get this thing closer to a finished state. It requires a lot of creative writing on my part, because of how I've structured things.

Each chapter is made of a series of descriptors, and chance encounters.

Building a full-sized novel (with incomplete descriptors) only takes about 15mins on my terrible (Celeron) laptop, which is surprisingly good.

Another quick sample:

A small stone catches the eye of Elptibud. It's a diamond. Knocked loose from some larger arrangement. The princess came this way.

Elptibud turns their gaze to the next narrow opening, that joins this cave, to the next.

@shakna-israel
Copy link
Author

Basic story structure:

  • Randomised prologue intro, ending with a hero chasing a princess kidnapped by a monster into an underground structure.
  • Protagonist moves through a series of caves:
    • Random descriptors, including:
      • Light
      • Water
      • Crystals
      • Blood trail
    • Chance of:
      • Low level enemy
      • Boss fight (mutually exclusive to low level fight)
      • All fights are based around protagonist's random class
    • Treasure/loot, descriptors based on protagonist's random class
    • Something I'm not spoiling here
    • Chance of:
      • Trace of princess
      • Trace of princess kidnapper (mutually exclusive to trace of princess)

Then once enough words have been generated, we move into the climactic moment:

  • Success is predetermined
  • Based on success/failure:
    • Random descriptors of fight where protagonist loses
    • Random descriptors of fight where protagonist wins
      • If protagonist wins, a secondary 50/50 chance happens (no spoilers):
        • Protagonist dies
        • Protagonist returns victorious

Then we send that final output off to pandoc, for our final formats (PDF, ePub, HTML).

It may be overly simple, but it's getting close to being something actually readable for three or four chapters. Of about 30-60 that get generated.

@shakna-israel
Copy link
Author

Ignoring the missing fight scene, and awful title, this is pretty good:

Kcohav the Warrior's Joyous Encounter


Some crystalline structures can be seen lining the walls.

Something growls in the dark.

Echoing, from some distance, a voice speaks: 'Kcohav, did you know? That you were doomed even before you began?'

Kcohav turns their gaze to the next narrow opening, that joins this cave, to the next.

Kcohav lay on the ground, coughing as they drowned in the blood pouring from their shattered frame. It was over. The battle was lost. The princess was gone. Evil would inherit the surface... What evil? Humanity would be expunged... Which meant there was no evil, not anymore. Just the rightful owner taking back what was already theirs. Humanity was the evil. Kcohav closed their eyes, for the last time.

@shakna-israel
Copy link
Author

Still getting issues occasionally:

pandoc: Cannot decode byte '\xc3': Data.Text.Internal.Encoding.Fusion.streamUtf8: Invalid UTF-8 stream

Something to do with the name generator, I think.

gen_name_diagram() {
  # Grab a random twochar selection from the dictionary, and lowercase it.
  val=$(cat /usr/share/dict/words | cut -c-2 | uniq | shuf -n1 | tr '[:upper:]' '[:lower:]')
  # If we got something nonenglish, retry.
  while [ "$val" = 'bq' ] || [ "$val" = 'bz' ] ||
  [ "$val" = 'cf' ] || [ "$val" = 'cj' ] || [ "$val" = 'cv' ] ||
  [ "$val" = 'cx' ] || [ "$val" = 'fq' ] || [ "$val" = 'fv' ] ||
  [ "$val" = 'fx' ] || [ "$val" = 'fz' ] || [ "$val" = 'gq' ] ||
  [ "$val" = 'gv' ] || [ "$val" = 'gx' ] || [ "$val" = 'hx' ] ||
  [ "$val" = 'hz' ] || [ "$val" = 'jb' ] || [ "$val" = 'jd' ] ||
  [ "$val" = 'jf' ] || [ "$val" = 'jg' ] || [ "$val" = 'jh' ] ||
  [ "$val" = 'jl' ] || [ "$val" = 'jm' ] || [ "$val" = 'jp' ] ||
  [ "$val" = 'jq' ] || [ "$val" = 'jr' ] || [ "$val" = 'js' ] ||
  [ "$val" = 'jt' ] || [ "$val" = 'jv' ] || [ "$val" = 'jw' ] ||
  [ "$val" = 'jx' ] || [ "$val" = 'jy' ] || [ "$val" = 'jz' ] ||
  [ "$val" = 'kq' ] || [ "$val" = 'kx' ] || [ "$val" = 'kz' ] ||
  [ "$val" = 'mx' ] || [ "$val" = 'mz' ] || [ "$val" = 'pq' ] ||
  [ "$val" = 'pv' ] || [ "$val" = 'px' ] || [ "$val" = 'qb' ] ||
  [ "$val" = 'qc' ] || [ "$val" = 'qd' ] || [ "$val" = 'qf' ] ||
  [ "$val" = 'qg' ] || [ "$val" = 'qh' ] || [ "$val" = 'qj' ] ||
  [ "$val" = 'qk' ] || [ "$val" = 'ql' ] || [ "$val" = 'qm' ] ||
  [ "$val" = 'qn' ] || [ "$val" = 'qp' ] || [ "$val" = 'qq' ] ||
  [ "$val" = 'qv' ] || [ "$val" = 'qw' ] || [ "$val" = 'qx' ] ||
  [ "$val" = 'qy' ] || [ "$val" = 'qz' ] || [ "$val" = 'sx' ] ||
  [ "$val" = 'tq' ] || [ "$val" = 'vb' ] || [ "$val" = 'vf' ] ||
  [ "$val" = 'vh' ] || [ "$val" = 'vj' ] || [ "$val" = 'vk' ] ||
  [ "$val" = 'vm' ] || [ "$val" = 'vp' ] || [ "$val" = 'vq' ] ||
  [ "$val" = 'vw' ] || [ "$val" = 'vx' ] || [ "$val" = 'wq' ] ||
  [ "$val" = 'wv' ] || [ "$val" = 'wx' ] || [ "$val" = 'xd' ] ||
  [ "$val" = 'xj' ] || [ "$val" = 'xk' ] || [ "$val" = 'xr' ] ||
  [ "$val" = 'xz' ] || [ "$val" = 'yq' ] || [ "$val" = 'yy' ] ||
  [ "$val" = 'zf' ] || [ "$val" = 'zr' ] || [ "$val" = zx ]
  do
    val=$(cat /usr/share/dict/words | cut -c-2 | tr '[[:alnum:]]' | uniq | shuf -n1 | tr '[:upper:]' '[:lower:]')
  done
  echo "$val"
}

gen_name() {
  # Fairly crappy name generator.
  name=''
  for i in $(seq 1 $(shuf -i 2-4 -n 1)); do
    name="$name$(gen_name_diagram)"
  done
  # Capitalise first letter
  name=$(echo "$name" | awk '{ for ( i=1; i <= NF; i++) { sub(".", substr(toupper($i),1,1) , $i) } print }')
  echo "$name"
}

I would have thought passing it through tr '[[:alnum:]]' would have killed any odd symbols, but who knows. Debugging something where everything is random is kinda difficult.

@shakna-israel
Copy link
Author

I hate time.

Latest commit d2a4350 an hour from now

@shakna-israel
Copy link
Author

Today's journal entry: Heat wave, and cluster headache... Yeah, not much is getting done today.

@shakna-israel
Copy link
Author

Pre-release demo files are up: here.

They are incomplete, but show the basic structure and how it's coming along. I'm kinda impressed.

@LuRsT
Copy link

LuRsT commented Nov 4, 2018

Wow, so much progress! Keep it up!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

No branches or pull requests

5 participants