xerver Posted September 30, 2014 Share Posted September 30, 2014 Hey all, recently released another plugin to try and improve the tilemap system in Phaser (specificly the flow for Tiled maps). You can the plugin here: https://github.com/englercj/phaser-tiled If you have questions or bugs, please report them on the GitHub page. Also, if you are looking for a project to contribute to I would appreciate any help! Thanks, -Chad Using my test map which is 256x256 tiles, each 16x16 pixels, and 3 tile layers the core renderer gave me a performance graph like this: The spikes you can see are when camera was panning. When using the phaser-tiled plugin on the exact same map I get this: Still panning, still 3 layers, same map; different rendering strategy (graphs from phaser-debug). j0hnskot, nkholski, Sanju and 1 other 4 Link to comment Share on other sites More sharing options...
CtlAltDel Posted September 30, 2014 Share Posted September 30, 2014 Is this intended as a dropin replacement or eventually to be merged into phaser? Link to comment Share on other sites More sharing options...
xerver Posted September 30, 2014 Author Share Posted September 30, 2014 This is meant to extend the current implementation with extra stuff for specifically when you are using Tiled Editor maps. That is instead of using the core methods, you would use the ones the plugin provides. Generally where you type "tilemap" you would use "tiledmap", with a "d". For example, when loading you use "game.load.tiledmap" instead of "game.load.tilemap". You can see more in the README. This way the plugin runs side-by-side with the current implementation. You can choose to use the core methods, or these. Eventually the idea would be to extend this and merge it to core as a replacement for the current implementation, but there is a lot of work to do if we want it to be backwards compatible. Right now the API is similar, but code you use for tilemaps will probably not "just work" with this plugin. There are assumptions this plugin can make since we know the format of the data and the tool, so there is a lot more magic that seems to happen (layers created for you, tilesets created for you, etc) so a lot of the boilerplate you have when dealing with Tiled maps goes away. If you are using a CSV, custom build map, building a map in code, or something like that it may not just work for you. Link to comment Share on other sites More sharing options...
scoots Posted October 2, 2014 Share Posted October 2, 2014 Cool stuff, thanks so much for sharing! Do you have any side-by-side performance comparisons? I'm working on a game with a large map that could definitely use a boost, but I'd love to see it in action before committing to switching over to the plugin. Link to comment Share on other sites More sharing options...
xerver Posted October 2, 2014 Author Share Posted October 2, 2014 Cool stuff, thanks so much for sharing! Do you have any side-by-side performance comparisons? I'm working on a game with a large map that could definitely use a boost, but I'd love to see it in action before committing to switching over to the plugin. Edited main post with some graphs. Link to comment Share on other sites More sharing options...
nkholski Posted October 2, 2014 Share Posted October 2, 2014 Seems like a great plugin and I will definitely test it! Do you plan to make it independent of Phaser tilemap system? It would be great to be able to choose between your specialized Tiled plugin and the former core tilemap system when Phaser goes modular in the 2.2 release. Link to comment Share on other sites More sharing options...
valueerror Posted October 2, 2014 Share Posted October 2, 2014 viewing your graphs i'd say .. this should go into phaser.. why not make the changes to the core system.. im sure rich would pull them in... Link to comment Share on other sites More sharing options...
marcotronic Posted October 6, 2014 Share Posted October 6, 2014 Wow! I'm planning a game with larger tilemaps right now and your plugin will definitely come in very handy! Can't wait to give it a try! Marco Link to comment Share on other sites More sharing options...
laurie Posted October 6, 2014 Share Posted October 6, 2014 The plugin looks like it has promise, but I have a question: the readme doesn't mention isometric maps. Are they supported by this plugin? (either directly or via lewster32's isometric plugin) Thanks, Laurie Link to comment Share on other sites More sharing options...
xerver Posted October 6, 2014 Author Share Posted October 6, 2014 Seems like a great plugin and I will definitely test it! Do you plan to make it independent of Phaser tilemap system? It would be great to be able to choose between your specialized Tiled plugin and the former core tilemap system when Phaser goes modular in the 2.2 release. It is independent, you can use this parallel to the core implementation. The plugin looks like it has promise, but I have a question: the readme doesn't mention isometric maps. Are they supported by this plugin? (either directly or via lewster32's isometric plugin) Thanks, Laurie No it doesn't, maybe in the furture (since the goal is feature parity with Tiled Editor), but not right now. Link to comment Share on other sites More sharing options...
xerver Posted November 4, 2014 Author Share Posted November 4, 2014 Just updated the plugin to v1.2. This update adds adds physics integration and other stuff as well: https://github.com/englercj/phaser-tiled/releases/tag/v1.2.0 You no longer need to pass a tileset cache map into the plugin, as long as you load things with keys that it will expect it can "discover" the map assets for you. Information about how physics work, and how the key discovery work can be found by reading through the readme: https://github.com/englercj/phaser-tiled#phaser-tiled Link to comment Share on other sites More sharing options...
JustPaul Posted December 18, 2014 Share Posted December 18, 2014 Hi, I'm going to be testing your plugin to see if it improves performance on a test app I'm porting to js from ts at the mo. Once I get it working.. at the moment it's not obvious (to me) from the readme which Tiled layers etc are passed.... // Key// vgame.load.tiledmap(cacheKey('my-tiledmap', 'tiledmap'), 'assets/levels/tilemap.json', null, Phaser.Tilemap.TILED_JSON);// ^// Que?//// game.load.image(cacheKey('my-tiledmap', 'tileset', 'tileset1-name'), 'assets/levels/tileset1.png');// ^// Layer? At the moment the physics are working (from an object layer with .convertTiledCollisionObjects), so the tilemap is being loaded, but I am not seeing any tiles and I can't use .convertTiledMap for collisions. I need to be 100% sure I'm passing the correct parameters here so I can investigate. Could you confirm which of these are the map-key, tileset-name, layer-name etc?Cheers!edit: it turns out that Que? and Layer? above are the type of asset, which should have been blindingly obvious. The rest of the issues were caused by the tileset not being an exact multiple of tilesize. Now that I've trimmed it, everything appears to be working.edit2: ... and holy guacamole, what a difference in performance. On Canvas+ CocoonJS I was experiencing a slowdown from 60+fps to around 4fps when scrolling used stock Phaser. Now the fps stays pretty constant, always 60fps+ on a map that's 20 tiles high * 1000 long. Now I just need to populate it with more than the ground and a few platforms and see what happens, but the difference is night and day.Great work xerver! Link to comment Share on other sites More sharing options...
nkholski Posted January 2, 2015 Share Posted January 2, 2015 I'm trying to switch from the built-in support for tilemaps to the plugin but ran into some problems. I can't get the camera to follow the player, and rotated tiles is placed on wrong coordinates (+/-1 on either the x or y value of tile position, in my case +/- 16px). Do you have any examples or demo to learn from, preferably following a moving sprite and using rotated tiles? Link to comment Share on other sites More sharing options...
Partsu Posted January 29, 2015 Share Posted January 29, 2015 I'm having issues with colliding to the world bounds which is not working with Tiledmap. It seems that the sprite events outOfBounds and onEnterBounds are not firing. And yes, i have set body.collideWorldBounds to true... The world size is also correct. Any way to enable bound collision easily? Link to comment Share on other sites More sharing options...
cjke Posted August 31, 2015 Share Posted August 31, 2015 Hi Great plugin, tried it with Phaser 2.3 and I got a massively improved framerate. As mentioned in the issues section, it no longer works in Phaser 2.4. Looking into it, it's seemingly related to cache management (but could be a few things playing up). I wanted to ask two things: - How would you approach migrating the plugin to 2.4? As I am happy to work on it and submit a PR - What were strategies in obtaining such high performance? What bottlenecks were in the original phaser version? jdnichollsc and Skeptron 2 Link to comment Share on other sites More sharing options...
jmp909 Posted October 9, 2015 Share Posted October 9, 2015 how are you calling this.game.load.tiledmapfrom within TypeScript, as your d.ts has no reference for this? thanksJ Link to comment Share on other sites More sharing options...
jmp909 Posted October 9, 2015 Share Posted October 9, 2015 theoretically I think this should work to bypass the TypeScript issues (using square-bracket property notation rather than dot syntax)preload () { this.game.plugins.add(new Phaser.Plugin.Tiled(this.game,null)) var cacheKey = Phaser.Plugin.Tiled.utils.cacheKey this.game.load['tiledmap'](cacheKey('my-tiledmap', 'tiledmap',null), 'assets/demo/super_mario.json', null, Phaser.Tilemap.TILED_JSON); this.game.load.image(cacheKey('my-tiledmap', 'tileset', 'SuperMarioBrosWorld-1-1'), 'assets/demo/super_mario.png');}create () { var map = this.game.add['tiledmap']('my-tiledmap');}but i get this error:Tileset "SuperMarioBrosWorld-1-1" unable to find texture cached by key "my-tiledmap_tileset_SuperMarioBrosWorld-1-1", using blank texture.I'm wondering if it's actually to do with updates to Phaser itself? the actual image seems to be in the cache.. (essentially meaning the plugin loader works) Link to comment Share on other sites More sharing options...
san40511 Posted November 20, 2015 Share Posted November 20, 2015 What I do wrong?I've got this error - Tileset "testtiles" unable to find texture cached by key "my-tiledmap_tileset_testtiles", using blank texture.preload state //preloader stategame.add.plugin(Phaser.Plugin.Tiled);//loader statetileMapLoader : function () {var cacheKey = Phaser.Plugin.Tiled.utils.cacheKey;this.load.tiledmap(cacheKey('my-tiledmap', 'tiledmap'), 'res/maps/w1-1.json', null, Phaser.Tilemap.TILED_JSON);this.load.image(cacheKey('my-tiledmap', 'tileset', 'testtiles'),'res/maps/testtiles.png');},//game state this.mapToo = this.add.tiledmap('my-tiledmap'); Is this plugin work? Link to comment Share on other sites More sharing options...
jmp909 Posted November 21, 2015 Share Posted November 21, 2015 not currently. there's some fixes on github as pull requests, but i'm not sure they cover everythinghowever try making the 2.4 fix changes .. https://github.com/englercj/phaser-tiled/pull/37 you should be able to get that code above working at least i just copied the changes into phaser-tiled.js manually Link to comment Share on other sites More sharing options...
san40511 Posted November 21, 2015 Share Posted November 21, 2015 not currently. there's some fixes on github as pull requests, but i'm not sure they cover everythinghowever try making the 2.4 fix changes .. https://github.com/englercj/phaser-tiled/pull/37 you should be able to get that code above working at least i just copied the changes into phaser-tiled.js manuallyThis link is doesn't work. Link to comment Share on other sites More sharing options...
jmp909 Posted November 21, 2015 Share Posted November 21, 2015 https://github.com/englercj/phaser-tiled/pull/37 =>https://github.com/bixi/phaser-tiled/commit/bf3bac48c86e152a9f307ced01c9fc4b293e1f6e Link to comment Share on other sites More sharing options...
san40511 Posted November 21, 2015 Share Posted November 21, 2015 thank you Link to comment Share on other sites More sharing options...
Jazz Posted November 21, 2015 Share Posted November 21, 2015 its working with these fixes, but how do u load specific layers and not just the whole map ? nvm: i can access them under map.layers[] how should i approach drawing the player between layers 2 and 3? also all debug information is gone using this plugin, its now drawing on top of everything my guess is Link to comment Share on other sites More sharing options...
Sanju Posted March 9, 2016 Share Posted March 9, 2016 This looks good. I'd love to see the option for isometric tilemaps implemented, though. Great job on this and your other plugins. Link to comment Share on other sites More sharing options...
Recommended Posts