Simulating 2D using 3D

I am currently tinkering with a Map Editor for a game engine I am in the process of making. I should also say that I may stop working on the map editor and focus on creating a MAXScript export script for gMAX/3DS MAX. That way I will not have to create a map editor and focus just on the engine itself. I am still trying to decide on this.

To the gamer, the Game engine will appear to be a 2D tile based game engine, but in fact it will be a full 3D engine, that uses a OrthoOffCenterLH projection matrix to render geometry on the screen in a 2D manner. The geometry itself consists of untransformed and lit 3D geometry, So that the video card handles all of the transofrmations etc.

I have written a sample demo of a map editor that demonstrates creating a simulated tile environment using untransformed and lit 3D geometry. NOTE: That this LEDemo app is a just a demo, so that I could visually play around with the basic principles of map making using 3D geometry to simulate 2D. And to give me insite as to how the actual map editor will operate when it is finished being written.

This demo also gets back the the reason(s) That I no longer suggest people use the Direct3D.Sprite class to draw 2D images on screen, but rather to use 3D untransformed geometry and render it using a OrthoOffCenterLH projection matrix.

The benifits of using OrthoOffCenterLH projection matrix and 3D untransformed geometry ...

  • A much more powerfull alternative where as the Direct3D.Sprite class calls upon the cpu to do the rotation and translation math and using 3D untransformed geometry you can push the rotation, translation, and scaling work load off onto the video card.
  • Greater oportunity to use one type of unified Vertex format throught your entire game engine.
  • Ability to use/apply vertex and pixel shaders to the geometry. (Vertex shaders do not work with the Direct3D.Sprite class)
  • Because the simulated 2D objects are actually 3D you have the ability to do deformations, and stretching effects to your geometry in ways that would be difficult or impossible to do using regular 2D.
  • Saves you from having to create, manage and draw series of textures for your animations and Allow you to replace them with 3D alternatives that are more flexible and dynamic.
  • For tile based engines, using 3D allows you to have 2 triangles representing a rectangle. Which means you dont have to store and render data for 100 tiles for example, but rather you would only need to render 2 triangles that have the tile texture texture mapped across them.

If you watch the demo and run the app you will get a better idea of what I am trying to describe.

The (1.12 mb) file includes the fallowing ...

VB.NET 2002 source code
compiled executable
3 images

Some more benefits of using 3D to simulate 2D ...

  • Ability to do zooming, panning, and scaling, quick and easy just by manipulating a matrix.
  • You can still use the same code logic for determining what tiles are visible, and where they are located on screen.
  • Allows you to have multi textured tiles.
  • You can use 3D geometry and render over top of an area to simulate lighting effects or even shadow effects.
  • Because the game uses 3D to render 2D tiles you will already be prepared to add and incorporate more 3D oriented features to the game engine in the future.
  • You could use a 3D mesh of a rotating diamond rather then having a texture or series of textures of a diamond rotating.
  • Allows you to use professional apps like gMAX or 3DS Max for creating your game levels and characters etc. Saving you from having to create your own and
    all the problems/hard work that goes with it.
  • Allows you to have multi textured tiles.
  • Allows you to do multi layered platform games like Rise of the Mushroom Kingdom

    Pay attention to the scene at the beginning when Mario comes out of the castle and starts doing exercises, then jumps into the pipe to the left of the scene. (The next sequence is what I am talking about when I say people should consider using 3D geometry to simulate 2D tiles games.) The camera then zooms back and starts to show another layer with 2 pipes on it then zooms back even more and you see a whole new layer that Mario begins to run around on.

You would be somewhat hard pressed to implement these type of game features using a traditional 2D base tile engine and still have it look good.

Created by: X

Just another personal website in this crazy online world

Name of author Dean Lunz (aka Created by: X)
Computer programming nerd, and tech geek.
About Me -- Resume