Hello!
In this article, I would like to talk about Monkey, a programming language aimed primarily at creating cross-platform 2D games. This tool, in my opinion, is somewhat undeservedly deprived of the attention of developers and I would like to fix it.
')
Monkey is by no means the "killer" of Unity and other similar tools. But it may be of interest to beginners, as well as independent game developers, whose budget is largely limited. If I managed to interest you, welcome under cat.
Tongue
Monkey is an object-oriented, broadcast programming language that is cross-platform by translating the Monkey code into a platform native language.
Officially, Monkey code can be translated into the following programming languages: C ++, C #, Java, JavaScript, and ActionScript. However, this list can be expanded by writing your own translators. So, by the Monkey community, translators for Python and BlitzMax have been successfully developed.
Monkey refers to a family of languages with a BASIC-like syntax. But it also clearly shows the influence of Java. The language has static typing, provides modularity, supports abstraction, encapsulation, inheritance, and polymorphism, as well as interfaces, generic types, properties, iterators, and exceptions.
Sample code written in Monkey
The author of the language is New Zealand developer Mark Sibley - the founder of Blitz Research Ltd. This person is known to some developers for creating game tools like BlitzBasic, Blitz3D and BlitzMax. In essence, Monkey is an evolution of the lineup of all previous products from Blitz Research Ltd.
Cross platform
As I wrote above, cross-platform is achieved through translation. In essence, all that the Monkey translator can do is check and translate code, build a project that is valid for the platform, and run native tools for building applications. In this regard, to build the final application, you will need to install the SDK for all the required platforms. Below is a table of currently available platforms and a list of required software.
Platform | Required software |
---|
HTML5 | not required |
Flash | Flex SDK, Java SE |
GLFW (Windows, Mac) | MS VC ++ or MinGW, OpenAL |
Android | Android SDK, Java SE (32-bit), ANT (Windows) |
iOS | OS X 10.6, Xcode |
XNA (Windows, WP7, XBox 360) | XNA Game Studio 4.0, MS VC #, WP SDK 7.1 |
PSM (PS Vita) | PSM SDK |
Thus, we manage to avoid using different launchers and plug-ins for launching final applications. Everything looks as if we wrote the application ourselves. Of course, the translated code is unreadable and not always optimal, but at the same time it gives all the advantages of native development.
As can be seen from the table above, the following platforms are currently supported:
HTML5 ,
Flash ,
Android ,
iOS ,
WP7 ,
PS Vita ,
Xbox 360 ,
Windows and
Mac .
Linux is also supported, but so far unofficially. As in the case of translators, this list can be expanded by your own implementation of support for the platforms you need.
Translator
The translator, strange as it may sound, is written in Monkey. But as in the case of egg and chicken, there was an intermediate stage when the translator was written in BlitzMax. The source code of the translator is completely open, so if necessary, you can make changes and rebuild it in Monkey using the target platform Stdcpp (standard C ++).
Preprocessor
Monkey uses a simple preprocessor to separate specific sections of code for different platforms, set additional configuration parameters, and also to include or exclude code blocks depending on the configuration of the assembly.
Using native code
Platform-specific language can be used to write platform-specific code. Using the Extern directive, classes and functions that use platform-specific features can be included in Monkey code. This makes it possible to extend the functionality of your application with virtually no restrictions.
Modules
The capabilities of the language can be expanded using modules that can be written directly on Monkey or in a platform native language.
Out of the box Monkey comes with the following modules:
- monkey (basic language features)
- brl (a set of classes and functions for working with streams)
- reflection
- os (module for working with the operating system)
- dom (module for working with DOM-tree of HTML-document)
- mojo (2D framework)
- opengl (module for working with OpenGL)
In addition to this list, the developer community has written over
20 additional modules, including ports of various physical engines (
Box2D ,
Chipmunk and
Fling ),
GUI systems, modules for working with fonts, modules for implementing
IAP (in-app purchase) , modules for working with
XML ,
JSON and various services. A list of most of the currently available modules can be found
here .
Game development
Here we come to the most important thing. At the beginning of the article, I said that Monkey is mainly used to create 2D games. But, as you can see, the language itself for this case is not sharpened.
Mojo
For game development, the mojo module, which comes with Monkey, is used. This module provides the developer with a cross-platform API for working with 2D graphics, sound and input devices. The capabilities of the framework are somewhat limited and this is due primarily to the need to support multiple platforms. Not all features available on one platform are available on another. If some kind of "chip" is not available on at least one of the platforms, then it will not be included in the mojo. Of course, this is somewhat radical. But at the same time, you can be sure that your application will work equally on all platforms.
The second reason for such a modest functionality is the ease of adding new platforms. Technology is changing at an incredible speed. Here and there, new devices and operating systems appear. That is why the ability to quickly add support for a new platform gives an undeniable advantage over other similar tools.
Game frameworks
Of course, the mojo functionality is not enough to write a full game. After all, the game is not only working with graphics, sound and input devices, but also the user interface, various states, tiles, animation, physics, and so on. All this in mojo, unfortunately, no. But game frameworks and other modules created by the Monkey community come to the rescue.
List of popular gaming frameworks for MonkeyDiddy . One of the most popular frameworks for Monkey. In addition, directly, the framework provides a large number of additional functionality.
FantomEngine . The creator of the framework is the author of the book "Monkey Game Development", all the examples in which are made using fantomEngine.
Flixel . Port of the popular flash-framework flixel. I am engaged in porting this framework, but at the moment, in the absence of time, work on it is suspended.
Playniax . The only commercial framework, but with good reviews. The author is the developer of the framework of the same name for BlitzMax.
In addition to these
4 frameworks, on the official website you can find links to another
4-5 such tools of varying degrees of completion.
3D
If your goal is to create 3D games, then you have the opengl module (not available on all platforms) or the
minib3d framework. But in general, in this regard, everything is pretty bad.
Monkey Games
List of popular games made on Monkey
The most complete list of games you can see
here .
Cost and distribution model
Monkey's pro license costs
$ 99 . For this amount you get: lifelong support and updates, access to the official website forum, the mojo module for all officially supported platforms and the ability to create commercial games.
Also, a demo version is available for download, which includes a mojo for HTML5. With this version you
can not create commercial games.
Actually, speaking of demo and pro versions, I mean only mojo, since Monkey itself is in the public domain and is distributed completely free of charge. Unfortunately, Monkey has no official repository, so you can download only custom forks.
At the moment, two Monkey forks are known:
Of these two, I would recommend using the first one, since it is more often updated and includes more improvements.
disadvantages
Like any software product, Monkey has its drawbacks. Below, I will try to talk about the most important of them, as well as suggest ways to solve them.
IDE
This is probably the most serious problem - the lack of a normal development environment. Despite the fact that Monkey comes with two IDE (Monk and Ted), none of them can not be called complete. I would rather call them a little advanced notepad, no more. Writing serious projects on them is very problematic.
To solve this problem, you can use the commercial
Jungle IDE (there is a free lite-version) or one of
several plug-ins for popular text editors. However, the problem with the IDE, unfortunately, remains one of the key.
Lack of auxiliary tools
Most professional tools for creating games come with editors for levels, sprites, animations, etc. In Monkey, you will not see such tools. There is only language, modules and IDE.
Third-party software comes to the rescue, both paid and free. Usually, importing projects from such tools is not a big problem. In addition, if you search through the official forum, you can find ready-made solutions, such as importing texture atlases from TexturePacker, import of tile maps from Dame and Tiled, etc.
HTML5 performance
The HTML5 version of mojo uses a 2D context, which adversely affects the performance of games. Unfortunately, WebGL is not supported in IE. And as I wrote earlier, if some feature is not supported somewhere, then it is not used at all.
To remedy this situation, you can try using the experimental mojo patch -
Mojo HTML5 GL , which replaces the 2D context with WebGL, which gives a significant performance boost.
Official site
Another hello from the past - the official site. Yes, he copes with his direct responsibility - to provide users with the opportunity to ask questions and receive answers, but otherwise this is a very primitive forum with a terrible design. Many of those who are interested in Monkey, began to doubt immediately after viewing the main page. And when they switched to demos, they ran away with horror and never returned (I am not exaggerating). Despite the fact that the problem does not directly concern the development, I consider it one of the most serious secondary problems.
Title
Many users complain that looking for information about Monkey is very difficult, as they constantly come across information about monkeys. In addition, the phrase monkey coder has a negative color, due to its similarity with
Code Monkey .
Monkey and Haxe
Haxe is a universal, high-level object-oriented programming language with a Monkey-like principle of operation. And given that Haxe appeared earlier, we can assume that the developer of Monkey drew his inspiration from him.
Like mojo, Haxe has a NME framework repeating the Flash API. In view of such a number of coincidences, a logical question arises: “How is Monkey and mojo better than Haxe and NME?”. I will make a reservation right away, I am not familiar with Haxe closely and maybe I am mistaken about something, but nevertheless, I will try to be as objective as possible.
The advantages of Monkey and mojo bundles, in my opinion, are:
- more officially supported platforms
- support of such important platforms as PS Vita, WP7, Xbox 360, HTML5 (in NME this platform is in its infancy)
- stable translation in C # and Java (in Haxe, these languages are in beta status)
- the same or expected behavior on all platforms. In NME, the difference between the platforms looks bigger.
- relative ease of adding support for new platforms
- payment, as a guarantee of development
Advantages of the Haxe and NME bundles:
- more "advanced" language
- great features of the NME framework
- familiar to many Flash API game developers
- FlashDevelop as the main IDE
- large community
- gratuity
As you can see, each tool has its strengths and weaknesses. And to get an unequivocal answer to the question which of them is better is not possible. Much depends on what you expect to receive from your chosen instrument.
In conclusion
Thank you for reading this post to the end. I did not expect that it will turn out so long, so I'm sorry if I wasted your time. Nevertheless, I hope that I was able to fully open the topic and talk about Monkey as objectively as possible.
For anyone interested in Monkey - the
official site of the project .
Thanks for attention!
That's all. Until!