Skip to content

Commit

Permalink
Version 0.1.3.
Browse files Browse the repository at this point in the history
Version 0.1.3. Continued work on automated rehearsal system. The personality model of new storyworlds will no longer include self perceptions. Effect creation screen changed to disallow editing the coefficients of bnumber pointers. About window changed to note the use of Godot 3.5.3. Script editor changed to replace "Arithmetic Mean" with "Average." New storyworld metadata added, including about text, meta description, language, and age rating. Interface of compiled storyworlds changed to improve gui and add display options for players. Authors can set the default display theme and font size of a compiled storyworld. Documentation updated to reflect these changes. Added ability to export storyworld to txt file. Fixed spool deletion so that spool references are deleted from scripts, and effects that affect a deleted spool are themselves deleted.
  • Loading branch information
FrobozzWaxwing committed Dec 15, 2023
1 parent cce4cd3 commit 29440f9
Show file tree
Hide file tree
Showing 137 changed files with 3,198 additions and 1,200 deletions.
98 changes: 0 additions & 98 deletions godot/CharacterTraitEditingInterface.gd

This file was deleted.

30 changes: 22 additions & 8 deletions godot/Compiler.gd
Original file line number Diff line number Diff line change
Expand Up @@ -22,17 +22,31 @@ func get_template_from_file():
print(error_message)
return html_content

func _init(game_data, storyworld_title, storyworld_author, ifid, storyworld_debug_mode_on, template = "res://custom_resources/encounter_engine.html"):
func _init(game_data, storyworld, template = "res://custom_resources/encounter_engine.html"):
file_to_read = template
output = get_template_from_file()
if (!storyworld_debug_mode_on):
if (!storyworld.storyworld_debug_mode_on):
var regex = RegEx.new()
regex.compile("\\s*console\\.log\\(.*\\);")
output = regex.sub(output, "", true)
if ("" != storyworld_title):
output = output.replacen("<title>SweepWeave Storyworld Interpreter</title>", "<title>" + storyworld_title + "</title>")
if ("" != storyworld_author):
output = output.replacen("<meta name=\"author\" content=\"Anonymous\">", "<meta name=\"author\" content=\"" + storyworld_author + "\">")
if ("" != ifid):
output = output.replacen("<meta prefix=\"ifiction: http://babel.ifarchive.org/protocol/iFiction/\" property=\"ifiction:ifid\" content=\"\">", "<meta prefix=\"ifiction: http://babel.ifarchive.org/protocol/iFiction/\" property=\"ifiction:ifid\" content=\"" + ifid + "\">")
if ("" != storyworld.language):
output = output.replacen("<html>", '<html lang="' + storyworld.language + '">')
var meta = ""
if ("" == storyworld.storyworld_title):
meta += "<title>An Interactive Storyworld</title>"
else:
meta += "<title>" + storyworld.storyworld_title + "</title>"
if ("" == storyworld.storyworld_author):
meta += '<meta name="author" content="Anonymous">"'
else:
meta += '<meta name="author" content="' + storyworld.storyworld_author + '">'
if ("" != storyworld.ifid):
meta += '<meta prefix="ifiction: http://babel.ifarchive.org/protocol/iFiction/" property="ifiction:ifid" content="' + storyworld.ifid + '">'
if ("" != storyworld.sweepweave_version_number):
meta += '<meta name="generator" content="SweepWeave ' + storyworld.sweepweave_version_number + '">'
if ("" != storyworld.meta_description):
meta += '<meta name="description" content="' + storyworld.meta_description + '">'
if ("" != storyworld.rating):
meta += '<meta name="rating" content="' + storyworld.rating + '">'
output = output.replacen("<!-- Storyworld Metadata -->", meta)
output = output.replacen('<script type="text/javascript" src="storyworld_data.js"></script>', "<script>" + game_data.replacen("\\n", "<br>\\n") + "</script>")
89 changes: 60 additions & 29 deletions godot/HB_Record.gd
Original file line number Diff line number Diff line change
Expand Up @@ -11,13 +11,17 @@ var antagonist_choice = null
var encounter = null
var is_an_ending_leaf = false
var turn = 0
var fully_explored = false
var relationship_values = {}
# {character id: copy of bnumber_properties}
var spool_statuses = {}
# {spool id: copy of is_active}
var parent_record = null
var branch_records = []
var explored_branches = []
var unexplored_branches = []
var parallel_to = []
var can_be_skipped = false
var path_multiplier = 1
var path_count = 0 #The number of paths branching off from this record. The count is recursive: if this record has only one child but the child record has two children, both of which are ending leaves, then this record's branch count should be 2.

func record_character_states(storyworld):
#Clear out any old data.
Expand All @@ -26,14 +30,41 @@ func record_character_states(storyworld):
for character in storyworld.characters:
relationship_values[character.id] = character.bnumber_properties.duplicate(true)

func record_occurrences():
func record_yielding_paths():
#Add the record's branch count to the yielding path count of each of the record's events.
var additional_paths = path_count * path_multiplier
if (null != player_choice):
player_choice.yielding_paths += additional_paths
if (null != antagonist_choice):
antagonist_choice.yielding_paths += additional_paths
if (null != encounter):
encounter.yielding_paths += additional_paths
for each in parallel_to:
each.path_count = path_count
each.record_yielding_paths()

func set_as_ending_leaf():
is_an_ending_leaf = true
path_count = 1
if (null != encounter):
encounter.potential_ending = true

func increment_occurrences():
if (null != player_choice):
player_choice.occurrences += 1
if (null != antagonist_choice):
antagonist_choice.occurrences += 1
if (null != encounter):
encounter.occurrences += 1

func decrement_occurrences():
if (null != player_choice):
player_choice.occurrences -= 1
if (null != antagonist_choice):
antagonist_choice.occurrences -= 1
if (null != encounter):
encounter.occurrences -= 1

func record_spool_statuses(storyworld):
#Clear out any old data.
spool_statuses = {}
Expand All @@ -44,43 +75,41 @@ func record_spool_statuses(storyworld):
func get_parent():
return parent_record

func get_children():
return branch_records

func add_branch(page):
page.parent_record = self
branch_records.append(page)

func get_fully_explored():
if (fully_explored):
return true
elif (is_an_ending_leaf):
return true
if (0 < branch_records.size()):
for each in branch_records:
if (false == each.fully_explored):
return false
return true
unexplored_branches.append(page)

func is_parallel_to(sibling):
if (null != antagonist_choice and null != sibling.antagonist_choice):
if (antagonist_choice.is_parallel_to(sibling.antagonist_choice)):
return true
return false

func _init(in_parent = null):
parent_record = in_parent

func clear():
var children = get_children().duplicate()
func clear_children():
var children = explored_branches.duplicate()
for child in children:
child.clear()
child.call_deferred("free")
explored_branches.clear()
children = unexplored_branches.duplicate()
for child in children:
child.clear()
child.call_deferred("free")
unexplored_branches.clear()

func clear():
clear_children()
player_choice = null
antagonist_choice = null
encounter = null
is_an_ending_leaf = false
turn = 0
fully_explored = false
relationship_values.clear()
spool_statuses.clear()
parent_record = null
branch_records.clear()

func set_as_copy_of(original):
clear()
Expand All @@ -89,20 +118,22 @@ func set_as_copy_of(original):
encounter = original.encounter
is_an_ending_leaf = original.is_an_ending_leaf
turn = original.turn
fully_explored = original.fully_explored
relationship_values = original.relationship_values
spool_statuses = original.spool_statuses
relationship_values = original.relationship_values.duplicate()
spool_statuses = original.spool_statuses.duplicate()
parent_record = original.parent_record
for page in original.branch_records:
for page in original.explored_branches:
#Branches will still have original parent.
explored_branches.append(page)
for page in original.unexplored_branches:
#Branches will still have original parent.
branch_records.append(page)
unexplored_branches.append(page)

func stringify_option(cutoff = 50):
var result = ""
if (null == player_choice):
result += "null"
else:
var fulltext = player_choice.get_text(self)
var fulltext = player_choice.get_text()
if ("" == fulltext):
result += "[Blank Option]"
else:
Expand All @@ -117,7 +148,7 @@ func stringify_reaction(cutoff = 50):
if (null == antagonist_choice):
result += "null"
else:
var fulltext = antagonist_choice.get_text(self)
var fulltext = antagonist_choice.get_text()
if ("" == fulltext):
result += "[Blank Reaction]"
else:
Expand Down
Loading

0 comments on commit 29440f9

Please sign in to comment.