I'm researching some way of reading files in the folder where my twine story is. I'm interested in reading my /images and /templates folders. Since my project will probably grow pretty large in time and I have no idea how to organize all the data (images of potraits, landscapes, characters, maps, etc.) that I'll be using in my game inside the Twine editor, I want to be able to extend my game through external files.
I would want to put images of my items, portraits of characters and landscapes into my /images folder and then .json templates into my /templates folder. Both folders would have their own subfolders.
I would like to specify the data such as properties of my game objects inside the .json file and then assign random image paths from the corresponding images folder to the object, then use 'new' and prototype inheritance to generate game objects when my twine game starts.
/images/Enemies/Goblins/Portraits holds the following files: GoblinPortrait1.jpg, GoblinPortrait2.jpg, GoblinPortrait3.jpg
/images/Enemies/Goblins/Characters holds the following files: GoblinStand1.jpg, GoblinStand2.jpg
/templates/Enemies/Goblins holds Goblin.json, GoblinSoldier.json, GoblinMaster.json, GoblinWorker.json
I would build a list of GoblinPortraits and another list for the GoblinStand images and then randomly assign the paths to these images to my Goblin enemy game objects. The properties of the Goblin enemy game object would be read from the .json file and then when needed instantiated using the new operator.
I'm very new to web development, but I'm very eager to learn and experiment.