Take the 2-minute tour ×
Game Development Stack Exchange is a question and answer site for professional and independent game developers. It's 100% free, no registration required.

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?

share|improve this question
    
What do you mean by "somewhat 3D"? A little more information please. –  Cameron Fredman Mar 9 '13 at 21:02
    
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" –  Fredrik Boston Westman Mar 9 '13 at 21:41
    
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) –  Cameron Fredman Mar 9 '13 at 22:32
    
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 –  Fredrik Boston Westman Mar 9 '13 at 23:06
    
Maby i should edit the question abit, so its a bit clearer –  Fredrik Boston Westman Mar 9 '13 at 23:10

1 Answer 1

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.

share|improve this answer
    
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 :) ! –  Fredrik Boston Westman Mar 10 '13 at 0:41
    
I'm pretty sure even the top-down view in that game is 3D. –  Cameron Fredman Mar 10 '13 at 0:43
2  
@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. –  Nicol Bolas Mar 10 '13 at 6:58

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

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