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

Web UI #5

Open
wants to merge 18 commits into
base: master
Choose a base branch
from
Open

Web UI #5

wants to merge 18 commits into from

Conversation

Arkanic
Copy link
Contributor

@Arkanic Arkanic commented Jul 31, 2024

Compiles atmosim to WASM via emscripten, tied with a html/js WebUI
Current state is functional, but probably a few things that I still want to tweak
Uploading just so it doesn't die untouched in a folder on my computer for years

Backend

All web code & configuration lies within the "web" folder, and no further modifications to the base atmosim.cpp are required, meaning that the web ui is effectively standalone to the actual atmosim calculator.
The only required dependency for building is emscripten, with python being optional for the dev webserver (run make serve, and visit http://127.0.0.1:8000/dist/ to view). Building compiles atmosim.cpp and puts the result in /dist, and then copies all the files from /src to /dist as well

Functionally emscripten compiles atmosim.cpp into atmosim.wasm and atmosim.js (the JS interaction endpoint). The Web UI JS then calls atmosim as a web worker so that the main thread remains responsive and doesn't make the browser feel "laggy". Input is provided via args, and output is parsed from the stdout of the atmosim binary.

Bad things

The current output format isn't very nice to parse as a computer, it follows a pattern but there are a lot of outliers in the output which means that the JS parsing the atmosim output has to be relatively hardcoded, meaning that changes to the output in future will require modifications to main.js in order to not break the output.

TODO

  • Github actions to build web on release
  • Readme instructions
  • Add more input options to the UI
  • Potentially handle when no maxcaps are found by atmosim?
  • make css cool (and autoscroll the terminal output)

pls look through and point out things that are bad

image
image
image

Sample dist.zip if you just want to look through without installing emscripten and whatnot:

dist.zip
note that you'll probably have to self host it locally as a lot of javascript fetch stuff doesn't work locally for security reasons

@Ilya246
Copy link
Owner

Ilya246 commented Jul 31, 2024

needs some more tweaks:

  • normally the mix gas goes into the tank, and the pure gas goes into the canister; what you've depicted is the rarer reverse-mix method
  • this is kind of useless since it only lets you optimise for radius, all actually practical bombs optimise for something else
  • in order to optimise for something that isn't radius you also need restrictions to be settable

@Arkanic
Copy link
Contributor Author

Arkanic commented Jul 31, 2024

lol i just noticed i did it the wrong way around troll

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

Successfully merging this pull request may close these issues.

2 participants