Scrolling!!

BlitzMax Forums/BlitzMax Programming/Scrolling!!

luke101(Posted 2006) [#1]
I have a question on scrolling and maps. I am creating a RPG game 2D. When I load my map do I load a very large picture or what. I am not sure how this would go. If I load a large picture that will take alot of memory right? Is there any technigue you guys use to scroll large maps?


Mordax_Praetorian(Posted 2006) [#2]
If you're doing an RPG, you should be using a tile based engine


luke101(Posted 2006) [#3]
OK, How would I implement a tile based engine. This is only my second game so i have no idea how to go about this. If there is any information on the net that is good plz point me to it. Thanks for any responses.


Dreamora(Posted 2006) [#4]
If it can run: Thats the problem, on this system NOTHING will run done with Blitzmax, beside GUI apps and console apps.

Your graphics card does not qualify as 3D card and thats the total minimum. (and Windows 95 does not qualify as required OS btw)


Abomination(Posted 2006) [#5]
http://www.blitzbasic.com/Community/posts.php?topic=55290#616699
This should get You on your way...


CS_TBL(Posted 2006) [#6]
It's just like a 2d array, that's all to it.

The 2d array is your mapdata, each element is a tile. Tiles are equal in size. Each tilenumber corresponds with an X,Y coordinate in a big image with all the tiles. The most easy way is to use LoadAnimImage, then each tile has a number.

Next there's the mapviewer, some kinda viewport with a given width and height (in tile units usually), and then you simply draw tiles in that viewer in a for y for x construction (cover only the size of the mapviewer!). Within these for loops you grab the value of each array element, add some x- and y-offsets to them so you can move around, and then draw the correct image frame on the x and y coords.

It's very simple, just think simple: it's a 2d array.. what all do you need to walk through it. Heck, forget images, just test on the debugscreen with text orso .. and when it's ready: support images.


luke101(Posted 2006) [#7]
OK, so you are saying that I can put the tile bimaps in an array, then create a viewport the size of the screen? Then scroll the rest of the map?

Where is the best place I can get tiles?


Raph(Posted 2006) [#8]
Create a 2d array that stores the map. Each element in the array is the index of a tile. Store your tiles all on one image (an AnimImage) and draw the frame that is referenced (not only is this easiest, it's also faster).

Don't draw the whole map. Assume your guy is at the center of the screen, figure out how many tiles he can see to the left/right and up/down. Do a loop that only draws elements in the array from -20 x and -10 y of where he is (or whatever the number is), and to +20 +10. You don't want to draw everything, but you do want to draw a little bit off the edge of the screen for when you scroll.

Once you have that working, you can do smooth scrolling by using SetOrigin. As the guy moves, create a little offset value that you reset when he crosses a tileboundary.

A quick Google will net you a zillion textures suitable for tiles; many are free for the taking.


Mordax_Praetorian(Posted 2006) [#9]
I advise making your own tiles, or getting someone on the project that can do so

If you use someone elses work, you'll never have the same feeling of accomplishment as you would otherwise, and when people see the finished product, they will see that you took the tiles from elsewhere, and it will be less in their eyes

When you finish your product, you want to be able to boast that all of the content was created specificly for your game