Monkey X

From Wikipedia, the free encyclopedia
  (Redirected from Monkey (programming language))
Jump to: navigation, search
Monkey X
Monkey's Logo
Paradigm(s) multi-paradigm: structured, imperative, object-oriented, modular, reflective, generic, concurrent
Designed by Mark Sibly
Developer Blitz Research Ltd.[1]
Appeared in March 1, 2011; 3 years ago (2011-03-01)
Stable release 0.79(e)[2] / June 17, 2014; 18 days ago (2014-06-17)
Typing discipline Static, Weak, Strong (Optional), Safe, Nominative, Partially Inferred
Influenced by BlitzBasic, BlitzMax, C, C++, C#, JavaScript, Java
Platform Crossplatform (See the targets section for a full list of supported platforms)
OS Microsoft Windows, Mac OS X, Linux
Website www.monkey-x.com

Monkey X is a high-level programming language designed for developing video games for many different platforms, including desktop/laptop computers, mobile phones, tablets, and video game consoles. The language itself is an object-oriented dialect of BASIC, which the compiler translates into native source code for several target platforms. The resulting code is then compiled normally. Currently the official target platforms include: Windows (Including the windows 8 store), Mac OS X, Linux, Xbox 360, Android, iOS, and many more.

Community-driven/user-made targets have also been created, some notable user-targets include: MonkeyMax (BlitzMax),[3] Monkey-Python (Python),[4] and a Nintendo DS target.[5]

History[edit]

Monkey was released on March 1, 2011[6] by Mark Sibly of Blitz Research Ltd.[7]

In December of 2013, Monkey was re-branded as Monkey X.

The free version of Monkey X released at this time included unrestricted use of the HTML5 and Desktop targets.[8]

Mojo[edit]

Mojo is the official proprietary graphics 'module' for Monkey X. Mojo has been written for all of Monkey X's official game-based targets, this is done using the native programming languages of each target. Mojo is then wrapped using Monkey X's "external-language" system. Mojo was designed primarily for writing simple 2D games in Monkey X, but like many other APIs, it can also be used for other types of programs. Like Monkey X itself, one of Mojo's goals is to make everything (Graphics and sound in this case) as consistent as possible on all of its supported platforms. Because of this, Monkey X based games tend to look almost identical on all platforms, despite sometimes being based on drastically different technologies.

Mojo currently doesn't render with WebGL for its HTML5/JavaScript versions, however, a member of Monkey X's community known as Devolonter has done it himself.

Development Roadmap[edit]

As of July 10, 2013, Mark Sibly (Monkey X's creator) has started a forum thread about the future of Monkey X's development,[9] as well as some information about new functionality for Monkey X and Mojo. One of the most notable announcements was the planned development of a new cross-platform 3D API. There hasn't been very much information released, but we do know that the working title is "Mojo3D".

Mark Sibly has stated that the new 3D API will be similar in design to the OpenGL ES 2.0 API, and will support the following targets:

Mark Sibly's ongoing forum thread can be found here, in Monkey X's official forums.

Official targets (Garbage-collected)[edit]

Official Targets (Not Garbage-collected)[edit]

Upcoming Official Targets[edit]

  • Android (NDK): On July 10, 2013, Mark Sibly stated that there was a strong possibility that a native Android target will be coming to Monkey X in the near future.[13]

Unofficial Targets[edit]

You can find most of Monkey X's unofficial/community-driven targets at the official community's "User Targets" section.

Notable games made using Monkey X[edit]

Sample code[edit]

' This example relies on the 'Mojo' module, so it will not compile with the STDC++ target.
' Mojo comes with all full versions of Monkey, and it works on all official game-targets.
' Classes and functions such as Image, and App, LoadImage, and DrawImage are located in Mojo.
 
' Enable strict mode.
Strict
 
' Import the mojo module.
Import mojo
 
' The entry point for monkey:
Function Main:Int()
  New GameApp
  Return 0
End
 
' The main class which expends Mojo's 'App' class:
Class GameApp Extends App
  Field player:Player
 
  ' Override Mojo's 'OnCreate' method:
  Method OnCreate:Int()
    ' OnCreate is called automatically when the 'App' class is created.
 
    ' Most media should be stored in a folder called "ProjectNameHere.data".
    ' Load the image player.png, then return the 'Image' class to 'img'.
    ' Mojo assumes that what you're loading is in the "ProjectNameHere.data" folder.
    Local img:Image = LoadImage("player.png")
 
    ' Create a new instance of our player class using the image we loaded.
    player = New Player(img, 100, 100) ' Self.player could also be used here.
 
    ' Set the update-rate to 60 frames per second.
    SetUpdateRate(60)
 
    ' Returning zero usually signifies that there were no errors in a method like this.
    Return 0
  End
 
  ' Override Mojo's OnUpdate method:
  Method OnUpdate:Int()
    ' OnUpdate is called automatically several times per second.
    ' The number of times this is called is based on the update-rate.
 
    ' Add '1.0' to the player object's 'x' variable(Float).
    player.x += 1.0
 
    ' If the value of 'x' exceeds 100, set it to zero:
    ' This could also be done using 'Mod', the modulus operator.
    If (player.x > 100) Then
      player.x = 0
    Endif ' End could be used here instead of Endif
 
    ' Everything went according to plan, now return zero.
    Return 0
  End
 
  ' Override Mojo's OnRender method:
  Method OnRender:Int()
    ' OnRender is usually called as many times as OnUpdate.
    ' Normally, all graphical/drawing operations must be done in here.
    ' However, you can manually render by using BeginRender() and EndRender().
 
    ' Clear the screen, then display a color based on the values specified(RGB).
    Cls(32, 64, 128)
 
    ' Call our player object's 'Draw' command.
    player.Draw()
 
    ' Everything went according to plan, now return zero.
    Return 0
  End
End
 
' The player class that was referenced above:
Class Player
  ' Define all of our fields (Variables):
  Field x:Float, y:Float
  Field image:Image
 
  ' Overloading 'New' works the same way as a constructor in other languages.
  Method New(img:Image, x:Float=100, y:Float=100)
    ' Due to the arguments, 'Self' is required in this situation:
    Self.image = img
    Self.x = x
    Self.y = y
  End
 
  ' 'Draw' is a simple command that draws our image using the coordinated specified.
  Method Draw:Void()
    DrawImage(image, x, y)
  End
End

See also[edit]

  • HaXe - a programming language that compiles to JavaScript, C++, Java, C#, and several other languages

References[edit]

  1. ^ Monkey's official website
  2. ^ The official Monkey X forums, where all of the product updates are documented and discussed.
  3. ^ MonkeyMax Source Code Repository from Google Code
  4. ^ User Made Python Target Source Code Repository from Google Code
  5. ^ User-made Nintendo DS Target for Monkey
  6. ^ [1] Monkey Announcement
  7. ^ http://www.blitzbasic.com/faq/faq_entry.php?id=29 Blitz Research Ltd
  8. ^ Monkey X Re-branding Official Forum Post
  9. ^ http://www.monkey-x.com/Community/posts.php?topic=5548 A forum thread started by Mark Sibly (Monkey X's creator), which contains a 'roadmap' for Monkey X development
  10. ^ After the release of V71, the 'standard' C++ target was given a fully functional garbage collector. - Source: A forum post made by Mark Sibly (Monkey's creator) from www.monkey-x.com
  11. ^ A forum thread started by Jochen himself. from www.monkey-x.com
  12. ^ A forum post made by Mark Sibly (Monkey X's creator) from www.monkey-x.com
  13. ^ Monkey X's official development road-map.
  14. ^ Official BAFTA Sports/Fitness 2013 Category Page from bafta.org

External links[edit]