Project: “Space Trader” (Python)

Inspired by the transport tycoon type game, the complete specifics are still being debated, but effectively I’m aiming for managing a space company, with the possibility to focus on different avenues.

Pure trader – Move goods around, buy low, sell high. Don’t forget to factor in transport costs!

Research – fund new research into, mining, manufacturing and design. Then sell these technologies to other companies for royalties and/or lump sums!

Manufacturing – Take raw resources and manufacture them into different products, these products need researching so either research them yourself or buy from another company!

Reconnaissance – explore the unknown, send scout ships to map an area, or send the prospectors to find out what resources lie hidden on the planets. On behalf of your company or others; For a price!

Current aims:

  • Generate a Section of a galaxy divided into sectors, each sector is then populated with solar systems and other objects.
  • Procedurally craft a small section of a galaxy, down to the resources on a planet (albeit a little abstracted).
  • Create an economic simulation that shifts causing supply and demand to change. The effects of competing companies.

I have mainly been working on the rendering and organisation of the differing levels, so far I have achieved:

  • Animated Sprites, with customisable “tick” rate.
  • Ability to pan.
  • Parallax sprites – that when panning move in an offset fashion to normal sprites.
  • Selection of objects with mouse.
  • Randomly generated “solar systems” and “asteroid fields”, not procedurally done yet.
  • Different levels of “view” Galaxy, Sector, Solar System and Planet(or other objects), that allow for more in depth information.


Some development pics
(yayy for programmer art and

Sector view, with solar systems and asteroid fields plus debug connections

Sector view, with solar systems and asteroid fields plus debug connections

debug boxes and houses as "planets" and a planet.... oh.

debug boxes and houses as “planets” and a…. planet…. oh. Planet is my art, rest was acquired



Pyglet and ecs Part 2: Flying Around

So right now we can give entities images. However, they don’t do anything on screen other than stay very still in the location we put them. To change this we need to give the entities a Physics component this will allow for the entity to update its position.

class Physics(Component):
    def __init__(self, vx=0.0, vy=0.0, thrust=100.0, rotate_speed=100.0):
        self.vx = vx #the velocity in the x axis
        self.vy = vy #the velocity in the y axis
        self.thrust = thrust #the amount of force we can apply
        self.rotate_speed = rotate_speed #how quickly we can rotate.

We also need to build the accompanying PhysicsSystem, which will require the use of Physics component and the Transform component.
class PhysicsSystem(System):
    def __init__(self):
        self.drag = 0.4

    def update(self, dt):
        for entity, phys_comp  in self.entity_manager.pairs_for_type(Physics):
            #we need our transform component to update the position of the entity
            pos_comp= self.entity_manager.component_for_entity(entity, Transform)

            #times it by the delta time to get frame rate independent movement.
            pos_comp.x += phys_comp.vx * dt
            pos_comp.y += phys_comp.vy * dt

            #apply drag to velocity.
            phys_comp.vx -= phys_comp.vx * self.drag *dt
            phys_comp.vy -= phys_comp.vy * self.drag *dt

To get our player to start moving we need to update the entity factory create_player() method and add the system into our SystemsManager. To test the movement system is working we can give our player an initial velocity, it’s a one line addition after the other components


Project: Shop RL (Python)

This is my longest standing project – it’s a long term hobby!

The premise of this was to be a shopkeeper/adventurer, much along the likes of Recettear, however I wanted more of the permanent roguelike elements to make an appearance. So when you lose a fight, you die and that’s it! I also wanted this to cross over into other things, so if you were in debt for too long without making any payments, people would come and begin repossessing your things and even your take the shop. Ideally there would be a couple of routes out of a situation like that – sell up everything and be a full time adventurer?, sign a deal with the thieves and local thugs? Fight off all the guards who come to try and touch your stuff!

The current state of the game is not close to realising this yet, I got quite distracted with generating everything so never really made any progress on making the “game” part, plus it’s been on hiatus whilst working on my masters’ but I will come back around to it eventually.

Current features:

  • Controllable player character
  • Dungeons that are visit-able
  • Can pick up items
  • Player has skills
  • Can use some items
  • Procedurally (almost) generated a world
  • Traders go between cities
  • Cities trade with each other and have a supply and demand
  • Mini-map
  • Pathfinding – roads generated with it, and some dumb AI generate and follow paths between cities.
map generated with a few cities and dungeons, and some garish roads connecting some of the cities

map generated with a few cities and dungeons, and some garish roads connecting some of the cities

The very beginning of dungeon generation. Currently just places rectangles with a chance of touching. Along with a single “connection” (diagonal corridor in this case)

The view of the moisture in the land - this is used (eventually) for biome calculation

The view of the moisture in the land – this will be used (eventually) for biome calculation


Current (or next) goals:

  • Finish biome generation
  • Finish dungeon generation
  • City/Settlement generation


Pyglet and ecs Part 1: Small Beginnings

I am not going to go through the specifics of setting up Python/Pyglet/IDE’s and ecs, but here are the links to all the appropriate sources:

  • Python (I’m using 2.7)
  • ecs (I used pip to install it, here is an easy install for pip)
  • Pyglet I am using the development version (pyglet 1.2 alpha1), and used pip on the command line to install as per instructions on the bottom of their download page.

QuickStart Guide for Pyglet: If you’ve never used Pyglet I would advise looking through this, just to get a feel for how Pyglet works. They can probably explain the basics better than I can!

The IDE I am (experimentally) using is PyCharm, though I have used Aptana Studio standalone, and both do a very good job.

This tutorial is based heavily upon this tutorial, but I have tried to go about extracting the game into components and systems.