Sign in to follow this  
javasirc

seamless scrolling help plz

Recommended Posts

I have been thinking about ways to do seamless scrolling for the last week and havnt decided on a good way. I know about seperating the world into partitions but thats where im stuck. I dont know what to do or where to start. And cant find help tutorials on google any links would be greatly appriciated plz.

Share this post


Link to post
Share on other sites
You're on the right lines. The first step is splitting the world up into partitions as you thought. I'll set out a simple technique for a 1D game, but you can extend it to 2 or 3D easily enough.

At any time the player is in one partition. If we imagine a side-scroller with a screen width of 800, I would recommend that partitions are around 1000 to 1500 units wide. Now, often you will be near enough the edge to see another partition, so you will need to have loaded at minimum the current partition and any adjacent partitions. (In 1D that's just the two to either side; in 2D it's the 8 corner-adjacent cells and in 3D it would be the 26 cells touching in any way.) So when entering a partition, load any partitions that you now need and are not cached; if your cache is full, unload the 'oldest' (i.e. last visited longest ago) partitions first.

You will probably want to put the loading of partitions into a background thread so as not to cause the main game to freeze for a moment.

Share this post


Link to post
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now

Sign in to follow this