How to load all project files in html game?

From the Asset Store
five golem elements Sprites Sheet.Best for enemy or villain game characters.
  • I have made a html game in which there are many text files (.txt) in project folder. But when I exported my game and tested it , I noticed that game never loads project files in advance like other files(event,objects):- I mean the game only loads the required text file when it is in use. But it would be problem for users with low internet speed and hence game would crash

    So how can I make the game load all project files in advance itself (like in loader layout).

  • Try Construct 3

    Develop games in your browser. Powerful, performant & highly capable.

    Try Now Construct 3 users don't see these ads
  • Request all these files in your loader layout, and save their contents in global variables or an array/dictionary.

  • Request all these files in your loader layout, and save their contents in global variables or an array/dictionary.

    Thanks for the reply

    Actually there are many text files (approx 200).And it would be a lot of work. But I am quite sure that there must be another way for this( Ashley may help)

    Anyway thanks for the reply. Have a nice day !!!

  • It shouldn't be a lot of work if there is some system to these files. For example, if they named like file001.txt to file200.txt, you can load them all in one loop with only a few events.

  • It shouldn't be a lot of work if there is some system to these files. For example, if they named like file001.txt to file200.txt, you can load them all in one loop with only a few events.

    Can we do it? I mean how can I load a file just by using its name

  • Your game will already download everything on the first run to save it for use offline. See offline games in Construct.

  • I mean how can I load a file just by using its name

    Yes, use "AJAX request URL", where URL is the filename.

    For example:

    Repeat 200 times
    AJAX Request URL "file" & loopindex & ".txt"
    
  • There's no point doing that, because all those files are downloaded on startup already for the offline cache.

    If this is related to this issue, the problem was the server had disabled caching. So the server was telling the browser to re-download the resource every time it was requested. If the resource is allowed to be cached, it won't be repeatedly requested.

  • There's no point doing that, because all those files are downloaded on startup already for the offline cache.

    If this is related to this issue, the problem was the server had disabled caching. So the server was telling the browser to re-download the resource every time it was requested. If the resource is allowed to be cached, it won't be repeatedly requested.

    You are right. Actually I don't have knowledge of web development so I just simply assumed that it was game engine fault

    I will have to change some settings on the netlify so that my problem gets solved

    Thanks a lot Ashley for figuring out my issue. Thanks again

Jump to:
Active Users
There are 1 visitors browsing this topic (0 users and 1 guests)