ReferenceError: IgeClass is not defined

Post your help queries and engine programming questions here

ReferenceError: IgeClass is not defined

Postby PWG » Mon Jul 10, 2017 12:37 am

Hi,

I'm new to both Node and IGE. I get the following error when trying to use node to run server.js: "ReferenceError: IgeClass is not defined". I'm guessing this is a node config issue. Any help would be appreciated.

Thanks,

PWG



A little bit about my setup:

I'm using Vagrant to run an Ubuntu VM. I proxy node using nginx. I verified the node install using a simple HelloWord.js script that runs successfully and emits HTML. I did run npm install ige/server and it seemed to work.

The following is the contents of my webroot:

readme.md
assets
ClientConfig.js
client.js
gameClasses
index.html
index.js
ServerConfig.js
server.js
ige

The following are the installed node packages reported by npm ls:

/vagrant/live
/vagrant/live/node_modules/igeServer
/vagrant/live/node_modules/easyimage
/vagrant/live/node_modules/mongodb
/vagrant/live/node_modules/bson
/vagrant/live/node_modules/mysql
/vagrant/live/node_modules/require-all
/vagrant/live/node_modules/net.io-server
/vagrant/live/node_modules/websocket
/vagrant/live/node_modules/node-arguments
/vagrant/live/node_modules/socket.io
/vagrant/live/node_modules/base64id
/vagrant/live/node_modules/policyfile
/vagrant/live/node_modules/redis
/vagrant/live/node_modules/socket.io-client
/vagrant/live/node_modules/active-x-obfuscator
/vagrant/live/node_modules/zeparser
/vagrant/live/node_modules/uglify-js
/vagrant/live/node_modules/ws
/vagrant/live/node_modules/commander
/vagrant/live/node_modules/nan
/vagrant/live/node_modules/options
/vagrant/live/node_modules/tinycolor
/vagrant/live/node_modules/xmlhttprequest
/vagrant/live/node_modules/uglify-js2
/vagrant/live/node_modules/optimist
/vagrant/live/node_modules/minimist
/vagrant/live/node_modules/wordwrap
/vagrant/live/node_modules/source-map
PWG
 
Posts: 2
Joined: Sun Jul 09, 2017 11:57 pm

Re: ReferenceError: IgeClass is not defined

Postby PWG » Fri Jul 14, 2017 7:04 am

The fix to the above problem really just boiled down to finding the right piece of documentation and reading it. The documentation in question is located at https://www.isogenicengine.com/docs-manual.html#server-side-examples. It shows an example of how to run ige from the command line. There are some subtleties that are worth noting.

Run an ige example from the command line looks like this:

In the ige directory:

node ./server/ige -g ./examples/0.0-load-graph

The -g option is an option being passed to the ige script not to node. It doesn't seem to have any extensive documentation but the code that uses it can be found at: https://github.com/Irrelon/ige/blob/9f5aaae7d5cb902c4a0d8843edf44f72bf9a6bb4/server/IgeNode.js#L18

Since the -g option is used by ige and not by node running a script using pm2 looks like this:

pm2 start ./server/ige.js -- -g ./examples/24.2-multiplayer

Notice the .js extension on ige and the double-dash (i.e. --) before the -g option.


The examples like to be run from the directory they live in in the distribution. Copying the examples and making them run from a different directory requires adjustments be made. Most of the examples that require an open port on the server use port 2000. So it's important to forward that port from host to VM.

ige.js uses node to run the game code but not to serve any html or assets. For example to run the multiplayer demo on my setup I (with port 2000 forwarded to 2000 and port 8000 forwarded to port 80) I first launch the example on the server using node then I open a browser and navigate to:

http://127.0.0.1:8000/ige/examples/24.2-multiplayer/

index.html, the associated javascript files, and all of the various assets are served by nginx from the VM. Once the client javascript is loaded and running in the browser it takes over and starts talking to the node process running on the server using port 2000.
PWG
 
Posts: 2
Joined: Sun Jul 09, 2017 11:57 pm


Return to Help & Questions

Who is online

Users browsing this forum: No registered users and 1 guest
cron