Tool HTML My method of running HTML games

Would you be interested in a packaged solution? (An exe file that you run and does all this for you)

  • No

    Votes: 0 0.0%
  • No I prefer to do this another way (Please share)

    Votes: 0 0.0%

  • Total voters
    12

flookout2

New Member
Jul 23, 2020
4
12
Preview image
I have been enjoying HTML games recently and I use the following method to start a local server and keep it all in one place to track (As I'm lazy to update the list a python script does it on its own)
Short Version:
I run node.js local server and update the HTML files using python that automatically updates and I get a webpage with all the games in the same directory and sub-directory. You can download the files attached after following the requirements section or read the details to learn more about what's going on.
Requirements and setup:
I'm going to try to write this in as much detail as I can there are two available versions for the server (as written in the BAT file) one of which is using python the other is using node.js (which I highly recommend as it doesn't allow for caching and opens the browser as the server runs). If you want to use that follow from step 1 or skip to step 3.
1. [OPTIONAL] Install node.js and npm from the official website here: .
2. [OPTIONAL] After node.js and npm are installed open a command line (WIN KEY + R > "CMD" > RUN) and enter the following command
You don't have permission to view the spoiler content. Log in or register now.
this installs the npm package (http-server - ).
3. Install python 3 from the following URL: (In the header click "Download" and it will show a drop-down with the download button) and make sure you check the add to path checkbox.
4. Extract the contents of the ZIP package to a directory.
5. Each game should be in a sub-directory under the one made in step 4
6. [OPTIONAL] If step 1 and 2 were not followed open the server.bat file in any text editor (notepad will work) to change the default server from node.js to python and change the following:
You don't have permission to view the spoiler content. Log in or register now.
to
You don't have permission to view the spoiler content. Log in or register now.
7. Now start the file "Server.bat" this (if the node.js path was used) will start a local server, create a "list.json" file and open up a browser window.
8. ENJOY!

In detail:
Ok so in this section I'll cover each file and what it does ... IN A TABLE because its easier that way

FilenameReason of existenceMore about the file
list.pyPython file looks up in the directory and subdirectories to find HTML files that can be listedThis file runs python 3 to read the directory and subdirectories (Which can be changed or add more directories to search in if you edit the scan_dirs array it can use * to indicate all ex game-* which will look for any directory with game- in beginning) this script runs to generate the list.json (More about that below) you can read each line and read the comments (HTML files are sorted by last modified).
list.jsonHolds all the data of the HTML files found by list.pyThis gets read by accessing (if you're using the default port) by a Javascript in the index.html file
index.htmlThe default homepageContains a table and calls map.js to get the list.
map.jsGet the data in list.json and lays them outThere is no magic to it just get the list.json data and puts it out in the table
update_list.batCalls list.pyThat's all it does just call list.py
server.batCalls update_list.bat to ensure that the list is up to date then starts http serverDepending on what you changed in step 6 this would open a node.js or a python local server both set by default to run on port 8882 meaning you can access this from the following url or using your local network ip which enables you to run any of these HTML games on your phone or tablet or other computer (This can be disabled in node.js server option)
 
Last edited:
  • Like
Reactions: Stardust07