Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

a step-by-step guide #1

Open
Aspirinkb opened this issue Aug 17, 2017 · 5 comments
Open

a step-by-step guide #1

Aspirinkb opened this issue Aug 17, 2017 · 5 comments

Comments

@Aspirinkb
Copy link

Aspirinkb commented Aug 17, 2017

Hi, it is a nice work to learning machine learning and I like it very much. I am new to HTML and JS, can you give a step-by-step guide to install, train and play this game?

@Aspirinkb Aspirinkb changed the title a a step-by-step guide Aug 17, 2017
@jcgoodru
Copy link

If you run index.html via file:// or C:/, then the program isn't going to work.

Instead, you need to run it via a web server.

A simple solution is to invoke python -m SimpleHttpServer from the directory containing index.html, then point your browser to localhost:8000 (or whatever port Python tells you it's running on).

@fahimalizain
Copy link

@jcgoodru can u explain why do we need to run it from a web server ? 😊

@jcgoodru
Copy link

jcgoodru commented Dec 6, 2017

If you open index.html via file:// or C:/, and open the javascript console in your browser, you'll see an error message that looks something like this:

Cross origin requests are only supported for protocol schemes: http, data, chrome, chrome-extension, https

I'm not 100% sure of all the details, but basically if you open a web page via file://, your browser won't allow you to get/send requests to other servers. This is for security reasons (ex: webpages launched via file:// can access your entire filesystem and can execute malicious code, but pages rendered via webservers usually don't have these permissions).

I don't know enough to give a detailed explanation, but here are some relevant links:

https://stackoverflow.com/questions/10752055/cross-origin-requests-are-only-supported-for-http-error-when-loading-a-local
https://bitmovin.com/same-origin-policy-cors-and-crossdomain-xml-what-you-need-to-know/

@roachsinai
Copy link

Use python -m http.server for Python3.

@ouyanx
Copy link

ouyanx commented May 16, 2019

  1. modify gameplay.js (Line 46) :
    Phaser.ScaleManager.SHOW_ALL -> Phaser.ScaleManager.NO_SCALE

  2. python -m SimpleHTTPServer from the directory containing index.html

  3. open http://localhost:8000

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

5 participants