CobolCraft is a Minecraft server written in COBOL that demonstrates the versatility of this language in modern applications.
In an effort to merge classic technology with contemporary applications, CobolCraft emerges as an innovative project that implements a Minecraft server using COBOL, a programming language released several decades ago and traditionally associated with financial and business systems.
CobolCraft Project
CobolCraft is an open source project that implements a Minecraft server written in COBOL. This project, available on GitHubseeks to demonstrate COBOL’s ability to handle modern applications such as game servers.
Project Features
Among the functionalities that CobolCraft offers include:
- Infinite terrain generation and dynamic chunk loading.
- Persistence of world and player data on disk.
- Support for Minecraft file formats, allowing the import of existing worlds.
- Multiplayer capability for up to 10 concurrent players.
- Basic interaction with blocks, such as placing and breaking blocks, and opening doors.
- Player inventory limited to creative mode.
- Chat functionality.
Code Structure
The project is organized as follows:
- The main entry point is
main.cob
. - The other COBOL files are located in the directory
src/
includingsrc/server.cob
which contains most of the server logic. - C++ libraries are located in the directory
cpp/
and are compiled into a shared library. - TCP connections are managed by the library
CBL_GC_SOCKET
located inCBL_GC_SOCKET/
.
Interoperability with Minecraft
To ensure compatibility with the Minecraft client, CobolCraft uses network data captured from an official server instance using tools such as Wireshark.
This data is found in the directory blobs/
and are decoded at runtime. Additionally, the project employs a custom JSON parser to handle data extracted from the official Minecraft server, allowing interoperability without distributing potentially copyrighted material.
CobolCraft is distributed under the MIT license. It is important to note that although “Minecraft” is a trademark of Mojang Synergies AB, CobolCraft is not affiliated with or endorsed by Mojang.
Author’s Considerations
Fabian Meyer, the author, comments on the project:
Well, there are quite a few rumors and stigmas around COBOL. This sparked my curiosity to learn more about this language, something that, in my opinion, is best done with some kind of project. That’s right, you heard it right: I had no prior experience with COBOL when I started.
Writing a Minecraft server was perhaps not the best idea for a first COBOL project, since COBOL is designed for enterprise applications, not for low-level data manipulation (bits and bytes), which is something the Minecraft protocol requires greatly. However, abandoning before having a working prototype was not an option. Much of this functionality had to be implemented completely from scratch, but with some clever programming, data encoding and decoding not only fully work, but are also quite efficient.
CobolCraft is a notable example of how traditional programming languages such as COBOL can be adapted to develop modern applications, challenging conventional perceptions about their limitations and demonstrating their versatility in today’s programming arena.
Source: geeksroom.com