Hi !
Featured games (84)
games approved by the League of Dukes
Games in Showcase (604)
Games in Android Showcase (171)
games submitted by our members
Games in WIP (654)
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  
  [noob] hows a "map" like?  (Read 1419 times)
0 Members and 1 Guest are viewing this topic.
Offline fermixx

Senior Newbie

« Posted 2009-08-15 03:56:40 »


im pretty new at game development, so this is beyond java programming.

I was wondering about how's the general structure of a map in a normal 2d platform game.

The specific questions are:

1º regardin the image, is it a very wide image and you just print the part that is inside the frame? how do you handle de coords of everything?

2º how do you implement the ground or walls? i heard about tile maps divided in cells, and each cell is either "air" or "solid" but, if you need high precision, i guess you need a really big array of bools, i mean, REALLY big. is that true?

3º how do you place objects and or enemies that are outside the screen? you just set their x to be outside the display area? (e.g. you have a 1024x640 frame, so you place the enemy at 2048. But, when your character moves, what happens?

Im a really newbie in game programming and i just dont imagine how things are. Besides that, all tutorials talk about games like arcanoid, tetris and SPACE INVADERS, but none of them about a game which involves solid and not solid objects (and maps bigger than the actual display size).

If anyone has a mario-style tutorial or code of a rip off (that would be cool) it would be the perfect answer for my questions, and a great help too.

I dont want the exact algorithm, just something explanatory to have a brief idea of how its like.

thank you in advance


RTS game or a big rock-paper-sissors ?
Offline Nate

« JGO Bitwise Duke »

Medals: 165
Projects: 4
Exp: 14 years

Esoteric Software

« Reply #1 - Posted 2009-08-15 06:00:44 »

To try to answer some of your questions...

1) The screen is typically drawn as tiles. You can simply have a data structure with the type of tile at each location.

2) The simplest form is a tile is either movable or not. The next step is probably supporting a square tile with a triangle shape (from corner to corner).

3) Objects outside the viewport are not drawn. When the character moves, the map and any objects are redraw to show the new location.

On very large maps some tricks can be done, like not running the AI for an enemy that is very far away. When the player gets close enough, but with the enemy still not on screen, then you would run the AI.

You might look at Slick and TilED.

Demo of tilemap with Slick:

More interesting, scrollable tilemap:

TilED editor:

TilED homepage:

Offline Renoria

Junior Devvie


« Reply #2 - Posted 2009-08-15 07:10:36 »

what I use is an ArrayList of line segments as platforms. That way I can have sloped tiles in any direction I want. Good luck
Games published by our own members! Check 'em out!
Legends of Yore - The Casual Retro Roguelike
Offline Nate

« JGO Bitwise Duke »

Medals: 165
Projects: 4
Exp: 14 years

Esoteric Software

« Reply #3 - Posted 2009-08-26 07:44:01 »

2) The simplest form is a tile is either movable or not. The next step is probably supporting a square tile with a triangle shape (from corner to corner).
Found this and thought of my post here.

Offline fermixx

Senior Newbie

« Reply #4 - Posted 2009-08-27 08:09:22 »

i was reading that some time ago, if im not wrong it was with actionscript. its pretty similar though.

im gonna read it a bit more when i have time.

if its you who wrote the tutorial, thanks for sharing Smiley, finally a non space-invaders tutorial !!

RTS game or a big rock-paper-sissors ?
Pages: [1]
  ignore  |  Print  
You cannot reply to this message, because it is very, very old.

SHC (30 views)
2015-08-01 03:58:20

Jesse (20 views)
2015-07-29 04:35:27

Riven (40 views)
2015-07-27 16:38:00

Riven (22 views)
2015-07-27 15:35:20

Riven (25 views)
2015-07-27 12:26:13

Riven (15 views)
2015-07-27 12:23:39

BurntPizza (37 views)
2015-07-25 00:14:37

BurntPizza (46 views)
2015-07-24 22:06:39

BurntPizza (31 views)
2015-07-24 06:06:53

NoxInc (37 views)
2015-07-22 22:16:53
List of Learning Resources
by gouessej
2015-07-09 11:29:36

How Do I Expand My Game?
by bashfrog
2015-06-14 11:34:43

List of Learning Resources
by PocketCrafter7
2015-05-31 05:37:30

Intersection Methods
by Roquen
2015-05-29 08:19:33

List of Learning Resources
by SilverTiger
2015-05-05 10:20:32

How to: JGO Wiki
by Mac70
2015-02-17 20:56:16

2D Dynamic Lighting
by ThePixelPony
2015-01-01 20:25:42

How do I start Java Game Development?
by gouessej
2014-12-27 19:41:21 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‑
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!