Rafarel Posted February 2, 2014 Share Posted February 2, 2014 Hello there!I'm totally new to your forum and it's my first post, here's a quick introduction about me:I'm a French developer who makes games in his free time like Claytus Tower Defense and who works on 360° video web technologies at my job (Kolor). I want to take part on Phaser development and Phaser Plugins development and I want to know how to do it well!I spent the last few days to watch every demo and read the documentation that Phaser provides, it looks to me to be a very good project and a strong knowledgeable team. I haven't found any "How to" or "Good practices guide" about Phaser.Plugin development and submitting. I wanted to start by providing a path finder plugin that works with a Phaser.Tilemap and a JSON file made with the Tiled Software.I ran through some "How the hell can I achieve this the proper way?" kinda questions Maybe you can confirm that I'm right or wrong doing on some points: Need more data from the JSON parser: In the process I needed to adapt the Phaser.TilemapParser.parseTiledJSON because I wanted to have the tileproperties on the layer object from the TiledJSON file. (made in Tiled software)These properties are omitted by the original function so I added this line to my override one:tileProperties: json.tilesets[0].tilepropertiesMaybe there's a better way to achieve this, but I didn't find it.I'd love to pass an additional data {'stringIndex', ... } arguments to game.load.tilemap for example:game.load.tilemap('desert', 'assets/maps/tilemap.json', null, Phaser.Tilemap.TILED_JSON, {'tileproperties'});Adding a debug method: I wanted to output the calculated path by drawing a line on the screen, so on my plugin file, I added a function to the Debug prototype:Phaser.Utils.Debug.prototype.AStar = function(astar, color){ ... Drawing the last calculated path by astar plugin object ...}Here is a screenshot of my work in progress. (debug draw is the red line) I'll upload a live demo a soon as possible with a fun sandbox to test it Many thanks for sharing your work! Arcanorum, george and jerome 3 Link to comment Share on other sites More sharing options...
rich Posted February 3, 2014 Share Posted February 3, 2014 You probably ought to take a look at the dev branch if you're doing a tilemap based plugin, as the tile properties you require are all exposed now (plus maps are handled a bit differently internally too) Link to comment Share on other sites More sharing options...
Rafarel Posted February 3, 2014 Author Share Posted February 3, 2014 Hello Richard, Thanks for your reply. I checked out the dev branch and I have some rework to do to be compatible with the new way you handles maps.This looks like very cool. Good job ! Do you think the right place to store path finding values (like walk-able tile or not) is in the properties object of the tile ?For now, I use the properties of the tileset that I copy to each tiles (depending of the tile index) of the layer I use for my path finding. Link to comment Share on other sites More sharing options...
rich Posted February 4, 2014 Share Posted February 4, 2014 Yes that would make sense - I guess it depends how often the tile properties are updated. But each tile now has a properties object, so it makes sense to take advantage of it! Rafarel 1 Link to comment Share on other sites More sharing options...
Rafarel Posted February 14, 2014 Author Share Posted February 14, 2014 Hello there ! I worked with the Phaser dev branch on my AStar path finding plugin this evening and I have something to share I've embedded my demo on the phaser's example page in : plugins > astarI don't know what are the best practices to load a plugin JavaScript file so I edited the example "view_full" template to add my script.I didn't find if there's a correct way to submit a plugin so I share in this topic. You can click on the map to find the shortest path between your click and the turtle.You can also move the turtle with arrow keys. It's pretty cool to work with Phaser, keep up the good work ! Rafarel 1 Link to comment Share on other sites More sharing options...
Rafarel Posted February 25, 2014 Author Share Posted February 25, 2014 Hello Richard, Are you interested in adding the Astar plugin to your github dev branch plugin folder ?Maybe we should rename the topic to : Phaser Pathfinding Plugin (if it is possible) Link to comment Share on other sites More sharing options...
rich Posted February 26, 2014 Share Posted February 26, 2014 If it works under Phaser 1.2 then I'm more than happy to do this. Link to comment Share on other sites More sharing options...
Rafarel Posted February 27, 2014 Author Share Posted February 27, 2014 Glad to hear it Your dev branch is 1.1.6, my plugin works with the old dev branch Phaser.VERSION at 1.1.4 There is a 1.2 branch on the github website but the readme is marked as 2.0.0It doesn't appeared on the git branch command line, do I have to test it with this one? Link to comment Share on other sites More sharing options...
rich Posted February 28, 2014 Share Posted February 28, 2014 Yes right now 1.2 is the latest version. Dev is actually 1 behind master I think. I was going to move 1.2 into dev to keep it easy, but as we're only a couple weeks away from release it's not worth the upset. 1.2 branch = Phaser 2.0. Link to comment Share on other sites More sharing options...
Maxime Posted March 17, 2014 Share Posted March 17, 2014 There is already a plugin for pathfinding using A* http://www.html5gamedevs.com/topic/2311-plugin-for-pathfinding-on-maps-using-easystarjs/?hl=plugin.Maybe the both plugin can be merged into only one as they use the same method.Having two plugin available for the exact feature is a little bit over 9000, isn't it?. Link to comment Share on other sites More sharing options...
Rafarel Posted March 17, 2014 Author Share Posted March 17, 2014 I wanted to adapt the path finding script that I used for my tower defense game to Phaser to see how comfortable I am with.I made it as a Plugin, to be part of Phaser and working with its Tilemap system.By the way, I submitted it on gitHub in the 1.2 branch, it comes with an example page.https://github.com/photonstorm/phaser/pull/595 Link to comment Share on other sites More sharing options...
saibotlive Posted May 23, 2014 Share Posted May 23, 2014 How do you follow the found path? Link to comment Share on other sites More sharing options...
Recommended Posts