Friday, July 23, 2010

OgrePathFinder

I was always interested in graphics/game programming, so after an XNA/Blender workshop held at the faculty I've started to look into OpenGL programming.
I had a few adventures with OpenGL and SDL, GLUT and other tools meant to make life with OpenGL easier. I have studied a few mesh loaders (obj and md2), but I soon realized the limitations of this form of development.
Then I heard about Ogre3d, the Object-Oriented Graphics Rendering Engine.
So I've looked into their tutorials and started studying it. After a few Hello World- like applications I have decided to go more in-depth. I studied the topics of Scene Managers, Scene Graphs, Lights, Cameras, Animations and whatnot.

To put things in practice I've decided to write a simulation for my own implementation of the A* algorithm, written as an assignment at the university (from a list of problems, and we could choose the complexity of our solution).

Therefore, OgrePathFinder was born.
You can find the sourcecode and binaries (for Windows and Linux, since Ogre3d is cross-platform) at the Google code page:

http://code.google.com/p/ogrepathfinder/


Here is a youtube video demonstrating the application, complete with victory dance :




I have ported the Ogre Character sample from the Samples SDK to the Ogre3D wiki tutorial framework. Most of the resources (meshes, textures whatnot) are part of the Character sample. The only thing that I modeled in blender was the obstacle cube.


The movements are based on calculating the traveled distance with vectors and with checking their bounds at every frame, so the movement is framerate dependent. I also wanted to learn collision detection so I've added raycasting too.
You can see that the bounding boxes of obstacles in front of the character appear when touched by the ray. Raycasting is used to avoid walking in the front of an obstacle.
I've also included a smaller labyrinth. Just copy labyrinth.in.2 into labyrinth.in.


The motion is framerate dependent, all bound checks take place in the main render loop, so the character could take a wrong turn at some point, and think it arrived to the goal, but Ogre is only a graphics engine and I didn't use a physics engine like PhysX or Bullet.
The application seems to work well, but this is my first Ogre project, bugs may happen.

It could help beginners in learning Ogre.

Enjoy!