Photos from my short Iceland roundtrip:
Photos from my short Iceland roundtrip:
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:
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:
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:
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.
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.
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.
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:
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:
Some more photos of the last few months in Germany and Switzerland.
These image galleries are created with
fgallery -i -j 4
input-dir output-dir title to get the full images as well and to run the image
conversion processes on a few cores in parallel.
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!
Last night I had an idea and implemented it, soo let's see what will happen. But first, the idea:
Have a livestream  of DDNet running non-stop  that always shows some interesting  players on the server.
This should be my last post about my travels. I wrote short texts for the highlight photos on imgur, which should deal better with high traffic.
I also made a clickable imagemap for the full photos:
I'm done with the second half of my Europe travels. Here's the photos:
This is my first non-technical post. I'm currently travelling Europe for 1 month after just finishing my CS master. Right now I'm back at home, but will be flying around again in a few days. I've never had a photo camera before, so not sure if the photos are good. This was my route so far with photos:
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.
— Summary by haberman
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
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:
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.
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.
Ok, this part is not exciting yet, but I invite you to follow along with the post:
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.
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: