erkyrath / tworld

A choice-based shared online text environment sandbox
MIT License
72 stars 13 forks source link

Builder interface UI: Age graph #89

Open zephjc opened 11 years ago

zephjc commented 11 years ago

Suggestion is a link from the main builder page to a graph of existing Locations within an Age, with - at least to start - a minimal UI, e.g. click Location node to start editing properties.

There are JS graph viz libraries like http://www.graphdracula.net/ which emit data nicely.

The benefit would be to allow the user to make sure all Location connections are in place when writing the Age.

There are probably caveats with the Tworld scripting language I'm not aware of however.

erkyrath commented 11 years ago

Yeah, the scripting language makes this tough. Tougher. It's a hard problem to begin with.

Twine demonstrates the value of this sort of thing, but it's not going to happen soon, I'm afraid.

zephjc commented 11 years ago

That's fine - I've been using paper and pencil as my guide, which works well enough! This might have more utility as a debugging tool to make sure all the paths you wanted to include exist.

erkyrath commented 11 years ago

Twine also has a feature where unimplemented hyperlinks appear in red. Might be worth doing.

sethwoodworth commented 11 years ago

Can you point me to where Ages are mapped to data in mongo? I would be really interested in trying to generate a map with existing data.

But first: This sounds like the sort of thing that Writers may not want to be seen. If that is so, it is not worth exploring.

erkyrath commented 11 years ago

The database structure is described at http://seltani.shoutwiki.com/wiki/Database_Collections

zephjc commented 11 years ago

@sethwoodworth My intention was purely for the building interface, so that Writers could ensure they had added/included all the connections they intended to, which could become a hassle for more complex Ages.

sethwoodworth commented 11 years ago

Pseudocode

edges = []
nodes = [lookup_location_name(locid) for locid in Age]
for worldprop (instanceprop?) in Age.worldprops if worldprop is a link:
    edges.append( (worldprop.locid, worldprop.val) )

This assumes that the value of a link property is the destination id, which I am not sure it is. I Ack'd around in the source and I found a Link class in twcommon/interp.py with the properties of target and external. But the class might be private to the interp file.

An easier solution might be to extend play.js. ~line 1528 there is code to parse a desc and create hyperlinks. We could create a js variable that keeps lists of visited locations (nodes) and their links (edges). But this would only give you a map of visited pages.

zephjc commented 11 years ago

In a Move-type property, the primary value should always be a realm-wide location key, should it not?

Also, "Caveat: dynamically created paths between Locations are not supported unless you travel to them while developing this Age."

sethwoodworth commented 11 years ago

Ah! that is what I was looking for Move properties

erkyrath commented 11 years ago

Please specify whether you're talking about a generated map view for builders or for players. Neither is high on my priority list, but this thread has gotten confused between the cases.

zephjc commented 11 years ago

@erkyrath : My original request was for builders only, as a development tool to help ensure all connections were there.

This is not something that should ever me made accessible for anyone other than that specific Age's builder(s), as it would be one large Age-ruining spoiler.