Development processes
Whether you're an individual who builds games as a hobby or a developer for a large game publisher, you can benefit from following a number of best practices adopted from JavaScript development for the Web and game development on other platforms. You can also build Three.js-based games without deviating too far from your favorite game development processes.
JavaScript best practices
In previous chapters, we haven't been very concerned with the high-level structure of our code. We wrote some examples as single HTML files, and we split the FPS and CTF projects into separate files, but for polished games we should be more careful, especially when working with teams. General coding lessons apply:
Keep assets in folders by file type/purpose. For example, at a high level you might have folders such as
css
,js
,images
,models
, andsounds
. Within thejs
folder, organize JavaScript files by purpose; keep library, source, and production code separate.Avoid putting code that directly...