메뉴
HN
Hacker News 53일 전

LLM, 구조화된 '스마트 센스'로 8비트 게임 플레이

IMP
4/10
핵심 요약

한 개발자가 LLM이 단순히 시각이나 오디오를 해석하는 대신, 게임 세계를 텍스트 기반으로 추상화한 '스마트 센스(Smart Senses)'를 통해 8비트 레트로 게임을 플레이하도록 구현했습니다. 이 방식은 LLM이 원시 데이터를 파싱하는 데 낭비되는 시간을 줄이고, 상태 추론과 행동 계획이라는 핵심 역량에 집중하게 만듭니다. 이 프로젝트는 대형 언어 모델이 복잡한 시각 정보 없이도 구조화된 텍스트 입력을 통해 에이전트처럼 게임 환경과 성공적으로 상호작용할 수 있음을 증명합니다.

번역된 본문

PvP-AI 게임 만들기 PvP-AI는 제가 1990년에 만들었던 8비트 게임의 재탄생작입니다. 원작의 흔적은 몇 가지 스케치와 손글씨 메모뿐입니다. 당시 8비트 플랫폼에서는 메모리와 CPU를 쥐어짜 간신히 가장 단순한 애니메이션과 배경으로 초당 4프레임을 얻어내야 했습니다. 아쉽게도 게임을 완성할 무렵 1990년 경기 후퇴가 시작되어 개인용 컴퓨터를 비롯한 많은 산업이 타격을 입었고, 결국 아무런 성과도 얻지 못했습니다.

몇 년 전 데이비드 머레이(David Murray)가 운영하는 The8BitGuy라는 유튜브 채널을 보게 되었고, 특히 그의 커맨더 X16(Commander X16) 레트로 컴퓨터에 관심이 갔습니다. 사양을 살펴보니 PvP-AI의 새로운 버전을 감당할 수 있겠다는 생각이 들었습니다. 실제로 에뮬레이터는 이 게임을 매우 잘 구동했고, 더 많은 세부 사항과 더 나은 AI를 담아 초당 거의 8.6프레임으로 실행되었습니다. 작동하는 모습은 이 영상에서 볼 수 있습니다. 하지만 실제 하드웨어에서는... VERA 모듈에 선 그리기 문제가 있어 특정 종류의 선이 올바르게 렌더링되지 않았고, 결국 더 느린 방식으로 대체해야 했습니다. 그 결과 하드웨어에서는 초당 4프레임밖에 나오지 않습니다. 직접 해보고 싶다면 제 구글 드라이브에서 파일을 다운로드할 수 있습니다. 실행할 때는 x16-emulator, 특히 R49 버전을 사용하는 것을 권장합니다. 자세한 내용은 제 GitHub EXPLORE 저장소의 CX16 v2 – AI Demo(일명 PvP-AI)에서 확인할 수 있습니다.

이 게임의 플레이 방식에는 일반적인 8비트 슈팅 게임과 차별화되는 몇 가지 특징이 있습니다.

  • 아레나 구조는 플레이어가 도달한 최고 레벨에 따라 변합니다.
  • 미사일은 제한된 지능을 가지고 있으며 벽 주변이나 위를 탐색할 수 있습니다.
  • 한 플레이어가 다른 플레이어의 체력을 0으로 만들면 두 플레이어 모두 레벨이 올라갑니다.
  • 마지막 레벨(레벨 6)에서만 모든 체력을 잃은 플레이어가 게임에서 탈락합니다.
  • 플레이어의 체력이 0이 되면 점수가 감소합니다.
  • 다른 플레이어의 체력을 0으로 만들거나 다른 플레이어를 탈락시키면 점수가 증가합니다.
  • 승자는 항상 점수에 관계없이 마지막까지 남은 플레이어입니다.
  • 2위는 탈락한 플레이어 중 가장 높은 점수를 얻은 플레이어가 됩니다.

이러한 게임 방식은 AI를 통합할 때 마주칠 수 있는 '대체 전략'을 구사하기에 매우 적합합니다. 그리고 이것이 우리를 다음 주제로 이끕니다...

AI와 통합하기 ChatGPT vs 아타리 2600 비디오 체스(Atari 2600 Video Chess) 등 LLM이 8비트 시스템과 상호작용하는 다른 시도들에서 영감을 받아, 저는 LLM이 단순한 게임과 성공적으로 상호작용하려면 무엇이 필요한지 탐구하고 싶었습니다. LLM이 시각이나 오디오 출력을 직접 해석하도록 요구하는 접근 방식과 달리, 저는 이른바 '스마트 센스(smart senses)'라는 방법을 사용했습니다. 이는 게임 세계의 구조화되고 텍스트 기반인 표현으로, 무거운 인지 작업을 추상화합니다. 이를 통해 LLM은 원시 데이터를 해독하는 데 시간을 낭비하지 않고, 상태를 추론하고 행동을 계획하는 자신이 뛰어난 작업에 더 많은 시간을 할애할 수 있습니다.

이를 위해 게임을 LLM과 호환되도록 다음과 같이 조정했습니다.

  • 턴제 플레이: 실시간 게임은 LLM에게 너무 빠르므로, 턴제로 변환하여 LLM에 필요한 시간을 제공합니다.
  • 지속적인 메모: LLM이 게임 내외에서 메모를 유지하도록 지시하여, 게임 전반에 걸쳐 전략을 이어갈 수 있게 합니다.
  • 스마트 센서리 입력: 8비트 AI가 사용하는 것과 동일합니다:
    • 터치: 미사일, 벽, 아레나 경계와의 접촉 인식
    • EMF(전자기장) 감지: 다른 플레이어의 위치와 상태 인식

다른 연구자들과 마찬가지로 저는 ChatGPT API(모델 gpt-4o)를 LLM으로 사용하고 있습니다. 강력한 추론 능력, 안정적인 구조화된 출력, 그리고 호출당 저렴한 가격을 제공하기 때문입니다. 또한 제가 PHP에 가장 익숙하므로, PHP를 LLM과 게임을 연결하는 인터페이스 계층으로 사용했습니다.

마지막으로 남은 과제는 PHP와 에뮬레이터 간의 양방향 통신을 가능하게 하는 것이었습니다: ┌───────┐ ┌───────────┐ ┌───┐ ┌───────────┐ ┌────────────┐ ┌──────┐ │'클라우드'│ <─> │ChatGPT API│ <─> │PHP│ ××× │ ??? │ ××× │x16-emulator│ <─> │PvP-AI│ └───────┘ └───────────┘ └───┘ └───────────┘ └────────────┘ └──────┘ 에뮬레이터의 기존 기능을 조사한 후, 저는...

원문 보기
원문 보기 (영어)
PvP-AI Creating the Game PvP-AI is a recreation of an 8-bit game I wrote back in 1990. The only traces left of the original are a few drawings and handwritten notes. Back then, writing for an 8-bit platform, it took every bit of memory and CPU to eke out 4 frames/s with the simplest of animations and backgrounds. Alas, by the time I finished it, the 1990 recession had begun, affecting many industries, including personal computers, so nothing came of it. A few years ago, a YouTube channel by David Murray The8BitGuy caught my eye, in particular his Commander X16 retro-computer. Looking over the specifications, I realized it might be able to handle a newer incarnation of PvP-AI. As it turns out, the emulator was able to handle it very nicely, running at almost 8.6 frames/s, with more detail and better AI! Here’s a video of it in action. The actual hardware, though… it turns out there’s a line drawing issue in the VERA module such that certain kinds of lines aren’t rendered correctly, meaning it has to fall back on a slower method. The end result is only 4 frames/s on hardware. If you want to try it out, you can download the files from my Google Drive . I recommend using the x16-emulator , specifically R49, to run it. More details are in my GitHub EXPLORE repository under CX16 v2 – AI Demo (a.k.a. PvP-AI) . Of note are some peculiarities in gameplay, differentiating it from your typical “shoot-’em-up” 8-bit game: the arena layout changes based on the highest level reached by any player missiles have limited intelligence and can navigate around and above walls if a player brings another player’s health to zero, both players advance in level only at the final level (level 6) does losing all health eliminate a player from the game scores are reduced when players have their health brought to zero scores are increased when players bring another player’s health to zero or eliminate another player the winner is always the last remaining player, regardless of score second place goes to the eliminated player with the highest score It turns out this game lends itself very well to “alternate strategies” one might encounter when integrating with AI — which leads us to… Integrating with AI Inspired by other attempts to have LLMs interact with 8-bit systems, most notably ChatGPT vs Atari 2600 Video Chess , I wanted to explore what it takes for an LLM to interact successfully with a simple game. Unlike approaches that require the LLM to interpret visual or audio output directly, my method uses what I call “smart senses” . These are structured, text-based representations of the game world that abstract away heavy perception tasks. This lets the LLM spend less time deciphering raw data and more time doing what it excels at: reasoning about state and planning actions. To that end, these were the accommodations to make the game compatible with the LLM: turn-based play : the live game runs too fast for the LLM; converting to turn-based gives the LLM the time it needs persistent notes : the LLM is instructed to maintain in-play and after-game notes so that it can carry strategies forward across games smart sensory input , equivalent to what the 8-bit AI uses: touch : awareness of contact with missiles, walls, and arena boundaries EMF detection : awareness of other players’ positions and states Like other researchers, I’m using the ChatGPT API (model gpt-4o ) as the LLM because it offers strong reasoning, stable structured outputs, and affordable per-call pricing. I’m also most familiar with PHP, so I’m using it as the interface layer that connects the LLM to the game. The last missing piece was enabling two-way communication between PHP and the emulator: ┌───────┐ ┌───────────┐ ┌───┐ ┌───────────┐ ┌────────────┐ ┌──────┐ │“Cloud”│ <─> │ChatGPT API│ <─> │PHP│ ××× │ ??? │ ××× │x16-emulator│ <─> │PvP-AI│ └───────┘ └───────────┘ └───┘ └───────────┘ └────────────┘ └──────┘ After some investigation into the existing capabilities of the emulator, I was able to piggyback a new feature, currently a pull request under review, and that completed the “chain”: ┌───────┐ ┌───────────┐ ┌───┐ ┌───────────┐ ┌────────────┐ ┌──────┐ │“Cloud”│ <─> │ChatGPT API│ <─> │PHP│ <─> │VIA2-socket│ <─> │x16-emulator│ <─> │PvP-AI│ └───────┘ └───────────┘ └───┘ └───────────┘ └────────────┘ └──────┘ After enabling on-demand screen captures and removing sound and other non-essentials, I had a working platform to research with. And one final allowance for budgeting reasons: instead of making an API call every frame, I chose to make one every alternate frame. As part of my investigations, I’ve recorded a series of three sequential games “ChatGPT vs PvP-AI” with persistent notes from game to game. They provide a very interesting arc from experimentation to a winning strategy by the LLM. Game 1 — “lucky win” Game 2 — “be aggressive” Game 3 — “wait it out” Further details about the LLM interface and technical setup are in my GitHub EXPLORE repository under CX16 v3 – LLM vs PvP-AI . Given the encouraging results, for future research, I’m looking into even more advanced “smart senses” like vision, hearing, and balance. © 2026 Russell Harper