Driven by a desire to learn networking and improve his Common Lisp skills, the author embarked on creating a multiplayer shooter game. He chose the relatively low-level Hunchentoot web server, using WebSockets for communication and opted for a client-server architecture over peer-to-peer for simplicity. Development involved tackling challenges like client-side prediction, interpolation, and hit detection while managing the complexities of game state synchronization. The project, though rudimentary graphically, provided valuable experience in game networking and solidified his appreciation for Lisp's flexibility and the power of its ecosystem. The final product is functional, allowing multiple players to connect, move, and shoot each other in a simple 2D arena.
Ertuğrul Çetin detailed their experience developing a multiplayer shooter game using Common Lisp, specifically the SBCL implementation, and documented the journey in a comprehensive blog post. They began by outlining their motivation, driven by a long-standing desire to create a game and a fascination with Lisp's unique capabilities. This fascination stemmed from prior exposure to the language and a belief in its potential for game development, despite its unconventional status in the gaming world.
The post then delves into the technical aspects of the project. Initially, Ertuğrul experimented with the Bearriver game library, but ultimately decided against it due to perceived limitations in networking functionality. This led them to explore and utilize a combination of libraries and tools, most notably cl-sdl2 for graphics and low-level input handling, and ENet for networking. The decision to use ENet was based on its lightweight nature and suitability for the real-time demands of a shooter game.
The development process is described as iterative, with the initial focus on establishing fundamental mechanics like player movement, projectile handling, and collision detection. The implementation details of these features are explained, highlighting the use of Common Lisp's powerful macro system and functional programming paradigms. For instance, game objects and their interactions were managed using structs and functions that operate on these structs, showcasing a data-oriented approach.
Networking posed a significant challenge, requiring careful synchronization of game state between the server and clients. Ertuğrul describes the chosen client-server architecture and the strategies employed to minimize latency and ensure consistency. The server authoritatively tracks game state and broadcasts updates to connected clients. Clients predict their own actions locally to enhance responsiveness, while relying on server corrections to maintain accuracy.
The graphics aspect of the game is kept deliberately simple, employing basic 2D shapes to represent players and projectiles. This minimalist approach allowed Ertuğrul to prioritize core gameplay mechanics and networking functionality over visual polish. The blog post includes screenshots showcasing the game's visual style.
The post concludes with a reflection on the lessons learned throughout the development process. Ertuğrul expresses satisfaction with completing the project and highlights the advantages of using Lisp, such as its interactive development environment and the expressive power of its macro system. The challenges encountered, particularly in networking, are also acknowledged. Finally, the source code of the game is made available on GitHub, encouraging others to explore and learn from the project.
Summary of Comments ( 5 )
https://news.ycombinator.com/item?id=42796906
HN users largely praised the author's work on the Lisp shooter game, calling it "impressive" and "inspiring." Several commenters focused on the choice of Lisp, some expressing surprise at its suitability for game development while others affirmed its capabilities, particularly Common Lisp's performance. Discussion arose around web game development technologies, including the use of WebSockets and client-side rendering with PixiJS. Some users inquired about the networking model and server architecture. Others highlighted the clear and well-written nature of the accompanying blog post, appreciating the author's breakdown of the development process. A few commenters offered constructive criticism, suggesting improvements like mobile support. The general sentiment leaned towards encouragement and appreciation for the author's technical achievement and willingness to share their experience.
The Hacker News post titled "I made a multiplayer shooter game in Lisp, here is my journey" (linking to https://ertu.dev/posts/i-made-an-online-shooter-game-in-lisp/) generated a moderate amount of discussion with a mix of technical curiosity and some skepticism.
Several commenters expressed admiration for the author's accomplishment and interest in the technical details. One commenter specifically praised the clear writing and the author's approach to tackling a complex project, breaking it down into manageable steps. They also appreciated the author's honesty about the challenges faced. Another user expressed interest in Common Lisp and game development, seeing this project as further evidence of Lisp's suitability for such tasks. Questions were raised about the specific libraries used, particularly concerning networking and graphics.
Some commenters questioned the practicality of using Lisp for game development, citing potential performance issues and the lack of established libraries compared to more mainstream game development ecosystems. One comment suggested that while interesting from a technical perspective, choosing Lisp might not be the most efficient way to achieve the end goal. Another pointed out the potential difficulty in finding collaborators or maintaining a Lisp-based game project in the long run, given the smaller community size.
Performance concerns were addressed, with discussion about the potential overhead of garbage collection and the author's use of SBCL. A few comments highlighted the mature and optimized nature of SBCL, suggesting that performance might not be as much of a concern as some might assume.
There was also discussion about the game's simplistic graphics, with some suggesting improvements or exploring alternative rendering approaches. One user specifically suggested using a pre-rendered tileset for improved visual fidelity.
Finally, there was some discussion about web-based gaming technologies, including WASM and the challenges of achieving performant multiplayer interactions in a browser environment. Some commenters shared their own experiences with WASM for game development, offering potential solutions and insights.
Overall, the comments reflect a mix of genuine interest in the project, admiration for the author's technical skills, and pragmatic concerns about the chosen technology stack. The discussion is generally constructive and offers a valuable perspective on the trade-offs involved in choosing Lisp for game development.