scrolling graphics & optimization
Hi there,
I am making a simple test game to get familiar with MW2. A simple @d shooter against one enemy, however since the fight could take different amount of time depending on the player I am having the background scroll in a loop... so far I am using multiple 256 by 256 tiles all linked (position binded to) one tile that has a path animation that is simply scrolling down off the screen and popping back to its position. It loops perfectly but right now I've added a layer of clouds, 3 new 256 by 256 using the same path looping method.. but now the frame rate is getting poopy... Should I drop the whole path movement method and learn how to do camera scrolling instead and make a super long level so that players may have enough time..
Thanks !
Re: scrolling graphics & optimization
You can do looping scrolling with the built-in MMF2 scrolling features. I think in the layer properties you have to choose loop, not sure how to set that up. But really all you have to do is set the scrolling on your player and have the player move. ;)
Re: scrolling graphics & optimization
LOL MW2, I think you meant MMF2 :D
For big backgrounds made from tiles, I would suggest you use the "background image object" extension. It will only display the tiles that are on the screen which means that there is no performance penalty to have massive levels.
Re: scrolling graphics & optimization
No, do what LB suggested. Use a negative (I think) virtual width (I think) and put the backgrounds on a different layer, and horizontal wrap them.
Re: scrolling graphics & optimization
Yes, set the virtual width to -1 (means unlimited) and set Wrap Horizontal (and/or vertical) on. MMF will wrap it around automatically for you as you use the scrolling actions. You can also use MMF layers if you wish which have their own advantages.
If you want to have best performance, use the HWA version instead as it will utilise your 3D card to draw the screen taking that part of the load off the CPU directly. You have to be mindful to some rules and limitations (for example 3D cards can get funny with very large textures and those not in width/height sizes to the power of 2 ... 2, 4, 8, 16, 32, 64, 128 etc) but the performance is worth it.
Oh and set the FPS to 60 (or more with vsync) to ensure a steadier display.
Re: scrolling graphics & optimization
Also make sure that if you use the built in scrolling feature of MMF2, then your images need to be Backdrop Objects. Active objects will not obey scrolling.
Re: scrolling graphics & optimization
Awesome. Thanks for the great replies. I will get rid of all those animated active images and do a proper scrolling background :)
Thanks again.
Re: scrolling graphics & optimization
Alright looks like I'm having some trouble withs scrolling...
I followed the scrolling tutorial on this site and I can't get the background to scroll in the right direction. This equation Y Top Frame+301 has the background scrolling upwards and i need it to go downwards.I tried replacing the + by a -. I tried from the bottom frame border... nothing.
My second problem is that I am using a condition to keep the player inside the screen : x of player > 128 = set x position of player 128. But that seems to be scrolling as well, pushing the player along...
I'm pretty confused right now lolz. Thanks
Re: scrolling graphics & optimization
First, what is your frame size? To scroll up, try Set Y to (Y Top Frame + (screen height/2 - 1)).
If you want your player independant of the scrolling, you need to uncheck the "Follow the Frame" checkbox in the object's properties.
Hope that helps,
Mobichan
Re: scrolling graphics & optimization
Hey Mobi, thanks I'll try that out. All I want is exactly that, the background scrolling and al the gameplay elements just ignoring the whole scrolling business. The background does not affect gameplay in any way.
By the way great website. I have yet to try your knightly demo. Great art.
Re: scrolling graphics & optimization
Thanks for the kind words. FYI, Knightly actually does scroll through a very long level/frame. I made it before I learned more about scrolling. :P
Re: scrolling graphics & optimization
Cannot get the scrolling to work at all. A friend sent me an example using a camera object with movement and having the storyboard control go always > center display at 0,0 of the camera object.
I left the camera object visible and at the start I see it fly upwards and nothing else moves.
Everything has follow frame unchecked (since i only want the background to scroll). I am using a layer with a scrolling coefficient of 1.0 with my background art loaded as background>picture objects.
Thanks again.
Re: scrolling graphics & optimization
everything else is on another layer with scrolling coefficient set to 0.
Re: scrolling graphics & optimization
How big is your frame window size in relation to your actual frame size in the storyboard editor? And if the camera shoots up at start something is wrong with it's movement.