ewrogers/sgdk-skills

sgdk-ai

Implement enemy behavior in SGDK games with patrol/chase/attack states, sight cones, target selection, bounded pathfinding and staggered updates.

ソースを見る

使い方

  1. インストールコマンドをコピーし、自分の環境へ導入する前にソースを確認します。
  2. 必要なツール、認証情報、対応環境を原文で確認します。
  3. 入力と成果物を指定し、出力を資料と照合します。
npx skills add https://github.com/ewrogers/sgdk-skills --skill sgdk-ai

開始前の確認

  • 導入にはモデル契約、API枠、ファイルへのアクセス許可は含まれません。
  • スター数や導入数は活動の指標であり、独立した品質・安全性試験ではありません。
リポジトリの原文

見出し、例、コード、表、リンク、参照画像を含む原文を表示しています。

SGDK AI

Give enemies clear rules, a predictable amount of work and feedback the player can read. A Bombardier that spots you, turns, pauses and attacks often feels smarter than one that runs an expensive search every frame.

Choose the behavior first

  • Define what each enemy knows: current target, last seen position, home and

state timer. Keep perception separate from movement and attack resolution.

  • Make state changes cancel old intentions. Stun, defeat, respawn and a new

level must invalidate outstanding path results and attacks.

  • Use a sight range and, where useful, a forward cone. Check occlusion against

the same solid geometry used for movement. Remember a lost target briefly instead of following its hidden live position forever.

  • Keep a visible target unless there is a reason to switch. Decide how equal

distances and multiple players are resolved. Telegraph attacks and recheck whether a melee strike can still hit when its wind-up ends.

See states and perception for the tradeoffs and the lab's concrete rules. These are ordinary C game systems, not SGDK AI APIs.

Bound the expensive work

Prefer authored patrol points and direct movement when they suffice. Add a grid search when the game actually needs routes around obstacles. Match the grid's walkability to the enemy's footprint; a path for a point may not fit a large creature.

Use fixed search storage, a queue capacity, a per-frame expansion budget and a fair request scheduler. Preserve the frontier between frames. Give no-path, full projectile pools and stale results explicit outcomes instead of retrying without limits. A bounded search can still have noticeable latency when many enemies request it together.

See navigation and budgets. Stagger perception and planning; keep movement, attack timers and animation on the intended game clock. Measure the optimized ROM. A node counter is not a CPU percentage.

Integrate with SGDK

Pull ewrogers/sgdk:latest, run doctor, and verify the selected SDK's headers and source before using an unfamiliar function. The references were checked with SGDK 2.11. Sample SGDK's cached joypad state once per displayed frame and share it. Keep normal VBlank work running during pause.

Use SGDK sprites and audio for presentation; keep AI independent of sprite handles. Disable sprite auto-animation when pause must freeze a model-driven animation. Reuse sprite objects and fixed projectile slots rather than allocating for each attack. CPU, main RAM, VRAM, DMA and sprite scanlines are separate budgets.

The standalone Enemy Lab is a three-area stealth challenge with Bombardiers, Shockers, sentries, exits, stun, tries and Game Over. It includes graphical feedback and optional sight/path views. Copy it as a small proof or adapt individual modules; it is not a required game framework. Use its supplied makefile so its SGDK buffer-access compatibility setting stays in effect.

Validate behavior and limits

Test cone/range boundaries, occlusion, deterministic target ties, wind-up dodges, stun recovery and pause. Compare path results with an independent oracle; cover walls, long routes, full queues, cancellation and level changes. Check per-frame work and total wait time separately.

Build release/debug through the container, then playtest facing, alerts, attacks, navigation and readability. Record actual tool versions and distinguish host simulation, build validation, emulator playtests and console measurements.

For damage, guarding and reactions after an enemy requests an attack, use sgdk-combat when available. Detection and the decision to attempt a guard remain AI policy; the combat resolver decides whether that guard blocks the contact.

タスクに関連する項目

同じリポジトリから

関連する Skills

すべての Skills
ewrogers
コミュニティ

sgdk-assets

Prepare, import and troubleshoot Mega Drive graphics, palettes, spritesheets, tiles, maps, fonts and audio resources with SGDK ResComp in Docker. Use for .res files, palette or tile budgets, broken imports, sprite cutting and asset pipeline changes.

導入数
1
GitHub Stars
0
更新日
10月20日
ewrogers
コミュニティ

sgdk-best-practices

Write or review SGDK C for defined arithmetic, clear module boundaries, resource lifetimes, safe queued transfers and interrupt sharing. Use for implementation quality and project code organization, rather than toolchain setup, game design or performance profiling alone.

導入数
1
GitHub Stars
0
更新日
10月20日
ewrogers
コミュニティ

sgdk-cartridge

Plan and implement large SGDK cartridges with Sega/SSF bank switching, FAR resources, pinned shared code and audio, and safe SRAM access. Use when a ROM exceeds the linear address window, stage assets live in separate banks, a FAR pointer becomes invalid, or saving interferes with banked content.

導入数
1
GitHub Stars
0
更新日
10月20日
ewrogers
コミュニティ

sgdk-compression

Choose and validate SGDK asset compression, measure ROM/CPU/RAM trade-offs, and schedule decoding for loading or preloading. Use for packed graphics or data, not general archive formats or replacing SGDK's renderer.

導入数
1
GitHub Stars
0
更新日
10月20日