Jump to content

Search the Community

Showing results for tags 'quadtree'.

  • Search By Tags

    Type tags separated by commas.
  • Search By Author

Content Type


  • 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


Last Updated

  • Start


Filter by number of...


  • Start



Website URL





Found 5 results

  1. Hi, I'm interested in using the QuadTree class of Phaser to retrieve spatially-indexed objects based on their spatial coordinates. But it seems I don't quite understand the "retrieve" part. I'm looking at the quadtree example, and I don't understand it well. I would expect that when you click somewhere in the example, only the green rectangles that intersect or are within the big blue rectangle would be selected, based on their spatial coordinates. However, it doesn't seem to be the case at all, and I don't see any "logic" in the way the green rectangles are selected. Depending on where I click, nearby rectangles are selected (which makes sense), but rectangles very far away from the select zone are selected as well, which seems to me to defeat the purpose of spatial-based selection. In other cases (seemingly random to me), almost all rectangles are selected, which renders the whole thing useless. Never do I manage to select only the rectangles that are in the blue selection zone. Can someone explain it to me? My goal being to be able to select only the rectangles in the blue zone, or at least rectangles closeby.
  2. Is it possible to use Phaser's QuadTree without enabling the physics system? I don't really need Physics I just want to check if mouse is over a specific tile of a large matrix. I have a matrix of sprites and it can grow or shrink. Roughly it can have from 70 up to 1500 tiles. I can use nested "for" cycle to visit each sprite tile and check if mouse cursor is over it but this check happens mostly each update cycle which means 60 frames per second times 1500 checks, that is 90000 checks in the worst case every single second. Quad Tree uses adjacency tiles to find if mouse is over a specific one. It is more optimized.
  3. I am currently implementing a quadtree (in TypeScript) for a game prototype. In order to optimize performances, a little bit, instead of managing just one quadtree for all game objects, I am wondering if it would be speed-wise to separate static objects (like walls) from movings objects (like characters). This way, the static layer shall never be updated (cleared and populated) each frame which may save some CPU cycles. Obviously, in order to check collision, we will have to retrieve objects from the static and the moving objects layers. What do you think about this idea? Is it relevant?
  4. I am wondering if I could use the reset() method of a QuadTree object the same way as the clear() method. After checking the source code, it seems reset() would be faster since there is no reccursion, only setting arrays length to 0. But, I am still unsure it has no drawback compared to the standard clear() method. Anyone has some insight about it? Thanks!
  5. So my game has a large game world, with lots of baddies running around that I need to test for collisions with the player, as well as a tilemap with some solid (collidable) tiles. I understand that using the quadtree technique can help me sort out what is close enough to be considered for collision testing and can save me some collision checks if used right. I have read the docs and the links to the original implementations that the Phaser one is based on, and understand how the concept works, but I can't seem to find any complete explanation of how to get it working in Phaser and any special quirks that Phaser adds. The quadtree example on the Phaser examples page is not helpful. It just throws code at me without explanation. From the scraps of info that I have found from a forum search, I have the following questions: How does the grouping mechanism relate to how quadtrees work? Do the physics systems use a quadtree by default? Do I need to create my own? Are tilemap tiles considered? i.e. I might have some tiles with collides set to true. Will the quadtree factor out distant collision tiles like it would with other physics bodies when checking collisions?
  • Create New...