Game Development Reference
In-Depth Information
Strength.js"></script>
<script src="./js/components/
LaserGun.js"></script>
<script src="./js/
PhysicsManager.js"></script>
<script src="./js/EnemyManager.js"></script>
<script src="./js/widgets/
EnergyBar.js"></script>
<script src="./js/main.js"></script>
</body>
</html>
Mobile optimizations
In this final section, let's take a look at a few aspects of the game that we could (and
should) optimize particularly for deployment on mobile devices. Although some of
the following optimizations discussed also overlap in terms of desktop optimizations,
they are especially impactful in mobile web development.
Combine resources
Although it is a good practice to write loose, modular code, we must not stop there.
Before deploying the application to a production server, we would be wise to at least
combine all of those files into a single file. The easiest way to do this would be by
simply concatenating each file and serving up that larger file instead of multiple ones.
The reason this is preferred over sending multiple individual files to the client is
because after a certain amount of concurrent connection to the same server, the
browser will queue consequent connections and the total time it will take to load all
of the files will increase.
Also, after all of the resources have been combined into a single resource, we should
also use one of the many available tools that lets us compress, minify, obfuscate,
and uglify our code. Anything we can do to reduce the code to the smallest possible
amount of bytes is a big win for a mobile player. One particularly powerful tool for
the job is the popular open source Closure Compiler developed by Google. Among
its many features, the Closure Compiler also offers a function that analyzes the final
code and removes any unreachable, dead code. Doing this will further reduce the fi-
Search WWH ::




Custom Search