Inside the current build

Behind NiNjAttack

NiNjAttack is built as two browser interfaces that share one arcade session: the main battlefield on a larger screen and an optional smartphone controller opened from a QR code. The game also works directly with a mouse, so the second device adds a different input method rather than locking the game behind extra hardware.

NiNjAttack gameplay preview using the current player, enemy and shuriken assets
A gameplay preview reconstructed from the current build's own sprites, arena color, HUD labels and gameplay dimensions.

One game tab, one session

When the game page opens, its JavaScript creates or reuses a session identifier for that browser tab. If a session arrives in the page URL it is used; otherwise the code checks session storage and generates a new identifier when necessary. That value is exposed to the scroll interface so the Controller view can build the correct pairing link.

The QR link points to the controller route with the session identifier in the ?s= query parameter. Opening that link on a phone gives the controller the same identifier as the desktop game. Both interfaces then connect to the NiNjAttack WebSocket service. Messages include the session value, and the game ignores controller messages belonging to a different session. This is what lets more than one open game tab exist without intentionally sharing the same controller input.

The phone is an input surface, not a second game screen

The controller does not mirror the battlefield. Its canvas contains a shuriken positioned on a quadratic curved track. Pointer movement is converted into a normalized horizontal value called t, clamped between 0 and 1. Dragging sends an aim message with that value. Releasing sends a shoot message and resets the controller shuriken to the middle of the track.

On the game side, the received t value becomes a firing angle. A value near the middle produces a more vertical throw, while values toward either side rotate the trajectory left or right. The mouse fallback follows the same basic idea: the horizontal click position inside the playable arena is normalized and passed into the same shuriken-spawning function.

NiNjAttack smartphone controller track with a draggable shuriken
The controller interaction reconstructed from the current controller geometry: drag horizontally along the curved track, then release to send the throw.

A deliberately small arcade loop

A run always starts with three lives, zero score and an empty active field. The player's ninja stays near the bottom center of the canvas while enemies spawn above the arena and move downward. A defeated enemy adds one point. A life is removed if an enemy crosses the player line or if an enemy shuriken reaches the player. The run ends when all three lives are gone.

The enemy mix changes as the score rises. Normal enemies descend directly and have one hit point. Once the score is above 5, a zigzag type can appear and adds horizontal movement while descending. Once the score is above 12, a larger boss can appear; it moves more slowly and has three hit points. These are probability-based additions rather than fixed level transitions, so reaching a threshold allows a type to spawn without guaranteeing that it appears immediately.

Enemies can also launch shuriken toward the player. The player's own shuriken can collide with and remove an incoming enemy projectile. That means a throw can be defensive as well as offensive: sometimes the immediate problem is the projectile already travelling down the screen rather than the enemy that fired it.

Why there is still a mouse mode

The QR controller is the distinctive cross-device part of NiNjAttack, but it is optional. Keeping direct mouse input means the game can be opened and understood on one computer without pairing another device. It also provides a practical fallback if a phone is unavailable or the controller connection cannot be established.

The two modes ultimately feed the same aiming model. That keeps the game rules consistent: the player is choosing an angle for the next shuriken rather than moving the ninja around the battlefield.

What the Scroll of Fame actually stores

After game over, NiNjAttack stores results in the browser's local storage under a dedicated leaderboard key. Entries are sorted by score and the saved list is capped in the current implementation. Because this storage belongs to the browser, the Scroll of Fame is a local high-score table, not an account-based or global ranking. Clearing browser storage or switching devices can therefore change which scores are visible.

Current technical boundaries

Where the surrounding pages fit

How to Play is the practical manual for setup, controls, scoring, enemy behavior and troubleshooting. This page focuses instead on how those pieces are implemented and why the cross-device interaction works. About gives the shorter project overview.

The separate Ninja Facts and Tao Wisdom pages sit outside the core product documentation. They provide historical and philosophical context for visitors who want to explore the game's thematic inspiration, without presenting those subjects as part of the game's technical design.