Monkey wishlist / current issues

Monkey Forums/Monkey Programming/Monkey wishlist / current issues

Xaron(Posted 2011) [#1]
Maybe we could just just discuss some must have features in this thread.

I'd like to start with a copy from the BB forum from Jim Brown (hope you don't mind, Jim):

This one focuses purely on Mobile phone implementation and how nicely Monkey plays with the O/S. Some of these I consider 'must have' features due to how mobile phones are used

1. There needs to be an OnPause() event, at least in Android world. This happens when the home button is pressed or a call is received. As such it is better to suspend the accelerometer and timer (to conserve battery life). Also its a good opportunity to use game save states
Equally, OnResume() can be used to re-enable the accelerometer, timer, and load game state

2. What happens if I rotate the phone? Does it destroy the display? Do DeviceWidth and DeviceHeight get updated?

3. Pressing the back button should ideally call and OnDestroy() function so the developer can act accordingly

4. Can the menu button be supported?

5. Does installing a new version of an app overwrite the persistent data previously stored?

Please make a sample demo available with touch support and sound output. I am concerned to read a user is getting no sound on their (Galaxy S) device.


I second that above especially regarding this OnResume/OnPause/OnDestroy or however you want to call this. It's very important to have for mobile devices.


xlsior(Posted 2011) [#2]
4. Can the menu button be supported?

All four of the standard Android buttons, for that matter...

Anyway, they are all good questions, and I'd love to see an answer. :-?


taumel(Posted 2011) [#3]
a) More love for mojo.sound (proper looping with HTML-5, sound on GLFW at all).
b) Tiny but important enhancements in mojo.graphics (filtering options for imported images like no filtering for a pixel look, SetColor support for Images, more Blend Options, a.o. to be able to write Text with an Alpha but without additive blend, SetScale worked better for me than the current implementation, pixmap support).
c) Communication ability with the rest of the website/SQL-servers.
d) A 2d physics engine.
e) Easy way for GPU access.
f) Beside of the dialog window, adding the option to setup target platforms (tag those you want) in the IDE Prefs.


Xaron(Posted 2011) [#4]
Good suggestions, taumel. Point d) is in progress already (I will keep you up to date regarding that, you may look into my german forum as well *gg*). :)


taumel(Posted 2011) [#5]
;O) The warm colours are a lot better now.


dopeyrulz(Posted 2011) [#6]
Like Jim, I think some form of discussion/investigation around suspending/resuming apps under Android/iOS/Windows Phone 7 is required. I'm not sure about others, but WP7 has a 'tombstone' process to recover apps if you exit then return (via the Back button) - events are available to handle this.

I would assume apps (particularly iOS and WP7) would not receive approval without proper support.

Now I may be jumping the gun as perhaps some of this is already complete??


Virtech(Posted 2011) [#7]
Agree on all suggestions.

- Support for Android phone buttons should be priority nr1
- Sound must work on Android.


DGuy(Posted 2011) [#8]
I'll chime in on the desire/need for some sort of OnPause/OnResume/OnExit type notifications.


Brucey(Posted 2011) [#9]
I realise most of my wishes won't be game oriented, but I'm sad like that...


A) Support for big numbers, like Double, and Long - on platforms that don't directly support such big numbers, I don't mind if it scales down to Float- but I'd like to be able to use big numbers where I can.

B) Large-file support in the "system" functions. There is a world out there where files are larger than 2gig... (I don't know enough about module dependencies to know if I can replace it with my own - without actually physically replacing it!)

C) Some kind of field/class/method tagging/annotation/meta support - more useful at the build stage, but possibly useful through the Object model too...


comparing my list with the rest, I think I'm living in a completely different universe...


Perturbatio(Posted 2011) [#10]
comparing my list with the rest, I think I'm living in a completely different universe...


Aberdeen? ;)


taumel(Posted 2011) [#11]
I was wondering about Double as well when i did some more computations. Would be nice to have them inside.


Wiering(Posted 2011) [#12]
I would like to vote for:

- ReadPixel and WritePixel (to manipulate images)

- IncBin (especially for Flash, the final game should be a single SWF)


Xaron(Posted 2011) [#13]
I'd like to see plain and simple enums.


taumel(Posted 2011) [#14]
Hmm is it intention that i also have to define module imports in external files, although they are beeing imported in the main script before the external files are beeing imported?


Xaron(Posted 2011) [#15]
I think so. Actually I like it because that way you see all dependencies a single file has.


Sledge(Posted 2011) [#16]
IncBin (especially for Flash, the final game should be a single SWF)
Should?! It would be nice as an option, but it would also be handy to have an swf that pulls resources from a (not necessarily obvious) relative dir for when you maybe don't want people half-inching your game from your site (say if the point of the swf is to drive and keep folk there).


Wiering(Posted 2011) [#17]
What I mean is if you want to get your Flash game onto thousands of portals and have it played by millions of people, it's best to have a single SWF file. Many (most?) portals don't allow multiple files.


Alex(Posted 2011) [#18]
Is there any reason why ReadPixel and WritePixel can't be done?


a1programmer(Posted 2011) [#19]
I would LOVE a ReadPixel and WritePixel (or SetPixel32 / GetPixel32).

I also really need the ability to have an off-screen render target.

I wanted to do it for Android / Flash / HTML5, but have no time (off-screen target, that is).


ziggy(Posted 2011) [#20]
Is there any reason why ReadPixel and WritePixel can't be done?
AFAIK pixel level access is not supported in HTML5 canvas.


matt(Posted 2011) [#21]
It is possible in HTML5 using the canvas context, it's just very slow right now in current browsers.

See here: https://github.com/gingerbeardman/context-blender


a1programmer(Posted 2011) [#22]
Yep, The issue is that you have to get a rect "snapshot" of the pixel data, manipulate it, then put it back.

For what I'm wanting to do (add a smoked/burned/charred look to a terrain), it would work.

http://stackoverflow.com/questions/667045/getpixel-from-html-canvas


Suco-X(Posted 2011) [#23]
Hmm...I´ve just written a small test.

Import mojo
Import dom

Extern

Global game_canvas:HTMLCanvasElement


Public


Class CPixmap
	Field _canvas:HTMLCanvasElement
	Field _rc:CanvasRenderingContext2D
	Field _pixel:ImageData
	
		
	Method New(canvas:HTMLCanvasElement)
		_canvas = canvas
		_rc = CanvasRenderingContext2D(canvas.getContext("2d"))
	End
	
	
	Method Width:Float()
		If Not _pixel Return
		
		Return _pixel.width
	End 
	
	
	Method Height:Float()
		If Not _pixel Return 
		
		Return _pixel.height
	End 
	
	Method GetPixel:Int[](x:Int, y:Int)
		Local index:Int, color:Int[4]
		
		If Not _pixel Return 
		
		x = Min(x, _pixel.width)
		y = Min(y, _pixel.height)
		
		
		index = (y*4)*Width+(x*4)
		
		color[0] = _pixel.data[index]
		color[1] = _pixel.data[index+1]
		color[2] = _pixel.data[index+2]
		color[3] = _pixel.data[index+3]
		
		Return color
	End 

	
	Method SetPixel(x:Int, y:Int, r:Int, g:Int, b:Int, a:Int)
		Local index:Int 
	
		If Not _pixel Return 
		
		index = (y*4)*Width+(x*4)

		_pixel.data[index]   = r
		_pixel.data[index+1] = g
		_pixel.data[index+2] = b
		_pixel.data[index+3] = a
	End 
	
	Method Create(w:Int, h:Int)
		If Not _rc Return 

		_pixel = _rc.createImageData(w,h)
	End
	
	
	Method Grab(x:Int, y:Int, w:Int, h:Int)
		If Not _rc 
			Print "Rendering Context doesn`s exists"
			Return
		End
		 
		_pixel = _rc.getImageData(x,y,w,h)
	End 
	
	
	
	Method Draw(x:Float, y:Float)
		If Not _pixel Return 
		
		_rc.putImageData(_pixel,x,y)
	End
	
	

End




Class CGame Extends App
	Field pixmap:CPixmap
	Field fps:Int, tfps:Int
	Field timer:Int
	
	
	Method OnCreate()
		SetUpdateRate(60)	
		pixmap = New CPixmap(game_canvas)
		pixmap.Create(DeviceWidth(), DeviceHeight())
		
		For Local x:Int = 0 Until pixmap.Width
			For Local y:Int = 0 Until pixmap.Height
				pixmap.SetPixel(x,y,255,0,0,255)
			Next 
		Next 
		
		timer = Millisecs()
	
	End
	
	
	Method OnUpdate()
	
		If Millisecs()-timer>1000
			fps = tfps
			tfps = 0
			timer = Millisecs()
		End
		tfps+=1
		
	End
	
	
	Method OnRender()
		Cls 0,0,0
		pixmap.Draw(0,0)
		DrawText "FPS: "+fps,10,10
	End

End



Function Main()
	New CGame
End


Only drawing pixels on the canvas, but 60 fps.

Mfg Suco


impixi(Posted 2011) [#24]
@Suco-X: Very nice. Good performance on Chrome.

I've added a Cls method to the CPixmap class and a heightmap generation and rendering test:




FlameDuck(Posted 2011) [#25]
I'm voting for Brucey's suggestions and Xaron's Enum suggestion and would like to add:

- XML support. Seriously. Every platform has it out of the box, many even go one further and support XPath expressions.
- Ternary operators. Every supported language has them.
- Decent IDE. This has been Blitz's Achilles heel since forever.

You want to attract serious developers to your otherwise excellent language? Focus on the tools. While it's true that Monkey is a more productive language than practically any other (with the possible exception of Python), other languages compensate for this shortcoming, by having excellent editors. It's sad but if you have (say) IntelliJ and only care about HTML5 and Android, it's actually more productive (as measured in error-free lines of code produced in one 8 hour working day) to maintain both a Java and a HTML5/JavaScript version as opposed to using Monkey, which from where I'm sitting, utterly defeats the purpose.


Tibit(Posted 2011) [#26]
I'd like to see Interfaces and Smart Enums (not the normal constant-list that you can't enumerate)

- XML, this will come from the community soon enough
- Ternary Operators? already in are they not? if A = 0 Then B = 0 Else A = 1
- Kickass IDE with superb intellisense, I'm working on it ;) windows-only though.


skid(Posted 2011) [#27]
I would like to run monkey code on app engine (google cloud) servers. So I was going to request a python target, but now it looks like Go would be better choice.

A WebGL version of Mojo would be nice also.


therevills(Posted 2011) [#28]
@FlameDuck

* XML - have a look at the config.monkey example included with Monkey
* Ternary Operators - Same as Tibits - Monkey is still a BASIC language
* IDE - Have you seen JungleIDE? Maybe Mark should ask Ziggy to team up with BRL or include the free version of Jungle with Monkey?


dopeyrulz(Posted 2011) [#29]
Would love Enums - they make validations such as Select/Case very clean and your code much more readable.


muddy_shoes(Posted 2011) [#30]
- Ternary Operators? already in are they not? if A = 0 Then B = 0 Else A = 1


While an If-Else provides the logical equivalent, Monkey doesn't support the scoping that is involved in many instances where ternary operators are used for brevity. e.g.

 int x = (test ? vala : valb ); 



Samah(Posted 2011) [#31]
It would be nice to have something like C#'s coalesce operator, ??
It's really just sugar, but it makes for cleaner code.

Instead of:
Method Foo(o:Bar)
  Local obj:Bar = o
  If obj = Null Then obj = New Bar()
End

You would have:
Method Foo(o:Bar)
  Local obj:Bar = o ?? New Bar()
End

Obviously ?? would conflict with the boolean shortcut, but even a keyword operator like "Coa" or "Coal" would be useful.

It would be great to be able to chain them too:
Local a:Foobar = b ?? c ?? d ?? e ?? New Foobar()



FlameDuck(Posted 2011) [#32]
XML - have a look at the config.monkey example included with Monkey
While I certainly appreciate that skn3 went to all the trouble to write a 1000 line Greenspunian XML parser, it seems utterly redundant when every target platform already comes with an out-of-the-box, standards compliant, native code, widely tested, encoding aware XML parser. In this day and age, particularly with a DSL that simply screams "Online Connectivity" (like Monkey and at least half its target platforms) it seems odd that one has chosen not to include XML (or JSON for that matter) support, when standard API's are readily available.

* Ternary Operators - Same as Tibits - Monkey is still a BASIC language
Monkey is not a BASIC variant by any stretch of the definition. It has more in common with Python and Java than any version of BASIC. Besides, point me to the specification of BASIC that says you can't have ternary operators? Visual Basic 9 (the BASIC variant most people under 40 will be familiar with) has it.

* IDE - Have you seen JungleIDE? Maybe Mark should ask Ziggy to team up with BRL or include the free version of Jungle with Monkey?
Yes. I have seen JungleIDE. I own a copy. Unfortunately it's modeled on Visual Studio (the hands-down worst of the "professional" IDE's) and while it's a huge improvement over the "stock" IDE, it's a far cry from IntelliJ or Netbeans. Even Eclipse or Visual Studio for that matter. I'm actually almost at the point where I would offer to buy ziggy a copy of ReSharper, just so he can see what he's missing out on, just for the one in a million shot that some of the things I want in an IDE (refactoring, code inspection, etc.) would make it into JungleIDE.

You cannot imagine the frustration of all the power and productivity enhancements you lose, when switching from your job, or your more "serious" side project (one that has a budget that pays for things like IntelliJ), to have a few hours of recreational coding. The whole point of a powerful language (like Monkey) is to take the tedium out of programming, which it does very well. Unfortunately the other part of removing tedium from programming is a matter of having a tool that eliminates the tedious tasks that a language cannot do for you (like refactoring poorly written or designed code, generating stub methods and boilerplate code, etc.). That's the part of the equation that Monkey (and BlitzMAX for that matter) really lack in my opinion, and the only remaining hurdle it has to overcome to be taken seriously.

Why doesn't BRL offer a "premium package" that has plug-ins for major IDE's (think of something like Flash Builder 4.5, which is basically a version of Eclipse that Adobe charge you for or ReSharper which is basically a version of IntelliJ for people who have to work with Visual Studio). Flash Builder 4.5 costs 700 USD, Resharper costs 420 USD, Unity Pro (which also has a horrible IDE by the way) costs 1500 USD. You think my situation (professional programmer who actually also does recreational coding) is such a unique situation?

You're telling me you don't think there's a market for a version of Monkey, with an IDE that doesn't drain your will to live? Hell you could probably write a nice letter to the folks over at JetBrains and get them to write the damned thing for you, using their existing technology (and make a Monkey version of PhpStorm/RubyMine/PyCharm). I mean PyCharm and PhpStorm are both priced comparatively to Monkey (RubyMine is even cheaper). You telling me you don't see a market for a Flash Builder/Unity killer which only costs $250 bucks? You're telling me you don't think people would pay the extra 120 USD for an order of magnitude increase in productivity? Well, you might be right, but I doubt it.

There is a premium market, there are people looking at using Monkey professionally, Monkey does solve a real pain that even large companies are pouring endless streams of money into solving (ineffectively I might add) and that force smaller companies to just suck it up, and chose sides. But nobody is going to invest in a language/platform whose best tool is essentially a functionally neutered (if pretty and intuitive) version of vim, supported by one guy, who (as far as I'm aware) has to do something else for a living.

You really want to gamble your livelihood on the odds that neither Mark or Manel get struck by lightning or hit by a bus, that's your business. But you're not going to convince any venture capitalists that that's a sound business plan.


xzess(Posted 2011) [#33]
The most important feature for next version is for me a memory release for Images and Sounds.


Xaron(Posted 2011) [#34]
Something like ReadPixel/WritePixel would be awesome. I currently work on my Master studies where I apply some image scaling approach and would love to do an app for this. :)


Michael(Posted 2011) [#35]
Networking support is sorely needed (though a kind soul did create some httpget support for flash & html5 elsewhere on this board).


Xaron(Posted 2011) [#36]
Michael, I still work on that. :)

http://monkeycoder.co.nz/Community/posts.php?topic=725


Michael(Posted 2011) [#37]
Yes Xaron, you're an absolute legend for providing that (whoops I got confused with Indiepath who was working on a similar system). Well I better check out your work! Thanks again.


Skn3(Posted 2011) [#38]
While I certainly appreciate that skn3 went to all the trouble to write a 1000 line Greenspunian XML parser, it seems utterly redundant when every target platform already comes with an out-of-the-box, standards compliant, native code, widely tested, encoding aware XML parser. In this day and age, particularly with a DSL that simply screams "Online Connectivity" (like Monkey and at least half its target platforms) it seems odd that one has chosen not to include XML (or JSON for that matter) support, when standard API's are readily available.


Heh didn't know what "Greenspunian" meant. Agree that full XML support would be good to wrap the native targets! The config example was specific to my project.

My only feature request would be cross platform socket support!


XanthorXIII(Posted 2011) [#39]
My Wish is for an improved editor that ships with this.


Virtech(Posted 2011) [#40]
3D! Which I also would pay extra for.


QuietBloke(Posted 2011) [#41]
I'm still learning my way around but I ditto the request for read write pixels.

I initially wanted to re-write my Space Invaders game but I had to put that on hold as I cant see how I can destroy the shields.

Unless I'm missing something ( its very possible... I have only been looking at the help files at the moment ) I can't see a way of creating / manipulating images or how to do pixel perfect collision detection.

[EDIT]
Opps.. just scrolled up to find the post by Suco-X.


AdamRedwoods(Posted 2011) [#42]
- Organize the docs better.
- keep the audio separate so we don't have to use OpenAL
- bring back the semicolon
- IncBin


matt(Posted 2011) [#43]
@AdamRedwoods How would you like the docs organised?


AdamRedwoods(Posted 2011) [#44]

How would you like the docs organised?



Perhaps it's a little to do with the IDE as well as the docs.

- the nav on the right in the IDE is a bit clustered. hard to discern where the actual language reference is vs. module code vs. style css. It may be that I'm used to BlitzMax's docs on the right nav tree (but then most customers will be coming from BMax)
- the IDE doesn't interpret HTML code (from the right side nav tree), the docs popup in <brackets>
- The actual language doc is one big file, not broken into sub groups.
- code examples are not indented or framed.
- the tutorial "path of the monkey" has no margins, so on a widescreen monitor the sentences are hard to read.
- ditto with "Getting started with Monkey"
- this file: "Monkey/docs/modules/index.html" has GREAT INFO, has a nice nav, but took me forever to find since it was buried in the nav tree on the right.

It may seem like I'm nit-picking, but when someone is exploring around in a new language, the help file is CRITICAL to solving problems. A frustrating help file leads to a frustrating first-impression.


ErikT(Posted 2011) [#45]
Monkey is great. But pleeeeeease add the option to turn off bilinear filtering for images! All pixelled graphics look incredibly ugly with filters applied. There's no reason not to add this option, is there?


Samah(Posted 2011) [#46]
bring back the semicolon

Agreed, as long as it's mandatory, ala C/C++/C#/Java.


FlameDuck(Posted 2011) [#47]
IncBin
Not technically possible (and/or desirable) on all platforms (Android and HTML5 should immediately spring to mind).


matt(Posted 2011) [#48]
@AdamRedwoods:
- this file: "Monkey/docs/modules/index.html" has GREAT INFO, has a nice nav, but took me forever to find since it was buried in the nav tree on the right.

Use Chrome/Safari/Firefox/IE9 to get a dynamic search box in the top right of that page.

@ErikT:
Monkey is great. But pleeeeeease add the option to turn off bilinear filtering for images! All pixelled graphics look incredibly ugly with filters applied. There's no reason not to add this option, is there?

Non-filtered resizing of images is only controllable in some web browsers.

Firefox 3.6+: https://developer.mozilla.org/En/CSS/Image-rendering
img { image-rendering: -moz-crisp-edges; }

IE8+: http://msdn.microsoft.com/en-us/library/ms530822(v=vs.85).aspx
img { -ms-interpolation-mode: nearest-neighbor; {

No solution currently for WebKit.

Safari: https://bugs.webkit.org/show_bug.cgi?id=40881
Chrome: http://code.google.com/p/chromium/issues/detail?id=1502


Wiering(Posted 2011) [#49]
Please, can we have Pixmaps with getpixel32 and putpixel32?

@FlameDuck
IncBin

Not technically possible (and/or desirable) on all platforms (Android and HTML5 should immediately spring to mind).

It doesn't have to be literally included as binary data, just let the contents of the binary file be accessible as an array of bytes (so you don't have to go through the hassle of loading data from external files).


matty(Posted 2011) [#50]
MIDI support on smart phones..no idea of feasibility but would certainly allow for smaller app sizes..