Tuesday, February 23, 2016

OnceAnHour

Hi folks,

On Friday I decided I wanted a very simple timer for my desktop. Today I have an idle game with a timer as an added bonus.

The "game" is quite simple. It's a barebones console window that will, at regular intervals, popup a window and progress you forward in the game when you "Ok" the popup away.

The game features a config.txt file that allows you to modify most of the prominent values in the game. Like how long it takes for the game to update, if the game generates a popup at all, what the popup says, and a variety of strings.

You can download OnceAnHour for Windows here.

The remainder of this post is about the source code for OnceAnHour.

The game is written in Python 2.7 and uses a handful of builtin modules. It's wrapped into an .exe via py2exe.

Most of what I'd like to improve with the game has very little to do with the game itself. It was written rather hastily and features a variety of anti-Python elements (notably, it's classless). I'm also working on exposing more of the game in the config file. The end goal is to rewrite it to fully integrate Class and expose as much as is reasonable to the config file.

Edit: the crossed out paragraph is no longer as relevant as of 2/25/2016. A central Player class replaced the vast majority of globals and greatly improved the readability of the project.

The game is not cross-platform because it uses "ctypes.windll.user32.MessageBoxA" to generate the popup window. I believe this is relatively easy to solve by using something like Tkinter instead, but I haven't Googled enough about it yet to be certain.

You can download OnceAnHour's source here.

Edit: you can now view OnceAnHour's source on GitHub.


No comments:

Post a Comment