I recently started a new project, and I'm wondering if I should change the technology now before it's too late.

I'm using SDL with C++, I have around 6 classes, and the game is going alright, but I got to this point where I have to rotate my sprite to make it point to the coordinates of the mouse.

It's a 2D topdown game, so if I pre-cached the images, I'd have to load 360 images, which is bad for memory. If I used SDL_glx, I could do the rotation real time, but I heard it'd drop my frame rate very drastically, and I don't want my game to be slow.

I also read I could use OpenGL, which is faster at these things. The problem is, how much would I have to change my code if I moved to OpenGL with SDL.

So, I considered moving to a completely different language - Java - which is much simpler, and would allow me to focus on the game and handle networking much more easily than with C++.

I am very confused, and would like to hear your opinion - thank you!


closed as not constructive by MichaelHouse, Trevor Powell, Anko, bummzack, Josh Apr 16 '13 at 15:06

As it currently stands, this question is not a good fit for our Q&A format. We expect answers to be supported by facts, references, or expertise, but this question will likely solicit debate, arguments, polling, or extended discussion. If you feel that this question can be improved and possibly reopened, visit the help center for guidance. If this question can be reworded to fit the rules in the help center, please edit the question.

  • 8
    \$\begingroup\$ You do seem to be confused. Why would you have to load 360 images? Why can't you just rotate your sprite? You "heard" it would drop your frame rate, have you just tried it? \$\endgroup\$ – Tetrad Feb 25 '12 at 20:28
  • 2
    \$\begingroup\$ I believe the original poster is referring to SDL's inability to rotate sprites frame by frame, without certain plugins like SDL_glx. I agree that the poster should just try SDL_glx and see if there is really a performance hit before writing it off. \$\endgroup\$ – Tristan Crockett Feb 25 '12 at 21:02
  • 3
    \$\begingroup\$ "So, I considered moving to a completely different language - Java - which is much simpler, and would allow me to focus on the game and handle networking much more easily than with C++." How? Java doesn't exactly have many game-specific routines. So you'd either be using something like Java2D (not exactly performance friendly) or OpenGL. In which case, as far as rendering is concerned, you're no better off than in C++. This is not a problem that is solved by language, but by what library/framework you're using. \$\endgroup\$ – Nicol Bolas Feb 26 '12 at 0:26
  • \$\begingroup\$ I did try SDL_gfx, and rotoZoom function, and it didn't slow my game down that much. Around 2 frames per second slower now, so I might just stick with it, thank you all! \$\endgroup\$ – David Gomes Feb 26 '12 at 16:07
  • \$\begingroup\$ SDL_gfx is the way to go. \$\endgroup\$ – Vortico Apr 25 '12 at 11:10

If you're fairly new to game programming and programming in general, I recommend against starting out learning everything in C++. Either set your sights lower than sprite-based games while you learn C++ (e.g., practice with a text adventure while you get comfortable with the language) or go for the less cerebral, more fun route with another language.

Java is a good language to start game programming in if you're at least somewhat comfortable with object oriented programming. You have libraries like JogAmp, LWJGL, and Java Monkey Engine to get started, as well as tools like Eclipse.

Lua and Python have similar libraries to Java available and are also pretty good for getting something on screen relatively quickly and making it move around, although I have to defer to someone else's experience for starter libraries and tools for these languages.

If you're comfortable with C++ and would like to stick with it, then I think it comes down to a matter of personal experience, priorities, and taste. The options you listed are all good ones generally, but you'll want to read up on the APIs, strengths and weaknesses, and so on to see which one fits you best.

My hunch, though, is that you'd be happier working in another language for a while to get some experience before you come back to C++. There is plenty of general game programming experience to be gained elsewhere.

I hope this helps. Good luck.


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