2D RTS Games

This is a discussion on 2D RTS Games within the Game Programming forums, part of the General Programming Boards category; I'm going to start a RTS or turn-based strategy very soon, and I had several questions: 1. I've never really ...

  1. #1
    The Defective GRAPE Lurker's Avatar
    Join Date
    Feb 2003
    Posts
    949

    2D RTS Games

    I'm going to start a RTS or turn-based strategy very soon, and I had several questions:

    1. I've never really worked on 2D games (jumped right into 3D, both good and bad) and I hear a lot about isometric maps. I think I get the generic idea, but can anyone explain them a little more?

    2. What does Starcraft use? Considering the map editor works in tiles, I'm guessing Starcraft uses isometric maps; is this true?

    3. Would I have to create something like squares and place textures on them in OpenGL, or should I use its 2D image support? Which is faster?

    Thanks all, this is really appreciated.
    Do not make direct eye contact with me.

  2. #2
    Software Developer jverkoey's Avatar
    Join Date
    Feb 2003
    Location
    University of Waterloo
    Posts
    1,903
    1. I've never really worked on 2D games (jumped right into 3D, both good and bad) and I hear a lot about isometric maps. I think I get the generic idea, but can anyone explain them a little more?
    Isometric maps are basically 2d maps that are put together to create the illusion of 3D.
    Some games that use this (and use it well) include simcity, diablo, and quite a few other games out there.
    isometric maps tend to represent a view of the map from a 45 degree angle, looking diagonally down at the units.
    http://gamedev.net/reference/list.asp?categoryid=44
    there's a bunch of gamedev.net articles relating to isometric games

  3. #3
    Confused Magos's Avatar
    Join Date
    Sep 2001
    Location
    Sweden
    Posts
    3,145
    2. What does Starcraft use? Considering the map editor works in tiles, I'm guessing Starcraft uses isometric maps; is this true?
    SC uses "normal" tiles but creates the illusion of them being isometric.
    MagosX.com

    Give a man a fish and you feed him for a day.
    Teach a man to fish and you feed him for a lifetime.

  4. #4
    l'Anziano DavidP's Avatar
    Join Date
    Aug 2001
    Location
    Plano, Texas, United States
    Posts
    2,738
    If you use a 2D API, isometric tiles are hell to work with, bluntly speaking. The math involved is horrid.

    A 3D API might actually work quite nicely with isometric tiles, although I have never tried that before. Because with a 3D API such as OpenGL you can simply use regular tiles and then do a rotation of the view to make it look isometric. Therefore you wouldnt have the same difficulties trying to calculate coordinates as you would with a 2D API.

    I have attached a image of a single isometric tile that would be used in the case of a 2D API. The first obstacle you would have to overcome is fitting a whole map of these tiles together so that they look like one whole map. In order to do that you would need to use equations as such:

    ScreenX = (GridX * TERRAIN_WIDTH) + (GridY % 2 == 0)? 0 : (TERRAIN_WIDTH / 2);
    ScreenY = (GridY * TERRAIN_HEIGHT) / 2;

    However, the problem is, you cannot use the same equations to go back. In other words, if you are trying to calculate the grid coordinate of a unit, you cannot just manipulate those equations and get the grid coordinate. Why? Well, Check out the tile I attached below. The magenta transparent sections of the tile stop you from doing that. Even though they arent blitted, they are part of the tile, and factor in to the equation of where the tile gets blitted. Therefore in order to get the real grid coordinate of a unit a 2D isometric map, you would need to do a whole series of equations dealing with right triangles, which I have not even started to figure out. I just gave up and used a square coordinate system instead of an isometric coordinate system.

    However, when I think about it, a 3D API like OpenGL would work wonderfully for using an isometric system. You can just use square tiles and then rotate a small amount to make them look isometric. It would not have any difficult math at all.

    It all depends on your preference though. Maybe I just make 2d isometric systems more complicated than they actually are. There are lots of tutorials on the net to help out with isometric tile sets, especially at gamedev.

    Good luck with your game man.
    Attached Images Attached Images  
    My Website

    "Circular logic is good because it is."

  5. #5
    Software Developer jverkoey's Avatar
    Join Date
    Feb 2003
    Location
    University of Waterloo
    Posts
    1,903
    i've heard about some tile systems that use colors to determine which tile they've selected. When the user clicks a position on the map, the map is re-rendered quickly on the backbuffer with certain colors applied to each tile, allowing you to figure which tile was clicked just by a simple color test at the position of the mouse.

    However, I'm not sure how well this would work with an isometric game, I just know that the technique has been used before, so it might be worth noting.

  6. #6
    The Defective GRAPE Lurker's Avatar
    Join Date
    Feb 2003
    Posts
    949
    Quote Originally Posted by Magos
    SC uses "normal" tiles but creates the illusion of them being isometric.
    Rotated or something? Not quite sure how else they would do that......(easily that is).
    Do not make direct eye contact with me.

  7. #7
    Confused Magos's Avatar
    Join Date
    Sep 2001
    Location
    Sweden
    Posts
    3,145
    Quote Originally Posted by Lurker
    Rotated or something? Not quite sure how else they would do that......(easily that is).
    They use small tiles that put together looks like it would be isometric.
    Proof 1 of this is the placement of buildings, where you can see the green marker not being isometric.
    Proof 2 is given in the attached screenie, where a special program has modified a map a bit to place induvidual tiles rather than using the normal placer (which actually places several tiles at once).
    Attached Images Attached Images  
    MagosX.com

    Give a man a fish and you feed him for a day.
    Teach a man to fish and you feed him for a lifetime.

  8. #8
    The Defective GRAPE Lurker's Avatar
    Join Date
    Feb 2003
    Posts
    949
    I actually thought of that when I was posting...which is why I added the "easily that is" message .
    Do not make direct eye contact with me.

  9. #9
    I am he who is the man! Stan100's Avatar
    Join Date
    Sep 2002
    Posts
    361
    The hard part isn't so much the coding as it will be drawing. Everything is skewed.
    Stan The Man. Beatles fan

    When I was a child,
    I spoke as a child,
    I thought as a child,
    I reasoned as a child.
    When I became a man,
    I put childish ways behind me"
    (the holy bible, Paul, in his first letter to the Cor. 13:11)

  10. #10
    The Defective GRAPE Lurker's Avatar
    Join Date
    Feb 2003
    Posts
    949
    That's what I meant; hard for the artists.
    Do not make direct eye contact with me.

Popular pages Recent additions subscribe to a feed

Similar Threads

  1. Best Graphics Library for 2d RTS?
    By arew264 in forum Game Programming
    Replies: 4
    Last Post: 04-18-2007, 01:05 PM
  2. Void, return... and what to use for 2D games?
    By Kenoriga in forum C Programming
    Replies: 6
    Last Post: 12-28-2006, 11:56 AM
  3. General Advice (RTS Game)
    By b00l34n in forum Game Programming
    Replies: 2
    Last Post: 05-07-2005, 01:34 PM
  4. Video Games Industry. 5 years left.
    By Cheeze-It in forum A Brief History of Cprogramming.com
    Replies: 26
    Last Post: 12-10-2002, 10:52 PM
  5. Do people still like 2d games
    By muttski in forum Game Programming
    Replies: 10
    Last Post: 04-28-2002, 10:26 AM

1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21