2D Platform - Scrolling

BlitzMax Forums/BlitzMax Beginners Area/2D Platform - Scrolling

psychoullis(Posted 2006) [#1]
Hello!
I am playing around with BMAX and for the first time I really believe I can make a game I want :)

Anyway. I have created my basic type (you know, bullets, guns, characters) but I dont know how to make the scrolling.

The game will be (!) side scrolling (to the right) but I have trouble figuring out how to do what i have in mind.

Well to begin with, I want my game enviroment to be like those in Worms game (the 2D worms game). So how can I do this?

I have read about tile-based scrolling but I cant find a way to relate it to what I am looking for.

I would really appriciate your help as I dont know how this technique is called, so I can look for it.

Thank you for reading.


ImaginaryHuman(Posted 2006) [#2]
That kind of environment is not entirely easy to do in Blitzmax because not only is it very inefficient and clumsy to read from the graphics buffer, but it's also difficult to implement a sustainable game world larger than the screen. The backbuffer is usually trashed when you Flip() the screen into view so it's not as if you can keep making modifications to the same landscape image over and over without some other techniques. Since those games read the graphics buffer quite a bit that is also a serious bottleneck. I recommend doing all modifications that you want to keep track off off-line in main memory, and only using the visible display as a display device. You should then spool pieces of landscape to the images in video ram when they alter. Something like that. Or just go with non-scrolling. But you said you want it scrolling one way - so.... endless game world that scrolls is much easier to maintain than one that preserves all changes everywhere.


smilertoo(Posted 2006) [#3]
scrolling is easy but its the detailed collision environment that's hard, i cant see how to do it without resorting to big bitmaps.


psychoullis(Posted 2006) [#4]
Thank you for the answers guys. I think I understand what you explained.
However, I did not understand how this enviroment is created in the first place. Is it one big image?? Or you have to split the image up?

Metal Slug game has also a very nice enviroment (yes different than worm style). This kind of enviroment is easier to implemend? And if you are kind enough could you explain the basic princibles, so that I know where to find info.

Thank you very much.


ImaginaryHuman(Posted 2006) [#5]
Not famliliar with that game, sorry. Generally speaking in the old days you would just have a graphics buffer, would draw land to it, would then destruct parts by removing some pixels etc. Simple stuff. These days the graphics buffer does not reliably exist after doing a Flip() of the double buffered display, so you have to redraw the whole visible area each frame.

To do that you obviously have to have all the graphics that you need stored somewhere. Generally speaking it has to be in images. YOu can try one big image but there is a limit of the maximum image size supported by any given graphics card so you would be better off splitting it up into say 256x256 size chunks, one image each. Even when that is the case, you would have to draw all the visible parts of the landscape, draw any new destruction or changes, then re-grab all image parts that changed so that next frame you are drawing the changes you kept. GrabImage is not always very quick.

What we need to know is is this a turn based game, do you want it to have lots of realtime action, is it going to be scrolling only in one direction, and do you intend to modify the landscape?


psychoullis(Posted 2006) [#6]
Thank you for the great info!
Since I am a beginner I will keep things simple. No destruction to the environment that is.

Anyway lets start from the beginning. Which technique would you recommend me to read and (try to) program, if a want:

1) Simple 2D scrolling to one direction
2) No destructable env.
3) Real Time


Thank you again.


Jesse(Posted 2006) [#7]
there is a new Blitzmax book out in print by Sloan Kelly if you are willing to spend the money to help you. if you are not, you can download the source code from the book. There is a beginners example of a scroller game in there. You can get the books souce code from Sloan Kelly website:
http://www.sloankelly.net/


ImaginaryHuman(Posted 2006) [#8]
If you are scrolling in one direction only and you never have to go backwards, that makes it easier to do because now you only have to be concerned with drawing what is visible. You could most probably just draw your current normal non-destroyed environment as like a simple tilemap scroller, and then draw destruction on top of it, in realtime, each frame. Since you probably will be scrolling the destruction out of view sooner or later, you shouldn't have to worry much about it slowing down due to too much destruction objects onscreen.