pinoypixel game developer blog by Joey Albert Abano

Pinoypixel is a game development blog. This site contains casual filipino themed web and mobile indie games. Most of the projects would be in alpha or beta stages, sourcing from gamejams, test prototypes or just plain adhoc dumps.

Construct 2: Tips in generating huge maps

Friday of February 10, 2017

resource: https://pixabay.com/en/world-map-geography-earth-world-1997599/

Creating world maps is a tedious task. Often times large world maps have performance issues and are difficult to manage. Creating a very large map in one layout, and rendering it in one go consumes a lot of memory. Not to mention if you have collision checks thus adding additional processing cycles on the large tilemap. The solution for this is to create small sized tilemaps and generating them on demand, and destroying the tilemap objects when it is not visible in the screen.

Tilemaps is one of the key features of Construct 2, which helps designers build a resource efficient game world. Despite being handy, it still has some flaws and gaps if not properly used specially for large sized map. This is a template on how to manage tilemaps in local storage for Construct 2, Template: Load and Save Large Tilemaps in Localstorage.

 


 

Challenges and Solutions

Identifying the challenges in making games with large tilemaps are quite straight forward, and below are a few of those. The solutions to address these challenges are also presented, and the difficulties that comes in dealing with these solutions.

Challenges: Multiple tilemaps in a layout

People tends to create one big map in a single layout. This process is understandable since it is easier to visualize the entire map. The problem with this approach is the loading size, drawing time and the increased collision checks

Challenges: Rendering speed

Large maps are difficult to render, and if the maps are also defined in the json files, it also creates an additional overhead loading and reading the files.

Challenges: Auto-generated maps

Some games try to auto-generate maps, such as rouge games, simulation games and open worlds.

Solution: Storing tilemaps as json

Most people will consider storing their tilemas in json files and loading them when needed, but writing and managing tilemaps on a json is a pain and most of the time doing this approach reduces our productivity.

Solution: Loading tilemaps on demand

Identifying when and what tilemaps to load is also challenging.

 


 

Tips and Approach

In the tutorial Template: Load and Save Large Tilemaps in Localstorage, it allows the following to easily manage maps.

  1. Perform layout redirection to load target tilemaps

    The designer still edits the tilemaps on a single layout but instead of creating a large tilemaps, the tutorial advices to create smaller tilemaps that will be loaded on demand. The sample capx redirects the user the target world map on demand and redirects it back to the game screen, in doing this we maintain one clean game layout.

  2. Use localstorage to hold the tilemaps

    The sample capx dumps the tilemap definition inside the local storage. If the local storage already contains the map it will use the local copy instead of redirecting the user to the map layout.

  3. Use dictionary to improve tilemap access

    Upon identifying the selected world, the sample capx would then load the entire world map from the local storage to a dictionary. Placing the map configuration in the dictionary allows faster read access.

  4. Render adjacent tilemaps

    Tilemaps are generated relative to the player. The tilemaps adjecent to the player will be created, and tilemaps that are not visible to the player will be destroyed. Tilemaps are read from the dictionary thus access is relatively fast compared to local storage.

 


This site pinoypixel is designed, developed and copyrighted by me [Joey Albert Abano], to view my main blog refer to Rankaru | I support this striving game studio Jyoru Games and this graphic content provider Katture. Please also provide your care for people with disability, by donating to this institution Philippine Down Syndrome Association.

Go Top. 2016-2017 Copyright by pinoypixel.com. If you want to contact me, drop a message in my gmail account at joey.abano(at)gmail(dot)com