关于 game-developer
面向 Unity 和 Unreal 开发者的游戏开发技能,涵盖架构设计、实现、性能分析与测试,并提供性能检查点和专题参考文件。
主要功能
- 01Unity 与 Unreal 开发指导
- 02ECS 与游戏架构模式
- 03性能分析与优化
- 04多人网络开发指导
- 05跨平台与压力测试
适用场景
- 01规划新游戏的架构
- 02优化 CPU、GPU、内存或帧时间
- 03实现多人游戏功能
安装
复制下面的命令,在终端中运行。
$
npx skills add https:/ / github.com/ jeffallan/ claude-skills --skill game-developer安装后在 Claude Code 中输入/game-developer确认已加载。
包含的文件
除 SKILL.md 外,安装时一起下载的参考资料和脚本。
references/ecs-patterns.mdmultiplayer-networking.mdperformance-optimization.mdunity-patterns.mdunreal-cpp.md详细介绍
游戏开发者
核心工作流
- 分析需求 — 明确游戏类型、平台、性能目标和多人游戏需求
- 设计架构 — 规划 ECS/组件系统,并针对目标平台进行优化
- 实现 — 构建核心机制、图形、物理、AI 和网络功能
- 优化 — 分析性能并优化至 60+ FPS,尽量降低内存和电池消耗
- ✅ 验证检查点: 运行 Unity Profiler 或 Unreal Insights;确认帧时间 ≤16 ms(60 FPS)后再继续。逐步识别并解决 CPU/GPU 瓶颈。
- 测试 — 进行跨平台测试、性能验证和多人游戏压力测试
- ✅ 验证检查点: 确认压力负载下帧率稳定;发布前运行多人游戏延迟/不同步测试。
参考指南
根据上下文加载详细指南:
| 主题 | 参考资料 | 加载时机 |
|---|---|---|
| Unity 开发 | references/unity-patterns.md | Unity C#、MonoBehaviour、Scriptable Objects |
| Unreal 开发 | references/unreal-cpp.md | Unreal C++、Blueprints、Actor 组件 |
| ECS 与模式 | references/ecs-patterns.md | Entity Component System、游戏模式 |
| 性能 | references/performance-optimization.md | FPS 优化、性能分析、内存 |
| 网络 | references/multiplayer-networking.md | 多人游戏、客户端-服务端、延迟补偿 |
约束
必须执行
- 在所有平台上达到 60+ FPS
- 对频繁实例化的对象使用对象池
- 实现 LOD 系统以优化性能
- 定期分析性能(CPU、GPU、内存)
- 对资源使用异步加载
- 为游戏逻辑实现恰当的状态机
- 缓存组件引用(避免在 Update 中调用 GetComponent)
- 使用 delta time 实现与帧率无关的移动
不得执行
- 在紧密循环或 Update() 中调用 Instantiate/Destroy
- 跳过性能分析和性能测试
- 使用字符串比较标签(应使用 CompareTag)
- 在 Update/FixedUpdate 循环中分配内存
- 忽视平台特定的限制(移动设备、主机)
- 在 Update 循环中使用 Find 方法
- 将游戏数值硬编码(应使用 ScriptableObjects/数据文件)
输出模板
实现游戏功能时,请提供:
- 核心系统实现(ECS 组件、MonoBehaviour 或 Actor)
- 相关数据结构(ScriptableObjects、struct、配置)
- 性能注意事项和优化措施
- 对架构决策的简要说明
关键代码模式
对象池(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