Let's write a video game from scratch like it's 1987
Philippe Gaultier created Minesweeper in 1987 using X11 without libraries, resulting in a compact executable. The article explores X authentication, Odin language usage, and minimalistic GUI development, offering insights into X11 intricacies. Source code is on GitHub.
Read original articleIn 1987, Philippe Gaultier embarked on creating a video game, Minesweeper, using X11 without libraries, resulting in a small executable. The game, a few hundred lines of code, is significantly smaller than Microsoft's version. Gaultier's approach allows for easy compilation on Unix systems without dependencies, even on older machines. The article delves into X authentication protocols, detailing the process of connecting to the X server securely. The Odin programming language is used for implementation, emphasizing simplicity in GUI development without extensive libraries. The article provides insights into X11 messaging for window creation, image loading, and event handling, showcasing the minimalistic approach compared to modern GUI development. Gaultier's work serves as a resource for understanding X11 intricacies and offers an alternative perspective on GUI programming. The project's source code is available on GitHub for further exploration and learning.
Related
X debut 40 years ago (1984)
Robert W. Scheifler introduced the X window system in June 1984 for the VS100 Unix server, offering improved performance over W. The system was stable, with the Laboratory for Computer Science already transitioning to X and developing applications. Scheifler encouraged experimentation and welcomed volunteers for documentation contributions.
Andrew S. Tanenbaum Receives ACM Software System Award
Andrew S. Tanenbaum, known for MINIX, receives ACM Software System Award for shaping OS education and influencing Linux's design. His microkernel work continues to impact OS development globally.
Avoiding Emacs Bankruptcy
Avoid "Emacs bankruptcy" by choosing efficient packages, deleting unnecessary configurations, and focusing on Emacs's core benefits. Prioritize power-to-weight ratio to prevent slowdowns and maintenance issues. Regularly reassess for a streamlined setup.
I found an 8 years old bug in Xorg
An 8-year-old Xorg bug related to epoll misuse was found by a picom developer. The bug caused windows to disappear during server lock, traced to CloseDownClient events. Despite limited impact, the developer seeks alternative window tree updates, emphasizing testing and debugging tools.
XZ backdoor: Hook analysis
Kaspersky experts analyzed the XZ backdoor in OpenSSH 9.7p1, revealing hidden connections, SSH authentication bypass, and remote code execution capabilities. The backdoor manipulates RSA keys, uses steganography, and executes commands.
And even with this impressive reduction in resource usage, it's actually huge for 1987! A PC of that age probably had 1 or 2 MB of RAM. The Super NES from 1990 only had 128Kb of RAM. Super Mario Word is only 512KB.
A PlayStation from 1994 had only 2MB of system RAM. And you had games like Metal Gear Solid or Silent Hill.
This is my thought as well. You can even avoid some of the grotty details of this article if you use Xlib as your interface instead of going in raw over a socket. Basic Xlib is surprisingly nice to work with, albeit with the caveat that you're managing every single pixel on the screen. For something like a game where you're not using system widgets it is all you need.
Where people ran into trouble is when they try to add the X Toolkit, which is far more opinionated and intrusive.
I did it in Turbo Pascal with BGI graphics. I remember having problems with recursively uncovering empty tiles in large levels where mines were sparse. Recursive algorithms turned out to be rather tricky in general when the stack segment is 64k.
I added a starting disk of various diameters which let you pick a starting location without risk of explosion, which I think was appreciated.
This is probably a better description (from a code point of view) on what you had to do as a programmer to write a game in the late 80s / early 90s:
> One interesting thing: in Odin, similarly to Zig, allocators are passed to functions wishing to allocate memory. Contrary to Zig though, Odin has a mechanism to make that less tedious (and more implicit as a result) by essentially passing the allocator as the last function argument which is optional.
Seems like that could be further optimized especially for simple 2D games that don't use many features. I was impressed overall though. I hadn't looked at Godot in a long time.
I did a 1-1 replica of the Windows 95 version of Minesweeper.
You can find it at https://github.com/danielricci/minesweeper
I didn’t do anything fancy in terms of reducing the size of the output file, but it was fun to try and replicate that game as best as I could.
There is definitely something to be said of bloat but probably not in this case. You could even keep supporting Linux versions as old as this promises by using legacy 1.x SDL.
It is legitimate but by 1987 …
x y z z y S-Return
would cause the top left pixel of the screen to change color depending on whether the cursor was over a safe square or a bomb. Since you could plant flags before the timer started, it was possible to get rather unrealistic times.WTF? This is a showcase of everything wrong with the company today.
https://github.com/id-Software/DOOM/blob/master/linuxdoom-1....
This is more like 1992.
Michael Abrash's book was published in 1990.
So I just threw out the graphics library and wrote directly to the screen memory. Lots of games did that
"We will implement this in the Odin programming language"
checks Odin homepage...
"The project started one evening in late July 2016"
What? How big are your hostnames?
What?
Related
X debut 40 years ago (1984)
Robert W. Scheifler introduced the X window system in June 1984 for the VS100 Unix server, offering improved performance over W. The system was stable, with the Laboratory for Computer Science already transitioning to X and developing applications. Scheifler encouraged experimentation and welcomed volunteers for documentation contributions.
Andrew S. Tanenbaum Receives ACM Software System Award
Andrew S. Tanenbaum, known for MINIX, receives ACM Software System Award for shaping OS education and influencing Linux's design. His microkernel work continues to impact OS development globally.
Avoiding Emacs Bankruptcy
Avoid "Emacs bankruptcy" by choosing efficient packages, deleting unnecessary configurations, and focusing on Emacs's core benefits. Prioritize power-to-weight ratio to prevent slowdowns and maintenance issues. Regularly reassess for a streamlined setup.
I found an 8 years old bug in Xorg
An 8-year-old Xorg bug related to epoll misuse was found by a picom developer. The bug caused windows to disappear during server lock, traced to CloseDownClient events. Despite limited impact, the developer seeks alternative window tree updates, emphasizing testing and debugging tools.
XZ backdoor: Hook analysis
Kaspersky experts analyzed the XZ backdoor in OpenSSH 9.7p1, revealing hidden connections, SSH authentication bypass, and remote code execution capabilities. The backdoor manipulates RSA keys, uses steganography, and executes commands.