Base models and API for Django-based simulations.
Project description
Base models and API for Django-based simulations.
Provides an API compatible with the Wharton Interactive marketplace.
Getting Started
Install simpl-cloud, with the API extras if required:
pip install simpl-cloud[api]
Add simpl to your project’s Django settings module, along with the following settings:
INSTALLED_APPS = { # ... 'simpl', } SIMPL_GAME_EXPERIENCE = "simpl.GameExperience" SIMPL_RUN = "simpl.Run" SIMPL_INSTANCE = "simpl.Instance" SIMPL_CHARACTER = "simpl.Character" SIMPL_PLAYER = "simpl.Player" SIMPL_LOGOUT_URL_NAME = "logout"
Add the following to your project’s URL conf:
urlpatterns = [ # ... path("simpl/", include("simpl.urls")), ]
Architecture Overview
Run objects provide management and configuration of one or more game instances.
Launching game instances
When a player is added to a run, their details are stored in a Player object.
When they start playing your game, they will be attached to an Character object in a game Instance object that will track the progress of their game.
For multiplayer runs, these players will be initially grouped into Lobby object so they can be assigned to a game Instances. A lobby can be marked as ready once it is ready to start.
You can use Run.prepare to create new game Instance objects or manually create these.
Game play URL
The API uses a customizable url endpoint for players. You can specify this by using a custom Player model and overriding Player.get_play_url.
Alternatively, you can specify a SIMPL_GET_PLAY_URL in your settings as a dotted path to a function that receives a player instance and returns the correct url.
Run status
A run has the following statuses:
Set up (initial state, until any configuration options are provided)
Players prepare (optional step to if your game experience if players can interact with their Instance before gameplay starts)
Running (game Instances are running)
Debrief (optional step if your game experience provides a different interface after gameplay finishes)
Game Instance status
Each game Instance also has a status:
Preparing - waiting to start (Instance.date_start unset)
Playing - game in progress (Instance.date_start set but Instance.date_end unset)
Ended - game complete (Instance.date_end set)
Player status
Your app may mark a player as having completed the game (with a date).
Custom models
Extend the Simpl Django models by overriding the default classes in your project’s Django settings module:
Instance via SIMPL_INSTANCE = "your_app.YourInstance"
Character via SIMPL_CHARACTER = "your_app.YourCharacter"
GameExperience (only if your app provides multiple different game experiences) via SIMPL_GAME_EXPERIENCE = "your_app.YourGameExperience"
More rarely, you may also want to override the run and player:
Run via SIMPL_RUN = "your_app.YourRun"
Player via SIMPL_PLAYER = "your_app.YourPlayer"
Your overridden classes should subclass the related simpl.models.Base* abstract models.
The Character class will need two related abstract models, BaseCharacterData and BaseCharacterLinked. This is to make it possible to have character data as a template, not linked to a user or instance.
Project details
Release history Release notifications | RSS feed
Download files
Download the file for your platform. If you're not sure which to choose, learn more about installing packages.
Source Distribution
Built Distribution
File details
Details for the file simpl-cloud-0.4.tar.gz
.
File metadata
- Download URL: simpl-cloud-0.4.tar.gz
- Upload date:
- Size: 140.6 kB
- Tags: Source
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/3.4.2 importlib_metadata/4.6.4 pkginfo/1.7.1 requests/2.26.0 requests-toolbelt/0.9.1 tqdm/4.62.1 CPython/3.9.6
File hashes
Algorithm | Hash digest | |
---|---|---|
SHA256 | 5e3613dd962cfcc8946676c716f1d19dda2630de36bd7b61a4753d8ed129312c |
|
MD5 | 80e71951d527abe922d52a65d884564c |
|
BLAKE2b-256 | 2ac2d407064625a2116952c111a532e0b69e13cbf9f60f5df2b6adf98a135fb6 |
File details
Details for the file simpl_cloud-0.4-py3-none-any.whl
.
File metadata
- Download URL: simpl_cloud-0.4-py3-none-any.whl
- Upload date:
- Size: 155.7 kB
- Tags: Python 3
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/3.4.2 importlib_metadata/4.6.4 pkginfo/1.7.1 requests/2.26.0 requests-toolbelt/0.9.1 tqdm/4.62.1 CPython/3.9.6
File hashes
Algorithm | Hash digest | |
---|---|---|
SHA256 | efc1ece0219177d5988b9380e39ae136bf667e1cb5d8d651dbba6f2fae9de5e9 |
|
MD5 | 09afdf861f88274f9d41505b72bdc834 |
|
BLAKE2b-256 | a2728a792d8518f6e02adba4192d5e5fe199c36e9c7e71deb02aa2c078e783f6 |