PyCon JP 2022

ロケール設定が保存されました。pretalxでは英語のサポートが充実していると思っていますが、問題やエラーが発生した場合は、ぜひご連絡ください。

[辞退 / Declined] Introducing new game development stack using XState, PyScript and Atri
2022/10/14 , pyconjp_2
言語: English

このセッションは登壇者の都合でキャンセルされました。
This talk has been canceled due to speaker's reasons.


A game can be thought of as a series of states. The characters in the game either interact with the scene or with each other. Even a small game has hundreds of states. We will discuss how to render these scenes and manage these interactions using three open-source projects - XState, PyScript and Atri.


I will introduce a new game development stack for Python and build a game step-by-step using this stack.

We will first represent scenes using numpy arrays. These arrays will be handed over to the browser’s inbuilt 2D and 3D WebGL rendering engine. The frontend of the game will be built visually and its backend in Python both using Atri framework.

Note that each character-scene interaction and character-character interaction produces a state. A game can be thought of as a series of states where in each frame we either enter or exit a state. The next step is to build and manage these states. We will do this by using the XState library which is an implementation of statecharts with minor modifications.

Lastly, we will improve the performance of the game by shifting the computation to client side. We will implement it using PyScript.

The outline of the talk will be as follows:

  1. Show the game we will be building - its story, character and scenes. [2 min]

  2. Discuss the stack and build the game step-by-step. [23 min]

    a. How to render scenes? [10 min]

      i. How to represent a scene in Python using a numpy array? [2 min]
    
      ii. Introduce WebGL interface and discuss how to translate the numpy array to WebGL. [3 min]
    
      iii. Build UI and its backend in Python using Atri framework. [5 min]
    

    b. How to compute the next scene? [13 min]

     i. Define the inputs - last scene, current state, user input if any. [1 min]
    
     ii. Discuss why the state management system is required. [1 min]
    
     iii. Introduce state machine [2 min]
    
     iv. Introduce statecharts [2 min]
    
     v. Implement statecharts using XState. [4 min]
    
     vi. Implement actual scene calculation using numpy in Python. [3 min]
    
  3. Discuss performance of the game in different scenarios. [1 min]

    a. Scenario 1: we operate in server-client mode

    b. Scenario 1: we push calculations to the client side

  4. How to achieve a better frame per second? [3 min]

    a. Introduce PyScript. [1 min]

    b. How to use it in the browser? [1 min]

    c. Implement it for this game using Atri Editor. [1 min]

  5. Closing remarks [1 min]

Shyam Swaroop is the Co-Founder & CTO of Atri Labs where he is developing a new full-stack framework for web development. He has five years of experience in Machine Learning and Software Engineering in academia and industry. His most recent engagement in academia was working with DARPA under the US Department of Defense as Graduate Research Assistant at Columbia University (USA). Previously, he has created software products that have yielded multi million dollars of revenue for his organization, EXL Services, a US headquartered technology consulting firm. He studied Engineering from IIT, India.