gameplay-mechanics

pluginagentmarketplace/custom-plugin-game-developer · updated Apr 8, 2026

$npx skills add https://github.com/pluginagentmarketplace/custom-plugin-game-developer --skill gameplay-mechanics
0 commentsdiscussion
summary

Use this skill: When implementing core mechanics, balancing systems, or designing player feedback.

skill.md

Gameplay Mechanics Implementation

Core Mechanics Framework

┌─────────────────────────────────────────────────────────────┐
│                    ACTION → EFFECT LOOP                      │
├─────────────────────────────────────────────────────────────┤
│  INPUT          PROCESS          OUTPUT          FEEDBACK   │
│  ┌─────┐       ┌─────────┐      ┌─────────┐    ┌─────────┐ │
│  │Press│──────→│Validate │─────→│Update   │───→│Visual   │ │
│  │Button│      │& Execute│      │State    │    │Audio    │ │
│  └─────┘       └─────────┘      └─────────┘    │Haptic   │ │
│                                                 └─────────┘ │
│                                                              │
│  TIMING REQUIREMENTS:                                        │
│  • Input → Response: < 100ms (feels responsive)             │
│  • Animation start: < 50ms (feels instant)                  │
│  • Audio feedback: < 20ms (in sync with action)             │
└─────────────────────────────────────────────────────────────┘

Feedback Loop Design

FEEDBACK TIMING LAYERS:
┌─────────────────────────────────────────────────────────────┐
│  IMMEDIATE (0-100ms):                                        │
│  ├─ Button press sound                                      │
│  ├─ Animation start                                         │
│  ├─ Screen shake                                            │
│  └─ Controller vibration                                    │
│                                                              │
│  SHORT-TERM (100ms-1s):                                      │
│  ├─ Damage numbers appear                                   │
│  ├─ Health bar updates                                      │
│  ├─ Enemy reaction animation                                │
│  └─ Particle effects                                        │
│                                                              │
│  LONG-TERM (1s+):                                            │
│  ├─ XP/Score increase                                       │
│  ├─ Level up notification                                   │
│  ├─ Achievement unlock                                      │
│  └─ Story progression                                       │
└─────────────────────────────────────────────────────────────┘

Combat Mechanics

// ✅ Production-Ready: Combat State Machine
public class CombatStateMachine : MonoBehaviour
{
    public enum CombatState { Idle, Attacking, Blocking, Recovering, Staggered }

    [Header("Combat Parameters")]
    [SerializeField] private float attackDamage = 10f;
    [SerializeField] private float attackRange = 2f;
    [SerializeField] private float attackCooldown = 0.5f;
    [SerializeField] private float blockDamageReduction = 0.7f;
    [SerializeField] private float staggerDuration = 0.3f;

    private CombatState _currentState = CombatState.Idle;
    private float _stateTimer;

    public event Action<CombatState> OnStateChanged;
    public event Action<float> OnDamageDealt;
    public event Action<float> OnDamageTaken;

    public bool TryAttack()
    {
        if (_currentState != CombatState.Idle) return false;

        TransitionTo(CombatState.Attacking);
        StartCoroutine(AttackSequence());
        return true;
    }

    private IEnumerator AttackSequence()
    {
        // Wind-up phase
        yield return new WaitForSeconds(0.1f);

        // Active hit frame
        var hits = Physics.OverlapSphere(transform.position + transform.forward, attackRange);
        foreach (var hit in hits)
        {
            if (hit.TryGetComponent<IDamageable>(out var target))
            {
                target.TakeDamage(attackDamage);
                OnDamageDealt?.Invoke(attackDamage);
            }
        }

        // Recovery phase
        yield return new WaitForSeconds(attackCooldown);
        TransitionTo(CombatState.Idle);
    }

    public float TakeDamage(float damage)
    {
        float finalDamage = _currentState == CombatState.Blocking
            ? damage * (1f - blockDamageReduction)
            : damage;

        OnDamageTaken?.Invoke(finalDamage);

        if (finalDamage > 5f) // Stagger threshold
        {
            TransitionTo(CombatState.Staggered);
            StartCoroutine(RecoverFromStagger());
        }

        return finalDamage;
    }

    private void TransitionTo(CombatState newState)
    {
        _currentState = newState;
        _stateTimer = 0f;
        OnStateChanged?.Invoke(newState);
    }
}

Resource Economy System

ECONOMY BALANCE FORMULA:
┌─────────────────────────────────────────────────────────────┐
│  INCOME vs EXPENDITURE:                                      │
│                                                              │
│  Hourly Income = (Enemies/hr × Gold/Enemy) + PassiveIncome  │
│  Hourly Spend  = (Upgrades + Consumables + Deaths)          │
│                                                              │
│  BALANCE RATIO:                                              │
│  • < 0.8: Too scarce (frustrating)                          │
│  • 0.8-1.2: Balanced (meaningful choices)                   │
│  • > 1.2: Too abundant (no tension)                         │
│                                                              │
│  EXAMPLE STAMINA SYSTEM:                                     │
│  ┌───────────────────────────────────────────────────────┐  │
│  │  Max: 100  │  Regen: 20/sec  │  On Hit: +10           │  │
│  ├───────────────────────────────────────────────────────┤  │
│  │  Light Attack: -10  │  Heavy Attack: -25              │  │
│  │  Dodge: -15         │  Block: -5/hit                  │  │
│  │  Sprint: -5/sec     │  Jump: -8                       │  │
│  └───────────────────────────────────────────────────────┘  │
└─────────────────────────────────────────────────────────────┘

Progression Systems

PROGRESSION CURVE:
┌─────────────────────────────────────────────────────────────┐
│  Power                                                       │
│    ↑                                                         │
│    │                                    ╱───── Late Game     │
│    │                              ╱────╱       (slow, goals) │
│    │                        ╱────╱                           │
│    │                  ╱────╱                                 │
│    │            ╱────╱       Mid Game                        │
│    │      ╱────╱             (steady progress)               │
│    │ ╱───╱                                                   │
│    │╱ Early Game (fast, hook player)                        │
│    └────────────────────────────────────────────────→ Time   │
│                                                              │
│  XP CURVE FORMULA:                                           │
│  XP_needed(level) = base_xp × (level ^ growth_rate)         │
│  • growth_rate 1.5: Gentle curve (casual)                   │
│  • growth_rate 2.0: Standard curve (balanced)               │
│  • growth_rate 2.5: Steep curve (hardcore)                  │
└─────────────────────────────────────────────────────────────┘
// ✅ Production-Ready: Progression Manager
public class ProgressionManager : MonoBehaviour
{
    [Header("Progression Config")]
    [SerializeField] 

Discussion

Product Hunt–style comments (not star reviews)
  • No comments yet — start the thread.
general reviews

Ratings

4.628 reviews
  • Kaira Gill· Dec 28, 2024

    gameplay-mechanics fits our agent workflows well — practical, well scoped, and easy to wire into existing repos.

  • Isabella Chen· Nov 19, 2024

    We added gameplay-mechanics from the explainx registry; install was straightforward and the SKILL.md answered most questions upfront.

  • Chinedu White· Oct 10, 2024

    Solid pick for teams standardizing on skills: gameplay-mechanics is focused, and the summary matches what you get after install.

  • Kofi Sethi· Sep 17, 2024

    gameplay-mechanics is among the better-maintained entries we tried; worth keeping pinned for repeat workflows.

  • Neel Ramirez· Sep 13, 2024

    Useful defaults in gameplay-mechanics — fewer surprises than typical one-off scripts, and it plays nicely with `npx skills` flows.

  • Rahul Santra· Sep 9, 2024

    Solid pick for teams standardizing on skills: gameplay-mechanics is focused, and the summary matches what you get after install.

  • Pratham Ware· Aug 28, 2024

    We added gameplay-mechanics from the explainx registry; install was straightforward and the SKILL.md answered most questions upfront.

  • Kofi Taylor· Aug 8, 2024

    Useful defaults in gameplay-mechanics — fewer surprises than typical one-off scripts, and it plays nicely with `npx skills` flows.

  • Diya Ghosh· Aug 4, 2024

    gameplay-mechanics is among the better-maintained entries we tried; worth keeping pinned for repeat workflows.

  • Isabella Shah· Jul 27, 2024

    I recommend gameplay-mechanics for anyone iterating fast on agent tooling; clear intent and a small, reviewable surface area.

showing 1-10 of 28

1 / 3