What should I choose between java sdl, sfml, opengl, etc.

546    Asked by LillianHart in Java , Asked on Oct 10, 2022

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 in 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 that 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++.


Answered by Lily Hemmings

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++, java sdl (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.



Your Answer

Interviews

Parent Categories