Ebiten vs PyGame

The following is a copy of a response I wrote to a university student asking in the Ebiten Discord server whether they should use Ebiten or PyGame for their first time making a game:

Having used both I can say that PyGame provides much more out of the box but that this is not just a pro but also a con. For example in pygame there is a concept of “sprite” that has movement and you can tell it move left, move right etc. In Ebiten it surprised me to find that there is no such thing but it’s nice for two reasons:

  • implementing movement is trivial and maybe you don’t want your sprite to move like that, e.g. my first game with Ebiten had moons orbiting, not moving left-right etc.
  • Ebiten is much simpler to understand

When I was using PyGame I’d say I spent roughly 80% of the time reading the docs and trying to understand how to use correctly what is already there and only 20% working on the game, whereas with Ebiten it was the other way around, 80% of time programming my game.

And then my last point for Ebiten is that it makes it easy for you to build a single binary that you can ship to any popular platform. Ironically just yesterday I closed the last outstanding issue on my awful PyGame game that has been open for 3 years: To bundle the game into a runnable .exe file, I failed, it was too hard for me, but with an Ebiten game, Go’s build tools do the job for you.

Maybe a bit of a long, opinionated rant but I wanted to share the experience:

  • PyGame makes it easy to get into gamedev if you have zero experience because its framework provides rich existing general features for a game but don’t expect others to be able to play your game (if everyone in your class is already using Python and have it installed then this is not an issue)
  • Ebiten is by design simple to the core, so easy to understand, it is less a framework and more a strong library, you may have to implement some of details yourself but if you’re already familiar with Go programming then this could be fun and not so challenging, and it will be easier to share your game with others as .exe or for web etc

There are surely many more pros/cons for both, but these are the two that stood out the most for me. I don’t regret using PyGame for my first competition entry, it was a good introduction, but I won’t use it again.

Launched a new game: Cr1ckt

Direct link to game: https://sinisterstuf.itch.io/cr1ckt

On the 1st of December Tristan, Rowan and I released the first version of Cr1ckt, a tricky platformer where you need to jump to avoid water and get to the fruit. It’s our submission for the GitHub Game Off 2021 game jam, an annual challenge to make a game based on a secret theme within the month of November. The theme this year is “BUG” so apart from playing as a cricket it also has some fun, intentional bugs.

It’s got downloads for major desktop platforms Windows, Linux & Mac, as well as Android. They’re quite small so you should be able to download and play quite fast. You can get the downloads or play online in your browser on the game page at sinisterstuf.itch.io/cr1ckt.

As hobbyist game developers in our free time this is one of the Continue reading

First time in Hacktoberfest

This year was my first time participating in the online Hacktoberfest event.

I often use code from GitHub and occasionally publish my own projects there but I realised I rarely contribute to other people’s code. Hearing people talking about the event on the Ladybug Podcast, I was inspired to make a small pull request. The boost I got from something so insignificant being merged lead me to look through my favourite projects’ issue lists to see if there was a bug I could fix or a missing feature I could implement.

Continue reading

How to slugify text in Vim (properly)

Recently I had to write a lot attributes —titles and matching slugs (in the URL)— for a bunch of links for a simple Hungarian web page I was building. There were a lot of links. Since I was editing the HTML template and associated URL configuration in Vim, I figured I’d quickly run some macro to generate me slugs from the page titles, so that I wouldn’t have to do them one-by-one. It turned out none of the existing solutions did quite what was necessary so I developed my own solution (shown below), but first: What is a slug?

Define: slug

Slugifying is a step up from ascii-fication. If we take the latter to mean “removing all non-ASCII characters from a string” then slugifying simplifies it even more. The point of slugifying is to generate (usually from a link or post title) a string good for use as a URL, without the characters getting garbled up into non-human-readable URL-encoded rubbish like this:


when what you really want is something like this:


Existing solutions and the problem of OSX

I based my solution on xolox’s slug function from his str collection, but even more hardcore. His doesn’t handle accented characters well.

Mine shells out to iconv, like the Diacritic plugin does.

This doesn’t work so well on OSX because apparently its transliteration is rubbish, my workaround is to do a second pass and remove OSX’s garbage. I later found out that it’s because OSX uses the BSD libiconv which is much leaner and simpler and lighter than the GNU libc (this can be a good thing) but also apparently puts in much effort into transliterating strings in locales other than English. For example, if I convert a German word like “grün” to a German locale, I expect to get “groen”, and if I convert it to ASCII, which has no accented characters, then I expect grun, with no accents.

The iconv command on OSX would give you gr”un. IMO this is not useful in any language and it also doesn’t get me any closer to removing the accents to form slugs. A Hungarian example with a typical test word:

  • Árvíztűrőtükörfúrógép input text
  • ‘Arv’izt”ur”ot”uk”orf’ur’og’ep libiconv (OSX)
  • Arvizturotukorfurogep glibc (this is what I want)

The solution

Since I can’t expect this to work consistently on Mac and Linux and I myself often switch between both I decided to brute force it, use iconv and strip any left over apostrophes and quotes from the result to handle the OSX case:

command! Slugify call setline('.', join(split(tolower(substitute(iconv(getline('.'), 'utf8', 'ascii//TRANSLIT'), "[\"']", '', 'g')), '\W\+'), '-'))

Probably not the most elegant solution, but at least it works for me…. consistently.

Edit from the future: I have now used this so much that I’ve committed it to my vimrc.

Mathematical Range Summing

Immediately after the last post about summing a range of numbers, a talented friend of mine, Gábor, offered an even shorter, cleverer solution:

What I especially like about it is that instead of relying on esoteric JavaScript functions to do the job, it’s done with reasoning and plain maths, which makes it clearer and easier to read too.

The Maths.abs() call is only needed because in the original problem, the arguments could be in either order; the logic is still the same though, you just need to make sure the range is positive. In short, it’s (a+b) × (a-b+1) ÷ 2.

Sum All Numbers in a Range

A solution to Free Code Camp’s “Sum All Numbers in a Range” JavaScript challenge, in a Functional Programming style.

A friend of mine hosts meetups for the Free Code Camp, which describes itself as:

We’re an open source community of people who learn to code and help nonprofits.

He organises casual meetings in coffee shops to allow participants to work on their assignments in a nice environment and help each other. If you’re looking to learn programming I recommend finding a Free Code Camp group in your area.

Today I visited such a meeting and one of the Code Campers was working on a solution for one of the JavaScript problems in the Intermediate Algorithm Scripting section. The task was to write a function that takes an array of 2 numbers as an argument and returns the sum of all the numbers between them, including the 2 numbers themselves. For example, an input of [3, 1] should result in 6, because 1 + 2 + 3 = 6. As a hint, it’s recommended you read the documentation for Math.min(), Math.max() and Array.prototype.reduce(). Continue reading

Lean Poker

I had a lot of fun attending a Lean Poker event last weekend!

Me at Lean Poker

Me at Lean Poker

It’s a type of event where programmers get together, form teams and spend the day writing code competitively, to see who can write the best automated online-poker player. We don’t play for money but for pride, and the main aim is to practise writing beautiful code and lean principles. That said, given the time constraint of a single day, the focus is usually on Deliver as fast as possible and by the end I’m flurrying around to keep errors out of the code. We try to get quick feedback during the day (more on that later) but I thought I’d do a write up about the event to give people who haven’t attended one of these before an idea of what it’s like!

Continue reading

CSS for TODO Elements

I wrote a small CSS class .todo for cases when you want to mark HTML elements on a page that you still want to work on later. Add this class to elements that aren’t ready yet, to mark them so that you won’t forget about them and ship the site unfinished. See the Gist’s description on GitHub for more information on how to use it. Here’s the code:

/* CSS for adding TODO notes on WIP pages */
div.todo { /* style the text in a bright box */
  color: red;
  font-size: large;
    background-color: yellow;
    text-align: center;
    border: 3px solid red;
    border-bottom: 1px solid red;
    margin-bottom: 0;
    padding: 1px;
div.todo:before { /* prepend the word TODO to the text */
    font-weight: bold;
    content: "↓ TODO: "
div.todo+* { /* style the following element in a bright box too */
    border: 3px solid red;
    border-top: 0;
    margin-top: 0;