Commit graph

218 commits

Author SHA1 Message Date
Richard Davey
0952421bfb Expose the new functtions #4992 2020-10-02 11:00:30 +01:00
Richard Davey
da3d0108f4 Restore back to previous version 2020-10-02 10:59:24 +01:00
Richard Davey
9c22133bb2 Tilemaps.Components.StaggeredWorldToTileXY is a new function that converts world coordinates to staggered tile coordinates. 2020-10-02 10:58:36 +01:00
Richard Davey
b8520f3b0d Tilemaps.Components.IsometricWorldToTileXY is a new function that converts world coordinates to isometric tile coordinates. 2020-10-02 10:58:18 +01:00
Richard Davey
7402d22c53 Tilemaps.Components.HexagonalWorldToTileXY is a new function that converts world coordinates to hexagonal tile coordinates. 2020-10-02 10:57:57 +01:00
Richard Davey
7d39bf9217 Tidy return statements 2020-10-02 10:57:14 +01:00
Richard Davey
ef2d4f6d7a Tilemaps.Components.GetWorldToTileXYFunction is a new function that returns the correct conversion function to use. 2020-10-02 10:56:44 +01:00
Richard Davey
2537e3ff70 Tilemaps.Components.GetWorldToTileXFunction is a new function that returns the correct conversion function to use. 2020-10-02 10:37:41 +01:00
Richard Davey
3352bd800c Restored previous version #4992 2020-10-02 10:37:30 +01:00
Richard Davey
92b431646a Tilemaps.Components.GetWorldToTileYFunction is a new function that returns the correct type of translation to use. 2020-10-02 10:31:02 +01:00
Richard Davey
f1c85fc220 Tilemaps.Components.HexagonalWorldToTileY is a new function that converts world Y coordinates from pixels to hexagonal tile Y coordinates. 2020-10-02 10:30:53 +01:00
Richard Davey
cb09374f9d Tilemaps.Components.StaggeredWorldToTileY is a new function that converts world Y coordinates from pixels to staggered tile Y coordinates. 2020-10-02 10:30:43 +01:00
Richard Davey
17df0f7135 Restored to previous version. #4992 2020-10-02 10:30:30 +01:00
Svipal
3997cad5a7 same work 2020-09-19 13:05:56 +02:00
Svipal
299f83c13d fixed conflicts 2020-09-19 10:56:05 +02:00
svipal
79fe9abc6e finished updating culling system 2020-09-18 17:16:52 +02:00
Svipal
1994185d6f merged master 2020-09-08 22:17:04 +02:00
Richard Davey
0d934c730e Every single Tilemap.Component function has now been made public. This means you can call the Component functions directly, should you need to, outside of the Tilemap system. 2020-09-02 11:54:24 +01:00
Richard Davey
07865a5823 Final set of namespace changes. Fix #5062 2020-09-01 20:28:42 +01:00
Svipal
809d0b7495 merged master 2020-08-09 13:13:09 +02:00
Svipal
241d4193e8 let's try again 2020-08-09 12:33:52 +02:00
Svipal
b4a1473fea test 2020-08-09 12:13:29 +02:00
Svipal
b4d9d71009 fixed orthogonal world to tile 2020-06-25 15:04:57 +02:00
Svipal
e6d468cda7 worldToTile fixed 2020-06-06 00:23:16 +02:00
samme
c963768c1e Docs: SetCollisionByExclusion() and friends
Fixes #5179

Thanks @BoltKey
2020-06-05 10:01:30 -07:00
svipal
5911b94d35 Revert "clean up"
This reverts commit 854589ddbe.

woops
2020-04-10 20:55:31 +02:00
svipal
854589ddbe clean up 2020-04-10 20:40:52 +02:00
Svipal
8665e08f13 refactored things so that there is no more switching at runtime depending on orientation 2020-04-03 19:36:13 +02:00
Svipal
1ccc815ce7 removed a few debug prints, moved isoBounds to a new component, started to add constants 2020-03-22 12:35:24 +01:00
Svipal
72cb3343d6 cleaning up debug prints and such 2020-03-21 11:25:04 +01:00
Svipal
cec71a85ea added hexagonal support 2020-03-21 10:19:03 +01:00
Svipal
406e6eb093 fixed worldtotilex on odd tiles 2020-03-14 10:57:19 +01:00
Svipal
66e99bccc6 changed a few things, preparing tiles 2020-03-14 10:23:13 +01:00
Svipal
a7d4816564 added staggered support 2020-03-14 10:11:04 +01:00
svipal
8e30c5ef1c
Update TileToWorldX.js 2020-02-08 15:53:53 +01:00
svipal
cf622269e8 Update PutTileAt.js 2020-02-08 15:51:12 +01:00
svipal
7122ea0b6b
Update GetTilesWithinShape.js 2020-02-08 11:56:38 +01:00
svipal
e4c43e59ba
Update CullTiles.js 2020-02-08 11:55:33 +01:00
svipal
4007e92be0
Update GetTileAt.js 2020-02-08 10:32:35 +01:00
svipal
f48e4aa9aa
Update GetTileAt.js 2020-02-08 10:31:59 +01:00
Svipal
9b86c5e6ed commented 2020-02-07 15:31:15 +01:00
Svipal
1573e25214 added isoCullDistances parameter to DynamicTilemapLayer 2020-02-07 15:21:11 +01:00
Svipal
d7a857697f fixed worldToTileXY and tileToWorldXY undefined point mistakes. Fixed getTilesWithinXY incorrect snaptoFloor setting 2020-02-07 14:05:42 +01:00
Svipal
dc330aaf4a linted everything 2020-02-06 11:02:44 +01:00
Svipal
5747f7102d fixed problems with removeTileAt 2020-02-05 18:42:20 +01:00
Svipal
aaf512b9cd fixed problems with putting tiles from null tiles 2020-02-05 18:37:40 +01:00
Svipal
a8b60cf946 fixed dynamic layer rendering 2020-02-04 04:57:28 +01:00
Svipal
fd29e96a5d changed orientation to be part of the layer, really cleaned up API. Started tests on the dynamic layer. Trying to understand getTileAt bug 2020-01-30 15:58:07 +01:00
Svipal
050325bff0 tried to pin down where the orientation became undefined, no success. 2020-01-29 17:42:39 +01:00
Svipal
95d2ff9996 need to compare across commits to understand regression regarding this.x 2020-01-27 20:12:53 +01:00
Svipal
e4857ce48a yoyuee 2020-01-19 20:55:09 +01:00
Svipal
fbe3345e54 Updated RemoveTileAtWorldXy, PutTileAtWorldXY, GetTilesWithinShape and GetTilesWithinWorldXY 2020-01-19 20:50:57 +01:00
svipal
eb90fc2ab4
Merge pull request #2 from photonstorm/master
keeping up with master #2
2020-01-18 14:21:26 +01:00
No
1a88ff95ba updated dynamic layer and tilemap 2020-01-17 16:15:59 +01:00
No
f17aef0abf wordtotileX or Y cannot be called independently either 2020-01-17 15:15:15 +01:00
No
ddbcf85194 woops 2020-01-17 14:49:02 +01:00
No
83bbf08902 changed world to tile and tile to world in isometric mode 2020-01-17 14:47:33 +01:00
Richard Davey
ff65e69cd1 Changed copyright date to 2020 2020-01-15 12:07:09 +00:00
Josh Soref
013ece9373 spelling: indices 2019-10-29 02:22:43 -04:00
Richard Davey
3a3ce8b914
Merge branch 'master' into tile-collision-update 2019-10-02 15:15:18 +01:00
Fabadiculous
255232dd2a Fix bug where graphics methods were not renamed 2019-06-22 16:55:50 +10:00
Richard Davey
c91ed91ce3 License link update 2019-05-10 16:15:04 +01:00
Richard Davey
a6341a97a8 Fixed Types references 2019-05-09 15:32:53 +01:00
Richard Davey
44faa01578 Tilemap Types 2019-05-09 12:39:19 +01:00
Richard Davey
73617da673 Tidied up the formatting 2019-03-05 14:41:35 +00:00
Richard Davey
4fc817c519 Final batch of typedefs 2019-02-13 16:06:00 +00:00
Richard Davey
aa341854c7 Happy New Year 2019-01-15 16:20:22 +00:00
Nicolas Rouvière
7b9f7f0217 Fix: Cannot read property 'index' of undefined at GetTileAt and RemoveTileAt 2018-11-19 00:08:36 +01:00
foobar
e481ea4cfd Fix reference error when culling 2018-10-15 20:31:46 +02:00
Richard Davey
5115847791 Finished all the Tilemap component descriptions 2018-09-28 14:32:36 +01:00
Richard Davey
b4e59405b4 Calling Tilemap.renderDebug ignored the layer scale when drawing to the Graphics object. It will now scale the layer before drawing. Fix #4026 2018-09-26 16:18:44 +01:00
Richard Davey
df8c0d8673 Calling Tilemap.renderDebug ignored the layer world position when drawing to the Graphics object. It will now translate to the layer position before drawing. Fix #4061 2018-09-25 15:37:46 +01:00
Richard Davey
89b9f42f3e Adding jsdocs 2018-09-24 23:20:43 +01:00
Richard Davey
f8b3fcf539 Cull Tiles now needs a render order for the layer data. 2018-08-21 18:02:00 +01:00
rootasjey
e2c505554a Fix JSDoc in Tilemap 2018-08-20 13:20:23 +02:00
Richard Davey
fcf5d20d7b Disable culling if layer has non-1 scroll factor #3893 2018-08-06 22:22:32 +01:00
Richard Davey
86965c28e4 The Tilemap Culling function now uses the Tilemap tile dimensions for its bounds calculations, instead of the layer tile sizes, as they two don't have to match and it's the underlying grid size that takes precedence when calculating visible tiles. Fix #3893 2018-08-06 13:31:27 +01:00
Richard Davey
31421ee00a The CullTiles updates from 3.11 didn't factor in the position of the Tilemap Layer to its bounds calculations, causing Static layers displayed out of the Camera viewport to never render in Canvas mode. The method has also been optimized further, with less divisions and less checks if culling is disabled. 2018-08-03 00:40:56 +01:00
ampled
50c787a9c8 - add typedef for SpriteConfig extends GameObjectConfig
- allow update-function signature to be overriden by GameObject subclasses
2018-07-29 12:19:04 +02:00
Skysteed
5cd60b3378 Major Optimization for Tilemap Collision Indexing
This update optimizes an existing feature (Tilemap Collision Indexing).

This optimization will apply to [nearly] everyone using procedural generation tilemaps, infinite tilemaps, multiplayer tilemaps, particularly large tilemaps (especially those dyanmic in nature) or who otherwise intend to index collisions before the tiles are loaded.

Benchmarking:

Using the standard approach, indexing collisions for a 500x450 tileset took 2530ms. By pre-building the collision index array in its entirety, I was able to reduce that to 259ms. However, this implementation reduces it to 8 ms. Larger tilemaps would be exponentially affected.

There are some considerations to make here since there are better implementations, but it would require deprecating some existing code. The advantage would be that the standard approach itself would be optimized, (thus avoiding the sort of 2500+ms costs here), rather than fairly obscured as it is with this implementation.
2018-07-19 10:59:35 -05:00
Richard Davey
20f1b37256 eslint fix and log update 2018-07-18 15:06:56 +01:00
Richard Davey
5ada70409e Modified tile sizes. 2018-07-16 15:20:46 +01:00
Richard Davey
0cc52f6002 Swapped 4 ternaries for a single conditional #3834 2018-07-16 14:55:51 +01:00
tarsupin
ad24a0b8ec
Removed repetative code. 2018-07-14 20:09:36 -05:00
tarsupin
00a38f744a
Switching tabs to spaces 2018-07-14 14:41:13 -05:00
tarsupin
9ac505d5cc
Build is requiring me to pre-declare x, y, tile. 2018-07-14 14:38:19 -05:00
tarsupin
4fa3dc7159
Update CullTiles.js 2018-07-14 14:30:15 -05:00
tarsupin
e3d64c63b3
Major Optimization for Culling Tilemaps
Refine the loop to only scan through the drawn boundaries that are being tested against (except when skipping cull). This eliminates a huge bottleneck / lookup time from the original loop each frame.

The update should affect tilemaps exponentially based on their size. It reduced my culling time to 1/70th for 1000x1000 tilemaps, and by about 1/20th on 250x250 tilemaps. It also reduced my requestAnimationFrame time from over 16ms per frame to ~1ms for the larger map.
2018-07-14 14:14:55 -05:00
Richard Davey
8981cf4a03 Swapped from vec2 to explicit values for cullPadding 2018-07-12 16:51:54 +01:00
Richard Davey
b03d3ff783 Added support for cull padding 2018-07-12 16:44:36 +01:00
Richard Davey
e66cf4e00b Adjusted bounds +- 1 tile 2018-07-12 16:32:25 +01:00
Richard Davey
12c6736c67 Stats recorded in tilesDrawn and tilesTotal. 2018-07-12 16:12:55 +01:00
Richard Davey
89db84377e Added skipCull property and setSkipCull method 2018-07-12 15:31:25 +01:00
Richard Davey
a447d85401 CullTiles recoded to use Camera worldView - finally, properly culling, regardless of layer scale or camera zoom! Fix #3818 2018-07-12 15:07:45 +01:00
Richard Davey
869087044b Starting work on proper tile culling 2018-07-12 01:14:34 +01:00
Craig Whiteside
375b1f8f18
Pulled out calculation for tile pixel position amended with tilemapLayer position 2018-06-23 21:20:54 +01:00
Craig Whiteside
ac82e39314
Fix whitespace 2018-06-23 16:40:19 +01:00
Craig Whiteside
86f1cbcabf
Made it more specific to the tile offset. 2018-06-23 16:34:45 +01:00
Craig Whiteside
a73e47e508
Account for position of tilemapLayer when culling tiles 2018-06-23 16:28:45 +01:00
Richard Davey
3d9da060c5 Camera.shake would not effect dynamic tilemap layers. Fix #3669 2018-05-24 23:02:59 +01:00
Richard Davey
cd288b33c2 eslint fixes 2018-04-23 23:52:57 +01:00
Felipe Alfonso
1ce2311465 tile culling and clipping progress 2018-04-23 13:45:42 -03:00
Richard Davey
f02eb5874f Marked all Tilemap components as private 2018-04-16 15:25:22 +01:00
Richard Davey
18585de81d Lots of jsdoc fixes 2018-04-16 14:43:24 +01:00
Richard Davey
9fb1a72b70 Typo 2018-04-10 15:21:10 +01:00
Richard Davey
cdfe2e0ea2 Fixed references 2018-04-10 04:13:38 +01:00
Richard Davey
eebe58f1c9 Removed duplicate parameters 2018-03-21 15:17:40 +00:00
orblazer
9375bb0530 Fix multiple types on Tilemaps 2018-03-20 16:11:33 +01:00
orblazer
30f410d1d3 Fix types in Tilemaps 2018-03-20 12:36:35 +01:00
Bugi Görtz
077d933bbb Fixed Tile-Culling for Zoomed Camera
The fix from https://github.com/photonstorm/phaser/pull/3354/ leads to some tiles getting culled when camera is zoomed as the camera.scrollX/camera.scrollY-Properties are needed in unscaled Coordinates (World-Coordinates?) in CullTile.js

Error gets bigger with distance from (0|0)
2018-03-15 20:32:09 +01:00
Michael Hadley
d966aaa412
Fixes #3395 2018-03-15 06:22:22 -05:00
Richard Davey
d1f5f8a82b Added jsdocs 2018-02-12 16:01:21 +00:00
Richard Davey
ed89e48b4d Updated jsdocs 2018-02-08 02:02:37 +00:00
Richard Davey
cf6bbbd0fb Added jsdocs 2018-02-08 01:08:59 +00:00
Richard Davey
5dffe21858 Updated jsdocs 2018-02-07 23:27:01 +00:00
Richard Davey
fb42cbee42 Updated jsdocs 2018-02-07 22:46:07 +00:00
Richard Davey
10193c181a Fixed require paths. 2018-02-07 17:10:01 +00:00
Richard Davey
89fe7123e1 Moved to its own top-level folder. 2018-02-07 16:29:48 +00:00