Jump to content


Photo

Editing the index file


  • Please log in to reply
6 replies to this topic

#1 GM Studios

GM Studios

    GMC Member

  • GMC Member
  • 189 posts
  • Version:GM:Studio

Posted 01 February 2012 - 05:41 PM

Firstly i apologize if this has been brought up before, I seem to have a problem with editing the index file specifically the source file part here

<!-- Run the game code -->
<script type="text/javascript" src="html5game/parapals.js?INRAC=1789759812"></script>
</body>
</html>

Now whenever i edit the part highlighted to something other then html5game (and obviously the name of the file it points to) the game wont load in any browser i just get a black canvas! Any ideas?

Also for some strange reason if i have webgl enabled once i compile the game and run it in chrome all i get is the same black canvas (This was run locally). However the one i uploaded to my web server had webgl enabled and runs perfecly fine.

Edited by GM Studios, 01 February 2012 - 05:42 PM.

  • 0

#2 epicCreations

epicCreations

    Cool As Ace

  • New Member
  • 1241 posts

Posted 02 February 2012 - 02:20 AM

Firstly i apologize if this has been brought up before, I seem to have a problem with editing the index file specifically the source file part here

<!-- Run the game code -->
<script type="text/javascript" src="html5game/parapals.js?INRAC=1789759812"></script>
</body>
</html>

Now whenever i edit the part highlighted to something other then html5game (and obviously the name of the file it points to) the game wont load in any browser i just get a black canvas! Any ideas?

Also for some strange reason if i have webgl enabled once i compile the game and run it in chrome all i get is the same black canvas (This was run locally). However the one i uploaded to my web server had webgl enabled and runs perfecly fine.


For the first bit, you need to be sure to store the game resources and such in the correct locally referenced directory. For instance, if the index file is located in /games/, and you stored the game files in /games/source/game1/, then you need to change html5game/ to source/game1/. It's just a matter of following the rules when you reference resources.

For the second part about the WebGL... I think in Chrome, there is some flag of some sort that limits locally run files and doesn't allow them to use certain features. With a little Googling I found this, which seems to point at a security restriction due to cross-domain referencing of some sort. If you have Dropbox, there's a good way around this. Export your game into the "Public" folder and copy the public link, and then paste it into your browser. This game works great, from my experience! Give it a shot!

Ganbatte,
epic_Creations

Edited by epicCreations, 02 February 2012 - 02:21 AM.

  • 0

#3 Dangerous_Dave

Dangerous_Dave

    GMC Member

  • Global Moderators
  • 9276 posts
  • Version:Unknown

Posted 04 February 2012 - 03:22 AM

If you want to change the name of the html5game folder, you need to change the index file as well as the reference to the folder in the javascript file. Open the javascript file (yourgame.js) and search for "html5game". Update it to the new folder name.
  • 0

#4 GerardoLegend

GerardoLegend

    GMC Member

  • GMC Member
  • 9 posts
  • Version:GM:Studio

Posted 13 February 2012 - 11:22 AM

I'm also having this issue. I followed what was said here, and recompiled it without renaming anything and placing it on my main web directory, and nothing happens on all browsers. I set the webGL to auto-detect, and yet nothing. also I then change it to required and nothing. I'm completely stumped here.
  • 0

#5 GerardoLegend

GerardoLegend

    GMC Member

  • GMC Member
  • 9 posts
  • Version:GM:Studio

Posted 13 February 2012 - 12:35 PM

um, nevermind - :confused:
When I executed one of the demos, it worked for some reason. So I reloaded my game file to try again and bam, without any explanation, it just worked. I didn't do anything to the code. I just exit GM:html5 and open one of the demos. So I wonder, does GM:html5 have a mind of it's own????? Really though, I'm confused why it was stubborn to work before. I'm perplexed.
  • 0

#6 GM Studios

GM Studios

    GMC Member

  • GMC Member
  • 189 posts
  • Version:GM:Studio

Posted 15 February 2012 - 12:14 AM

Cheers guys got it to work eventually thanks to Dangerous_Dave. I opened the js file and edited as said and it worked i find it odd that you have to change that as well (though it makes sense) i guess that's why i'm not a programmer haha.

Thanks for the replies me and my easier to type, read and remember URL thankyou.
  • 0

#7 Dangerous_Dave

Dangerous_Dave

    GMC Member

  • Global Moderators
  • 9276 posts
  • Version:Unknown

Posted 15 February 2012 - 03:34 AM

i find it odd that you have to change that as well


The javascript file is not being run from it's own location, it is being loaded into the index.html file. Changing the location in the HTML file only tells the HTML file where to find the javascript file, it doesn't tell the javascript file where to find the images/sounds. The javascript file needs to know where the find the resources so it can use them in-game.
  • 0




0 user(s) are reading this topic

0 members, 0 guests, 0 anonymous users