Jump to content

Map improvements


webdeveloper_issy
 Share

Recommended Posts

Hi,

I am currently developing a multiplayer web game.
URL: bit.ly/1XTgB7


Now there are two things that get me crazy right now

- map optimization.

What I am currently trying: The map is 6400px by 6400px. To optimize it I think its good to cut the map in pieces of 100px by 100px and only show those pieces that are within the users viewport.

I couldn't really work it out, I have done the cutting part but showing those within the viewport is what i fail at.

Is it the right way to go? What other optimizations are possible? I currenly use .cacheAsBitmap = true.

 

- Fall down bug

When the player walks to the bottom of the map and shoots down every object other than the player 'falls'.
What is the cause of this and how can I solve it? When I shoot left it does not do that

Any help would be much appreciated :D

 

Ps. Please keep the URL private

Link to comment
Share on other sites

any size between 256 or 1024 will be ok, i think. I use 256 in gameofbombs.com, and it works very well on 1920x1080.

 

But there is the other way - https://github.com/pixijs/pixi-tilemap . Every time your viewport changes (to some point, like every 32px), just clear the tilemap and fill it again. Using this thing its not necessary to use RenderTextures or cacheAsBitmap.

That plugin is not that effective on canvas2d, but for webgl. But be sure that all textures you use have the same BaseTexture: atlas thing, JSON HASH, create it with TexturePacker or Shoebox), otherwise there might be bugs with z-index.

Link to comment
Share on other sites

10 minutes ago, webdeveloper_issy said:

its just one huge image of 6400px by 6400px :P

Make a spritesheet/atlas of things, and construct a map from it. Dont forget that mobiles can have textures up to 4096. Also GPU will cull most of the image anyway if you draw that big map.

If your map is very very very customized, then yes, just divide it to multiple textures of size 1024 or 2048 and it'll be just fine.

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...