×

Discussion Board

Results 1 to 10 of 10

Thread: Tiles

  1. #1
    Registered User
    Join Date
    Nov 2007
    Posts
    6

    Tiles

    Hi

    I am new to game programming. I have downloaded Nokia's 2D example. I understand pretty much what is happening. However one thing I can't get my head around is tiles. There is one mbm file, which contains one bmp, level0.mbm. From this the entire background is created. How is that so? The image contains different aspects of the backgound, like mountains and things to jump on. It is only one image though. If anyone has docs on this, I would be grateful.

  2. #2
    Nokia Developer Moderator
    Join Date
    Sep 2004
    Location
    Tampere, Finland
    Posts
    11,359

    Re: Tiles

    level0.mbm contains 2 bitmaps, each of them holding a set of sprites (I hope I'm not misusing the term here).

    Here's how you can have a look inside the mbm file:

    Code:
    F:\Work\Example2D\data>bmconv /v level0.mbm
    
    
    BMCONV version 112.
    level0.mbm is a File store containing 2 bitmaps
    
    Bitmap 1 information:
    Pixel size 1224 x 8
    Twips size 4337 x 28
    12 Bpp Colour
    12 bit RLE compression 23%
    
    Bitmap 2 information:
    Pixel size 1224 x 8
    Twips size 4337 x 28
    16 Bpp Colour
    16 bit RLE compression 32%
    
    
    F:\Work\Example2D\data>bmconv /u level0.mbm bm1.bmp bm2.bmp
    
    
    BMCONV version 112.
    Decompiling...
    Epoc file: level0.mbm
    
    Bitmap file 1   : bm1.bmp
    Bitmap file 2   : bm2.bmp
    Success.
    
    F:\Work\Example2D\data>
    -- Lucian

    If you are not yet a DVLUP member it is time to correct that mistake :) Click here to join: http://www.dvlup.com/lucian/Invite

  3. #3
    Registered User
    Join Date
    Nov 2007
    Posts
    6

    Re: Tiles

    Hi

    Thanks for the reply. I knew that already. My question was more how are those two bmps used to make an entire game. For example the first sprites in that picture are diamonds. How are they cut from the bmp and placed in the right location.

    I think this is the call:

    iTileMap = CTileMap::NewL( iBmTile, TSize( KMapW, KMapH ), KLevel0,/* this, */ iSystem );

    If you look at ctile.h they are located but I don't know how.

    Thanks

  4. #4
    Nokia Developer Moderator
    Join Date
    Sep 2004
    Location
    Tampere, Finland
    Posts
    11,359

    Re: Tiles

    A bitmap has 8x1224 pixels. With the sprite size being 8x8 that means that the bitmap contains 153 sprites.

    In level0.h the defined map has 3x22x255 tiles, for each tile specifying which of the sprite to be loaded (values between 0 and 152).

    Each set of 22x255 tiles represents a layer of graphics which overlapped create the graphic environment of the game.

    The rest is in the source code ...
    -- Lucian

    If you are not yet a DVLUP member it is time to correct that mistake :) Click here to join: http://www.dvlup.com/lucian/Invite

  5. #5
    Registered User
    Join Date
    Nov 2007
    Posts
    6

    Re: Tiles

    Thanks alot, that's what I was trying to figure out.

    I still don't know, how this is mapped to the screen? For example, how are those mountains put there in that order? The diamonds and monsters I can see in code, but not that background stuff.

    Thanks for the help.
    Last edited by Democritus; 2007-12-09 at 20:08. Reason: bad spelling

  6. #6
    Nokia Developer Moderator
    Join Date
    Sep 2004
    Location
    Tampere, Finland
    Posts
    11,359

    Re: Tiles

    Does this help ?
    -- Lucian

    If you are not yet a DVLUP member it is time to correct that mistake :) Click here to join: http://www.dvlup.com/lucian/Invite

  7. #7
    Registered User
    Join Date
    Nov 2007
    Posts
    6

    Re: Tiles

    Hi,

    Ok thanks, I understand the basics of it now. It seems quite a system, just to make a background. If I want to change the 3rd pixle down from the top left, I must count 459 ( 153 x 3 ) elements along the array. I'm guessing there must be a simpler solution.

  8. #8
    Nokia Developer Moderator
    Join Date
    Sep 2004
    Location
    Tampere, Finland
    Posts
    11,359

    Re: Tiles

    There are many ways of skinning a cat I would assume that those guys who wrote this app had some kind of visual level editor otherwise one would go nuts setting those values.
    -- Lucian

    If you are not yet a DVLUP member it is time to correct that mistake :) Click here to join: http://www.dvlup.com/lucian/Invite

  9. #9
    Regular Contributor
    Join Date
    Jan 2005
    Location
    Malmö, Sweden
    Posts
    157

    Re: Tiles

    There is a lot of visual tile map editors out there, do a google on "Tile Editor".

    I'd recommend using one of those for creating your maps, only masochists create tile maps by hand

    In the "old days", you often made a tile map editor from the same engine you used in your game, specific for the game you were creating.

  10. #10
    Registered User
    Join Date
    Mar 2008
    Posts
    1

    Re: Tiles

    Hi,
    Even I am facing same problem in understanding the code, It seems tile map is defined in 3 layers can u tell how that is and do u know any free tile editor tool....

Similar Threads

  1. Does tiles cache helps to boost FPS on Nokia60?
    By alex_raider in forum Mobile Java Media (Graphics & Sounds)
    Replies: 1
    Last Post: 2006-01-16, 02:38
  2. Tiles / Image problem (urgent)
    By cmonteiro in forum Mobile Java Media (Graphics & Sounds)
    Replies: 0
    Last Post: 2004-10-14, 13:42
  3. Tiles and controls
    By zono666 in forum Mobile Java Media (Graphics & Sounds)
    Replies: 5
    Last Post: 2004-01-13, 15:25
  4. Colision Detection between tiles and Sprites
    By tjankovic in forum Mobile Java Media (Graphics & Sounds)
    Replies: 0
    Last Post: 2004-01-08, 08:38
  5. Framerate with 8*8 tiles (S40)
    By Stengun in forum Mobile Java Media (Graphics & Sounds)
    Replies: 5
    Last Post: 2003-12-24, 11:06

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  
×