{"id":21844066,"url":"https://github.com/electronstudio/rlzero","last_synced_at":"2026-01-28T18:06:17.654Z","repository":{"id":40634833,"uuid":"190944410","full_name":"electronstudio/rlzero","owner":"electronstudio","description":"A simplified API for Raylib to enable beginners to create 3d games","archived":false,"fork":false,"pushed_at":"2022-08-21T00:53:51.000Z","size":34067,"stargazers_count":25,"open_issues_count":1,"forks_count":1,"subscribers_count":2,"default_branch":"master","last_synced_at":"2025-02-24T05:03:32.943Z","etag":null,"topics":[],"latest_commit_sha":null,"homepage":null,"language":"HTML","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"epl-2.0","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/electronstudio.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":null,"license":"LICENSE","code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null}},"created_at":"2019-06-08T23:24:40.000Z","updated_at":"2024-12-21T21:33:30.000Z","dependencies_parsed_at":"2022-08-28T00:12:38.441Z","dependency_job_id":null,"html_url":"https://github.com/electronstudio/rlzero","commit_stats":null,"previous_names":["electronstudio/richlib"],"tags_count":1,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/electronstudio%2Frlzero","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/electronstudio%2Frlzero/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/electronstudio%2Frlzero/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/electronstudio%2Frlzero/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/electronstudio","download_url":"https://codeload.github.com/electronstudio/rlzero/tar.gz/refs/heads/master","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":244825652,"owners_count":20516592,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2022-07-04T15:15:14.044Z","host_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub","repositories_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories","repository_names_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repository_names","owners_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners"}},"keywords":[],"created_at":"2024-11-27T22:18:20.705Z","updated_at":"2026-01-28T18:06:12.635Z","avatar_url":"https://github.com/electronstudio.png","language":"HTML","funding_links":[],"categories":[],"sub_categories":[],"readme":"# README\n\nA simplified API for Raylib for use in education and to enable beginners to create 3d games.\n\nCurrent state: 2d API is working and usable for education although may change a little before v1.0. 3d API is still in\nflux.\n\n## Use\n\n```\npip3 install rlzero\n```\n\nRLZero is just a few classes that sit on top of Raylib. Once you have imported RLZero you automatically get all of\nRaylib and you could copy any Raylib Python example code you find. Then if you want to use RLZero's classes as well as\nRaylib you can.\n\nThe normal way of using RLZero is not to write your own main game loop. Instead, you set some variables to tell RLZero\nhow you'd like your game to be define some specially named methods.\n\n**test.py**:\n\n```python\nfrom rlzero import *\n\nWIDTH = 800\nHEIGHT = 640\nCAMERA = CAMERA_FIRST_PERSON\nDATA_DIR = \"examples/models/resources/models/\"\n\ncube = Cube((0, 10, 0), (10, 20, 10), BLUE)\n\n\ndef draw3d():\n    clear()\n    cube.draw()\n\n\ndef update():\n    cube.x = cube.x + 1\n    if cube.x \u003e 100:\n        cube.x = -100\n\n\nrun()\n```\n\n# Design notes\n\nRLZero was inspired by the amazing Pygame Zero but with the addition of 3d graphics. Since I've\nbeen using it in the classroom the design has diverged a little.  It turns out\nthat 'zero boilerplate', in the sense of making the program as short as it can possibly be, is not actually most\nconducive to learning.  Sometimes being explicit rather than implicit is good.\n\n## Callbacks\n\nPGZero is heavily based on asynchronous callbacks. The main advantage of this is you can get started without\nwriting a main loop. It also makes event processing and timers easier. (Well, easier in the sense of requiring less code.)\nConceptually a callback is quite an advanced concept, so the downside is that the student may learn how to use it but\nwon’t really understand how it works.  When asked to add code to an existing program, \nstudents frequently attempt to add multiple `update` functions, because\nthey don't understand what a function is, or why there can't be two functions with the same name, or why this\nparticular function is special.\n\nI think it’s worth keeping the callbacks for use by beginners  especially as that lets us have a hidden (fairly complex)\nmain loop. But it should be possible for students to write their own main loops, and at some point we should encourage\nthis.\n\n## Imports/runner\n\nPGZero avoids the use of imports (and run method) by using its own runner to load and run the programs. This saves\ntwo lines of boilerplate on each program. However the trade-off is pretty large:\n\n* PGZero programs are not valid Python programs\n* PGZero is only easy to set-up in the Mu Editor - elsewhere it’s a pain.\n* Importing is a fundamental concept in almost every programming language so any student who goes beyond the basics will\n  have to learn about it eventually.  Hiding it doesn’t do them any favours except save some typing on the first day.\n\nFor these reasons PGZero can optionally work using imports and without the runner. I think RLZero should default to th\nother choice: require imports, but have a runner available for teachers that want to use it.\n\nRlZero is intended to be the first step in a programming education. On the other hand, for a one off lesson with students who are never\ngoing to actually learn to program, a runner would be better.\n\n## File loading\n\nPygame zero loads data files without specifying the file extension or the directory containing the file. There’s little\nharm in implementing this as a fallback to help those who need it to but I’ve seen students get quite confused by it.\nWith no file extension they don't see any difference between the file name and a variable name. So I’m\ngoing to specify the full file path in the examples.\n\n## Light weight, minimal wrapper\n\nAs much possible we should encourage the use of Raylib functions. There are some additions but I don’t want to maintain\na whole parallel hierarchy of enhanced versions of data types that already exist in Raylib. Eventually students should\nbe able to use pure Raylib and Implement their own versions of sprite classes, etc. And our implementations should try\nto be simple enough they could be pasted into a pure Raylib program if needed.\n\n## Strings\n\nPGZero automatically converts strings to colours.  This confuses students about why some colour names are\naccepted and some are not.  And of course we can't do IDE autocompletion or checking on strings.\nSo we are using Color type constants instead.\n\nPGZero weirdly *doesn't* use strings where it would make sense: when loading sound files.  Instead the file name\nis read from a pseudo package name.  It reduces typing slightly, but conceptually makes it seem like the name is\npart of the language, not a file on disk.  This is really getting into the territory of creating dynamic DSLs\nlike Ruby does, which is not Python-like.","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Felectronstudio%2Frlzero","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Felectronstudio%2Frlzero","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Felectronstudio%2Frlzero/lists"}