Game Development Stack Exchange is a question and answer site for professional and independent game developers. It's 100% free, no registration required.

Sign up
Here's how it works:
  1. Anybody can ask a question
  2. Anybody can answer
  3. The best answers are voted up and rise to the top

I have a 2D world of 50*50meters and a viewport of 15*10meters.

Current situation:

    player.x = 0;
    player.x = World.WORLD_WIDTH;
    player.y = 0;
    player.y = World.WORLD_HEIGHT;

So when the player will be placed on the other side of the world when he reaches the border. The camera is always oriented on the player which results in an ugly "jump" when the player is replaced on the other side.

How can i optimize my render-class to flewless render my world.


The player is at location {0,0}. on the right the world should be rendered normal {0,0} - {7.5,0}. And on the left i want to show the other end of the world {-7.5,0} - {0,0}. Same for the Y axis.

I am shure this is a common questen and asked several times here, but i have not found anything with the searchterms "infinite world" or "repeating world".

any advices?

share|improve this question
The term you're looking for is "wrap around". As for your actual problem, if we are supposed to help you with your renderer, why don't you show us the code for it? – Hackworth May 10 '12 at 19:51
Also called a Doughnut World or Torus World. – John McDonald May 10 '12 at 20:22
By the way, and I'm obviously guessing here, you might want to take a look at the "player.x > World.WORLD_WIDTH" and "player.y > World.WORLD_HEIGHT" statements. It looks like the player can move 1 length unit outside of the world, since the largest player.x and player.y should be "WORLD_WIDTH - 1" and "WORLD_HEIGHT - 1", respectively. As you obviously know, coordinates are zero-based, so the largest index in an array is always 1 smaller than the length of that array. Using ">=" in both cases might be correct instead. – Hackworth May 11 '12 at 8:48

Your Answer


By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.