Java-Gaming.org
Play Revenge of the Titans! The situation is critical. We need fancy commanders to defend Earth, the moon, Mars!
Featured games (78)
games approved by the League of Dukes
Games in Showcase (405)
games submitted by our members
Games in WIP (289)
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 968 times)
0 Members and 1 Guest are viewing this topic.
Offline fermixx

Senior Newbie





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

Hi,

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

fermin

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

JGO Wizard


Medals: 81
Projects: 3


Esoteric Software


« Reply #1 - Posted 2009-08-15 08: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:
http://slick.cokeandcode.com/demos/tilemaptest.jnlp

More interesting, scrollable tilemap:
http://slick.cokeandcode.com/demos/scroller.jnlp

TilED editor:
http://mapeditor.org/tiled.jnlp

TilED homepage:
http://www.mapeditor.org

Offline Renoria

Junior Member




...


« Reply #2 - Posted 2009-08-15 09: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!
Try the Free Demo of Revenge of the Titans
Offline Nate

JGO Wizard


Medals: 81
Projects: 3


Esoteric Software


« Reply #3 - Posted 2009-08-26 09: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.
http://www.tonypa.pri.ee/tbw/tut24.html

Offline fermixx

Senior Newbie





« Reply #4 - Posted 2009-08-27 10: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.

Play Revenge of the Titans! The situation is critical. We need fancy commanders to defend Earth, the moon, Mars!
 
Browse for soundtracks for your game!

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

The first screenshot will be displayed as a thumbnail.

The invasion has landed! On Mars! And you're there to beat 'em!
cubemaster21 (60 views)
2013-05-17 21:29:12

alaslipknot (69 views)
2013-05-16 21:24:48

gouessej (99 views)
2013-05-16 00:53:38

gouessej (96 views)
2013-05-16 00:17:58

theagentd (107 views)
2013-05-15 15:01:13

theagentd (98 views)
2013-05-15 15:00:54

StreetDoggy (144 views)
2013-05-14 15:56:26

kutucuk (166 views)
2013-05-12 17:10:36

kutucuk (165 views)
2013-05-12 15:36:09

UnluckyDevil (175 views)
2013-05-12 05:09:57
Complex number cookbook
by Roquen
2013-04-24 12:47:31

2D Dynamic Lighting
by Oskuro
2013-04-17 16:46:12

2D Dynamic Lighting
by Oskuro
2013-04-17 16:45:57

2D Dynamic Lighting
by Oskuro
2013-04-17 16:23:20

Noise (bandpassed white)
by Roquen
2013-04-05 17:36:01

Noise (bandpassed white)
by Roquen
2013-04-03 16:17:38

Java Data structures
by Roquen
2013-03-29 13:21:12

Topic Request
by kutucuk
2013-03-22 21:42:01
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!
Page created in 0.101 seconds with 20 queries.