Coding a game in Python. Code published on GitHub

python
python3
pyglet
gaming
puzzle

#21

Video unavailable on my end, wonder what s wrong.

Been hard at work !


#22

Stupid me! Marked “private” instead of “unlisted”. Thanks! Should work now.


#23

lol, bet that you work too hard ! Or not enough beer that I think ! lol

Edit: Working now.


#24

No beer on weekdays… :frowning: But yes, it was about 4 am. I like working at night, when the girls are sleeping. So quiet all over the house. :slight_smile:


#25

Yep , good decision. Well yes with these little mouses it can be quite busy sometimes right !lol


#26

Coding night 8 (and half of the next day!)

I got stuck on rotating incomplete groups:

image

If took me all the night and more to make them behave. :wink:

For the basic game engine to be ready, I only need the code to drop down columns, below which the cells have been destroyed.


#27

Keep it on @nwg


#28

Coding night 9

I made a progress to the board logic, but it still needs more debugging. Having it done, I’ll start with missing animations. But tonight I think I’ll have some bear instead. :slight_smile:

EDIT: it’s already to some degree playable. TBH: I didn’t expect the basic 6x6 board to be that difficult to win. :smiley:


#29

Coming up along !


#30

Coding (day &) night 10

No spectacular progress. I managed to accomplish the 6x6 board several times, but it’s not easy. :slight_smile: Wasted hours on trying to animate falling down cells, but it didn’t work as expected. I reverted recent changes and will start once again tomorrow.


#31

Coding night 11 - dropping columns

Seems to work (finally!). I’m still not sure if it’s bug free.


#32

Glad it worked out ! Good job @nwg


#33

Coding night 12 - undo & panel

Today I added undo (just 1 move back), and started coding the control panel. The buttons may finally look quite different, but the code behind them (class) looks not bad already.


#34

Some improvements ! Keep it on.


#35

Coding night 13: control panel & sound issue

The control panel class is ready:

There seem to be some problems with playing sound with Pyglet on Arch Linux. The minor one: to play compressed audio, the avbin (AUR) package is required. Alright, it may be optional, as the soundtrack is not a must in such a simple game. I’d like to add couple of sound FX, however. Uncompressed wav would be enough here. And this is the major problem:

double free or corruption (out)

Process finished with exit code 134 (interrupted by signal 6: SIGABRT)

I found the issue on the web, with no solution so far. On Void Linux the same code plays sound perfectly.

Unlucky thirteen?


#36

Sound issue resolved, at least on VM at the office. Use of the avbin7 AUR package instead of avbin allows to play mp3 and does not f.ck up .wav playback. Hooray.


#37

Great work in there @nwg


#38

Coding night 14 - optimization

Since the sound seems to be no longer an issue, tonight I focused on time tracking and resources usage. From now on the animations should look the same on each machine powerful enough to keep 60 frames per second (or more). The new_game method has been given a loop to delete sprites before creating them again.


#39

Gee, it never stops @nwg . Keep it on mate.


#40

Coding night 15 - debugging

While coding apps like games (or e.g. Android Wear watch faces), which execute some code in a loop 60 times a second, usually something goes wrong. Your app drops a frame or two, and does not check some necessary clause - for instance the mouse pointer position. This results in random errors. To me the little bastard are the most difficult to locate and fix.

The target for tonight was: drink some beer and fix rotation of incomplete groups (made of 3 cells), which happened to work improperly once 20, 50 or more mouse clicks. Both tasks accomplished. :slight_smile: