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

 Share

  • Recently Browsing   0 members

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