I first got into programming in high school, mainly by making games using Java and the 2D graphics/UI libraries in the standard library (Java2D, Swing, awt, etc.)<p>10 years and a CS degree later, I'm employed in industry but would really like to get back into making games as a creative outlet. But I'm always stuck on deciding what language, framework, engine, and environment to use.<p>So I'm wondering, what's the most straightforward stack and programming environment that gets me a window, event loop, canvas, etc. so that I can make whatever kind of 2D games I'm interested in? C++ with SDL? Javascript and canvas? Plain old Java again? Would like to hear what people here have a good experiences with.
I used to create a half-ass Ultima-spinoff (think Ultima 1-4 type of graphics) in C++ and SDL2. Tried twice but never managed to complete them, not due to technical difficulty but due to boredom once I figured out the major algorithms (path-finding, line of sight, random generation, such and such). My rendering "framework" only has some 200 lines of code but fits all of my rendering jobs.<p>I'd say it's a valid option as long as you are willing to devote some time building up the foundations. But if you are more into game programming than game engine programming, Godot may be your best choice. I have never used it though so cannot say for sure.
Godot.<p>C++ and SDL2 will get you a window, events, sound and other low level stuff, and you can get support for PNGs and fonts easier by including some of nothings/stb libraries[0] (rather than the equivalent SDL libs.) Maybe toss in Lua/LuaJIT for good measure. That will scratch a lot of itches.<p>But IMHO it's better in the long run to just pick up Godot and save yourself months of unnecessary effort. Otherwise if you're like me you'll wind up in the weeds with nothing to show for it but a tilemap class you've rewritten a dozen times.<p>[0]<a href="https://github.com/nothings/stb">https://github.com/nothings/stb</a>
Godot (<a href="https://godotengine.org/" rel="nofollow">https://godotengine.org/</a>) has given me the best mix of freedom and helpfulness. I worked in Unity for a few years, which was terrible but popular, and have done a small amount of Unreal Engine work, and have found them to be more "enterprise"-y than I need/want. Godot is FOSS and is a really incredible community. GDScript is pretty cool (if you're familiar or enjoy Python it'll feel pretty normal), but you can use pretty much whatever programming language you like.
I've personally had a very good experience with Haxe and Haxeflixel (<a href="https://haxeflixel.com/" rel="nofollow">https://haxeflixel.com/</a>) although Heaps (<a href="https://heaps.io/" rel="nofollow">https://heaps.io/</a>) seems to be more popular nowadays.<p>Haxe is very nice as a language, can easily cross-compile to a lot of targets, Haxeflixel is heavily inspired by some Actionscript framework and has a lot of goodies. Maybe Heaps is more mature, up to date and allows for more advanced features.<p>The cool thing is you can get started right away writing code, without having to learn a full-on tool like Unity. But it has visual tools for debugging things on-screen for example.
Raylib (<a href="https://www.raylib.com" rel="nofollow">https://www.raylib.com</a>) is a better API than SDL for hobby 2D game development and here's an illustrative reason why: You cannot even draw a circle with SDL.<p>Look at all this! <a href="https://github.com/raysan5/raylib/tree/master/examples">https://github.com/raysan5/raylib/tree/master/examples</a><p>If straying from native code then CanvasRenderingContext2D in the browser with JS/TS is good too, particularly because you can have hot-code-replacement during development by using e.g. Vite.
make your own. trust me: a minimum viable 2D gfx library based on OpenGL will take a day or two to put together, and you can hack at it as you work on your game. it's very comfy, and provides greater motivation for when gamedev drudgery threatens to stop your work.