Search the Community

Showing results for tags 'cache'.

More search options

  • Search By Tags

    Type tags separated by commas.
  • Search By Author

Content Type


  • HTML5 Game Coding
    • News
    • Game Showcase
    • Coding and Game Design
  • Frameworks
    • Phaser 3
    • Phaser 2
    • Pixi.js
    • Babylon.js
    • Panda 2
    • melonJS
    • Haxe JS
    • Kiwi.js
  • General
    • General Talk
  • Business
    • Collaborations (un-paid)
    • Jobs (Hiring and Freelance)
    • Services Offered

Found 41 results

  1. I'm making small turn based game tic-tac-toe using phaser 3. Is it possible to cache assets and all the files needed to run game so that game can be played offline so that no internet connection is needed and every file is loaded from cache (providing native like experience)? Does service worker would do the trick? What are the common approaches to speed up the loading process and caching in HTML5 games?
  2. Ignore missing images

    I am making a level viewer for a game using phaser, I loop through a large array representing the game grid and take the item names from the game save and place them in my phaser world in a loop. I take whatever the game name for the item is and map it to a phaser image, my issue is that I don't want to map every possible item type to an image, if phaser askes for an image that i have not loaded, can I just ignore it without the green texture being plastered over it?
  3. How to cache Texture or BitmapData

    Hello, Can anyone share information how can I do manual caching of sprite or speed up rendering in general? If I have group with lots of small sprites, it's wise to convert it into single BitmapData and use it as texture to prevent recalculations. However, I have no clue how can I do that and what other methods Phaser may offer. Thanks everyone in advance for help
  4. get data from Texture

    Hey, i'm trying to get the data source from a loaded Texture in BABYLON. But I haven't found a way to do this. Basicly my idea is to get the data from the image and save it as base64 in the local cache. And then I can get the image from the cache again and load it into BABYLON. This should improve performance and result in faster loading times once you already loaded the scene once. Does this accually makes sense or is there a better way of caching textures?
  5. Hi, I have a folder with 23MB of sounds (including music), all of them are in .ogg format because I need to support really old browsers. When loading those sounds, memory usage goes up to 900MB. If I comment the lines below, it stays about 90MB. What am I doing wrong? Controller.numMusic = 5; //Load music: for (var i = 0; i < Controller.numMusic; i++) { let soundName:string = "music" + i;, "assets/audios/music/" + soundName + ".ogg"); }"menu", "assets/audios/music/menu.ogg");, "assets/audios/" + ESounds.ACERTOU + ".ogg");, "assets/audios/" + ESounds.ERROU + ".ogg");, "assets/audios/" + ESounds.ANDANDO + ".ogg");, "assets/audios/" + ESounds.CAINDO + ".ogg");, "assets/audios/" + ESounds.CLICK_BT + ".ogg");, "assets/audios/" + ESounds.CLICK_RUN + ".ogg");, "assets/audios/" + ESounds.GRAB_ARTIFACT + ".ogg");, "assets/audios/" + ESounds.PUT_ARTIFACT_ALTAR + ".ogg");, "assets/audios/" + ESounds.BREAK_ARTIFACT + ".ogg");
  6. just look into PIXI example and replace the path 'required/assets/testVideo.mp4' to 'required/assets/testVideo.mp4?123', then the video will disappear, and there is no error image. Is it a bug? or I can't add ref number to a mp4 file?
  7. Hi, I was wondering if someone had experienced slight differences in "offsets" using sprite2D texture and wether it might be related to caching. As an example I have a fairly small texture of 16*16 here in svg, but i tried also using png, same problem. That's the begining of the sprite texture zoomed in 4800% When using it in chrome with a code like this: const crossSheet = taskObject.cloneAssetIntoScene(R.get.crossSheet, scene) crossSheet.hasAlpha = false const cross = new BABYLON.Sprite2D(crossSheet, { parent: canvas, id: 'cross', marginAlignment: 'v: center, h: center', spriteSize: new BABYLON.Size(16, 16), spriteLocation: new BABYLON.Vector2(0, 0), }) cross.spriteFrame = R.get.cross_predict The texture is at the center of the screen here, in chrome the top misses 0.5px In Safari there is a difference in colors and width of strokes: If now I am using a 16,17 sprite size i get a correct sprite in chrome: But somehow it is seems worst in safari: Any clue ? Do you think it is related to the caching strategy ? @Nockawa Here is the link to the texture: Here is a playground, on the playground it is the BOTTOM 0.5px that get cutoff..
  8. Hi guys, I load about 10mb of data for my game. But each time I refresh the page, everything has to be re-downloaded. It's like phaser can't save anything in the browser cache? Is there any way to fix this? Thanks, pyre
  9. Hello! I finally decided to try to use TexturePacker. This tool looks promising. Now I am just rewriting tons of my code. Here's the question, I hope some of you, friends, might be able to help me: My old code: var background = game.cache.getImage(backgroundName); something.drawImage(background, 0, 0, background.width, background.height, 0, 0, gameWidth, gameHeight); Can I do the same thing, but with background image being placed into texture atlas which will also include multiple other images? How can I do ' var background = game.cache.getImage(backgroundName);', but with texture atlas use? It seems methods like getFrameData return only some info strings.
  10. Hello, I anyone else experiencing serious cache isues using the latest version of chrome? I work on my server and update fles quickly, and a month ago I coud refresh and any new changes would be updated as the chrome browser would reload the updated file. Then about a month ago (maybe two), I had to open a new tab to get chrome to load a same name script whic was updated. But as of last week, I now must clear my cache regardless to get chrome to release any previous same name assets or scripts. If anyone has a solution to this, I'd love to hear; or if you are also experiencing the same issue. Thanks DB
  11. Hi, guys. I know that for an image I can retrieve it's width issuing the command game.cache.getImage(key).width; But suppose that instead of a single image you have an atlas named 'atlas' and its key is 'atlas' and that it contains an image named 'logo.png'. How could I get the width of image named 'logo.png' from cache object?
  12. Hello, i recognized on my own project where i want to add this filter that in firefox and safari this filter does not work the first time when you visit the page.. after it cached the .frag file mean on reload it works.. i also tried to cache the file first with jQuery.get but with no success. any help? Firefox: 46.0.1 Macbook Pro. EDIT: Really nobody? I mean this also happens on the example-page of Phaser, not only on my project.
  13. Preloader breaks loading video

    I have a custom Preloader which has been working fine, but now when i try to preload a 8.43 MB mp4 WebOptimized video (made with HandBrake) my preloader breaks with the message: Phaser.Loader - active loading canceled / reset If I remove the video the preloader loads fine OR if I clear the cache file of the video (on the browser) it also loads fine! When the loading breaks I get the 304 Not Modified status code for the video. What could be causing this?
  14. I want to make several unit tests that test my loading functionality. That means i have to run Phaser.Cache.destroy() just so I make sure the assets were not loaded by the previous test. The problem is destroy() makes the cache null which is not what I want. I just want to clear the data it holds. I even tried this: game.cache = new Phaser.Cache(game); But it doesn't seem to be working. What should I do in this case?
  15. Unit Testing my Game with JSUnit

    I have this test: function testLoadAtlasJSONHash_CreateCustomJSONAtlasAndRunTheFunc_PassesIfThePhaserLoaderContainsTheAssetKey () { var keyName = 'KEY_NAME', keyValue = 'keyValue', sheetUrl = 'assets/testing/images/guidesAndBackgrounds.png', sheetConfigUrl = 'assets/testing/settings/guidesAndBackgroundsHash.json'; WML.addConstant(WML.ImageAssetKeys, keyName, keyValue); game.load.atlasJSONHash(WML.ImageAssetKeys[keyName], sheetUrl, sheetConfigUrl); assertTrue(game.load.checkKeyExists(Phaser.Loader.TEXTURE_ATLAS_JSON_HASH, keyName)); } Note: I have separate tests which pass for WML.ImageAssetKeys[keyName] and for WML.addConstant() And I am not sure where it is failing. checkKeyExists() returns false. How can I know or find why it returns false?
  16. I am adding new Atlas Json Hash object and I want to check if its key exists in the Loader. I would do this: game.load.checkKeyExists(type, myKey) Bu I am not sure what to use as type. I know I should use game.cache.someconstant but which on is for Atlas JSON Hash ?
  17. In my application I have animation packages(babylon files) that are very large and take a while to download from the server. This download time is helped by using the enableSceneOffline and enableTexturesOffline in the manifest file, but we still have to deal with the initial load each time. Is there a way to load those so they are available in the background without having to render them on screen until we are ready for the user to interact with them? The load times are excessive for each package, but it would help if I could load a new babylon file to have it ready for when the user is done interacting with the first.
  18. Texture caching

    Hey guys! I'd like to cache my textures into IndexedDB, I saw that Babylon.js is capable of it, but my case is that, I don't have a "scene mesh babylon" file, I just create a simple Babylon.Scene and add some custom meshes, with textures. And I'd like to cache those textures, is there a workaround to "make babylon.js believe it is a scene loaded from a file and force checking manifest and force using indexed db for textures"?
  19. Key " " not found in Cache.

    Hi guys, I just started out with Phaser and I was thinking about creating a basic game with a guy jumping around from scratch. I searched this website for an answer but I couldn't actually find one that fits or I was too stupid to understand it. So why when I want to create an image on the canvas it says "Phaser.Cache.getImage: Key "jucator" not found in Cache." ? Here's my code: <html><head><meta charset="UTF-8" /><title>Dani Mocanu runs</title><script type="text/javascript" src="JS/phaser.min.js"></script></head><body><script type="text/javascript"> var player; new Phaser.Game(800, 600, Phaser.AUTO, '', {preload: function(){ = '#85b5e1';'platforma', 'assets/platform.jpg');'jucator', 'assets/player.jpg');}, create: function(){ player =,0,'jucator');}, update: function(){ }})</script></body></html>I'm using WAMP in order to 'host' the game. Thanks for the info and if you have any advice about how should I be learning Phaser in a better way or any advice about anything for a beginner please let me know. Thank you!
  20. Hi, I'm trying to check if the audio is ready before start the MainMenu. create: function () { this.addGameSrc(); Vendor.addSound(); Vendor.addMusic('main_menu', true); audios = [ music, sfx_Click, sfx_Drop, sfx_Explode ]; console.log(audios); this.status.setText('DECODING AUDIOS...'); this.sound.setDecodedCallback(audios, this.start(), this); }, start: function () { this.status.setText('READY'); setTimeout(function () { game.state.start("MainMenu"); }, 250); console.log("Splash\t\tOK"); },ERROR: TypeError: this._watchCallback is undefined I also tried this code: create: function () { this.addGameSrc(); }, update: function () { if (game.cache.isSoundReady('click', 'main_menu')) { this.startMenu(); } else { this.status.setText('DECODING AUDIOS...'); }; }, startMenu: function () { this.status.setText('READY'); this.state.start("MainMenu"); console.log("Splash\t\tOK"); },But it takes so long for decode, tested with S6 Edge and about 10 seconds waiting, doesn't matter if the audio is an mp3 or ogg with 5k or 500k, if it's one single file or ten files, make no sense for me... Plz, Someone can help me to fix this?
  21. Remove cache from atlasJSONHash

    I have a game on mobile which gets slower and slower as you progress which I have identified down to the cache not being emptied. I have successfully loaded in a number of pngs and json files by using the following in a loop through, "image.png", "data.json");Then I am successful in removing the sprite from the scene using the following:item.destroy();However when I try to then remove the png and json atlas json files from the cache, it errors, any ideas? I am using the;Any help would be greatly appreciated I have successfully removed sounds and images, but not atlas.
  22. Remove cache from atlasJSONHash

    I have successfully loaded in a number of pngs and json files by using the following in a loop through JSON:[i].animID, "assets/images/npcs/"+gameData.npc[i].animImagePath+"", "js/npcs/"+gameData.npc[i].animDataPath+"");Then I am successful in removing the sprite from the scene using the following: item.destroy();However when I try to then remove the png and json atlas json files from the cache, it errors, any ideas? I am using the following:[i].animID);
  23. Hello! I've been using phaser and to create a multiplayer game for about 5 days now. However, a weird error is happening: 'players' is a key for a image that I'm using to show other players (it's not the same of your player). Because I'm a newbie with phaser, maybe I'm missing something very basic, but until now I don't have idea of what it is. Here is the start of my code: var game = new Phaser.Game(window.innerWidth, window.innerHeight, Phaser.AUTO, 'kabar', {preload: preload, create: create, update: update});function preload(){ var loadingLabel = game.add.text(window.innerWidth / 2 - 85, window.innerHeight / 2 - 10, 'Loading...', {font: '30px Courier', fill: '#fff'}); game.load.image('player', 'assets/player/player.png'); game.load.image('players', 'assets/player/players.png'); game.load.image('bullet', 'assets/bullet1.png'); game.load.image('space', 'assets/space.gif'); game.load.start(); // I tried without this line too, didn't work }And here are both sockets where I load these images and the error happens: var socket = io(); socket.on('newPlayer', function (data){ var uID = data.uID; players[uID] = new EnemyPlayer(data.oPlayers[uID].id, data.oPlayers[uID].x, data.oPlayers[uID].y, data.oPlayers[uID].angle); players[uID].id = data.oPlayers[uID].id; players[uID] = game.add.sprite(0, 0, 'players'); players[uID].anchor.setTo(0.5, 0.5); game.physics.enable(players[uID], Phaser.Physics.ARCADE); players[uID].body.drag.set(0.2); players[uID].body.maxVelocity.setTo(400, 400); players[uID].body.collideWorldBounds = true; }); socket.on('update', function (data){ playerQuantity = data.playerQuantity if (userID == playerQuantity && userID > 1){ players = data.oPlayers; for (var i = 1; i < playerQuantity; i++){ if (i != userID){ players[i] = new EnemyPlayer(players[i].id, players[i].x, players[i].y, players[i].angle); players[i].id = players[i].id; players[i] = game.add.sprite(players[i].x, players[i].y, 'players'); players[i].anchor.setTo(0.5, 0.5); game.physics.enable(players[i], Phaser.Physics.ARCADE); players[i].body.drag.set(0.2); players[i].body.maxVelocity.setTo(400, 400); players[i].body.collideWorldBounds = true; players[i].position.x = players[i].x; players[i].position.y = players[i].y; players[i].angle = players[i].angle; } } } });(The socket 'New Player' is called for an existing player when a new player joins, while the socket 'Update' is called for the new player to draw all the other players) Could it be an error involving Or is it something that I'm missing?
  24. Problem with text in cache

    Hey, I've got a weird problem with loading a text into a variable from the cache. Slight background, I started with a txt file called test1.txt which contained the text "This is a test". (Just to try out the functionality) Later I changed the text to a part of lorem ipsum to experiment with longer texts and to improvise pagination in a dialogue bubble. However, the variable kept returning "This is a test". My code: game.load.text('test1', 'txt/test1.txt');...text = game.cache.getText('test1');speech = game.add.text(0, 0, text, { boundsAlignH: "left", fontSize: '12px', fill: 'black', wordWrap: true, wordWrapWidth: 160 });I keep failing to make it recognise that the txt file's contents have changed, anyone know what I'm doing wrong?
  25. Phaser.Cache Errors in 2.4.4

    Hi! I just updated from Phaser 2.2.2 to 2.4.4 and i'm now experiencing sporadic errors from the cache during GameState create, like this: Phaser.Cache.getImage: Key "" not found in Cache. I see this on both Chrome and Firefox, but Internet Explorer 11 seems fine. I believe this is a timing issue, since if I stop execution with a breakpoint in the start of the GameState create method I do not see the issue. Also refreshing a couple of times usually makes the problem go away, and all assets are available in the cache again. Cheers, Klaus