shifting dreamscape

I have a concept idea for a game that builds the map around the player. I also wish it to disassemble the areas the player hasn’t been in for a certain time span. The problem is that I have no idea on how to do it. Any suggestions?

To clarify things: I want it similar to the example “all roads lead to mars” in the documentation.

(If you’ve read ender’s game, what I’m going for is like the mind game.)

One cool thing about text adventures: You can get by often by describing something happening without mechanically doing it.

On a high level, I’d say do this by just using one room and moving “set pieces” (scenery, objects, npcs) in and out of the location like it’s a theater stage, and sell it with your narrative and descriptions.

IIRC you can change the mapping relations just like any other: “now the Sand Room is north of the Dark Cave.”

That doesn’t seem like it would work. How would it remember the immediate vicinity for a short time?
But it does sound like a good try.

You question is very very general. How much I7 do you know?

One of the first things I ever wrote in Inform was a world consisting of a endless flat plane, implemented as a single room with modified movement rules. I don’t have it with me right now, but here’s a quick reimplementation:

"Tron"

Section - Coordinates and Setting

A thing has a number called the x-coordinate.  The x-coordinate of a thing is usually 0.
A thing has a number called the y-coordinate.  The y-coordinate of a thing is usually 0.

The Virtual Plane is a room. "You are standing on a vast featureless surface."

The printed name of the virtual plane is "Virtual Plane ([x-coordinate of player], [y-coordinate of player])".

A signpost is fixed in place in the virtual plane. "You see here a rusty old signpost.  It looks strangely out of place in this otherwise featureless world."  The x-coordinate is 0.  The y-coordinate is 0.  The description is "The signs point in the four cardinal directions, and read 'NORTH', 'SOUTH', 'EAST' and 'WEST'. How useful."  Understand "sign", "signs" and "post" as the signpost.

The mysterious box is a container in the virtual plane.  "A mysterious box lies here on the surface. You have no idea how it got here."  The x-coordinate is 2.  The y-coordinate is 3.  The description is "Actually, it looks like just an ordinary box. The only thing mysterious about it is how it ended up in this place."

A red pebble is a kind of thing.
A green pebble is a kind of thing.
A blue pebble is a kind of thing.

The player carries 10 red pebbles, 10 green pebbles and 10 blue pebbles.

Section - Virtual Movement

The virtual storage is a privately-named container.

Instead of going a direction (called dir) in the virtual plane:
	let dx be 0;
	let dy be 0;
	if dir is listed in {northeast, east, southeast}, now dx is 1;
	if dir is listed in {northwest, west, southwest}, now dx is -1;
	if dir is listed in {northwest, north, northeast}, now dy is 1;
	if dir is listed in {southwest, south, southeast}, now dy is -1;
	if dx is 0 and dy is 0:
		continue the action;
	otherwise:
		virtualize surroundings;	
		increase the x-coordinate of the player by dx; 
		increase the y-coordinate of the player by dy; 
		realize surroundings;
		try looking.

To virtualize surroundings:
	repeat with the item running through things in the virtual plane:
		now the x-coordinate of the item is the x-coordinate of the player;
		now the y-coordinate of the item is the y-coordinate of the player;
		unless the item is the player, move the item to virtual storage.

To realize surroundings:
	repeat with the item running through things in virtual storage:
		if the item is virtually present, move the item to the virtual plane.

To decide whether (item - a thing) is virtually present:
	if the item is not in the virtual plane and the item is not in virtual storage, decide no;
	if the x-coordinate of the item is not the x-coordinate of the player, decide no;
	if the y-coordinate of the item is not the y-coordinate of the player, decide no;
	decide yes.

When play begins:
	repeat with the item running through things in the virtual plane:
		unless the item is the player, move the item to virtual storage;
	realize surroundings.

Section - Testing

Test me with "x post / drop green / e / e / drop red / n / n / n / get box / sw / sw / s / drop box / put blue in box / se / ne / get all / nw / sw".

The original also had NPCs roaming around the plane, and features visible from a distance (with approximate directions given). Neither one is particularly difficult to implement. In fact, here’s a version of the movement rule for NPCs:

Section - NPCs

Bob is a man in the virtual plane. "Bob is here, wandering about aimlessly."

Every turn when a random chance of 1 in 2 succeeds:
	let L be {north, northeast, northwest, south, southeast, southwest, east, west};
	let N be a random number between 1 and the number of entries in L;
	let dir be entry N of L;
	try Bob going dir.

Instead of someone going a direction (called dir) when the actor is in the virtual plane or the actor is in virtual storage:
	let dx be 0;
	let dy be 0;
	if dir is listed in {northeast, east, southeast}, now dx is 1;
	if dir is listed in {northwest, west, southwest}, now dx is -1;
	if dir is listed in {northwest, north, northeast}, now dy is 1;
	if dir is listed in {southwest, south, southeast}, now dy is -1;
	if dx is 0 and dy is 0:
		continue the action;
	otherwise:
		if the actor is in the virtual plane, say "[The actor] wanders off to [dir].";
		increase the x-coordinate of the actor by dx; 
		increase the y-coordinate of the actor by dy; 
		if the actor is virtually present:
			move the actor to the virtual plane;
			say "[The actor] arrives from [opposite of dir].";
		otherwise:
			move the actor to virtual storage.

You can do that, but you need a slightly different syntax, and you need to be explicit about how all connections between rooms change.

For instance, if we have a world where Another Place lies to the south of The Place, and we want to put Another Place to the north of The Place when the player sing, we write:

[code]The Place is a room.

A room called Another Place is south of The Place.

Instead of singing:
now Another Place is mapped north of The Place.
[/code]
But this will only add a connection to the map: as it stands, after singing Another Place will be both south and north of The Place. We explicitly have to say that the one is no longer south of the other:

[code]The Place is a room.

A room called Another Place is south of The Place.

Instead of singing:
now Another Place is mapped north of The Place;
now Another Place is not mapped south of The Place;
[/code]
Now, after singing Another Place is north of The Place and is no longer south of The Place; however this only achieves the changes literally and explicitly stated. In particular, The Place will still be north of Another Place, just as it was before, since we have told the game to change that connection! So to make the changes we want, we’d better be as explicit as we can about this:

[code]The Place is a room.

A room called Another Place is south of The Place.

Instead of singing:
now Another Place is mapped north of The Place;
now The Place is mapped south of Another Place;
now Another Place is not mapped south of The Place;
now The Place is not mapped north of Another Place.[/code]

That said, HanonO suggests what may very likely the best way to do things

But I’m not at all sure about exactly what effects you’re after.

You asked about dismantling old areas “after a certain time span”. Maybe you want to do something like vyznev’s code, but with (say) eight rooms instead of one. Always keep the current room and the previous seven in place. When the player tries to move to a new one, remove the oldest room, change its description, and drop the player into it.

I know enough to make things and move things. Pretty much I know enough to make a game. However, I just don’t know this.

Brilliant breakthrough!!! Use the all roads code with [size=150]randomness[/size] :open_mouth:

very brilliant I think.

But NOT WORKING!!!

:imp:

You could use a recurring scene that runs for ten turns and restarts. At the end of the scene run all of your code to change things around.

Good Idea Hannon0

BUT…

I want it to be like a dream. Things shift in slight ways, but not all at once.

OK one thing left:

How do I completely remove a room from the map? and by map I mean the region accessible to the player.

You cannot remove a room in standard inform. You can remove all connections to it though.

Otherwise, there is a dynamic rooms extension I believe.

That is what I meant by the region accessible to the player.

Shouldn’t that be “change the north exit of The Place to Another Place”? At least, that’s what the documentation uses.

Of course, this can be easily encapsulated in a phrase, as in:

To connect (B - a room) to (thataway - a direction) of/from (A - a room):
	let thisway be the opposite of thataway;
	change the thataway exit of A to B;
	change the thisway exit of B to A.

For example, here’s a demo of a totally randomized map:

"Random Graph"

To connect (B - a room) to (thataway - a direction) of/from (A - a room):
	let thisway be the opposite of thataway;
	change the thataway exit of A to B;
	change the thisway exit of B to A.

The Nodeset is a region.

Alpha, Beta, Gamma, Delta, Epsilon, Zeta, Eta, Theta, Iota, Kappa, Lambda, Mu, Nu, Xi, Omicron, Pi, Rho, Sigma, Tau, Upsilon, Phi, Chi, Psi and Omega are rooms in the Nodeset.

To decide whether (B - a room) is not connectable (thataway - a direction) of/from (A - a room):
	if B is not a room or B is not in the Nodeset, decide yes;
	if B is A or B is adjacent to A, decide yes;
	if the room the opposite of thataway from B is a room, decide yes;
	decide no.

Before going a direction (called thataway) in the Nodeset:
	let destination be the room thataway from the location;
	if destination is not a room:
		while destination is not a room or destination is not connectable thataway from the location:
			let destination be a random room in the Nodeset;
		connect the destination to thataway of the location;
		instead try going thataway.

Before exiting in the Nodeset:
	if the holder of the player is the location, instead try going outside.

The player carries a marker.

Test me with "drop marker / n / n / e / s / w / u / in / jump / out / d / e / n / w / s / s / get marker".

Note that, in this example, exits never change once they’ve been created, but that’s only because the code takes extra care never to override previously created exits. It would be quite easy to make this code forget old map connections and replace them with random new ones.

In the words of a famous movie:

IT’S ALIVE!!!

My code finally works!!!

Here is the completed version:

[code]the maximum age is a number which varies. the maximum age is 5

A room can be shifting. A room is usually not shifting. A room has a number called age. the age of a room is usually 0.

A room is either active or inactive. a room is usually inactive.

Before going a direction (called way) when a room (called the place) is inactive and the place is not shifting and the location is shifting (this is the mapmaking rule):
let further place be the room the way from the location;
if further place is a room, continue the action;
let reverse be the opposite of the way;
let next location be a random inactive room which is shifting;
if the room reverse of the next location is a room:[Ensures we are not overwriting a permanent connection.]
abide by the mapmaking rule;
otherwise:
change the way exit of the location to the next location;
let reverse be the opposite of the way;
change the reverse exit of the next location to the location;
continue the action.

Every turn:
repeat with loop running through active rooms which are shifting:
If the player is not in the loop:
increase the age of the loop by 1;
if the age of the loop is the maximum age:
dissassemble the loop;
else:
now the age of the loop is 0:

After looking:
now the location is active.

to dissassemble ( place - a room):
repeat with way running through directions:
let reverse be the opposite of way;
if the room way of the place is a room(called the other place):
If the other place is shifting:
change the way exit of the place to nowhere;
change the reverse exit of the other place to nowhere;
now the place is inactive. [/code]

Now all I have to do is define rooms. Thank you all for your assistance. :smiley:

By the way, you are all getting credit in the credits.

Great now I feel like :ugeek:

That is also done with the All Roads example.