Orb
From OrbEdit Wiki
Contents |
Orb
Like all game engines, Orb is made up of several different systems that work together in order to:
- Draw graphics
- Print text
- Play sounds
- Get user input
Glue all these tasks together in the right way and you have a video game! The "glue" in this case is Orb's scripting system, which orchestrates these systems to create the symphony of your game. Much of the functionality of these systems comes from a set of excellent 3rd-party libraries. Orb uses only the finest ingredients!
These systems are briefly discussed here and then in greater detail elsewhere in the wiki.
Orb Lifecycle
Every Orb game goes through the following steps when it runs:
- Initialization: Initialize all the different subsystems of Orb. This includes the scripting system, renderer, OpenGL, sound engine, XML processor, and physics engine.
- Startup: Execute your game's startup script, which will load your game's first Level, likely a title screen or splash screen.
- Game Loop: This is where all the work of your game takes place. This loop continues until the user chooses to quit by closing the game window. Each time though this loop is called a "frame"; when you hear the term "FPS", or "frames per second", that is simply a measure of how many times this loop loops in 1 second.
- Input: Check for user input and dispatch any keystrokes or mouse clicks detected.
- Resume: Check all paused coroutines for any that need to be resumed. If their time is up, resume them right where they left off.
- Update: Update all Elements, which will advance their positions, fire events, check for collisions, etc.
- Draw: Render all visible Elements to the screen.
- 4. Shutdown: Stop all scripts and release all resources that were allocated during the above steps. This is the final step before your game exits.
Graphics
|
| Orb uses OpenGL for its graphics. As the name implies, OpenGL is open source and cross-platform, which allows Orb games to run on a variety of operating systems. Since Orb is a 2D game engine, it does all its drawing in orthographic projection mode, meaning that everything is drawn "flat" or "2D".
A single graphic within Orb is known as a Sprite. In graphical terms, a Sprite is nothing more than a single textured quad, or in layman's terms, a single rectangular image. Orb has a simple system for animating Sprites, flipbook style, displaying one image after the next in a sequence, giving the effect of animation. Sprites are used for all drawing within Orb, from large backgrounds, to small doodads, to tiny particles. Sprites are very lightweight, meaning thousands of them can be drawn on the screen at once. |
GLSL
Orb supports pixel shaders in the form of GLSL. Shaders allow to directly program your GPU for all sorts of cool visuals, from realistic particle effects, to great texturing tricks, down to simple Sprite animation. Shaders are a big topic that can take a long time to get your mind around, Orb comes with a few examples to get you started.
Scripting
|
| Orb is primarily driven by Lua, a lightweight and fast scripting language.
Almost every aspect of Orb is scriptable. OrbEdit uses scripts to communicate to Orb, making its behavior easy to change. Orb can compile your game's scripts if you don't want your users to be able to modify them, but makes no effort to hide its own core scripts; they are open and free for anyone to modify. OrbEdit comes with its own script editor, with all sorts of handy features like code coloring, autocomplete, and calltips. If you already have a favorite code editor, OrbEdit will happily pass scripts to it for editing instead. |
Text
|
| In addition to their other rendering capabilities, Orb Sprites can also render text. Orb uses a version of the FreeType font library for displaying TrueType fonts. Text can be configured to scale and rotate with the Sprite it's attached to and can be colored independently through control strings within the text. All text is rendered with a small shadow dropped behind it, improving readability on similarly-colored backgrounds. Currently all text is stored in ASCII but Unicode support is planned for the future.
Orb has its own markup language for processing and controlling the display of large blocks of text, which allows you to externalize your game's text into separate files for translation into other languages. Included is a set of functions to allow you to print text one character at a time, typewriter style. |
Sound
|
| Orb supports a wide variety of sound and music formats, via the FMOD sound library. Large sound files can be streamed, allowing them to start playing immediately, or smaller sound files can be cached for fast playback. Orb has a system of DSPs (AKA sound effects) that it can use to alter the sound of any playing sound, such as making it echo or distorting it.
Orb gives you full access to the ID3 tags in your .mp3 files, allowing you to retrieve and display information like track name, title, artist, etc. You can also retrieve information like track length and bitrate, making it easy to synchronize animation and sound in your scripts. |
Physics
|
| Orb uses Box2D Physics for its physics engine. Box2D is fast, lightweight, and can handle a whole lot of objects at once. While not all 2D games require physics (many can be done with Sprites alone), a robust physics engine can make a world of difference for certain genres. There is no strict requirement for you to take advantage of Orb's physics engine for your game, though you will likely want to once you see what can be done with it.
Orb's Sprites are tied tightly to its physics; Sprites can be attached to the majority of physical objects. As a physical object bounces around the World, so too do its Sprites. OrbEdit can be used for a quick and easy 2D physics simulator, there is no need for any game logic in order for a physics simulation to work. |
Input
|
| At a low level, Orb uses the SDL library to gather input from the keyboard and mouse. Through SDL, Orb supports all shapes and sizes of gamepads; some games are best played with a controller! Each input action calls immediately to the scripting system, giving very direct access to the API.
Orb provides a fully scripted, state-based input handling system to control everything from your character to the menus in your game. No mouse support is available at the moment but will be coming soon! |
