So after a few days playing around with python I noticed a few interesting things:
1) PyPy is not always the fastest!
PyPy is an version of Python with a JIT compiler that is supposed to speed-up python code dramatically. It especially is good at optimising loops but has trouble with python modules that are not pure python, but have C/C++ backend libs.
Unfortunately in my case both PyGLET and PyMunk are backed by C/C++ and the event loop of my game is handled by PyGLET and calls events on the python code.
This causes PyPy to not perform as well as CPython in my case.
2) CPython performance is weird???
With my very simple early prototype I am getting weirdly inconsistent frame-rates between runs of the exact same code.
While I usually get a nice smooth 60fps, every now and then it will only run at 20fps for no apparent reason.
This raises the possibility that the finished game will not perform as well as I would like and makes me consider dropping python in general.
Of course that has its own set of problems, while the chipmunk code can be fairly easily ported to c++, changing the windowing/graphics library to something like SDL will be a bit of a pain.
So 13 days have passed in this month and I have not posted anything. Does this mean that there is no game this month?
Well the answer to that is no, there is a game this month, I just haven’t got around to writing about it.
This is partially because I’m not that happy with what I chose to do and partially because other projects have demanded more attention.
What is this months game?
The theme for this month was “Doctor”, meaning it the game just needs to reference a doctor of some kind (whether medical or some other doctor).
This month I have chosen to follow that theme and since last month I had a lot of troubles with porting the game and was only in the end able to get it done for Mac OSX Mavericks, I have chosen to go in a much simpler direction.
And so Click Hospital was born.
Click Hospital is what you would call an idle clicker game.
Basically clicking a button earns money which then can be used to purchase things and upgrades that make more money.
There is no end-game so there are no states such as winning or loosing it just continues on, although you could consider it the end when all the possible items and upgrade and achievements are purchased (although there is no limit on the amount of each item that you can purchase, and future updates can unlock more items/upgrades/achievements).
So while the game is inherently pointless, there is something about idle clicking games that is extremely addictive.
Advantages over Space Shooter
So while Click Hospital is much simpler the Space Shooter it also has quite a few advantages.
Also because only a limited amount of logic is needed for the game to be considered playable, I can make the game available for playing earlier in the month and then expand on the content for the rest of the month.
So where is it?
Ok while I said not much is needed to be considered playable, I have not yet made it to that stage.
There is a little bit of work remaining to get it into that state, but I am quite close.
I expect to have it ready for the initial launch in the next few days so pay attention to the Games section of my website.
After signing up for the #1GAM the next thing was to decide on the three L’s: Language, Library, Location (IDE).
I have been playing around with C/C++ for a while and decided that C would be a nice low-level language to work with, and a bit of a break from OO languages which I personally think over-complicates things sometimes when there is no need to. Also has the advantage that I could make it a lot more cross-platform rather then using something like Objective-C.
Location is also an easy choice, on OS X I haven’t really found an IDE that compares to XCode, not that I think XCode is the best IDE that I have used either, but for a native IDE it seems to be the best.
Now for the library.
Interestingly the inspiration for this seem to come out of nowhere. I was looking through the MacPorts devel category and I saw Allegro. I had briefly looked at Allegro probably around 6 years ago, but at the time I was using c#.net and I didn’t want to leave that language, and ended up using SDL.net which I think put me off SDL in general (or maybe it was the bad software rendering it did by default).
I played around with it and without too much hassle I had it installed and a test project up and running.
Choosing a game
So now I had my three L’s I just had to start coding… right?
Well, without an idea of sorts to base the game around there really is nothing I could start coding for.
What sort of a game would it be?
Side-scroller? Top-down? Action? Adventure? Sports? RPG? Platformer? First-person? Third-person? The options are endless.
The optional theme for #1GAM this month is money, but not money as in in-game money, money as in making money for the game. That doesn’t really help for designing the game and I don’t think I am ready to start monetising my games yet, that can wait until I get better at making games and building more worthwhile games.
I spaced out over this for a while, and then I realised, Space, a space shooter.
Its an easy choice for a 1st game working with a new framework, no need to find/build a level editor or handcraft levels instead, I could easily generate the maps programmatically very easily, after all, it’s just stars and planets randomly placed on-top of a black background.
If I have enough time I might add in-game resources and purchasable upgrades, but thats as close to the theme as I will get.
Working with Allegro has been great and I have found it fairly easy so far. The only complaint I have is that there isn’t a docset for it in dash (an API browser that I quite like) and I have to use the online version, which can be a hassle since I do a lot of my coding on the train with little to no internet connection.
So far I have made an engine that loads all the required resources, builds the map, has a working and optimised render loop (only renders visible sprites), and has keyboard interaction that uses the dpad to scroll the viewport around the map.
Here is a screenshot of the current work-in-progress:
Next on the todo list is to add a space ship, bind the viewport to it, and work on the movement of the ship using a impulse/inertia control system.
So for any of you who haven’t heard, theres a really cool gamedev/jam site called #1GAM. It’s a site you can sign up to with the intention of building a new game every month.
But its not just that, its also a community of game developers with a massive diversity of skills and experiences who are making games, and might be willing to team up with others with different skill-sets, or just share some of their knowledge.
I encourage anyone who may be interesting in developing game, whether you are a coder like me, a 2d or 3d artist, sfx designer, musician, or writer to join up and have a go.