Jump to content

Blitz BASIC

From Wikipedia, the free encyclopedia
This is an old revision of this page, as edited by PJonDevelopment (talk | contribs) at 10:34, 24 September 2010 (Books on Blitz Basic). The present address (URL) is a permanent link to this revision, which may differ significantly from the current revision.

Blitz BASIC is a commercial compiler for the BASIC programming language. Originally developed on the Amiga, Blitz BASIC compilers are now available on several platforms. The Blitz products are mainly designed for programming games but also feature support for graphical user interfaces and general applications. The term Blitz BASIC is often used to refer to the general syntax used in the entire range of Blitz languages, as well as the original product that started them.

History

The first Blitz language that was designed by Mark Sibly was for the Amiga computer and published by the Australian company Memory and Storage Technology.

After returning to New Zealand, Blitz2 was published several years later by Acid Software (a local 90's Amiga game publisher).

BlitzBasic

Otherwise known as Blitz2D, Blitz Basic was released in October 2000 for Microsoft Windows and allowed only 2D graphics. It was published by Idigicon.

Recognition of Blitz Basic increased when a limited range of "free" versions were distributed on popular UK computer magazines such as PC Format. This resulted in a legal dispute between the developer and publisher which was eventually amicably resolved.

Blitz3D

Blitz3D was released in September 2001, competing with other similar PC game-development languages of the time (such as Dark Basic). Blitz3D extended Blitz Basic's command-set with the inclusion of a brand-new 3D engine, providing a BASIC style API for creating, manipulating and rendering three-dimensional objects. Blitz3D is built on top of DirectX 7 and as such was released solely for Microsoft Windows.

Although originally Blitz3D's distribution rights were owned by Idigicon, Blitz Research Ltd. later signed a deal with the firm so as to allow Blitz Research Ltd. to distribute Blitz3D themselves. In return, Idigicon were granted full rights to distribute Blitz Basic and to clear any outstanding stock copies of Blitz 3D.

BlitzPlus

In February 2003, Blitz Research Ltd. released BlitzPlus also for Microsoft Windows. It does not have the 3D engine of Blitz3D, but does bring new features to the 2D side of the language by implementing limited Microsoft Windows control support for creating native GUIs. Backwards compatibility of the 2D engine was also extended, allowing compiled BlitzPlus games and applications to run on systems that might only provide DirectX 1 support.

BlitzMax

BlitzMax
Paradigmobject-oriented, imperative, modular, reflective
Designed byMark Sibly
DeveloperBlitz Research Ltd. [1]
First appeared2004
Stable release
1.41 / August 2010
Typing disciplineStatic, Weak
OSMicrosoft Windows, Mac OS X, Linux
Websitewww.blitzbasic.com
Influenced by
BlitzBasic

BlitzMax is the most recent language released by Blitz Research Ltd. Unlike previous Blitz products, code can be compiled on *nix platforms too. The Mac OS X compiler was released first in December 2004, followed by compilers for Microsoft Windows and Linux in May 2005. BlitzMax brought the largest change of language structure to the modern range of Blitz products by adding object-oriented concepts and adapting the graphics layer to better suit OpenGL. BlitzMax is also the first of the Blitz languages to represent strings internally using UCS2, allowing programmers to write applications that use characters outside the standard ASCII character set.

BlitzMax is also the first modular version of the Blitz languages, improving the extensibility of the commandset. In addition, all of the standard modules shipped with the compiler are open-source and so can be tweaked and recompiled by the programmer if necessary. The official BlitzMax cross-platform GUI module (known as MaxGUI) allows developers to write GUI interfaces for their applications on Linux (FLTK), Mac (Cocoa) and Windows. Various user-contributed modules extend the use of the language by wrapping such libraries as wxWidgets, Cairo, FontConfig as well as a selection of database modules. There are also a selection of third-party 3D modules available for BlitzMax, such as MiniB3D [2] - an open-source OpenGL engine which can be compiled and used on all 3 of BlitzMax's supported platforms.

BlitzMax is capable of producing cross-platform applications, as BlitzMax source code is designed to be platform agnostic. As such code developed on one platform should behave similarly when recompiled on any of the other supported platforms. However the official compiler and build chain will only generate binaries for the platform that it is executing on. Unofficially, users have been able to get Linux and Mac OS X to cross-compile to the Window platform.

In October 2007, BlitzMax 1.26 included the addition of a reflection module [1]. BlitzMax 1.32 ships with new threading and Lua Scripting modules and most of the standard library functions have been updated so that they are unicode friendly [2].

Blitz3D SDK

The latest product from Blitz Research Limited, a 3D graphics engine based on the engine in Blitz3D. It is designed to be used with C++, C#, BlitzMax and PureBasic, however it can be used with other languages.

Max3D module

In 2008 Blitz Research released the source code to Max3D under a BSD license, a cross-platform 3D engine purported to have been in development for quite some time. Max3D was written in C++ and made use of several open source libraries, namely Assimp, Boost and ODE. The engine focused on OpenGL, but had an abstract backend for other graphics drivers (such as DirectX). Interest and support died off over time, and eventually development came to a halt. There is no indication that Blitz Research will pickup the project again.

Sample code

The following code creates a windowed application that shows the current time in binary and decimal format. This code is written in Blitz Basic, but will compile and run in both Blitz3D and BlitzPlus. See below for the same example written in BlitzMax.

 AppTitle "Binary Clock"
 Graphics 150,80,16,3
  ;Copy, modify and redistribute this source as much as you like
 
  
  ;#####################################################
  ;                      MAIN LOOP
  ;#####################################################
   
  ;create a timer that means the main loop will be 
  ;executed twice a second
 secondtimer=CreateTimer(2)
 Repeat
 
 	Hour = Left(CurrentTime$(),2)
 	Minute = Mid(CurrentTime$(),4,2)
 	Second = Right(CurrentTime$(),2)
 	
 	If Hour >= 12 Then PM = 1
 	If Hour > 12 Then Hour = Hour - 12
 	If Hour = 0 Then Hour = 12
 		
 	;should do this otherwise your PM dot would be 
 	;left up once the clock rolled past midnight!
 	Cls 
 	
 	Color(0,255,0) ;make the text green for the PM part
 	If PM  = 1 Then Text 5,5,"PM"
 	;set the text colour back to white for the rest
 	Color(255,255,255)
 	
 	For bit=0 To 5
 		xpos=20*(6-bit)
 		
 		binaryMask=2^bit
 		
 		;do hours
 		If (bit<4)
 			If (hour And binaryMask)
 				Text xpos,5,"1"
 			Else
 				Text xpos,5,"0"
 			EndIf
 		EndIf
 		
 		;do the minutes
 		If (minute And binaryMask)
 			Text xpos,25,"1"
 		Else
 			Text xpos,25,"0"
 		EndIf
 		
 		;do the seconds
 		If (second And binaryMask)
 			Text xpos,45,"1"
 		Else
 			Text xpos,45,"0"
 		EndIf
 	Next
 	
 	;make the text red for the decimal time
 	Color(255,0,0)
 	Text 5,65,"Decimal: " + CurrentTime$()
 	;set the text back to white for the rest
 	Color(255,255,255)
 
 	;will wait half a second
 	WaitTimer(secondTimer)
 Forever

BlitzMax version of the above clock:

 AppTitle = "Binary Clock"
 Graphics 145,85
 
 secondtimer = CreateTimer(2)
 Repeat
 
         Hour = CurrentTime()[..2].ToInt()
         Minute = CurrentTime()[4..6].ToInt()
         Second = CurrentTime()[6..].ToInt()
         
         If Hour >= 12 Then PM = 1
         If Hour > 12 Then Hour = Hour - 12
         If Hour = 0 Then Hour = 12
                 
         'should do this otherwise your PM dot would be 
         'Left up once the clock rolled past midnight!
         Cls 
 
         SetColor(0,255,0) 'make the text green For the PM part
         If PM  = 1 Then DrawText "PM",5,5
         'set the text colour back To white For the rest
         SetColor(255,255,255)
         
         For bit=0 Until 6
                 xpos=20*(6-bit)
                 binaryMask=2^bit
                 'do hours
                 If (bit<4)
                         If (hour & binaryMask)
                                 DrawText "1",xpos,5
                         Else
                                 DrawText "0",xpos,5
                         EndIf
                 EndIf
                
                 'do the minutes
                 If (minute & binaryMask)
                         DrawText "1", xpos,25
                 Else
                         DrawText "0", xpos,25
                 EndIf
                 
                 'do the seconds
                 If (second & binaryMask)
                         DrawText "1",xpos,45
                 Else
                         DrawText "0",xpos,45
                 EndIf
         Next
        
         'make the text red For the decimal time
         SetColor(255,0,0)
         DrawText "Decimal: " + CurrentTime(),5,65
         'set the text back To white For the rest
         SetColor(255,255,255)
 
 	 Flip
 
         'will wait half a second
         WaitTimer(secondTimer)
 	 If KeyHit(KEY_ESCAPE) Then Exit
 Forever

Notable software written using Blitz Basic

References

See also

  • Protean IDE - An IDE for BlitzBASIC/Plus/3D
  • IDEal - An advanced IDE for Blitz+ and Blitz3D.
  • BLIde - A .Net IDE for BlitzMax.
  • MaxIDE Community Edition - An open source branch of the default IDE maintained by some members of the Blitzmax Community.
  • Project Studio - A discontinued .Net IDE for Blitz3d/Basic and BlitzMax.

Books on Blitz Basic

  • Learn to Program 2D Games in Blitz Basic by John "Krylar" Logsdon, (2003)
  • Game Programming for Teens by Maneesh Sethi, (2003), ISBN 1-59200-068-1
  • Games Programming for the Absolute Beginner with Blitzmax by Sloan Kelly, ISBN 0-9553771-0-2
  • 3D Game Programming for Teens by Eric Grebler, (2006) ISBN 1-59200-900-X
  • 3D Game Programming for Teens, 2nd edition by Maneesh Sethi, (2009) ISBN 1598638432