User Tag List

Results 1 to 3 of 3

Thread: Including external files and/or binary data with interpreted expressions

  1. #1
    Clicker Multimedia Fusion 2SWF Export Module

    Join Date
    Sep 2006
    Posts
    1,577
    Mentioned
    2 Post(s)
    Tagged
    0 Thread(s)

    Including external files and/or binary data with interpreted expressions

    I've been trying to include fairly large volumes of external files into my project's exe that are loaded at runtime via expressions, like generating backdrops or loading tilesets from PNG files, or level INIs and data. After testing the binary data extensively and looking up all the guides and threads, it really doesn't look like it works properly. I made sure I had proper syntax extracting files, loading them from the temp file address, releasing them on app close, etc- and no matter what permutation of where the build path was or data path was really worked, the compiled .exe would still care what folder it was in compared to the absolute path of the files that didn't exist, which is a big no-go. A lot of attempts came up with similar results as other people have reported in other threads, it didn't work at all.

    But the "include external files" option seems to work just as expected. Any files in the same path as the MFA/EXE build folder can be compiled into the exe and will extract as temp files and reference them just fine in the code on other machines regardless of exe location, looks great. Except one huge limitation- this feature is limited to only static file paths and doesn't work with interpreted strings. I can for example have a line that says
    >Load image "C:/Dev/Images/Sword_01.png"
    but I cannot have a line that says;
    >Load image "C:/Dev/Images/" + image_name + ".png"

    I understand the compiler may be flagging static paths to included files and aliasing them for those included in the .exe build, but my question is: Could a feature be added to allow a check at runtime whether an expression matches an included file, and if so, use that instead of looking for an external file? This might require some iterating string comparison and be less optimal, so it could be an optional checkbox. But would it be technically possible? I mean something like taking the string after its resolved and compare it to the original external file path (not temp path) of included files, and if it matches one, load from the temp path of that file instead.

    Its possible to include large numbers of external files without a direct reference in an application's main code by just slapping some deactive dummy code into a spare frame or level that tells an active picture object to load 500 different images or whatever, that's a simple enough solution to make them included without any interface for including external files like data elements allow. But without expressions, the only way to load them in via static paths would be.... creating an absurdly long switch statement kind of code that loads each direct asset based on an input index, like;

    >* On loop "load image"
    >>child events-
    >>* If image_name = "Sword_01"
    >>= Load image "C:/Dev/Images/Sword_01.png"
    >>* If image_name = "Sword_02"
    >>= Load image "C:/Dev/Images/Sword_02.png"
    >>* If image_name = "Sword_03"
    >>= Load image "C:/Dev/Images/Sword_03.png"
    ....

    performance aside, that's a bit problematic when I already have 358 external files of various types and will probably wind up 700+

  2. #2
    Forum Moderator Fusion 2.5 MacFusion 2.5 DeveloperFusion 2.5+ DLCAndroid Export ModuleHTML5 Export ModuleiOS Export ModuleFirefly 3D ModuleInstall Creator Pro
    Fusion 2.5 (Steam)Fusion 2.5 Developer (Steam)Fusion 2.5+ DLC (Steam)Android Export Module (Steam)HTML5 Export Module (Steam)iOS Export Module (Steam)Mac Export Module (Steam)Universal Windows Platform Export Module (Steam)Firefly 3D Module (Steam)
    NaitorStudios's Avatar
    Join Date
    May 2010
    Location
    Brazil
    Posts
    1,618
    Mentioned
    9 Post(s)
    Tagged
    0 Thread(s)
    Put the folder and its files in the same folder as the mfa, then in the path for the binary data files, replace the start by apppath$ + then the rest of the path.

    So for example:
    C:\Fusion\Projects\Data\image.png

    Lets suppose the mfa is inside Projects, so change it to:
    Apppath$ + "Data\image0.png"

    Then you can use a expression, like:
    Apppath$ + "Data\image" + Index + ".png"

    This will also make sure when you move the mfa with the files, it will find their new location automatically.

  3. #3
    Clicker Multimedia Fusion 2SWF Export Module

    Join Date
    Sep 2006
    Posts
    1,577
    Mentioned
    2 Post(s)
    Tagged
    0 Thread(s)
    Quote Originally Posted by NaitorStudios View Post
    Put the folder and its files in the same folder as the mfa, then in the path for the binary data files, replace the start by apppath$ + then the rest of the path.

    So for example:
    C:\Fusion\Projects\Data\image.png

    Lets suppose the mfa is inside Projects, so change it to:
    Apppath$ + "Data\image0.png"

    Then you can use a expression, like:
    Apppath$ + "Data\image" + Index + ".png"

    This will also make sure when you move the mfa with the files, it will find their new location automatically.
    hmm so a lot of other older posts I saw about it said the way to go about including binary data was set aside a separate path like set it in D:/Bin/.... and using that absolute path
    but testing it out, it appears that putting everything in the same origin folder as the exe / build path and using that apppath$ is what did the trick, thanks.

    I guess it was trying to use a non-current-working-directory path that was screwing it up, so hopefully if someone in the future is googling up threads on it like I did with the other ones, they find this one.

Similar Threads

  1. Binary data/external files loading and saving
    By ricko_max in forum Extension Developers Lobby
    Replies: 0
    Last Post: 12th November 2017, 11:50 PM
  2. Replies: 1
    Last Post: 27th August 2017, 05:22 AM
  3. Binary Data including .txt files is it possible?
    By aenever in forum Fusion 2.5
    Replies: 5
    Last Post: 18th July 2017, 05:52 AM
  4. Using/Including External Audio and Data Files
    By butterfingers in forum XNA Export Module Version 2.0
    Replies: 0
    Last Post: 15th September 2014, 11:23 AM
  5. Including external files question
    By Blizna in forum Multimedia Fusion 2 - Technical Support
    Replies: 6
    Last Post: 14th September 2006, 10:52 AM

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •