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 9389 times)

Sowelu

  • Bay Watcher
  • I am offishially a penguin.
    • View Profile
Re: Roguelike worldgen...backwards.
« Reply #15 on: July 03, 2008, 06:41:02 pm »

Yeah...I don't know about random foreshadowing, anyway.  The actual plot itself really should be fairly complicated, and should be written by a human, in order to be fun.  It's just the specific details of the plot that need to be randomized.  A plot that's randomly built up over time seems trivial, and it doesn't feel like the player would really be involved at all.
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!

Idiom

  • Bay Watcher
  • [NO_THOUGHT]
    • View Profile
Re: Roguelike worldgen...backwards.
« Reply #16 on: July 03, 2008, 08:31:25 pm »

Wait, wait, wait... as in the plot could be made up as you play?

LOST  :D
Logged

Cthulhu

  • Bay Watcher
  • A squid
    • View Profile
Re: Roguelike worldgen...backwards.
« Reply #17 on: July 03, 2008, 08:41:06 pm »

HE SHOOTS, HE SCORES!
Logged
Shoes...

Lord Dullard

  • Bay Watcher
  • Indubitably.
    • View Profile
    • Cult: Awakening of the Old Ones
Re: Roguelike worldgen...backwards.
« Reply #18 on: July 03, 2008, 11:18:51 pm »

Humm.. all this talk of Chrono Trigger AND roguelikes makes me wonder: what would a roguelike with time travel be like?

*boggle*
Logged

Sowelu

  • Bay Watcher
  • I am offishially a penguin.
    • View Profile
Re: Roguelike worldgen...backwards.
« Reply #19 on: July 03, 2008, 11:26:40 pm »

I thought about time travel.  I don't see any way to do it well, roguelike or not.  It takes a HUGE level of control over the player's actions, like in Chrono Trigger.

So the present-day mayor is a greedy twit, so you can go back in time to teach his ancestor the value of kindness?  Awesome, if you script the heck out of it.  But any game with any remote kind of plot would absolutely fall apart if you can go back in time to KILL the mayor's ancestor.  Even barring paradoxes.

Let's picture a roguelike with two time periods; 600 AD and 1000 AD.  You go to 1000 AD and dig a hole in the ground.  Then you go to 600 AD and drop an item above where that hole got dug.  When you return to 1000 AD, what happens?  Does the item fall in the hole?  From a very basic analysis, that seems stupid.  Of course it's way more likely that any item you drop in the past won't be there in the future, but whatever.
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 #20 on: July 03, 2008, 11:53:54 pm »

You'd have to devote an entire Roguelike to time travel, I think, to make it a remote possibility. Though it's certainly worth investigating. It could require massive amounts of memory, depending on how much you need to remember... Dwarf Fortress does this, granted, but I'm not sure if it does so enough to actually move things backwards, as I don't think that was ever Toady's intention.

Paradoxes would be a really big problem, even in small scale time travel. If you kill a group of goblins and get a powerful sword, then go back in time ten years and kill a goblin chieftain that ironically starts the group you just killed ten years later, does the sword still exist? Tracking if it should or not would be a nightmare.
Logged

Sowelu

  • Bay Watcher
  • I am offishially a penguin.
    • View Profile
Re: Roguelike worldgen...backwards.
« Reply #21 on: July 04, 2008, 02:54:50 am »

Many roguelikes have a huge problem with simulating what happens when the player is gone.  Most of them don't even try.  Always kind of bugged me...like Nethack, how the levels are always pristine when you arrive, and then suddenly they get dug up by the dwarves.  (aside from non-pristine bones levels)  Or Adom, where you can land in a level that has herb patches which are about to expire, which had no way of getting to their present state.  I always wanted to see a roguelike that was remotely realistic in that regard, and made an -attempt- to make levels look lived-in when you arrive.

Time travel would require an IMMENSE amount of work there.

For a while I was toying with some simulator stuff.  I always thought that if you left a dungeon alone after clearing its former residents out, you should get goblins moving in, and building fortifications intelligently.  But that's way beyond me.
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!

Aqizzar

  • Bay Watcher
  • There is no 'U'.
    • View Profile
Re: Roguelike worldgen...backwards.
« Reply #22 on: July 04, 2008, 03:01:15 am »

To make a time-travel game with plot would be virtually impossible without keeping the player in lockstep.  But for arguement's sake, imagine it as a sandbox, a tech-demo.  I think it could work something like this-

With appologies to the OP, I have to imagine it generating the world forward, for simplicity.

The world would need a definate startpoint and endpoint, beyond which no time travel could occur.  It would also need a start and end for worldgen, which could be slightly larger.  Say, the world starts at year 0, automatically ends at year 1000, and the player can travel to any specific point between years 100 and 950, to keep you from peeing in the primordial soup as it were.

Essentially, the key to the game would be to regen the world whenever the player moves forward in time.  It would take the world exactly as it is when the player hits the "future" button, and play it out again and again as necessary.  The hitch would be the player itself.  For the player's actions in the past, the game records every action, and makes that instance of the player part of the world.

For this to work at all, it would have to completely ignore paradoxes.  Everything that happens forward in time of your current activities is completely imperminant.  This would mean that, yes, you can go back to when you were in the past and kill your past self, and you'd keep living, interrupting whatever you were doing then, and obviously having a profound effect on the future.

I don't know what kind of game, let alone plot, you could work into something like this.  But it would be fun to play around with.
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.

Sowelu

  • Bay Watcher
  • I am offishially a penguin.
    • View Profile
Re: Roguelike worldgen...backwards.
« Reply #23 on: July 04, 2008, 04:28:52 am »

Here's a simple, simple exploit.

00:00: Drop 500 gold coins.  Wait.
01:00: Pick up 500 gold coins.  Go back one second.
00:59: Pick up 500 gold coins.  Go back one second.
00:58: Pick up 500 gold coins.  Etc...

That sort of exploit really puts a lot of constraints on how much you can travel...specifically, it implies that the timespan between periods you can travel to should be pretty large.

Hmm...If you re-run worldgen each time, then there's going to be enormous changes.  Pretty simple for an adventurer to go kill a small band of wandering settlers.  But then there's no town.  And then the political landscape can change entirely.  Essentially, different "futures" have absolutely NOTHING in common with each other thanks to the butterfly effect.  Which makes anything you see in the future kind of pointless once you go back again.  Hm.
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!

Sean Mirrsen

  • Bay Watcher
  • Bearer of the Psionic Flame
    • View Profile
Re: Roguelike worldgen...backwards.
« Reply #24 on: July 04, 2008, 05:31:26 am »

The 500 gold coins would, in terms of the game, have the same ID in whatever time you travel to.
So when you pick up the 500 coins @01:00, nothing conflicts with you, but when you go back to 00:59 and pick up the coins, you have two sets of objects with the same ID, thus the game knows you already have a set of objects you picked up before, or rather after. The 500 coins from 01:00 you already have would thus disappear when you pick up the 500 coins @00:59.
Logged
Multiworld Madness Archive:
Game One, Discontinued at World 3.
Game Two, Discontinued at World 1.

"Europe has to grow out of the mindset that Europe's problems are the world's problems, but the world's problems are not Europe's problems."
- Subrahmanyam Jaishankar, Minister of External Affairs, India

qwertyuiopas

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

My idea for a roguelike with time travel would be small changes and the instant a past self encounters a diffrence(seeing something somewhere else or whatever) every copy of yourself after that disappears, although what they did does not, and you take control of the player then. Things that the player would not notice would not trigger such a thing, such as a never used sword being given an extra magic effect that can't be seen until it was used. Maybe the last part you get an anti paradox item allowing you to help yourself beat the final boss....
Or you could put a remotely triggered event on an item you will pick up and then go scout ahead in a potentially deadly area then trigger the event just before you die allowing for carefully planned metagaming.
Alternatively it could ignore things it sees that have changed, only those it interacts with.
Logged
Eh?
Eh!

Sowelu

  • Bay Watcher
  • I am offishially a penguin.
    • View Profile
Re: Roguelike worldgen...backwards.
« Reply #26 on: July 04, 2008, 10:39:19 am »

So I'm trying to come up with some good heuristics for this method of worldgen.  You're building up your history, piece by piece; first you have a town, then you add a piece that talks about how that town was formed, then you add some stuff about the mayor...  Building something up in parts like that, you need some way to make sure you're on the right track.  Some way to look at all the options available to you and make an intelligent choice.

One thing I'm thinking of doing is having a "contrivance" counter, that essentially monitors how hokey the plot is getting.  Now I'm serious here.  It's one thing to say "The evil tower just appeared there!", you can get away with that...  But if the evil tower just appeared, and so did your hometown, and the mayor is the same guy who runs the store, and nobody can remember how their war against the goblins started, and it just so happens that you need to do a silly item-fetching quest to make the magic bridge appear, then the plot just starts looking really ridiculous.  You can only have so many absurd, contrived things in one game before the whole plot starts being suspect.  The more obviously contrived something is, and the more screen-time it gets, the worse.

So, each connection / explanation / node in the worldgen plot tree has a "contrivance" value, and when you define a world, you can specify what level of contrivance you want to keep it BELOW.  As a basic guide, the worldgen algorithm should prefer less-contrived solutions to problems...  So if it needs an origin for that goblin tower, it should try all the plotlines that involve it being goblin-built, or taken over from human ownership first.  Only if those explanations won't fit will it advance to the highly contrived options like the tower suddenly appearing out of thin air, or the tower being created in a week by a wizard, etc.  If while generating the plot, it runs out of contrivance points that it's allowed to spend, it treats that kind of like a contradiction; it should go back and snip out the most contrived parts, and look for better things to go in their place.

It'd be nice to have some kind of balance of contrivance vs. complexity.  Yes, we COULD track down where this seaside village came from...what empire settled it...who was in power at the time...what their motives were in settling that region...what geopolitical climates allowed the village to grow the way it did.  In some very detailed worlds that might even be useful somehow (mainly in a world with a lot of different towns that want a shared history).  However, in a early, simple world, the plot writer might set a very low complexity threshold, and medium contrivance threshold--allowing the game to conveniently say "The village has been here for a few hundred years" and not bother with any other flavor information at all.

Here's some holes I'm seeing in this idea...

First, it might be hard to predict how close to finishing worldgen you are, so it might be hard to tell if spending a lot of contrivance right now is okay (worldgen is nearly finished) or a really bad thing (there's a long way yet to go).  The plot graph is going to be a big tree with a bunch of interconnecting branches, so it can be difficult to know how much stuff needs to be generated.  This gets even trickier if you say "I -want- the plot to feel at least a little contrived".  We need to make an accurate guess about how much contrivance we can spend while we're first generating the world, because it's a HUGE waste of time and resources if you have to go back and replace some parts later.

Second, it seems like this might create situations like "I could add a sage NPC hanging around the town for some flavor!  But if I don't come up with a huge elaborate backstory, then he'll end up putting a few more contrivance points in the pool, and I really can't afford those."  Maybe increasing the complexity of the plot makes more contrivance acceptable?  Or maybe the naive approach really is correct, and adding a bunch of shallow NPCs would make the world seem more shallow, and keeping it simple is a necessary evil?

In any case, some of the contrivance points will be intrinsic to a node (like a node that says "The tower came out of thin air!" as an explanation for its origins), and some of them will be intrinsic to conditions that are detected in the graph (the mayor is the same person as the shopkeeper is the same person as the captain of the guard is the same person as the love interest etc etc etc).

Criticisms?  Help me poke holes in this heuristic.  I want to find out why this contrivance-based system won't work, so I can refine it into something that'll work better.
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!

Armok

  • Bay Watcher
  • God of Blood
    • View Profile
Re: Roguelike worldgen...backwards.
« Reply #27 on: July 04, 2008, 11:10:35 am »

What I have always wanted for storytelling games is some kind of fate system, that modifies random rolls and luck, simply BEFORE you do something it checks if it would cause a paradox, and if it would it uses a random event to prevent it.
So, if you tried to put an item on a place you'd later even SEE, then somone comes and stal it.
If you plant a tree were you have in the future seen a plain whit no trees, then the tree will be killed by bad weather.
if you try to kill the ancestor of someone you miss, or even get killed.
If you try to go near yourself some random event stops you from being seen.
etc.
If it's NPCs doing the timetraveling you could get it more complicated, leting them actualy meet themselves whit no problem if you do it right.
The system could also be used to in a more natural and less forced way make sure the player will always fulfil it's destiny, and not get randomly killed, as well as making the villain always get away, basically making plot armour a stat, a very special invisible stat prone to cheating.
Logged
So says Armok, God of blood.
Sszsszssoo...
Sszsszssaaayysss...
III...

Sowelu

  • Bay Watcher
  • I am offishially a penguin.
    • View Profile
Re: Roguelike worldgen...backwards.
« Reply #28 on: July 06, 2008, 05:02:21 am »

Okay, I'm hoping to start poking at some code for this in the next few days (no promises on how long before it's even a remotely usable demo).  I know I need to build up a library of causes and effects.  The question is how to enumerate them.

Let's say there's some event that we're using to explain why the humans are at war with the goblins.  "Poisoned the Water Supply" sounds good. What do we need to know about this event?  Let's call it...

ePoisonedWaterSupply
- It's an action that a faction takes on a location.
- It's some kind of offensive action, which means the acting faction should have a reason to attack the location.
- It's perpetrated against a settlement.  The target must have people living there.
- It must be performed locally.  The acting faction must have physical access to the targeted location.
- It's "subtle"; the actors must have some intrinsic ability to be subtle (some factions are too stupid to do this...trolls or giants might be too dumb)
- It requires the target location to have an "externally accessible water supply".  This is not very important though.  Unless some plot point specifically says "they don't drink water" or something, assume this is OK.
- It's "sneaky"; it can be performed by a small force against a larger defending force.
- It leads to some condition, let's call it "cWaterSupplyPoisoned", which lasts from days to months, and which kills or weakens the location's population while in effect.
- It is an "evil" action (largely because it attacks civilians), so it's generally only performed by a faction whose morals allow it.
- As an offensive action and as an evil action, it inspires hate for the actors within the target location.  It can inspire a declaration of war.
- It opens up a slot for a "mastermind"--some character within the acting faction who takes the blame, and who can later be killed in revenge (or used as a quest).  This is not mandatory.
- It requires that the acting faction have access to something toxic...which isn't difficult, since even a dead body would work.

I'm running out of ideas for the basic characteristics of this event.  We also need some strings when people refer to the event...
"%s poisoned %s's water supply"
"%s poisoned our water supply"
"%s poisoned our water supply with %s"
"the evil %s of the %s poisoned our water supply"
These can get built into other strings, presumably, generating something like "Five months ago, the goblins poisoned our water supply with dead human bodies, causing us to declare war on them.  The evil Blacktooth poisoned our water supply; I command that you kill him!  Blacktooth is hiding in a cave to the west."

Now the tricky part is still HOW DO YOU REPRESENT ALL THIS DATA.  What I'm noticing though, is that nearly all of the characteristics of events like this can be represented purely in text files with no event-specific code!  Same basic strategy as a DF tokens file, though I'd probably use (urk) XML.  Or maybe something more like STRIPS.

To put it more code-like...  And yes, this is total bull, and a lot of it doesn't make much sense, and a lot of it would have to be totally reworked, but I *HAVE* seen planning languages that can handle code remotely like this:
Code: [Select]
ePoisonedWaterSupply {
  requires actor is faction
  requires target is location
  optional mastermind is character

  include eOffensiveAction(actor, target)

  if mastermind {
    assert mastermind has faction actor
  }
  assert target has flag "occupied"
  assert actor has flag "subtle"
  assert actor can access physically target
  if target.watersupply {
    assert target.watersupply has flag "external"
  }
  assert actor.morality has "evil"
  assert cHasReasonToAttack(target, actor)

  causes cWaterSupplyPoisoned(target, timeRange(7 days, 3 months))

  has morality "evil"
  has inspireHate intRange(3, 20)
 
  where victim is faction
  {
    assert victim has location target
    can provide causeWarDeclaration(victim, actor)
    if mastermind {
      can provide cHasReasonToKill(victim, mastermind)
    }
  }
}

Does this sound...Remotely workable?  You'd have to work some more strings in there too.  Also, some events WOULD need custom code, and you'd need a way to state that in this text file so it would know to look for the custom stuff.

I just don't think this is possible to do if every single event, condition, cause, effect is hard-coded.

Seriously...Does this look alright, or does this look really insane?  The more I'm looking at this, the more I realize that it NEEDS an automated planner and some really insane planning algorithms that can handle multiple highly imperfect heuristic-based paths...but the important question is, *can* you represent all the important facts about every event and condition in this format?

Edit:  Dammit.  I knew this wasn't going to be easy, but I thought I'd be doing a whole lot of randomized-with-hints guessing and checking, instead of writing my own damn automated planner with free-variable support from freaking scratch.  >.<

I hadn't even considered the difficulty of handling free variables in a scripting type of language.  This may have just slipped past the realm of possibility.
« Last Edit: July 06, 2008, 05:14:40 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!

LeoLeonardoIII

  • Bay Watcher
  • Plump Helmet McWhiskey
    • View Profile
Re: Roguelike worldgen...backwards.
« Reply #29 on: July 07, 2008, 01:15:23 pm »

I played a really irritating flash game called Chronotron. You have a robot that starts in a time machine, and you have to get through the level to pick up an object and then move back to the time machine.

You can go out, do things, and come back to the time machine, and then go back in time to when you started the level. Your controllable robot can then wander around the level at your leisure, but your "past self" goes through the motions that you already did.

You can keep doing this over and over, generating multiple robots all doing their own thing which you determined earlier by doing it yourself.

There isn't a paradox, so long as all the robots get back to the time machine at some point. But of course, built into the game are ways to create a paradox. For example, if one of the robots falls into a pit, you lose because you created a paradox.

The game is driven by the level design - most levels require the actions of multiple robots in concert to reach the MacGuffin. Often you have to walk out, stand on a button to open a gate, and time yourself to decide how long you should wait on it for when the future self comes along to get through the gate and pick up the item.

So this game says that nothing arbitrary happens to prevent paradoxes. It's okay to meet your past self and make out with you. But any timeline that involved a paradox wouldn't result in a continuation of the story in the next level. So if you want to get to the next level, you have to play through it without generating a paradox.

Something tells me Sowelu was onto something with re-running worldgen, but I think you'd re-run worldgen every time you traveled through time. Ideally you'd re-run worldgen every tick, to take into account your character killing his grandfather. I think it would be possible to do this with a large game world eventually, but right now you could definitely do it with a small community. You'd have to have excellent AI, of course:

Example: You live in a small farming town. You can travel through time. It's the year 1000 right now.
Your friend's mother is a midwife, his father is a librarian. His young life involved lots of study and not much getting out to play. He hasn't married yet. If you end the game, the ending shows your friend becoming an old man who never marries, and he die at a reasonable age.

You travel back in time to when your friend's father was born. You steal the infant, though you don't know who it really is, and throw it off a cliff. As soon as the theft occurs, the worldgen assumes the infant is gone forever. If you leave the infant on the ground, worldgen would determine the likelihood of an unattended infant being picked up by someone and who that would be, and whether the infant would be returned to the parents.

Based on random chance, you could end up with your friend's mother marrying an ironworker instead, and so he grows up to be strong but uneducated, marrying a woman early and having lots of kids. That might mean he never becomes your friend, if you never met.

The paradoxes come in when the event in the past changes the actor, or changes whether or not the actor would have done it. For example, if your friend were sick you might go back in time to plant curative herbs in the forest so his parents would pick them and he would never develop a serious sickness. But if he never got seriously sick, you would never have thought of going back in time to plant the seeds. Effectively, you would have to figure out what of all historical events you need to go back and do for no reason other than to make sure they get done.

Likewise, say you go back and convince your grandfather to marry someone other than your grandmother because you know he's your grandfather. Even if you still exist, because someone else did marry your grandmother, there would be no reason for you to go back in time and convince some random dude to marry some random woman. If you didn't do that, he would probably marry your grandmother instead. So hello paradox.

We could get around this by giving the character some mystical protection from the effects of time travel. Meaning even if you break the world, you still exist and remember everything that has happened from your perspective. If you kill your parents, you still exist even though nobody could have conceived or birthed you. But the effects on your character are important and interesting, so this should be used only as a last resort.

The fate-style conservation of timeline is an easy way out. After all, most large scale processes are beyond the scope of individuals to influence. Even assassinating a hated political leader might not stop international events from occuring, since that leader isn't operating in a vacuum. He's just taking advantage of existing politics, the sentiment of the people, economic forces, cultural movements, etc. Someone else will fill the void, though you might argue that you could kill off every one who stepped up to lead. It's likely that the military would step in and take control, and we're playing a time travel game not a Rambo simulator.

I think making the main characters relatively weak, so they can't just solve their problems by force, is just about required. That way, you can protect important people and places just by making it certain that the time traveler will be slain trying to destroy them.

Then again, why restrict him? If you're already setting up a complex world, why not make him the most powerful force in it? Omnipotent characters are generally very boring, so still I'd go with a weaker one. It seems more satisfying to think and finesse your way through something rather than just bash it good.
Logged
The Expedition Map
Basement Stuck
Treebanned
Haunter of Birthday Cakes, Bearded Hamburger, Intensely Off-Topic
Pages: 1 [2] 3