steffendx / GoNorth

GoNorth is a story and content planning tool for RPGs and other open world games.
MIT License
571 stars 30 forks source link

JSON Export for NPC's #88

Closed 1e4 closed 2 years ago

1e4 commented 2 years ago

With the NPC export, under dialogs, how do you know which is the first node to interact with?

In the export array I'd expect a field start or first_node with the uuid of the node, how else do you tell which is the first dialog to appear? Is it that links[][0] is always the first step in a dialog and then you connect the nodes from there?

steffendx commented 2 years ago

You can identify the root node by finding the node which does not have a link object where the TargetNodeId equals to the Node Id. To build a hierarchy I have implemented a graph parser which might be really helpful for you. This function identifies the root nodes. If there are multiple root nodes GoNorth throws an exeception during exporting to code.

The NodeGraphBaseParser class also builds a hierarchy so this code might be a good reference.

Does that help?

1e4 commented 2 years ago

I think so yes, I can see that one doesn't have a target node. Would be nice to have a flag for this or someway of marking one as the first. Such as rootNode: true. Quests has this already implemented it seems due to "Start" always being the start and available.

Off topic for this ticket, but is there a way to export chapters? You can do quests individually, but no way to export as a chapter, nor do quests contain any relational data to identify what chapter it is, it does show under the "Connections" toggle, but nowhere in the export.

Finally, is there anyway to support development? This is a really good tool, I'm using it mainly for the quest side of things, however am considering using the NPC and Items, though both have issues with Images which aren't able to be uploaded to a CDN but also only reference the image, not the entire link to the image (Maybe I missed something on the wiki though I did read it before hand).

Appreciate all you're work, it's great!

steffendx commented 2 years ago

You are rigt that there is a small break between the dialog and quest for quests having starts. I implemented it that way since the quests are connected with other quests and therefore the ending and start is more important compared to a dialog. But I will keep this in mind and maybe extend the export to implement support for root node display.

An export for chapters is currently not available since I never needed this so far. But implementing a simple JSON export with the quest references should be pretty easy. I can include an export function to JSON in the future.

Thanks for offering to support development! I am always happy for pull requests. So if you want to add support to reference images of Npcs and items by adding a link to an external CDN (or upload the image to an external CDN automatically) I would be more than happy about a pull requests.

And thanks a lot for the kind words! I am really happy if my project can help you.

1e4 commented 2 years ago

Would be greatly appreciated if dialog mimicked quests in that sense of the start bit.

Export in the future sounds fantastic. It should just include the chapter details with a nested array of quests that are associated with it.

The CDN is a nice to have, not sure how I'm going to sync my images up though, perhaps just use nginx to proxy the address http://domain.example/api/StyrApi/FlexFieldObjectImage?imageFile={imageName} to something like http://domain.example/images/{imageName}

I unfortunately unable to PR, I have 0 knowledge of C# otherwise I would, hence asking if there was anyway to contribute monetarily :)

steffendx commented 2 years ago

An export for chapters sounds fairly easy and I will include this in the future.

In regards to the cdn: I think this is fairly specific so it would be hard to implement at this moment since it would be needed to sync it like you said.

Oh I missunderstood, sorry! Its really nice for you to offer but I want to keep this mainly a hobby project. But dont worry, I am always happy to include feature requests so I will take care of the export functionality.

1e4 commented 2 years ago

Awesome! Can't wait for the chapter export and hopefully the start node in quests. Thank you again for this tool!

steffendx commented 2 years ago

Thanks! Really appreciate it!