Blitz BASIC

From Wikipedia, the free encyclopedia

Blitz BASIC is a 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. 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.

Contents

[edit] History

The first compiler, originally designed by Acid Software from New Zealand, was Blitz BASIC for the Amiga. It competed with Europress Software's AMOS. Both AMOS and Blitz were distinguished from other BASIC implementations by their built-in support for writing computer games.

It was shortly after this time that Acid Software became known as Blitz Research Limited and concentrated solely on the development and promoting of Blitz languages and tools.

[edit] Blitz Basic

Blitz Basic was released in October 2000 for Microsoft Windows which allowed only 2D graphics. It was Blitz Research's first product and was published by Idigicon. It is now discontinued from its developers.

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.

[edit] Blitz3D

Blitz3D was then released later in September 2001 and was also for Microsoft Windows. It was distributed at first by Idigicon. Blitz3D is Blitz Basic with a built in 3D engine and command list allowing the creation of 3D games for the first time in the Blitz range of languages. It kept all of Blitz BASIC's older commands and incorporated an entirely new set for the movement and rendering of three-dimensional objects. It used DirectX7 to create 3D, and competes with other similar PC game-development languages such as Dark Basic.

Blitz Research Limited later signed a deal with Idigicon giving them full rights to distribute Blitz Basic, to clear their stock of copies of Blitz 3D, and to now allow Blitz Research Limited to distribute Blitz3D themselves.

[edit] BlitzPlus

In February 2003 Blitz Research Limited 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 allowing some control over Microsoft Windows forms and widgets, as well as implementing compatibility of the 2D engine as far back as DirectX 1.

[edit] BlitzMax

BlitzMax
Paradigm object oriented, reflective
Appeared in 2004
Designed by Mark Sibly
Developer Blitz Research Limited
Typing discipline static, weak
Influenced by BlitzBasic

The latest in the range of Blitz languages is BlitzMax which, unlike previous Blitz products, is designed to run on multiple operating systems. It was released for Mac OS first, in December 2004, and then 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 switching the graphics layer to favour OpenGL.

BlitzMax is also the first modular version of the language, allowing plugins to be written for the language itself. This opened up new possibilities for programmers to configure the language, as well as to purchase additional components from Blitz Research Limited. For instance, the official BlitzMax cross-platform GUI module (known as MaxGUI) was released by Blitz Research Limited, allowing 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. In addition, there are many third-party 3D modules available for BlitzMax, including MiniB3D[1] - an open-source OpenGL engine which can be compiled and used on all 3 of BlitzMax's supported platforms.

In October 2007, BlitzMax update v1.26 (available to registered users as a download from the official site) included the addition of a Reflection module, which further increased the flexibility of the language.

[edit] Blitz3D SDK

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

Unfortunately there are several outstanding issues with the SDK which are currently being resolved - but which preclude release of any applications (Blitz3D SDK Bug Reports)

[edit] Sample code

The following code creates a windowed application under Windows that shows the current time in binary and decimal format. This code is written in Blitz Basic, but will compile and run in both Blitz 3d and Blitz Plus. See below for the same example 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 = Left(CurrentTime$(),2).ToInt()
         Minute = Mid(CurrentTime$(),4,2).ToInt()
         Second = Right(CurrentTime$(),2).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 To 5
                 xpos=20*(6-bit)
                 binaryMask=2^bit
                 'do hours
                 If (bit<4)
                         If (hour And binaryMask)
                                 DrawText "1",xpos,5
                         Else
                                 DrawText "0",xpos,5
                         EndIf
                 EndIf
 
                 'do the minutes
                 If (minute And binaryMask)
                         DrawText "1", xpos,25
                 Else
                         DrawText "0", xpos,25
                 EndIf
 
                 'do the seconds
                 If (second And 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) Exit
 Forever

[edit] Notable software written using Blitz Basic

  • Fairway Solitaire - Blitz Max
  • Grid Wars - Blitz Max
  • Platypus - Blitz 2D (Mac port, Blitz Max)
  • Worms - originally titled Total Wormage and developed in Blitz Basic on the Amiga before its commercial release [1]

[edit] References

  1. ^ IGN. Worms Blast Preview

[edit] See also

[edit] External links

[edit] Books on Blitz Basic