All skills
jeffallan avatar

/game-developer

@efebc44
by jeffallanjeffallan/claude-skills12k stars
1,124

Use when building game systems, implementing Unity/Unreal Engine features, or optimizing game performance. Invoke to implement ECS architecture, configure physics systems and colliders, set up multiplayer networking with lag compensation, optimize frame rates to 60+ FPS targets, develop shaders, or apply game design patterns such as object pooling and state machines. Trigger keywords: Unity, Unreal Engine, game development, ECS architecture, game physics, multiplayer networking, game optimization, shader programming, game AI.

Use this Skill: https://skilld.dev/gh/jeffallan/claude-skills/game-developer

This session only. Nothing lands on disk.

referencesecs-patterns.md

≈2.6k tokens on demand. Your agent reads this file only when SKILL.md points to it.

ECS Architecture and Game Patterns

Entity Component System (ECS)

// Component = pure data (no logic)
public struct PositionComponent
{
    public float X;
    public float Y;
    public float Z;
}

public struct VelocityComponent
{
    public float X;
    public float Y;
    public float Z;
}

public struct HealthComponent
{
    public int Current;
    public int Max;
}

public struct PlayerTag { } // Marker component

// Entity = just an ID
public struct Entity
{
    public int Id;
}

// System = logic operating on components
public class MovementSystem
{
    public void Update(float deltaTime,
        Span<PositionComponent> positions,
        Span<VelocityComponent> velocities)
    {
        for (int i = 0; i < positions.Length; i++)
        {
            positions[i].X += velocities[i].X * deltaTime;
            positions[i].Y += velocities[i].Y * deltaTime;
            positions[i].Z += velocities[i].Z * deltaTime;
        }
    }
}

// Simple ECS World
public class World
{
    private int nextEntityId = 0;
    private Dictionary<int, PositionComponent> positions = new();
    private Dictionary<int, VelocityComponent> velocities = new();
    private Dictionary<int, HealthComponent> healths = new();

    public Entity CreateEntity()
    {
        return new Entity { Id = nextEntityId++ };
    }

    public void AddComponent<T>(Entity entity, T component)
    {
        // Store component by entity ID
    }

    public T GetComponent<T>(Entity entity)
    {
        // Retrieve component for entity
        return default;
    }
}

Object Pool Pattern

public class ObjectPool<T> where T : class, new()
{
    private readonly Stack<T> pool = new();
    private readonly Func<T> createFunc;
    private readonly Action<T> resetAction;
    private readonly int maxSize;

    public ObjectPool(Func<T> createFunc, Action<T> resetAction, int initialSize = 10, int maxSize = 100)
    {
        this.createFunc = createFunc;
        this.resetAction = resetAction;
        this.maxSize = maxSize;

        // Pre-populate pool
        for (int i = 0; i < initialSize; i++)
        {
            pool.Push(createFunc());
        }
    }

    public T Get()
    {
        if (pool.Count > 0)
            return pool.Pop();

        return createFunc();
    }

    public void Return(T obj)
    {
        if (pool.Count < maxSize)
        {
            resetAction?.Invoke(obj);
            pool.Push(obj);
        }
    }
}

// Usage example
public class BulletManager
{
    private ObjectPool<Bullet> bulletPool;

    public void Initialize()
    {
        bulletPool = new ObjectPool<Bullet>(
            createFunc: () => new Bullet(),
            resetAction: (bullet) => bullet.Reset(),
            initialSize: 50,
            maxSize: 200
        );
    }

    public Bullet SpawnBullet()
    {
        Bullet bullet = bulletPool.Get();
        bullet.Activate();
        return bullet;
    }

    public void ReturnBullet(Bullet bullet)
    {
        bullet.Deactivate();
        bulletPool.Return(bullet);
    }
}

State Machine Pattern

public interface IState
{
    void Enter();
    void Update(float deltaTime);
    void Exit();
}

public class StateMachine
{
    private IState currentState;

    public void ChangeState(IState newState)
    {
        currentState?.Exit();
        currentState = newState;
        currentState?.Enter();
    }

    public void Update(float deltaTime)
    {
        currentState?.Update(deltaTime);
    }
}

// Example: Enemy AI States
public class IdleState : IState
{
    private readonly EnemyController enemy;

    public IdleState(EnemyController enemy) => this.enemy = enemy;

    public void Enter()
    {
        enemy.PlayAnimation("Idle");
    }

    public void Update(float deltaTime)
    {
        if (enemy.PlayerInRange())
            enemy.StateMachine.ChangeState(new ChaseState(enemy));
    }

    public void Exit() { }
}

public class ChaseState : IState
{
    private readonly EnemyController enemy;

    public ChaseState(EnemyController enemy) => this.enemy = enemy;

    public void Enter()
    {
        enemy.PlayAnimation("Run");
    }

    public void Update(float deltaTime)
    {
        if (!enemy.PlayerInRange())
            enemy.StateMachine.ChangeState(new IdleState(enemy));
        else if (enemy.InAttackRange())
            enemy.StateMachine.ChangeState(new AttackState(enemy));
        else
            enemy.MoveTowardsPlayer(deltaTime);
    }

    public void Exit() { }
}

Command Pattern (Input Handling)

public interface ICommand
{
    void Execute();
    void Undo();
}

public class MoveCommand : ICommand
{
    private readonly Transform transform;
    private readonly Vector3 movement;
    private Vector3 previousPosition;

    public MoveCommand(Transform transform, Vector3 movement)
    {
        this.transform = transform;
        this.movement = movement;
    }

    public void Execute()
    {
        previousPosition = transform.position;
        transform.position += movement;
    }

    public void Undo()
    {
        transform.position = previousPosition;
    }
}

public class InputHandler
{
    private Stack<ICommand> commandHistory = new();

    public void ExecuteCommand(ICommand command)
    {
        command.Execute();
        commandHistory.Push(command);
    }

    public void UndoLastCommand()
    {
        if (commandHistory.Count > 0)
        {
            ICommand command = commandHistory.Pop();
            command.Undo();
        }
    }
}

Observer Pattern (Event System)

public class GameEvent<T>
{
    private event Action<T> listeners;

    public void Subscribe(Action<T> listener)
    {
        listeners += listener;
    }

    public void Unsubscribe(Action<T> listener)
    {
        listeners -= listener;
    }

    public void Trigger(T data)
    {
        listeners?.Invoke(data);
    }
}

// Event hub
public static class GameEvents
{
    public static readonly GameEvent<int> OnScoreChanged = new();
    public static readonly GameEvent<float> OnHealthChanged = new();
    public static readonly GameEvent<string> OnGameOver = new();
}

// Subscriber
public class UIController
{
    private void OnEnable()
    {
        GameEvents.OnScoreChanged.Subscribe(UpdateScoreDisplay);
        GameEvents.OnHealthChanged.Subscribe(UpdateHealthBar);
    }

    private void OnDisable()
    {
        GameEvents.OnScoreChanged.Unsubscribe(UpdateScoreDisplay);
        GameEvents.OnHealthChanged.Unsubscribe(UpdateHealthBar);
    }

    private void UpdateScoreDisplay(int score)
    {
        // Update UI
    }

    private void UpdateHealthBar(float health)
    {
        // Update UI
    }
}

// Publisher
public class Player
{
    public void TakeDamage(float damage)
    {
        health -= damage;
        GameEvents.OnHealthChanged.Trigger(health);
    }
}

Service Locator Pattern

public static class ServiceLocator
{
    private static Dictionary<Type, object> services = new();

    public static void Register<T>(T service)
    {
        services[typeof(T)] = service;
    }

    public static T Get<T>()
    {
        if (services.TryGetValue(typeof(T), out object service))
            return (T)service;

        throw new Exception($"Service {typeof(T)} not found");
    }

    public static bool TryGet<T>(out T service)
    {
        if (services.TryGetValue(typeof(T), out object obj))
        {
            service = (T)obj;
            return true;
        }

        service = default;
        return false;
    }

    public static void Clear()
    {
        services.Clear();
    }
}

// Usage
public class GameInitializer
{
    public void Initialize()
    {
        ServiceLocator.Register<IAudioManager>(new AudioManager());
        ServiceLocator.Register<ISaveSystem>(new SaveSystem());
        ServiceLocator.Register<IInputManager>(new InputManager());
    }
}

public class Player
{
    private IAudioManager audioManager;

    public void Start()
    {
        audioManager = ServiceLocator.Get<IAudioManager>();
    }

    public void PlaySound(string soundName)
    {
        audioManager.PlaySound(soundName);
    }
}

Spatial Partitioning (Grid)

public class SpatialGrid<T>
{
    private readonly Dictionary<(int, int), List<T>> grid = new();
    private readonly float cellSize;

    public SpatialGrid(float cellSize)
    {
        this.cellSize = cellSize;
    }

    private (int, int) GetCell(Vector2 position)
    {
        int x = Mathf.FloorToInt(position.x / cellSize);
        int y = Mathf.FloorToInt(position.y / cellSize);
        return (x, y);
    }

    public void Insert(Vector2 position, T item)
    {
        var cell = GetCell(position);
        if (!grid.ContainsKey(cell))
            grid[cell] = new List<T>();

        grid[cell].Add(item);
    }

    public List<T> Query(Vector2 position, float radius)
    {
        List<T> results = new();
        int cellRadius = Mathf.CeilToInt(radius / cellSize);

        var centerCell = GetCell(position);

        for (int x = -cellRadius; x <= cellRadius; x++)
        {
            for (int y = -cellRadius; y <= cellRadius; y++)
            {
                var cell = (centerCell.Item1 + x, centerCell.Item2 + y);
                if (grid.TryGetValue(cell, out List<T> items))
                    results.AddRange(items);
            }
        }

        return results;
    }

    public void Clear()
    {
        grid.Clear();
    }
}

Double Buffer Pattern (for Rendering/Physics)

public class DoubleBuffer<T>
{
    private T[] buffers = new T[2];
    private int currentIndex = 0;

    public DoubleBuffer(T buffer1, T buffer2)
    {
        buffers[0] = buffer1;
        buffers[1] = buffer2;
    }

    public T Current => buffers[currentIndex];
    public T Next => buffers[1 - currentIndex];

    public void Swap()
    {
        currentIndex = 1 - currentIndex;
    }
}

// Usage for physics
public class PhysicsSimulation
{
    private DoubleBuffer<PhysicsState> stateBuffer;

    public void Update(float deltaTime)
    {
        // Read from current, write to next
        ComputeNextState(stateBuffer.Current, stateBuffer.Next, deltaTime);

        // Swap buffers
        stateBuffer.Swap();
    }
}

Source: SKILL.md on GitHub

1 alert16d5 checks · Risk CRITICAL
  • Gen Agent Trust Hub16d

    The skill provides reference documentation and code samples for Unity and Unreal Engine game development, covering patterns like ECS, object pooling, and multiplayer networking. No malicious patterns, prompt injections, or security vulnerabilities were found.

  • Socket16d

    No alerts

  • Snyk16d

    Risk: LOW · No issues

  • Runlayer6mo

    2/6 files flagged

  • ZeroLeaks5mo

    Score: 93/100 · 2 sections analyzed

Signed by skilld at efebc44. This ties the file your Agent reads to that commit on GitHub. It does not review the instructions.

Last checked against GitHub 2 months ago.

Steadyupdated 5 months ago
Other metadata
metadata
{
  "author": "https://github.com/Jeffallan",
  "version": "1.1.0",
  "domain": "specialized",
  "triggers": "Unity, Unreal Engine, game development, ECS architecture, game physics, multiplayer networking, game optimization, shader programming, game AI",
  "role": "specialist",
  "scope": "implementation",
  "output-format": "code",
  "related-skills": null
}
  • Performance
  • unity
  • unreal-engine
  • game-development
  • ecs
  • physics
  • multiplayer
  • networking
  • optimization
  • shader
  • game-ai

README badge

README badge for jeffallan/claude-skills/game-developer

Implements core game systems for Unity and Unreal Engine including ECS architecture, physics, multiplayer networking, and performance optimization targeting 60+ FPS. Provides patterns for object pooling, component caching, state machines, and shader development with validation checkpoints for profiling and cross-platform testing.

Generated from the current SKILL.md.

Does this skill support both Unity and Unreal Engine?
Yes. The skill includes reference guides for both Unity C# and Unreal C++/Blueprints, with platform-specific patterns and constraints for each engine.
What performance targets does this skill enforce?
The skill mandates 60+ FPS on all platforms with validation checkpoints using profilers (Unity Profiler or Unreal Insights) to confirm frame time stays at or below 16 ms.
Does this cover multiplayer networking?
Yes. The skill includes guidance on client-server architecture and lag compensation strategies via the multiplayer-networking reference guide.
What game architecture patterns does this skill teach?
The skill covers Entity Component System (ECS) architecture, state machines, object pooling, and component caching, with concrete code examples for each pattern.
Can I use this skill for mobile game optimization?
Yes. The skill explicitly addresses platform-specific constraints including mobile performance, memory usage, and battery considerations as part of the optimization workflow.

Generated from the current SKILL.md. These answers refresh after source changes.