TILES.

I’d really love to make a 2d top-down tile-based game, similar to Legends of Yore (http://www.legendsofyore.com/) in that you move one square at a time. Unfortunately, I have no idea where to start :clue:

I’ve made a few really basic things using Slick2D, but when I’ve tried to Google where to start with tile-based games, I’ve not been able to find anything D: So, what I’m asking is, could you help me out with starting to program a tile-based game?

Thanks!

I would start by figuring out what you want this game to be. Write out some basic goals before jumping in.

After you’ve got a good idea of what you want it to look like, pick a direction. Separate the game into much smaller tasks and pick one to tackle.

I’m actually working on a top-down tile-based RPG right now and I chose to create the world and a player just so that I could start moving around and testing collision, etc. A couple hours after I started I’ve got a dude running around multiple levels. Using placeholders for your art will speed up the process quite a bit.

For my maps, I’m just using basic arrays to hold integers. Each one represents a different type of tile to draw to the screen. Also, when you move off the screen to the next area, the map get’s loaded as the current level and redrawn.

Right now my game is super simple and easy to get up and running. You can check out the source on my github page and I wrote about the steps I took to get the map up and running on my blog.

TL;DR - Break your ideas down into small bite-sized chunks and pick a direction to go in. You can find more help online for small topics rather than a very large topic like tile-based games.

Now go out there and make another awesome RPG. The world doesn’t have nearly enough of them!

Thanks that was some great advice! I’ve designed the basic idea of the game now. My current task is drawing tiles on the screen. Which is proving to be troublesome :confused:

So I took a look at the source of your game, and at your blog, and found both to be really helpful. But, I’ve come across a problem … How do you draw the array on-screen? In your source, you’ve used:

levels[currentLevel].draw(g);

Which doesn’t seem to work for me :frowning: I’ve made the arrays, and I’ve assigned the numbers to Images, but that bit doesn’t seem to work and I don’t know what else to use.

Thanks!

What’s your problem? Moving exactly one tile like Yore? just simply add the x or y with tile’s size each key press.

And about that array, it’s array of object which has method draw() taking ‘g’ as parameter (which I believe is Graphics).

The problem you are having could be a wide variety of issues. Without seeing your code it is very difficult to figure out what’s going on. Instead, I’ll try to explain what my game is doing to draw the tiles.

For rendering the world to the screen I have 4 classes: World, Level, Tile, and Map.

The Map class simple holds an array for each level. It’s basically just the layout.

The Tile class represents a single tile, so mostly it just loads the right image. It also has its own draw method.

The Level class organizes the tiles based on the appropriate map and has it’s own draw method, which simply calls draw on each tile in the level.

Finally, the World class keeps all the levels organized and calls the proper level’s draw method when needed.

The code that you pasted here is the World class retrieving the appropriate level from the levels array, and calling that level’s draw method. That method then just calls the draw method of each tile in that level.

I hope that I explained it well enough to help you figure out the bug you’ve got going on. If you want more in depth help, feel free to give us your code so we can look over it.

P.S. Glad I could help get you on the right track!