Posts Tagged ‘strategy game’

pyEmpires v0.1 is finished!

The game which I used pygame and python in writing and published as my graduation thesis, has reached v0.1. I will publish this game as soon as I choose a proper license and an SVN server. By the way, the name pyEmpires was made up and I can change it if it is taken.

Edit: Now it is GPLv3 🙂

Edit: New version avaible!

Here is a screenshot from game:



source files are here: or download directly from

You have to install these files in order to play.

Python 2.6: for Windows

Pygame: for Python 2.6 Windows

After that extract files from zip. Click Main.pyc in src folder and open it with python (2.6).

To run in *nix, just write “python Main.pyc” in that folder.

Also you can add your music (mp3 or ogg) files or their links to resources/music folder. To seperate music files played in menus and game window, music can be put in separate folders menu and game. They will be played random.


How can I Play?

Controls are similar to the click & go games like diablo2 and AoE2. Click left to select, right to send away (except orange walls) & attack. While holding left button you can draw a selection box to select multiple units.

Pressing ESC key will open menu during game. To exit, use menu option.

Objective of game

You are guiding blue collared dogs. There is a default green collared enemy dog. (colors other than blue are enemy’s).

Your dogs are default in agressive mode, so don’t be surprised if they attack enemy near without your commands. And if your unit is attacking to an enemy, enemy’s health bar will turn red from green. Your units have health bar, too.

What’s happenning at background?

It seems a basic game -probably because there’s no scenario- but at background I use some good techniques. First of them is A* algorithm. It should be improved. Second is Finite State Machines.

A* is used for finding shortest path with obstacles. It has a wide range usage in games and it relies on heuristics. I may add another post just for it later because there is much to be developed in path finding (especially group movements).

Finite State Machine (FSM) is a technique in writing artificial intelligence. It has benefits on reusing so my AI module is one of the shortest module. So what is going on in AI?

First of all with FSM’s, units are in a state and they change their states under particular conditions. These states are attack, evade, chase, etc. Conditions are enemy_near?, enemy_strong?, etc. I put these to tables, so different tables means different AI behaviors.

And the additional keys are: (valid in only your selected units)

A key – Aggressive mode
S key – Defensive mode
D key – Stand ground mode
E key – No attack mode

With these keys you can alter your selected units’ mode. And these modes are:

Aggressive mode

Unit will attack if an enemy is near. Before attacking it chases the enemy so unit’s position will be lost.

Defensive mode

Even in attack mode, unit’s base position won’t be lost. If enemy can escape (become distant to base position), or it dies, unit will return to base position.

In No Attack Mode, unit will only attack if enemy is very close to him. But in No Attack Mode, unit won’t attack at all.

Known issues:
– Save and load game doesn’t work
– There is no collision detection. So units could be overlapped. Then try num-keys to select a particular unit in a selection group.

Support and Feedback:

Anyone interested in making strategy games, could comment here or send mail to baris dot aydek at gmail dot com. I’m open making it a 3D game, code in C/C++ etc. if I can bring together a great team. And if you encounter bugs other than known issues or have a suggestion/criticism don’t afraid of dropping a comment.