Chapter 7. Tips and Tricks

Table of Contents

Keep object models simple
Use transparent planes for hotspots
Use scripting sparingly

This chapter contains some useful hints for authoring high-quality content.


The Popcode system is designed to run on a variety of devices with a range of processing capabilities and limitations. For this reason, content should be created with these limitations in mind.

This section provides some guidelines for developing content runs effectively across all devices that can run Popcode.

Keep object models simple

Try to minimise the number of polygons in your models. Blender provides a Poly Reducer script that automates the task of reducing the number of polygons in a model to an extent.

Keep texture resolutions low. Remember that many devices will have small screens and so fine detail is unlikely to be noticed anyway.

Use transparent planes for hotspots

Any object with events specified becomes a "hotspot". This comes with a significant performance penalty that increases with the number of polygons in the object. If you want to execute actions when the user hovers or clicks on a complex object, consider placing a transparent plane object (scaled to be around the same size as the object) in the same place as the object and setting the events for that instead.

Example 7.1. Use of transparent plane for hotspots

<group id="myobject">
	 <object type="MyHighPolygonModel.aro"/>
	<object type="primitives/plane/plane.aro" color="1 1 1 0.5">
		<event type="onclick">
			<!-- Perform actions -->

Use scripting sparingly

There is a small performance overhead when using Lua script so here are a number of tips for keeping scenes with scripts running well:

  • Try to use action nodes, such as transition, instead of scripting where possible.

  • Reuse the variables returned by more expensive functions, such as scene:getById("...").

  • Avoid constructing objects in Lua when they could just as effectively be placed in XML. The platform creates objects defined in the XML when the Popcode is scanned. Any slow-down due to object loading is not noticed since the user is viewing the Popcode user-interface and not the free-flowing camera picture. Conversely the application first executes Lua code the first time that the user views the target with the device. Any delay (due, for example, to loading objects constructed in the Lua) is more noticeable since the user is concentrating on the camera view.