Advice for learning game development?

Hi guys. I started learning Java programming a few months ago with no previous programming knowledge. My intention is to many learn at least some before my Uni course starts. I’m looking at going into game development more as a hobby as I am more interested in desktop applications long run. I feel that I might be ready but I think I need to brush up on for loops a little, but hopefully I can do that while programming something in the future :slight_smile:

I’ve got Slick2D all setup and watched TheNewBoston Videos on programming with Slick and I actually learnt some good stuff. I’m looking for a project which would be relatively easy to do and a good introduction to game programming and also any good places where I can learn more? Honestly, my maths isn’t very good :persecutioncomplex: and was wondering what skills I will need to make simple 2D games? I’ve been reading into vectors lately as I have seen those used a lot in example code and I think i’m finally understanding them >.<

So to sum it up… relatively new to programming, looking for some simple projects and any good places to learn more :slight_smile: Thanks!

Just make any game you want. If it is your first game, you should probably choose simplest game possible, because you would be surprised how much you need to do to make even very simple playable game.

Seriously, stop thinking about what you need to learn to make a game, and learn while making the game. When you run into a problem when making a game and don’t know how to fix it, you need to look more into it. You won’t really be able to make games without making games.

Okay :slight_smile: I did this a little while learning core Java so I guess I can do the same. I’ll brainstorm a few ideas and get going. Thanks! :slight_smile:

I don’t think there is a point in brain storming ideas, if you cannot implement them. Start with something like moving square which is rotating towards the movement direction and when left mouse click occurs you shoot a small projectile toward the mouse, which disappears when it hits the end of the screen.

I mean, if you really don’t have any experience, this would probably be more than enough for exercise. Also, if you’re not using Libgdx of LWJGL, remove the rotation part, because with Java2D learning how to rotate objects is a mess, and even if you learn to do that, you won’t be using it in the future anyway.

Okay, good idea :slight_smile: thanks a lot for your advice.

Sounds like you’re off to a good start, my advice though is to not worry so much about what tools(skills) you need in your toolbox before you need them, but buy(learn) them as you need them.

For example, you said you’re using Slick2d, I can assume you built TheNewBoston’s little mini-game (I did as well, he’s where I got started). So if you’re at that point, you have a basic grasp on the concepts of moving a player, a map, etc.

What you should do now is ask yourself “What do I want to make?” and then start making it. I’ve found the best way to learn is out of necessity. For example, if you make a block breaker, you’ll have to learn collision detection. If you make a platformer, you’ll have to learn smooth controls/movement and (presumably) interaction with other entities. RPG, you’ll have to learn how to make a inventory/stats/experience system.

Really, I learned via TheNewBoston to get a framework for computer programming, and I’ve used the method mentioned above. It’s been just slightly over a year since I downloaded my first-ever copy of Eclipse, and now I’m working on this:
[shamelessplug]
http://www.java-gaming.org/topics/sixtygig-open-world-retro-rpg/32172/view.html
[/shamelessplug]

But I’m a bit of a special case, I’m an extremely fast learner. Not to sound too arrogant, but you shouldn’t be where I am at in a year, and even so I still consider myself a newbie, and still sometimes ask for help here on JGO.

Programming takes a lot of time, skill and dedication. The reason there’s about 5 million people who want to make video games for every 1 person who actually knows how is because the entire process to gain the skill set takes an extremely long time, and even longer to learn how to apply those skills correctly.

Thanks for the advice Ray :slight_smile: It seems the best way to learn is to in fact learn on the go. One question I do have is, should I eventually learn tile based games? Btw your game looks really neat :smiley: i’ll give it a download :slight_smile:

There’s no real posted download yet :smiley: (Aside from the blood tech demo)

Well, honestly, I started with Tiled based games. But it seems like all my ideas always seem to need it. :stuck_out_tongue:

Slick2D has a very easy to use TiledMap class though, just check out the java docs on it:
http://slick.ninjacave.com/javadoc/org/newdawn/slick/tiled/TiledMap.html

Also, it’s based on using tiled maps made via TilEd: http://mapeditor.org

If you’re just thinking about basic 2D topdown (or isometric) game maps, it’s the way to go. It’s what my game maps are based on.

Okay :slight_smile: thanks! I’ll check out the docs for it and do some googling. I noticed that in the videos (TheNewBoston) we made the map move instead of the player. Is this actually the correct way to do things?

Tile maps are a good thing to start with, theyre very easy to work with and very versatile. usually you would have a camera position, and move that around, rather than moving the map or the player around (although the player will normally be moving around anyway, with the camera following it).

Should I use a tiled editor program for these sort of maps?

personally i like to make my own built in editor and map renderer because i usually like to include an editor with my games. it might be easier to use a tiled editor to start with though because it would cut down quite a lot of work for you.

Oh okay :slight_smile: thanks! Ray posted a link to a map editor, I take it that it works directly with Slick?

Yes, it works directly with slick2d. All you really need to do to load a TilEd map under init in your Class, and render it. There’s a TON of more advanced stuff you’ll have to figure out later, like rendering 1 layer at a time (so your character can go behind objects, for example) and figure out how to only render a certain chunk of the map, else large maps will end up extremely laggy. But, just to get the core basics down, this is all you need to do:

I’m going to assume a StateBasedGame, but it’ll work with regular games too in slick.

public class MapState extends BasicGameState{
	private TiledMap map;
	int mapX,mapY = 0;
	
	public MapState(int state){
	}
	
	public void init(GameContainer gc, StateBasedGame sbg) throws SlickException{
		map = new TiledMap("res/subfolders/yourMapName.tmx")
	} 
	
	public void render(GameContainer gc, StateBasedGame sbg, Graphics g) throws SlickException{
		map.render(mapX,mapY);
		//map.render(mapX,mapY,layer); //Per layer rendering example
	}
	
	public void update(GameContainer gc, StateBasedGame sbg, int delta) throws SlickException{
		//Here you'd have to write your own custom way of centering the map on your player at all
		//times. For something super simple, you can just do this. Basically what you're doing here is setting 
		//mapX and mapY to the reverse of the player's X/Y and then shifting it half the map width and height. 
		//This should lock the player dead-center of the map and move the map around.
		mapX = (playerX*-1)+(gc.getWidth()/2);
		mapY = (playerY*-1)+(gc.getHeight()/2);
	} 

	public int getID(){return stateID;} //For stateBasedGames in slick2d, not needed otherwise.
	
}

As for what Liquid said, having a map editor for your players to use is really cool, if you want to design you’re own. The code for a Tiled Map really isnt all that complicated. All it really is, is a 2D array of images on the screen. But personally, I feel I still have a “map editor”. I was just going to give credit where credit is due, and send players to www.mapeditor.org if they wanted to edit my maps. :stuck_out_tongue:

But there is a great benefit to making your own editor, you can add a lot of functionality your way and not be contrainted to some of TilEd’s stuff. For example, the biggest drawback for me with TilEd is using sprite sheets, I’d much rather have single-images, so I don’t have to worry about sheet arrangements. But since TilEd doesn’t allow that, and that’s my only real gripe, I just use SpriteSheets :stuck_out_tongue:

Thanks Ray :smiley: I actually looked at tiledmaps today as well as creating things like bullets and I learnt a lot :)! I’m actually going to design a small mini-game where my player can only move on the Y axis and has to dodge randomly generating enemies. I know it might sound simple but I think it could be a great learning experience and could help me in the future.

I have noticed a lot of games move the map rather than the player. What is the reasoning for this or does it make no difference at all?

Thanks again for everyone’s help, loving the forums!

It’s usually a lot easier to move the map up/down/left/right than the player itself, personally I don’t like doing it that way. I like moving the map in relation to where the player is at. It makes rendering everything else a lot more straightforward.

But, it is a lot easier to just always render the player at the middle of the screen and link your controls to manipulating mapX and mapY. The (what I consider to be) more proper method involves moving the player on the map, and making the map always follow the player. Once you start getting into other entities and stuff on the map it makes things a lot less complicated. It also allows for better camera control (I think). For example, in my game I use a loosely following camera, it doesnt lock dead on the character (Like the example code I showed you would). It kinda follows the player around.

Example of one axis:


	if((mapX*-1)-player.getEntityX() >= -197){
		if((mapX*-1)-player.getEntityX() >= -161){
			mapX += player.getEntitySpeed();
		}else{
			mapX += player.getEntitySpeed()/2;
		}
	}

Basically it’s checking where the player is, if the difference between the reverse of mapX/Y and playerX/Y is too high or low (depending on the direction) it moves the map at half the rate of the player’s walk speed, if you go too far, it matches it. If you watch my latest video you can see it in action as the player walks around. You’ll notice the map movement isn’t as rigid. But, you need 4 of these. This example is only for one direction.

But soft camera mechanics like that are a lot more complicated if your system rely on moving the map instead of the player. I prefer to move the player and have the map play catchup.

Either way though, it all depends on what you’re doing. But if you move the map instead of the player, it’s easier, if you move the player instead of the map (and then have the map follow you) I think it offers more control. :smiley:

I will need to look into camera mechanics in the future when my programming gets betters :P. Am I able to use the delta timer on tile based games? I can’t seen to get my enemies to move position during the timer D:

Delta is just the time it takes between 2 frames to render, it’s really mostly used for consistent movement speeds despite framerate fluctuation. personally I don’t use Delta, I’d rather my game slowdown when the frame rate drops. :wink:

When you start doing complex calculations (like collision detection) sometimes delta can cause problems, like getting stuck inside objects when the framerate drops. A lot of tutorials/people swear by delta, but I honestly think it cases more trouble than it’s worth because it can cause a lot of calculation glitches with movement.

If your game can run a solid 60FPS (or whatever you set it to run at) on most machines, using delta in your calculations won’t make a huge difference.

Ahh I see. The tutorial was based on delta to count if a bullets have “died” yet but I would prefer checking if the enemy has been killed or destroyed and then render. At the moment, the enemy will render but will not fall down and will just blink in 1 spot

Are you sure you’re not taking about update ticks? I’m kinda curious how it’s using delta to do that, all delta is is the time (usually nanoseconds when things are running smoothly) that it takes between 1 frame render and another.