I have a grasp on basic knowledge of Java and wish to learn more. Alot more. Can anyone point me in a direction? Or like where should I start? I sit here and think “where do I start…” like I don’t know weither or not to code the player and stuff first or what. Can someone point me to a guide or something? Atleast for me to learn more? Thanks.
Do you already know what type of game you plan on making? I think before you start just jumping in a coding, you should have an idea of what kind of game you want to try creating.
One simple question that could mean a lot in where you want to go with programming games with Java.
Do you understand OOP?(Object Oriented Programming)
If you can then it’ll make it a lot easier.
Get a game idea. That’s how to start. Nothing too complex. Something simple.
Now about actually starting somewhere. You’re going to need some additional hardware. A Pen and Paper. Expensive right?
Now you’ll want to plan absolutely everything.
[x] Player
[x] Enemy
Etc
Each one of these will be a class. If they share common variables such as:
[x] hp
[x] strength
[x] agility
So on.
Then go on and plan out and create an idea of how you’ll do everything.
You’ll need to know:
How the game is won?
How will the player interact with the game?
What feedback will the game give to the user? (Sound, new images, etc)
How will the player know what they have to do?
There’s a hell of a lot of planning. Then you can begin programming.
Its always nice and helpful for when you come back to solve all the problems that will arise when you go through making the game.
So you might want to set up a couple of packages within your project in eclipse. These can store different types of classes.
For example:
A package for the screens
A package for the entities
Etc.
There’s a lot of work involved. But when your ready to start programming, you’ll want to start from the base up. Not somewhere in the middle.
Set up your screens, drawing surface and game loop. Then work on say a superclass called Entity.
Might look something similar to:
public class Entity
{
int hp, maxhp;
int str, agi;
int level;
double x, y;
boolean active = true;
public void destroy()
{
active = false;
}
}
Hope this helps you in some way or another.
I agree with Scyth for the most part, with 1 small difference.
Before you actually get to making your game, the best thing to do is to do a ‘how to make a game’ tutorial so you know the basics. the first chunk of pretty much every game (2d graphic based games, i mean) are pretty much the same for the most part. So watching/reading tutorials will help you learn how to set everything up before you actually get programming the stuff you want for your game.
While learning these basic things, and doing the tutorials, you should write down a basic outline of what you want in your game, then fill it out in as much detail as possible. Doing this WHILE learning the basics makes it much easier to learn to think like a game programer, without turning it into a really daunting task. (seriously, just sitting down and saying ‘how do i want to have the save system set up, what about the maps and mobs?’ seems REALLY scary if you’re doing it all in 1 go) Their explanations on things in game programing can also help you come up with with some good ideas on how you want to do things:
For instance, while i was watching TheChernoProject’s and coding along (he has the BEST explanations for just about everything, with the exception of saving, even if he does use Notch’s codes for the starter) when he explained how his mapping code worked, i actually thought up a really good way of doing something that i hadn’t been able to figure out until then:
The idea i got? Well, that was how to do chunk-loading, of course (which he doesn’t actually cover, but that’s kind of what i mean by getting inspired by their explanations: [quote]Chunk loading ideas:
(Idea 1)
-
As terrain is basically read from a text file, then placed on the screen, then having each world made
out of multiple text files, with each text file holding 4 16x16 (or 32x32) grids of blocks
(background, wall art, front, extra art), and have the game load each one when the camera
screen is within 4 blocks of that chunk. (base which map should be loaded by the ID) -
The chunk loading guide file should be handled like this:
-
Map Ids are composed of 4 numbers, with each number having 4 sets of letters:
x—y---xn—yn—If(PlayerWalkingLeft==true & x == 0)xn++;
If(PlayerWalkingRight==true & xn == 0)n++;
If(PlayerWalkingLeft==true & x > 0)x–;
If(PlayerWalkingRight==true & xn > 0)xn–;If(PlayerWalkingDown==true & y == 0)yn++;
If(PlayerWalkingUp==true & yn == 0)y++;
If(PlayerWalkingDown==true & y > 0)y–;
If(PlayerWalkingUp==true & yn > 0)yn–;LoadMap(‘x’ + x.toString() + ‘y’ y.toString() + ‘xn’+ xn.toString() + ‘yn’ +yn.toString());
-
xn and yn stand for ‘x-negative’ and ‘y-negative’. this should allow for sudo negative numbers (since java doesn’t allow for negitives T_T).
have the game use Xn for negative x, and Yn for negative y.
if(x=0){}
[/quote]
As for the actual game itself, i started writing the basics of what i wanted, which started off like this (yes, this is actually the original file, with the exceptions of the edit notes, lol):
Then i went in depth about everything that i wanted. i detailed the mobs i wanted (even went into how many different slimes i want, every rpg needs it’s obligatory slimes) the weapon ‘parts’, the ‘ores’ and ‘mine-able things’. and all of that, and then i thought about how i would do them. (chunk-loading came up during this, which is when i started having problems)
Anyway, the first 2 things you need to do, is think about what you want, and learn the basics. here are 2 tutorial series that you should watch (both are on going, but they already have everything you need):
https://www.youtube.com/user/TheChernoProject - I learned MOST of what i needed from watching TheChernoProject’s first 20-30 videos on his ‘java game programming tutorials’ (NOT THE 3D ONES! just the regular)
http://www.youtube.com/user/MrDeathJockey - MrDeathJockey’s videos taught me what Thechernoproject didn’t. (I only watched MrDeathJockey ‘java intermediate tutorials’)