Sign in to follow this  

RPG/Free-roaming Map's different areas

This topic is 3341 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

Say you have a simple Final Fantasy style RPG or perhaps a simple 2D game like Fallout wherein there's some form of world map that the player can traverse and then enter different towns on the world map which then brings them to an altogether separate screen as it "zooms" in to street level. So while in that town, you've just got that town on the screen and to go to another town you need to leave the current town and enter the world map again. OR Your character is walking around the world/town and enters a shop (which on the outside only takes up a few tiles) at which point the shop takes up the entire screen and you can wander around in there etc. until you leave the shop. Alright, that was probably needlessly specific and detailed, but I just want to be clear ^_^ My question is: The world map may be stored as some kind of array of tiles in Map class perhaps and the same would probably work for the layout of towns/shops/caves/whatever. However, how is the implementation of something like this usually handled? Or what's a good way to handle it? I mean, should each area/dungeon/town be its own separate Game State (as Lazy Foo seems to suggest here: http://lazyfoo.net/articles/article06/index.php) OR when you need to change the player's location from the world map to a town should you just load in a different array of Map tiles? And do whatever else like set the player's location to Town X or something then do all the logic based on how it should be in Town X. I assume making a Town or Area or GameScreen class to organize each different area would be good but since game states seem best used when the logic, rendering and controls of 2 parts of a game are very different (which in the case of entering a town/cave wouldn't be) it seems to me it might be unnecessary and needlessly awkward to actually create a different state. Probably went on for too long there, but bleh, you see what I mean. There are a lot of RPGs by hobbyist programmers out there it seems - what are the ways most of them do this?

Share this post


Link to post
Share on other sites
"OR when you need to change the player's location from the world map to a town should you just load in a different array of Map tiles? And do whatever else like set the player's location to Town X or something then do all the logic based on how it should be in Town X"

That one. You should store your town maps exactly the same as your world map, then just switch between them when needed. This way you don't need any extra coding other than just whatever you need to load in the new map.

Share this post


Link to post
Share on other sites
Alright cool...

So I suppose then a good way to do it would be to have a pointer to whatever map you're on and then do CurrentMap->draw() and whatnot?

Also, it would be the exact same concept for different levels in a side-scrolling/top-down shooter, right?

Share this post


Link to post
Share on other sites
Quote:

So I suppose then a good way to do it would be to have a pointer to whatever map you're on and then do CurrentMap->draw() and whatnot?


Right (Your pointer will point to a class or interface that both your world map and your town map are a type of).

Quote:

Also, it would be the exact same concept for different levels in a side-scrolling/top-down shooter, right?


Yes. This concept is called abstraction, by the way.

Share this post


Link to post
Share on other sites

This topic is 3341 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