The Daily Click ::. Forums ::. Klik Coding Help ::. Scrolling techniques, your opinions and source!
 

Post Reply  Post Oekaki 
 

Posted By Message

Zephni

My other cars a Balrog

Registered
  17/10/2007
Points
  4019

Has Donated, Thank You!VIP MemberSonic Speed
8th March, 2011 at 08:57:31 -

Hi guys! Scrolling can make a whole game feel stiff, flimsy, dynamic ect... I feel it's important anyway, but getting scrolling perfect for your game isn't the easiest thing to pull off.

Here, say what you think the best style of scrolling is for specific game types, or what you prefer? Some games will have the camera lag behind a character to make you feel like the game is fast paced and the screen just can't keep up, while some will have the camera ahead of the direction your faceing, while switching back and forth depending on the level design, what do YOU like when it comes to scrolling?

I basically have a couple of scrolling engines, but i still feel like they arent dynamic enough, any idea's or source code will be greatly appreciated, thanks guys. Mainly trying to get idea's

 
dont make me divide by zero...

Assault Andy

Administrator
I make other people create vaporware

Registered
  29/07/2002
Points
  5686

Game of the Week WinnerVIP Member360 OwnerGOTM JUNE - 2009 - WINNER!GOTM FEB - 2010 - WINNER!	I donated an open source project
8th March, 2011 at 09:46:53 -

It depends a fair on the type of game you have. For a shooter or platformer I would often choose a "look ahead" camera which centers on the player + some distance in the direction that the player is moving in - with smoothing. With a top down shooter I might make the camera center between the player and the aim cursor. If I do have that "camera lag" effect it has to be extremely subtle. If you over do it, it just becomes incredibly annoying and limits gameplay. Just my two cents.

 
Creator of Faerie Solitaire:
http://www.create-games.com/download.asp?id=7792
Also creator of ZDay20 and Dungeon Dash.
http://www.Jigxor.com
http://twitter.com/JigxorAndy

Ricky

loves Left For Dead 2

Registered
  28/12/2006
Points
  4075

Has Donated, Thank You!Game of the Week WinnerVIP MemberWii OwnerHero of TimeGOTM Winner! - November 2009I am an April Fool
8th March, 2011 at 09:47:50 -

Ive been trying for a while to get the camera to creep ahead of the player, but it always feels weird. Like the layer is being pushed back.

The best scrolling ive seen in any game is in the underside. The way it locks in some areas then catches up when you leave them, it's brilliant.

 
-

Zephni

My other cars a Balrog

Registered
  17/10/2007
Points
  4019

Has Donated, Thank You!VIP MemberSonic Speed
8th March, 2011 at 10:05:12 -

To be honest Ricky the underside is excatly what i was thinking of. The underside was very much inspired by Cave Story, and the scrolling on Cave Story is just amazing. I find the main problem (with me) is having trouble with decimal points... Like moveing the camera at 0.3 or something.. because it never ends up excatly where i want it.. Does anyone have any ideas on the "proper" way to move objects at decimal places?

@Assault Andy yeah I think your spot on with that, and yeah the camera lag should deffinately just be subtle or you end up almost running off the screen into enemies you can't see yet!

All comments are appreciated

 
dont make me divide by zero...

AndyUK

Mascot Maniac

Registered
  01/08/2002
Points
  14586

Game of the Week WinnerSecond GOTW AwardHas Donated, Thank You!VIP Member
8th March, 2011 at 14:26:25 -

Since I use a level editor my level frame is much bigger than the size of any of the levels. I use an X and Y scrolling barrier.
The actual scrolling is basically centered to player unless at the edge of the boundries.

The code looks something like this

Always --- center horizontal position --- Min(X( "1mask" ), X( "xedgeobject" )-160)
Always --- center vertical position --- Min(Y( "1mask" ), Y( "yedgeobject" )-120)

Where '1mask' is the player's collision mask, and '160' and '120' is half the game windows resolution.

 
.

Eternal Man [EE]

Pitied the FOO

Registered
  18/01/2007
Points
  2955

Game of the Week WinnerHero of TimeLOL SignI am an April Fool
8th March, 2011 at 23:50:10 -

The scroll engine I'm using in my current project is inspired by cave story and the ilk. It's not finished yet though, but it is fully functional, wan't to make it more efficient. It currently uses many large actives, a big no-no. I know how to counter that, just haven't come to that point yet since it's only a blueprint/sketch.
Anyways, have a look, I believe it uses the same principal idea as The Underside does, gives similar results anyways.

http://www.mediafire.com/?9mlype821delp1d

Oh, space toggles visibility on the aforementioned actives.

 
Eternal Entertainment's Code'n'Art Man

E_E = All Indie


...actually Ell Endie, but whatever.
Image
Image

Zephni

My other cars a Balrog

Registered
  17/10/2007
Points
  4019

Has Donated, Thank You!VIP MemberSonic Speed
9th March, 2011 at 09:16:32 -

Awesome thanks EE i'll go take a look now...

 
dont make me divide by zero...

Zephni

My other cars a Balrog

Registered
  17/10/2007
Points
  4019

Has Donated, Thank You!VIP MemberSonic Speed
9th March, 2011 at 09:23:26 -

EE thats exactly the idea i'm looking for! I made a level editor that puts them kind of active objects on the screen, yknow, the ones that are the same size as the screen and tell it to change the camera type. I have got mine working to a certain extent but still arent happy with it, im going to take a look at your code now. The only problem i see atm is when you run in the same direction and get the furthest away from the camera it kind of jumps repeatedly. Il take a look now, thanks again.

 
dont make me divide by zero...

Zephni

My other cars a Balrog

Registered
  17/10/2007
Points
  4019

Has Donated, Thank You!VIP MemberSonic Speed
9th March, 2011 at 10:49:57 -

Ok sorry ive just replied 3 times in a row..

Lol i have obviously been away from MMF too long, i have this question..

In your source, the condition to find wether you are in/colliding with a scrolling object like U-D or L-R you use:

+ If the player is overlapping
+ the player is within the borders of the screen scrolling object.

But how is the player actualy "overlapping" the object if the middle of it is transparent? So confused lol.

 
dont make me divide by zero...

Eternal Man [EE]

Pitied the FOO

Registered
  18/01/2007
Points
  2955

Game of the Week WinnerHero of TimeLOL SignI am an April Fool
9th March, 2011 at 11:48:57 -

Box collision my young padawan. (untick fine detection on the u-d/l-r etc.)

About the jerky camera:
I assume you mean a situation like what occurs when running in the bottom corridor, a slight jerk when the distance between the SDOT and CAM is at it's maximum.

That's because of the "follow code" for the CAM (i.e the CAMpos+(SDOTpos-CAMpos) bit)
The jerk occurs because the CAM accelerates when at it's percieved maximum, "jumping" forth towards the SDOT causing the jerk. I'm sure there are work-arounds for it, perhaps matching the CAM's max speed to the player's max speed. Only problem with that at the moment is that the CAM doesn't have a "speed", it repositions based on "Ratio" and distance.

Perhaps one could conjur up some sort of vector movement for the CAM?

Anywho, it's probably do-able. (interesting note since everyone uses Cave Story as inspiration anyways: CS's camera also jerks)


The thing I'm gonna do next is getting rid of the hugh actives. The way to do that would be to change the overlap/position code from:

+ If the player is overlapping
+ the player is within the borders of the screen scrolling object

to just

+ If player is within (a screen's distance originating from scrolling object XY)
then
--> set scrolling variables

Only thing to manage is putting the code so object selection is correct i.e using the proper scrolling objects XY as origin. Then the scrolling objects can be just 1x1 sized dots as long as they are placed in the correct XY. And for the level editor you can have big boxes show just for clarity.
I think it's called magic.

EDIT: It's great! I help you with this and you help me implent external animations!

Edited by Eternal Man [EE]

 
Eternal Entertainment's Code'n'Art Man

E_E = All Indie


...actually Ell Endie, but whatever.
Image
Image

Zephni

My other cars a Balrog

Registered
  17/10/2007
Points
  4019

Has Donated, Thank You!VIP MemberSonic Speed
9th March, 2011 at 11:59:13 -

Oh my goodness, ive used clickteam products since i was like 1 years old and i never knew that about unticking the fine collision detection lol!!

I = dumbass

Yeah i see what your saying about the camera catching up, i'm sure it can be easily delt with.

Yeah i would deffo keep the screen sized actives when using them in the level editor, but i see what you meen you want to keep big actives down to a minimum when the actual game is running. I wonder how the podunkian does it with the underside... anyone know? He may use a similar engine to the one you say about having a 1x1 pixel object.

 
dont make me divide by zero...

Zephni

My other cars a Balrog

Registered
  17/10/2007
Points
  4019

Has Donated, Thank You!VIP MemberSonic Speed
9th March, 2011 at 13:31:45 -

Ok, so using the idea from your engine, that there are basicaly restrictions set on the "scrolling to" object in its alerable values.
I started this from scratch: http://www.zephni.com/downcontent/scrollingengine.mfa

I'm going to take a look at how to stop it jumping when you are at max speed now, if anyone else manages to take a look at it and figure it out before I do please reply = Thanks again EE

Edited by Zephni

 
dont make me divide by zero...

Eternal Man [EE]

Pitied the FOO

Registered
  18/01/2007
Points
  2955

Game of the Week WinnerHero of TimeLOL SignI am an April Fool
9th March, 2011 at 17:32:40 -

Interesting!
The camera centers perfectly on the camera target XY, I wonder why mine doesn't since we use the same code..? :/
Very well organized and clear, are you going to implent the scroll restrictors too? They are the shit when you don't want the camera to scroll past a wall i.e doing it metroid-style!

I'll take a crack at minimizing the actives later tonight when I get a chance to sit by the computer.

Nice work!
//EE

 
Eternal Entertainment's Code'n'Art Man

E_E = All Indie


...actually Ell Endie, but whatever.
Image
Image

Zephni

My other cars a Balrog

Registered
  17/10/2007
Points
  4019

Has Donated, Thank You!VIP MemberSonic Speed
9th March, 2011 at 17:41:34 -

Yeah i noticed that!? When I did it i expected it to get the same problem (not aligning for left or top) but it just worked! Which was a bonus but just causing confusion! I'm gonna have a go at making the L R U D restricters now, ive got a feeling theres gotta be a better way though :s the other thing ive done is made it so there is only one active object that changes the scrolling, but it has a text variable telling it what type it is like "fixed" or "left-right", but thats done on my level editor game, you can add parameters to objects. anywho, let me know how you get on!

 
dont make me divide by zero...
   

Post Reply



 



Advertisement

Worth A Click