HookRace Blog     Posts     Feed     DDNet     Me     Switch Theme

Haskell: Game Programming with GIF Streams

Note: This is translated from the German original, which was used as a homework for the Programming Paradigms course at Karlsruhe Institute of Technology a long long time ago when I was co-holding the practical courses.

Read the full post

God writes Haskell

God famously does not play dice with the universe, but he seems to enjoy writing Haskell:

Read the full post

Database Testing at Yugabyte

YugabyteDB is a cloud-native database for business-critical enterprise applications. It is designed to provide continuous availability as well as horizontal scalability, while retaining a strong set of RDBMS features. This objective creates a strong quality incentive for us in the Yugabyte Quality Assurance (QA) team. As a member of this team, I am giving an overview of the testing philosophy, approaches, and implementations for YugabyteDB.

Read the rest of the blog post over on the YugabyteDB blog.

Read the full post

€9 Ticket

As a relief for rising energy costs and inflation Germany is offering nearly-free public transportation for the months of June, July and August. For just €9 per month you can take any kind of regional public transportation in all of Germany. That’s basically everything except the IC/ICE for long distance. This means that a monthly ticket is now as cheap as what I would normally pay for a single route. In this post I want to talk about my experiences with this €9 ticket.

Update 2022-09-01: The €9 ticket ended yesterday without a similar replacement system in place. So many people are again back to paying about €100 per month for much smaller regional tickets instead (see for example this German Reddit thread. Financially it makes more sense for me personally to go back to driving. (I hope the gasoline in the car is still good after three months.) My hope is that these three months will stay in people’s minds in Germany and shape the future of public transportation to be cheaper and simpler:

Read the full post

Update on DoS Attacks against our Online Game

In my previous post 8 months ago I described how our open source online game DDraceNetwork has been suffering under DoS attacks for about 8 years, basically since its inception. Recently the attacks have gotten much worse, forcing us to work on further approaches. Since many players made suggestions recently, I’m writing this blog post to summarize what we are attempting and to ask for help again.

Read the full post

macOS Setup after 15 Years of Linux

About 3 years ago I wrote about my Linux Desktop Setup and having used pretty much the same software setup for 10-15 years. My setup used to be heavily keyboard based. Now for work I am for the first time using a macOS-based Macbook Pro with an M1 Pro CPU. I spent the last 3 weeks using it as a daily driver, tweaking it here and there. Here are my experiences.

Read the full post

DoS Attacks against our Online Game

DDraceNetwork is an open source online game I’ve been running since 2013 with a community of volunteers. The game is available for free, I’m hosting servers for it in many countries around the world so that we have trusted official ranks. The servers are paid for by donations, which I stop collecting once the cost of the servers for the current year is covered. I wrote about DDNet in a previous post in 2016 and also a bit about the game history in 2013.

Pretty much since the beginning we have been suffering from DoS attacks against the servers. Since the Steam release in 2020 the player number has increased significantly, so that we have about 1300 players playing on average.

Read the full post

Quest for the Lost Home Server

Today I lost access to my home server. As I described in a previous post I depend heavily on the server to fetch my emails, as a file server, to synchronize files, for newsbeuter and irssi sessions and many other things. As no one was going to be in proximity of the server for the next few hours, my goal for today was to solve the problem remotely.

Read the full post

Chinese Traffic to time.gif

Nearly two years ago I posted this endless GIF that always shows the current time in UTC:

Read the full post

Linux Desktop Setup

Russian Translation by Akhmad Karimov

My software setup has been surprisingly constant over the last decade, after a few years of experimentation since I initially switched to Linux in 2006. It might be interesting to look back in another 10 years and see what changed. A quick overview of what’s running as I’m writing this post:

Read the full post

Theme Switcher in Nginx

Some people really liked the dark DDNet theme for Halloween by Soreu, so we decided to keep it possible to use the default bright or the dark theme.

Thanks to xse we got a JavaScript based theme switcher. After some improvements I finally I switched it away from JavaScript entirely and finally am also using it on this blog with an OLED friendly dark theme.

Read the full post

One year of cycling to work

Exactly on this day, one year ago, I came back from a one month long trip to Taiwan, went straight to work from the airport and immediately moved into a new apartment after work. Since then I have cycled to work nearly every day.

Read the full post

Turning Down a Blockchain Job Offer

I have recently received a job offer to work on a blockchain implementation. While the offer was very generous, I had to turn it down. In this post I want to collect the thoughts that went into my decision process leading to this conclusion.

Read the full post

HANA C++ Development Environment and Processes

I started working as a C++ developer in the HANA Core Platform team at SAP in Walldorf, Germany more than a year ago. In this time I have gotten some insights into the development environment and processes. I will use this post to illustrate them by the example of adding a small new feature and explaining the steps on the way of getting it released. Some of this will be specific to HANA, some to my team inside HANA, some to my own system.

Read the full post

C++ Quiz #1

What is the output of this small snippet that is based on real C++ code?

Read the full post

time.gif

This is an endless GIF that always shows the current time in UTC:

Read the full post

Nim Code Coverage

Creating code coverage reports with Nim is surprisingly easy. You can simply use the good old gcov and lcov tools. Nim can be told to insert its own line information with the --debugger:native command line parameter.

Here’s the small example program we’re looking at:

var x = 0
if x > 1:
  echo "foo"
echo "bar"

Read the full post

A Taste of Haskell

In this post I want to highlight a few fun aspects of the Haskell programming language. The purpose is to give you a taste of Haskell so that you will want to learn more of it. Don’t consider this as a tutorial or guide but rather as a starting point, as it is based on a short talk I held at work, which in turn is based on my favorite material from holding practical courses about Haskell at university.

Let’s start by seeing how programmers compare Haskell to a mainstream programming language, for example Java:

Read the full post

New Hardware and Hacks

In my latest post I showed some examples of how I ran mostly the same PC hardware over a period of 8 years. Today I finally finished setting up my new PC hardware in my new home, so I can report about what I did differently, my thought process, and some problems I encountered and hacks I did to solve them.

I’m not sure if this article is interesting for anyone, but I had some fun setting the new system up and felt like writing about it, so here we go:

Read the full post

Broken Hardware, Fixes and Hacks over 8 Years

After reading the feedback of my recent article about running DDNet, I noticed that people found it interesting how I’m trying to minimize money and resources. I also noticed that I had been doing something similar with my personal computing hardware setup for an even longer time.

I’ve mostly been using the same hardware for personal computation purposes over the last 8 years. In this article I want to talk about some of the hardware I’ve been using, how it broke and how I fixed the problems or worked around them. My goal was to be frugal about hardware, to keep using the same hardware for a long time and repair it when possible instead of simply buying new hardware.

Read the full post

Writing a 2D Platform Game in Nim with SDL2

Japanese Translation

In this article we’re going to write a simple 2D platform game. You can also consider this as a tutorial for game development with SDL2 in Nim.

We will read in user input, display graphics and a tile map, and simulate simple 2D physics with collision detection and handling. Afterwards we will implement simple camera movement and game logic. To display some information we will render texts and develop a caching mechanism for said text rendering.

The final result will be a binary file that requires only SDL2 and can be easily distributed, perfect for games. If you’re on Linux we will also present a simple way to cross-compile Nim programs for Windows.

Read the full post

Experiences of Running an Online Game for 3 Years

It’s been roughly 3 years since DDraceNetwork (DDNet) started in the summer of 2013. Last year I wrote a non-technical History of DDNet. Today in this post we will dive into the technical side of what makes DDNet run.

For the uninitiated, DDNet is an open-source modification of Teeworlds, a retro multiplayer shooter. DDNet is a game in which you, instead of killing each other, cooperate with each other to work your way through challenging maps, trying to beat the map or get a better time than other teams.

Read the full post

Introduction to Metaprogramming in Nim

Introduction to the Introduction (Meta-Introduction)

Wikipedia gives us a nice description of metaprogramming:

Metaprogramming is the writing of computer programs with the ability to treat programs as their data. It means that a program could be designed to read, generate, analyse and/or transform other programs, and even modify itself while running.

In this article we will explore Nim’s metaprogramming capabilities, which are quite powerful and yet still easy to use. After all great metaprogramming is one of Nim’s main features. The general rule is to use the least powerful construct that is still powerful enough to solve a problem, in this order:

Read the full post

DDNet Server Statistics with ServerStatus, RRDtool and Nim

About a month ago I set up statistics for the official DDNet servers. My motivations for this are:

  1. Monitor the servers more easily
  2. Get notified about server problems
  3. Have nice graphs to look at

The choices for the software used are mainly made to keep resource usage low, a general principle used for DDNet since we run on cheap VPSes all around the world and are limited in CPU and memory resources. In the rest of this post we will explore the 3 major tools used, their purpose in our solution as well as their performance impact:

  1. ServerStatus: Gather live server statistics
  2. RRDtool: Record and graph data
  3. Nim: Favorite programming language for performance and readability

Read the full post

Writing an Async Logger in Nim

Surprisingly I’m working on HookRace again. I might share a few interesting code snippets and thoughts in this blog along the way. I’m still going with Nim as the programming language.

For an easy start let’s write a logging module that can be used everywhere in the game’s server as well as client. There are mostly three aspects that I care about:

Follow along if you want to witness how fun it is to write code in Nim!

Read the full post

DDNet Live: Twitch spectates an online game

Last night I had an idea and implemented it, soo let’s see what will happen. But first, the idea:

Have a livestream [1] of DDNet running non-stop [2] that always shows some interesting [3] players on the server.

The resulting livestream is running on Twitch. All the scripts are on Github

Read the full post

Nim binary size from 160 KB to 150 Bytes

The size of binaries in the Nim programming language seems to be a popular topic recently. Nim’s slogan is expressive, efficient, elegant, so let’s examine the efficient part in this post by exploring a few ways to reduce the size of a simple Nim Hello World binary on Linux. Along the way we will:

The full source code of this post can be found in its repository. All measurements are done on Linux x86-64 with GCC 5.1 and Clang 3.6.0.

Read the full post

Porting a NES emulator from Go to Nim

Let me get this straight. We have an emulator for 1985 hardware that was written in a pretty new language (Go), ported to a language that isn’t even 1.0 (Nim), compiled to C, then compiled to JavaScript? And the damn thing actually works? That’s kind of amazing.

Summary by haberman

Read the full post

NimES: a NES emulator in Nim

Since today Nim 0.11 has been released, I guess it’s a good time to release this as well: NimES is a NES emulator written in Nim. More info in the GitHub repository and the JS demo.

Discussion on Hacker News and Reddit.

Read the full post

Make a Lisp in Nim

I spent the last weekend working through the amazing guide for Make a Lisp, writing a Lisp interpreter in Nim. The final result just made it into the repository.

Running the Nim version is pretty simple. You need the Nim compiler from the devel branch and nre which can be installed through nimble. After installing those you can build and run the MAL interpreter:

$ cd nim
$ make
  # OR
$ nimble build
$ ./stepA_mal
Mal [nim]
user> 12
12
user> (+ 2 3)
5

Read the full post

How I Start: Nim

My most recent post goes in another direction (no, it’s still about Nim): How I start a new Nim project. Check out the article on howistart.org. Comments on Hacker News and Reddit as always.

Read the full post

Conclusion on Nim

In my last two posts, “What is special about Nim?” and “What makes Nim practical”, I forgot the important conclusion - why I personally have decided for Nim in favor of Rust, C++, Python and Haskell:

Nim is not the fastest language, it’s not the easiest language to write in and it surely has some flaws that should be fixed. Nim has no single “killer feature” like go’s goroutines or Rust’s memory management. But Nim doesn’t need a killer feature. Instead it strikes a reasonable balance that makes it the most efficient language for me:

Read the full post

What makes Nim practical?

In my last post I showed what makes the Nim programming language special. Today, let’s consider Nim from another angle: What makes Nim a practical programming language?

Binary Distribution

Programs written in interpreted languages like Python are difficult to distribute. Either you require Python (in a specific version even) to be installed already, or you ship it with your program. This even causes some to reconsider Python as a teaching language.

How does Nim work around this problem? For starters your program gets statically linked against the Nim runtime. That means you end up with a single binary that depends solely on the standard C library, which we can take for granted on any operating system we’re interested in.

Read the full post

What is special about Nim?

Russian Translation by frol, Chinese Translation by JiyinYiyong, Japanese Translation by Mutsuha Asada

The Nim programming language is exciting. While the official tutorial is great, it slowly introduces you to the language. Instead I want to quickly show what you can do with Nim that would be more difficult or impossible in other languages.

I discovered Nim in my quest to find the right tools to write a game, HookRace, the successor of my current DDNet game/mod of Teeworlds. Since I’m busy with other projects for now, this blog is now officially about Nim instead, until I find time to continue developing the game.

Easy to get running

Ok, this part is not exciting yet, but I invite you to follow along with the post:

for i in 0..10:
  echo "Hello World"[0..i]

Read the full post

Nim Adventures

To learn some Nim I held a talk about it at the GPN14 (in German, Slides).

Afterwards I started solving Rosetta Code tasks in Nim to get a better feel for the language and standard library. That also made me discover some rough edges in the language, but luckily the community, albeit small, is active and competent. All the small code pieces I wrote are now on Github too.

What I noticed is that most problems are as easy to solve as in Python, but much more performant. I’m now more confident that this language is the right choice for writing HookRace in.

Read the full post

What is HookRace?

I have been running DDraceNetwork for 1 year, which started out as a little server of a Teeworlds modification called DDRace. It has turned into the biggest project within Teeworlds, offering servers in 6 countries with thousands of players and dozens of mappers. We also offer a custom server and client (Windows, Linux, OS X, Android).

Now it’s time to start something new. I’m working on a new game called HookRace, which will be the successor to DDraceNetwork. It will be its own game, not based on Teeworlds.

Some of the plans I have so far for HookRace:

Read the full post