2D Graphics library

    This site uses cookies. By continuing to browse this site, you are agreeing to our Cookie Policy.

    • 2D Graphics library

      Having read game code 4 in its entirety now, I'm eager to start making some projects of my own. However after some research I' still not sure as to what 2D graphics library to use. I'm torn between doing some OpenGL 2D, Direct3D or allegro. I think I am going to try OpneGL 2D after reading www3.ntu.edu.sg/home/ehchua/pr…engl/CG_Introduction.html

      The reasoning behind this in my head is that OpenGL for 2D will help me move on to 3D projects as I will already be familiarized with the library. Moreover OpenGL is cross platform so it doesn't limit me to windows.

      However being new and inexperienced I am curious to know whether this is recommended and what others have used for 2D graphics.
    • My personal opinion is that if you want to go 3D eventually, then just do it. Don't waste time working with 2D unless that's what you want to do, or graphics arn't the goal.

      Rez works with a 2D renderer because he's more concerned with the AI and other aspects. So going 2D reduces the complexity for his projects.
    • OpenGL is a great platform for 2D as well, it gives you hardware accelerated sprites which can be really fast if you do it right, I actually use it for my own project at the moment. As I tell anyone, I am always willing to help people with OpenGL if they wish, as well as I know of quite a few learning resources I used back when I learned OpenGL.
      PC - Custom Built
      CPU: 3rd Gen. Intel i7 3770 3.4Ghz
      GPU: ATI Radeon HD 7959 3GB
      RAM: 16GB

      Laptop - Alienware M17x
      CPU: 3rd Gen. Intel i7 - Ivy Bridge
      GPU: NVIDIA GeForce GTX 660M - 2GB GDDR5
      RAM: 8GB Dual Channel DDR3 @ 1600mhz
    • Originally posted by Kl1X
      My personal opinion is that if you want to go 3D eventually, then just do it. Don't waste time working with 2D unless that's what you want to do, or graphics arn't the goal.


      I STRONGLY disagree with this. You have to look at your goal. Unless you specifically want to be a graphics programmer, you shouldn't bother with 3D. It adds a layer of complexity that isn't worth it. If you want to do gameplay, just make 2D games. I know tons of people who spend their time just trying to get their 3D world to work and look decent. If you really want 3D, use an existing engine like Unity or Ogre3D.

      If you're new, you want to start out REALLY small. Make and FINISH a simple 2D game using a simple engine. Make Tetris or Space Invaders. More people fail at game development because they bite off more than they can chew than anything else.

      -Rez
    • Yes, this article is great! Man, if I had a dollar for every person who told me they were going to make an MMO, i'd never have to work another day in my life.

      -Rez
    • Originally posted by rezination
      I STRONGLY disagree with this. You have to look at your goal. Unless you specifically want to be a graphics programmer, you shouldn't bother with 3D.


      And if I want to become graphics programmer can I still use some 3d party engines (like UDK for example) to make something beautiful and still persuade employer to take me as a graphics programmer? I'm just thinking about this lately. My plan is to make 2d game of my own and then jump to UDK and create some 3d visuals as another project. Because implementing nice 3d renderer in bounded time is just something impossible in my head :)

      What's your advice on this, should I do just 3d myself and ignore UDK/Unity3d/whatever or my plan is OK?
      Looking for a job!
      My LinkedIn Profile
    • If you want to be a graphics programmer, you need to write all the graphics code from scratch. Sure, you can use UDK or something, but that doesn't really count. Graphics is all about complex math and optimization. You need to prove that you can do it.

      This goes for everything. If you want to be an AI programmer, you probably shouldn't use an off-the-shelf path finding system or any AI engine. You should write your own. Everything else can be third party.

      -Rez
    • Thanks for your help, I think that I will probably use OpenGL for 2D development as I think it keeps my options open and there seems to be a lot of help available for it. I have made some simple games with sfml before but I was looking to move on to something that is more widely used in the industry, just to keep my options open and hopefully it will prove to be a useful experience.
    • Dear all,

      I have a question that's kind of related to this thread. I am planning on starting developing some small games of my own, starting small, like tetris or pacman, and work my way up the ladder of complexity. I think this is a good way to see if game programming really interests me. BTW, many thanks to Mr. Mike and Rez for making subjects I found boring before, like UI programming, sound really interesting and challenging in their book. I like way you don't hide anything about how hard and complex it is in the book. I have not finished the book yet (GCC4), but I think I have read enough to start designing my own tetris game.

      Now that that's out of the way, my question is the following. While I think I agree with the comments about 2D and 3D, if I eventually want to focus on AI programming, wouldn't it be more difficult in a 3D environment ? For example, if I make an game like Homeworld, isn't the pathfinding system more difficult to program and doesn't it require more resources ? I guess my question is related to the difficulty gap of the different systems in a 3D or 2D environment.

      Thanks and I hope you'll understand my question (I had difficulties putting it together) :D
    • Originally posted by DerickThePoney
      I have a question that's kind of related to this thread. I am planning on starting developing some small games of my own, starting small, like tetris or pacman, and work my way up the ladder of complexity. I think this is a good way to see if game programming really interests me. BTW, many thanks to Mr. Mike and Rez for making subjects I found boring before, like UI programming, sound really interesting and challenging in their book. I like way you don't hide anything about how hard and complex it is in the book. I have not finished the book yet (GCC4), but I think I have read enough to start designing my own tetris game.

      Thanks!!


      Now that that's out of the way, my question is the following. While I think I agree with the comments about 2D and 3D, if I eventually want to focus on AI programming, wouldn't it be more difficult in a 3D environment ? For example, if I make an game like Homeworld, isn't the pathfinding system more difficult to program and doesn't it require more resources ? I guess my question is related to the difficulty gap of the different systems in a 3D or 2D environment.

      Thanks and I hope you'll understand my question (I had difficulties putting it together) :D

      It depends on the game. Take The Sims, since it's on my brain so much lately. I could use the exact same code for a 2D game with no modifications whatsoever. The code is exactly the same. This is true for most of the games I've worked on. The reason is because The Sims is fundamentally a 2D game when you really think about it. Sims are always on the X & Z axes and only go up the Y axis when they're on a hill or going up stairs. How is this different from a 2D game with similar requirements?

      Pathing is a bit different and, in my opinion, isn't quite an AI problem. It's more of data structures problem. A* is a common algorithm for traversing weighted graphs, which happen to work really well for modeling navigation in a game. Even there, the code doesn't have to change too much. Who cares if the node position is a 2D vector or a 3D vector? The code is basically the same; you're trying to find the shortest path between two nodes in a graph with weighted arcs.

      In a game like Homeworld where you have complete freedom of movement in the 3D environment, the math can get a bit more complicated, but the actual decision-making logic (where should I go? what do I want? how should I attack?) remains pretty much the same.

      So I would say that the difficulty gap between 2D and 3D with regards to AI is fairly small. I would definitely start with 2D though. Once you have that down, making the jump to 3D is fairly simple.

      -Rez
    • Thanks Rez for the quick answer ! That was more or less what I was thinking, but as I did not yet reached the AI chapter, I wasn't sure.

      However, I am still confused about pathfinding not being an AI problem. I understand that finding a path from point A to point B is actually a problem of traversing a graph with nodes and weigthed edges is not an AI problem if the graph is known in advance and doesn't quite change. But is it still not an AI problem, if for example we want our character to sneak up to you and slit your throat from behind (and then laugh at you while you're bleeding out --- I have a strange mind...), while you are moving? I guess the game states seen by the AI character are changing depending on how you interact with the world... And it then has to adapt its view of the world and therefore its pathfinding?

      Guess what? I think I answer my own question writing these lines... :P The AI problem here is not pathfinding, which will use the same algorithm each time it has to adapt itself, the AI problem is presenting the AI character with a view of the game states, that will then be used for pathfinding. Am I right?

      Thanks!
    • I think of AI in terms of layers. The lowest layer is basically all math. For example, I'm facing this direction and need to rotate to face that direction, so find the delta between the two direction vectors, convert to a rotation, and apply it. Ian Millington calls it kinematics, which it basically is. There's very little decision making happening, it's really more about the execution of that decision.

      The middle layer is all the decision making. I have 56 health and 134 bullets left. Should I go for cover, ammo, or attack the player? To me, this is the core of the AI system and the one I find the most interesting.

      The highest layer is basically tuning. Adding goals to NPCs, adjusting stats, building the behavior trees, etc.

      Each layer uses the layer below it. Using the example above, building a behavior tree at the highest level would consist of composing a bunch of behaviors that you built into a tree that will be traversed when the agent needs to make a decision. This is commonly done by designers. The behaviors themselves are written by engineers on the middle layer. Those behaviors call into the lowest layer to directly manipulate the agent.

      I don't really consider that lowest layer to be AI. It's basically just math and even games with no autonomous agents need it. The core of the pathing system tends to live at this level.

      On some teams, these three layers are handled by different teams. On The Sims, I work on the middle layer, MoTech (motion technology) works on the lowest layer, and designers work on the highest layer.

      -Rez