Jump to content

Changing image crashing canvas


mansim
 Share

Recommended Posts

I am making my game http://armyfight.com/simulator.html now with sprites (swordsman unit). Sprites are 7000*3000 size. One for movement, another for fighting, third for dieing. Same for red color units, another copy for blue color units. So totally 6 big images. If i use only one image( for example, it is always moving, no matter, it fights or dies), it loads smoothly. But if i use all images, when movement changes into fighting, chrome crashes for 2 seconds. But only for first hit, only once. Same happends when unit dies, also chrome crashes for 2 seconds, once,  and afterwards everything smooth again, every die and fight is keeping smooth. 

It is same crash time, even if in field are 50.000 units, or 2 units. Crashes same for 2 seconds.

Any suggestions how to make it smooth always?

Link to comment
Share on other sites

I don't know exactly what you're doing, but it sounds like you want to draw every image once before even starting the game - "loading" time will increase slightly but then you wouldn't have this problem?
 

Also 7000x3000 is too big - lots of machines will have trouble with texture sizes > 4096.

Link to comment
Share on other sites

Yeah, it works fine for me here, so it might not be Chrome but your gpu or something trying to handle those image sizes.

Looks like each frame is only about 180x180px, killing all the whitespace would help, but, as you're only displaying them on screen far far smaller than 180x180 you could make each frame considerably smaller and get your image size down dramatically.

Link to comment
Share on other sites

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.
Note: Your post will require moderator approval before it will be visible.

Guest
Reply to this topic...

×   Pasted as rich text.   Paste as plain text instead

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

Loading...
 Share

  • Recently Browsing   0 members

    • No registered users viewing this page.
×
×
  • Create New...