Make 2D and 3D games with simple BASIC syntax and full Raylib power.
Option A: Download Pre-built (Windows)
# Download cyberbasic.exe from releases
# Place it anywhere (e.g., C:\Games\CyberBasic\)Option B: Build from Source
git clone https://github.com/CharmingBlaze/cyberbasic.git
cd cyberbasic/source
python build.py --static
# Executable: build/cyberbasic.exeCreate my_game.bas:
REM My First CyberBasic Game
INITWINDOW(800, 600, "My Awesome Game")
SETTARGETFPS(60)
VAR playerX = 400
VAR playerY = 300
VAR speed = 5
WHILE NOT WINDOWSHOULDCLOSE()
REM Input handling
IF ISKEYDOWN(KEY_W) THEN playerY = playerY - speed
IF ISKEYDOWN(KEY_S) THEN playerY = playerY + speed
IF ISKEYDOWN(KEY_A) THEN playerX = playerX - speed
IF ISKEYDOWN(KEY_D) THEN playerX = playerX + speed
REM Drawing
BEGINDRAW()
CLEARBACKGROUND(30, 30, 50)
DRAWCIRCLE(playerX, playerY, 30, 255, 100, 100)
DRAWTEXT("Use WASD to move", 10, 10, 20, 255, 255, 255)
ENDDRAW()
WEND
CLOSEWINDOW()cyberbasic.exe my_game.basThat's it! You just made your first game!
REM 2D Game Template
INITWINDOW(800, 600, "My 2D Game")
SETTARGETFPS(60)
REM Load assets
VAR playerTexture = LOADTEXTURE("player.png")
VAR background = LOADTEXTURE("bg.png")
REM Game state
VAR playerX = 400
VAR playerY = 300
VAR playerSpeed = 5
VAR score = 0
WHILE NOT WINDOWSHOULDCLOSE()
REM Update
IF ISKEYDOWN(KEY_W) THEN playerY = playerY - playerSpeed
IF ISKEYDOWN(KEY_S) THEN playerY = playerY + playerSpeed
IF ISKEYDOWN(KEY_A) THEN playerX = playerX - playerSpeed
IF ISKEYDOWN(KEY_D) THEN playerX = playerX + playerSpeed
REM Draw
BEGINDRAW()
CLEARBACKGROUND(20, 20, 30)
REM Draw background
DRAWTEXTURE(background, 0, 0, 255, 255, 255)
REM Draw player
DRAWTEXTURE(playerTexture, playerX, playerY, 255, 255, 255)
REM Draw UI
DRAWTEXT("Score: " + STR(score), 10, 10, 20, 255, 255, 255)
DRAWTEXT("FPS: " + STR(GETFPS()), 10, 35, 20, 255, 255, 255)
ENDDRAW()
WEND
REM Cleanup
UNLOADTEXTURE(playerTexture)
UNLOADTEXTURE(background)
CLOSEWINDOW()Graphics:
DRAWCIRCLE(x, y, radius, r, g, b)- Draw circlesDRAWRECTANGLE(x, y, width, height, r, g, b)- Draw rectanglesDRAWTEXTURE(texture, x, y, r, g, b)- Draw textures/spritesDRAWTEXT(text, x, y, size, r, g, b)- Draw textDRAWLINE(x1, y1, x2, y2, r, g, b)- Draw lines
Input:
ISKEYDOWN(key)- Check if key is pressedISKEYPRESSED(key)- Check if key just pressedGETMOUSEPOSITION()- Get mouse positionISMOUSEBUTTONPRESSED(button)- Check mouse button
Audio:
LOADSOUND("file.wav")- Load sound effectPLAYSOUND(sound)- Play soundLOADMUSIC("file.mp3")- Load musicPLAYMUSIC(music)- Play music
REM 3D Game Template
INITWINDOW(800, 600, "My 3D Game")
SETTARGETFPS(60)
REM Setup 3D camera
VAR camera = CAMERA3D()
camera.position = VECTOR3(0, 10, 10)
camera.target = VECTOR3(0, 0, 0)
camera.up = VECTOR3(0, 1, 0)
camera.fovy = 45
camera.projection = CAMERA_PERSPECTIVE
REM Load 3D model
VAR model = LOADMODEL("character.obj")
VAR rotation = 0
WHILE NOT WINDOWSHOULDCLOSE()
rotation = rotation + 1
REM Update camera (example: orbit)
VAR time = GETTIME()
camera.position.x = COS(time) * 10
camera.position.z = SIN(time) * 10
REM Draw
BEGINDRAW()
CLEARBACKGROUND(50, 50, 60)
BEGINDRAW3D(camera)
REM Draw ground
DRAWCUBE(VECTOR3(0, -1, 0), 20, 1, 20, GRAY)
REM Draw model with rotation
PUSHMATRIX()
ROTATE(rotation, 0, 1, 0)
DRAWMODEL(model, VECTOR3(0, 0, 0), 1, WHITE)
POPMATRIX()
REM Draw primitives
DRAWCUBE(VECTOR3(5, 1, 5), 1, 1, 1, RED)
DRAWSPHERE(VECTOR3(-5, 1, -5), 1, BLUE)
ENDDRAW3D()
REM Draw UI overlay
DRAWTEXT("FPS: " + STR(GETFPS()), 10, 10, 20, 255, 255, 255)
DRAWTEXT("3D Game", 10, 35, 20, 255, 255, 255)
ENDDRAW()
WEND
REM Cleanup
UNLOADMODEL(model)
CLOSEWINDOW()3D Primitives:
DRAWCUBE(position, width, height, length, color)- Draw cubeDRAWSPHERE(position, radius, color)- Draw sphereDRAWPLANE(position, width, length, color)- Draw planeDRAWCYLINDER(position, radiusTop, radiusBottom, height, color)- Draw cylinder
3D Models:
LOADMODEL("file.obj")- Load 3D modelDRAWMODEL(model, position, scale, color)- Draw modelUNLOADMODEL(model)- Unload model
Camera:
CAMERA3D()- Create 3D cameraBEGINDRAW3D(camera)- Start 3D renderingENDDRAW3D()- End 3D rendering
Lighting:
ENABLELIGHTING()- Enable lightingSETLIGHTDIRECTION(direction, color)- Set directional lightSETLIGHTPOSITION(position, color, intensity)- Set point light
The examples/ folder contains 69+ working examples:
2D Games:
pong_game.bas- Complete Pong with AIspace_invaders.bas- Classic Space Invaders2d_game_template.bas- 2D game starter
3D Games:
model_viewer.bas- 3D model viewer3d_game_template.bas- 3D game startercomplete_3d_game_demo.bas- Full 3D game example
Features:
hello_graphics.bas- Basic graphicsaudio_demo.bas- Audio systemphysics_demo.bas- Physics simulationgui_demo.bas- GUI system
Run any example:
cyberbasic.exe examples/pong_game.bas- Game Development Guide:
docs/GAME_DEVELOPMENT_GUIDE.md - 2D Graphics Guide:
docs/2D_GRAPHICS_GUIDE.md - 3D Graphics Guide:
docs/3D_GRAPHICS_GUIDE.md - Quick Reference:
docs/QUICK_REFERENCE.md
INITWINDOW(800, 600, "Game")
SETTARGETFPS(60)
WHILE NOT WINDOWSHOULDCLOSE()
REM 1. Handle Input
IF ISKEYDOWN(KEY_SPACE) THEN
REM Do something
ENDIF
REM 2. Update Game State
playerX = playerX + velocityX
REM 3. Draw Everything
BEGINDRAW()
CLEARBACKGROUND(0, 0, 0)
REM Draw game objects
ENDDRAW()
WEND
CLOSEWINDOW()VAR frame = 0
VAR frameTime = 0
VAR currentFrame = 0
WHILE NOT WINDOWSHOULDCLOSE()
frameTime = frameTime + GETFRAMETIME()
REM Change frame every 0.1 seconds
IF frameTime >= 0.1 THEN
currentFrame = (currentFrame + 1) MOD 4
frameTime = 0
ENDIF
BEGINDRAW()
REM Draw sprite at currentFrame
DRAWTEXTUREREC(texture, RECTANGLE(currentFrame * 32, 0, 32, 32), x, y, WHITE)
ENDDRAW()
WENDFUNCTION CHECKCOLLISION(x1, y1, w1, h1, x2, y2, w2, h2) AS BOOLEAN
IF x1 < x2 + w2 AND x1 + w1 > x2 AND y1 < y2 + h2 AND y1 + h1 > y2 THEN
RETURN TRUE
ENDIF
RETURN FALSE
END FUNCTION
REM Usage
IF CHECKCOLLISION(playerX, playerY, 32, 32, enemyX, enemyY, 32, 32) THEN
REM Collision!
ENDIF- Use
SETTARGETFPS(60)- Limits frame rate, saves CPU - Batch texture loading - Load all textures at start
- Reuse objects - Don't create objects in game loop
- Print values:
PRINT "X: " + STR(playerX) - Show FPS:
DRAWTEXT("FPS: " + STR(GETFPS()), 10, 10, 20, 255, 255, 255) - Draw debug info: Use
DRAWRECTANGLEto visualize collision boxes
- Use functions - Break code into reusable functions
- Use variables - Store magic numbers in named variables
- Add comments - Use
REMto document your code
Build with static linking for zero dependencies:
cd source
python build.py --static- Include executable:
cyberbasic.exe - Include game files: All
.basfiles - Include assets: Textures, sounds, models, etc.
- Create launcher: Simple batch file that runs your main game
Example launcher.bat:
@echo off
cyberbasic.exe main_game.bas
pauseTest on a clean system (no development tools installed) to ensure it works.
- Run Examples - See what's possible
- Modify Examples - Change colors, speeds, add features
- Create Your Own - Start with template, add your ideas
- Read Docs - Learn advanced features
- Share Your Game - Show off what you made!
- CyberBasic is case-insensitive -
VAR,var,Varall work - All Raylib functions available - 527+ functions for graphics, audio, input
- Simple syntax - BASIC is easy to learn
- Powerful features - Full 2D/3D game development
Start coding, start creating, start having fun!
Questions? Check docs/ folder or open an issue on GitHub.
Ready to make games? Start with examples/2d_game_template.bas and modify it!