SDL and scrolling tilemaps

Started by
0 comments, last by ConorH 16 years, 7 months ago
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!
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

This topic is closed to new replies.

Advertisement