0
\$\begingroup\$

How do I make a camera for a strategy game? Think something in the style of Warcraft 3, so you can lower the camera angel and view the world in a somewhat 3D format. Do I need to have some coordinate system where you put every single unit, building, etc., in it and then use an algorithm for the camera to render everything between certain coordinates?

Edit: To clearify the question abit more. How do you render the graphics for a strategy game when the map of the game is bigger then what the players camera view is?

\$\endgroup\$
5
  • \$\begingroup\$ What do you mean by "somewhat 3D"? A little more information please. \$\endgroup\$ Commented Mar 9, 2013 at 21:02
  • \$\begingroup\$ Like wc3(Warcraft 3), wc3 is only counted as a 3d game due to a technicality. In wc3 you can scroll and the camera changes angle, so insteed of looking from they sky (like a 90 degree angle) you can look from another prespectiv closer to the ground (like a 20 degree angle maby). That little effect makes it per definition a 3D game. Otherwise it would be more of a emulated 3D game. That is what i ment of " somewhat 3d" \$\endgroup\$ Commented Mar 9, 2013 at 21:41
  • \$\begingroup\$ Do you mean like this video? If not, do you have some other link, image, or video so you can show us what you mean by somewhat 3D (for those less familiar with warcraft 3) \$\endgroup\$ Commented Mar 9, 2013 at 22:32
  • \$\begingroup\$ yh exactly :) as you can see in 3:50 there is a sequence where the camra angle lowers, you can do this in game as well and go even lower, tho not all the way down to 0 degrees. Anyway dont get to hung up about that, just a little additional detail that is intresting to know. Im mostly intresteed in how the render the the things you see in the camra in general, when the map is bigger then your camera view \$\endgroup\$ Commented Mar 9, 2013 at 23:06
  • \$\begingroup\$ Maby i should edit the question abit, so its a bit clearer \$\endgroup\$ Commented Mar 9, 2013 at 23:10

1 Answer 1

1
\$\begingroup\$

Having discussed it with you, I believe your question is simply "How do I implement a 3D camera in directX?" The principles are the same regardless of the genre of the game (i.e., the "strategy game" detail is not relevant). And the example video we looked at together is just 3D, not "somewhat 3D".1

In any event, how to implement a camera is something that comes up quite a bit. This answer from Josh Petrie is pretty good and has some handy tutorial links:

There are several ways of going about this (see tutorials here, here and here for example, with plenty more available on the Internet via Google). The technology used in the resources you may find online may vary slightly (in terms of D3D, XNA, OpenGL, et cetera), but the underlying principles are going to be the same:

  • your camera object maintains its position and its direction, and optionally another pair of vectors that, alongside the direction, form an orthogonal basis for the camera's coordinate system.

  • your camera's public API exposes methods for yawing, pitching, and optionally rolling the camera around it's basis vectors -- the act of adjusting the camera orientation will update the basis vectors for subsequent use.

You can elect to store the vectors directly, or recompute the underlying view matrix every time, as you need and prefer. There's a lot of flexibility to the technique, so if you need help beyond those general steps you may want to post a new question with a more specific query.

1It may be that you're thinking of that video (at 3:50) as not truly 3D because the game does not give the player control over the camera.

\$\endgroup\$
3
  • \$\begingroup\$ Thanks :) and you can controll the camera, change the angle by scrolling. Tho if they wouldnt have added that little thing it would have been a 2D game, thats why i argued that its a 3D like effect. Just a cheap way to be able to call it a 3D game. Most true 3D game have diffrent floors ect you can be on . Anyway it dosnt matter. Thanks for pointing me in the rigth direction :) ! \$\endgroup\$ Commented Mar 10, 2013 at 0:41
  • \$\begingroup\$ I'm pretty sure even the top-down view in that game is 3D. \$\endgroup\$ Commented Mar 10, 2013 at 0:43
  • 2
    \$\begingroup\$ @FredrikBostonWestman: WC3 is rendered in 3D. It does not have a "3D like effect"; it has actual 3D effects. The gameplay is only 2-dimensional, but how you render the gameplay and how the gameplay works are two different things. \$\endgroup\$ Commented Mar 10, 2013 at 6:58

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .