HTML JavaScript and localhost server directories (user directories)

Jan 25, 2018
97
119
Long story short I am making a game where I want to allow users to create their own imagepacks in JavaScript using only localhost. This means no NodeJS is ever expected to run and no apache or whatever else config can be set up to make server directories discoverable.

Right now I am bruteforcing the first 200 namespaces of what I would expect (ex: if I have an image for "woman" I would try to load everything from woman(1).png to woman(200).png, same thing for a handful of other file extensions). This is what we in the development business call a hilariously bad solution for a hilariously terrible problem. It is, however, the only solution I've found so far that is both flexible and easy for users to add to.

The requirements I'm imposing myself are as follows:

- User-side must require, at most, adding a line to a txt or similar file to add a new imagepack directory full of images of various formats
- Strict naming conventions for image files are fine, no naming conventions for image files are better (would allow for multiple image packs to be loaded at once)
- Images are loaded up during startup so they can be randomized during the game

And before someone thinks to say it, I am extremely painfully aware that just about any other programming language would be not only easier but far more adequate for a project like this. I am also doing this to myself to learn JavaScript coming from Java, and I am actually really happy with the progress I'm making.
 

Kinderalpha

Pleb
Donor
Dec 2, 2019
198
261
Just to clarify, it sounds like you're trying to enable players to use their own image packs? If that's the case, just impose strict naming on image files. If not, care to elaborate more on what your goal is here?
 
Jan 25, 2018
97
119
Just to clarify, it sounds like you're trying to enable players to use their own image packs? If that's the case, just impose strict naming on image files. If not, care to elaborate more on what your goal is here?
Sorry I messed up the introductory sentence a bit. The ideal scenario is a drag-and-drop imagepack system, and a big part of the issue is that there's an arbitrary amount of images and even directories because I am making this easily modifiable. The challenge lies in creating a way to crawl through the different directories using javascript.