Skip to content

Feature/ray tracing#34

Merged
manix84 merged 8 commits into
mainfrom
feature/ray-tracing
Jun 12, 2026
Merged

Feature/ray tracing#34
manix84 merged 8 commits into
mainfrom
feature/ray-tracing

Conversation

@manix84

@manix84 manix84 commented Jun 12, 2026

Copy link
Copy Markdown
Owner

This pull request introduces new 2D ray tracing helpers to the engine, allowing for visibility polygon calculations, ray/segment intersection checks, capped light bounces, and improved lighting demos. It also adds string tile-map helpers for authoring and querying grid-based maps as text. The documentation has been updated to reflect these new features, and Storybook demos have been reorganized and expanded to better showcase the engine’s capabilities.

New Features

  • Added 2D ray tracing helpers for calculating visibility polygons, ray/segment intersections, rectangular bounds, polygon occluders, surface colors, and capped diffuse bounce layers. [1] [2] [3] [4]
  • Added string tile-map helpers for parsing and querying text-authored grid maps, including cell lookups and coordinate conversions. [1] [2]

Documentation and Demo Updates

  • Updated README.md, API.md, src/README.md, and WHATSNEW.md to document the new ray tracing and tile map features, and reorganized Storybook demo references for clarity and improved navigation. [1] [2] [3] [4] [5] [6] [7] [8] [9] [10] [11] [12]
  • Improved Storybook demo organization, splitting systems into more focused categories (e.g., Input, Player Data, Achievements, Rendering, Effects, Physics) and adding new demos for ray tracing and tile maps. [1] [2] [3]

Test Coverage

  • Added new exports to the coverage-focused tests to ensure the new ray tracing and string tile map helpers are included in test coverage. [1] [2] [3] [4]

Version Bump

  • Bumped package version to 4.10.2 to reflect the new features and improvements.

manix84 added 8 commits June 12, 2026 13:57
…d manipulation

- Introduced StringTileMap and StringTileMapCell types for representing a grid of tiles.
- Implemented parseStringTileMap function to convert a string representation into a structured tile map.
- Added utility functions to retrieve tiles, calculate centered points, and find specific tiles within the map.
Copilot AI review requested due to automatic review settings June 12, 2026 23:16
@manix84 manix84 enabled auto-merge (squash) June 12, 2026 23:16
@manix84 manix84 merged commit fda8e22 into main Jun 12, 2026
8 checks passed
@manix84 manix84 deleted the feature/ray-tracing branch June 12, 2026 23:18

Copilot AI left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull request overview

This PR adds renderer-agnostic 2D ray-tracing utilities (visibility polygons, ray/segment hits, and capped diffuse bounce layers), introduces string-authored tile-map parsing/query helpers, and reorganizes/extends Storybook demos and documentation to showcase the new capabilities.

Changes:

  • Added ray-tracing helpers with optional surface-color tinting and bounce-layer tracing, plus a new ray-traced apartment Storybook demo.
  • Added string-tile-map parsing and lookup helpers, plus a new interactive isometric dungeon demo using the text-authored map pattern.
  • Updated docs/Storybook navigation and bumped package version to 4.10.2.

Reviewed changes

Copilot reviewed 27 out of 28 changed files in this pull request and generated 3 comments.

Show a summary per file
File Description
WHATSNEW.md Notes new ray tracing + Storybook reorg additions.
src/string-tile-map.ts New string tile-map parser + lookup/coordinate helpers.
src/ray-tracing.ts New 2D ray tracing + visibility + bounce-layer helpers.
src/index.ts Exports new tile-map and ray-tracing APIs/types.
src/tests/string-tile-map.test.ts Adds unit tests for tile-map parsing and queries.
src/tests/ray-tracing.test.ts Adds unit tests for ray casting, visibility, and bounces.
src/tests/coverage.test.ts Extends coverage export list for new APIs.
src/stories/systems/systems-demos.ts Adds “Ray-traced apartment” demo + new ray-tracing imports/types.
src/stories/systems/README.md Updates Storybook grouping explanation + documents ray-traced apartment story.
src/stories/systems/Presentation.stories.ts Moves/renames sidebar group and exports RayTracedApartment story.
src/stories/systems/ScreenEffects.stories.ts Renames sidebar path for player effects stories.
src/stories/systems/EnvironmentScreenEffects.stories.ts Renames sidebar path for environment effects stories.
src/stories/systems/ComboEffects.stories.ts Renames sidebar path for combo effects stories.
src/stories/systems/AtmosphericEffects.stories.ts Renames sidebar path for atmospheric effects stories.
src/stories/systems/Input.stories.ts Renames sidebar path for input stories.
src/stories/systems/PlayerData.stories.ts Renames sidebar path for player data stories.
src/stories/systems/Achievements.stories.ts Renames sidebar path for achievement stories.
src/stories/systems/Physics.stories.ts Renames sidebar path for physics stories.
src/stories/systems/Audio.stories.ts Renames sidebar path for spatial-audio stories.
src/stories/Showcase.stories.ts Renames “Live Systems” panel label to “Live Features”.
src/stories/GameArena.stories.ts Improves pointer dragging state handling for view control.
src/stories/arcade-camera-demos.ts Adds editable string-map dungeon demo, wheel zoom, keyboard movement; reuses FPS corridor scene.
src/stories/README.md Updates Storybook section descriptions and grouping.
src/README.md Documents new tile-map and ray-tracing helper modules.
README.md Documents new features and updated Storybook grouping; adds ray-tracing section.
API.md Adds API docs for string tile maps and ray tracing; updates Storybook paths.
package.json Version bump to 4.10.2.
package-lock.json Lockfile version bump to 4.10.2.

Comment thread src/string-tile-map.ts
Comment on lines +27 to +31
const sourceRows = text
.replace(/\t/g, " ")
.split("\n")
.map((row) => row.replace(/\s+$/u, ""))
.filter((row) => row.length > 0);
Comment thread src/ray-tracing.ts
Comment on lines +187 to +191
const determinant =
rayDirection.x * segmentDirection.y - rayDirection.y * segmentDirection.x;

if (Math.abs(determinant) < Number.EPSILON) {
return;
Comment thread src/ray-tracing.ts
Comment on lines +99 to +104
const base = parseRayTracingHexColor(baseColor);
const surface = parseRayTracingHexColor(surfaceColor);

if (!base || !surface) {
return baseColor;
}

@chatgpt-codex-connector chatgpt-codex-connector Bot left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

💡 Codex Review

Here are some automated review suggestions for this pull request.

Reviewed commit: 59ed6b7cdb

ℹ️ About Codex in GitHub

Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you

  • Open a pull request for review
  • Mark a draft as ready
  • Comment "@codex review".

If Codex has suggestions, it will comment; otherwise it will react with 👍.

Codex can also answer questions or update the PR. Try commenting "@codex address that feedback".

Comment thread src/string-tile-map.ts
const normalizeTile = options.normalizeTile ?? ((tile: string) => tile as TTile);
const sourceRows = text
.replace(/\t/g, " ")
.split("\n")

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

P2 Badge Preserve trailing space tiles when parsing maps

When callers use a non-space emptyTile to distinguish playable floor spaces from padded void (as the new dungeon demo does with _), this trim turns any intentional spaces at the end of a row into missing cells that are then padded with the empty tile. For example, parsing "S \n###" with emptyTile: "_" yields S__ instead of preserving the two floor cells, so editable text maps cannot represent floor tiles on the right edge of ragged rows.

Useful? React with 👍 / 👎.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants