Level Creation in Direct3D and 3DSMAX

Started by
5 comments, last by Nads 16 years, 3 months ago
Hello members of gamedev, I am just starting to make my first 3D game in Direct X using C++. Previously, I have experience in creating 2D games using directX and other languages like J2ME for mobile phones. I have also done a mod of Half Life 2 in 3D which included coding, scripting and modelling! The reason for me starting this new game demo is basically to learn 3D game development and also to have something to show on my portfolio as every company ive applied to has asked for a 3d demo. ------------------------------------------------------------------------------- Anyway going back to my reason for posting this topic! My question is to do with getting a level developed in Direct3D. Is it possible to create all the level objects (Eg. Houses, trees, other objects etc..) in one scene in 3DSMAX and then export that one scene as a .x mesh for directX to load into the game? The reason I ask this is because its very tedious and long to build a level directly in directX by loading in seperate meshes for each object, simply because you might have so many of the same trees and houses but at different locations! I know in mods you already have a level creator like HAMMER (half life 2) and you use that to place any number of same objects in the level, which makes it really fast as you dont have to code in each object. If I have missed out any finer details then please do ask. I hope to hear back from all you useful people here on gamedev with any sujjestions. Thanks alot.
Advertisement
Quote:
My question is to do with getting a level developed in Direct3D. Is it possible to create all the level objects (Eg. Houses, trees, other objects etc..) in one scene in 3DSMAX and then export that one scene as a .x mesh for directX to load into the game?

Yes. However, unless the scene in your demo (and thus, your level) is very small and trivial in terms of interactivity, you won't want to do this. X files are good for models, but bad for large level geometry. Extra processing of the file or worse, the in-memory mesh, is required to efficiently perform culling, collision testing, et cetera usually required of level geometry.

Quote:
The reason I ask this is because its very tedious and long to build a level directly in directX by loading in seperate meshes for each object, simply because you might have so many of the same trees and houses but at different locations!

Most 3D frameworks, even the basic ones, support automatically caching duplicate resource data via "resource instance" type objects (so for a model, you might have one copy of the geometry data, but two different model instances with different world transforms -- those instances simply point to the immutable, shared model geometry).

Quote:
I know in mods you already have a level creator like HAMMER (half life 2) and you use that to place any number of same objects in the level, which makes it really fast as you dont have to code in each object.

Which leads me to my suggestion: use Hammer, and load the HL2 level data.

Be careful with this project, in general. The projects one writes to learn the complexities of 3D graphics are frequently very poor quality -- remember the first few programs you ever wrote? Yeah.

Understanding 3D graphics is not strictly required for the industry -- it helps, certainly, but it's possible to get by with just a passing familiarity of the domain if your actual area of interest is AI or game logic, et cetera.
Quote:
Original post by jpetrie
Which leads me to my suggestion: use Hammer, and load the HL2 level data.


Do you know where one might find the specs of the HL2 file format (or even of HL1)? I've tried googling but with no luck.
jpetrie, thanks alot for your help. Your answer definetly provided me with what I wanted to know.

But that also leads me to another question, you said that I can create a level in Hammer and then export that into my direct X game? Is that possible, what do I need to convert it to? .X format or another format, I know Unreal uses .bsp formats cant remember if its the same for Hammer.

Is it also possible to load in a self made developed level from UnrealEd 3.0 (the one that comes with Gears of War) into direct3D? and then build on that?

If the answer to the above question is yes then that leads to unimaginable branches that I can explore. Eg. I can do the graphics using UnrealEd without having to do my own models in 3DSMAX and then just concentrate my DirectX code on more specific topics like enemy AI and gameplay!!

Is my sense of thinking correct?

Thanks
Quote:
Do you know where one might find the specs of the HL2 file format (or even of HL1)? I've tried googling but with no luck.

HL2 uses a BSP format; the Google query you want is "Half-Life 2 BSP format" or similar. There's some cruft in the results, frequently sites related to actually downloading maps rather than detailing the format, but it's a good base.

Valve's Developer wiki on BSP and this linked article in particular are some options.

Quote:
But that also leads me to another question, you said that I can create a level in Hammer and then export that into my direct X game? Is that possible, what do I need to convert it to? .X format or another format, I know Unreal uses .bsp formats cant remember if its the same for Hammer.

No, you want to export the level exactly as you might a level for any HL2 mod. You'll need to write a loader for the HL2 BSP format in your code. While this might seem like a lot of work, if you need to do anything interesting with the level data beyond simply displaying it (inefficiently, I might add), it will be worth it.

Quote:
Is it also possible to load in a self made developed level from UnrealEd 3.0 (the one that comes with Gears of War) into direct3D? and then build on that?

If the answer to the above question is yes then that leads to unimaginable branches that I can explore. Eg. I can do the graphics using UnrealEd without having to do my own models in 3DSMAX and then just concentrate my DirectX code on more specific topics like enemy AI and gameplay!!

Is my sense of thinking correct?

Basically. But you don't "load things into Direct3D." You have read the data files and parse their format yourself, and translate that into the creation of vertex and index buffers and all that stuff to send to D3D. That's how 3D graphics work; graphics APIs are just set up to take submission of a collection of vertices and optionally some indices and render states and draw those on the screen. All that higher level stuff -- level or model loading, animation, culling, collision, et cetera -- you need to do that yourself. Or use a third-party framework.
Quote:
Original post by jpetrie
Valve's Developer wiki on BSP and this linked article in particular are some options.


Thanks, that's just what I wanted.

thanks again jpetrie, sorry hadnt been able to get back sooner.

Your advice is definetly useful.

If others do have any of their own advice on this topic then please do add.

Thank you.

This topic is closed to new replies.

Advertisement