The Modern BASIC Language for Game Development
Big changes are comming in April 2006! There has been a lot of work on getting the next version ready. In CyberBASIC version 2 we have Included BOX2D and Bullet Physics into the language and we have changed develeopment from C++ to GO and we have a working compiler. Also we will have everything working correctly and its close to being done. This version will change. The team has had a hard time with C++ and getting it to work on other devices, especially MAC. Working with C++ has been a headache. The GO switch has been going smoothly.
If you want to take a look at the pre-pre-version you can go here:https://github.com/CharmingBlaze/cyberbasic2 and we will be releasing it here in april and retiring the C++ version.
CyberBasic combines the simplicity and elegance of classic BASIC programming with the full power of modern game development. Write games, graphics applications, and interactive programs using familiar BASIC syntax while leveraging the complete Raylib graphics library.
Distribution focus: CyberBasic is primarily offered as a plug-and-play Windows executable (
cyberbasic.exe). Linux and macOS users are welcome—and fully supported—to compile from source using the instructions later in this README, but I only distribute binaries for Windows.
Download the Windows Executable:
- Direct download: cyberbasic.exe (ready to run)
- Save it anywhere you want
- Run:
cyberbasic.exe your_game.bas
That's it! No installation, no setup, just download and start coding games.
One-Command Build:
git clone https://github.com/CharmingBlaze/cyberbasic.git
cd cyberbasic
python build.pyOr use platform scripts:
build.bat # Windows
./build.sh # Linux/macOSNeed help?
- Check your system:
python check-system.py - Full guide: Installation Guide
- Zero setup - Download and run immediately
- Modern BASIC - Familiar syntax with modern features
- 527 Raylib functions - Complete 2D/3D graphics, audio, input
- 69+ examples - Games and demos to learn from
- Cross-platform - Windows, Linux, macOS support
- Self-contained - No external dependencies needed
The .github/workflows/build.yml pipeline keeps CyberBasic honest:
- Windows (MinGW + MSYS2) – produces the official
cyberbasic.exeartifact described above. This is the version I expect most users to run. - Linux (GCC) – ensures the project keeps compiling cleanly on Linux so developers there can build locally without surprises. I don’t redistribute that binary, but the job proves the source stays portable.
Anyone can inspect the workflow run to audit the build steps before downloading the Windows artifact or before compiling on their own system.
Create my_game.bas:
REM My First CyberBasic Game
INITWINDOW(800, 600, "My Game")
SETTARGETFPS(60)
VAR x = 400
VAR y = 300
VAR speed = 5
WHILE NOT WINDOWSHOULDCLOSE()
IF ISKEYDOWN(87) THEN y = y - speed
IF ISKEYDOWN(83) THEN y = y + speed
IF ISKEYDOWN(65) THEN x = x - speed
IF ISKEYDOWN(68) THEN x = x + speed
BEGINDRAW()
CLEARBACKGROUND(20, 20, 30)
DRAWCIRCLE(x, y, 30, 255, 100, 100)
ENDDRAW()
WEND
CLOSEWINDOW()
Run it: cyberbasic.exe my_game.bas
The CyberBasic interpreter runs .bas files. Here's how to use it:
Windows (prebuilt):
# From anywhere inside the repo
.\bin\cyberbasic.exe path\to\your\program.bas
.\bin\cyberbasic.exe examples\hello_text.basIf you downloaded the
cyberbasic-windowsartifact or copiedbin\cyberbasic.exeelsewhere, just run it directly—no build step required.
Linux/macOS: CyberBasic currently ships as a Windows executable only. If you’re on another platform you’ll need to build it yourself—see source/README.md for the developer-focused steps (kept out of this guide so end users aren’t distracted).
The repository includes 69+ example programs in the examples/ directory:
# Windows
.\bin\cyberbasic.exe examples\hello_text.bas
.\bin\cyberbasic.exe examples\simple_pong.bas
.\bin\cyberbasic.exe examples\space_invaders.bas
# Linux/macOS (after you produce your own build)
# See source/README.md if you truly need this.
./cyberbasic examples/hello_text.bas
./cyberbasic examples/simple_pong.bas
./cyberbasic examples/space_invaders.bas- Use forward slashes
/or double backslashes\\in file paths on Windows - Relative paths are relative to the current working directory, not the executable location
- You can run programs from any directory by using absolute or relative paths
The repo already includes a statically linked Windows interpreter at bin/cyberbasic.exe. Drop that file next to your .bas game and ship it. Nothing else required.
- Installation Guide - Step-by-step setup for all platforms
- How to Use CyberBasic - Complete guide to using cyberbasic.exe, running examples, and troubleshooting
- Game Development Guide - Complete guide to making games
- 2D Graphics API Guide - Learn 2D rendering, sprites, textures
- 3D Graphics API Guide - Learn 3D rendering, models, cameras, lighting
- GUI System Guide - Complete GUI system documentation
- GUI Quick Reference - Quick reference for all GUI commands
- Distribution Guide - How to distribute your games
- Quick Reference - Quick syntax reference
- BASIC Programming Guide - Complete language reference
- Advanced Features Guide - Enums, dot notation, state machines, ECS, coroutines, tuples
- ECS System Guide - Entity-Component-System architecture
- Modern State System Guide - State machine system
Case-Insensitive: CyberBasic is case-insensitive, just like classic BASIC. Keywords and identifiers can be written in any case:
VAR x = 10 REM All of these work the same:
var y = 20 REM VAR, var, Var are equivalent
Var z = 30 REM myVar, MyVar, MYVAR refer to same variableVariables & Constants:
VAR x = 10 REM Modern variable (can be used anywhere)
LET y = 20 REM Classic variable
CONST PI = 3.14159 REM Immutable constantArrays:
DIM arr[10] REM Classic style
VAR items = [] REM Modern empty array
VAR matrix[5, 10] REM 2D array
REM Advanced operations
arr.insert(6) REM Insert element
arr.remove() REM Remove last
arr.sort() REM Sort array
arr.find(5) REM Find elementDictionaries:
VAR dict = {"key": "value", 2: 3} REM JSON-style
VAR other = {key = "value", other_key = 2} REM BASIC-styleTypes:
TYPE Player
x AS NUMBER
y AS NUMBER
health AS INTEGER
END TYPE
VAR player = Player()
player.x = 100
player.y = 200Functions:
FUNCTION add(a, b) AS INTEGER
RETURN a + b
END FUNCTION
FUNCTION getSize() AS tuple
RETURN (800, 600)
END FUNCTION
VAR (w, h) = getSize() REM Tuple destructuringControl Flow:
IF condition THEN
REM code
ELSEIF other THEN
REM code
ELSE
REM code
ENDIF
WHILE condition
REM code
WEND
FOR i = 1 TO 10
REM code
NEXT
SELECT CASE value
CASE 1
REM code
CASE 2
REM code
END SELECTDot Notation:
VAR pos = Vector2(100, 200)
pos.x = pos.x + 5
PRINT "X: " + STR(pos.x)
VAR color = Color(255, 100, 100, 255)
PRINT "R: " + STR(color.r)2D Graphics:
- Primitives: rectangles, circles, lines, triangles, polygons
- Textures: loading, drawing, sprite sheets
- Text: fonts, formatting, measurements
- Camera: 2D camera system
3D Graphics:
- Primitives: cubes, spheres, planes, grids
- Models: loading, animation, transformations
- Camera: first-person, third-person, orthographic
- Lighting: directional, point, spot lights
- Materials: textures, PBR materials
Audio:
- Sound effects: loading, playing, 3D spatial audio
- Music: streaming, looping, volume control
Input:
- Keyboard: key states, key codes
- Mouse: position, buttons, wheel
- Gamepad: controller support
Window Management:
- Window creation, resizing, fullscreen
- Multi-monitor support
- Window icons and titles
ECS (Entity-Component-System):
COMPONENT Position {x = 0, y = 0}
COMPONENT Velocity {dx = 0, dy = 0}
VAR player = ENTITY()
player.ADD(Position(100, 200))
player.ADD(Velocity(2, 0))
SYSTEM Movement(Position, Velocity)
Position.x += Velocity.dx
Position.y += Velocity.dy
END SYSTEM
RUN MovementState Machines:
STATE Idle
ON UPDATE
REM idle logic
END
TRANSITION TO Walking WHEN keyPressed
END STATECoroutines:
FUNCTION animate() AS coroutine
FOR i = 1 TO 10
PRINT "Step " + i
YIELD
NEXT
END FUNCTIONTimers:
TIMER(1000, repeat = true) -> PRINT "Tick every second"
WAIT(2.0) REM Pause for 2 secondsTuples:
VAR pos = (100, 200)
VAR (x, y) = pos REM DestructuringEnums:
ENUM Direction
UP
DOWN
LEFT
RIGHT
END ENUM
ENUM Status
IDLE = 0
WALKING = 1
RUNNING = 2
END ENUMThe repository includes 69+ example programs in the examples/ directory:
pong_game.bas- Complete Pong game with AIspace_invaders.bas- Classic Space Invaders gamemodel_viewer.bas- 3D model viewer with mouse orbit controlsspinning_cube.bas- Animated 3D spinning cube demonstrationfps_game.bas- First-person shooter with 3D graphics and projectile systemspace_defender.bas- Space shooter with AI enemies2d_game_template.bas- 2D game template3d_game_template.bas- 3D game templatecomplete_game_demo.bas- Full game example
hello_graphics.bas- Basic graphicssmooth_animation_demo.bas- Smooth animationsaudio_demo.bas- Audio systemgui_demo.bas- GUI systemcomprehensive_gui_demo.bas- Complete GUI demonstration with buttons, sliders, checkboxes, tabs, and morephysics_demo.bas- Physics simulationmodels3d_demo.bas- 3D modelscomplete_3d_game_demo.bas- Complete 3D game
var_const_demo.bas- Variables and constantsdot_notation_demo.bas- Dot notationdictionary_literal_demo.bas- Dictionary syntaxselect_case_demo.bas- Control flow
Run any example:
cyberbasic.exe examples/hello_graphics.basCyberBasic is built with modern C++20 and follows clean architecture principles:
- Lexer: Converts BASIC source code into tokens
- Parser: Builds an Abstract Syntax Tree (AST)
- Interpreter: Executes the AST with full runtime support
- Function Registry: Manages built-in and user-defined functions
- Code Generator: Auto-generates Raylib bindings from YAML specifications
cyberbasic/
├── bin/ # Ready-to-run Windows executable
├── docs/ # Guides for learning and shipping CyberBasic games
├── examples/ # 69+ sample games and demos
├── images/ # Logos + showcase screenshots
├── source/ # Full compiler/runtime source tree (for developers)
└── 3Dmodels/ # Assets used by bundled examples
Developers who need the full C++ source can dive into source/ and read source/README.md, but everyone else can ignore that folder entirely.
- Case-Insensitive: Keywords and identifiers can be written in any case (
VAR,var,Varall work) - Variables:
VAR,LET, andCONSTdeclarations - Arrays: Classic
DIMand modernVAR arr[10]syntax - Array Operations:
.length,.insert(),.remove(),.sort(),.find(),.reverse(),.swap() - Dictionaries:
{"key": "value"}or{key = "value"}syntax - Types: User-defined types with
TYPE ... ENDTYPEand JSON serialization - Functions: Parameters, return values,
ENDFUNCTION value, tuple returns - Control Flow: IF/THEN/ELSE/ELSEIF, WHILE/WEND, FOR/NEXT, SELECT CASE, GOSUB/GOTO/RETURN
- Operators: Arithmetic, relational, boolean, and bitwise operators
- Dot Notation: Access object properties and methods
- Module System:
IMPORT "file.bas"orINCLUDE "file.bas" - Error Handling: Comprehensive error messages with line numbers
- ECS System: Entity-Component-System for game architecture
- State Machine: Modern BASIC-style state system
- Sprite System: Sprite creation, animation, and management
- Collision Detection: Built-in collision checking
- Camera System: 2D and 3D camera management
- Input Events: Keyboard, mouse, and gamepad handling
- Timer System: Game timing, delta time, scheduled timers
- Animation System: Sprite and object animation
- Coroutines: Suspension and resumption with
YIELDandAWAIT - Tuples: Lightweight grouped values with destructuring
- Enums: Named and unnamed enums with custom values
- Component Defaults: Default values in component declarations
- System Priority: Priority-based system execution
- JSON Support: Serialize/deserialize arrays and types
- Debug Support: Built-in debugging capabilities
Perfect for:
- Learning programming fundamentals
- Rapid game prototyping
- Educational projects
- Retro-style game development
- Anyone who wants to code without complexity
- 2D and 3D game development
- Interactive applications
See the Distribution Guide for complete instructions on distributing your games.
Quick summary:
- Build with static linking:
cmake .. -DBASIC_STATIC_LINK=ON - Package executable,
.basfiles, and assets - Create launcher script
- Test on clean system
- Distribute as zip or installer
CyberBasic is designed for both learning and production use:
- Fast startup: Programs begin execution immediately
- Efficient execution: Optimized interpreter with minimal overhead
- Memory safe: Automatic memory management with no leaks
- Cross-platform: Consistent performance across Windows, Linux, and macOS
We welcome contributions! Whether you're fixing bugs, adding features, or improving documentation:
- Fork the repository
- Create a feature branch
- Make your changes
- Add tests if applicable
- Submit a pull request
See CONTRIBUTING.md for details.
This project is open source. See the LICENSE file for details.
- Documentation: docs/
- Examples: examples/
- Issues: GitHub Issues
- Releases: GitHub Releases
- Getting Started Guide - Installation and first steps
- Quick Reference - Quick syntax reference
- Game Development Guide - Complete game development guide
- 2D Graphics API Guide - 2D rendering, sprites, textures
- 3D Graphics API Guide - 3D rendering, models, cameras, lighting
- Distribution Guide - How to distribute your games
- BASIC Programming Guide - Complete language reference
- Advanced Features Guide - Enums, dot notation, state machines, ECS, coroutines
- ECS System Guide - Entity-Component-System architecture
- Modern State System Guide - State machine system
REM Complete 2D Game Example
INITWINDOW(800, 600, "My 2D Game")
SETTARGETFPS(60)
REM Load assets
VAR playerTexture = LOADTEXTURE("player.png")
REM Game state
VAR playerX = 400
VAR playerY = 300
VAR playerSpeed = 5
WHILE NOT WINDOWSHOULDCLOSE()
REM Input
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(30, 30, 50)
DRAWTEXTURE(playerTexture, playerX, playerY, 255, 255, 255)
DRAWTEXT("FPS: " + STR(GETFPS()), 10, 10, 20, 255, 255, 255)
ENDDRAW()
WEND
UNLOADTEXTURE(playerTexture)
CLOSEWINDOW()REM Complete 3D Game Example
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 model
VAR model = LOADMODEL("character.obj")
VAR rotation = 0
WHILE NOT WINDOWSHOULDCLOSE()
rotation = rotation + 1
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()
DRAWTEXT("FPS: " + STR(GETFPS()), 10, 10, 20, 255, 255, 255)
ENDDRAW()
WEND
UNLOADMODEL(model)
CLOSEWINDOW()- Enhanced error messages with line numbers and suggestions
- Integrated debugger with breakpoints and variable inspection
- IDE integration with syntax highlighting and autocomplete
- Additional BASIC dialects (QBASIC, Visual Basic compatibility)
- Performance optimizations and JIT compilation
- Web-based editor and runtime
For questions, bug reports, or feature requests:
- Issues: Open an issue on GitHub
- Documentation: Check the docs/ folder
- Examples: Browse the examples/ directory
CyberBasic - Where classic programming meets modern game development. Start coding games today, not tomorrow.
Made with love for game developers
Important: Raylib and raygui are included directly in this repository (not as submodules). A simple git clone is all you need - no --recursive flag required.
Universal Method (All Platforms):
git clone https://github.com/CharmingBlaze/cyberbasic.git
cd cyberbasic
# One command builds everything
python build.pyPlatform-Specific Quick Build:
# Windows
build.bat
# Linux/macOS
./build.shThat's it! The scripts automatically:
- Detect your platform and compiler
- Install missing dependencies (where possible)
- Configure the optimal build settings
- Build with maximum CPU cores
- Copy the executable to
bin/cyberbasic(.exe)
The build scripts will check for these automatically:
All Platforms:
- CMake 3.10+ (will prompt to install if missing)
- Python 3.6+ (for binding generation)
Windows:
- MinGW-w64 GCC (recommended) or Clang
- MSVC (experimental support with
--msvcflag)
Linux:
- GCC or Clang
- Build essentials:
sudo apt install build-essential cmake python3
macOS:
- Xcode Command Line Tools:
xcode-select --install - Homebrew (optional):
brew install cmake python
Python Build Script (Most Flexible):
python build.py # Standard release build
python build.py --debug # Debug build with symbols
python build.py --clean # Clean and rebuild
python build.py --msvc # Use MSVC on Windows (experimental)
python build.py --static # Force static linking
python build.py --help # Show all optionsBatch/Shell Scripts:
# Windows
build.bat # Standard build
build.bat --debug # Debug build
build.bat --clean # Clean build
# Linux/macOS
./build.sh # Standard build
./build.sh --debug # Debug build
./build.sh --clean # Clean build
./build.sh --static # Static linkingIf you prefer manual control:
Windows:
git clone https://github.com/CharmingBlaze/cyberbasic.git
cd cyberbasic
mkdir build && cd build
# MinGW (recommended)
cmake -G "MinGW Makefiles" -DCMAKE_BUILD_TYPE=Release ../source
cmake --build .
# MSVC (experimental)
cmake -G "Visual Studio 16 2019" -DALLOW_MSVC=ON ../source
cmake --build . --config ReleaseLinux:
git clone https://github.com/CharmingBlaze/cyberbasic.git
cd cyberbasic
mkdir build && cd build
cmake -DCMAKE_BUILD_TYPE=Release ../source
make -j$(nproc)macOS:
git clone https://github.com/CharmingBlaze/cyberbasic.git
cd cyberbasic
mkdir build && cd build
cmake -DCMAKE_BUILD_TYPE=Release ../source
make -j$(sysctl -n hw.ncpu)After building, you'll find:
- Executable:
bin/cyberbasic(orcyberbasic.exeon Windows) - Build files:
build-{platform}-{type}/directory - Test it:
./bin/cyberbasic examples/hello_text.bas
"No suitable compiler found":
- Windows: Install MinGW-w64 or MSYS2
- Linux:
sudo apt install build-essential(Ubuntu/Debian) - macOS:
xcode-select --install
"CMake not found":
- Windows: Download from cmake.org or use MSYS2:
pacman -S cmake - Linux:
sudo apt install cmake(Ubuntu/Debian) - macOS:
brew install cmake
"Python not found":
- Windows: Download from python.org or use MSYS2:
pacman -S python - Linux:
sudo apt install python3 - macOS:
brew install pythonor use system Python
MSVC Issues:
- MSVC support is experimental. Use MinGW-w64 for best results
- To force MSVC:
python build.py --msvcorcmake -DALLOW_MSVC=ON
Build fails:
- Try the universal script:
python build.py --clean - Check all prerequisites are installed
- Use debug build to see more details:
python build.py --debug - Check the Issues page
Static Linking (Default on Windows):
python build.py --static # Creates standalone executableDebug Build:
python build.py --debug # Includes debug symbols and assertionsCustom CMake Options:
mkdir build-custom && cd build-custom
cmake -DCMAKE_BUILD_TYPE=Release -DBASIC_STATIC_LINK=ON -DALLOW_MSVC=ON ../source
cmake --build .Available CMake Options:
BASIC_STATIC_LINK: Enable static linking (ON/OFF)ALLOW_MSVC: Allow MSVC compiler (ON/OFF)CMAKE_BUILD_TYPE: Release, Debug, RelWithDebInfo, MinSizeRelBUILD_SHARED_LIBS: Build shared libraries (ON/OFF)
Raylib Keymap Numbers (KeyboardKey enum)
Letters Key Value
KEY_A 65 KEY_B 66 KEY_C 67 KEY_D 68 KEY_E 69 KEY_F 70 KEY_G 71 KEY_H 72 KEY_I 73 KEY_J 74 KEY_K 75 KEY_L 76 KEY_M 77 KEY_N 78 KEY_O 79 KEY_P 80 KEY_Q 81 KEY_R 82 KEY_S 83 KEY_T 84 KEY_U 85 KEY_V 86 KEY_W 87 KEY_X 88 KEY_Y 89 KEY_Z 90
Numbers (Top Row) Key Value
KEY_ZERO 48 KEY_ONE 49 KEY_TWO 50 KEY_THREE 51 KEY_FOUR 52 KEY_FIVE 53 KEY_SIX 54 KEY_SEVEN 55 KEY_EIGHT 56 KEY_NINE 57
Common Control Keys Key Value
KEY_SPACE 32 KEY_ESCAPE 256 KEY_ENTER 257 KEY_TAB 258 KEY_BACKSPACE 259 KEY_INSERT 260 KEY_DELETE 261
Arrow Keys Key Value
KEY_RIGHT 262 KEY_LEFT 263 KEY_DOWN 264 KEY_UP 265
odifiers Key Value
KEY_LEFT_SHIFT 340 KEY_LEFT_CONTROL 341 KEY_LEFT_ALT 342 KEY_LEFT_SUPER 343 KEY_RIGHT_SHIFT 344 KEY_RIGHT_CONTROL 345 KEY_RIGHT_ALT 346 KEY_RIGHT_SUPER 347
Function Keys Key Value
KEY_F1 290 KEY_F2 291 KEY_F3 292 KEY_F4 293 KEY_F5 294 KEY_F6 295 KEY_F7 296 KEY_F8 297 KEY_F9 298 KEY_F10 299 KEY_F11 300 KEY_F12 301






