Sunday, October 23, 2011

Surprise!

Surprise!

Well, it's been quite a while since Monkey was officially released, and I finally feel like things are settling down a bit!

So, a few thoughts about Monkey...

As with any product release, there were a number of unforseen issues to be dealt with, but perhaps the scariest was the 'crappy graphics performance on Android' problems the arose immedately after release.

I made several goofs here, but the major one was probably underestimating how grunty typical Android hardware actually is. I initally went with the 'Canvas' API under the impression it would work anywhere, and benefit from OpenGL acceleration where possible. Well, it turned out I was right about the former, but way off about the later - the Canvas API is SLOW and does not appear to be in any way accelerated.

The situation improved by moving to OpenGL1.0, but Monkey games still weren't cutting it compared with other games out there. It wasn't until I moved to GL1.1 + VBOs ('vertex buffer objects') + weird-driver-behavior-workarounds that we really started getting acceptable speed.

This really took longer than it should I have. I should have tried to work out what sort of hardware/OpenGL drivers were actually in common use, and gone from there. Instead, I kind of got stuck trying to work out what a bunch existing (but dated) sample code was doing - perhaps a case of 'too much' information in way? Still, I learned a lot in the process I guess.

Another thing that bit me on release was the 'generics' system used by Monkey. I initially modelled Monkey generics on the system used by Java. However, for various reasons (the main one being my own inexperience at implementing generics in a compiler) this turned out to be a BAD choice, and I've only just managed to get generics into what I'd call a really usable state. And it turns out the way I've ended up doing generics is MUCH simpler and the potential for improving it much greater now.

I actually feel that in an odd way that Monkey is the first compiler I've written that I really have a good handle on. Previous compilers have sort of reached both the 'finished' and 'unmanageable' started at about roughly the same time - more or less by design! But with generics now cleaned up, I feel very comfortable with the Monkey code. It's not perfect by any means, but I still have a rough idea of how everything works, where the weak bits are etc.

And what next for Monkey? My current list of 'big picture' improvements under consideration includes:

* Better control over app data - in particular, what data is used on what targets, and how. Currently, any data considered usable by a target is added to the target project based purely on file extension. But this can mean some data ends up getting duplicated in some situaitons, esp. when you are required to provide the same data in multiple formats to handle target limitations. The current plan here is for some kind of config/control file in the data dir.

* Reflection - ie: the ability for your app to be able to dynamically call itself. And I don't think this will actually be all that hard. One thing that has struck me since release is just how flexible a translator is - you can actually do much more with a translator than I realized. To provide reflection data for an app should just involve generating suitable reflection classes/code - in Monkey - for each app decl, and then handing the whole lot over to the translator. The native target translators shouldn't have to do any thing.

* Interpreter - which would be much more useful/intersting if built on top of reflection. For example, if you want interpeted code to be able to call DrawImage, it'd be preferable for the interepter to just be able to use reflection. You'd hopefully then be able to get rid of the need for users to write any 'glue' code. Interpretable Monkey would also be (more) easily debuggable, but I'm not sure how useful that'd be in practice, as interpreted Monkey wont be able to do everything native Monkey can, and is likely to be slowish. Still, you'd be able to stop/start interpreted code even on callback based targets, so perhaps it'd be OK. If not...

* Stop/Start style debugger for the GLFW target. As Monkey users are well aware, debugging can currently be a bit, erm, challenging. Basically, if your app tries to access a null object or index an array beyond bounds, the app stops and you get a stack trace - and that's it. Unfortunately, a proper stop/start debugger for all targets would be impossible, as many targets cannot be stopped as they're callback driven. Therefore, I think the most practical solution to the debugger problem would be to concentrate on making a decent debugger for the one target that can really support it - GLFW. This isn't ideal, and I'm still considering options for debugging, but given the nature of Monkey, it's kind of a tricky one!

I've got lots of smaller tweaks I'd like to make too, but these are the 'biggies' I'm currently considering.

And on the non-Monkey front...

I've just finished an excellent book called 'Ready Player One' - not by any means a literally masterpiece, but an incredibly fun cyberpunky adventure story that will appeal heaps to anyone who was involved in computers/gaming in the 80's, ie: me! Very highly recommended!

I totally loved the recent True Grit movie too, somewhat to my surprise as I'm not generally a big fan of the Cohen brothers stuff. I usually find their movies highly entertaning, cleverly plotted etc, but ultimately pretty bleak. I mean, yes, there are pyschos out there with bad haircuts, doing nasty things to people with electric cattle prods...so?!? Probably related to me aversion to 'torture porn'. But I found True Grit to be very different. It's much more of a straightforward adventure story, with hugely likeable, if flawed, characters. Even the bad guys were kind of cuddly in their own way! I also checked out the book and 1969 version, and both are highly recommended too.

And if you're into Anime, I highly recommend Katanagatari. It's got a highly unique visual style, almost reminiscent of the game 'Okami', lots of clever, frequently funny dialog and plenty of cool fighting sequences involving Ninjas and the odd sexy nun! It's also nice and unpredictable, always a plus for me.

Finally, a big shoutout to anyone 'occupying' anywhere right now! Not sure what will ultimately be achieved, but I do thinks it's managed to raise the odd eyebrow in the upper/political classes, and does represent a faint hope that democracy wont lose out to complacency in the end. I'm not anti-capitalist or anti-free market and I'm definitely not anti-iPhone (apparently, protesters are allowed to use capitalist-derived technology), but I do think there's a very good case to be made that a very small bunch of wealthy, privilaged people are running off with all the loot (regardless of the havoc they wreak in the process of obtaining it) while things just get harder for everyone else - often as result of the reckless behavior of said looters! And govts, left or right, seem oddly uninterested in doing anything about it.

Tuesday, June 21, 2011

Websites majorly down!

Hi,

As you may have noticed, both the www.blitzbasic.com and www.monkeycoder.co.nz sites have been down for over a day now.

Apologies for this, but it looks like there's been a pretty serious server crash. Our webhosts are currently working on getting the site back up, but we don't know how long that will take.

So please bear with us, normal transmisson will resume as soon as possible.

Bye!
Mark

Sunday, December 19, 2010

Christmas update!

Hi all!

Well, I finally got around to dusting off the old Christmas lights for the web site so it must be time for a blog update too!

I was hoping to have SOMETHING out re: monkey by Christmas, but it became apparent a few weeks ago that that just wasn't gonna happen so the new target is now for a mid January release.

The software is IMO mostly finished, if a bit rough around the edges (still fixing little things on a daily basis) although the docs currently suck. I plan on spending my Christmas 'break' mostly on docs, hopefully with a hangover much of the time - just kidding!

The whole 'production' side of things is something I think BRL products are missing a a bit these days compared with the old Guildhall/Idigicon days. Despite our, erm, 'creative' differences, Guildhall/Idigicon did I think take a lot of the weight off my shoulders when it came to the docs and general production side of things, and I do kind of miss that.

I don't really enjoy being responsible for EVERYTHING - and there are aspects of what I do that I know I could be doing a lot better (or at least someone else could be doing a lot better!) - but I have somehow managed to end up existing in this weird kind of 'bubble' down here in Auckland, New Zealand!

So at some point next year I intend to make an honest attempt at getting someone with some kind of business sense involved in the BRL experiment, quite possibly with the initial aim of producing a 'physical' version of monkey.

And there's that 'monkey' reference again - what can it mean?!?

Well, after surprisingly little thought and consultation (although I DID check with the 'Mono' guy...) I have settled on a name for the next programming language from BRL: 'monkey'.

In addition, the lightwight 2d app module that I am working on will be called 'mojo'.

Note that the two are separate: monkey will be 'just' a programming language, with the only IO related function probably being 'Print', while mojo will be an optional extension module.

The plan at this point is to make monkey free and open (in all respects), while charging for mojo (possibly with a free html5 version, or maybe a dual license GPL release - haven't decided on the 'demo' yet).

So stay tuned - interesting days ahead!

Peace out,
Mark

Saturday, October 9, 2010

Update

Hi,

Ok, a few people helping out with bmx2 development have expressed concern that the BRL community are expecting something far more 'BlitzMax like' with respect to bmx2.

So, in a probably futile attempt to reduce confusion levels somewhat...

* Bmx2 is NOT, erm, BlitzMax 2! bmx2 is just the code name for the next BRL programming language.

* Bmx2 is, however, fairly similar to BlitzMax in terms of language syntax.

* Bmx2 is MUCH smaller than BlitzMax, with far fewer modules. There are only currently about 10 'core' modules - most of these just deal with simple algorithmic stuff like lists, maps, math, random etc. There are no PngLoader modules or anything like that, no stream system or audio/graphics driver subsystem. Stuff will be added over time, but I want to be careful this time around not to let it all become a big nasty 'mega system' the way BlitzMax did - I want the core to remain VERY lightweight.

* Bmx2 will also include a very simple 2D gamedev module. And by 'simple' I mean SIMPLE! This is so that it can work on a wide range of target devices. This module will initially only include functionality that is available on ALL target platforms. The 2D module is not 'part' of bmx2 in quite the same way the brl.max2d module was 'part' of BlitzMax - it's very much separate and optional (although currently there's not a lot you can do without it!).

* Bmx2 will also include a very simple IDE written in the 2D module, but I expect seasoned developers are likely to turn to something like notepad++ (what I'm currently using) or Ziggy's next super duper IDE. The included IDE will really only be designed to get people up and running - I'm not planning to get into the IDE 'biz at all, but in the spirit of keeping the product fully 'self contained' (as all BRL products have been) some sort of IDE is a must.

Finally, here's a little YouTube vid of bmx2 in action - nothing too fancy, mainly just proof of concept stuff including giving the new touch commands a workout, although I do like the look of delidash!



And don't forget, all this code runs just the same on HTML5, Flash, XNA and Android...

Thanks to jonpittock for that!

(And no, that's not 'real' 3D at the end there - just a nifty little raycaster).

Bye!
Mark

Monday, August 30, 2010

Self compiling!

Yipee!

I am pleased to say that bmx2 (STILL haven't decided on a new name yet) is now fully self-compiling!

In theory, this just involved converting the existing bmx source files to bmx2 via a little 'convbmx' util, but in practice it has been a tricky and at times somewhat mind bending exercise.

In particular, with 2 sets of sources I had to stop and think several times which one I actually needed to modify - and occasionally even found myself modifying the wrong one!

But it all seems to be working remarkably well now, and although I've only managed to compile the compiler itself as a C++ target (because that's the only target with sufficient filesystem support right now), the 'new' compiler has compiled all my other little tests successfully to html5, flash, xna and android.

Some more details about how it all works...

Bmx2 will required that the appropriate SDK's for the various targets be installed separately. For example, to compile to c++ you'll need MinGW installed. Current list of supported targets/SDK's is:

* HTML5 - HTML5 compatible browser required for testing.
* Flash - Open source Flex SDK required.
* XNA - Visual C# Express + XNA framework
* Android - The Android SDK (plus Java SDK and 'Ant' on Windows).
* Native (ie: C++) - Mingw/GCC (will probably add visualc support too in future).
* iPhone - XCode.

This has the obvious benefit of making life a whole bunch easier for myself, but it also means you'll be able to take full advantage of the various SDK tools available. For example, iPhone projects will be 'real' xcode projects, so you'll be able to edit them in xcode, mess with the NIB file etc. When you compile your bmx2 program, the translator simply replaces a chunk of text in a 'main' file somewhere in the target project, and leaves the rest of the project alone.

Installation of SDK's can be a little messy in some cases, but the compiler already automagically deals with any PATH or ENV var issues which makes life a whole lot easier.

Some more details on the new language:

* 'Type' renamed to 'Class'.

* Identifiers now case sensitive.

* Private can at last be used inside classes!

* A single 'End' can be used to terminate blocks, eg:

Function MyFunc()
Print "Boo!"
End

Ye olde bmx1 style terminators are still permitted too.


* Function/method overloading added, eg:

Function DrawImage( image:Image,x,y )
...
End

Function DrawImage( image:Image,x,y,frame )
...
End


* 'Proper' constructors, eg:

Method New( x,y )
Self.x=x
Self.y=y
End


* Support for 'properties', eg:

Method X() Property
Return x
End

Method X( x ) property
Self.x=x
End


* Simple class template support, eg:

Local list:=New List<Actor>


* Simple 'boxing', eg:

Local list:=New List<IntObject>
list.AddLast 10
list.AddLast 20
Local n=list.Last()


* Auto type inference for initializers, eg:

Local t:=New Actor 'instead of Local t:Actor=New Actor


* Strict mode is back, but will effectively mean bmx1-style SuperStrict (or possibly even stricter). Default mode will be plain bmx1-style Strict (and probably even lazier).

I agonized for a while over whether bmx2 should go 'SuperStrict only', but after realizing that some of the superstrict crowd wanted things even stricter(!) while I wanted things more relaxed, I decided to keep Strict in there in the hope the final product will appeal to a wider range of people.

I have a related theory on this: SuperStrict users prefer C# over C++; Strict users vice versa...


* Module 'Imports' can now be cyclic, eg:

'Module A
Import B

'Module B
Import A

I can't BELIEVE I thought this wasn't a big deal in bmx1!

It was kind of mission to get going too - I basically had to change the compilation process from a top down, 2 pass algorithm to a 'compile on demand' one.

It worked out really well though - the entire program is compiled simply by compiling 'Main'...which causes anything main depends on to compile, and so on.

As a nice side effect, you end up with a very clear picture of what code the program actually uses, meaning apps should be nice and tight.


It's not all good news though (assuming you already though it was) - here are a few nasty 'detail' things that may or may not be fixed/improved over time, but for now would be very hard to do efficiently in ALL target languages. I consider them pretty minor, but you're free to disagree with me on that...

* Strings and Arrays are NOT objects in bmx2 the way they are in bmx1 - they are more like primitives such as int and float, eg:

Local t:Object="Hello world" 'OK in bmx1, Error in bmx2.


* Multidimensional arrays are out, although you can still have arrays of arrays, eg:

Local t[10,20] 'OK in bmx1, Error in bmx2
Local t[][10] 'OK in bmx1 and bmx2.


* Arrays can not be 'downcast' in bmx2, eg:

Local t:Object[]=New Thing[10]
Local p:Thing[]=Thing[]( t ) 'OK in bmx1, Error in bmx2.

This will mean that arrays may have to be manually 'wrapped' in some situations.


And that's it for now. Hope you found it informative!

Bye,
Mark

Monday, July 19, 2010

Update

Hi,

***** BMX2 news *****

Well, I still haven't settled on a name for this yet, but anyway, here's a quick update on where the project is going...

The source language will be very bmx-like, with a few tweaks and additions including:

* Simple class templates
* Function overloading
* Constructors
* Properties

...and some stuff removed, such as pointers. Yes, POINTERS! Function pointers too!


Target languages I'm aiming for upon release are:

* JavaScript
* ActionScript
* Java
* C#
* C++
* Python (just as an experiment - probably wont be much lib support for this to begin with).


Target platforms I'm aiming for:

* HTML5
* Flash
* XNA
* Android
* Native GL
* iPhone


The system will also include an interpreter for debugging/preprocessing. Ideally, you should also be able to use the interpreter for scripting, but that may end up being in a future release depending upon difficulty level.

I'm keeping the modules *very* simple for the initial release, but they should still be grunty enough to do some decent games with depending on your target platform.

The 'official' IDE will be a custom job written in the language itself. However, it should be usable enough (well, I'm using it) and it will at least run *everywhere*. Of course, there are likely to be 3rd party IDE offerings too, so hopefully everyone will be happy in the end.

More to come...

Thursday, May 27, 2010

The plan!

Hi,

Ok, here's the plan:

I am currently working on a 'light' version of BlitzMax designed to run on a wide range of target platforms. For now, let's call it 'bmx2'.

Bmx2 will be similar to bmx language wise, but will have a much smaller and simpler set of modules that will be targeted at simple 2D game creation.

But the major feature of bmx2 is that it will be a 'translator', designed to convert code from bmx2 syntax to as many target languages as possible - preferably in as human readable a form as possible.

I have already made considerable progress generating output for the following target languages: C++, C#, Java, JavaScript and ActionScript. I also plan to add python add some stage, and...?

In addition, I have a simple Blitz2D/Max2D-like module underway and some very simple 'system' modules for the following platforms: Win32, MacOS, Linux, HTML5, Flash, XNA, Android. There's an iPhone version too, but it's status is very much 'up-in-the-air' right now due to licensing issues.

Anyway, development has now reached the point where I am interested in getting more people involved.

Right now I'm interested in people who are keen on language design and/or have some experience with several languages. If that sounds like you and you'd like to get involved please contact blitzmunter at gmail dot com.

Flash demo (well, not *that* flash - very simple actually! You may need to click window to activate too):



Same demo running on HTML5, Android and XNA:



LOTS more info soon.

Peace out!
Mark