How to make a RTS game world that seamlessly wraps around on east-west axis

Started by
0 comments, last by ikarth 9 years, 8 months ago

Many strategy games like Civilization or Supreme Commander have their game maps seamlessly wrap around. The camera can pan indefinitely in east-west axis, and object can traverse smoothly from one edge of the map directly to the opposite one. I want to implement that effect into my RTS game to emulate a cylindrical world on a flat map.

I have spent a few weeks to research on this matter and have a few ideas about this matter, but I need some advice from someone with more experience. Maybe there are a staple solution for my problem, and it will save lot of time doing experiment by myself. Graphical programming is not my trade, but I will learn more about it if necessary. I use Unreal Engine 4 for my game, that is one thing to put in concern. But even if a solution is not compatible with that engine, I still want to hear about it.

Advertisement

At its most basic level, all you need for a map to wrap around is to have anything that goes past one edge of the map show up on the other side. If the position of something on the map is a set of coordinates, from, say, -100 to 100, going past 100 just wraps you around to -100. The graphics do the same thing, so if the camera is looking across the boundary, it shows stuff on both sides.

You can fake this by having visual duplicates of the map placed at the edges, and teleport anything that crosses to the opposite coordinates, but you have to be careful that this doesn't mess with the physics.

Unreal isn't really designed for dynamic map manipulation, so you may have to write some of this stuff yourself to handle the edge cases. It might be easiest to chunk the entire map into sections larger than the maximum camera viewing area, and then dynamically arrange where they are in space. (Ideally, this would only be changing their visual representation, and not their underlying representation in the physics.)

Here's an article that talks about some games that do this: http://simonschreibt.de/gat/1nsane-carpet-2-repetitive-worlds/

This topic is closed to new replies.

Advertisement