r/javahelp • u/_skink • Dec 11 '20
Questions About Making Games in Java
Hi everyone,
I would like to learn how to make games with Java. However, I don't know where to start. I have some prior experience with JavaFX and Java Swing so I think that is good. My main question is: What library do I use, and where can I find good information/tutorials/docs about that library?
Thanks
15
u/DerekB52 Dec 11 '20
LibGDX. You won't be using FX or Swing. LibGDX is a great game framework. Start by following along with a guide to make something like a flappy bird clone.
2
2
u/kronikkid Dec 11 '20
I agree with the LibGDX reccomendation if you want to go pure Java, but it does take a while to do basic things and gets complicated really quickly. If your willing to learn a little C# I would suggest trying out unity, you can get a lot more done with many more tools.
2
u/_skink Dec 11 '20
Part of the reason I’m learning java is because it’s so similar to C# (At least that’s what I’ve heard). I’ll probably learn C# and Unity once I feel like I can create basic games with Java
7
u/LiteratureStriking Dec 11 '20 edited Dec 11 '20
JavaFX and Swing aren't the best for creating games, they are best for creating user interfaces. Not to say you can't create simple games using them...
A better way is to use a library meant for creating games. For example, LWJGL.
4
u/whizvox Graduate and Tutor Dec 11 '20
I must point out to the OP that LWJGL is not a game engine, it's a wrapper for OpenGL, OpenAL, and some other commonly-used C libraries. However, it can be used to create a game engine.
2
u/msx Dec 11 '20
Hi, there's plenty of libraries for that, from simple wrapper for opengl to full featured engines, it pretty much depend on what you want to do, for example if 2d or 3d, if for desktop or android or something else, etc.
In general, i find libgdx to be a very good one and is the one i use. It's not exacly simple tho. It's well worth the learning if you plan to invest your time in gamedev.
1
u/Rabestro Dec 11 '20
If you are beginner I suggest to try GreenFoot IDE. This is IDE for game development. The book about how to create games in the IDE: https://www.packtpub.com/product/creative-greenfoot/9781783980383
A year ago when I started to learn Java I used Greenfoot and created a simple game:
-6
u/collin_himself Dec 11 '20
I typically use java for an assignment in my ai class we used unity using c#. You should check that out it was pretty cool don’t really know how it all works exactly since most of it was already coded I was just building a bot but you can make some games in that
3
u/GreenParsley Intermediate Brewer Dec 11 '20
OP wants to create a game using java, not just any game
•
u/AutoModerator Dec 11 '20
Please ensure that:
Your code is properly formatted as code block - see the sidebar (About on mobile) for instructions
You include any and all error messages in full
You ask clear questions
You demonstrate effort in solving your question/problem - plain posting your assignments is forbidden (and such posts will be removed) as is asking for or giving solutions.
Trying to solve problems on your own is a very important skill. Also, see Learn to help yourself in the sidebar
If any of the above points is not met, your post can and will be removed without further warning.
Code is to be formatted as code block (old reddit: empty line before the code, each code line indented by 4 spaces, new reddit: https://imgur.com/a/fgoFFis) or linked via an external code hoster, like pastebin.com, github gist, github, bitbucket, gitlab, etc.
Please, do not use triple backticks (```) as they will only render properly on new reddit, not on old reddit.
Code blocks look like this:
You do not need to repost unless your post has been removed by a moderator. Just use the edit function of reddit to make sure your post complies with the above.
If your post has remained in violation of these rules for a prolonged period of time (at least an hour), a moderator may remove it at their discretion. In this case, they will comment with an explanation on why it has been removed, and you will be required to resubmit the entire post following the proper procedures.
To potential helpers
Please, do not help if any of the above points are not met, rather report the post. We are trying to improve the quality of posts here. In helping people who can't be bothered to comply with the above points, you are doing the community a disservice.
I am a bot, and this action was performed automatically. Please contact the moderators of this subreddit if you have any questions or concerns.