Jump to content

Rendering Tilemap through Node JS


Menakatep
 Share

Recommended Posts

Some questions have come up, since I recently began developing an isometric MMORPG-esque JS game. I’m running a Node JS server and serving map files to the client. My question is about making the images for the tiles more efficient and how best to serve them to the client.

 

I considered a tile sheet somehow stored locally on the client machine but I have about 2000 different tiles for just the floor pieces and then a couple thousand or so walls and decorations I can use on a separate layer. So, I didn’t feel that would be as viable considering it would be accessible by mobile devices. 

 

I also thought perhaps i could run through my image folders with a php script and store each tile as a base64 image code. The as maps are requested I could serve the map file with a json object containing the necessary base64 tile information. However, does a json object have data limits of some kind that I’d reach pretty quick? Can’t imagine each map would have more than, at most, 200-300 different tiles? They might be a kilobyte and a half each.

 

Am I missing a much better way to make this work? I’m pretty new to this method of application development and would appreciate any advice!

Link to comment
Share on other sites

One 4k square texture stores 11k of tiles. Seems like you can use just a pair of 2k square textures. Each is 16 MB in videomemory, or 4MB if you use DDS (PC) or PVR (mobiles) compressed formats.

Just make a big atlas, you can optimize it later. Atlas can be generated with https://github.com/krzysztof-o/spritesheet.js/ on server side.

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