Skip to main content

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 = "account_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.

Navigation

Provide a function to the SIMPL_SETUP_NAV setting. It should accept a Run object as an argument and return a dictionary of keys as Simpl URL names and the values as a dictionary with the name, optional hint, and one of the following statuses:

  • simpl.nav.DISABLED (and unstarted)

  • simpl.nav.UNSTARTED

  • simpl.nav.INCOMPLETE

  • simpl.nav.READY

  • simpl.nav.COMPLETE

For example:

return {
    "config": {
        "name": "Game Configuration",
        "status": nav.UNSTARTED,
    },
    "team": {
        "name": "Manage Teams",
        "status": nav.DISABLED,
    },
    "start": {
        "name": "Start Game",
        "status": nav.DISABLED,
    },
}

Provide a function to the SIMPL_PLAY_NAV setting. It should accept a Run object as an argument and return a dictionary of keys as Simpl URL names and the values as a dicitonary with the name and one of the following statuses:

  • simpl.constants.DISABLED

  • simpl.constants.READY

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.

Auth0

If using Auth0 for social authentication, add the following Django settings to make sure users are correctly logged out of Auth0 and (optionally) redirected after logout:

ACCOUNT_ADAPTER = "simpl.auth0.Auth0LogoutAdapter"
AUTH0_LOGOUT_RETURN_TO = "some.url"

Release files for simpl-cloud 1.3.0

For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.

Source distribution (sdist)

Source distribution for simpl-cloud 1.3.0
File Size Uploaded
simpl-cloud-1.3.0.tar.gz 306.6 kB Details

Built distribution (wheel)

Table of built distributions (wheels) for simpl-cloud 1.3.0
File Interpreter ABI Platform
simpl_cloud-1.3.0-py3-none-any.whl Python 3 none any Details

Total release size: 633.5 kB

Release files / simpl-cloud-1.3.0.tar.gz

Download URL simpl-cloud-1.3.0.tar.gz
Size 306.6 kB
Tags Source
SHA-256 checksum
How to use checksums
5daf785a61347987f54537b258fd22f2b47941f95b8eaf4be19ec759a1abb564
BLAKE2b-256 checksum
How to use checksums
0838d65acfca3f1534fe72cfdb8f4eedb4dd5cfed04016061815c371d0d28e04
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/3.4.1 importlib_metadata/4.11.4 pkginfo/1.7.0 requests/2.28.2 requests-toolbelt/0.9.1 tqdm/4.59.0 CPython/3.9.14

Release files / simpl_cloud-1.3.0-py3-none-any.whl

Download URL simpl_cloud-1.3.0-py3-none-any.whl
Size 326.9 kB
Tags Python 3
SHA-256 checksum
How to use checksums
7d1e3ac8644d4f8551b0de9a876c2508e0501f221af0ae9ad6a424f53a136c7e
BLAKE2b-256 checksum
How to use checksums
e1e62299566b9593d474c2b0befd511541c9cc570db02d197a5ff44bea5eb494
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/3.4.1 importlib_metadata/4.11.4 pkginfo/1.7.0 requests/2.28.2 requests-toolbelt/0.9.1 tqdm/4.59.0 CPython/3.9.14

Release history Release notifications | RSS feed

This release

1.3.0 This release

2 release files

1.2.4

2 release files

1.2.3

2 release files

1.2.2

2 release files

1.2.1

2 release files

1.2

2 release files

1.1

2 release files

1.0.9

2 release files

1.0.8

2 release files

1.0.7

2 release files

1.0.6

2 release files

1.0.5

2 release files

1.0.4

2 release files

1.0.3

2 release files

1.0.2

2 release files

1.0.1

2 release files

1.0

2 release files

0.62

2 release files

0.61

2 release files

0.60

2 release files

0.59

2 release files

0.58

2 release files

0.57

2 release files

0.56

2 release files

0.55

2 release files

0.54

2 release files

0.53.2

2 release files

0.53.1

2 release files

0.53

2 release files

0.52

2 release files

0.51

2 release files

0.50.1

2 release files

0.50

2 release files

0.49

2 release files

0.48

2 release files

0.47

2 release files

0.46

2 release files

0.45

2 release files

0.44

2 release files

0.43

2 release files

0.42

2 release files

0.41.1

1 release file

0.41

2 release files

0.40

2 release files

0.39

1 release file

0.38

1 release file

0.37

2 release files

0.36

2 release files

0.35

2 release files

0.34

1 release file

0.33

2 release files

0.32

2 release files

0.31.3

2 release files

0.31.2

2 release files

0.31.1

2 release files

0.31

2 release files

0.30

2 release files

0.29

2 release files

0.28

2 release files

0.27

2 release files

0.26

2 release files

0.25

2 release files

0.24

2 release files

0.23

2 release files

0.22

2 release files

0.21

2 release files

0.20

2 release files

0.19

2 release files

0.18

2 release files

0.17

2 release files

0.16

2 release files

0.15

2 release files

0.14

2 release files

0.13

2 release files

0.12

2 release files

0.11

2 release files

0.10

2 release files

0.9

2 release files

0.8.1

2 release files

0.8

2 release files

0.7

2 release files

0.6.1

2 release files

0.6

2 release files

0.5

2 release files

0.4.1

2 release files

0.4

2 release files

0.3

2 release files

0.2

2 release files

0.1

2 release files

Anthropic, PBC Visionary sponsor Bloomberg Visionary sponsor Hudson River Trading Visionary sponsor Meta Visionary sponsor NVIDIA Visionary sponsor Microsoft Sustainability sponsor Depot Continuous Integration AWS Cloud computing and Security Sponsor Datadog Monitoring Fastly CDN Google Download Analytics Sentry Error logging StatusPage Status page