intfiction.org

The Interactive Fiction Community Forum
It is currently Wed Sep 26, 2018 2:47 am

All times are UTC - 6 hours [ DST ]




Post new topic Reply to topic  [ 23 posts ]  Go to page Previous  1, 2, 3  Next
Author Message
PostPosted: Fri Feb 23, 2018 10:37 am 
Offline
User avatar

Joined: Thu Feb 11, 2010 1:51 pm
Posts: 801
Location: Geneva, Illinois, USA
I'm going to draw some diagrams to show the differences in execution. I think we've talked about three kinds now: REPL, Pub/Sub?, and event driven state machine.

_________________
David C.
https://github.com/ChicagoDave

"It boots nothing to avoid his snares, for they are ever beset by other snares." - The shade of High Lord Mhoram, The Wounded Land - Second Chronicles of Thomas Covenant.


Top
 Profile Send private message  
Reply with quote  
PostPosted: Sat Mar 03, 2018 11:44 pm 
Offline

Joined: Sat May 03, 2008 11:32 pm
Posts: 298
jkj yuio wrote:
I know that systems with extensions have been around for a long time. but I'm talking about taking that modularity to another level. Imagine you wrote the behaviour (and properties) for a pet dog and this was all in a single module that you could simply copy verbatim into another game. Whereupon, in that other game, characters would pet the dog, react to the dog, and the dog itself would forage for bones etc and do dog-like things - automatically and driven entirely by data and no specific code.

I started designing something like this for Guncho, in the form of "bot realms": an NPC running in one realm could appear in a different realm by passing actions back and forth, interacting with a virtualized copy of the remote realm's world model.

A good implementation would either need a lot more introspection/reflection than Inform provides out of the box, or a big curated list of actions and attributes and such. It's more work than I was motivated to do on my own for something nobody would use, but I think it'd be relatively straightforward.


Top
 Profile Send private message  
Reply with quote  
PostPosted: Sun Mar 04, 2018 1:19 pm 
Offline
User avatar

Joined: Thu Feb 11, 2010 1:51 pm
Posts: 801
Location: Geneva, Illinois, USA
So I'm working on the graph data store at the moment and trying to optimize properties.

(Note this is about programming, in C#, so if TL/DR if you don't code)

For a graph, you have noun -> verb -> noun (leaving out the bidirectional use case for the moment).

However, the noun would be something like "item" or "location" so it also needs properties. Because this is a graph we have to link things together.

The problem is that within the story game, I'd like objects to be of a type (like Item, Location, Player). But they also need to be of type Vertex (noun) or Edge (verb).

I could do this by implementing IVertex and forcing all authored objects to implement the vertex required properties. Or all objects have to inherit a VertexBase class.

I'm undecided which way to go.

I was trying to use generics and that works until I need to combine object and vertex properties.

Any thoughts are appreciated.

_________________
David C.
https://github.com/ChicagoDave

"It boots nothing to avoid his snares, for they are ever beset by other snares." - The shade of High Lord Mhoram, The Wounded Land - Second Chronicles of Thomas Covenant.


Top
 Profile Send private message  
Reply with quote  
PostPosted: Sun Mar 04, 2018 1:24 pm 
Offline
User avatar

Joined: Thu Feb 11, 2010 1:51 pm
Posts: 801
Location: Geneva, Illinois, USA
In addition to this...if objects are c# classes, do I build a complex reflection process to pull property names and values out by their correct type and add them to a hash table or do I use JSONSerializer and then use some complex search mechanism to identify JSON properties in a list of objects. Or is there another, better option?

_________________
David C.
https://github.com/ChicagoDave

"It boots nothing to avoid his snares, for they are ever beset by other snares." - The shade of High Lord Mhoram, The Wounded Land - Second Chronicles of Thomas Covenant.


Top
 Profile Send private message  
Reply with quote  
PostPosted: Sun Mar 04, 2018 3:44 pm 
Offline

Joined: Sat May 03, 2008 11:32 pm
Posts: 298
DavidC wrote:
So I'm working on the graph data store at the moment and trying to optimize properties.

I'd say hold off on anything involving the word "optimize" until you have a working proof of concept.

Quote:
For a graph, you have noun -> verb -> noun (leaving out the bidirectional use case for the moment).
However, the noun would be something like "item" or "location" so it also needs properties. Because this is a graph we have to link things together.

The problem is that within the story game, I'd like objects to be of a type (like Item, Location, Player). But they also need to be of type Vertex (noun) or Edge (verb).

I'm having trouble envisioning how a graph like that is going to represent a game. Do you have a diagram?

Quote:
I could do this by implementing IVertex and forcing all authored objects to implement the vertex required properties. Or all objects have to inherit a VertexBase class.

One way around that is to use composition. Design the graph data store to be agnostic of your parser/world model, and just give every node a data field that can store whatever IF object you want.

Quote:
In addition to this...if objects are c# classes, do I build a complex reflection process to pull property names and values out by their correct type and add them to a hash table or do I use JSONSerializer and then use some complex search mechanism to identify JSON properties in a list of objects. Or is there another, better option?

Keep it simple for the proof of concept. Cloak of Darkness has like 4 rooms -- you can get by with brute force for now.


Top
 Profile Send private message  
Reply with quote  
PostPosted: Mon Mar 05, 2018 7:22 pm 
Offline
User avatar

Joined: Sat Jun 25, 2016 12:13 pm
Posts: 242
Perhaps consider the graph as a design abstraction rather than as an implementation guide. In 1996, i faced the same challenge and this is what i came up with;

My "graph" consisted of concepts and connections, but the connections did not have names since it turned out that the relations implied by connections needed also to be concepts. It was thus unlabelled. That being the case, the "graph" collapsed into a set of properties per concept. Eventually, the meaning of the concept itself became defined by these properties and the concept itself just a label.

So, each concept is a set;

Code:
lemon = {(color yellow) ...}
banana = {(color yellow) ...}
apple = {(color red) ...}


For inverses, eg. "what things are yellow", it was necessary to make a general rule; (R Y) in X => (Y X) in R.

then we get;

Code:
color = {(red apple), (yellow banana), (yellow lemon) ...}


Quickly yielding the results, banana & lemon.

It seems there are no collisions by storing the inverse properties in the very same data structures as the forward properties - since which are really forward and which really backward? They don't clash.

A corollary of (R Y) in X => (Y X) in R, must be (X Y) in R => (X R) in Y !

Writing this out, we get;

Code:
red = {(apple color) ...}
yellow = {(banana color), (lemon color) ... }


I used to call these three projections; forward, backward and sideways.

Code:
lemon = {(colour yellow)...}       "the color of lemon includes yellow"
colour = {(yellow lemon)...}       "yellow colored things includes lemon".
yellow = {(lemon colour)...}       "lemons are yellow because of color".


Implementationwise, each concept was a standard tree/set or map.


Top
 Profile Send private message  
Reply with quote  
PostPosted: Mon Mar 05, 2018 7:55 pm 
Offline
User avatar

Joined: Thu Feb 11, 2010 1:51 pm
Posts: 801
Location: Geneva, Illinois, USA
jkj yuio wrote:
My "graph" consisted of concepts and connections, but the connections did not have names since it turned out that the relations implied by connections needed also to be concepts. It was thus unlabelled. That being the case, the "graph" collapsed into a set of properties per concept. Eventually, the meaning of the concept itself became defined by these properties and the concept itself just a label.

...

Implementationwise, each concept was a standard tree/set or map.


This is the likely direction. There are two design requirements. Make it usable, but also allow for a fluent interface.

The graph interface so far is:

Code:
    public interface IGraph
    {
        List<T> Match<T>(string vertex, Guid? id, Dictionary<string,string> props) where T : IVertex;
        void Save<T>(string label, T data, Dictionary<string, string> props) where T : IVertex, new();
        void Connect<T, U>(T nodeA, IEdge edge, U nodeB);
        void Disconnect<T, U>(T nodeA, IEdge edge, U nodeB);
    }

_________________
David C.
https://github.com/ChicagoDave

"It boots nothing to avoid his snares, for they are ever beset by other snares." - The shade of High Lord Mhoram, The Wounded Land - Second Chronicles of Thomas Covenant.


Top
 Profile Send private message  
Reply with quote  
PostPosted: Mon Mar 05, 2018 9:04 pm 
Offline
User avatar

Joined: Thu Feb 11, 2010 1:51 pm
Posts: 801
Location: Geneva, Illinois, USA
If we follow the concepts idea, we start seeing things like:

Movement is an event when the player (or NPC) attempts to move in a compass direction or some other command meant to change locations.
Remove Skin is an event when the player (or NPC) attempts to peel a lemon.
Some properties are abstract. (Lemon is yellow, which can't be manipulated, though I guess there's probably some chemical mixture that could alter the color of a lemon, but in the case of IF, it's an abstraction)
Some properties are real. (Lemon has a skin)

I'm not sure about reverse and "sideways". I'll need to ponder those a bit more.

_________________
David C.
https://github.com/ChicagoDave

"It boots nothing to avoid his snares, for they are ever beset by other snares." - The shade of High Lord Mhoram, The Wounded Land - Second Chronicles of Thomas Covenant.


Top
 Profile Send private message  
Reply with quote  
PostPosted: Tue Mar 27, 2018 10:40 am 
Offline
User avatar

Joined: Thu Feb 11, 2010 1:51 pm
Posts: 801
Location: Geneva, Illinois, USA
I'm thinking about continuing refly development on a twitch stream. It will help keep me focused and allow others to chime in.

I'm sort of stuck on a big decision at the moment. There's a part of IF that allows you to "intervene" in any action with custom code. I'm trying to decide if I want to enable that, or see if refly can be truly data-centric and declarative. My gut tells me that would close off a lot of reasonable authoring features. So if I do enable code, it would probably be C#. I just don't want code to be so abstract that it kills the platform with complexity.

I'm just going to have to decide which direction I want to go and build it out that way. If it proves unwieldy, UNDO.

_________________
David C.
https://github.com/ChicagoDave

"It boots nothing to avoid his snares, for they are ever beset by other snares." - The shade of High Lord Mhoram, The Wounded Land - Second Chronicles of Thomas Covenant.


Top
 Profile Send private message  
Reply with quote  
PostPosted: Wed Mar 28, 2018 3:32 pm 
Offline

Joined: Sat May 03, 2008 11:32 pm
Posts: 298
DavidC wrote:
I'm sort of stuck on a big decision at the moment. There's a part of IF that allows you to "intervene" in any action with custom code. I'm trying to decide if I want to enable that, or see if refly can be truly data-centric and declarative. My gut tells me that would close off a lot of reasonable authoring features. So if I do enable code, it would probably be C#. I just don't want code to be so abstract that it kills the platform with complexity.


I don't think it's possible to do "real" IF without custom interventions -- when every behavior is standard, it's just a single-player MUD. The stories and puzzles in IF come from the places where the author deviates from standard behaviors.

But... who's to say your custom interventions can't be data-centric and declarative? A Turing machine is data-centric and declarative; it's a table of state transitions. In other systems, state transitions are often modeled as workflow graphs. You have graphs!

OTOH, if you do decide to add imperative scripting, you have other options that might fit better than C#: IronPython or F# would be nice and lightweight.


Top
 Profile Send private message  
Reply with quote  
Display posts from previous:  Sort by  
Post new topic Reply to topic  [ 23 posts ]  Go to page Previous  1, 2, 3  Next

All times are UTC - 6 hours [ DST ]


Who is online

Users browsing this forum: No registered users and 1 guest


You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot post attachments in this forum

Search for:
Jump to:  
Powered by phpBB® Forum Software © phpBB Group