Monkey2v1.1.08 now available!

Hello all,

Monkey2v1.1.08 is out now at!

First up, there are a number of cool language additions:

  • ​The safe member access operator, ‘?.’ can be used to safely reference object members in cases where the object may be null. Works the same as plain member access ‘.’ if the object is non-null, otherwise returns a null value of the appropriate type.
  • The elvis operator ‘?Else’. Use this to return an alternate value if an expression is null. For example, ‘r=x ?Else -1’ will assign the value of ‘x’ to ‘r’ if ‘x’ is non-null otherwise, it will assign the value -1 to ‘r’.
  • Where conditions for classes. Class declaration can now include a ‘where condition’ at the end of the regular class declaration. If the where condition evaluates to false when the class is instantiated, a compile time error occurs.
  • Implicit bool->string conversions added, eg: you can now go ‘Print myboolvar’ and it will print “True” or “False”. Note this doesn’t work the same way in reverse, ie: converting “False” to bool will actually produce a true result, as any non-null string is considered to be ‘true’. I’ve added a std.stringio.ParseBool function to handle converting bools to strings in this way.
  • Implicit struct->bool conversions added, eg: You can now go ‘If MyStruct’ instead of ‘If MyStruct<>Null’.

The makedocs system built into mx2cc has been rewritten from scratch because the old one had become such an unholy mess I couldn’t really do anything with it any more! Module ‘manual’ docs should now be placed in a ‘newdocs’ dir inside the module dir, and all docs are now built into the same location, ie: the docs/modules dir, which IMO is a whole lot more useful than the old system which used to build docs into the individual module dirs. You also no longer have to makedocs before uploading a module via the module manager page.

A simple ‘component system’ has been added to mojo3d, although not much has been done with it yet – I have converted the Animator, Collider and RigidBody types to components, but more as a proof of concept than anything else (that said, I’m quite happy with it and can’t see it changing much). I plan to spend considerable time over the next month getting this stuff into shape – The non-rendering side of mojo3d has all been a bit ‘half done’ for too long now! I am relatively happy with the current state of the renderer (it generates some weird warnings in the android emulators which needs fixing, but it does at least work on all emulators I throw it at), but there is of course more to 3d engines than just rendering – esp. these days! That said, I *have* been experimenting with a more modern terrain system for mojo3d in my spare time and think I’ll eventually be able to do something pretty cool terrain-wise.

There’s a new PlayMusic method in AudioDevice for streaming audio from file – see new musictest banana. This should work on all targets except for emscripten, which doesn’t support threads so will need to use a different mechanism, probably involving some calls into native javascript. Audio must currently be in ogg format, although mp3 support is now a possibility due to several mp3 patents having apparently expired. PlayMusic returns a ‘channel’ object which can be used to control music volume, pause music etc. With the addition of music streaming, I do feel like monkey2 is finally ‘fully equipped’ for writing 2d games with, although of course there will be many refinements and bugfixes to come!

Apart from more work on mojo3d, my next goal is to try and put together a more ‘finished product’ by the end of the year. This will involve more work on both the docs and examples, esp. for the monkey, std, mojo, mojox and mojo3d modules, which really form the ‘core’ of monkey2.

Finally, apologies for the late ‘monthly’ release….no excuses really, just been a weird couple of months in various ways (IRL too).



12 thoughts to “Monkey2v1.1.08 now available!”

  1. Unsure as yet what some of these things mean, but happy to use opportunity to buy. Greatly enjoying using mx2.


  2. Safe member operator- I remember you mentioning this and it sounded cool glad it made its way in.  Struct->Bool conversion is great too.


  3. Some great changes and improvements, thank you Mark! Monkey2 is already awesome, and getting better with every release! Hopefully your IRL weirdness has subsided. All the best.