Jump to content

  • Log In with Google      Sign In   
  • Create Account


Map editor


Old topic!
Guest, the last post of this topic is over 60 days old and at this point you may not reply in this topic. If you wish to continue this conversation start a new topic.

  • You cannot reply to this topic
5 replies to this topic

#1 NLScotty   Members   -  Reputation: 404

Like
1Likes
Like

Posted 31 August 2013 - 04:25 AM

Hello,

 

I'm thinking about creating my own map editor, with my own saving to file code etc. My goal is something like this : .

 

I'll be using tiles, as a tile could be the size 70x30 (not sure yet). Since I need way more horizontal lenght, cause I will only use it for platformers. I wonder how it is possible that he can create tiles on every place on the map. Is he using tiles, and have the picture of the tile start at given coordinates? Or is this a right way to do it?

 

So instead of a tile having 1 picture, it now has a picture at a given coordinate inside the tile.

 

Grz



Sponsor:

#2 Waaayoff   Members   -  Reputation: 781

Like
0Likes
Like

Posted 31 August 2013 - 07:24 AM

Well there are many ways to do this. You can break down your map into a grid and load only cells that are visible. Each cell would have a list of picture IDs, their coordinates and any other special parameters such as portals/fire/etc... Then it simply becomes a matter of fetching a handle to the actual picture from the loaded ID. 


"Spending your life waiting for the messiah to come save the world is like waiting around for the straight piece to come in Tetris...even if it comes, by that time you've accumulated a mountain of shit so high that you're fucked no matter what you do. "

#3 imoogiBG   Members   -  Reputation: 1133

Like
1Likes
Like

Posted 31 August 2013 - 07:26 AM

He is definetly not using tiles because game object have no alignent in the scene. You're probably confused between 'tile world representation' and 'tiled textures'.

 

tile world representation - that means that he is using tiles to place object. each object lies on a tile. 

 

tiled textures - one texture can contain one ore more images. each image can represent different object(or some part of an object). Each different image on the texture is called tile. Later in code a tile is defined with structure that looks like this { textureName: 'example-grass-tiles.some_extension, tileTopLeftPoint (0,0), tileBottomRightPoint(50, 50) ; }.

 

So when he displays a tile he is writing something like this : 

Draw(objectPosition, myTile.texture, myTileTopLeftPoint, myTileBottomRightPoint); //a tile defined by myTile variable is going to be drawn at point objectPosition);



#4 Kryzon   Prime Members   -  Reputation: 2936

Like
0Likes
Like

Posted 31 August 2013 - 06:05 PM


He is definetly not using tiles because game object have no alignent in the scene.

I agree he's not using tiles in the general sense, but I do think they have some sort of alignment. This is so from the fact that all blocks are fitting properly with each other.

They're most likely block assets of varied sizes that were all painted under the same grid.

 

To create those assets, the artist sets up in his painting program an infinite grid with a spacing of 32x32 pixels, for example, and draws freehand but under that reference grid and with some game-design established constraints, such as "platform heights that are two grid cells high", "slopes that always finish in exact cells" etc.

219p8wz.jpg

 

On the editor, you just need to snap these blocks under a grid of the same size as the reference one used by the artist (in this case, that grid of 32x32 spacing), so they fit together.


Edited by Kryzon, 31 August 2013 - 06:36 PM.


#5 NLScotty   Members   -  Reputation: 404

Like
0Likes
Like

Posted 01 September 2013 - 01:44 PM

He is definetly not using tiles because game object have no alignent in the scene. You're probably confused between 'tile world representation' and 'tiled textures'.

 

tile world representation - that means that he is using tiles to place object. each object lies on a tile. 

 

tiled textures - one texture can contain one ore more images. each image can represent different object(or some part of an object). Each different image on the texture is called tile. Later in code a tile is defined with structure that looks like this { textureName: 'example-grass-tiles.some_extension, tileTopLeftPoint (0,0), tileBottomRightPoint(50, 50) ; }.

 

So when he displays a tile he is writing something like this : 

Draw(objectPosition, myTile.texture, myTileTopLeftPoint, myTileBottomRightPoint); //a tile defined by myTile variable is going to be drawn at point objectPosition);

 

ok thanks guys. So if I understand everything: My map class, will have an array with all the tiled textures, like a square in the map. In this square i will code my tiles. But there could be overlapping between these squares right?

 

In code

class Tile // ur struct
{
    POINT leftTop, RightTop; // the x,y from the square (tiled texture)
}

class TiledTexture
{
     List<Tile> m_currentTiles; // all tiles from this square
}

class Map
{
    const int texture_size = 150; // so a square is 150x150, for example
    TiledTexture[][] m_textures;
}

class Camera
{
     // checks which tiled textures are visible and draws those.
}

Is it also a good idea, that when a tiled texture IS visible, instead of drawing all textures one by one, make one big texture of it and draw that to the screen?



#6 imoogiBG   Members   -  Reputation: 1133

Like
0Likes
Like

Posted 03 September 2013 - 10:17 AM

You need additional file to express where tiles are locaded.

you can use something simple like

<tile_name> <texture_name> <TopLeftCoords> <BottomRigthCoords> or

<tile_name> <texture_name> <TopLeftCoords> <WidthAndHeight> or watherver

 

Example file :

 

myTileDesk.txt :

grass1 grass_tex.bmp 0 0     50 50

grass2 grass_tex.bmp 50 0    100 50

rock1  rock_tex.bmp 0 0       50 50

 

 

Also if you prefer you can use different file that describes tiles for each texture it is up to you

 

 

Later in code:

 

Tile

{

std::string name;

Texture* pTexture;

RECT coords;
}

 

class MyTileManager
{

 

public :

 

Tile* GetTileByName(char* tileName);

 

   private:

vector<Texture> textures;

vector<Tile> tiles;

 

}

 

and probably later

 

DrawTile(Tile*, xPos, yPos);

 

Or some similar structure






Old topic!
Guest, the last post of this topic is over 60 days old and at this point you may not reply in this topic. If you wish to continue this conversation start a new topic.



PARTNERS