Sign in to follow this  

Best approach to map making for 2d rpgs?

This topic is 4713 days old which is more than the 365 day threshold we allow for new replies. Please post a new topic.

If you intended to correct an error in the post then please contact us.

Recommended Posts

What is the best way to make maps for 2d rpgs... I have a map class and a tile class but as for making the maps I am unsure how to program it. I am wanting an easy click user interface... I have a tile selection box that loads tilesets and allows users to select specific tiles and I want the user to be able to create a new "map" with defined sizes and then select the tile and just click in the cell the want to modify...Thanks!

Share this post


Link to post
Share on other sites
Ok there is something magical 'bout the bathroom. I got an idea...I was thinking render the map to a context and then when the user clicks get the x and y position of the mouse. From that you can get which tile it is in an array of tiles and you can change the bitmap or whatever is needed...Works for me...! Only thing is...can you create a DirectDraw device in something other than a form...? I am using C# and DirectX9 (DirectDraw).

^_^! ~ Krisc

Share this post


Link to post
Share on other sites
Quote:
Original post by Krisc
Ok there is something magical 'bout the bathroom. I got an idea...I was thinking render the map to a context and then when the user clicks get the x and y position of the mouse. From that you can get which tile it is in an array of tiles and you can change the bitmap or whatever is needed


yes, this is pretty much exactly how it is done. good luck. (sorry, dont know anything about C#)

Share this post


Link to post
Share on other sites
I doubt that there is a "best" way. You might want to see if there are other map editors out there and make your game to coincide with how the map is constructed in that editor. Or you might find some open source map editors and modify their code to suite your game.


For my game I've got a guy building our map editor in C++ and QT3. It's still heavly under development, but basically it looks in the tile images directory and loads all those tiles into the right side of the window, then in the main part of the window draws a grid where you can drag and drop, click and drop, etc. Then when we save the map, the editor converts the tile gride into the data structures that our game uses.

We're starting out small with it and not adding all the bells and whistles yet, but rather just building it a piece at a time.

Share this post


Link to post
Share on other sites

Using that method, I would store an index of each tile. Then you are only saving one number instead of two. Then when your program loads the tile, calculate the X and Y values.

X = Tile_Index % TileSet_Width
Y = Tile_Index / TileSet_Width

resulting in the following tile number pattern:
1,2,3,4
5,6,7,8
TileSet_Width = 4

Results in almost half the map size, exluding delimiters.

Share this post


Link to post
Share on other sites

This topic is 4713 days old which is more than the 365 day threshold we allow for new replies. Please post a new topic.

If you intended to correct an error in the post then please contact us.

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