Skip to main content

Pygame Zero like API to teach 3d games programming based on Raylib

Project description

Richlib

A simplified API for Raylib for use in education and to enable beginners to create 3d games.

Current state: working, but untested alpha, API may change.

Use

Richlib is just a few classes that sit on top of Raylib Python CFFI. Once you have imported Richlib you automatically get all of raylib.static and raylib.pyray and you could just copy any Raylib Python example code you find. Then if you want to use Richlib's classes as well as Raylib you can.

The normal way of using Richlib is not to write your own main game loop. Instead, you set some variables to tell Richlib how you'd like your game to be:

from richlib import *

WIDTH=800
HEIGHT=640
CAMERA=rl.CAMERA_FIRST_PERSON
DATA_DIR="examples/models/resources/models/"

cube = Cube((0, 10, 0), (10, 20, 10), 'blue')

Then you define some specially named methods:

def draw():
    clear()
    cube.draw()

def update():
    cube.x = cube.x + 1
    if cube.x > 100:
        cube.x = -100

Then you tell Richlib to run your methods in its game loop:

run()

Differences from Pygame Zero

  1. We don't have a special mode in the Mu editor like Pygame Zero does, and therefore it is necessary to add an import line to the start of every program, and a run() line to the end.

  2. The underlying API, Raylib, is not object oriented like Pygame is. The stuff added by Richlib is object oriented but you might notice there is no proper equivalent of the screen object because Raylib doesn't have one.

  3. 3D games are inherently more complex than 2D, e.g. there is no equivalent of the camera object for the 2d programmer to worry about.

  4. To mitigate (3) as much as possible we do automate some stuff that you might expect to do manually in Pygame Zero.

Project details


Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distribution

richlib-0.0.3.tar.gz (22.5 MB view details)

Uploaded Source

Built Distribution

richlib-0.0.3-py3-none-any.whl (22.4 MB view details)

Uploaded Python 3

File details

Details for the file richlib-0.0.3.tar.gz.

File metadata

  • Download URL: richlib-0.0.3.tar.gz
  • Upload date:
  • Size: 22.5 MB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/1.13.0 pkginfo/1.5.0.1 requests/2.22.0 setuptools/40.8.0 requests-toolbelt/0.9.1 tqdm/4.32.1 CPython/3.7.3

File hashes

Hashes for richlib-0.0.3.tar.gz
Algorithm Hash digest
SHA256 291af2f9617cb69044999c7cd882f5cbe28d42deefbb4c055715472197b314b6
MD5 6c0ce3b1f5292e4850ff4992b0ddd937
BLAKE2b-256 0b1d3a69b5616f8048c0aceb116cc7a18feac1c89a690af04e24ec2b8d26eedd

See more details on using hashes here.

File details

Details for the file richlib-0.0.3-py3-none-any.whl.

File metadata

  • Download URL: richlib-0.0.3-py3-none-any.whl
  • Upload date:
  • Size: 22.4 MB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/1.13.0 pkginfo/1.5.0.1 requests/2.22.0 setuptools/40.8.0 requests-toolbelt/0.9.1 tqdm/4.32.1 CPython/3.7.3

File hashes

Hashes for richlib-0.0.3-py3-none-any.whl
Algorithm Hash digest
SHA256 b3ae85e14408ec7197f8c9a475a973e28360fb9019c88c6d7f3e5e301095f980
MD5 2454293486a557118ec604d904451986
BLAKE2b-256 a52d7693aec06ef02e2f162335834ad4b044d7bb424c264221e87c20ecfc5572

See more details on using hashes here.

Supported by

AWS AWS Cloud computing and Security Sponsor Datadog Datadog Monitoring Fastly Fastly CDN Google Google Download Analytics Microsoft Microsoft PSF Sponsor Pingdom Pingdom Monitoring Sentry Sentry Error logging StatusPage StatusPage Status page