So I have seen many 3D tutorials creating heightmaps and big landscapes but I am hoping there is something simple that i can throw together. If I was to do something doom/wolfenstien-like, do i just draw a cube and texture it? I guess my question is, How should i go about creating a very simple box-like room?


The topic you're asking about is more involved and broad than you might think. Drawing is only half of the problem at that point; chances are, if drawing a room is a challenge, then 3D collision detection is going to be a pretty big task.

I'd highly recommend taking a look at the XNA starter kits and seeing what you can learn from there.

The XNA Starter Kits are available at: http://creators.xna.com/en-US/education/starterkits/

To answer your original question, the XNA Creator's Club website has a code sample for drawing 3D primitives at: http://creators.xna.com/en-US/sample/primitives3D

And this howto (for XNA 1.0, but with the right concepts) is fundamental to moving forward: http://msdn.microsoft.com/en-us/library/bb464051(XNAGameStudio.10).aspx

  • \$\begingroup\$ you may have answered my question but some clarification. If the answer is primatives then I get it. My question meant to say, "is this how I should go about it?". I kno wI have to add collision but at this point I just wanted ot be directed down the "right road". So if your answer is.. "use primitives" then I will mark this as the answer. \$\endgroup\$ – Jonathan Kaufman Aug 11 '10 at 17:37

In theory you can build the entire level in some 3D editor (MAX, Blender etc), export it as a single model and draw it using the methods explained in XNA's 3D game tutorial.

This is not what you want, unless we are dealing with very small spaces.

Usually the world geometry is partitioned for (mainly) the following reasons:

  1. Ensure you do not have to push more geometry than necessary to the hardware. There is no poing drawing the entire level if you are inside a room with all the doors closed.
  2. Limit the number of polygons you need to test for collision detection etc.

The two main techniques used for this purpose in indoor scenes are binary space partitioning (BSP), used by doom/quake and friends, and portal/cell (of Unreal fame). There are advantages and disadvantages to both techniques. Both are a substantial amount of work to implement from first principles.

I recommend you base your work on an existing engine that does this for you.


If you drew a cube and textured it you would have a cube, not a room. I don't know how XNA define "primitive", but what you should be doing is drawing polygons to form a square or a rectangle for a single wall of your corridor.

  • \$\begingroup\$ Also keep in mind that polygons in 3D graphics are generally (unless otherwise specified) single sided. If you draw a cube you can only see it from the outside, not from the inside. \$\endgroup\$ – drxzcl Aug 12 '10 at 12:15

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.