mcpField
G
game-developer

game-developer

github.com/jeffallan开发12.1k6.5k 次安装今天更新
代码仓库

关于 game-developer

面向 Unity 和 Unreal 开发者的游戏开发技能,涵盖架构设计、实现、性能分析与测试,并提供性能检查点和专题参考文件。

主要功能

  1. 01Unity 与 Unreal 开发指导
  2. 02ECS 与游戏架构模式
  3. 03性能分析与优化
  4. 04多人网络开发指导
  5. 05跨平台与压力测试

适用场景

  1. 01规划新游戏的架构
  2. 02优化 CPU、GPU、内存或帧时间
  3. 03实现多人游戏功能

安装

复制下面的命令,在终端中运行。

$npx skills add https://github.com/jeffallan/claude-skills --skill game-developer

安装后在 Claude Code 中输入/game-developer确认已加载。

包含的文件

除 SKILL.md 外,安装时一起下载的参考资料和脚本。

references/
ecs-patterns.md
multiplayer-networking.md
performance-optimization.md
unity-patterns.md
unreal-cpp.md

详细介绍

游戏开发者

核心工作流

  1. 分析需求 — 明确游戏类型、平台、性能目标和多人游戏需求
  2. 设计架构 — 规划 ECS/组件系统,并针对目标平台进行优化
  3. 实现 — 构建核心机制、图形、物理、AI 和网络功能
  4. 优化 — 分析性能并优化至 60+ FPS,尽量降低内存和电池消耗
    • ✅ 验证检查点: 运行 Unity Profiler 或 Unreal Insights;确认帧时间 ≤16 ms(60 FPS)后再继续。逐步识别并解决 CPU/GPU 瓶颈。
  5. 测试 — 进行跨平台测试、性能验证和多人游戏压力测试
    • ✅ 验证检查点: 确认压力负载下帧率稳定;发布前运行多人游戏延迟/不同步测试。

参考指南

根据上下文加载详细指南:

主题参考资料加载时机
Unity 开发references/unity-patterns.mdUnity C#、MonoBehaviour、Scriptable Objects
Unreal 开发references/unreal-cpp.mdUnreal C++、Blueprints、Actor 组件
ECS 与模式references/ecs-patterns.mdEntity Component System、游戏模式
性能references/performance-optimization.mdFPS 优化、性能分析、内存
网络references/multiplayer-networking.md多人游戏、客户端-服务端、延迟补偿

约束

必须执行
  • 在所有平台上达到 60+ FPS
  • 对频繁实例化的对象使用对象池
  • 实现 LOD 系统以优化性能
  • 定期分析性能(CPU、GPU、内存)
  • 对资源使用异步加载
  • 为游戏逻辑实现恰当的状态机
  • 缓存组件引用(避免在 Update 中调用 GetComponent)
  • 使用 delta time 实现与帧率无关的移动
不得执行
  • 在紧密循环或 Update() 中调用 Instantiate/Destroy
  • 跳过性能分析和性能测试
  • 使用字符串比较标签(应使用 CompareTag)
  • 在 Update/FixedUpdate 循环中分配内存
  • 忽视平台特定的限制(移动设备、主机)
  • 在 Update 循环中使用 Find 方法
  • 将游戏数值硬编码(应使用 ScriptableObjects/数据文件)

输出模板

实现游戏功能时,请提供:

  1. 核心系统实现(ECS 组件、MonoBehaviour 或 Actor)
  2. 相关数据结构(ScriptableObjects、struct、配置)
  3. 性能注意事项和优化措施
  4. 对架构决策的简要说明

关键代码模式

对象池(Unity C#)
public class ObjectPool<T> where T : Component
{
    private readonly Queue<T> _pool = new();
    private readonly T _prefab;
    private readonly Transform _parent;

    public ObjectPool(T prefab, int initialSize, Transform parent = null)
    {
        _prefab = prefab;
        _parent = parent;
        for (int i = 0; i < initialSize; i++)
            Release(Create());
    }

    public T Get()
    {
        T obj = _pool.Count > 0 ? _pool.Dequeue() : Create();
        obj.gameObject.SetActive(true);
        return obj;
    }

    public void Release(T obj)
    {
        obj.gameObject.SetActive(false);
        _pool.Enqueue(obj);
    }

    private T Create() => Object.Instantiate(_prefab, _parent);
}
组件缓存(Unity C#)
public class PlayerController : MonoBehaviour
{
    // Cache all component references in Awake — never call GetComponent in Update
    private Rigidbody _rb;
    private Animator _animator;
    private PlayerInput _input;

    private void Awake()
    {
        _rb = GetComponent<Rigidbody>();
        _animator = GetComponent<Animator>();
        _input = GetComponent<PlayerInput>();
    }

    private void FixedUpdate()
    {
        // Use cached references; use deltaTime for frame-independence
        Vector3 move = _input.MoveDirection * (speed * Time.fixedDeltaTime);
        _rb.MovePosition(_rb.position + move);
    }
}
状态机(Unity C#)
public abstract class State
{
    public abstract void Enter();
    public abstract void Tick(float deltaTime);
    public abstract void Exit();
}

public class StateMachine
{
    private State _current;

    public void TransitionTo(State next)
    {
        _current?.Exit();
        _current = next;
        _current.Enter();
    }

    public void Tick(float deltaTime) => _current?.Tick(deltaTime);
}

// Usage example
public class IdleState : State
{
    private readonly Animator _animator;
    public IdleState(Animator animator) => _animator = animator;
    public override void Enter() => _animator.SetTrigger("Idle");
    public override void Tick(float deltaTime) { /* poll transitions */ }
    public override void Exit() { }
}

由 @jeffallan 维护,他是 Synergetic Solutions 的首席顾问

文档

评论

支持 Markdown