Browser Loads the game every single time

(Zouhair Elamrani Abou Elassad) #1

Hi Guys,

I hope you’re doing well, i’m creating a game using FlashPunk and now the size of the swf file is almost 50 Mega, i’m having this issue about loading the game in the browser, every time i refresh the page that contains the game, the browser downloads the game once again and it takes quite a while every time.

I was wondering if there is something i can do to make the browser downloads the game just for the first time.

Thank You.

(Mike Evmm) #2

As far as I know, there’s nothing you can do but add a preloader.

(Zouhair Elamrani Abou Elassad) #3

In fact i already added a preloader, but i don’t think it’s normal, usually the browser should load the game only once, after that the game will be cached and then the preloader won’t show.

(Jean) #4

It maybe related to the website itself.

If I recall correctly, to make sure that you have up-to-date files there are a few configs server to tell the browser to download it everytime. The reason behind it it’s because of single page application and these sort of things, to make sure you download the newer version of the .js files. Maybe it’s affecting your .swf aswell.

Have you tried a home made server, like, just installing Apache/TomCat and ask someone to try it?(LogMeIn Hamachi recommended to avoid headaches about Port Forwarding and Firewall Permissions)

(rostok) #5

Try comparing GET requests of the swf file (for example in Firefox’s developer toolbar). First request should just download it while second just ask www server if file was modified by sending proper “If-Modified-Since” header. In my case second one returned HTTP status code 304 - Not modified. I am not expert on this but think that examining those headers should narrow the problem down to with be browser or the www server.

(Zouhair Elamrani Abou Elassad) #6

Yes i did, and everytime it gives the status 200, it’s downloading the game every time, it’s weird because other swf files are being cached, could it have something to do with the big size of the SWF file ?

(Zouhair Elamrani Abou Elassad) #7

I’ll see about that and i’ll keep you posted

(rostok) #8

@AbouElassad but does the 2nd request include “If-modified-since”?

(Zouhair Elamrani Abou Elassad) #9

@rostok thanks for the feedback, how can i add a “If-modified-since” ?

(rostok) #10

You can’t, it’s browser specific and I doubt you have caching disabled. Maybe server sends “Expired” header with past date and therefore SWF won’t be cached. My bet is this is server issue.