Jump to content
  • Advertisement
Sign in to follow this  
Anonyymi

OpenGL SDL and scrolling tilemaps

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

Hello, I need to do scrollable tilemap for my upcoming topdown gameproject. But i don't know how should i do it like i want. I'm using SDL and OpenGl. Let's say the whole game map is size 10000 x 10000 pixels and visible area on screen is 800 x 600. I would like to have different tilemaps for different areas. For example if i read tilemap data from textfile, i have multiple textfiles for different areas. And i would like the coordinates to stay like they are, meaning that if my character is at position x=5000 and y=5000, i blit the screen from x=4600 and y=4700 to x= 5400 and y= 5300 so the character is middle of the screen(Huh i hope i counted those coordinates right). What would be the best way to do this? Should i even use tilemaps? Only thing why i even thought about tilemaps is because those should be faster(?) and easier to graphics artist to design and make levels. I've been searching and reading different posts and articles about this, but didn't actually find any solutions. Hope you understood what i mean :) Thanks!

Share this post


Link to post
Share on other sites
Advertisement
Quote:

And i would like the coordinates to stay like they are, meaning that if my character is at position x=5000 and y=5000, i blit the screen from x=4600 and y=4700 to x= 5400 and y= 5300 so the character is middle of the screen(Huh i hope i counted those coordinates right). What would be the best way to do this?


I cant say as whether its the best, but everytime i started (and never finished) a topdown 2d game, I always used tilemaps. I suppose for what your suggesting, lots of different areas put together as one big map wouldnt be as easy as just having one big ol area, but its very easy to have your character stay central to the screen and scroll about with a tilemap. They are easier for artists to produce for in some ways, because of the ability to loop textures, keeping file sizes and memory use down.

The only thing i never implemented was a sort of predictive caching of tiles; I tended to load the whole map at once, but only render that 800x600 area the screen was at. This tended to slow things down on bigger maps

Share this post


Link to post
Share on other sites
Sign in to follow this  

  • Advertisement
×

Important Information

By using GameDev.net, you agree to our community Guidelines, Terms of Use, and Privacy Policy.

We are the game development community.

Whether you are an indie, hobbyist, AAA developer, or just trying to learn, GameDev.net is the place for you to learn, share, and connect with the games industry. Learn more About Us or sign up!

Sign me up!