Sphere (program)
Encyclopedia
Sphere is a cross-platform
Cross-platform
In computing, cross-platform, or multi-platform, is an attribute conferred to computer software or computing methods and concepts that are implemented and inter-operate on multiple computer platforms...

, open source
Open source
The term open source describes practices in production and development that promote access to the end product's source materials. Some consider open source a philosophy, others consider it a pragmatic methodology...

 computer program
Computer program
A computer program is a sequence of instructions written to perform a specified task with a computer. A computer requires programs to function, typically executing the program's instructions in a central processor. The program has an executable form that the computer can use directly to execute...

 designed primarily to make role-playing game
Role-playing game
A role-playing game is a game in which players assume the roles of characters in a fictional setting. Players take responsibility for acting out these roles within a narrative, either through literal acting, or through a process of structured decision-making or character development...

s (RPGs) similar to those found on the SNES
Super Nintendo Entertainment System
The Super Nintendo Entertainment System is a 16-bit video game console that was released by Nintendo in North America, Europe, Australasia , and South America between 1990 and 1993. In Japan and Southeast Asia, the system is called the , or SFC for short...

 and Sega Genesis consoles. Sphere was originally coded by Chad Austin. When making a game with Sphere, most things are scripted using the JavaScript
JavaScript
JavaScript is a prototype-based scripting language that is dynamic, weakly typed and has first-class functions. It is a multi-paradigm language, supporting object-oriented, imperative, and functional programming styles....

 (often abbreviated as JS) language (though very early versions used its own Spherescript language) with special functions and objects for maps, spritesets, images and other resources.

Though Sphere was designed to make RPGs, because of the flexibility of a scripting language it can be used to make almost any other type of game, even basic applications such as Drawing programs.

Sphere, unlike other game-makers which can create a single Executable file, keeps all of its files in folders, which involves many file-handling abilities. This is in tune with Sphere's Open Source ideology. It also has access to networking functions, allowing for game-play over the internet or LANs
Local area network
A local area network is a computer network that interconnects computers in a limited area such as a home, school, computer laboratory, or office building...

.

Recent versions of Sphere also support basic 3D graphics functions using the OpenGL
OpenGL
OpenGL is a standard specification defining a cross-language, cross-platform API for writing applications that produce 2D and 3D computer graphics. The interface consists of over 250 different function calls which can be used to draw complex three-dimensional scenes from simple primitives. OpenGL...

 video driver. However, it is more complicated to use than the 2D graphics functions and is still in early stages.

Additionally, a modified version of Sphere was made where one could choose to use Python
Python (programming language)
Python is a general-purpose, high-level programming language whose design philosophy emphasizes code readability. Python claims to "[combine] remarkable power with very clear syntax", and its standard library is large and comprehensive...

 as the scripting language by changing a line of text in the "game.sgm" file. This feature was never completed and was not intended to be an official release, especially due to the conflict two incompatible scripting languages would make in the engine's community.

The Sphere engine

Sphere has a wide range of basic abilities that are embedded in the engine itself and are run via scripts written in Javascript.

Drawing functions

A great deal of drawing abilities are provided within the engine. These range far greater than the simple image, line, or shape drawing available in the majority of game engines. These functions allow game creators to create on-screen effects without tampering with image-editing software. As an added bonus, there is also a special image type called windowstyles which are images that can be stretched but keep their borders and corners intact - a tool used for displaying text boxes in games.

As for text, sphere allows users to import text from their operating system, and can also edit them within the IDE
Integrated development environment
An integrated development environment is a software application that provides comprehensive facilities to computer programmers for software development...

. A number of effects are available, such as applying gradients and expanding its size. The fonts themselves are not limited to the basic 256 characters, but can incorporate many more characters.

If any image files are used, they are saved in a folder within the game itself, which can be referred to from scripts.

Due to using JavaScript, highly complex and systematic functions, such as a Bézier curve
Bézier curve
A Bézier curve is a parametric curve frequently used in computer graphics and related fields. Generalizations of Bézier curves to higher dimensions are called Bézier surfaces, of which the Bézier triangle is a special case....

 are possible.

Programming with Sphere

Sphere uses the JavaScript
JavaScript
JavaScript is a prototype-based scripting language that is dynamic, weakly typed and has first-class functions. It is a multi-paradigm language, supporting object-oriented, imperative, and functional programming styles....

 language, used largely in the web. This means Sphere supports programming native objects, like strings, arrays, and objects, while retaining their native properties (like string.substr or array.length). This Object-oriented programming language allows Sphere to create highly adaptable objects and systems, producing powerful, structured and organized scripts.

The Sphere JS function Abort is similar to Alert, common for debugging JavaScript on the web, although it exits the program when the message is outputted.

Here is Hello World as used in Sphere:

function game {
Abort("Hello World");
}

External links

  • http://www.spheredev.org/wiki/Main_Page - Official Sphere Site
  • http://www.spheredev.org/forums - Dedicated Sphere community
  • http://www.sphere-2d-engine.net/ - A French Sphere community
  • https://developer.mozilla.org/en/docs/Core_JavaScript_1.5_Reference - Mozilla JavaScript Reference
  • https://developer.mozilla.org/en/docs/Core_JavaScript_1.5_Guide - Mozilla JavaScript Guide
  • http://www.spheredev.org/smforums/index.php?topic=592.0 - Forum page with Sphere Python documentation
The source of this article is wikipedia, the free encyclopedia.  The text of this article is licensed under the GFDL.
 
x
OK