Java-Gaming.org Hi !
Featured games (83)
games approved by the League of Dukes
Games in Showcase (539)
Games in Android Showcase (132)
games submitted by our members
Games in WIP (603)
games currently in development
News: Read the Java Gaming Resources, or peek at the official Java tutorials
 
    Home     Help   Search   Login   Register   
Pages: [1]
  ignore  |  Print  
  tile based game  (Read 5011 times)
0 Members and 1 Guest are viewing this topic.
Offline clankill3r

Innocent Bystander





« Posted 2011-07-02 20:23:34 »

Hi,

does someone has a good tutorial or example of how to make a tile based game.
(rts kinda way like red alert).
I have been searching for more then a hour but didn't found any good.
I don't want to use any library.

plz help
Offline Cero
« Reply #1 - Posted 2011-07-03 00:13:31 »

well its a broad topic
you basically have an 2-dimensional array of fields/images/textures/tiles/whatever (per layer) used in an Orthographic or isometric fashion.

I don't know of any tutorial in particular but I liked the section in "Developing Games in Java" by David Brackeen in which this is covered.

Offline namrog84

JGO Ninja


Medals: 46
Projects: 4


Keep programming!


« Reply #2 - Posted 2011-07-03 06:57:04 »

Although it requires a little more knowledge and work.  Sometimes if you really cant find a "java tutorial"  look for a tutorial in similar languages, like C# has a similar syntax to Java.  Aside from the rendering and audio aspect, a lot of the game logic will be extremely similar between many different languages. 


Though a tile based game, like Cero said can be a broad topic.

Depending on how complicated your system or game is to be.  Id personally recommend a simple 2D array containing the terrain,  with identification of whats buildable terrain or not.  Then simply have an arraylist of all your buildings locations,  and 1 more list(or could be combined with the buildings one) to contain all your units.  Depending on how you want to handle it. 

Also, you may not find a good tutorial,  try just look for source code and examine how other people have done similiar things.

"Experience is what you get when you did not get what you wanted"
Games published by our own members! Check 'em out!
Legends of Yore - The Casual Retro Roguelike
Offline appel

JGO Wizard


Medals: 68
Projects: 4


I always win!


« Reply #3 - Posted 2011-07-05 14:40:42 »

Terrain is probably the least complicated part. Many start with that, because well, it's an obvious thing to start with. But without units moving on that terrain you don't have much of a game. Unit movement is probably more important, because it's difficult to implement. Jeeps, tanks, soldiers, etc. how are you going to add that so it's convincing like Red Alert?

Unit behavior, movement, AI, physics, pathfinding, etc. is very important.

Check out the 4K competition @ www.java4k.com
Check out GAMADU (my own site) @ http://gamadu.com/
Offline loom_weaver

JGO Coder


Medals: 17



« Reply #4 - Posted 2011-07-05 14:51:32 »

does someone has a good tutorial or example of how to make a tile based game.
(rts kinda way like red alert).

As other posters suggested, start with a simple 2D array for your terrain and show a character moving about in a 'roguelike' style.

I would forget the 'rts' portion for now.  Creating the interface, drawing the graphics, and moving the camera about is a much more complicated task and even if you know what you're doing, it will likely take months to create something that even rudimentary (think boxes and rectangles instead of any graphics) resembles a RTS.
Offline Eli Delventhal

JGO Kernel


Medals: 42
Projects: 11
Exp: 10 years


Game Engineer


« Reply #5 - Posted 2011-07-05 15:02:04 »

I like to use a 3D array, where the 3rd dimension is different rendering/logic layers. Alternatively, you can represent this in multiple 2D arrays, which I'll lay out here because that's probably a little simpler to understand.

1  
2  
3  
4  
5  
6  
7  
8  
9  
10  
11  
12  
13  
14  
15  
16  
17  
18  
19  
//Contains pathing data, information about doors, switches, etc.
private int[][] logicGrid;
//Contains sprites that get rendered beneath the player. Might have null spaces.
private Sprite[][] backgroundSprites;
//Contains sprites that get rendered on top of the player. Might have null spaces.
private Sprite[][] foregroundSprites;
//Contains all the active entities that move around. Units, land mines, etc.
private ArrayList entities;

public static final int GRID_EMPTY = 0;
public static final int GRID_WALL = 1;
public static final int GRID_LAVA = 2;
public static final int GRID_SWITCH = 3;
//etc.

public boolean canMoveTo(int x, int y)
{
    return (logicGrid[x][y] == GRID_EMPTY);
}

See my work:
OTC Software
Offline Mads

JGO Ninja


Medals: 26
Projects: 3
Exp: 6 years


One for all!


« Reply #6 - Posted 2011-07-07 09:43:25 »

Well, Somnium has two articles covering a simple tile based game, Felix. You can find it here: somnium.dk/blog
While it doesn't go in depth with how the low-level code works, it's commented nicely so it should be easy to figure out. It comes with different tiles, animation and collisions (as far as I remember).

Pages: [1]
  ignore  |  Print  
 
 
You cannot reply to this message, because it is very, very old.

 

Add your game by posting it in the WIP section,
or publish it in Showcase.

The first screenshot will be displayed as a thumbnail.

rwatson462 (33 views)
2014-12-15 09:26:44

Mr.CodeIt (23 views)
2014-12-14 19:50:38

BurntPizza (51 views)
2014-12-09 22:41:13

BurntPizza (84 views)
2014-12-08 04:46:31

JscottyBieshaar (45 views)
2014-12-05 12:39:02

SHC (59 views)
2014-12-03 16:27:13

CopyableCougar4 (59 views)
2014-11-29 21:32:03

toopeicgaming1999 (123 views)
2014-11-26 15:22:04

toopeicgaming1999 (114 views)
2014-11-26 15:20:36

toopeicgaming1999 (32 views)
2014-11-26 15:20:08
Resources for WIP games
by kpars
2014-12-18 10:26:14

Understanding relations between setOrigin, setScale and setPosition in libGdx
by mbabuskov
2014-10-09 22:35:00

Definite guide to supporting multiple device resolutions on Android (2014)
by mbabuskov
2014-10-02 22:36:02

List of Learning Resources
by Longor1996
2014-08-16 10:40:00

List of Learning Resources
by SilverTiger
2014-08-05 19:33:27

Resources for WIP games
by CogWheelz
2014-08-01 16:20:17

Resources for WIP games
by CogWheelz
2014-08-01 16:19:50

List of Learning Resources
by SilverTiger
2014-07-31 16:29:50
java-gaming.org is not responsible for the content posted by its members, including references to external websites, and other references that may or may not have a relation with our primarily gaming and game production oriented community. inquiries and complaints can be sent via email to the info‑account of the company managing the website of java‑gaming.org
Powered by MySQL Powered by PHP Powered by SMF 1.1.18 | SMF © 2013, Simple Machines | Managed by Enhanced Four Valid XHTML 1.0! Valid CSS!