Coding a game in Python: beta version in AUR


Coding night 22 - internalization and some new animations

With its dictionaries, Python is easy to create language versions with few lines of code. I set en_EN as default, and any translation can be added at any time. I added pl_PL, of course.


I’ve also redesigned animations on the game start and level finished (in 2 variants). No soundtracks yet, besides the sample one I created yesterday in about 5 minutes. :slight_smile:

The avbin library, necessary to play compressed sound (music tracks will be in ogg!) may not be present on each machine / OS. Arch Linux needs an AUR package. avbin crashes for me, avbin7 plays well with pyglet. Void Linux has no avbin support yet. For the game to work, even with no music (just sound FX in .wav), I added a workaround. When started, the game attempts to play the initial sound from the .ogg file. If the try clause catches an exception, the avbin variable is being set False. No more compressed file will be loaded.

1 Like

Wow, some updates & tweaks.


Coding (day and &) night 23 - summary bar

This seems to be not really important feature on 6 x 6 board, but I expect it to be useful. After each move, which results in deletion of cells, a summary bar is being displayed. It shows how many cells of each type left, and disappears when mouse moved (could be displayed again with “h” key). If less than 3 cells of any type left, the value will be followed by :(, so that you could use the Undo button.

1 Like

Coding night 24 - more sounds

Not all of them included in the movie. :wink:


Coding night 25 - player panel

The part of the job I don’t really like: player account, player login, top players list. This means the text input and also printing results, and I’d like to avoid opening another window(s). It also means php and MySQL on the server side - bleh!

I divided the remaining area of the user’s panel and added buttons. It must be enough for tonight.



You work too hard @nwg . Coming up nicely.


Coding night 26 - player account dialog

It’s always a hell of work with coding dialogs in a framework like PyGame or Pyglet. Pyglet offers some basic text widgets, but they do not look well enough to be shown to the world. I implemented the player account dialog as a sprite, but still a lot of work is waiting to be done. At least it already looks not bad. :slight_smile: By the way - I did a lot of optimisation to the bottom panel code.

1 Like

Coding night 27 - runtime configuration

Being slightly fed up with the player account, I put it off, and added the RuntimeConfig class and the rc file. At the moment it allows to select the cells graphics, and also play with the background image:

  • if to draw it while playing (or save on resources on less powerful machine) - True by default;
  • if to rotate it while playing (too distracting to me!) - False by default.

Further progress to the player account - later. UEFA Euro 2020 qualifying starts tomorrow. :slight_smile:

1 Like

Coding night 28 - player account continued

As usually - it’s a real pain in the ass. I had to re-write quite a lot of the python code. Even if I reuse php I wrote for my two previous games, it doesn’t make things look any better. For now I have the player account creation working, and it’s 4:30 am. Enough is enough.

1 Like

Coming up slowly but slowly right !

1 Like

Coding night 29 - still the player account

Nothing special to show tonight. I started adapting the old php code. Also made several changes to the panel to show the online status.


1 Like

Coding night 30 - player login

There’s a damned number of things that may go wrong: no internet connection, wrong password, wrong player name, hell knows what else. For now the player sign in seems to work not bad, and loads scores stored on the server. A lot of code ahead, as the game progress must be synced to the cloud every time the player achieves a better result than what’s saved on the web. The most difficult, however, was to run http requests asynchronously (not locking the main thread), and I would never do this w/o StackOverflow.

1 Like

Wow, nice progresses !


Coding night 31

Quite a lot of debugging and improvements to the player account. Nothing spectacular enough to record a movie.


The behind the scene action right !

1 Like

Coding night 32 - resolving conflicts

We need to resolve possible conflicts between what’s stored online and local scores. The player could have stored results on another machine. They could have gone offline. To keep things simple, I overwrite worse values with better (lower) ones. Having it done locally, the game just sends all the table to the cloud.

Damned php, having received nothing, assumes it must have been zero. Thankfully we still have StackOverflow. :slight_smile:

1 Like

Coding night 32 - players management ready

…but still needs testing. Two main things left:

  1. Top 10 scores list
  2. Preferences

The first of above already started: I added some php on the server side, and it works. The python code asks for data asynchronously. When parsed, they will be possible to display in some way. A little of new GUI will be a must.

1 Like

Loads of work mate !

1 Like

Coding night 33 - the cloud up and running

I added a sprite to display Top 10 results (for each level) downloaded from the server. Also decided to remove the music on/off button from the panel. I’m still unsure if a music track is needed, as I know well that almost everyone turns it off. In case I decide to write one finally, it may be switchable in settings.

1 Like

Keep it on @nwg

1 Like