Kartones Blog

Be the change you want to see in this world

Course Review: Building with Bazel

Building with Bazel, from Ray Wenderlich, is a free 90 minutes course to learn about Bazel, the build system that Google open-sourced around 2016 and that it is as powerful as initially complex to learn. During the course we'll learn the basic concepts: Workspaces, build files, actions, rules, what is the Starlark language, running tests... All of them via basic but easy to understand examples. We'll also get briefly introduced to distributed builds.

It is a brief but good overview, you can't beat the price, and really can't complain about missing contents. But if I could improve something, the focus on Android and iOS systems doesn't covers the full picture. That said, it is also true that Bazel support for web, at least as of late 2022, feels still quite beta, having to rely a lot on Aspect rule-sets instead of on the built-ins (especially if you use Typescript).

Audiobook Review: Algorithms at Work


Algorithms at Work audiobook cover

Title: Algorithms at Work

Author(s): Brian Christian, Tom Griffiths

With around 5 hours of content, with this audiobook we'll learn about the following topics:

  • Distributed systems
  • Queueing theory
  • Concurrency & coordination
  • Consensus algorithms (Paxos & Raft)
  • Networks & hierarchies, including decentralized network structures
  • Action & reaction (game theory)

The selection is quite nice, but what I liked most is that each topic is presented with very easy to understand real world examples. Sometimes there are also purely technical explanations, but for example learning about game theory with a professional poker player, or about distributed systems with how the CERN manages multi-year and insanely huge data projects, while coordinating thousands of scientists, feels really refreshing and very interesting and different.

It doesn't covers everything, choosing instead in some topics a fragment and zooming in, but it felt like a nice refresher compared with a more traditional Distributed Systems book. And in fact I learned new things, like the Stackelberg competition model.

Trying Electron for packaging web apps

I know that Electron is quite famous to package web applications into native binaries, but I hadn't decided when to use it. So after reading that version 20 had just been released, I checked the tutorial and it looked insanely easy and quick to get a simple page transformed, so I decided to give it a go.

The tutorial guides you quite well and step by step, both in building a hello world web inside Electron, and then adding Electron Forge to build the binaries. I picked up my pomodoro web app and excepting a single issue regarding the favicon, it gave me no errors. Even the notifications worked out of the box!

But being a bit stubborn myself, I wanted to generate both Linux and Windows from the same Linux host, and despite what the Electron Forge Makers doc said, I wasn't able to compile Windows binaries. Having installed the pre-requisites both mono and wine (and available from my $PATH), it didn't worked with Squirrel nor with WiX. It would only compile the Linux deb installer.

This is my makers config (almost the same as the tutorial's):

"makers": [
    "name": "@electron-forge/maker-squirrel",
    "config": {
      "name": "pomodoro"
    "name": "@electron-forge/maker-deb",
    "config": {}
    "name": "@electron-forge/maker-wix",
    "config": {
      "language": 1033,
      "manufacturer": "Kartones"

My saviour was electron-builder. Just npm-installing it and adding a new script like the following:

"scripts": {
    "make-windows": "electron-builder --ia32 --x64 -w"

Made it work at the first attempt.

I knew that Electron apps tend to weight a lot, as after all they contain a NodeJS and a Chromium browser. What I didn't expected was that the Windows installer of a < 0.5MB webpage would weight 266MB! And even less that the Linux deb installer would be a whooping 600MB!!! I'm sure there are some tweaks and options to shrink this, but the default is... a bit insane... I also want to test generating the Linux binaries using electron-builder, as maybe works better than electron forge (one binary weights less than half than the other).

So, overall, it is true that Electron is very very easy to get running and do a simple packaging, and you can even do multi-arch and cross-platform compilations from a single host (which sounds as crazy as great!), but the default options seem to make it just work for building a kind of "alpha" binary, in need of extra love.

Syndicate Map Viewer

Syndicate is, alongside Quake, one of my all-time videogame jewels, not only because the gameplay was quite innovative, but because the Cyberpunk setting, visuals and sound were amazing (and still mostly are).

As now I can potentially do more than just play it, I recalled there was a website (the Freesynd project) that had documented some of the file formats, and decided to spend some time of a vacation at least beginning to build a map viewer for the game.

My initial intention is to fully display maps, including sprites, probably using something like Phaser for some smooth rendering (and so that I get to learn it too). If I were to define milestones, they would be the following: 1. Extract tiles 2. Render map tiles 3. Extract sprites 4. Render map sprites 5. Render map using Phaser

As of today, I have achieved the first two milestones (and began preparing for the third one).

The project is available at my Github: https://github.com/Kartones/syndicate-map-viewer.

Extracting tiles

The first step was the longest because it also meant creating some foundations for the future, but at least thanks to a tool I found ("Bullfrog games RNC Utilities" by Jon Skeet & Tomasz Lis), I didn't had to implement any Run-Length Encoding (RLE) logic. After some fights with outdated documentation and a refresh on little-endianness and bit masks, I was able to extract all the tiles with all the game palettes (in-game missions use only 16 colors, but chosen from 5 different palettes):

Tile reader output screenshot

Rendering maps

Having the tiles, rendering a map sounded simple... The map format itself is quite easy, just a 2-dimensional array having a stack of tiles at each coordinate. What was more fun was rendering the tiles according to the isometric projection that the game uses. All in all, I built a map exporter that saves a full-resolution PNG file (~20MB per map) of each map it finds in the data folder, with each palette file also found at the same folder.

A sample:

MAP01 with HPAL01 screenshot

MAP01 with HPAL02 screenshot


Although not having sprites means that scenarios are missing doors and decorations (traffic lights, neon signs, video walls, etc.) apart from the obvious pedestrians and vehicles, the maps already look quite cool.

In a few maps there seems to be some unused areas, maybe there wasn't enough time to test them and were left out? I also have noticed some curious tiling patterns under what acts as main ground level. I wonder if they have some special meaning for the AI, or if they are what the minimap draws, or maybe they simply were initial guides for the level designers and where left there. That's why having a GUI to see the maps and potentially toggling on-off certain layers of tiles would be so nice...

Now on to reading, extracting and rendering sprites!

How to play Quake trilogy with modern engines

Quake is forever

To me, Quake is one of the greatest videogames of all time. It never grows old, and even recently got remastered. But for those of us who prefer more "vanilla" experiences and can detect subtle differences in engines re-done from scratch (don't get me wrong, they can be awesome too), id Software's old policy of releasing as opensource their id Tech engines meant that people have adapted the titles for modern times, while keeping their nature exactly as it was.

With this post I'll just list my top engines as of 2022 to enjoy the first 3 Quake games, on any major platform (Windows, Linux or Mac).

The original games

To use a modern engine, you still need the original game. You can find all three games at many online stores, but my personal preference is the DRM-free, launcher-free version: I, II, III.

The "Quake refresh" version (also known as "Quake re-release") includes additional maps and modes and slightly improved visuals, but in exchange you need use a different engine to play, quite good but not 100% equal to the old engine.


Engine: Instead of the vanilla clients, use vkQuake. This engine builds and improves on the original, so it is 100% compatible with any mod I've tested, and it is even able to run the new maps of the "refresh" re-release. It is only not capable (as of the time of writing this post at least) of using the new re-release 3D models.

Alternative: The DarkPlaces engine still uses the original Quake engine as the base (so physics and the like are still 100% accurate), but offers an improved visual experience, particularly if you go for the HD Ultra quality texture pack and the Quake Retexture/Remodel Project models and creature textures. Not so vanilla in the visual aspect this way, but quite impressive.

Extra #1: Arcane Dimensions is a "mission pack" with so many incredible maps with extra graphics and enemies and complex mechanics, that requires an advanced Quake engine because goes out of the original 3D engine limits in many ways.

Extra #2: Quaddicted Random Map is a small tool I built to pick random maps from the amazing Quaddicted site and play them. While not all of the maps are supported (some of the zip files are a mess), a lot of them work and is a lazy and fun way to try new maps each time you want to play.

Quake II

Engine: Yamagi Is a much-needed engine that only provides fixes and small upgrades, being one of the few Q2 engines compatible with most (if not all) mods. As Quake 2 has aged quite badly, I recommend installing also the Neural Upscale textures to make things less blurry.

Alternative: vkQuake 2 aims to be the equivalent to its Quake I counterpart, but sadly uses new DLLs that seem to collide with some mods, not being as compatible as Yamagi.

Extra: Quake 2 Generations: To me Quake II is the least good of the trilogy, and this mod allows you to play with the Quake I marine weapons and physics (or with DoomGuy or BJ Blazkowicz from Wolfenstein 3D, also each with their weapons). It unbalances the game a lot, but at the same time you feel like playing a big Quake I mission pack.

Quake III

Engine: Quake3e it's based on the alternative ioQuake3 engine, but with many improvements, making it the best choice to play Q3.

Alternative: ioQuake3 is an engine providing cross-platform and vastly improved options for playing Quake III: Arena and Quake III: Team Arena expansion. Fully compatible.

Extra: [HQQ] High Quality Quake texture pack provides improved visuals keeping the same original style.

Previous entries