BlitzBasic is dead - BlitzBasicScript is born

Published July 22, 2020
Advertisement

First Quarter of 2004
During a project week at my old school, some friends and I wanted to develop a computer game without having the least programming experience at all. By internet research we discovered Blitz3D and began to produce the first simple graphic demos. Thus the cornerstone was laid for my interest in game programming.

February 27, 2008
My parents donated me a Blitz3D license for my birthday, which cost about 100€ at this time. Since then I could participate on Blitz Code Compositions in the German BlitzForum.

Thursday, June 08, 2017
Mark Sibly, the developer of all four Blitz programming languages decided to close his website, thus ceasing any support. Meanwhile, all Blitz languages are available as open source, and it has been widely discussed whether it would be worthwile to still write games in Blitz3D or BlitzMax.

Beginning of March 2018
I initially thought about the possibility of daring a new implementation of Blitz3D with help of modern web technologies. Having a professional education and job as a web developer, I considered the following aspects:

  • modern browsers allow for demanding 3D calculations thanks to Canvas and WebGL, using the client GPU (or CPU, respectively)
  • implementations are platform independent: games can (theoretically) be played on any device that has a web browser
  • the imperative syntax of BlitzBasic can easily be mimicked with JavaScript
  • modern features such as shadow rendering or physics, which already exist in modern WebGL frameworks, could be integrated into BlitzBasicScript using the standard syntax (e. g. “CreateShadowMap”)

However I was also aware that some problems would occur when you transmit the classical Blitz3D command set into the browser:

  • data streams: for browsers are sandboxes, you cannot simply read (and especially not write) from / to local file systems
  • special commands like “CallDLL” or “Exec” would not be recreatable because they execute native C++ code
  • Blitz3D works completely synchronously, whereas JavaScript functions work asynchronously to load resources

After many tries and a first implementation in pure JavaScript, I decided around September 2018 to restart the whole thing in a more clean and efficient manner, using Angular and TypeScript. The current tech stack looks like that:

  • framework for 3D rendering: BabylonJS
  • framework for the web app: Angular 10 with TypeScript (having started with Angular 7 and continuously upgraded)
  • framework for gui rendering: native HTML

And this is how a piece of BlitzBasic codes becomes a runnable BlitzBasicScript program:

  • the code is tokenized by the lexer
  • the tokens are being analysed by the parser and converted into an abstract syntax
  • the interpreter uses the intermediate syntax representation to execute command and function calls at runtime (like assignments, evaluations etc.)
  • the generated target code gets executed line by line and thanks to Promise objects waits until previous operations have finished, even if they work asynchronously

December 30, 2018
After nine months of development time I would like to send a first sign of live of this project, event though there is not much to see yet and the website just contains some developer tools. However, some nice features and progresses can be reported:

  • 2D and 3D graphics can be combined, using two overlaying canvas elements
  • with help of Promise objects, asynchronous processes can be executed in a synchronous manner, allowing to preserve the original Blitz3D workflow and not having undefined states due to concurrency
  • the lexer is finally implemented
  • the parser (and its language grammer) is formally defined at about 50% and a basic implementation exists
  • the interpreter can already execute simple static statements and command calls
  • nearly all BlitzBasic functions have been structured and ~120 of them been implemented already
  • the whole project is availabe on GitHub under MIT license

Outlook
Further information and images will regularly follow from now on. I hope that some of you guys will have a little interest in BlitzBasicScript, for it offers the big chance of re-using dozens of game codes out there in the world that have once been written in Blitz3D or BlitzPlus. Let's revive these codes in a new, modern environment!

0 likes 0 comments

Comments

Nobody has left a comment. You can be the first!
You must log in to join the conversation.
Don't have a GameDev.net account? Sign up!
Advertisement
Advertisement