Jump to content

Search the Community

Showing results for tags 'a*'.

  • Search By Tags

    Type tags separated by commas.
  • Search By Author

Content Type


Forums

  • HTML5 Game Coding
    • News
    • Game Showcase
    • Facebook Instant Games
    • Web Gaming Standards
    • Coding and Game Design
    • Paid Promotion (Buy Banner)
  • Frameworks
    • Pixi.js
    • Phaser 3
    • Phaser 2
    • Babylon.js
    • Panda 2
    • melonJS
    • Haxe JS
    • Kiwi.js
  • General
    • General Talk
    • GameMonetize
  • Business
    • Collaborations (un-paid)
    • Jobs (Hiring and Freelance)
    • Services Offered
    • Marketplace (Sell Apps, Websites, Games)

Find results in...

Find results that contain...


Date Created

  • Start

    End


Last Updated

  • Start

    End


Filter by number of...

Joined

  • Start

    End


Group


Website URL


Twitter


Skype


Location


Interests

Found 7 results

  1. Contrary to the name, I am finding Easystar.js to be intensely not-easy. I have created a tilemap in Tiled with: base, collision, and foreground layers. The collision layer consists of two tiles, a walkable (6669) and a non-walkable(540). I have set up easystar in my create and update loop as described in the docs (see below) but constantly get either "The path to the destination point was not found", or "Your start or end point is outside the scope of your grid.". current code: var level = map.layers[1].data; easystar = new EasyStar.js(); easystar.setGrid(level); easystar.setAcceptableTiles([6669]); easystar.enableDiagonals(); easystar.enableCornerCutting(); easystar.findPath(player.x, player.y, 0, 0, function (path) { console.log("HERE") if (path === null) { console.log("The path to the destination point was not found."); } else { for (var i = 0; i < path.length; i++) { console.log("P: " + i + ", X: " + path.x + ",Y: " + path.y); } } }); I have looked at just about every example, dissected every bit of code I can, and read every doc I can find on the subject matter but cant seem to make any headway. Does anyone have any experience using easystar.js or pathfinding.js?
  2. Hello all, I'm having super hard time while trying to implement https://github.com/bgrins/javascript-astar to my testproject @ http://eljuko.com/pathfindingTest/ you can see the js source here http://eljuko.com/pathfindingTest/scripts/main.js I'm getting pretty frustrated with this since it "almost" works but not at all . So please help the stupid to right direction. known issues; - u can't click twice in the same spot. or ofc u can but it wont fire. - sometimes fails to create path - silly waypoints sometimes - grid in -90 degree angle?! EDIT: after few hours of more buttscratching, i kinda start to get to bottom of this. something is not removing the goal node from the closed list when the object reaches its destination. anyone knows this plugin? If anyone knows how to get this working or can provide an algorithm that works; i'll be forever grateful Thanks, eljuko - the stupid
  3. I want to clone what this Russian guy achieved for my game exactly but the programmer says that its not physically possible to do anything other than A* based grid movement. It's incredibly frustrating because I've seen Atari games where entities on screen can pathfind around without the need of a grid but still colliding with each other and respecting collisions with the grid, and he hasn't been able to explain to me what's so hard about pathfinding that isn't A* based because I've seen a thousand games that do it before us no problem at all. Like, how do you program pathfinding and collision like THIS?
  4. Hello people, I am making a little isometric game and I need to determine some range of movement. So I wanted to know if someone had a efficient way to get the positions of every tile that the player can reach. Here is a visual exemple of what I need. I've already have basic A* pathfinding. Thanks
  5. I'm using easystar plugin for phaser and there's something wrong about it. I don't know maybe my configurations is wrong, but i often get f*cked up path. Here's my config: easystar.enableDiagonals();easystar.disableCornerCutting();easystar.setGrid(grid);easystar.setAcceptableTiles([1]); grid: [ [ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1 ], [ 1, 1, 2, 1, 1, 1, 2, 1, 1, 1, 2, 1, 1, 1, 2, 1, 1, 1, 1, 1, 1 ], [ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1 ], [ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1 ], [ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1 ], [ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1 ], [ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1 ], [ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1 ], [ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1 ], [ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1 ], [ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1 ], [ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1 ], [ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1 ], [ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1 ], [ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1 ], [ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1 ], [ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1 ], [ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1 ], [ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1 ], [ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1 ], [ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1 ] ]Results (green tiles is calculated path):
  6. While using the AStar.js plugin (from the official Phaser plugin repository), I have been running into a strange bug. Whenever I try to find a path between any two points on my map, the findPath function returns a path of zero length every time. Even more odd, the path, regardless of where I set it to begin or end, always has a start point and goal of (32, 47). This point does exist on my map and is the closest walkable tile to the bottom-right of the map, but there appears to be nothing else of significance about it. It is never mentioned in my code; the number 47 does not even exist in any of my files. The path should not cross that point and a quick manual calculation of A* on my map suggests that (32, 47) would not even be considered, since it should find a direct path to the goal fairly quickly. Does anyone know what might be causing this problem? The only useful tutorial I found online specific to this plugin is the example by Rafarel that is currently a pull request for the Phaser Examples repository. I copied parts of it directly and still had the same bug. If anyone else has a tutorial or example of using this plugin they would like to share, I (and probably quite a few others) would appreciate it, especially if it showed a common use of A* in games, such as pathfinding for multiple characters. Some relevant code: this.AStar = this.game.plugins.add(new Phaser.Plugin.AStar(this));this.AStar.setAStarMap(this.tileMap, 'Tile Layer 1', 'tiles_3_final');this.pathfindKey = this.input.keyboard.addKey(Phaser.Keyboard.ONE);this.pathfindKey.onDown.add(this.pathfindFromCharToChar, this);pathfindFromCharToChar: function() { var path = this.AStar.findPath(new Phaser.Point(40, 18), new Phaser.Point(9, 17)); // var path = ast.findPath(this.player.tilePos, this.otherChar.tilePos); // I tried this and several other ways to get points; // I can confirm that the method of passing the points // in is not part of the problem. this.player.tilePos.x = path.nodes[3].x; // Returns an error, as the path, which should be ~42 nodes long (43 with the start point), // is only 1 node long. this.player.tilePos.y = path.nodes[3].y; this.player.x = tilePos.x*32; this.player.y = tilePos.y*32;},EDIT: After some more digging around in the console, I found some information that might be useful. Forgive me if I ramble on a bit, but I figure that I might as well, since anyone who tries to help either has already gone through the exact same issue and can skip it, or would otherwise have to go through this whole process themselves. The findPath() function is properly passed the correct startPoint (40, 18) and goalPoint (9, 17). However, both start and goal return an AStarNode with an x and y of (32, 47), meaning that something happens in the below segment of code in AStar.js to cause the bug. I can confirm that _tilemap, _layerIndex, goalPoint.y, and goalPoint.x all reference the proper things. Going into properties.astarNode at the correct locations show that the astarNode.x and astarNode,y are set to 32 and 47, respectively. Phaser.Plugin.AStar.prototype.findPath = function(startPoint, goalPoint){ var path = new Phaser.Plugin.AStar.AStarPath(); var start = this._tilemap.layers[this._layerIndex].data[startPoint.y][startPoint.x].properties.astarNode; //:AStarNode; var goal = this._tilemap.layers[this._layerIndex].data[goalPoint.y][goalPoint.x].properties.astarNode path.start = start; path.goal = goal; this._open = []; this._closed = []; this._visited = []; this._open.push(start); ...}While searching for examples originally, I found this Stack Overflow question about AStar.js. I ignored it at the time, but thankfully remembered now. Of course, it remains unanswered, but it did point out that each AStarNode contains the x and y coordinates of the last location to use the same tile as it. So (0, 0), using tile 5, is marked as being at (49, 49), as is everything else that uses tile 5. Likewise, everything using tile 16 is marked as (32, 47). I hadn't noticed since 16 is the only currently used walkable tile, and I didn't think to try using AStar on a non-walkable tile. So the next thing to look at is where the astarNode property is set up on each tile. The updateMap is automatically called when you setup a map for AStar, and can also be manually called after a change to the map. I set up some variables (not shown below) to track whatever the previous tile was so I could check the astarNode property and see if the x and y are changing. Phaser.Plugin.AStar.prototype.updateMap = function(){ var tile; var walkable; //for each tile, add a default AStarNode with x, y and walkable properties according to the tilemap/tileset datas for(var y=0; y < this._tilemap.height; y++) { for(var x=0; x < this._tilemap.width; x++) { tile = this._tilemap.layers[this._layerIndex].data[y][x]; walkable = this._tilemap.tilesets[this._tilesetIndex].tileProperties[tile.index - 1][this._walkablePropName] !== "false" ? true : false; tile.properties.astarNode = new Phaser.Plugin.AStar.AStarNode(x, y, walkable); } }};And apparently, as expected, they are. Going through it line by line, and checking for changes, I can tell that it is line 166 that is changing it. And so the next stop is in the AStarNode constructor, shown below (with comments removed for length). Phaser.Plugin.AStar.AStarNode = function(x, y, isWalkable){ this.x = x; this.y = y; this.g = 0; this.h = 0; this.f = 0; this.parent; this.walkable = isWalkable; this.travelCost;};The console says nothing unexpected happens there (not that I really expected anything to). So I am stuck once again. Somehow, this line of code... tile.properties.astarNode = new Phaser.Plugin.AStar.AStarNode(x, y, walkable);...or a related line is causing other tiles to have their properties changed. All I can think of is that somehow an update to Phaser may have broken this plugin, as it doesn't appear to have been updated since 2.0.4 (at least). I read back through about half of Phaser's entire changelog and cannot see anything that obviously would break this plugin. So that's everything I have found out. Does anyone else who knows more about changes in how Phaser deals with tile properties (or anyone else) know anything that might be causing this problem?
  7. Hi! today my last game became "playable" You can find it here : http://www.arlefreak.com/games/8puzzle/play/ To play use the arrow keys And the source code: https://github.com/Arlefreak/Phaser-8-puzzle-game Currently its using Phaser 2.0.2 It is an attempt to improve my JS and AI skills, the objective is to get the right order of the numbers, I used A* algorithm to find the answer, at the moment you can see the progression opening the console and hiting the arrow button. I will really appreciate if someone could tell me any feedback on my JS or AI skills based on the code or any feedback actually When I implement the solving animation will update this
×
×
  • Create New...