惯性聚合 高效追踪和阅读你感兴趣的博客、新闻、科技资讯
阅读原文 在惯性聚合中打开

推荐订阅源

D
DataBreaches.Net
小众软件
小众软件
腾讯CDC
Jina AI
Jina AI
钛媒体:引领未来商业与生活新知
钛媒体:引领未来商业与生活新知
The Cloudflare Blog
博客园 - 三生石上(FineUI控件)
V
Visual Studio Blog
Y
Y Combinator Blog
Engineering at Meta
Engineering at Meta
美团技术团队
U
Unit 42
Cyber Security Advisories - MS-ISAC
Cyber Security Advisories - MS-ISAC
WordPress大学
WordPress大学
N
Netflix TechBlog - Medium
Microsoft Security Blog
Microsoft Security Blog
L
LangChain Blog
罗磊的独立博客
aimingoo的专栏
aimingoo的专栏
让小产品的独立变现更简单 - ezindie.com
让小产品的独立变现更简单 - ezindie.com
G
Google Developers Blog
C
Check Point Blog
大猫的无限游戏
大猫的无限游戏
Recent Announcements
Recent Announcements

Yi's Blog

Solving Jane Street's 'Dropped a Neural Net' Puzzle HRM Explained: A 27M Parameter Model That Reasons Without Chain-of-Thought BrushNet & BrushEdit Explained: From Inpainting Architecture to Intelligent Editing U-Net Explained: A Visual Guide for Beginners Building an Image Captioning Transformer from Scratch Building a Language Transformer Step by Step Reverse Engineering Guitar Pro 8's Locked Files Breaking Up with Evernote: Building a Custom Migration Tool for Apple Notes 《世上为什么要有图书馆》读书笔记 - Yi's Blog 《纳瓦尔宝典》推荐阅读 - Yi's Blog 与冰山交谈 - Yi's Blog Claude Code Complexity: Safety, Safety, Safety 微信读书:LLM 自动化问答 PK - Yi's Blog Working on Moonshot Projects - Yi's Blog Vibe Coding - Baby Sleep Tracker 独立思考的人 - Yi's Blog Magic Moment - Yi's Blog 《思辨力35讲:像辩手一样思考》读书笔记 - Yi's Blog Daily Watched YouTube Videos - Yi's Blog
Vibe Coding - Extracting Pet Sprites from Cross Gate
Yi · 2026-01-17 · via Yi's Blog
  • The Challenge
  • The Solution
  • The Frontend
  • Lessons Learned
  • References
  • What’s Next

Cross Gate Pet Viewer

Cross Gate (魔力宝贝) was one of the most influential MMORPGs in Taiwan and China during the early 2000s. As someone who spent countless hours collecting pets in this game during my childhood, I recently embarked on a nostalgia-driven project: extracting all the pet sprites from the game files and building a modern web viewer to browse them.

The Challenge

Game resources from the early 2000s are notoriously difficult to work with. Cross Gate uses proprietary binary formats for its graphics and animation data:

  • GraphicInfo_*.bin (40 bytes per entry) - Metadata for each graphic including dimensions, offsets, and addresses
  • Graphic_*.bin - RLE-compressed 8-bit indexed images with transparency
  • AnimeInfo_*.bin (12 bytes per entry) - Animation metadata linking pet IDs to frame sequences
  • Anime_*.bin - Animation frame data with actions and directions
  • Palette files (.cgp) - 224-color palettes mapping indices 16-239

The compression format is a custom RLE implementation with multiple encoding modes (literal, repeat, transparent) and variable-length counters.

The Solution

Using AI-assisted development (Claude Code and Antigravity), I built a Python extraction pipeline:

  1. Parse the binary formats - Read the structured binary files, extracting metadata and addresses
  2. Decompress RLE graphics - Implement the full RLE decompression algorithm with all encoding modes
  3. Apply palettes - Map 8-bit indexed pixels to RGB colors using the game’s palette files
  4. Generate animated GIFs - Combine frames into animated GIFs for each pet’s actions and directions

Each pet has up to 10 actions (Idle, Walk, Attack, Defend, Cast, etc.) and 8 directions, resulting in potentially 80 GIF animations per pet.

The Frontend

I built a Next.js web application to browse the extracted pets:

  • Grid view displaying all available pets
  • Detail view with interactive controls for actions and directions
  • Drag-to-rotate functionality for intuitive direction changes
  • Pixel-perfect rendering with image-rendering: pixelated to preserve the retro aesthetic

Lessons Learned

  1. Binary format reverse engineering is time-consuming - Even with AI assistance, understanding undocumented binary formats requires careful experimentation and validation
  2. Progress persistence is essential - With 1000+ pets to process, the batch generator needed to skip already-processed pets and handle timeouts gracefully
  3. Test with edge cases early - Some pets had unusual frame counts or missing animations that caused the initial implementation to fail

References

This project was made possible by the cgg-viewer project, which provided the foundational understanding of Cross Gate’s binary file formats and RLE decompression algorithm. The original Python implementation by the cgg-viewer author was invaluable for understanding how to correctly parse GraphicInfo, AnimeInfo, and palette files.

What’s Next

You can try it out at https://1203906e.cross-gate-pets.pages.dev/.