Jump to content

  • Log In with Google      Sign In   
  • Create Account

Need Help Making a map


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 factorXero   Members   -  Reputation: 101

Like
0Likes
Like

Posted 23 August 2012 - 07:20 PM

Hello! I have been working on some very small projects all of which don't require a map or background image other than a black screen. I am looking to make a pokemon type map where there is a map and buildings and what not and the character stays in the middle at all times. I am using Microsoft Visual C++ and using Allegro 5 with it.

tl:dr Need help starting to make a pokemon type map.

Any and all help is appreciated. I just need a starting point. I will put in all the work I need for the problem solving but I really dont know where to start.

Thanks!
factorXero

Sponsor:

#2 Servant of the Lord   Crossbones+   -  Reputation: 19596

Like
5Likes
Like

Posted 23 August 2012 - 09:51 PM

Pokemon, or at least older Red, Blue, and Yellow handheld versions, use what's called a 'tile based map'.

Instead of having artists draw huge images of the entire world, which would take ages and waste alot of memory (every single pixel in the world must be saved), the artists draw small "tiles" instead. Tiles are pieces of images that can be recombined and re-arranged by the people making the maps.

A large area like this:
Posted Image

Can be created easily from the separate "tiles".

Here's the scene broken into tiles:
Posted Image


That entire map only took 6 tiles to make.
Posted Image


I explain the basics of how tile maps work here.
Googling "Tile maps C++ Allegro" will probably provide some good tips as well (and perhaps some bad tips as well, but meh - such is the internet).

If you have any questions or need more help, feel free to ask and we'll do our best to help.
It's perfectly fine to abbreviate my username to 'Servant' rather than copy+pasting it all the time.
All glory be to the Man at the right hand... On David's throne the King will reign, and the Government will rest upon His shoulders. All the earth will see the salvation of God.
Of Stranger Flames - [indie turn-based rpg set in a para-historical French colony] | Indie RPG development journal

[Fly with me on Twitter] [Google+] [My broken website]

[Need web hosting? I personally like A Small Orange]


#3 laztrezort   Members   -  Reputation: 968

Like
3Likes
Like

Posted 23 August 2012 - 10:20 PM

To add to what SOTL said:

I had success years ago using a tile map editor called Mappy http://www.tilemap.co.uk/mappy.php with Allegro - there is even a "playback" library you can download that has a minimal tile engine built in.

Note that this was years ago, so I'm not sure which version of Allegro it works directly with, so YMMV.

#4 Shippou   Members   -  Reputation: 1537

Like
2Likes
Like

Posted 26 August 2012 - 04:21 PM

This goes into more detail about 2D tile maps http://wiki.sheep.art.pl/Tiled%20Map%20in%20PyGame and gives examples . You'll have to translate Python to C++, but it shouldn't be too difficult.

 Reactions To Technologies:
1. Anything that is in the world when you’re born is normal and ordinary and is just a natural part of the way the world works.
2. Anything that's invented between when you’re fifteen and thirty-five is new and exciting and revolutionary and you can probably get a career in it.
3. Anything invented after you're thirty-five is against the natural order of things.

- Douglas Adams 2002


 


#5 LennyLen   Crossbones+   -  Reputation: 3795

Like
0Likes
Like

Posted 27 August 2012 - 05:17 PM

Note that this was years ago, so I'm not sure which version of Allegro it works directly with, so YMMV


There are versions of Mappy for all versions of Allegro.

#6 shadowgamesco   Members   -  Reputation: 326

Like
1Likes
Like

Posted 27 August 2012 - 10:19 PM

Tiled maps are definitely the way to go for what you're asking. Try something like this:

1) Load the data from a .txt file that looks something like this:

1 1 1 1 1 1 1 1 1 1
1 1 0 0 0 0 0 0 1 1
1 1 0 0 0 0 0 0 1 1
1 1 0 0 0 0 0 0 1 1
1 1 1 1 1 1 1 1 1 1

2) Loop through the data from the .txt file row by row. For each 1, add a wall image, for each 0 add a floor image. Add the image to an array, with each row as its own array. Putting all of the rows in order, and another array. That makes a 2D array which would represent all of the tiles of your map.

3) In your main game loop, loop through your 2D map array, rendering each tile image at the appropriate position. I would even consider going as far as having a tile class, to create tiles for your 2d array that hold not just it's image, but also it's position, weather or not it's a walkable tile, etc. Stuff like that.

That's just a basic idea of what I would recommend, and the above would only display a room, but thats the concept. Tiled maps are actually a lot more simple than people think!

Also if you like the idea of tiled maps, when you become more familiar with them, a really interesting topic is random map generation for generating random dungeons, caves, etc. That way you don't have to load a .txt file, it's all generated. It also give each new map a whole new feel but uses the same tiled map idea. If you're interested at all here is a guide I wrote on 2D tiled random map generation.

http://breinygames.b...generation.html

It would be a pretty cool thing to implement in a pokemon style game. Good luck!

Edited by breinygames, 27 August 2012 - 10:20 PM.





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