Re: [browserquest] Reworked server main.js, enabled monster roaming
- Justin Clift
- 2012-10-08 @ 10:42
On 08/10/2012, at 4:48 PM, William Bowers wrote:
> The file looks great, Justin! I'd like to see that logger in a property
the entire system can access (if it isn't already; I don't actually see
where that variable is declared...). Maybe I'll try and tackle that soon.
which enabled killing the nesting there.
And yeah, that log variable itself does seem to have something weird going
on with it. Haven't tried tracing though, to find out properly.
If we declare it at the top of main.js, to give it full scope of the file,
then the other modules don't receive it and barf. (kind of expected)
Having it declared without var from the main scope works though, so my
guess without actually checking is that somehow everything else is inheriting
it ok. No real idea. ;)
For a _really weird_ thing that's happening, check out this missing comma
at the top of server/js/map.js here:
var cls = require('./lib/class')
_ = require('underscore');
If that gets broken into two separate var statements, or the comma gets
added, then getWeaponRank() and getArmorRank() in shared/js/gametypes.js
breaks. I have no real idea what a missing comma like that does in
a declaration. :/
> On Sun, Oct 7, 2012 at 11:18 AM, Justin Clift <email@example.com> wrote:
> With the new fangled ability to actually trace and debug stuff
> properly, I went and reworked the server side main.js.
> (almost rewrote the thing)
> Main focus was on making things readable, so the file is
> now longer but very well commented. Anonymous functions were
> broken out and given names, and nesting was seriously reduced:
> Not sure if the removing-nesting is such a good idea though.
> Anyone care to take a look and venture their thoughts?
> Btw, enabled roaming for monsters too, so if you want to
> try that out you'll see they walk around instead of just
> being static. (my repo atm, master branch)
> Regards and best wishes,
> Justin Clift
> Aeolus Community Manager
Aeolus Community Manager