<?xml version="1.0" encoding="utf-8" standalone="yes"?><rss version="2.0" xmlns:atom="http://www.w3.org/2005/Atom"><channel><title>博客 on Chen Shungen</title><link>https://chenshungen.cn/blog/</link><description>Recent content in 博客 on Chen Shungen</description><generator>Hugo</generator><language>zh-cn</language><lastBuildDate>Sun, 19 Apr 2026 00:00:00 +0000</lastBuildDate><atom:link href="https://chenshungen.cn/blog/index.xml" rel="self" type="application/rss+xml"/><item><title>游戏服务器开发实战笔记</title><link>https://chenshungen.cn/blog/game-server-erta/</link><pubDate>Sun, 19 Apr 2026 00:00:00 +0000</pubDate><guid>https://chenshungen.cn/blog/game-server-erta/</guid><description>&lt;p>这篇文章整合了我在游戏服务器开发过程中积累的几个核心主题的实践经验，时间跨度从 2018 到 2022 年。内容涵盖 3D 寻路、唯一 ID 生成、Go Plugin 热更新、通信安全加密，以及 Go 性能优化技巧。&lt;/p>
&lt;hr>
&lt;h2 id="一3d-寻路recastnavigation-在游戏服务器中的应用">一、3D 寻路：RecastNavigation 在游戏服务器中的应用&lt;/h2>
&lt;blockquote>
&lt;p>最初发表于 2018 年，记录了将 RecastNavigation 应用于游戏服务器的完整过程。&lt;/p>&lt;/blockquote>
&lt;h3 id="背景">背景&lt;/h3>
&lt;p>&lt;a href="https://github.com/recastnavigation/recastnavigation">RecastNavigation&lt;/a> 是一个开源的 Navigation-mesh Toolset for Games，核心功能包括 3D 寻路、控制 Agent 行走/移动、动态添加阻挡、动态改变地形。&lt;/p>
&lt;p>值得一提的是，RecastNavigation 其实就是 Unity3D 引擎自带的 Navigation 寻路模块的前身——这一点我曾在 Google Group 里和作者 memononen 确认过。&lt;/p>
&lt;h3 id="为什么要在服务器上做寻路">为什么要在服务器上做寻路&lt;/h3>
&lt;p>客户端做寻路很容易，现代游戏引擎都内置了这些工具。但在服务器上实现 3D 寻路，对于 AI 控制、反外挂验证等场景至关重要。RecastNavigation 用 C++ 实现，可以很方便地嵌入到 C++、Go、Python 等语言的服务器程序中。&lt;/p>
&lt;h3 id="从-unity-导出地图">从 Unity 导出地图&lt;/h3>
&lt;p>以 Unity 为客户端为例，有两种方式导出地图供 RecastNavigation 使用：&lt;/p>
&lt;p>&lt;strong>方式一：导出 Unity 已 bake 好的 NavMesh&lt;/strong>&lt;/p>
&lt;p>使用导出脚本将 Unity 中生成好的 NavMesh 导出为 obj 文件，然后放入 RecastNavigation 生成寻路网格。这种方式最直接，导出的 NavMesh 与 Unity 中一致。&lt;/p></description></item><item><title>我的开发者收藏夹：那些年攒下的技术链接</title><link>https://chenshungen.cn/blog/dev-bookmarks/</link><pubDate>Sat, 18 Apr 2026 00:00:00 +0000</pubDate><guid>https://chenshungen.cn/blog/dev-bookmarks/</guid><description>&lt;p>从 WordPress 迁移到 Hugo 的过程中，翻到了旧站上的「记事本」页面——一个从 2017 年就开始积攒的链接收藏夹。这些链接记录了我在不同阶段关注的技术方向，与其让它们躺在旧站里吃灰，不如整理出来，也算是一份个人技术成长的缩影。&lt;/p>
&lt;blockquote>
&lt;p>注意：部分链接年代久远，可能已经失效。&lt;/p>&lt;/blockquote>
&lt;h2 id="博客推荐">博客推荐&lt;/h2>
&lt;ul>
&lt;li>&lt;a href="https://colobu.com/">鸟窝博客&lt;/a> — Go 语言领域非常活跃的中文博主&lt;/li>
&lt;li>&lt;a href="https://blog.codingnow.com/">云风的博客&lt;/a> — 游戏开发圈的前辈，写了二十多年博客&lt;/li>
&lt;/ul>
&lt;h2 id="go-语言">Go 语言&lt;/h2>
&lt;ul>
&lt;li>&lt;a href="https://www.processon.com/view/link/5a9ba4c8e4b0a9d22eb3bdf0">Go 知识图谱&lt;/a> — 一张思维导图串起 Go 的核心知识点&lt;/li>
&lt;li>&lt;a href="https://go101.org/article/101.html">Go101&lt;/a> — 系统性地深入 Go 语言细节&lt;/li>
&lt;li>&lt;a href="https://go101.org/article/concurrent-common-mistakes.html">Go 并发常见错误&lt;/a> — 并发编程踩坑指南&lt;/li>
&lt;li>&lt;a href="https://bravenewgeek.com/so-you-wanna-go-fast/">So You Wanna Go Fast?&lt;/a> — Go 性能优化实战&lt;/li>
&lt;li>&lt;a href="https://github.com/gansidui/skiplist/blob/master/skiplist.go">Go SkipList 实现&lt;/a> — 跳表的 Go 实现参考&lt;/li>
&lt;li>&lt;a href="http://daizuozhuo.github.io/golang-rpc-practice/">go 标准库 rpc 实践&lt;/a> — net/rpc 使用指南&lt;/li>
&lt;li>&lt;a href="https://www.jianshu.com/p/cffe039fa060">Go-Kit&lt;/a> — Go 微服务框架入门&lt;/li>
&lt;li>&lt;a href="https://groups.google.com/g/golang-nuts/c/3FVAs9dPR8k/m/Jk9T3s7oIPEJ">map for readonly access will always remain thread-safe?&lt;/a> — golang-nuts 上关于 map 并发安全的经典讨论&lt;/li>
&lt;/ul>
&lt;h2 id="算法与数据结构">算法与数据结构&lt;/h2>
&lt;ul>
&lt;li>&lt;a href="https://www.geeksforgeeks.org/top-algorithms-and-data-structures-for-competitive-programming/#algo1">经典算法&lt;/a> — GeeksforGeeks 竞赛编程算法合集&lt;/li>
&lt;li>&lt;a href="https://zhuanlan.zhihu.com/p/68409952">动态规划：最长公共子序列 + 最长公共子字符串&lt;/a> — DP 经典题目详解&lt;/li>
&lt;li>&lt;a href="https://blog.csdn.net/legend050709/article/details/114917637">限流之固定窗口/滑动窗口计数法&lt;/a> — 限流算法原理&lt;/li>
&lt;/ul>
&lt;h2 id="推荐书籍">推荐书籍&lt;/h2>
&lt;ul>
&lt;li>&lt;a href="https://book.douban.com/subject/30329536/">《数据密集型应用系统设计》(DERTA)&lt;/a> — 分布式系统必读&lt;/li>
&lt;li>&lt;strong>《人月神话》&lt;/strong> — 软件工程经典，几十年过去了还是那么准&lt;/li>
&lt;/ul>
&lt;h2 id="kubernetes">Kubernetes&lt;/h2>
&lt;ul>
&lt;li>&lt;a href="https://blog.csdn.net/CHENYUFENG1991/article/details/79118446">单机 k8s 安装&lt;/a>&lt;/li>
&lt;li>&lt;a href="https://www.cnblogs.com/zhenyuyaodidiao/p/6500830.html">k8s 集群部署 (CentOS 7)&lt;/a>&lt;/li>
&lt;li>&lt;a href="http://blog.51cto.com/jonauil/2086931">k8s Dashboard 部署 (一)&lt;/a>&lt;/li>
&lt;li>&lt;a href="https://blog.csdn.net/wh0426/article/details/54406555">k8s Dashboard 部署 (二)&lt;/a>&lt;/li>
&lt;/ul>
&lt;h2 id="c--c">C / C++&lt;/h2>
&lt;ul>
&lt;li>&lt;a href="https://github.com/AnthonyCalandra/modern-cpp-features">Modern C++ Features (C++11/14/17)&lt;/a> — 新标准特性速查&lt;/li>
&lt;li>&lt;a href="https://gcc.gnu.org/projects/cxx-status.html">C++ Standards Support in GCC&lt;/a> — GCC 各版本对 C++ 标准的支持情况&lt;/li>
&lt;li>&lt;a href="http://www.cplusplus-soup.com/2010/01/freedelete-not-returning-memory-to-os.html">Free/Delete Not Returning Memory To OS?&lt;/a> — 内存释放后为什么系统看不到？&lt;/li>
&lt;li>&lt;a href="https://blog.joefom.com/archives/207">cc1.exe: sorry, unimplemented: 64-bit mode not compiled in&lt;/a> — MinGW 64 位编译报错解决&lt;/li>
&lt;/ul>
&lt;h2 id="数据库">数据库&lt;/h2>
&lt;ul>
&lt;li>&lt;a href="http://bbs.redis.cn/forum.php?mod=viewthread&amp;amp;tid=728">Redis 应用分享&lt;/a>&lt;/li>
&lt;li>&lt;a href="https://mongoing.com/archives/4368">MongoDB 分片集群 Chunk 分裂与迁移&lt;/a>&lt;/li>
&lt;/ul>
&lt;h2 id="工具与编辑器">工具与编辑器&lt;/h2>
&lt;ul>
&lt;li>&lt;a href="https://regex101.com/r/zV2fO7/1">regex101&lt;/a> — 在线正则表达式测试，调正则必备&lt;/li>
&lt;li>&lt;a href="https://marketplace.visualstudio.com/items?itemName=vscodevim.vim">VSCode Vim 模式插件&lt;/a>&lt;/li>
&lt;li>&lt;a href="https://stackoverflow.com/questions/17440659/capitalize-first-letter-of-each-word-in-a-selection-using-vim">Vim: Capitalize first letter of each word&lt;/a> — Vim 批量首字母大写技巧&lt;/li>
&lt;li>&lt;a href="https://templates.office.com/en-us/Resumes-and-Cover-Letters">简历模板&lt;/a> — Office 官方简历模板&lt;/li>
&lt;/ul>
&lt;h2 id="linux--运维">Linux / 运维&lt;/h2>
&lt;ul>
&lt;li>&lt;a href="http://www.ocpsoft.org/tutorials/git/use-reflog-and-cherry-pick-to-restore-lost-commits/">git rebase 丢失 commit 找回&lt;/a> — reflog + cherry-pick 救命指南&lt;/li>
&lt;li>&lt;a href="https://love61v.github.io/2017/07/12/awk%E7%BB%9F%E8%AE%A1%E6%8E%92%E5%90%8D%E5%8D%95%E8%AF%8D%E5%87%BA%E7%8E%B0%E6%AC%A1%E6%95%B0/">linux awk 命令统计排名单词出现次数&lt;/a>&lt;/li>
&lt;li>&lt;a href="https://www.cnblogs.com/lsdb/p/12010128.html">Linux 脚本只允许单实例运行&lt;/a>&lt;/li>
&lt;/ul>
&lt;h2 id="python">Python&lt;/h2>
&lt;ul>
&lt;li>&lt;a href="https://www.devdungeon.com/content/working-binary-data-python">Working with Binary Data in Python&lt;/a>&lt;/li>
&lt;/ul></description></item><item><title>用 AI 重构我的个人网站：从 WordPress 到 Hugo</title><link>https://chenshungen.cn/blog/ai-native-website/</link><pubDate>Thu, 16 Apr 2026 00:00:00 +0000</pubDate><guid>https://chenshungen.cn/blog/ai-native-website/</guid><description>&lt;h2 id="为什么要告别-wordpress">为什么要告别 WordPress？&lt;/h2>
&lt;p>WordPress 是一个优秀的内容管理系统，但对于一个想要通过 AI 工具（如 Claude Code）来管理内容的开发者来说，它有几个痛点：&lt;/p>
&lt;ol>
&lt;li>&lt;strong>内容存储在数据库中&lt;/strong>，AI 工具无法直接读写&lt;/li>
&lt;li>&lt;strong>PHP + MySQL 的技术栈&lt;/strong>维护成本高&lt;/li>
&lt;li>&lt;strong>安全更新&lt;/strong>需要频繁关注&lt;/li>
&lt;li>&lt;strong>动态渲染&lt;/strong>相比静态站点速度慢&lt;/li>
&lt;/ol>
&lt;h2 id="新方案hugo--adritian">新方案：Hugo + Adritian&lt;/h2>
&lt;p>最终选择了 Hugo 作为静态站点生成器，配合 Adritian 主题：&lt;/p>
&lt;ul>
&lt;li>&lt;strong>内容即文件&lt;/strong>：所有文章都是 Markdown 文件，存储在 Git 仓库中&lt;/li>
&lt;li>&lt;strong>AI 友好&lt;/strong>：Claude Code 可以直接创建和编辑 &lt;code>.md&lt;/code> 文件&lt;/li>
&lt;li>&lt;strong>零维护&lt;/strong>：纯静态 HTML，没有数据库，没有后端&lt;/li>
&lt;li>&lt;strong>极速&lt;/strong>：毫秒级页面加载&lt;/li>
&lt;/ul>
&lt;h2 id="技术栈">技术栈&lt;/h2>
&lt;table>
 &lt;thead>
 &lt;tr>
 &lt;th>组件&lt;/th>
 &lt;th>选择&lt;/th>
 &lt;th>原因&lt;/th>
 &lt;/tr>
 &lt;/thead>
 &lt;tbody>
 &lt;tr>
 &lt;td>静态生成器&lt;/td>
 &lt;td>Hugo&lt;/td>
 &lt;td>Go 构建，速度极快&lt;/td>
 &lt;/tr>
 &lt;tr>
 &lt;td>主题&lt;/td>
 &lt;td>Adritian&lt;/td>
 &lt;td>专业网站风格，非纯博客&lt;/td>
 &lt;/tr>
 &lt;tr>
 &lt;td>部署&lt;/td>
 &lt;td>阿里云 ECS&lt;/td>
 &lt;td>国内访问最快，已有备案&lt;/td>
 &lt;/tr>
 &lt;tr>
 &lt;td>CI/CD&lt;/td>
 &lt;td>GitHub Actions&lt;/td>
 &lt;td>git push 自动构建部署&lt;/td>
 &lt;/tr>
 &lt;/tbody>
&lt;/table>
&lt;h2 id="ai-内容发布流程">AI 内容发布流程&lt;/h2>
&lt;div class="highlight-wrapper">
 &lt;button class="copy-code-btn" type="button" aria-label="Copy code to clipboard">
 &lt;svg xmlns="http://www.w3.org/2000/svg" width="16" height="16" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2" stroke-linecap="round" stroke-linejoin="round" aria-hidden="true">
 &lt;rect x="9" y="9" width="13" height="13" rx="2" ry="2">&lt;/rect>
 &lt;path d="M5 15H4a2 2 0 0 1-2-2V4a2 2 0 0 1 2-2h9a2 2 0 0 1 2 2v1">&lt;/path>
 &lt;/svg>
 &lt;span class="copy-text">Copy&lt;/span>
 &lt;/button>&lt;div class="highlight">&lt;pre tabindex="0" class="chroma">&lt;code class="language-text" data-lang="text">&lt;span class="line">&lt;span class="cl">Claude Code 写 Markdown → git push → GitHub Actions 构建 → 部署到 ECS&lt;/span>&lt;/span>&lt;/code>&lt;/pre>&lt;/div>&lt;/div>
&lt;p>整个过程零人工干预，从写作到上线完全自动化。&lt;/p></description></item><item><title>Go 语言后端开发实践总结</title><link>https://chenshungen.cn/blog/golang-backend/</link><pubDate>Wed, 15 Apr 2026 00:00:00 +0000</pubDate><guid>https://chenshungen.cn/blog/golang-backend/</guid><description>&lt;h2 id="为什么选择-go">为什么选择 Go？&lt;/h2>
&lt;p>Go 语言在后端开发中的优势不言而喻：&lt;/p>
&lt;ul>
&lt;li>&lt;strong>编译速度快&lt;/strong>：秒级编译，开发体验流畅&lt;/li>
&lt;li>&lt;strong>并发原语优秀&lt;/strong>：goroutine + channel 模型简洁强大&lt;/li>
&lt;li>&lt;strong>部署简单&lt;/strong>：单二进制文件，无依赖&lt;/li>
&lt;li>&lt;strong>性能优异&lt;/strong>：接近 C 的性能，远超脚本语言&lt;/li>
&lt;/ul>
&lt;h2 id="项目结构推荐">项目结构推荐&lt;/h2>
&lt;div class="highlight-wrapper">
 &lt;button class="copy-code-btn" type="button" aria-label="Copy code to clipboard">
 &lt;svg xmlns="http://www.w3.org/2000/svg" width="16" height="16" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2" stroke-linecap="round" stroke-linejoin="round" aria-hidden="true">
 &lt;rect x="9" y="9" width="13" height="13" rx="2" ry="2">&lt;/rect>
 &lt;path d="M5 15H4a2 2 0 0 1-2-2V4a2 2 0 0 1 2-2h9a2 2 0 0 1 2 2v1">&lt;/path>
 &lt;/svg>
 &lt;span class="copy-text">Copy&lt;/span>
 &lt;/button>&lt;div class="highlight">&lt;pre tabindex="0" class="chroma">&lt;code class="language-text" data-lang="text">&lt;span class="line">&lt;span class="cl">project/
&lt;/span>&lt;/span>&lt;span class="line">&lt;span class="cl">├── cmd/ # 应用入口
&lt;/span>&lt;/span>&lt;span class="line">&lt;span class="cl">│ └── server/
&lt;/span>&lt;/span>&lt;span class="line">&lt;span class="cl">│ └── main.go
&lt;/span>&lt;/span>&lt;span class="line">&lt;span class="cl">├── internal/ # 内部包（不对外暴露）
&lt;/span>&lt;/span>&lt;span class="line">&lt;span class="cl">│ ├── handler/ # HTTP 处理器
&lt;/span>&lt;/span>&lt;span class="line">&lt;span class="cl">│ ├── service/ # 业务逻辑
&lt;/span>&lt;/span>&lt;span class="line">&lt;span class="cl">│ ├── repository/ # 数据访问
&lt;/span>&lt;/span>&lt;span class="line">&lt;span class="cl">│ └── model/ # 数据模型
&lt;/span>&lt;/span>&lt;span class="line">&lt;span class="cl">├── pkg/ # 可复用的公共包
&lt;/span>&lt;/span>&lt;span class="line">&lt;span class="cl">├── api/ # API 定义（proto/openapi）
&lt;/span>&lt;/span>&lt;span class="line">&lt;span class="cl">├── config/ # 配置文件
&lt;/span>&lt;/span>&lt;span class="line">&lt;span class="cl">└── deploy/ # 部署相关&lt;/span>&lt;/span>&lt;/code>&lt;/pre>&lt;/div>&lt;/div>
&lt;h2 id="错误处理模式">错误处理模式&lt;/h2>
&lt;p>Go 的错误处理虽然冗长，但有其设计哲学。推荐的做法：&lt;/p></description></item><item><title>分布式系统设计要点</title><link>https://chenshungen.cn/blog/distributed-systems/</link><pubDate>Tue, 14 Apr 2026 00:00:00 +0000</pubDate><guid>https://chenshungen.cn/blog/distributed-systems/</guid><description>&lt;h2 id="分布式系统的核心挑战">分布式系统的核心挑战&lt;/h2>
&lt;p>分布式系统面临的根本挑战可以用 CAP 定理来概括——一致性（Consistency）、可用性（Availability）、分区容错性（Partition Tolerance）三者不可兼得。&lt;/p>
&lt;p>在实际工程中，我们几乎总是需要保证分区容错性，因此核心的权衡在于：&lt;/p>
&lt;ul>
&lt;li>&lt;strong>CP 系统&lt;/strong>：优先一致性，如 ZooKeeper、etcd&lt;/li>
&lt;li>&lt;strong>AP 系统&lt;/strong>：优先可用性，如 Cassandra、DynamoDB&lt;/li>
&lt;/ul>
&lt;h2 id="服务间通信">服务间通信&lt;/h2>
&lt;p>常见的服务间通信方式：&lt;/p>
&lt;table>
 &lt;thead>
 &lt;tr>
 &lt;th>方式&lt;/th>
 &lt;th>适用场景&lt;/th>
 &lt;th>优势&lt;/th>
 &lt;th>劣势&lt;/th>
 &lt;/tr>
 &lt;/thead>
 &lt;tbody>
 &lt;tr>
 &lt;td>gRPC&lt;/td>
 &lt;td>内部服务调用&lt;/td>
 &lt;td>高性能、强类型&lt;/td>
 &lt;td>调试不如 REST 方便&lt;/td>
 &lt;/tr>
 &lt;tr>
 &lt;td>REST&lt;/td>
 &lt;td>外部 API&lt;/td>
 &lt;td>通用、易理解&lt;/td>
 &lt;td>性能较低&lt;/td>
 &lt;/tr>
 &lt;tr>
 &lt;td>消息队列&lt;/td>
 &lt;td>异步解耦&lt;/td>
 &lt;td>削峰、解耦&lt;/td>
 &lt;td>复杂度增加&lt;/td>
 &lt;/tr>
 &lt;/tbody>
&lt;/table>
&lt;h2 id="关键设计原则">关键设计原则&lt;/h2>
&lt;ol>
&lt;li>&lt;strong>幂等性&lt;/strong>：所有写操作都应该是幂等的&lt;/li>
&lt;li>&lt;strong>超时与重试&lt;/strong>：设置合理的超时，使用指数退避重试&lt;/li>
&lt;li>&lt;strong>熔断降级&lt;/strong>：防止级联故障&lt;/li>
&lt;li>&lt;strong>可观测性&lt;/strong>：日志、指标、链路追踪三者缺一不可&lt;/li>
&lt;/ol>
&lt;h2 id="总结">总结&lt;/h2>
&lt;p>分布式系统没有银弹。好的系统设计来自对业务场景的深入理解和对技术取舍的清晰认识。&lt;/p></description></item></channel></rss>