Sign in to follow this  
lordcorm

Mapes?

Recommended Posts

In a 2d game do you have to have your maps in sprites or can you make it one big thang. Basicaly can you make your maps like runescape on big map no sprites. Thanks Guys

Share this post


Link to post
Share on other sites
Its your game - you can do it however you like :)

That's what's wonderful about writing your own code.


EDIT: Though, to be fair. I'd start by implemented a tiled map - a map composed of many, often repeated tiles. There are a lot of ways to go about this, but perhaps the easiest is to maintain a single-dimensioned array of tiles:

struct Tile {
// represents a tile which can be rendered
};

const int MAP_W = 256; // width of map in tiles
const int MAP_H = 256; // height of map in tiles

Tile yourMap[ MAP_W * MAP_H ]; // array which represents map.


Now, to access an individual tile from this 1D map using a 2D coordinate is pretty simple -

Tile& getTile( int x, int y ) {
if ( x < 0 || x >= MAP_W ||
y < 0 || y >= MAP_H ) return Tile(); // or throw an exception,
// or do something.
return yourMap[ x+y*MAP_H ];
}

Share this post


Link to post
Share on other sites
1) don't cross post in multiple forums

2) you can certainly make your map one big thing but you'll quickly run up against teh upper bounds of texture sizes that your video card supports. the typical video card doesn't support more than 2048x2048 resolution. Most people use what are called "tile maps" to do 2D top down games. You should browse around the Isometric forum and read the docs covering techniques in the Articles & Resources section of this site.

-me

Share this post


Link to post
Share on other sites
yes thank you, i know that but i was asking if you can make one image file thats big thats your map and not a buch on sprites i guess i should have made it clearer.

Share this post


Link to post
Share on other sites
Hey thanks srry about the other post i didnt know that i was putting it in visual arts when i wanted it in the begginners and srry about the other post above this one i was anserwing musu's anserw.

Share this post


Link to post
Share on other sites
Quote:
Original post by lordcorm
yes thank you, i know that but i was asking if you can make one image file thats big thats your map and not a buch on sprites i guess i should have made it clearer.


well because of texture size limitation you'd have to cut it up during runtime into smaller image sections anyway. So whatever seems conceptually easier to you at the moment is where you should start. There is typically no right or wrong answer in game-making. There's always at least 5 ways to do most everything.

Especially if this is your first project just pick something and run with it.

-me

Share this post


Link to post
Share on other sites
Quote:
Original post by lordcorm
yes thank you, i know that but i was asking if you can make one image file thats big thats your map and not a buch on sprites i guess i should have made it clearer.

Yes you can, as long as the image itself is supported by the hardware (usually safe to assume that 1024x1024 textures will be fine).

You may want to take the tiled map approach, simply because
  1. Its significantly better performing on large maps
  2. Simplifies the content creation process
  3. Is probably easier in some respects.


Also note that quite a few games use tile maps very well - to the point where you can't tell that tiles are even being used. I'm too lazy to google some images on the subject, but basically most GB/GBA games use some form of tile mapping (since its built into the hardware) to get the job done. It may just not be directly apparent.

Are you sure the game you're attempting to emulate just uses one big texture?


EDIT: I'm getting too slow these days XD

Share this post


Link to post
Share on other sites
Quote:
Original post by Mushu
Its your game - you can do it however you like :)

That's what's wonderful about writing your own code.


EDIT: Though, to be fair. I'd start by implemented a tiled map - a map composed of many, often repeated tiles. There are a lot of ways to go about this, but perhaps the easiest is to maintain a single-dimensioned array of tiles:

struct Tile {
// represents a tile which can be rendered
};

const int MAP_W = 256; // width of map in tiles
const int MAP_H = 256; // height of map in tiles

Tile yourMap[ MAP_W * MAP_H ]; // array which represents map.


Now, to access an individual tile from this 1D map using a 2D coordinate is pretty simple -

Tile& getTile( int x, int y ) {
if ( x < 0 || x >= MAP_W ||
y < 0 || y >= MAP_H ) return Tile(); // or throw an exception,
// or do something.
return yourMap[ x+y*MAP_H ];
}

ok thanks

Share this post


Link to post
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now

Sign in to follow this