Commit Graph
9 Commits
Author SHA1 Message Date
Leonid PershinandClaude Fable 5 a395e58458 Add MrGameEng.Pathfinding and MrGameEng.Collisions modules
CI / build-test (push) Failing after 1m5s
Pathfinding (depends on Core only): GridPathfinder with A* (octile/
Manhattan heuristic), Dijkstra and BFS over a game-implemented
IPathGrid; 4/8 connectivity, diagonals never cut corners. FlowField +
FlowFieldBuilder (multi-source Dijkstra) give crowds O(1) steering per
agent per frame. All buffers are grid-sized once and invalidated by a
generation stamp - repeated queries allocate nothing and clear nothing.

Collisions (Graphics exception: Transform2D, RectF): Collider component
(circle/AABB, offset, two-way layer masks), CollisionWorld - a uniform
spatial hash on flat arrays rebuilt from scratch each tick (O(n) for
movers, zero alloc after warm-up, deterministic pair order), pair
collection, QueryAabb and closest-hit Raycast. scene.UseCollisions()
registers CollisionSystem after movement systems.

30 new tests (string-map mazes, cost weighting, corner cutting, flow
descent; pair/mask/query/raycast). Sample gains a PathfindingScene
('path' console command): click to set the goal, 250 agents follow the
flow field, the A* path is highlighted, colliding agents flash red.

Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>
2026-06-11 13:39:28 +03:00
Leonid Pershin b3415120c3 Add MrGameEng.Tilemaps: code-built tile grids rendered through the batcher
CI / build-test (push) Failing after 1m4s
TileSet maps ids to texture regions with tints (0 = empty), TileGrid is a
bounds-checked dense ushort grid, and the Tilemap component places a grid
in the world per render layer. UseTilemaps() inserts TilemapRenderSystem
before the flush; it submits only the camera-visible cell range
(TilemapMath.VisibleCells), so frame cost scales with the screen, not the
grid. Demonstrated in the sample as a checkerboard floor; Tiled loading
stays on the roadmap on top of this API.
2026-06-11 10:24:47 +03:00
Leonid Pershin b318d1e795 Add MrGameEng.Atlases: texture atlas builder, runtime loader and CLI tool
CI / build-test (push) Failing after 1m13s
AtlasBuilder packs a directory tree of loose images into atlas pages plus
JSON metadata (deterministic shelf packing, incremental rebuilds, orphan
cleanup); TextureAtlas loads them back handing out Texture2DRegions, so
sprites from one page batch into a single draw call. The asset handle
generator maps .atlas files to TextureAtlas and skips page images.
Demonstrated in the sample (Assets/Atlases + 'atlas' console command),
wrapped as tools/MrGameEng.AtlasTool for build scripts.

Documented dependency exception: Atlases depends on Graphics and Assets.
2026-06-11 08:18:30 +03:00
Leonid Pershin d6f19b9119 Migrate test projects from xunit 2.9.3 to xunit.v3 3.2.2
CI / build-test (push) Successful in 1m6s
Test projects become executables (OutputType=Exe) as required by v3.
Satisfy the new xUnit1051 analyzer by passing TestContext cancellation
tokens in the generator compilation test.
2026-06-11 05:50:09 +03:00
Leonid PershinandClaude Fable 5 d498c70660 Add in-game developer console (MrGameEng.DevConsole)
Core gains a static Log (Debug/Info/Warning/Error + event); the engine
logs key events like scene switches. The console captures Log output
into a 2048-line ring buffer and executes registered commands with
input history (up/down), Tab prefix completion and scrolling
(PageUp/PageDown/End/wheel). Built-ins: help, clear, echo, timescale,
close, quit; games register their own (sample: stress/main/beep).

Console core is pure logic covered by headless tests; the Myra overlay
renders a single label rebuilt only when the Revision counter moves -
an idle or closed console costs nothing per frame. Toggled with the
backquote key; sample gameplay hotkeys are suppressed while open.

Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>
2026-06-11 05:17:08 +03:00
Leonid PershinandClaude Fable 5 e06f24a319 Parallel rendering pipeline, ring vertex buffer, phase timings
Five optimizations measured on the 100k-entity stress scene (Release,
vsync off): 103 FPS baseline -> 297 FPS.

- Sprite submission and vertex building run on all cores above
  Renderer2DOptions.ParallelThreshold (default 8192). Work is sliced
  into 4096-entity segments: a Friflo chunk holds a whole archetype,
  so per-chunk parallelism degenerates to one thread. Segments merge
  in deterministic order, preserving radix sort stability.
- Vertex buffer is ring-written with SetDataOptions.NoOverwrite
  (GPU buffer 2x frame size); Discard only on wrap-around.
- Texture2DRegion precomputes UVs - four float divisions per sprite
  per frame removed.
- Renderer2D exposes per-phase timings (submit/sort/build/upload/draw),
  shown in the sample HUD - all further optimization is data-driven.
- Sample BounceSystem parallelized the same segmented way.

Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>
2026-06-11 05:06:55 +03:00
Leonid PershinandClaude Fable 5 a3e6d3bb0a Stable radix sprite sort and render hot-path optimizations
SpriteBatcher now sorts with a stable LSD radix sort: equal-key sprites
keep submission order across frames (no flicker) and passes over digits
identical in all keys are skipped, making the common single-layer case
nearly free. Hot paths avoid per-sprite trig and square roots: SinCos is
skipped for unrotated sprites and the culling radius comes from the
region's precomputed diagonal.

Stress scene (100k entities, ~61k on screen, Release): 103 -> 124 FPS.
Sample now runs with VSync off to show real frame rates.

Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>
2026-06-11 04:39:17 +03:00
Leonid PershinandClaude Fable 5 2b7d4c4fef Add scene transitions (fade, wipe) to SceneManager
Switch(scene, transition) covers the old scene, swaps at full coverage
(hiding slow OnLoad), then reveals the new one. Built-in Fade and Wipe
transitions draw through TransitionRenderer (BasicEffect quad, no
SpriteBatch); custom transitions subclass Transition. Runs on unscaled
time so it works while gameplay is paused; Switch during a transition
replaces the pending target.

Sample: Tab now fades into the stress scene and wipes back.

Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>
2026-06-11 04:27:54 +03:00
Leonid Pershin ff2231a8ab Update README.md to include project description, developer documentation links, and license information.
CI / build-test (push) Successful in 1m6s
2026-06-11 04:03:07 +03:00