Welcome, Guest. Please login or register. Did you miss your activation email?

Author Topic: Why tile map over 1 large picture?  (Read 4052 times)

0 Members and 1 Guest are viewing this topic.

sdweim85

  • Newbie
  • *
  • Posts: 2
    • View Profile
    • Email
Why tile map over 1 large picture?
« on: April 19, 2012, 09:47:24 pm »
I'm new to all this game programming stuff so forgive me if my questions seem awful.  I'm making a 2d 8 bit game in SFML C++ and I keep reading these long tutorials for building tile based maps, and tile management code.  Why can't you just make a multi-layered level in photoshop and import that entire picture into your game.  Just have the base level impassable, the background and extras passable, and place your sprites on the map.

From what I've read making tile sets is the common practice.  Is loading one giant picture slower?  I figure it would be easier on the code just to point to one .bmp and not a giant Array of numbers pointing to tons of tiles,

julen26

  • Jr. Member
  • **
  • Posts: 89
    • View Profile
    • http://julen26.blogspot.com
Re: Why tile map over 1 large picture?
« Reply #1 on: April 19, 2012, 10:05:08 pm »
It's just because you can save maps represented by lightweight files. A large image file is bigger than a text file with a few bytes(or KB).
For speed people recomend to draw tiles in a RenderTexture once, and then draw it every loop.

Sorry about my pour post, im writing from my smartphone
« Last Edit: April 19, 2012, 10:08:58 pm by julen26 »

Laurent

  • Administrator
  • Hero Member
  • *****
  • Posts: 32498
    • View Profile
    • SFML's website
    • Email
Re: Why tile map over 1 large picture?
« Reply #2 on: April 19, 2012, 10:19:15 pm »
Tiles:
- allow worlds of unlimited sizes to be represented by a small texture (the tileset), which is faster to load, lightweight to store in video RAM and more efficient to process by the graphics card
- provide a logical representation of the world, which can be used for collision detection etc., not just for drawing
- make it easy to edit the world (no need to deal with an image editor)
- allow different tilesets to be applied to the same world (probably not THE big feature, but why not?)

Huge images:
- probably exceed the maximum texture size allowed by graphics cards, so they have to be split anyway :)
Laurent Gomila - SFML developer

sdweim85

  • Newbie
  • *
  • Posts: 2
    • View Profile
    • Email
Re: Why tile map over 1 large picture?
« Reply #3 on: April 19, 2012, 10:47:16 pm »
The maps I'm thinking of creating are 8 bit.  So like Mega man map size.  So they won't even big that big to begin with, and they will be split into sections.  There are even tile map creators that can save to bitmap anyways so making changes wouldn't be that difficult.

HKei

  • Newbie
  • *
  • Posts: 23
    • View Profile
Re: Why tile map over 1 large picture?
« Reply #4 on: April 19, 2012, 11:17:56 pm »
If your maps end up smaller than 4096x4096 pixels you're probably fine, but why bother? Setting up a tile map system isn't that hard, and saves time in the long run. Though of course if you want to do it like that, noones actually stopping you. You can just try if your approach works for the game you're using, just try to keep your code flexible enough so you can try something else if it doesn't.

 

anything