Ryan Zhang

_


Full-Stack Developer with a passion for software and hardware

Projects


Click on my projects to see what I learnt during development!


Visit my Github for codebases & technical documentation

ProcessingCiv


Overview

A simplified, in-progress, solo-developed port of Civilization 5 written fully in Processing Java, built as a playground for experiments with LLM-based CPU AIs.


What I learnt

This is the largest-scale project I worked on, with 5k+ lines written, and a wide scope ranging from terrain generation to local multiplayer.
The development process has taken ~2 months to reach ~70% completion of my project brief, created at the start.
Taught me: Performance optimization, improved my debugging skills, and made my coding practices more maintainable.

Gifs showing some examples of in-game controls

Hardest Challenges During Development


Map Generation - Creating a realistic distribution of biomes and river generation

Using perlin noise for humidity, altitude and temperature noise maps, and adapting tree growth algorithms for pruning/merging rivers.


Local Multiplayer - Which game states to pass?

Use delta compression, game states that affect other players immediately (e.g. coming within range/attacking enemy unit) are transmitted to the player via host. Discrepancies are resolved each turn by host, residual data distributed.


Optimization - Rendering large maps is laggy...

Compatibilizing program with the P2D OpenGL renderer to utilize GPU hardware acceleration, implementing culling and level-of-depth for rendering, and quadtrees for clicking.

A demo video showing a fight between three civs

The LLM CPU


Overview

An LLM fed game states that performs analysis and considers real-world cases, outputting next-move decisions and long-term game plans. Inspired by the paper Richelieu: Self-Evolving LLM-Based Agents for AI Diplomacy.


Architecture

  1. Generic, important game states are translated into strictly-formatted text. An LLM agent tells us whether the current long-term plan is worth deviating or modifying based on updates to the previously-considered game state.
  2. An LLM agent ranks the importance of game systems (e.g. 1. Military Development, 2. Science Production)
  3. A set of high-level, prioritised instructions are made, e.g. "1. Continue invasion of X, 2. Research towards science-producing buildings". These are recorded for consideration in future turns.
  4. An LLM agent exists for each game system, with access to more specific game states for its focus area. These translate high-level instructions to low level, strictly formatted instructions. An LLM agent is used to assign tasks, based on priority and sequencing.
  5. In hardcode, low-level instructions are checked for conflicts, and parsed and executed by the game.



ryan-zhang.com


Overview

A portfolio website showing off my projects.


What I learnt

This project took 5 days to make, refreshed my knowledge on SVG animation, CSS and Cloudflare web hosting.
Experimented with a minimalist-theme for the website, allowing more focus to be placed on the projects.
What I found most difficult: Words drifting off the avatar, color coordination, web responsiveness between desktop/laptop