A comprehensive game engine for the Bruce device with 2D gameplay, level editing, and 3D rendering capabilities.
- 2D Game Engine: Entity management, collision detection, game loop
- Level Editor: Visual level editor with tile placement
- Player System: Controllable player character
- Object Types: Walls, coins, enemies, exits
- 3D Mode: Full 3D rendering with cubes, pyramids, wireframe and filled modes
- Save/Load: Store levels to device storage
BruceEngine.js- Complete merged game engine (single file containing all features)
var Bruce = require("BruceEngine");
Bruce.init();
Bruce.run();- Play Game - Start playing the current level
- Level Editor - Create and edit game levels
- Load Level - Load a saved level
- 3D Mode - Launch 3D demo showcase
- About - Show engine information
- Exit - Exit the application
var Bruce = require("BruceEngine");
Bruce.init();var level = {
name: "My Level",
width: 16,
height: 8,
tileSize: 16,
tiles: [[1,1,1...], [1,0,0...], ...]
};
Bruce.loadLevel(level);- Player (green) - Controllable character
- Wall (gray) - Solid obstacle
- Coin (yellow) - Collectible item
- Enemy (red) - Moving obstacle
- Exit (cyan) - Level completion point
- Arrow Keys: Move cursor
- OK/Enter: Place selected tile
- BACK: Cycle through tile types
- MENU: Open editor menu
- Save Level: Save current level to storage
- Load Level: Load a level from storage
- New Level: Create a new blank level
- Toggle Grid: Show/hide tile grid
- Play Level: Test the current level
- Exit Editor: Return to main menu
Bruce.start3DMode();var cube = createCube(x, y, z, size, color);
cube.rotationSpeed = 1;
cube.rotationAxis = "y";
entities3D.push(cube);var pyramid = createPyramid(x, y, z, size, color);
pyramid.rotationSpeed = 0.8;
entities3D.push(pyramid);var grid = createGrid(size, spacing, color);
entities3D.push(grid);- wireframe: Line-only rendering
- filled: Shaded polygon rendering
VR Split Screen renders the 3D scene twice with offset cameras for stereoscopic vision:
// VR mode renders left and right eye views side by side
// Left eye: offset camera -15 units
// Right eye: offset camera +15 units- Arrow Left/Right: Rotate camera yaw
- Arrow Up/Down: Rotate camera pitch
- Back/Menu: Exit 3D mode
- Bruce device with firmware supporting JavaScript interpreter
- ES5 syntax only (var, function, no arrow functions)
- Display module for graphics
- Keyboard module for input
- Storage module for saving levels
- Dialog module for UI