Repeating world with seamless transitions?


is it somehow possible to create the effect of an infinite world by repeating it with seamless transitions. For example a spaceshooter where you see the spaceship from the bird’s eye view. When the spaceship comes to the left end of the world it starts over from the right end. Like in Asteroids but with a scrolling camera, so that there would be a point where you could see the left and the right end of the world simultaneously.


1 Like

Yeah, just set the cam position and ship position when the ship leaves the map on one side to the other side location and make sure the screen looks the same, then its not noticeable. Ofc your game code also needs to know about this (e.g. shooting accross the border etc)

Dynamic objects would just pop up , wouldn’t they? I rather meant to simulate the effect of a globe. As if you could fly around the world. (Without literally seeing any curves.)

1 Like

No they wouldnt, as I said you have to make sure your game arranges the objects right. Just move all objects on the screen.

1 Like

maybe you could add a pivot (center of the globe) as a global app state (control) such that it would make sure that on every object’s update to keep it within range such that if an object keeps moving forward it will actually rotate around the center of the globe, assuming the numbers used are huge it’d look as if it always goes forward

these links might be of interest:

I know I used the second link (control) to implement the similar behaviour for the camera: camera’s direction is fixed at an object but you can still move the camera up/down left/right or towards/backwards to the object

PS: I haven’t yet studied the global app state control yet

When the object’s X goes to -10, you just move it to X = 10?

Momoko_Fan said:
When the object's X goes to -10, you just move it to X = 10?

that isn't seamless though,
seamless would be like portal 2 lol
but, that's not even what @Hot-Chip wanted,... more like imagine if the universe would be a sphere(or better yet imagine earth), although you go in a straight line(ie.direction vector doesn't ever change), say direction Vector3f.UNIT_Z, you keep going such that eventually you end up at the point you started (seamlessly though, no jumps like that), even though you went in a straight line; I think this can be emulated by keeping a fixed distance to a center (of the universe) while the object is moving in a straight line (if it'd move non straight then distance would change a bit, which is ok), of course in jme3 it wouldn't be a straight line (it would keep distance same to center but only when moving in a straight line, and variations to this when moving non-straight) - not yet sure how to implement this (can't think, sleepy)

Guys, did you even try what momoko and me said? If you do it right you will not notice all objects on the screen going from 10 to -10 incl the camera.

Could you maybe explain it a little bit more in detail normen? A thought-provoking impulse might be enough :)? Thanks a lot up to this point!

EDIT: ok right when I finished saying the following (don’t read btw, I leave it though for historical purposes xD) I reread the first post and I realized it’s meant to be 2D, birds eye view (if it’s true 2D then it’s as you guys said I suppose) but I assumed it’s real 3D and first person even, so yeah I respectfully apologize for assuming wrongly & giving the impression that I believed you to be wrong (ie. missing the mark)


some idiotic monkey :slight_smile:

I didn't try that, I only imagined it - which may imply some failure of imagination on my part
Do you mean to say that when the object reaches some Z position 10 it will be positioned at Z position -10 ?
as in, if it moves straight assuming Vector3f.UNIT_Z direction, and assuming it started from Vector3f.ZERO (for simplicity?) then when object's location reaches 0,0,10 then it will be moved to 0,0,-10 ?
or did you guys mean the exact same but for meshes? say if the object is not a dot but just a line, and it moves past 0,0,10 ie. to 0,0,11 then the line will be drawn as if two lines really (well like portal 2 so you can imagine)
Else, if you meant the entire object moves from 0,0,10 to 0,0,-10 (that is when it's center reaches that, or Mesh's center?) then at the very least has parts of itself "teleported" to a different location, I mean it seems like you guys are suggesting that the world is flat and when reaching the 4 edges the objects would wrap around to the opposite edge, if a ship would be flying like that it would see a jump & change in scenery at the moment of wrap, not to mention it wouldn't see anything ahead before the wrap around, unless something global would change each accessed coord (?) ... I don't know, but most likely I assumed wrongly what you guys said, most likely you didn't say what I assumed, feel free to correct my assumptions xD

I don't know how I could implement 4 big portals(like portal 2 portals I mean) at the edges of the flat map such that when ship/camera is near to edge , looking straight would see the world from the opposite edge, it seems rather complicatedly impossible (to image how to program it in jme3)

Sorry for not understanding,

Imagine just moving everything you see on screen from + to - locations, including the camera. You will not see anything “moving” or “popping up” on screen.

Hm, maybe I’m just too stupid but I don’t get it. How would I for example move single particles from a ParticleEmitter? I thought it might be possible to program something like that:

1 Like

Just move the whole particle emitter, just make sure its not set to “emit to world”.

1 Like

Ok, just one last question before I’ll give it a try. Is there a smart way to get all objects which are currently in the range of the cam?

You could check their cullHint

1 Like