Repository navigation
feat(tiled): load maps made in the Tiled editor (TILE-1) - #158
Merged
Merged
Conversation
TileRenderer skipped tiles with Camera2D.View, which ignores zoom and rotation, so a zoomed-out camera left the outer tiles undrawn. It now culls with VisibleBounds plus the shake margin. A new overload takes a per-cell TileOrientation (Tiled's flip bits) and an extra margin.
…ects MicroEngine.Tiled reads .tmx and .tmj maps, with their external tilesets and templates, through the game's assets: tile layers with each cell's flips, tilesets as sprites (tall tiles and animations included), objects as records with typed properties, and a collision grid from a tile property the game names. DotTiled parses the files and never appears in the public API. TileRenderer's new overload takes the layer's offset and tint.
The version tool lists it (never required of the versions already published), the package check knows its files and dependencies, the samples swap its package reference for the project, and the notices list DotTiled.
…ts own folder DotTiled 1.0.0's loader resolves a template's tileset against the map's folder, so a template in another folder failed to load; the package now resolves every reference from the folder of the file that names it. Tile objects draw as Tiled shows them (stretched, mirrored, turned about their bottom-left corner), object layers draw their tile objects, TiledMap.ParallaxShift gives Tiled's parallax, TiledObject.TurnedBounds the box around a turned object, and image collections with gaps in their ids list only the tiles they have.
TiledLevel loads Tiled's own Sticker Knight example map (public domain) through the MicroEngine.Tiled package: the objects whose bodyType the designer set are solid, the coin template's instances are collected and every layer draws with its parallax. Its tour script is played by the documented samples check and its tests by Samples.Tests.
…ture table MapBench writes a 1000 x 1000 map of three compressed layers and times its load and one frame of drawing at zoom 1 and 0.5.
The world manual gains a Maps from Tiled section quoting the TiledLevel sample, the API reference covers MicroEngine.Tiled, and the release notes list the package and the TileRenderer fix under the next release.
|
Preview of 9d73602 (candidates demos): https://micro-engine-557s1r2ck-nastmzs-projects.vercel.app |
This branch was successfully deployed
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
docs/evaluations/tile-1.md) recommended option 1, which the owner approved and ADR 0052 records: an optionalMicroEngine.Tiledpackage over DotTiled whose public API uses engine types only.TileRenderer, which skipped the tiles a zoomed-out or rotated camera shows, and lets it draw mirrored and turned cells.Changes
Engine:
TileRendererculls withCamera2D.VisibleBounds. NewTileOrientationtype, and aDrawoverload with per-cell orientation, offset, tint and margin.MicroEngine.Tiled, the ninth SDK package (optional, managed only):.tmxand.tmjmaps with their tilesets and templates through the game's assets (Assets.TiledMap).TiledSprites), animations and image collections included.CollisionGridreads collision from a tile property the game names.DotTiled 1.0.0 defects worked around in the package, each pinned by a test:
Release path:
sdk/version.mjsadds the package; it is not required of the versions already published.THIRD-PARTY-NOTICES.mdand the architecture table include it.Sample:
samples/TiledLevelplays Tiled's own Sticker Knight map (public domain,CREDITS.md), which the Tiled editor saved.Benchmark:
benchmarks/MapBench, on a 1000 × 1000 map with three compressed layers:Docs:
docs/manual/world.md, quoting the sample.## Next release.odd/tasks/tile-1.md.Unrelated chore:
.gitignoreignores the localtrailer*/andchannel-art/folders.Testing
dotnet test MicroEngine.slnx -c Release: every project passes. The new tests areMicroEngine.Tiled.Tests(25),TileRendererTests(4) andTiledLevelTests(2). The architecture table needed the new package, which the first run caught; it now passes.node --test sdk/tests/version.test.mjs: 29/29.node site/scripts/snippets.mjs: passes.astro build: passes.check-distreported only the demo files, which were not fetched locally.sdk/tests/docs.mjsagainst the packed feed (CI runs it).Closes #121