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

Add support for GAME function and providing gaming inputs at runtime #483

Closed
chrispcampbell opened this issue May 15, 2024 · 2 comments · Fixed by #505 or #476
Closed

Add support for GAME function and providing gaming inputs at runtime #483

chrispcampbell opened this issue May 15, 2024 · 2 comments · Fixed by #505 or #476

Comments

@chrispcampbell
Copy link
Contributor

chrispcampbell commented May 15, 2024

A number of developers have requested support in SDEverywhere for Vensim's GAME function and for game mode in general (see Vensim docs here and in their user guide here).

Currently SDEverywhere accepts models that use the GAME function, but it simply returns the input value. Adding proper support for the GAME function will entail changes to the compile and runtime packages. I also plan on adding a simple example app that demonstrates how to use the new API that will allow for providing game inputs at runtime.

@chrispcampbell
Copy link
Contributor Author

chrispcampbell commented May 30, 2024

Here's a quick status report. Most of the work on supporting "gaming mode" in SDEverywhere has been in adding the ability for an application to override lookups/data at runtime, and to make that happen there have been a series of improvements made in branches under separate issue numbers.

Completed

Completed as of June 3 (was: In progress as of May 30)

Completed as of August 16 (was: Completing soon)

  • Allow for controlling whether the minimal model listing is included in the generated model #503: Added support for opt-in configuration settings for bundling the model listing with the generated model (to allow for finding lookup variables by name at runtime) and for enabling the setLookup function (to allow for providing game inputs at runtime).
  • Add support for GAME function and providing gaming inputs at runtime #483 (this issue): Once I've merged the branches for the issues listed above, I will be finishing up the last ~20% of gaming support, which should be straightforward. This entails changing the compiler to transform GAME function calls to read from a Lookup instance, which contains the gaming inputs (basically a lookup table) that the application sets at runtime. Once the compiler changes are complete, I will update the house-game example to show how it all fits together.

@chrispcampbell
Copy link
Contributor Author

Now that support for the GAME function is implemented in SDEverywhere, it is now possible to implement turn-based games and simulations in your SDEverywhere-based project. See examples/house-game in this repo for a working example.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment