Jump to content

using tilemaps in a persistent game


stvrbbns
 Share

Recommended Posts

I am writing a 2D, top-down persistent game with land and multi-character ships, using Phaser. Players will be able to modify the game world. It looks to me like using Phaser TileMaps is probably the most sensible way to display the ships and the land - composing each out of tiles as opposed to groups of sprites. However, in any case, I must be able to persist/save tilemap information to a store/database (currently using MongoDB).

How would you, the reader, solve this?

  • The Phaser TileMap data could be exported to a format it natively imports, but that requires looping over every tile in every layer to get each tile's index. And either deciding what else to save if creating JSON, or being sure to not use features other than tiles if writing CSV (because the CSV won't contain information like rotation).
    ("export tilemap as json" thread)
  • A separate "tilemap" (2D matrix of information) could be implemented which save and reload itself, and can return itself as a Phaser TileMap.
  • ??

... Is there an easy way to save and reload an entire Phaser.TileMap object using something like JSON.stringify() + _.extend()? (I'll try this next)

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