Who doesn’t like playing games? There’s a console, computer, and mobile games built to everyone’s taste and budget. They provide us with a fun way to pass time. And just imagine how much time game developers have.
Which begs the question, which programming language would you choose to create a game? My personal favorite is Java.
Java is not just a prospect of a big bank account. It’s one of the OG languages that lead the technological progress, and it has a huge following — a great community of peers who enjoy coding in a simple, object-oriented language.
If you consider becoming a Java programmer or you’ve already started learning it, developing simple games can be a fun way to practice your knowledge. Of course, Java game development is a thing. Try out Minecraft, Ninja Gaiden, Worms: A Space Oddity, Guitar Hero Mobile series, or FIFA 11 to see that good games made with Java do exist.
The saying “practice makes perfect” is true on this occasion as well. Every bite of theory should be followed with hands-on experience, even if you are just retyping a piece of source code.
So the first thing you want to do when you start learning Java, for any purpose, is installing the development kit or JDK. It’s a set of tools you would need to develop in Java, including a runtime environment, compiler, interpreter, and documentation generator. You can download JDK for the official Oracle website.
It will do you good if you start with the fundamentals. Even if you’re not new to programming, get to know the basic syntax and core concepts, so you a) are on the same page with Java, and b) won’t confuse any of the elements with other languages when writing code.
Here is a taste of what your curriculum as a beginner Java programmer would look like:
- Object — a basic element of a program that contains state (attributes) and behavior (how it interacts with other elements)
- Class — an element which describes an object like a template
- Method — an element that describes exactly how an object should behave
- Variable — a value that is attributed to an object
- OOP — a Java program is a collection of objects that interact with each other
- Data types — the types of values that can be assigned to an object, such as an integer number (int) or character (char)
- Collections — a framework for manipulating and storing groups of objects
- Multithreading — the concurrent execution of two or more processes with the most efficient use of a CPU
- Patterns — working solutions for specific programming tasks
- Unit testing — testing your application in small units
Here are a few good sources of information both about programming in Java, specifically, creating games in Java.
- Killer Game Programming in Java by Andrew Davison
- Head First Java by Kathy Sierra
- The Beginner’s Guide to Android Game Development by James S. Cho
- Game Programming Patterns by Robert Nystrom
- Java Forums has a gaming topic where you can connect with the community over Java game development
- Java Gaming is a community dedicated solely to game programming in Java
- Gitconnected — learn Java with the best tutorial resources online
- CodeGym games — learn Java while creating simple games
- Udemy — brush up on some theory on the Java Processing Library
- GameCode School — explore game programming tutorials for beginners
The thing is, you can’t choose between either. If you want to become a professional, you’ll need to learn constantly, so self-learning is always on the table. Yet, there are good reasons to use a course when you are a beginner:
- Courses set a conducive environment for learning. They help differentiate between learning and everything else.
- Courses help motivate. They give information in bite-sized portions, you’re in touch with the course mentor all the time, and you can communicate with fellow students.
There’s an abundance of courses, so you should weigh out the pros and cons, to find the best one for you. All courses can be roughly split into three categories:
- Free or paid: paying for the course, gives the people maintaining it the resources to upkeep, upgrade, and provide you with better services. Although if you don’t have the budget, some free courses can start you off.
- Real-time or self-paced: real-time courses can be great for time management and communication with a teacher or mentor. Self-paced courses, on the other hand, don’t restrict you to a particular timeline.
- Online or offline: Online courses don’t restrict you to the options you have locally. They facilitate communication within the student community, providing chatrooms and forums. But some might prefer or find more motivation when studying online in groups.
You know that becoming an expert from zero knowledge in something in just 2-weeks, as some companies claim, is impossible. It’s a gradual process that requires setting milestones. If you set yourself too big of a goal and don’t fulfill it, you might demotivate yourself. On the other hand, the satisfaction you get after completing a goal gives a great boost to your spirits.
This ties in with the previous point. If a big task is taking you ages to resolve, wrecking your brain in the process, it might demotivate you from learning if you don’t stop and take a break. A better course of action, in this case, would be to read some theory on a related topic, go to the forums, do a couple of easier assignments, and go back to the complex one when you feel more confident.
Be consistent with practicing small and moving onto more complex tasks gradually.
You might be excited to learn as much as possible in a short period of time, but jumping to a new topic or book before finishing the previous one creates a mess. You might also be bombarded with too much information, lose focus, and burn out too quickly.
People might tell you that Java isn’t the right language for game development or that programming as a profession has run its course. Or, you might encounter people who will say you’re not doing enough or you won’t be as good as other specialists. And it might be hard to ignore them, so remember that it’s their own insecurities talking. Go to forums and talk with your peers for a confidence boost.
Talking to your peers in chats and forums is always a great motivation booster. Especially if you have trouble solving a particular issue, you can ask for help from them or more experienced developers.
Learning Java for game development is a gradual process that requires patience and dedication. If you pace learning, connect with peers, set goals that can easily be achieved, start with the basics before moving onto more complex stuff, and you will soon be able to code a simple Java game.
Was published on Levelup GitConnected blog