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

API access possible? #42

Open
Sebaestschjin opened this issue Dec 10, 2023 · 1 comment
Open

API access possible? #42

Sebaestschjin opened this issue Dec 10, 2023 · 1 comment

Comments

@Sebaestschjin
Copy link

Hi,

I'm a developer of the GH/FH mod for Tabletop Simulator. It would be cool if the mod also had support for showing monster movement, but doing it inside TTS would be quite hard and probably very slow. So I was thinking if it would be possible to use this tool as an API. So that the TTS mod could publish it's current board state and get the movements back from the tool. Is this something that would be possible, e.g. when running the server locally?

@AluminumAngel
Copy link
Owner

AluminumAngel commented Dec 10, 2023

This seems viable. The server is fully stateless. You send a board state as JSON to the 'solve' route. It returns the movement options as JSON.

I'm not familiar with Tabletop Simulator development. If it allows Python, you could pull the solver logic in directly. If not, you could run the Flask server locally and send solve requests to its port.

Unfortunately the API is a bit of a mess, and the code is somewhat embarrassing. I put time into the solver and into the frontend. But hacked in the interface between the two very quickly. It's messy, not documented, and doesn't even do proper input validation.

The API specification is determined by solve() in init.py and unpack_scenario() in solver.py.

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

2 participants