Archived

This topic is now archived and is closed to further replies.

DesertEagle

Using x-files as levels

Recommended Posts

Hello everybody. I am building a 3D engine at the moment, but I don''t know how to make a good level editor for it. My solutions is to build my level in 3D Max Studio and then export it to an x-file and load it as a mesh in my game. My questions are: - Is this possible? I mean, it would be a huge mesh! - Does somebody know a way to walk around in it with collision detection. I mean : if you have a room with a table in the middle, you must be able to walk in that room, but not trough the walls or the table. So the collision detections mustn''t be on the whole mesh, but on each separate face of it. (It''s a little difficult to understand, but I don''t know how to say it in an other way.) If somebody can help me or knows a tutorial or other info about it, I would really appreciate it.

Share this post


Link to post
Share on other sites
You could use the mesh-object to do collision detection. I'd advice you to split the mesh up into 3 different meshes. The floor mesh, wallmesh, object meshes. You could even make a different collision mesh, which is much more low polygon than the mesh you'd render.

[edit] then than then than.. than.


.lick


[edited by - Pipo DeClown on August 7, 2003 2:38:00 PM]

Share this post


Link to post
Share on other sites
Thanks for the reply, it''s really good advice.
The only problem is how to position the three separate meshes.
If it would exists out of one mesh, I could use 3DS Max as a level editor and I would know exactly where everything is and how it looks, but with three meshes 3DS Max will save it as one single X-file(or mesh, whatever) so the problem will be the same, or did I missed something in 3DS Max?

Share this post


Link to post
Share on other sites
Can you make 3 separate X files for floors/walls/ceilings?

This should work fine for small levels (a few of rooms'' worth of data), but once your levels grow the cost of doing collision detecting/rendering/etc from only a couple of meshes could easily kill your performance, unless there''s a way to do culling on meshes of which I''m unaware.

Also, I don''t know what would happen if the number of vertices in the level exceeded the maximium index buffer size? If the minimum-spec target system is required to support 32-bit index buffers, you should be fine - if it only supports D3DFMT_INDEX16, you''d be limited to 64K index-ible vertices. Not sure if this is an issue for you.

However, barring possible index buffer limitations, you could save your level data to an X file, load it into a mesh in your game engine, then pull out the geometry from the mesh into your own vertex/index buffers (optionally discarding the mesh at that point). This way you could dump the data into a system more optimized for large levels (BSP/Octree/etc).

I don''t believe anything but the 16-bit index buffers would be a problem with very large X files.

Collision: If you wanted to keep the D3DXMesh to support collision detection, you could break the giant level-mesh into smaller meshes - that would give you the advantage of d3d mesh functions for collision detection and still keep your level in manageable chunks where you can eliminate geometry that you know you don''t need to test.

Or, if you''re looking at doing your own collision detection, you might want to look at the Source Code section at http://www.fluidstudios.com/publications.html for the collision detection algorithm w/examples. I have not yet implemented collision detection for level data myself, but this is where I intend to start once I reach that point.

Hope this helps

Share this post


Link to post
Share on other sites
This is very posible, you can create your level, load it in your program, if it is too big, you always can use Octrees to divide it.

If you create separate meshes in max, for collision detection, remember that the mesh is saved with reference to the origin so your position and defaz is saved too to your file.

Hope this help.

---------------------------------------------
If God with me, Who against me?
Sitio de desarrollo de videojuegos en español
Digital Moon Studio...

There is no spoon

Share this post


Link to post
Share on other sites