Page 1 of 1

Seeking advice: Rapid development of first Irrlicht app

Posted: Thu Feb 28, 2008 5:02 am
by merovingian
Hello,

I am currently working my way through the Irrlight tutorials. I am a total Irrlicht and 3d engine newbie. Don't even have the terminology sorted out.

I am looking to develop a simulator of an underground digger driving through a tunnel. Driving under joystick control, with collision detection if the vehicle contacts with the wall. The mine will be in a 2D plane (ie. the vehicle never goes up or down), and the tunnel ceiling height will be constant. It doesn't have to even look that great, just be good enough to give the sense of driving through a tunnel, with the mine featuring a few intersections and caverns. Driving with a kind of FPS perspective, as though I am in the driver's seat. This is a simulator for in-house testing of a commercial guidance algorithm (that prevents the human from contacting with the walls). The emphasis is on testing the navigation, not delivering top-notch gameplay.

From looking at the tutorials, I am amazed at how little code is needed on top of the engine. So I figure this should not be very difficult, apart from the fact that I really don't know yet where to start. :) None of the tutorials seem to feature this kind of driving/flight sim kind of motion. I presume it is achieved by moving the camera, but that maybe reveals my ignorance.

So anyway, I'm looking to get off to a fast start. If anyone has any broad tips about the key Irrlicht tools/APIs I should focus on, I would appreciate it. OTOH, I will also understand if I am told to RTFM.

Many thanks

Posted: Thu Feb 28, 2008 5:51 am
by TheBeef
RTFM :)

For the most part, you're going to have to learn how to do everything on your own. There are a lot of code snippets around these boards that can help, as well as tons of experts on the engine that are willing to help you out.

Maybe IrrWizard would help, but I'm not sure. Check it out!

Posted: Thu Feb 28, 2008 6:21 am
by CuteAlien
Irrlicht should be fine for that. For the joystick-support you will need an additional library, like for example SDL.

There are several ways to create the tunnels, that depends a little on what you need. The simplest way is maybe to create them in a modeling tool like Blender. But in case you need to work with real data you might also create the walls yourself. With fixed heights that is probably not too complicated.

For a start you might check the collision tutorial (number 7). You walk around, but that's rather similar to driving (at least unless you need a physical driving model). And it will already do the collisions with the floor and the wall so the main work would be to get your walls into the application.

Posted: Thu Feb 28, 2008 8:41 am
by hybrid
Creating the tunnels manually would require to create an SMesh and fill the MeshBuffers of that struct with useful data about the 3d vertices and how to create faces from those positions. A very simple tutorial about how to deal with 3d vertices is example 3. However, it lacks meshbuffer handling and texturing. But maybe you already get the basics from that and the API documentation.

Posted: Sun Mar 02, 2008 1:50 am
by merovingian
Thanks a lot for the info fellas.

The Collision tutorial was indeed very useful. In fact, all the tutorials were. Certainly, at this point, I understand how to move through the environment, and to setup collision detection.

What I don't know is how to build a tunnel or mine. From what hybrid said, this is indeed about building a "mesh"? In particular, a static mesh? I thought IrrEdit would help me out here, but it seems it only loads meshes, rather than letting me create one.

IrrWizard doesn't seem to favour my IDE (Eclipse/CDT & GCC).

I will give Blender a try right now. However, I don't follow what CuteAlien means by "in case you need to work with real data". The real mining vehicles will use a 2D range-measurement laser (operating in a horizontal plane) that will be the eyes of the guidance system. I need this in the simulator, and I see that IrrLicht includes methods for measuring distance between points - I need to measure the distance from the camera (which is the laser in effect) to the walls in a 180-degree arc with 0.5 degree angular resolution. AFAIK, this looks like it's possible with IrrLicht. I also need the vehicle velocity and acceleration to be realistic - to have appropriate inertia for a 30-tonne vehicle that never gets above 20kph. I think I can achieve this by manually setting the camera position according to my own acceleration routines, but I'm not sure if there's an easier or better way. I don't need proper physics for collisions (because they aren't supposed to happen :) )

Thanks also for the SDL tip.

hybrid, I must confess I really don't understand what you're talking about, but I will take another look at example 3. :)

Posted: Sun Mar 02, 2008 2:37 am
by CuteAlien
Can't help much with the IDE. I guess you can just use the Makefile for gcc. Maybe Eclipse can import one of the other project formats somehow?

Do you know what a mesh is? Basically a mesh is a collection of polygons which shares a material (the material contains stuff like a texture and information about lightning, filters, etc). So yes you need meshes for the tunnel.

There are several ways to create those. You can create them in a modeling tool like Blender, Maya, etc and save them in a format known to irrlicht ( like .obj or .x). Then you can load in those models (a model being a collection of meshes).

Another way is to create them by hardcoding them. You can define each polygon in your code by writing down the vertices of the corner of each polygon. This is usually fine for very, very simple models like a simple box or a pyramid, but not really workable for large terrains.

But based upon the manual coding there is a third way, which means coding your own meshes with some more automation. The extreme of this is writing a tool like modeler. But you often need a lot less information in your applications, so in your case it might be useful to write a very simple editor which just lets you define walls. So one large mesh for the floor and then create one mesh for each wall you set in your editor. Or maybe you just use a paintprogram to draw the floor layout of each wall and then create a mesh with a high based upon the color of each pixel of that floor layout. This would allow you to create the levels very fast in a paintapplication and such a converter also would not be too hard to write.

With real data I meant that you might already have the data which you need for the tunnels available in some format. If these are real tunnels then you want the data probably to be very exact. So I suppose you collected them already in some way. In that case you don't need an editor but you need to write a loader for that format which will create the meshes.

Posted: Tue Mar 04, 2008 7:02 am
by merovingian
Thanks again.

With your definition, and the Blender tutorials, I now have a much better understanding of what a mesh is.

Writing an app to automate generation of a mesh from a 2-D plan-view image would certainly work. At this moment though I don't have any data from a real mine, and am not likely to get any anytime soon. Therefore, instead of drawing 2-D maps with Gimp or Paint, I might as might as well make an imaginary 3-D mine in Blender. In the longer term, I think there will be considerable benefit in learning how to use this tool.

Anyway, I am still a total noob, but I think I know enough now to get modeling and coding, and hopefully move to educated and specific questions in new threads. :) Thanks for the kick start.