Bay 12 Games Forum

Please login or register.

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

Author Topic: Roguelike worldgen...backwards.  (Read 7759 times)

Sowelu

  • Bay Watcher
  • I am offishially a penguin.
    • View Profile
Roguelike worldgen...backwards.
« on: July 01, 2008, 10:49:39 pm »

I was poking at this idea a little bit, just long enough to realise that it was while not impossible, very very hard.  Way beyond NP, and probably intractable for most practical purposes.  I would have tried it anyway...but lost interest while making my roguelike engine in the first place.  So I think I'll dump this idea here and let people throw tomatoes at it.

Dwarf Fortress makes a random world way in the past, and generates many years of history leading up to the present.  Time is strictly one-way, and causation is pretty simple.  Other games do this too, heck, most games with any random terrain do it.  It works pretty good, but it doesn't always give results that have the characteristics you want.  Like, maybe you wanted to have a lake in this shape, or wanted to make sure there were elves.  Tweaking history like that is always a little hacky in this system.

I propose a system that works kind of like a human GM or writer's thought processes.  Start with some basic characteristics about the world, and then keep running time back and forth, making connections, solidifying nothing until you're forced to.  Be willing to change features you've already come up with.  Have a VAST set of "common sense" rules that determine how one state can lead to another.

For example, let's say the world's script calls for some ruins next to the starting town.  The algorithm plunks down some abstract ruins in a fuzzy area, then says "Ruins need an explanation, and one is lacking!"  So it says "Maybe this place was destroyed by war.  Maybe it was destroyed by famine and abandoned... The dice say war!"  Which leads to, "Who were its inhabitants?  Who were they killed by?  Well...We have an abstract sense that there were orcs here.  And an abstract sense that there are humans here.  Stick one of those in each slot and see how it pans out."  If you later determine it's more important that humans didn't arrive until after the ruins were created, that part needs to be changed.

Obviously, once you hit too many connections, it gets impossible to fit everything in...it's almost exactly like making a crossword puzzle from scratch, one word at a time.  Sometimes you want to change one clue to fit another in, sometimes you gotta rip out a whole part of the board.  And sometimes you realise that you don't KNOW what could have destroyed that town, so you just say "It was mysterious" and leave it at that...which is fine if it's a minor place, and far in the past.

The advantages of this system are ENORMOUS, if it works.  You can create a world with the story of your choice, and not worry about fiddly details; they can change every time.  "There's a human town, where the player starts.  There's a tower about fifty overworld tiles away, and it has a villain.  The villain stole something.  Make the tower suitable for level 5 characters, and put a cave nearby that's suitable for levels 1-6."  Poof.  It's there, filling all the details in from some vast library.  The algorithm is nearly impossible to create, but if it exists, you've got enormous potential.

I want to do this someday.  I think that actually setting up the overworld map itself may be the hardest part, because you have to manipulate things in 2d instead of abstract space, and you have blobs of terrain to mess with.

The eventual goal (and the inspiration!) is something like Populous:  Your hero descends in a semi-divine manner into an essentially random world, at level 1, and needs to not only figure out what needs to be done but also figure out what the world's like.  Maybe this world, all the good guys are orcs, and all the powerful magic items are from a dwarven culture a few hundred years ago...etc.  In any case, the idea is a large collection of -short- roguelike stories, of varying difficulties, tied together by a tenuous thread.  Wow it would be nice to have a roguelike that you can win in the first month (or week!) of playing.

Don't even get me started on the game balance...just the plot and overworld map generator are impossible enough.

...Has anyone seen this done before, in theory or in practice?
Logged
Some things were made for one thing, for me / that one thing is the sea~
His servers are going to be powered by goat blood and moonlight.
Oh, a biomass/24 hour solar facility. How green!

Keiseth

  • Bay Watcher
    • View Profile
Re: Roguelike worldgen...backwards.
« Reply #1 on: July 02, 2008, 12:53:08 am »

The eventual goal (and the inspiration!) is something like Populous:

You had my attention up to this point. Now you have my complete and undivided attention. I've never seen it done before, and it does sound hard as hell... but it also sounds awesome, and it can't be impossible. Dwarf Fortress has done things I've deemed impossible or too crazy for one man to do, so I have hope. Though, the very thought of the algorithm is making my head pound...
Logged

Sowelu

  • Bay Watcher
  • I am offishially a penguin.
    • View Profile
Re: Roguelike worldgen...backwards.
« Reply #2 on: July 02, 2008, 01:10:38 am »

Let me just drop a little more of my supposed überplot, then shut up and get back to the mechanics.  The PC is the avatar of the multiversal god of adventuring (long story).  Each level is a Populous-style thing: "This world has these general rules in place" but is otherwise random.  Levels can be beaten in any order, replayed, etc.  Beating levels gives you permanent bonuses...limited in some very strict ways, but if you've beaten five worlds as a fighter class, you can get some bonuses to HP and strength.  Or swap out one bonus for a mage related bonus, if you beat one of those worlds as a mage as well, etc.  In any case, these unlockable bonuses are *always there* for your uh, "save file", and apply in any world you go back into.  So if you die, you just lose your progress in that world, not everything.  The intention is that later levels are *supposed* to have overwhelming odds, and only your seriously overpowered avatar can stand up to them.  Add some over-arching plots involving your personal relationships with the other gods, who you can chat with between worlds, and who your avatars may end up worshipping within one of the worlds, or tracking down their base of power across multiple hostile worlds to kill them...  and you've got a game that will never be remotely finished if it's even started, though I've got a big stack of design papers here.

But uh...mechanics, yeah.

This system could never remotely support as much detail as DF.  It can't track every civilian at ALL.  It can only track major powers, and I suspect that the time to build a successful world grows linearly or Nlog(N) with the number of entities the final world contains, and at -least- N^2 with the number of initial requirements.

The real problems, to me, are:  You've built up a huge map of connected events.  You end up with fundamental inconsistencies that aren't discovered until very late.  What does the algorithm do to resolve them?  Undo things bit by bit?  Where does it rip things out, and what changes does it decide how to make?

I'm thinking something like "copy off the worldgen state every ten seconds.  If your state stalls out completely N times in a row, go back one state...and if it keeps failing, go back *again*..."  I'm also thinking that well-established events (the player's hometown is RIGHT HERE, in this well established forest!) should grow resistant to being randomly replaced when something is inconsistant if they've been around a while, but it's hard to know when to give up and say "you know, that forest just isn't going to work".

I can't think of a better "which inconsistency should I replace?" algorithm than "choose randomly, weighted towards newly added ones".  It's dangerous to even weight against things that already have a lot of connections to other elements, because more elements means more chances that one of them is really to blame for the inconsistency.
« Last Edit: July 02, 2008, 01:17:29 am by Sowelu »
Logged
Some things were made for one thing, for me / that one thing is the sea~
His servers are going to be powered by goat blood and moonlight.
Oh, a biomass/24 hour solar facility. How green!

qwertyuiopas

  • Bay Watcher
  • Photoshop is for elves who cannot use MSPaint.
    • View Profile
    • uristqwerty.ca, my current (barren) site.
Re: Roguelike worldgen...backwards.
« Reply #3 on: July 02, 2008, 07:02:10 am »

Wow, sounds interesting.
I may try to do this someday(and get nowhere, probably)
Logged
Eh?
Eh!

Another

  • Bay Watcher
    • View Profile
Re: Roguelike worldgen...backwards.
« Reply #4 on: July 02, 2008, 08:10:21 am »

This reminded me of OpenTTD. Apparently they now have railroad building AI that is capable of undoing it's work to various points in the past and trying to go to the goal by different approaches. I've seen the process (relatively reasonable locally) and the results in-game. Connecting 2 given points on a discreet 2D plane with elevations doesn't always produce reasonable results even with using A* algorithm in several places.

I fear that  your idea, Sowelu, is way too far from generating reasonable game worlds even if several very talented programmers and designers tried it.

Maybe adding some bits of this goal oriented retrofitting (one plot/dungeon/history entry at a time) to a setting that was created on different principles could enhance already solid world?

P.S.(And pleeeease - no total autolevelling of monsters/loot)
Logged

LeoLeonardoIII

  • Bay Watcher
  • Plump Helmet McWhiskey
    • View Profile
Re: Roguelike worldgen...backwards.
« Reply #5 on: July 02, 2008, 12:00:52 pm »

Instead of the avatar of the god of adventuring, how about saying that the god of adventuring was slain by something really nasty? Heroes from all around the world, from all times, and from alternate realities are trying to take up the slain god's mantle. During the game your choices determine the game's ending after you succeed in achieving godhood.

This means you can start out as a badass, or as a weakling with big dreams, and still have a reason to go adventuring. But if you're already the avatar of the god of adventuring ... wouldn't you be out creating adventures for people instead of completing them?

Which would be an awesome game in its own right.

"Hm ... let's see, I'll just steal this lady's locket and toss it in the sewer, grab a few slimes from the bottom of the ocean and stick them in there, and mutate a rat to become a boss monster. Fill a few treasure chests, and we're off!"

You would be rated based on how well you balanced it to the hero, meaning if you give way too much treasure or too little, or make it too easy or too hard, or put in poisonous monsters without adding any antidotes, you'd get a lower score.

Anyway, back to the worldgen idea, you could make it far more likely to achieve certain ends by weighting worldgen parameters before you start. For example, if you want to make sure Elves survive, give them really great defenses but low expansionist values in their culture (otherwise they'd just steamroll everyone else). Or heck, just make all cultures like the Elves a little more so they're more likely to be diplomatic with them.

But I get your idea about going back and forth. I'm toying with the idea of making a time travel D&D campaign. I loved Chrono Trigger, but I realize now that the game was actually rather restrictive and that there were only a few possible changes you could make to the future.

Also I noticed that the only time period that could have meaningful direct impact was 600 AD, upon 1000 AD. Because the other time periods were so far apart, the terrain was generally quite different, and generations passed between them. Just to remind you:

65 million BC
12000 BC
600 AD
1000 AD
2300 AD
End of Time

You might think some interesting things might be seen in 2300 if you did stuff in 1000, but 2300 is a ruined wasteland.

So this heavily limits the number of event interactions you have to deal with.

Of course, there were some long-term impacts during play. For example, one quest had you putting a sun stone in a mountain to recharge in 65 million BC, and retrieving it in 2300 AD. But someone had stolen it in 1000 AD and you need to find him. It's not hard, he has sparkles coming up out of his house. But he's a greedy bastard, so you go back in time to 600 AD and do a selfless thing for his ancestor, which means his family's values change, and by 1000 AD he had been raised to be a generous guy. So he gives it to you :P And then you replace the stone in the mountain, and go forward to 2300 to take it.

But as I'm thinking about it, I would need to act like every event in the game is like a room in a dungeon, and they interact with each other in complex ways. If you open the valve in the water wheel room, the floodgates open and the grand entrance opens. Well, if you slay the bandits, help them, scatter them, join them, or take control of them it will have an impact on everything in the area.

We do this all the time in D&D. The problem is that to have a coherent time travel campaign you have to detail out a lot of the events that will happen in the absence of the PCs, and then modify what happens in the future due to PC activities in the past.

Another thing Chrono Trigger did was to say that when you traveled through time, you were really just going to that time period, but you couldn't choose an exact date. As an example that didn't actually happen in the game:

A. 600 AD: you open a chest, taking 100 GP
B. 1000 AD: You go back to 1000 AD and spend the money to buy a key
C. 600 AD: you use it to open a locked chest in 600

But you can't go back to before you opened that first chest at A and got 100 GP. It's like you're entering a timeline based on some external clock. You can't go back and take the 100 GP you got from the chest a day before you opened it at A. This prevents a lot of paradoxes from popping up. After all, if you went back to before A and took the 100 GP, you wouldn't have found it there in the first place to buy a key with.

Also, it means in Chrono Trigger you never meet past selves. Although it would be technically possible, in the case of Magus meeting himself in the past, although at that point in the story you don't have the adult Maguc in your party.

Also you can leave Robo to plant a forest in 600, retrieve him in 1000, then go back to 600 with Robo in your party. You can stand there with Robo in your group watching a duplicate Robo ploughing. But they don't communicate because you're on the world map.

But that means Chrono Trigger had no real mechanism for preventing paradoxes. It just shoehorned you into the path you needed to follow. It was still a great game, one of the best I've ever played. But it doesn't give many bright ideas for trying to run a D&D campaign.

My players might leave Robo in 600, go to 1000 to retrieve him, then return to 600 and pick him up. All they have to do is return him to his planting by say 700 AD, and they can still fulfill the time travel requirement of leaving him and picking him up again in 1000. But until that happens, they would have two Robos. Example:

600 AD: Leave Robo
(400 years of Robo sitting)
1000 AD: Pick up Robo
Travel to 600 AD: Pick up Robo
Step 3: ??
Adventure.
Travel back to 600 AD right after they picked up Robo: Leave him there

From the perspective of people in 600 AD, Robo was brought in, started work, left for a moment, came back and returned to work. He works for 400 years, then is picked up by the adventurers.

So obviously my campaign is problematic.
Logged
The Expedition Map
Basement Stuck
Treebanned
Haunter of Birthday Cakes, Bearded Hamburger, Intensely Off-Topic

Cthulhu

  • Bay Watcher
  • A squid
    • View Profile
Re: Roguelike worldgen...backwards.
« Reply #6 on: July 02, 2008, 12:42:58 pm »

Quote
Wouldn't you be out creating adventures for people instead of completing them?

Which would be an awesome game in its own right.

I want to play that game now.  Someone needs to make this.
Logged
Shoes...

Aqizzar

  • Bay Watcher
  • There is no 'U'.
    • View Profile
Re: Roguelike worldgen...backwards.
« Reply #7 on: July 02, 2008, 03:57:02 pm »

Quote
Wouldn't you be out creating adventures for people instead of completing them?

Which would be an awesome game in its own right.

I want to play that game now.  Someone needs to make this.

It was called Neverwinter Nights.  The idea isn't as great as it sounds, when you realize how much grunt level building and engine wrangling you need to do to make a world that will take more than five minutes for some players to burn through.


God I wish I had something interesting to contribute to the original topic.  It's an idea I've thought about endlessly.  But I always come back to the sticking point of thinking about how to teach a program to ask, "Why did this happen?"  Mind boggling.

EDIT: And because the news just broke today - Re-release Chrono Trigger dur this fall.  Fans rejoice.  I rejoice.
« Last Edit: July 02, 2008, 04:03:45 pm by Aqizzar »
Logged
And here is where my beef pops up like a looming awkward boner.
Please amplify your relaxed states.
Quote from: PTTG??
The ancients built these quote pyramids to forever store vast quantities of rage.

LeoLeonardoIII

  • Bay Watcher
  • Plump Helmet McWhiskey
    • View Profile
Re: Roguelike worldgen...backwards.
« Reply #8 on: July 02, 2008, 04:31:20 pm »

I bought Chrono Trigger in the Fall of 1998. Will I buy it again ten years later?
...
This might be what makes me buy a console.

Oh. And I didn't mean you'd make adventures for other people. People suck ass. I'm saying you'd make adventures for NPC adventurers who wander around doing things.

They'd spontaneously create intra-party drama if alignments didn't match!
Logged
The Expedition Map
Basement Stuck
Treebanned
Haunter of Birthday Cakes, Bearded Hamburger, Intensely Off-Topic

Sowelu

  • Bay Watcher
  • I am offishially a penguin.
    • View Profile
Re: Roguelike worldgen...backwards.
« Reply #9 on: July 02, 2008, 05:07:12 pm »

I remember seeing an RTS where you could only really command heroes by assigning bounties to things, and letting them decide if they wanted to go squish the bad guys for you.

Another: Yeah it's going to be scary crazy hard to get anything reasonable.  I think the key is going to be "generate as LITTLE information as possible, and then do more standard worldgen methods from there".  Your average early-game adventure would only really need like six data points to define the town, bad guy, the quest...  A number that low can certainly fit together easily enough without running into trouble.

I do think it's important that both the physical landscape and the plot are generated at the same time.  So if there's some stupid plot point that you're going to need to solve some quest to get a boat or something, (yeah it sounds like console RPGs, so what) the world has to support that.  However, I absolutely think that you can put off dungeon -generation- until way after the plot is done being written.  Okay, it's a dungeon, it used to be inhabited by the old dwarf civ that made some magic items.  Now it's got orcs and their minions living in it.  That's all the plot information you need (though there could certainly be more).

Ideally, the same game-world and plot could be replayed, and have all the monsters/dungeons/items get randomly re-made.  Worldgen doesn't contain that much data.  Which is to say... One world world might have a basic plot of "Find which kingdom is under the power of a demon, and slay its ruler".  You could do worldgen multiple times for that world, and each time get different kingdoms, different plot threads.  But you could also play each generated world multiple times, and within each one, see the same kingdoms but different dungeons.  (You only get the metagame reward on a per-world basis, no matter how many times you run worldgen, or how many times you play that one.)

...As for the overall "god of adventuring" thing, the plot is more like:  Way back when, you were the only god in your multiverse.  The multiverse was starting to collapse after a bazillion years, so you forged a path into another realm for your people to follow.  All very abstract, like most traditional "creation of the universe" stories.  When you got there, you found a nice lush multiverse that didn't have any people in it...only something around a hundred demigods.  Threatened, they all ganged up on you, scattered your power, and bound you for eons.  They took your people and started ruling over them as their new gods, in a thousand skillion different universes.  Then, the player (the first god) wakes back up.  Demigod culture has changed entirely since they now have subjects they're happily ruling, and they are wary of starting a new war.  They're considering whether it might work better to coexist with you, and help advance their own goals and god domains.  In the meantime, you need to go recover your power, fragments of which are hidden in each world you can adventure in...and in the meantime, bring the very *concept* of a hero and adventurer back to worlds where that idea has been lost.

(also, no autoleveling of monsters.  It's just that once you've beaten a bunch of worlds, your level 1 fighter is taking down veteran soldiers, trolls, and other things.  I like it when monsters have a constant threat level, and being stronger just means you fight -different- monsters.  Of course who knows how strong the trolls in this particular universe are?)

Not that I wanted to make this into a topic about the game plot, but still. :P
« Last Edit: July 02, 2008, 05:10:40 pm by Sowelu »
Logged
Some things were made for one thing, for me / that one thing is the sea~
His servers are going to be powered by goat blood and moonlight.
Oh, a biomass/24 hour solar facility. How green!

LeoLeonardoIII

  • Bay Watcher
  • Plump Helmet McWhiskey
    • View Profile
Re: Roguelike worldgen...backwards.
« Reply #10 on: July 02, 2008, 05:18:36 pm »

Yeah I never liked autoleveling. I absolutely hated it in FF8.

I remember playing, and leveling up, and realizing the same monsters had progressively more HP as I leveled up but gave the same XP ... I was like NOOO you bastards!
D:
Logged
The Expedition Map
Basement Stuck
Treebanned
Haunter of Birthday Cakes, Bearded Hamburger, Intensely Off-Topic

Torak

  • Bay Watcher
  • God of Gods of Blood.
    • View Profile
Re: Roguelike worldgen...backwards.
« Reply #11 on: July 02, 2008, 11:09:48 pm »

I remember seeing an RTS where you could only really command heroes by assigning bounties to things, and letting them decide if they wanted to go squish the bad guys for you.


Majesty: A fantasy Kingdom Simulator, Great game.
Logged
As you journey to the center of the world, feel free to read the death announcements of those dwarves that suffer your neglect.

One billion b-balls dribbling simultaneously throughout the galaxy. One trillion b-balls being slam dunked through a hoop throughout the cosmos. I can feel every single b-ball that has ever existed at my fingertips, I can feel their collective knowledge channeling through my veins. Every jumpshot, every rebound and three-pointer, every layup, dunk and free throw.

beorn080

  • Bay Watcher
    • View Profile
Re: Roguelike worldgen...backwards.
« Reply #12 on: July 02, 2008, 11:13:25 pm »

Actually in Chrono Trigger there was the mail series of items that you could power up in the past, go to the future, loot the powerful versions, then go back to the past and loot the weaker but still useful versions and keep the powerful ones. I've played that game WAY too much.

Anyway back on topic: The way I see it working is starting with basic geographic world gen and a single small town with a quest inside of it.  During your play townspeople drop phrases like "The town to the east is evil." The engine would then store all the data about that town in a file where when you head to the town and uses that to generate it.
Logged
Ustxu Iceraped the Frigid Crystal of Slaughter was a glacier titan. It was the only one of its kind. A gigantic feathered carp composed of crystal glass. It has five mouths full of treacherous teeth, enormous clear wings, and ferocious blue eyes. Beware its icy breath! Ustxu was associated with oceans, glaciers, boats, and murder.

Sowelu

  • Bay Watcher
  • I am offishially a penguin.
    • View Profile
Re: Roguelike worldgen...backwards.
« Reply #13 on: July 02, 2008, 11:22:08 pm »

Hmmm... Constantly continuing worldgen as the game is going on, Beorn?  That's really interesting.  Would be a weird take on those RPGs where you get to place towns and locations on the map yourself (Legend of Mana I think was one of them, maybe FFTA was another) by taking it out of the hands of the player.  Mostly.  Main problem I can see there is that you wouldn't get much depth, because it would be hard to weave multiple things together at once...plus it might be very difficult to change established things.  Things would end up very simple or shallow.
Logged
Some things were made for one thing, for me / that one thing is the sea~
His servers are going to be powered by goat blood and moonlight.
Oh, a biomass/24 hour solar facility. How green!

LeoLeonardoIII

  • Bay Watcher
  • Plump Helmet McWhiskey
    • View Profile
Re: Roguelike worldgen...backwards.
« Reply #14 on: July 03, 2008, 11:30:52 am »

Although, it means you could place random foreshadowing in alread-generated areas, and tie those threads together when it generates a nearby area. But there wouldn't be much reason to do it that way, other than saving time generating the world in the first place. Seems like it would be a huge house of cards missing most of the cards.
Logged
The Expedition Map
Basement Stuck
Treebanned
Haunter of Birthday Cakes, Bearded Hamburger, Intensely Off-Topic
Pages: [1] 2 3