OpenSpace logo

Overview » Controlling the viewport

OpenSpace features advanced viewport controls to pan, zoom and center the map. Advanced techniques have been implemented to remove tiles and background/foreground parts located outside the viewport and minimize the CPU impact of the map movements, thus maximizing the rendering performance and allowing the creation of larger maps.

Pan, zoom and center

The viewport can be moved around in any direction by any distance, regardless of the player's avatar position. You can for example allow the user to navigate the map without actually moving the avatar around, or you can reposition the viewport to a new location on the map to show the player what's happening overthere.

With respect to version 1 of OpenSpace, the zoom feature has been fully re-engineered: full map interaction (viewport pan, scrolling on avatar movement, etc.) is now allowed in both zoomed-in and zoomed-out states. Tile coordinates and offsets can be passed to center the viewport on a specific tile while zooming.

Additional offset parameters can be passed to the map centering methods, allowing a fine-grained control over the viewport repositioning.

By default all viewport movements (pan, zoom, center) show the map scrolling animation. Camera speed, zoom duration, blur effect and movement easing equations can be controlled by means of configuration parameters. The map animation can also be disabled: in this case a static fade transition is displayed. Also, the default behavior can always be overridden at runtime by means of a specific flag passed to the viewport related methods.


The player's avatar movement on the map activates the map scrolling. Its behavior can be fully customized by setting different parameters: the distance of the avatar from the viewport sides which triggers the map animation, the map movement entity, the animation speed and the easing equation to be applied.

It's even possible to enable a continuous camera movement to follow the player's avatar, though this is not recommended on larger maps, being a CPU-intensive feature.

More customizations

By default all viewport movements are limited to the map boundaries (defined by the union of the tiles and background bounding boxes). Map boundaries can be ignored if needed by means of a specific flag passed to the viewport related methods. Custom map limits can be defined in the OpenSpace Editor or at runtime by means of a rectangle acting as a virtual map boundary to limit the viewport movement.

OpenSpace also supports dynamic viewport resizing at runtime and fully customizable (duration and easing equation) fading effect during map transitions.

For more informations on the viewport controls customization, please read the OpenSpace client-side configuration manual.