Howdy, Stranger!

It looks like you're new here. If you want to get involved, click one of these buttons!

Should games with lots of images have the the files stored externally?

What's optimal here? I pretty much know what I'm doing with internally stored images (on Twine 1/sugarcane) but I'm looking to make an adventure game with lots of different images in it. Is it best to store the files externally in this case to minimise the download size of the game?

If so, how do I do this? Is it best to use a cloud drive or can I link straight to pinterest for instance?

Comments

  • edited August 2016
    External storage will create pauses in image load during play, depending on how complex the images are. You're better to optimise the images correctly to reduce download size, such as by using http://www.jpegmini.com/
  • Thanks Claretta, I'll consider that an option but I'd prefer not to have to part with money if I don't have to (like my employers).
  • Tilaidie wrote: »
    What's optimal here? I pretty much know what I'm doing with internally stored images (on Twine 1/sugarcane) but I'm looking to make an adventure game with lots of different images in it. Is it best to store the files externally in this case to minimise the download size of the game?
    The best solution is likely to bundle the images with the compiled HTML file as separate files. This avoids both the size bloat caused by embedding them and any compilation issues from adding too many to your project. Also, if you plan to package them together within an archive for download, any network download issues during play.

    The setup is the same whether you plan on serving your project from a website or making it available for downloading as an archive—i.e. 7z, ZIP, RAR, etc.

    Make a new directory within the directory which contains the compiled HTML file—e.g. images—and place your images within it. Then, to reference the images in your project, you'd simply do something like the following:
    [img[images/some_image.jpg]]
    

    Tilaidie wrote: »
    If so, how do I do this? Is it best to use a cloud drive or can I link straight to pinterest for instance?
    Unless specifically allowed by the website hosting the resources, hotlinking to resources on third-party websites is usually heavily frowned upon. Don't be "that guy".
  • Tilaidie wrote: »
    Thanks Claretta, I'll consider that an option but I'd prefer not to have to part with money if I don't have to (like my employers).

    It's free to use.
  • Thanks Claretta, my mistake! That's really useful!

    TME, I'm pretty sure your answer is what I need but I can't quite figure it out yet. Soz!

    I created a folder for the game files, created a folder within that for the image files and slung a few pics in there to test. I opened a fresh twine file (in twine 1 with sugarcane) and created a new passage within it referencing - as you showed me - to one of the images. When I go to close the passage it asks 'Do you want to import the image files linked in this passage into the story file?'

    I click 'yes' and it comes up with the following error.

    'An error occurred while importing an image
    Traceback (most recent cal last):
    File "storyframe.pyo", line 668, in importImagefile
    File "storyframe.pyo", line 702, in openfileasbase64
    IO error: [errno 2] no such file or directory:

    ...under that it has a list of all the files that my test files are in.

    Any idea what I'm doing wrong?

    Also, do I need to save them as 'whatever.jpeg' or can I just save them as 'whatever'?
  • Tilaidie wrote: »
    When I go to close the passage it asks 'Do you want to import the image files linked in this passage into the story file?'

    I click 'yes'
    You want to answer 'No' to the 'Do you want to import...' question if you are planing to use externally stored image files.

  • That makes sense but when I do that and play the game from that passage, nothing shows.
  • Can you give an example of one of the image markup links that does not work in that passages, and can you give an example of the folder hierarchy where you are storing both your story TWS file and the related image files.
  • edited August 2016
    OK, I have
    [img[vt_img/cas1.jpeg]]
    
    in a passage of a Twine file that is in a file with another file containing the images. I also seem to have a copy of the same Twine file actually within the image file. I've tried both but I know the latter is wrong.

    Just to clarify, I do have a jpeg in the image folder titled 'cas1'.

    So the story is in something like User/Me/Documents/Twine/Gamename

    ...and the folder containing the images is in the same folder 'Gamename'.

    What am I missing?
  • notes:
    1. I am leaving the User/Me/Documents/ part out of my example to make it simpler. I am also using Gamename to represent the name of the actual story project file and the generated Story HTML file.

    2. Based on your last comment I am assuming that your folder/file structure is as follows.
    Twine/
    	Gamename/
    		vt_img/
    			cas1.jpeg
    
    		Gamename.tws
    		Gamename.html
    
    ... where the Gamename folder contains a sub-folder named vt_img, a Story Project file named Gamename.tws and a Story HTML file named Gamename.html which you generated using one of the Build options. And the vt_img sub-folder contains an image named cas1.jpeg

    I did not notice before that you are using Sugarcane, that story format has an issue with accessing a locally referenced image file using the [img[fine-name]] based markup. You will need to use a HTML image element like the following:
    <img src="vt_img/cas1.jpeg">
    

    Or you could switch to the SugarCube which does support using [img[fine-name]] based markup to reference local image files.
  • OK, I tried
    <img src="vt_img/cas1.jpeg">
    
    and I now have a broken image icon. Does the story need to be built for this to work by the way? - I just tried it post-build and got the same thing.

    A curious thing; another file appeared next to the gamename.html file and it seems identical bar the name 'tmpeseupu' (html).

    I'm pretty sure I didn't name it. What the hell is it!? :S
  • Maybe it's time I tried my luck with Sugarcube but I'd have to re-write and re-learn a lot of stuff. :(
  • Tilaidie wrote: »
    A curious thing; another file appeared next to the gamename.html file and it seems identical bar the name 'tmpeseupu' (html).

    I'm pretty sure I didn't name it. What the hell is it!? :S
    That is a temporary HTML file, they are created when you use the Test option to view your story in a web-browser.
  • OK, thanks greyelf. That clears that up at least.

    I've had a fiddle with it and I'm stumped. I still have only the broken image icon. Is there something I might be missing that links the image with the game?

    I'll attempt it in sugarcube when I get a chance, see if that works.
  • I tried it in Sugarcube2 and got a similar result. '[img[]]' with the broken file icon beside it. I'll keep fiddling...
  • Have you tried right-clicking on the broken image and copying the image URL? The specific menu item is called different things in different browsers but it shouldn't be hard to find—e.g. Copy image location, Copy image address, Copy picture.

    At the very least, that would show you what URL is being used, so you'd know where to look.
  • It's a file location not a URL.

    file:///C:/Users/Me/Documents/Twine/Gamename/vt_img/cas1.jpeg

    Does that explain what I'm doing wrong?

    I've dabbled with T2 but stuck with T1 because I'm not keen on everything being stored in my browser. I don't have a problem with images being referenced from an outside source like a cloud drive or similar (I forget the generic term for that - host?) but I like the game stored on my hard drive. I thought we were attempting to reference images in a file within the same file as the game files (tws & html) all stored on my hd.
  • Tilaidie wrote: »
    It's a file location not a URL.

    file:///C:/Users/Me/Documents/Twine/Gamename/vt_img/cas1.jpeg
    Don't teach grandpa to suck eggs. That is, in fact, a valid uniform resource locator—to a local resource, yes, but that has no bearing on whether it's a valid URL.

    Tilaidie wrote: »
    Does that explain what I'm doing wrong?
    Not if you've followed greyelf's examples.

    Assuming that all of the following are true:
    1. Your project's built HTML files—the one's from Build Story and Test Play—reside within the Gamename directory.
    2. The cas1.jpeg image resides within the vt_img directory.
    3. You're using the following image markup <img src="vt_img/cas1.jpeg">, in any story format, or [img[vt_img/cas1.jpeg]], in SugarCube 1/2.
    4. You've ensured that everything is spelled correctly.
    Then that should work. I'm kind of at a loss here. It's a problem on your end somewhere, but where seems to be eluding everyone.


    I'm attaching a ZIP archive of a working example project to this post which shows both image markups—built in SugarCube 2, but the HTML image markup should work even in the vanilla story formats.

    Could you try extracting it and testing it out? First, simply open the pre-built HTML file. After that, build the project yourself, saving the HTML within the same directory. Do both work for you?

    Also, have you tried opening the built HTML files in a different browser than you normally use?

    Tilaidie wrote: »
    I thought we were attempting to reference images in a file within the same file as the game files (tws & html) all stored on my hd.
    Within a sub-directory of the directory containing the built HTML files, yes.
  • edited August 2016
    Sorry TME, didn't mean to insult you.

    I tried the example and it works fine so I think that rules out any problem with my browser and clearly implicates me as the problem. Who would have thought that?

    I'm stumped. I haven't misspelled anything as I copied what I needed.

    It seems really straight forward to me so you guys must be stuck in a permanent facepalm by now. Soz for that.

    Oh well, feel free to leave me to work this out from here as it seems you've done all that can be done. I'm sure I'll have a moment of revelation soon enough.

    Thanks all.
  • edited August 2016
    Update - it's working in both cane and cube now. I still have absolutely no idea why it wasn't before. Either way, I'm all good now. Thanks again.
  • Hmm. On occasion, Twine 1 can begin failing to updating the built HTML files when requested—I'm unsure why. My usual fix is simply to close Twine and reopen it. It's possible that you may have run afoul of that and never noticed.

    Regardless, at least it's working for you now. So, woot!
Sign In or Register to comment.