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!

7 comments:

roger said...

Im going to save this code in my reference lib! Well, as soon as I can get it via some external proxy (Google Code is blocked to my country).

Balázs Béla said...

I'm sorry to hear that they block google code. I could post it on some file upload site.

roger said...

That would be great!

Balázs Béla said...

Here you go:

http://dl.transfer.ro/OgrePathFinder-Win32-transfer_RO-26jul-ffc1e6.zip


I hope it's not blocked.

roger said...

Downloading rigth now! Thanks a lot.

夢癡 said...

hi! i am making cross engine game develope platform, welcome my website.

小D said...

Hey! I'm a student from Taiwan study in Computer Science like u! I have been working on a game project which uses Ogre as a render engine. Maybe we could discuss and provide information to each other. My MSN is titiu34@yahoo.com.tw and my e mail is titiu34@gmail.com. It's really nice to meet u!