OOI Code Concepts
This will eventually be converted in to c#, these are just concepts.
by Sam Fereday
HTML
<h3>Dialogue Constructor</h3>
<p>Note: This only manages main story strings at the moment, I will get around to side script later on.</p>
<p>String: This is your actual string of what needs to be said, simple as that. The name of the speaker is defined by the target.</p>
<textarea id="text">Test data</textarea>
<p>Add to chapter: More useful to the system so we can divide up chapters for easier management. But this still applies.</p>
<select id="chapters"></select>
<p>Appear after: Here you can select a previous string to appear after (chained conversation). This is also chapter based and will change accordingly.</p>
<select id="linkto"><option>Nothing</option></select>
<p>Target: This is where you select an entity to belong to (npc, etc). You'll need to make sure that the entity exists in the map when in use, but that's declared in the system.</p>
<select id="target"></select>
<p>Also need to flag if this section of dialogue will update the global story milestone.</p>
<p>Also need to have a max amount of characters that each thing can say, otherwise it'll go crazy off-screen.</p>
<button id="add">Add</button>
<h3>Current Structure</h3>
<div id="output"></div>
CSS
textarea {
width: 100%;
min-height: 4em;
}
;
JavaScript
// All this needs more of an Object Oriented approach, each chapter should be a model, also so should its data block too!
var output = document.getElementById("output");
// Note: This only deals with the main story dialogue right now. It doesn't take in to account sub quests and general chit-chat. But I'll get around to that one.
// Global data - stores your progress thus far through the whole game. Not sure if we'll use this as a save game bit. Probably strap the inventory / configs in here too.
var globalData = {
listing: {
"activeChapter": 1,
"chapters": [
{
"id": "chap_1",
"title": "Chapter 1",
"dialoguePosition": 1,
"stringBank": [
{
"id": "1a",
"str": "This is the first thing to say, it's a story thing, so it'll stick.",
"targetId": "player",
"nextid": "1b",
"belongsTo": "chap_1"
},
{
"id": "1b",
"str": "This is also another thing to say, it's another important milestone but part of a chain.",
"targetId": "npc",
"belongsTo": "chap_1",
"flagMilestone": true // Not yet implemented
}
]
},
{
"id": "chap_2",
"title": "Chapter 2",
"dialoguePosition": 1,
"stringBank": []
}
]
},
entities: [
// ID's are placeholders for character, as they are created by user, they are dynamically registered unlike npc's. After creation, they keep their data however through the game.
{
"id": "sys",
"name": "System / Narrator"
},
{
"id": "ent_party_0",
"isLeader": true, //...