pn-game-logic

pn-game-logic is a skill for Cursor from perniemann/pnCore. It costs 42 tokens per session (1,048 once invoked), scanned A, original, MIT.

A guide to implementing the rules and behavior of a video game, such as its game loop, menus, controls, collisions, scoring, and saved progress. It includes patterns for both two-dimensional and three-dimensional games.

In plain words
What is it for?
Use it to build game loops, state machines for menus and play modes, keyboard or controller input, collision handling, scoring, progression, inventory, and save/load features.
Why use it?
It helps keep game updates predictable and separates game state from rendering, input, and other systems. This reduces timing bugs and makes game logic easier to test and change.

Skill for Cursor

Written for Cursor: shipped in a Cursor plugin.

Part of the pn-core plugin — 133 skills, 19 commands, 9 agents, 1 MCP server shipped together

Good fit Use it to build game loops, state machines for menus and play modes, keyboard or controller input, collision handling, scoring, progression, inventory, and save/load features.

Compare 6 skills from other repositories ↓
Install with agentmods
npx agentmods add skills/perniemann/pncore/pn-game-logic
Install

Getting it into your agent

One page per mod, every tool's command on it. A separate URL per tool would split the same page into five that compete with each other.

Any agent
npx skills add perniemann/pnCore --skill pn-game-logic
Clone the repo
git clone --depth 1 https://github.com/perniemann/pnCore

Made for: Cursor.

Or install pn-core, the plugin that ships this one along with the rest of its 133 skills, 19 commands, 9 agents, 1 MCP server.

Wrote this? Show the measurements

A badge with what this costs and how it scanned, read live from this page, so it follows the numbers instead of freezing them. Markdown for a README, HTML for a documentation site or a project page.

agentmods badge for pn-game-logic

README.md
[![agentmods](https://agentmods.dev/badge/skills/perniemann/pncore/pn-game-logic/github.svg)](https://agentmods.dev/skills/perniemann/pncore/pn-game-logic)
Your own site
<a href="https://agentmods.dev/skills/perniemann/pncore/pn-game-logic"><img src="https://agentmods.dev/badge/skills/perniemann/pncore/pn-game-logic/github.svg" alt="Measured on agentmods" height="20"></a>

Or the 80×15 button, for a site that already has a row of RSS and ATOM ones. Only the verdict fits; the numbers stay here.

agentmods 80×15 button for pn-game-logic

Your own site · 80×15
<a href="https://agentmods.dev/skills/perniemann/pncore/pn-game-logic"><img src="https://agentmods.dev/badge/skills/perniemann/pncore/pn-game-logic.svg" alt="Reviewed on agentmods" width="80" height="20"></a>
Per session 42 Skills are progressive disclosure: only the name and description are preloaded; the body loads when the skill is used.
When invoked 1,048 The whole file, excluding the scripts and references it only reads on demand.
Security scan A 0 findings. A grade says what 26 rules found in the file — not that it is safe.
Origin original No closer match found in the catalogue.
Token cost

What it costs to keep this loaded

Counted locally with the o200k_base tokenizer, which is exact for GPT models; Claude uses its own tokenizer and its counts differ. Treat this as one consistent yardstick across the catalogue rather than a bill. Prices are per million input tokens.

ModelPer sessionOnce invoked
Fable 5.1 $0.00042 $0.01048
Opus 5 $0.00021 $0.00524
Sonnet 5 $0.00008 $0.00210
Haiku 4.5 $0.00004 $0.00105

Measured 8d ago against content hash 936b5e54c48c, method: parsed. Prices are Anthropic first-party input rates as of 2026-09-12, from the pricing page.

Security

Grade A, and why

pn-game-logic scanned grade A with 0 findings against 26 rules in 11 categories — prompt injection, anti-refusal, data exfiltration, privilege escalation, supply chain, agent snooping, system-prompt leakage, SSRF and excessive agency — measured 8d ago.

A static scan of the body, not an audit. Every finding is printed with the line that produced it so you can judge whether it matters here. A mod is markdown that instructs an agent; that is exactly why what it instructs is worth reading.

Nothing flagged

None of the 26 patterns this scan looks for appear in this file: no shell pipes, no recursive deletes, no credential paths, no hidden text, no instruction-override or anti-refusal phrasing, no agent-config snooping. That is not a guarantee, it is the absence of the things that are checkable.

packages/pn-core-mcp/content/skills/gamedev/pn-game-logic/SKILL.md · 74 lines

How it starts

The opening of the file, as written. The whole thing — 74 lines — stays where its author put it; the contents beside it link to each section on GitHub.

Game logic skill

When to use

  • Implementing or refactoring game loop architecture
  • Managing game states (menu, play, pause, gameover)
  • Handling input (keyboard, mouse, gamepad)
  • Implementing collision detection or spatial partitioning
  • Adding scoring, progression, or save/load
  • Structuring game logic for testability

Game loop

  1. Fixed timestep: Use a fixed delta (e.g. 1/60s) for physics and deterministic logic. Accumulate elapsed time and step in fixed increments to avoid spiral of death.
  2. Accumulator pattern: accumulator += delta; while (accumulator >= FIXED_STEP) { update(); accumulator -= FIXED_STEP; }. Cap accumulator to avoid large catch-up steps.
  3. Render interpolation: For smooth visuals, interpolate between last and current physics state using accumulator / FIXED_STEP when rendering.
  4. Single loop: Use one render loop with requestAnimationFrame. Separate update(delta) (logic) from render() (draw).

State machines

  • Game states: Model high-level states (menu, play, pause, gameover, settings). Use explicit state enum or state machine (e.g. currentState, enter(), exit(), update()).
  • Transitions: Define valid transitions; guard against invalid state changes. Use events or callbacks for state entry/exit (e.g. play music on play, pause physics on pause).
  • Sub-states: For complex flows (e.g. play → cutscene → play), use nested or hierarchical state machines when needed.

Input handling

  • Action mapping: Map raw keys/buttons to logical actions (e.g. "jump", "move", "shoot"). Decouple input from game logic for rebinding and multiple devices.
  • Input buffering: For responsive controls, buffer inputs for a short window (e.g. jump buffer so late jump still registers). Clear buffer on consume.
  • Gamepad: Normalize axes and buttons across devices. Use navigator.getGamepads() or a library (e.g. gamepad API wrapper) for consistent access.
  • Order: Process input → update logic → render. Avoid reading input mid-update.

Read the full file on GitHub · 74 lines

Changes

What this file has done since we first saw it

Hashed on every crawl. A supply-chain change to an agent config is a question of when, not whether, so the history is kept rather than the latest state alone.

  1. 8d ago First seen · 74 lines · 42 tokens per session scan A 936b5e54c48c

Subscribe to this mod's changes

pn-game-logic is a skill published in the GitHub repository perniemann/pnCore (0 stars, last pushed 6d ago), licensed MIT. It adds 42 tokens to every session and 1,048 once invoked, about $0.0002 per session on Opus 5. A static security scan graded it A with 0 findings. No closer match exists in the catalogue, so it is treated as the original; first seen 2026-09-03.

Related

Other skills, from other repositories

t-800-run-gates

A set of machine checks for deciding whether a T-800 run is ready to finish. It covers different run modes, such as creating, patching, looping, or auditing.

Khar-AG/t-800-agent · 89 tokens

screen-reader-testing

Test web applications with screen readers including VoiceOver, NVDA, and JAWS. Use when validating screen reader compatibility, debugging accessibility issues, or ensuring assistive technology support.

wshobson/agents · 39 tokens

temporal-python-testing

Test Temporal workflows with pytest, time-skipping, and mocking strategies. Covers unit testing, integration testing, replay testing, and local development setup. Use when implementing Temporal workflow tests or debugging test failures.

wshobson/agents · 45 tokens

e2e-testing-patterns

Master end-to-end testing with Playwright and Cypress to build reliable test suites that catch bugs, improve confidence, and enable fast deployment. Use when implementing E2E tests, debugging flaky tests, or establishing testing standards.

wshobson/agents · 51 tokens

implement-universal

Harness-agnostic version of /implement. Drives a single workshop ticket through the SWE→Tester loop in ONE conversation, with the role prompts bundled as agents/software-engineer.md and agents/tester.md instead of being launched as subagents. Resolves the ticket from implementyourself/tasks/, creates an…

Arindam200/awesome-ai-apps · 204 tokens

test

Enter the Test phase of CocoBrew. Reads spec.md test requirements, generates test cases, executes SQL validation and quality checks, records results in test.md. Can be re-run without full rebuild. Requires Build phase completion.

Snowflake-Labs/cocoplus · 47 tokens