lunes, 14 de julio de 2008

Carcode 3.0 Alpha1

Carcode is an experiment in programming education. The idea is to give beginning programmers carcode, which provides an animated car they can drive around the screen either using the keyboard, or programmatically through a simple API. By working on a series of problems (such as "park the car in parking space A"), beginners learn to program in an engaging, and goal-driven environment they already have much familiarity with.

The first version derived from GSOC 2008 code has been released, is an alpha release with a good and working code base but it is still not feature complete, you can however try it out and experiment with it.

Major features in this release:
  • Level scripting capabilities
  • Car scripting capabilities
  • Car sensors
  • Widgets for in game UI and dialogs
  • Few examples of scripting in demos directory
Downloads:
http://code.google.com/p/carcode/downloads/list

Issue Tracker:
http://code.google.com/p/carcode/issues/list

Don't forget to send feedback!, use the tag Milestone-Alpha1 when sending a new issue in the tracker.

This release has been out for a few days however there has been some heavy rain and electric storms in my area which delayed my work a few days, but I'm in working shape again (I hope there is no more storms for now).

Next thing to do is to add the event tracking system, add support for adding conditions and goals to the level and refine scripting in general, a few UI enhancements and I'll do another release.

miércoles, 2 de julio de 2008

GUI branch

After working a few days on my GUI branch of carcode, I got some interesting results, I completed a basic set of widgets that integrates well with carcode, I did a main menu and a file dialog to open script files:

It was interesting to work on this, I wanted once to create my own toolkit, based on SDL and C, but it ended up being a bit time consuming, this time was very simple and fast, using python + pygame + OpenGL to do all.

OpenGL has many useful features, for example Stencil buffers, I make use of them for clipping widgets inside windows or other widgets, even having multiple widgets that make use of it inside other widgets works fine, you just need to take care of how many times the buffer has been written.

Well, midterms are approaching but the project is on schedule, even better than I expected.

lunes, 30 de junio de 2008

Choice of tools

All projects use different tools, carcode is hosted on Google Code and uses Subversion, being coded in Python it is cross-platform.

I use Linux (Madriva 2008 Spring) and Git for versioning with git-svn for carcode subversion push, as for IDE I use a plain editor, Kate, I used VIM before but found Kate a bit more productive. I also like Nedit. I tried Eclipse + Pydev but I find it too big and I don't use most of the features it offers. I tried KDevelop but I didn't like it, it feels like a plain editor (for python, for C++ Qt is a good IDE), I tried Wings trial which I found comfortable but is not OSS although its price is affordable.

I usually don't use autocompletion features that offers certain IDEs, I know OpenGL well and have books at hand (OpenGL Game Programming), pygame documentation is all I need, any other thing missing may be found in the python shell by using dir() on the object, help() or internet.

As for development machine currently I'm using an HP pavilion dv6000 series laptop, which has an Intel core 2 duo processor (1.8ghz), I started working on the project on my later HP Pavilion ze4900 with a Celeron M (1.4ghz), I have an old test machine, an IBM ThinkPad 460XL with a Pentium 133Mhz just for the kicks, I tested other projects of mine on this machine when optimizing. Is really handy for that :).

As for Windows development I have windows XP dual-boot, I use Eric4 and msys-git (a windows port of git using msys), although I barely use windows, mostly rare windows development and some games that don't have a windows port or don't run under wine, but I usually buy games with linux support (such as doom3 or Neverwinter Nights) or play OSS games.

Additionally I have a host of virtual machines, one with Ubuntu (for deb packaging), other with OpenBSD and other with ReactOS, I will probably add more later (FreeBSD).

What do you use?

domingo, 29 de junio de 2008

Carcode GUI

At the beginning of the project I wanted to use PGU library to create a nice GUI for carcode, however, after moving to OpenGL it seems that pygame refuses to blit to screen surface when OpenGL is enabled, thus I had two options, look for a workaround and use PGU or to use an library which renders with OpenGL.

A workaround may implicate disabling OpenGL support from surface after arena drawing code, looking around it seems that the problem is with SDL and thus a workaround is discarted, it may be worth but it can be too much effort and time, it will complicate distrubution too. Anyways, PGU hasn't been updated since 2007, go figure.

Looking for an OpenGL compatible library doesn't gives much hope, there is a couple that may do but that would be another dependency, I will keep checking if I find something useful.

Meanwhile I created a branch to work on create a set of GUI widgets for carcode, is not that difficult and we don't need them to be very complex, currently I have labels (text), buttons, lists (listbox) and text inputs (simple one line inputs) working and integrated with carcode all this using OpenGL.

Additionally I'm looking at Box2D, a 2D physics library which has python bindings, I will create a branch to play with it later probably after GSOC is over.

When the project is more or less featureful I will start working with performance, there are many places where I can improve, specially OpenGL rendering code which has many optimizations available.

sábado, 28 de junio de 2008

Carcode improvements

Since last post I have already make good advances with carcode, collision is now working, I started using the Separating Axis Theorem (SAT) for collision, it works with boxes but it will be extended to polygons and other figures later on.

Also I have enabled car scripting, I did a small demo where you have a path and 2 sensors, the script uses sensor information to try to follow the path, it is a very simple script, it just steers the car according sensor data.

A few new entities have been added for level scripts, such as Box and Text, there is the object Console where you can write some text to the screen.

Currently I'm working on windows support, fixing things here and there and improving py2exe support which works pretty well (unless you install pyOpenGL 3.0). I have implemented game pause.

Next step will be providing packages for any brave testers :), improve collision detection, improve car scripting, create levels, improve UI.

miércoles, 18 de junio de 2008

Math

It has been a while since I had to use math a bit more complex than just your common arithmetic, for collision detection I had to sharpen my skills again, I worked all night with pen and paper aided by a simple plotting script to check results.

I got a full page packed with formulas to solve finite line intersection, then circle with circle (pretty easy) and finally line with circle, there was where everything went wrong and very messy; I ended opening one of my old math books which had an easier solution for line on circle by using determinants instead of the direct approach I was using.

Probably the small script I used for plotting could be released as a project, I called it glPlot, which could be a cool project, an OpenGL plotting canvas with python scripting where you could easily visualize data and parametric functions, it can already zoom and move trough the 2D space.

Anyways, I will incorporate the intersection code to carcode collision module this night and do a few demos later.

domingo, 15 de junio de 2008

Code updates

My semester officially ended the last Friday, finally free!, I'll be going back to home today for Fathers day.

Now about some code updates, I redid the basic tracer lines code for OpenGL, which consist of creating a series of lines given the movement of the car from Pos1 to Pos2, of course this could potentially waste a lot of resources, however, each new line is compared with previous one and if they have the same angle the previous line is just extended, additionally you can turn the tracer on and off, here is a nice example of things you can do with it :)Tracer lines are mostly done, and so are sensors, next thing is car scripting, I still not very sure on what approach to take, I could just load the script and execute it each time the car is updated, other way could be by using events, having the user hook to specific events (update, sensor, etc.), or just have them create a class where the function update is called each time the car updates, and so on, this last approach has the advantage that you can use the class for storage (variables). Who knows, I will probably just branch and take all approaches and see what works best then merge it with HEAD and be done with it :)