About XrXr

Entries

 
Ludum Dare 30
 
MiniLD #51
 
Ludum Dare 29

XrXr's Trophies

XrXr's Archive

Rapid Pygame!

Posted by
Tuesday, June 3rd, 2014 8:02 am

LD 29 is the first LD that I participated in. The jam went okay, beside not having a great idea, I didn’t get to finish all that I wanted to do. The game didn’t do too well in the rankings, but its not a big deal. Every time I make a game using Pygame, I find myself typing in the same thing over and over, wasting time. That’s why I made Rapid Pygame for MiniLD 51.

Rapid Pygame is a set of classes and tools that help accelerate the game development process when using Pygame, letting the developers to focus on game play features rather than the tiny building blocks behind the scene. It requires Python 3+ (Its time to move on)

Now of course, since Pygame uses Python, no body is going to use it, let alone this library. However I did spent a lot of time writing the docs for this project.

Enough words! Lets see what it can do!

Painless relative loading

Games load stuff. Images, sound, levels… And its pretty common to load a file relative to the executable or script. How do you do it in Pygame normally?

1

(Getting the path of the script, and then use os.path.join to join together path names. Loading from “./” wouldn’t always work since its relative to the current working directory)

Its fairly easy to read and understand, but its long and kind of messy.

Enter the ImageLoader class

2
Easier to read and understand. Loading using the instance is all relative to the path given in the constructor. Cross-platform relative path loading made easier.

It would be a pretty boring helper class if that’s all it can do. ImageLoader is also capable of  other things outline here. Loading all images in a folder, loading a sequence of images and giving back a path string relative to the origin if you don’t want to load an image.

Collision powered level manager

One approach of managing a map in games is using collision, the player can move around, as long as he/she is not colliding with the level. Its intuitive and powerful. Rapid Pygame provides a way of quickly getting a level up and running.

3

This will produce a level that a player can move around in (left right and jump). The level manager will take care of gravity, player movement and level collision. Pretty simple right? A 60 line basic game :). This will become even shorter and simpler in future version of the library. The details about the level format and the player class can all be found in the docs.

Behind the scenes

That’s pretty much all the features of the library, other than the pre-made Player class that renders animation for you.  Below is a bit about how the level manager behind the scenes.

One thing the level manger do is take the level landscape, and break it down into rectangles, which are then used for collision checking with the player. I’ve made some improvement to the algorithm compare to the old ones I used in the past. Each block represents a rectangle

The old approach is to break the level down into strips either vertically or horizontally.

3_result            1_result

The algorithm in the library will try to maximize the area of the rectangles, producing fewer rectangles for faster collision checking

4_result

Although its not prefect

2_result

Both methods are probably fast enough to not have a real impact on the game’s performance, but its nice to know that the algorithm that powers the manager is semi-smart XD

 

Well, hopefully I didn’t just waste my time typing this up, even though I highly doubt it. Thanks for reading and good luck to everyone in your future LD endeavors! Whether you use Pygame or not

First LD finished!

Posted by
Monday, April 28th, 2014 8:53 pm

Everything went well! Even though I didn’t get to implement all the things I planned, it was still a great experience, and the product is playable!

I could of finished everything, had I not take too many breaks and slept for too long. Since the reason for a imperfect finish was time management incompetence, I feel pretty good 😀

you died(I might be happy with the product, but the game is still not fully done)

Hope everyone is proud of their product and enjoyed their ride!

Going to play a few more games then its bed time :)

End of day 2 – progress update!

Posted by
Sunday, April 27th, 2014 10:47 pm

I didn’t get as much work as I would like done today, but still got a sizable amount of work done.

The game is almost releasable as it is, but I would like to add a few more game play features before I’m comfortable calling it “done”

I’m pretty excited to add the stuff that I originally planed, hopefully they come to come to fruition!

(this is a gif)

update 4

Also congrats to everyone who finished the compo! Hopefully everyone had fun.

Bed time. Tomorrow is the homestretch!

Progress update!

Posted by
Sunday, April 27th, 2014 12:23 pm

 

 

Things have been going well, if I can get a few more things done today, then I’m golden 😀 (I’m doing the jam)

(Its a gif)

update-3

 

This actually kind of look like a game now!

Off to lunch!

 

End of day 1

Posted by
Saturday, April 26th, 2014 9:31 pm

I drew some sprites and one background. In many ways, drawing these is much harder than coding.

I call this art style kindergartner can do better

This game is coming together quite nicely though, heck, I might even be able to finish this one with some spare time.

(this is a gif)

ezgif-save

 

I promise it will have something to do with the theme at some point. (I do have something in mind)

A few more miscellaneous things and I’m calling it a day 😀 good luck everyone!

Progress

Posted by
Saturday, April 26th, 2014 3:13 pm

Making another platformer, cause I’m uninspired

Got the controls and collision stuff working 😀

(this is a gif)

1

This is my first LD! Even though this is a virtual event, I can certainly feel the atmosphere. (not as strong as a physical event, but still). I know I’m going to have a lot of fun!

I’ve been to a couple gamejam/hackathons and have a reputation of not getting things done. I’m doing the jam, since it gives me more time.

My goal for this LD is to have something that someone can call “done”. Probably not going to be anything amazing at all.

Hope everyone have fun coding/drawing/designing! 😀

 

 

[cache: storing page]