r/learnjava • u/elyca98 • May 10 '21
Can one create a video game in Java only?
What I mean is: can one create a video game or graphic application without the use of external software like SceneBuilder, or libraries like JavaFX?
I’ve seen a guy recreate Minecraft using only coding in C, and I feel like, if you know enough of any powerful language like Java, you can do anything you want, at your own customs, without the need of pre-existing tools, and it may be easier once you are at that level.
27
u/AHistoricalFigure May 10 '21
You certainly could, but it would be a lot of work and there are much easier options. Because if you're not willing to use other people's tools or libraries you're going to have to build your own.
If you want to get into games development my suggestion would be to jump into the Unity Junior Programmer class offered for free through Unity Learn. The Java > C# transition is one of the easiest in programming.
9
u/elyca98 May 10 '21
Then I prefer to stay in Java for a time and be confident enough to do the jump. Thanks.
7
u/kiwidog8 May 10 '21
If you're asking if it can be done, well, literally everything running on a computer, phone, or game console (which are all computers) is just code underneath, so of course you can. Once you get more experience programming you start to realize that all programming languages are quite similar, the only reason why different languages exist is because they fill different niches (syntactically, stylistically, being more geared to one type of program, or have a focus on being easy to use and understand, etc.) but they all have the capacity to do the exact same things, it's just a matter of picking the language that does that one thing better or meets your needs as a developer. For most general purpose languages there are no limits, if you can imagine it, you can build it.
Now if you're asking if you should attempt to write a video game from scratch without using third party libraries and tools, then no, unless you're doing it strictly to learn/educate yourself. In the real world the majority of developers never build something without the use of libraries and tools without a good reason to. Don't reinvent the wheel and all of that, you know?
3
u/elyca98 May 10 '21
Thank you so much. This has made my third eye quiver a bit. Specially that last part.
16
May 10 '21
RuneScape private servers are written pretty much solely in Java, so yeah. To it’s core, it’s client-server-cache work and all you do is map out the streams with the headers and make sure your packets are being used
-14
7
u/HecknChonker May 10 '21
Java AWT (Abstract Windowing Toolkit) lets you create a canvas that you can draw shapes or images to.
I haven't used it myself since college when I did a few projects like tetris, and it worked well. I don't know how well it supports 3d or if it allows you to utilize a GPU.
https://docs.oracle.com/javase/7/docs/api/java/awt/package-summary.html
6
u/recursiveG May 10 '21
Libgdx is the most popular Java game engine I believe.
1
u/Acid-free_Paper May 11 '21
It's just a framework, not an engine.
3
u/smm_h May 11 '21
What's the difference in your opinion
2
u/carrdinal-dnb May 11 '21
I’d say engines are more fully featured freeing the developer up to focus on creating their game, whereas a framework is more a set of tools you can configure to get what you want but you’ll probably spend more time fiddling around with things.
3
u/Gustafssonz May 10 '21
Starsector, prob one of the best games I have ever played are written in Java.
1
3
u/snot3353 May 10 '21
Yes, there are plenty of established and high quality game frameworks in almost every language. If Java is the language you’re most comfortable with then go check out LibGDX.
3
u/MHREone May 11 '21
I had to make a game only with javafx for uni. It was a horrible experience. Don't do it.
5
u/Dexteroid May 10 '21 edited May 10 '21
You can but why would you want to ?
Edit: I don't want to deter you from learning something but my point is that there are better tools available for game Dev. Example : c# and unity.
4
2
u/strikefreedompilot May 10 '21
My friend made a playable good looking (for that time period) streetfighter and tetris type clones 20 years ago.
2
u/makingthematrix May 11 '21
Take a look at FXGL, video game engine built on top of JavaFX: https://github.com/AlmasB/FXGL
And libGDX, another game engine: https://libgdx.com/
2
May 11 '21 edited May 11 '21
This is a link to ThinMatrix's game dev log on YouTube (it's 125 videos). This is start to finish, ground up development of Equilinox which is currently on Steam.
Everything was built with Java, so yes, it is possible, and he shows you how.
2
u/nutrecht May 11 '21
People are answering your question but not the questio behind the question.
You should not avoid using external libraries when you're programming in Java. Sure it has a learning curve, but you need to get over it anyway.
For simple 2D games (start with stuff like tick tack toe or minesweeper) you can just use 'plain' Java + Swing. If you want to do 3D stuff you're going to end up using an external library, like for example Minecraft does.
1
1
May 11 '21
If you want to learn making games using Java here are the channels TheCherno, NewBoston on YouTube. These are the channels I'm learning java game programming from.
6
u/AutoModerator May 11 '21
Please, don't recommend/use thenewboston.
They are a discouraged resource as they teach questionable practice. They don't adhere to commonly accepted standards, such as the Java Code Conventions, use horrible variable naming ("bucky" is under no circumstances a proper variable name), and in general don't teach proper practices, plus their "just do it now, I'll explain why later" approach is really bad.
Derek Banas covers about the same ground, but in much better quality.
If you're looking for an in-depth, comprehensive, high quality, free Java course, use the MOOC Object Oriented Programming with Java from the University of Helsinki and maybe Java for Complete Beginners by John Purcell as secondary resource.
I am a bot and this message was triggered by you mentioning thenewboston. Please do not respond to this comment as I will not be able to reply.
I am a bot, and this action was performed automatically. Please contact the moderators of this subreddit if you have any questions or concerns.
3
0
u/asterik-x May 11 '21
Yes!! Whenever , im on vacations to Java, i do create a couple of video games in Java only. I do not cross the boundary of the island till i have coded all the game.
84
u/DigitalTorture May 10 '21
Minecraft was written in java, so yeah you can.