guten tag, im trying to make a map editor and i don't know any concepts
can you post some concepts to help me understand
Re: map editor help
Posted: Wed Jul 22, 2009 6:29 pm
by Sanshin77
Try looking around(open source projects ftw), and be a little more specific when making posts.
Im assuming you're creating a 2d map editor for some sort of tile-based game. Try to find out what a tile is and what it would look like in your code. You'd probably want to have multiple layers for better looking levels and a lot of people like having a separate collision "layer". You'll want to use the keyboard and the mouse and translating the mouse coordinates into tile positions is a must. Using some kind of GUI library will be a timesaver, If you're not aiming at completing this very simply and quickly, since more advanced map editors kinda "need" a GUI.
Hope this helped a bit, if there's something else you're unsure of, feel free to be a bit more specific :P
Re: map editor help
Posted: Wed Jul 22, 2009 9:24 pm
by wearymemory
derbon wrote:guten tag, im trying to make a map editor and i don't know any concepts
can you post some concepts to help me understand
You click on the window and it draws stuff.
Re: map editor help
Posted: Sun Jan 03, 2010 6:36 pm
by WSPSNIPER
usually the map is loaded from a .txt file and uses numbers to represent the tile
i just made one ( its crap but works ) i used a vector for a TileList which kept the tiles attributes stored and i used a format for loading form the SDLtutorial website where you save it as number:number ( 1:2 ) and the first number is the image and the second number is the type you would usually use 2 for loops to read through them
after loading you save it by going through the same kindof loop but writing the tileID and tileType to the file
when you place a tile get the position of the mouse and find the tile it is colliding with and set that tiles attributes according the the tile you have picked
This is how the loading looks and the saving looks similar but it is not the actual code it is most of it just giving a refrence
Hope i have helped Oh and the placing tiles and changing them was the hardest for me
for( int Y = 0; Y < MapH; Y++ )
{
for( int X = 0; X < MapW; X++ )
{
cTile tile;
fscanf( file, "%d:%d ", tile.TileID, tile.TypeID );
TileList.push_back(tile);
}
fscanf( file, "\n");
}
Re: map editor help
Posted: Sun Jan 03, 2010 6:58 pm
by GroundUpEngine
WSPSNIPER wrote:usually the map is loaded from a .txt file and uses numbers to represent the tile
This.
Re: map editor help
Posted: Sun Jan 03, 2010 7:40 pm
by Master Jake
Sanshin77 wrote:separate collision "layer"
An old game I used to play didn't just have a "collision" layer, but 2 attribute layers. The attributes were things like (Wall, Warp, No Monster Spawn, Item Spawn, Directional Tile, etc, etc etc.)
The tiles were just to look pretty, but the attributes effected what exactly happened on those tiles. There were 2 layers for attributes because sometimes 1 attribute for a tile just isn't enough. There were plenty of other attributes including a Script attribute which, when placed on a tile, ran a script when a player stepped on that tile.
The script title was based on the location of the script tile (mapMAP_X_Y) e.g. (map2_5_4)
Inside each attribute was additional information. For instance, the warp attribute had a Map, X, and Y for the location of the warp when someone stepped on it.
To this day, the attribute idea is my favorite for dealing with 2D games.
Re: map editor help
Posted: Wed Feb 03, 2010 10:06 pm
by eatcomics
@MasterJake I was going to do that same thing for one of my games :D but I started another project... I need to finish some stuff...
Re: map editor help
Posted: Thu Feb 18, 2010 12:52 pm
by acerookie1
ok i understand loading and saving the format of a map editor even GUI for one, but i dont understand editing the map in the program
Re: map editor help
Posted: Thu Feb 18, 2010 1:15 pm
by ismetteren
acerookie1 wrote:ok i understand loading and saving the format of a map editor even GUI for one, but i dont understand editing the map in the program
I think you should be able to figure that out if you think about it. After all that is what programming is about.
But what you want is a GUI libary with an GUI object that can register mouse clicks and allows you to draw on it. You will also need a way of choosing wich tile you want to draw(use your imagination a drop down list? each number button on the keyboard is mapped to a different tile? there are probably many ways to do it way better than that, but its a start). Now you can translate the mouse click coordinates into a position, maybe you want tiles to be located everywhere, maybe you want them to snap to a gitter. Combining that position, with the tile image gives you some nice data you can put into a tile object and then into an array(vector, list, another datastructure, an array might not be a good idea since it cant expand). You will then draw that array onto the click- and draw-able surface.
If you use java you can probably use a JPane for that click/draw able element and im sure there is an equvelant in C#. I guess that every other GUI libary out there has one too.
Re: map editor help
Posted: Thu Feb 18, 2010 1:42 pm
by MrDeathNote
Lusikka mage has a really helpfull document, i had a quick look at it when i was writing my first map editor. You can can check out her doc here http://www.moosader.com/tutorials.html. I'll also use this as a chance to plug my youtube vid showing my C#/GDI+ map editor which still isn't finished but some day.......
acerookie1 wrote:ok i understand loading and saving the format of a map editor even GUI for one, but i dont understand editing the map in the program
I think you should be able to figure that out if you think about it. After all that is what programming is about.
But what you want is a GUI libary with an GUI object that can register mouse clicks and allows you to draw on it. You will also need a way of choosing wich tile you want to draw(use your imagination a drop down list? each number button on the keyboard is mapped to a different tile? there are probably many ways to do it way better than that, but its a start). Now you can translate the mouse click coordinates into a position, maybe you want tiles to be located everywhere, maybe you want them to snap to a gitter. Combining that position, with the tile image gives you some nice data you can put into a tile object and then into an array(vector, list, another datastructure, an array might not be a good idea since it cant expand). You will then draw that array onto the click- and draw-able surface.
If you use java you can probably use a JPane for that click/draw able element and im sure there is an equvelant in C#. I guess that every other GUI libary out there has one too.
no i'm using the win32 api. and i know how to do the drop down list, menus , right click menus. just editing is the problem. maybe i should write a console version to see if i can anaylze the porblem.
Re: map editor help
Posted: Thu Feb 18, 2010 1:55 pm
by acerookie1
MrDeathNote wrote:Lusikka mage has a really helpfull document, i had a quick look at it when i was writing my first map editor. You can can check out her doc here http://www.moosader.com/tutorials.html. I'll also use this as a chance to plug my youtube vid showing my C#/GDI+ map editor which still isn't finished but some day.......