Hacker News new | ask | show | jobs
by gus_massa 2203 days ago
Nice project.

It is strange that all the code is in index.html. I was expecting something like mountains.js, trees.js ...

It is also strange to see power towers in the drawings. Why did you add them? (I guess there s an interesting story in this detail.)

2 comments

> It is strange that all the code is in index.html. I was expecting something like mountains.js, trees.js ...

Why? It's about 4000 lines of JavaScript, which is manageable usable in any editor, and it makes it completely self contained. What would be gained by splitting it up into multiple files?

Readability, separation of concerns, extensibility, easier merging of pull requests, improved testability, modularity, and less mixing of html and Javascript in a single file.
All of these are often of little concern to artists, who prefer to get in the flow of actually getting stuff done. Organizing your project is fun and all, but there's A TON value in eliminating context switches and shortening your iteration loop. Source: I participate in game jams.

Obviously, it would be nice to follow this up with refactoring, but you could also spend this time on another project, of which the author has many (and likely thanks to this "fire and forget" attitude).

I'm sorry, but it's not obvious to me how splitting the code into more files gives you any of these things except less mixing of HTML and JavaScript (which doesn't seem like a problem unless you have tools that won't handle it). Aren't these aspects of the code itself?
Agreed - very cool project that could use some refactoring.