Sunday, September 23, 2007

PyWeek Postmortem


So pyweek is all over for real now and as I actually participated I guess I'll have to write a few lines about it..

My game is a story driven shoot em up with the semi-intelligent name Kill Those Junkies.

I sure as hell didn't win the contest but at least I finished the game, and I'm quite satisfied with the result.

One good thing about contests like this is the warm and constructive criticism. I really like this comment: "This game is quite disturbing..". It kind of makes me proud in some perverted way, it sure must have made an impression on that player ;)

Anyway it was really fun to participate and I'd like to thank everyone who made it possible.

Thursday, August 23, 2007

Rabbyt Tutorial

This is a basic, hello world application for Rabbyt. It'll create a window and display a sprite.


import rabbyt
import pygame
from pygame.locals import *

#setup window
rabbyt.init_display(size=(640, 480))
rabbyt.set_viewport((640, 480))

#load our sprite
mySprite = rabbyt.Sprite("test.png")

#the gameloop
keepRunning = True

while keepRunning:
#messagepump
for event in pygame.event.get():
if event.type == QUIT:
keepRunning = False
elif event.type == KEYDOWN:
if event.key == K_ESCAPE:
keepRunning = False

#the actual rendering code
rabbyt.clear() #clear the screen

mySprite.render() #render the sprite

pygame.display.flip() #flip the buffers

That's it! So, what does it really do?


import rabbyt
import pygame
from pygame.locals import *
Well, of course we need to import rabbyt, but we also need pygame because we use it to handle our window.

#setup window
rabbyt.init_display(size=(640, 480))
This line creates a window with the size 640x480 and initializes OpenGL on it.


#load our sprite
mySprite = rabbyt.Sprite("test.png")
Loads the image test.png and assigns it to a new sprite named mySprite.


rabbyt.clear() #clear the screen
Yup, just as it says, it clears the screen. It clears to black by default, but by giving a tuple with the desired rgba value (ie. (r, g, b, a) ) you get to choose which color to clear to.


mySprite.render() #render the sprite
Draws our sprite. Where it gets drawn is depending on the coordinates given in mySprite.x and mySprite.y, which determines the center of the sprite. They default to zero, which means our image will show up centered on the screen.


pygame.display.flip() #flip the buffers

This performs a OpenGL buffer swap, everything we have drawn to the backbuffer finally shows up on screen.

That'd be all that's needed to get Rabbyt up and running and drawing a sprite.

More detailed info about Rabbyt can be found at its homepage.

Got a question or just want to make yourself heard? Please drop a comment!

Rabbyt - a sprite library for Python


A few days ago I stumbled over a sprite library for Python, named Rabbyt. I've been playing around with it for a while now and I think it's quite sleek.

What's negative about this library is that it's still in a quite early state of development and the fact that there's quite a lack of documentation. But I think this is a quite good library, and it's something I've been missing.

What I wanted when first trying to get in touch with the library was a small example of how to set it up and render a simple sprite. That's why I wrote this Rabbyt tutorial.

Wednesday, August 15, 2007

Moving to Karlshamn

In a few weeks I'll be moving to Karlshamn (a tiny town in the southern part of Sweden).

If you want to know more about where I'll live, just watch this video..


Wednesday, August 8, 2007

Menu update

My everlasting journey to get a hold on better looking menus for my main project, Flippuzzle, goes on. Here's a screenshot of the main menu in the latest build.


Not quite there yet, but it's getting there. Slowly.

Tuesday, July 24, 2007

Game updated: Asteroids

After a lot of rewriting and optimizing code for Flippuzzle I felt like I needed to look at something else to keep my mind a bit sane, so I did a revisit to my Asteroids game. Since I spent the last three days optimizing rendering code, that's just what I continued doing with Asteroids.

The main bottleneck was the smoke rendering, but with some nice special case code to stiffen up the entity-management and smaller smoke textures I managed to double the framerate and make it much less CPU-hungry.

Play it at pjio.com.

Tuesday, July 17, 2007

Fleshing up with graphical effects

I got this idea about how some pretty particle-effects could improve Flippuzzle. I thought it seemed a bit overkill for a simple puzzle game, but since I had the old explosion code from Asteroids just lying around, I decided to give it a go. I figured it would be nice as some kind of reward, like showing some nice fireworks when the player makes it to the highscore table.

So, said and done I spent yesterdays evening on implementing, and tweaking it until it worked, at least a bit like it's supposed to.

Now when it's there I've realized that just simple particle effects isn't enough. The level-finished screen needs some cool animations and that is that.

I've put togheter some simple movements of the whole gaming area where it zooms out a bit and rotates around itself. It actually changes the whole feeling of the game in some strange way, to the better I hope, but I might be wrong there.

I think I'll tweak the animation a bit and see where it goes, hopefully it'll turn out fine, otherwise I guess I'll have to remove it again.

Thursday, July 12, 2007

Leveling up

I've spent some time adding more levels to my soon to be finished game Flippuzzle. Now there are almost 40 different levels to play, two or three more and I'll be happy with the amount. Besides adding a few more of them, the levels also needs to be sorted, to make sure they come in a nice and non-repetitive order.

Damn, game development is a lot of work. If anyone claims the opposite they're lying and will most likely spend eternity burning in hell for that.

But even though it's a lot of work and it seems to take forever to get the tiniest little detail finished, it's still great fun, and progress is being made.

Tuesday, July 10, 2007

IMGUI

The development of Flippuzzle is moving on smoothly and the menus looks a lot nicer and cleaner today than they did three days ago. I've put quite a lot of work into getting rid of all unnecessary menus. Earlier the player had to pass through four different screens to start a new game, now two is enough to fire it up.

I've been using the IMGUI desgin pattern for my menus, this is something that have worked really well, and that's why I'd like to tell you a few words about it.

IMGUI stands for Immediate Mode Graphical User Interface. The idea is to let the rendering and logic for the GUI melt together. This reduces needs for callbacks and event handling and therefore removes a lot of the awkward parts of GUI coding.

Button example:
if( DrawButton( "ok", 25, 25 ) )
{
//the button was clicked..
DoSomething();
}

Besides the improved readability, this makes sure you don't have to initialize/cleanup all your buttons. Just render, check for action and forget. Nice and simple.

I'm really pleased with this system. It's fast to create and edit menus and they can be as dynamic as you like them to. I recommend using IMGUI, especially when the amount of menus is quite small. The bottom line: it's ideal for most games.

For more information about IMGUI check out Casey Muratori's video on the subject at Molly Rocket.

Sunday, July 8, 2007

Introducing: Flippuzzle

A while ago I posted a screenshot from my current project with a promise to give more info about it. So, here we go!

The game is called Flippuzzle, and is a 3-dimensional puzzle game. All levels will be based on photographs taken in Greenland. I had two reasons for choosing Greenland,
1. the nature over there is simply amazing
2. I came across a lot of really nice photos for a really nice price


















Above you can see an actual ingame screenshot. The gameplay is controlled with mouse only and the goal is to get all pieces to their right position, just like with a regular jigsaw-puzzle. What differs this puzzle from regular jigsaw ones is that the pieces are linked with their neighbors and rotates with them. It sounds complicated, but it's quite logical once you get the grip of it.

The game is starting to feel quite finished now. What's left to do is:
  • Add more levels. At the moment I've got 25 but I'd like it to be somewhere around 40
  • Add music. The code for loading and playing the music is almost done, but I need to find and select some nice tunes that match the game. This is tricky.
  • Fix the menus and instructions, the menus is really unsatisfying in the current build, and the instructions simply doesn't exist.
  • Polish.
I'm hoping to get finished with the game sometime this summer, but you never know, when I started the project it was supposed to take about one moth. That's over two years ago today..

Monday, July 2, 2007

Frets on Fire

The game to play at the moment (besides my versions of Snake and Asteroids) is without any doubt Frets on Fire.



Fun, innovative and open source. There are some stability issues, but it's still a great game. If you haven't tried it yet, then you know what to do..

Thursday, June 28, 2007

Screenshot


This is a screenshot from the game I'm working on at the moment. It's a puzzle game with a Greenland:ish touch, the image shows the level selection screen.

I'll be back with more info in a few days.

Sunday, May 27, 2007

Pygame

When choosing library for my snake game I decided to use pygame, which is a SDL binding for Python with a bunch of extra game related functionalities.

Why I decided to use this library is mostly because of the fact that as soon as someone in any forum mentions python and game development in the same sentence the phrase "try pygame" has a tendency to follow.

My first impressions of pygame was that it was really handy, everything is quite straightforward and really clean. Setting up the window and drawing some simple graphics is really quick and easy.

But the performance on the other hand is extremely poor, and the only way to get reasonable framerates is by using dirtyrects, and keep optimizing in mind all the time. As soon as bigger parts of the screen needs to be redrawn the fps dropped dramatically. This is a huge pain in the ass in my opinion. I don't think I'll ever use this library for a game again, at least not without combining with opengl or any other library to do the actual drawing.

New Game: Snake

I've been using python as in-game-scripting for some of my projects and the more I've used it the more I've come to like it.

So I thought it'd be nice to write something more than just some little game logic piece in it. Maybe like a little game or something. After some thinking I decided to go for a simplistic snake game since it seemed like a quite small project, and I wouldn't have to worry about performance.

To write this game I decided to use the pygame library, I'll go into more details about this in a future post.

The game took totally about four evenings to write, but the bigger part of the time was spent learning how to use pygame correctly. The two main goals for this game were to get the controls feel quick and responsive and to have working global highscore, I want to believe I achieved them both.

I uploaded it to pjio.com, so feel free to give it a try and you're more than welcome to drop a comment with your opinions.

Thursday, May 17, 2007

Highscore

Today I added a global highscore list to my asteroids clone. I think it actually works too, or at least I hope so.

Thursday, May 10, 2007

Back on track

Last post was all about frustration, but now I'm back and more motivated than ever.. kinda. I've got a bunch of new projects ready to get started and I also found some old ones that I had forgotten about. It's not that easy to decide what to spend time on, but I think I'll go on gut feeling and choose what feels right for the moment.

Now it looks like I'll get working on a 2d sidescrolling shmup, but first I'm going to try to get support for python scripting into my game engine.

I'll get back with more information as soon as I've got something to show.

Sunday, May 6, 2007

Frustration

So, yesterday I finished a game for the first time in my life. That's great and all but now I'm all restless, but has no project to work on. With every good thing there's a downside...

I have tried to come up with some new idea but I just haven't been able to catch enough inspiration yet. But I guess it'll sort itself out soon, otherwise I'll soon be insane..

Saturday, May 5, 2007

Asteroids clone

Here's my asteroids clone, with a little help from pjio.com

Click here if your browser makes a mess of the layout and hides half the game..

First entry..

For the first time in my life I actually finished a game project. This is kind of a big thing for me since I normally get bored and start developing something new when I've finished the actual gameplayt. So to celebrate I decided to start this blog where I could keep track of progress and post my future games.

The game that I've been talking about is an Asteroids clone written in c++ with help of opengl for graphics and audiere for sound. It's far from perfect, but atlest I made it.. ;)

Wanna give it a try?