RoganMurley / hitagi.js

JavaScript HTML5 game development framework
MIT License
183 stars 10 forks source link

Is everything in package.json for Client Side use? #9

Closed ghost closed 8 years ago

ghost commented 8 years ago

/package.json is for a NodeJS version but /hitagi.js has some more dependencies which make it a Browser version. I was wondering what those dependencies are?

sorry I'm a NodeJS novice, mostly work in the client side

I want to use the itemized file structure, which uses main.js to require all the other files, but then run into issues using require() and module.exports from Node JS. If you can explain the steps to get around that, or point me at a blog post, that would help.

RoganMurley commented 8 years ago

Could you tell me exactly what kind of issues you're having, maybe with what errors you're getting if you're getting any?

And it might be a stupid question, but have you ran npm install?

ghost commented 8 years ago

Yeah I ran it. What I want to do is use the individual folders and .JS files rather than the lump sum hitagi.js file that includes all the dependencies. The problem is that something happened between those folders & files and the sum file.

There's a lot of strange stuff in there like: 144:[function(require,module,exports){ and "./entity.js":144 that makes it work in a browser. Magic numbers.

I want to make a copy of the folders and then remove all the NodeJS code from them, in an optimized fashion. Then I can use them in my browser/windows app project more easily. That's it.

RoganMurley commented 8 years ago

The JS files are separated into CommonJS modules, the style used by Node. We then use a Browserify Grunt task to bundle the modules and their dependencies into a single output file hitagi.js. Browserify automatically adds all the 'magic' stuff.

If you're altering the core Hitagi code itself you'll want to run the default Grunt task while developing. Every time you make a change it will automatically lint, run tests and bundle your changes. This is what I'd recommend you do.

Alternatively you could switch to some other module system (do Windows Apps have one of their own?), but I'm afraid I don't have much knowledge about that!

ghost commented 8 years ago

The Browserify is an interesting tool, but as far as optimized development goes I think it's kind of spaghetti code!

The video I made was just to demo using JavaScript in the new Windows App model. It's cool but my goal is to make a browser, web-based game. I started writing an engine here too: d3Engine focusing on using D3JS for rendering.

I'll make a decision as to whether I want to continue down that path or branch from your engine.

Thanks again!