# How to do an infinite torus topology battlefield for over-the-shoulder perspective

I'm currently prototyping a simple two-player adversarial game, where the players are able to move around and shoot at each other with cannons. I would like the playing area to feel essentially unbounded, but I don't want one of the players to be able to stall the game by just rushing away from his opponent.

The standard solution to this dilemma in the 2D days was to introduce a torus topology: if a player leaves the screen from the top, they enter at the bottom. If they leave from the right, they enter from the left. I am looking for a workable analogon to this system for games played from a third-person perspective.

Technically you can implement this just fine. However, since they lack complete battlefield overview, it will confuse the heck out of the players if their opponent pops out of/into existence.

Currently I'm thinking of combining the following techniques:

• A map that shows top-down overview. This provides the context you used ot have in the 2D game.
• Rendering the closest periodic image of the enemy as solid. This is not necessarily the one in the same "screen".
• Rendering the others as "ghosts".

Will this be enough to make this design work? Can it be made to work better with some tweaks? Is torus topology and third person perspective just a really bad idea?

• I think if you visually obscure the mechanic (ie by not using the sphere or related idea) it would be confusing. Someone that was in front of you can shoot you in the back. I think there needs to be a clear indication for the player to justify this, whether it's logic, visual, gimmick or story. If it's confusing it's likely to frustrate.
– Kaj
Aug 19 '10 at 2:59

The actual topology doesn't matter as much as your viewpoint on it. You could pull exactly that old 2-D trick by making any 'view' on the world never be able to display an area larger than the world itself - so there's only ever one opponent (though you may be able to reach him by running in either of two directions) and no ghosts. Mark the edges of vision (very far away) with a haze of grey if you must.

Or maybe I just don't understand the problem correctly.

• So when you turn around and start going in the opposite direction, you eventually see you opponent emerging from the mist, without a clue that he might be there before he does? Aug 19 '10 at 10:20

How about playing the game on the top of some closed, finite 3d surface, such as a sphere or cube (or a noise function perturbed version of one of these to make it a more interesting generalized polyhedron). This will give you the effect of wrapping around, which will make the inifnite chase scenario somewhat trickier for the players. Having a 2D overview map would still have the popping off the one side and popping up on the other side issue, so perhaps a 3D map may be better: i.e., a simplified zoomed out overview of the 3D polyhedron model rendered with transparency.

• I like the idea. The only problem I can see is that with a small closed surface your horizon will be rather close, and your view will be filled with mostly sky. Of course, you can also do the same thing with the inside of the sphere, and you would be looking mostly at geometry. Aug 18 '10 at 10:38
• +1 Now there's an idea - a game world that is the inside of a sphere. Aug 18 '10 at 22:43
• inside of a torus would be Ringworld
– Ron
Aug 19 '10 at 1:07
• Yes, I was expecting that the environment would be large enough that from the camera viewpoint it would look like like a perturbed plane. It would probably be an interesting design choice for it to be small enough to give the feel of running about on the surface of a "small 3D planet" - probably not 100% original, but still fun. Aug 19 '10 at 7:51
• Yes, I'm aiming more for a "largish arena" feel than an "entire planet" feel. I probably should have mentioned that in the question. Aug 19 '10 at 10:22

You need to think with Portals :-)

Make the playing field large enough that a player can't see from one end to the other (e.g. using fog). That way, a player can never see two instances of the same opponent. Of course weapon ranges need to be limited appropriately as well.

Then, when a player nears the edge of the playing field, just draw a second copy of the map beyond that edge. That way, it will look like an infinite (though sort of repeating) playing field. When a player walks past the edge of the playing field, wrap them around. Same applies to any shots fired or attachs made at the edge of the playing field.

So, effectively, like with classic room-and-portal-based engines, you can have rooms loop over themselves. An even easier way might be to split up the whole playing field into tiles. Each tile knows its adjacent tiles in all four directions. Then hook up the tiles at the edge of the playing field to their opposite number. Pick the tile your player is on, and draw a limited number of tiles in all directions relative to that. This way, you do not need to wrap.

Well, I'm lying, actually, you'll need to wrap at each tile boundary.

If you think making the playing field large enough that you can not see to the end is too much (you'll need a little more, so that a player can't just walk backward a few steps and hit you from the other side), you could make the mechanic more explicit, either by having an actual teleporter fence (or a thick wall of fog)) at the edge, and having a player frozen for a second while teleporting (maybe even with directional stereo sound, so the opponent is warned of the teleport, and the teleport makes a player weaker as it gives an advantage). Alternately, you could model your world so it seems like a small moon or so, with the ground obviously curved. But then you would probably have an area for the opponent to hide again.

• Just because you can't see across the entire field doesn't mean you can't see the same player twice. All it takes is a FOV of 90 degrees or more, visibility range of 71% of the field size and the right place to stand. Nov 28 '14 at 14:26
• You'e right, it has to be less. I.e. < 50% of the field. Nov 28 '14 at 14:48

As with the "topology doesn't matter" answer, you can do the torus solution pretty easily. It's possibly easiest if you've got a tiled world. E.g. instead of one giant terrain mesh you have a map made up of M x N tiles. When you're in tile m,n you can see that tile and +/- 1 in each direction; just wrap the result of the additions and subtractions and you're done. I.e. tile 0,0 can "see" and is attached to as appropriate tiles 0,1, 1,1, 1,0 plus M-1,1, M-1,0, M-1,N-1, 0,N-1, and 1,N-1

• I know how to implement it from a technical standpoint. I'm more looking for game design suggestions. Aug 19 '10 at 10:16