Archive for July, 2007

Other Todos

Tuesday, July 31st, 2007
  • Write a product() function for py3k if it isn’t already written
    • Done, patch rejected (product function not wanted as a builtin)
  • Install roundup for personal bug tracking
    • Generally use mind maps now for idea tracking, don’t really have a todo list system.
  • Investigating business object type things that are open source

(updated December 1st, 2008)

Space Invaders!

Sunday, July 29th, 2007

Here’s the space invaders type game, like I promised :)

Ryan

from livewires import *

SCREEN_WIDTH = 640
SCREEN_HEIGHT = 480

def drawplayer(x,y):
    """This function draws the player at the position x y, modify this to
    change how the player looks."""
    return circle(x,y,r=10,filled=1)

def drawenemy(x,y):
    """This function draws enemies at the position x y, modify this to change
    you the enemies look."""
    return box(x-5,y-5,x+5,y+5,colour=Colour.red,filled=1)

enemy_x = 40
enemy_y = 400

begin_graphics(width=SCREEN_WIDTH,height=SCREEN_HEIGHT,title="Game")
allow_moveables()

# This is all the stuff that happens before we begin the game.
player = drawplayer(40, 40)
enemy = drawenemy(enemy_x, enemy_y)
direction = 'right'

# Begin the game.
while True:
    keys = keys_pressed()
    if 'x1b' in keys:
        break
    if '4' in keys:
        move_by(player, -10, 0)
    elif '6' in keys:
        move_by(player, 10, 0)

    if enemy_x < SCREEN_WIDTH-10 and direction == 'right':
        move_by(enemy, 5, 0)
        enemy_x += 5
    elif enemy_x > 10 and direction == 'left':
        move_by(enemy, -5, 0)
        enemy_x -= 5
    else:
        if direction == 'right':
            direction = 'left'
        else:
            direction = 'right'

    sleep(0.1)

end_graphics()

Blender Game engine tutorial

Sunday, July 15th, 2007

Alrighty, so it’s time to learn how to use the blender game engine. First we’re going to use the links here as a starting point.

We’ll also be doing some programming with livewire, since 2D is much easier than 3D, to start out with.

First, lets look to see what blender knows about objects in the game:

Game Engine Documentation

Now, here’s an example of what we can do with what blender knows:

Blender Scripting tutorial

So, we can access the properties of any object in the blender game engine, along with the sensors and actuators. The script is run in the game main loop automatically by blender, so we don’t have to worry about that.

Programming in livewires

To start off with, we need to installl pygame and livewires on your windows machine.

Lets start out working in the interactive interpreter provided by IDLE. So lets do a quick demo of what you can do.

from livewires import *
begin_graphics()
circle(200, 200, 50)

This has drown a circle at those coordinate within the window. This PDF contains other information that you may need to do stuff with livewire and graphics. Other PDFs on the livewires library are available here.

First we’ll just get used to drawing with livewires, then we’ll be able to make a game that takes user input.

Rebuilding ubuntu box

Saturday, July 14th, 2007

Ok, so I need to rebuild my Ubuntu linux box downstairs. So what I’ll do is

  • Install USB 2.0 card
  • boot into knoppix
  • connect external hard drive
  • backup linux partition
  • run Ubuntu install CD
  • Re-install packages, getting config files and data from backed up hard drive

Then I’ll be set, and ready to start working on some cool stuff :-)

Update

I’ve succeeded in doing just that, I’m now at the last step of reinstalling old packages.

Why don’t I use office software

Saturday, July 14th, 2007

Well, I’ve noticed something very interesting.

For writing text documents, I’d rather use LyX than Openoffice writer, the only thing it really doesn’t have is an interactive grammar and spelling checker, maybe abiword will get better at that, hmm, that’s a good patch that someone [me] should submit to LyX :-)

I’ve also noticed that I get irritated with spreadsheet programs, I’m downloading scipy to run a simple run report.

I guess I just like big hammers for my tasks, but I’m not sure if that’s a bad thing :-D

Management styles

Friday, July 13th, 2007

Joel on software talks about a few management styles, the ones I have direct experience with are theĀ  command and control and identity styles. The failure of command and control style management really hit home to me, you can’t force people to do things, you have to convince them.

Some managers understand this and excel, others don’t and fail. I think this also affects how much a manager micro-manages, what level decisions are made at, and even how open to new ideas managers are. It comes down to an issue of trust, and whether a manager trusts their employees or not.

It also depends on whether the manager thinks of employees as creative individuals that just need impedances removed, or squishy machines that need to be disciplined to instill control and predictability. Whether employees are humans to be nurtured, or slaves to be dehumanized.

GIMP iwarp and morphing

Thursday, July 12th, 2007

Hmm, I really should see what the development version of the GIMP has in its iwarp plugin. In GIMP 2.2, it could definitely use some improvements, I’ve used it a lot for photo retouching, so a larger preview areas would be nice or zoom, etc. And it’d be interesting to do some graphical stuff in C.

I really want to make a user friendly morphing program, as well. Something that might be able to generate nice polygon grids to be put into xmorph or iwarp. It just needs a good UI, I’m pretty sure that xmorph already has the algorithmic code necessary. It should be an interesting GUI project, but first I need to rebuild my Ubuntu box to get KDE working again.

Ryan

Mr. Rogers isn’t what’s wrong with America

Thursday, July 12th, 2007

There recently have been a few stories about how Mr. Rogers has ruined American culture by telling children that they’re special. That’s right, we better not tell children that they are unique, self-actualized, worthy humans, capable and deserving of receiving love, or else, heaven forbid, they’ll ask for extra credit in college if they have a bad grade.

They claim that Mr. Rogers encourages a culture that ‘coddles’ children, and that this, along with allowing children to call adults by their first names, will lead to the collapse of Western Civilization, or finance professors actually having to talk to their students in a cordial manner, the article wasn’t really specific. I guess putting large economic, social, and behavioral expectations on children is coddling, nevermind medicating them into a stupor, diagnosing them with false mental illnesses and giving them stress disorders.

I think a much more dangerous cultural feature is that we’ve trained children that they cannot control how they perform, that they are born with specific intelligences and abilities that cannot be improved. This is very different than telling children that they are special and worthy. What I remember about Mr. Rogers the most is how he’d often talk about emotional issues that children had, in a calm, very rational way. Worthiness is not the same as entitlement. The difference between entitlement and worthiness is the difference between being selfish and being self-assured. Of being kind, or sucking up. Only a bitter, spiteful person would confuse the virtue with the vice.

Wiki Creole

Tuesday, July 10th, 2007

Ok, so one of my pet interests is wikis. Currently I don’t think there is any python parser for Wiki Creole, a generalized syntax for wikis. So I think I’m going to create a parser for Wiki Creole in python, using test driven development (TDD). It’ll first consist of only one function, that outputs valid XHTML. After that I might add support for custom tags, etc. Then I’ll re-implement in javascript, and then world domination :-D. It’ll also give me a chance to do some heavy lifting in javascript, does anyone know of a good javascript unit testing library?

Firebug is a lifesaver, but at the moment I can’t keep track of all of DOM and javascript in my head at once.

Ryan

New blog

Tuesday, July 10th, 2007

Well, this is my first blog post, we’ll see how this goes! Mwhahahah! Wordpress is quite nice, I wish I knew what the mark comment as spam button did, though…

Ryan