Hello and thanks for your time.
I am making a huge game that uses Audio, Ajax to load txt files, and a lot of events, actions and variables. The problem is when the game loads the first layout, it loads only visual graphics, leaving what is underground load during the game (such as Ajax files and audio), but these are important for the game to work properly and for the complete game immersion.
So how do I do for the game loads everything before letting the player start?
here is the game(you can see that the Ajax is loading if you put the mouse over one faction and you can't see the description)
https://www.scirra.com/arcade/strategy- ... line-11526
I would also like to ask for a feedback about the game, let me know how I'm doing.
For the stuff like audio preloading and requesting on ajax, be sure to set a variable once the requests complete/audio finishes pre-loading so that the title screen (or when starting the game) actually starts only when said variable meets the expected value?
Nice idea, but how do I set the game to start only when the variable is true? Maybe another layout?
Sorry but this i understood, what comes next is my question. Also this system brings another problem because there are a lot of AJAX requests on my project, so I need multiple text files. Here is a Image to explain:
Develop games in your browser. Powerful, performant & highly capable.
Chain all of your ajax requests like this. When one finishes, have it's 'on completed' check start a 'queue' and request for the next ajax file you need and so forth. Then with the last AJAX request you have, put the variable change as a check to confirm all of the assets were loaded I put in the previous post up there. Don't allow the game to actually load (such as on player request with pressing start/space) until said variable meets said value.
Also, I would recommend pre-loading all of the ajax files and audio before the game technically starters, gameplay wise, such as from the title/first menu screen before starting a new game.
Got it, I'll do this.
To put it all to work properly I had to make some adjustments, as the request of the Array that I had to change Load From Json to Set Value At X and a variable to be true when the last request is completed:
So for each faction I set the corresponding X in the Array:
Then I put a variable "StartSignal" that is true when the audio is loaded and the variable "Request" is 1. While all this does not occur, a Loading text appears on the screen.
To see all this working please take a look at my game -> https://www.scirra.com/arcade/strategy- ... line-11526
If you have a more efficient method, please post a reply.
Thanks LaDestitute for your time and suggestions, it helped me a lot.