Experimental Monkey Pro V67a now up!

Monkey Forums/Monkey Programming/Experimental Monkey Pro V67a now up!

marksibly(Posted 2012) [#1]
Hi,

Please consider this release highly experimental - ie: do not release anything publicly/commercially with it!

I've given this a reasonably thorough testing, but right now I'm more interested in letting people have a play with it all and getting some feedback on the approach I've taken to targets/Mojo etc.

Anyway, here's a quick rundown on what's in there (probably missed a few things) - feel free to discuss here.

***** New mojo commands *****

ShowMouse
HideMouse
OpenUrl( url:String )
ResetInput


***** Linux version *****

The release now includes Linux x86 binaries for Monkey, Ted, mserver and transcc. The official dev platform for Linux Monkey is Ubuntu12. With a default monkey setup, you should be able to run html5 apps. To build glfw apps, use the package installer to install qtcreator and libopenal-dev. Support for flash/android etc coming...

Also, I forgot that zips don't do permissions, so you'll have to add 'executable' permissions to Linux exes.


***** New target system *****

bin/trans renamed to bin/transcc.

Majorly overhauled target system. Target dirs now contain:

TARGET.MONKEY - target control file
template/ - template project to be copied to app.build folder when target built.
modules/ - modules specific to target.

TARGET.MONKEY should contain 3 decls:

TARGET_NAME="Glfw Game" 'name of target to appear in IDE combo box and to be used with Transcc.
TARGET_SYSTEM="glfw" 'target system - this ends up in app config TARGET var.
TARGET_BUILDER="glfw" 'builder to use for target, same as system for now.

You can now 'copy' a target simply by copying a target dir and changing TARGET_NAME. Target builders are still hardcoded into transcc.


***** New game/mojo architecture *****

A new brl.game module has been added that implements a simple BBGame class. This is extended by various targets to implement BBHtml5Game, BBAndroidGame etc classes.

BBGame effectively handles all the app/timing/input stuff that used to be in Mojo, so that side of Mojo is now pure Monkey.

BBHtml5Game, BBAndroidGame etc (which are currently target modules) implement/extend BBGame and provide extra methods to create native bitmaps, images, const char *'s etc. This stuff is used by the native Mojo graphics/audio code.

More could probably be factored out of the target module classes to 'somewhere', but I've been hacking at this long enough and it's time to get some outside input on where it's all going!

The upshot of all this is that: a) you can now create apps of any target type without Mojo (you just have to write your own graphics/audio code!) and b) you can implement your own version of BBHtml5Game, BBAndroidGame etc in your own target to implement support for gamecenter or some other advert/social-media-ish stuff.


***** New targets *****

Added win8, winphone8 targets. Currently very much beta as I don't have any actual devices yet! Win8 phone should be out in a few weeks here in NZ.

You'll need Windows 8 and separate versions of MSVC Express to build each target. If you want to use the Windows Phone 8 emulator, you'll need Windows Pro 8 64 bit AND a computer capable of the necessary virtualization.

I haven't worked out how to run winrt apps yet, so for now you'll need to: build-in-Ted/switch-to-MSVC/reload-all/debug-go.


***** Language changes *****

Extern class member function munging changed so you no longer have to prefix the munged name with class scope.


***** PSM issues *****

Since the PSM SDK left beta, the ability to test code on an actual device has become limited to publishers only. And the ability to become a publisher has become limited to people residing in certain countries. And NZ is not one of those countries.

So I haven't been able to test any of the above new stuff on an actual Vita, therefore I can't verify whether the accelerometer or multi-touch stuff works properly. I had a quick look at speed issues when I did the last update rate fix (ie: always use SetUpdateRate 60 to get best performance on Vita) and Monkey code seemed to run about the same as PSM code (I did a quick rewrite of a 'spinning biscuits' sample to test) so IMO it *should* be more or less 'release ready'.

But in general...it has always been my goal that Monkey was available to as wide an audience as possible, and whether or not you can develop for a certain target here in NZ has been a pretty good indicator to me of whether that target had real 'global' reach and was worth supporting. This latest move by Sony makes the Vita far more like something like, say, the Wii for indie devs, and that's never been something I wanted to get involved in.

Plans for the Vita/PSM are therefore 'on hold' right now.


marksibly(Posted 2012) [#2]
Ok issue 1!

I forgot that zips don't do permissions, so you'll have to add 'executable' permissions to Linux exes.

Is it OK to use tar.gz on Windows yet?


Amon(Posted 2012) [#3]
Thanks! Will test now. :)


Jesse(Posted 2012) [#4]
oh wow. I haven't tried it but I will be busy testing it.

Thanks Mark and Thank you sir. My upmost respect!


c.k.(Posted 2012) [#5]
Is prior code expected to run without modification for this version?


marksibly(Posted 2012) [#6]
Hi,

> Is prior code expected to run without modification for this version?

'Pure' Monkey code should run as is.

Stuff that makes use of 3rd party extern code may have problems if it hooks into existing native code that has been moved.


skid(Posted 2012) [#7]
This code fails for XNA:

Import mojo
Import reflection
Import brl

Function Main()
	New App
	Print "hello"
End



The warning that triggers the build failure looks like this:


Program.cs(2066,14): warning CS0114: 'BBFileStream.Close()' hides inherited member 'BBStream.Close()'. To make the current member override that implementation, add the override keyword. Otherwise add the new keyword. [C:\MonkeyPro67a\test1.build\xna\MonkeyGame\MonkeyGame\MonkeyGame.csproj]




impixi(Posted 2012) [#8]
Nice update. I'm testing on Ubuntu 12.1 (32bit) and the HTML5 target seems to run most examples. However, I'm having issues with the GLFW target. This is the error I get when building bbgametest.monkey:

glfwOpenWindow failed
TRANS FAILED: Error executing './MonkeyGame', return code=65280

I've installed the stated packages (qtcreator, libopenal-dev). Anything else I might need?


impixi(Posted 2012) [#9]
Can no longer do this?

Strict

Function Main:int()
	Print "Hello World!"
	
	Return 0
End


HTML5: BBHtml5Game is not defined. GLFW also throws a similar error.


marksibly(Posted 2012) [#10]
> Can no longer do this?

Nice find - you'll have to use 'Import monkeytarget' for Mojo-less targets for now (except for C++ Tool). Will have a look at this...


ziggy(Posted 2012) [#11]
Looks nice!
This new system that allows target-specific modules is not supported by Jungle Ide. I'll support it as soon as possible but I will have to rewrite lots of it, so don't expect immediate adoption on Jungle Ide. It'll take some weeks.


MikeHart(Posted 2012) [#12]
Weird. On HTML5 (ChromeV23) with the bouncyaliens example, when I click in the middle of the canvas, it freezes.


therevills(Posted 2012) [#13]
I'm getting when trying Diddy:

Error opening file: C:\Dropbox\monkeydev\modules\reflection\reflector.monkey

I don't even have a Dropbox folder on my C drive ;)

when I click in the middle of the canvas, it freezes.

My too on IE10...

[edit]Just checked the code:
[monkeycode] If MouseHit(0)

If MouseX()<DeviceWidth/3
For Local i=0 Until 25
If Not sprites.IsEmpty() sprites.Pop
Next
Else If MouseX()>DeviceWidth*2/3
For Local i=0 Until 25
sprites.Push New Sprite
Next
Else
' OpenUrl "http://www.blitzbasic.com"
DebugStop
End[/monkeycode]

Its because of the DebugStop command...


therevills(Posted 2012) [#14]
Looks like the Diddy issue is caused by:

diddy/exception.monkey
[monkeycode]#REFLECTION_FILTER="diddy.exception"
Import reflection[/monkeycode]

Steps to reproduce:
1. Create test file:
[monkeycode]Strict

Import ref

Function Main:Int()
TestRef()
Return 1
End[/monkeycode]

2. Create a module folder in Monkey/modules folder:
ref/ref.monkey
[monkeycode]Strict

#REFLECTION_FILTER="ref.ref" ' <- doesn't matter what you put here
Import reflection

Function TestRef:Void()
Print "TEST"
End[/monkeycode]


CopperCircle(Posted 2012) [#15]
Cool, I'll try and build a Win8 target for my Surface RT.


ziggy(Posted 2012) [#16]
Just out of curiosity. Is c++ based targets garbage collection still being driver-based so it only happens after "on update" and the like? or we have a regular Garbage collector?


ziggy(Posted 2012) [#17]
@Mark: With the new compiler, if there's an import clash between the current target modules and the "global" or "shared" modules folder, wich one has priority? Also, if you add additional module folders through the command line, in wich order are they processed when an import has to be solved?


Skn3(Posted 2012) [#18]
Oh nice update! Good stuff Mark, will have a look now.

[edit]
sniff sniff sniffing around these new targets, interesting concept!

just noticed "CFG_OPENGL_GLES20_ENABLED" in the html5 target, nice. I can start to see how this system will be good!

One question, and I am asking it without fully investigating yet, but:

More could probably be factored out of the target module classes to 'somewhere', but I've been hacking at this long enough and it's time to get some outside input on where it's all going!

The upshot of all this is that: a) you can now create apps of any target type without Mojo (you just have to write your own graphics/audio code!) and b) you can implement your own version of BBHtml5Game, BBAndroidGame etc in your own target to implement support for gamecenter or some other advert/social-media-ish stuff.


So how can we extend existing targets, for example I want to extend the official html5 target and add some cool stuff in there. I could copy the entire folder, but is there a way I can just extend it instead?
Maybe semthing like:

All files would be imported from the base target and then any files in this target would override? Although that wouldn't account for extending the monkeytarget.monkey file...

You mention that the current builders are hardcoded into trans at the moment, does that imply you are going ahead with the plan to have optional custom builders? That would be pretty awesome!

I am really like the approach to mojo/game/app stuff now. Make everything "event" based instead of a mix between polling and events. Definitely would be good to keep this event and implement approach through all monkey stuff that fits! One thing I would suggest here though is to prefix these with 'On'. Eg OnKeyEvent instead of KeyEvent.


slenkar(Posted 2012) [#19]
Nice update but cant seem to build anything:

Builder.Make;C:/Dropbox/monkeydev/src/transcc/builder.monkey<66>

so this is a file on your Mr.Sibleys computer



Also when I change the build target in Ted it still builds the first choice, so I have to restart it to change the new build option.


Ironstorm(Posted 2012) [#20]
Yeah. Windows 8 is working :)

Played a little bit. But there are several problems. SetScissor don't work out of the box.

Here some pics:
http://squorlix.de/IMAG0076.jpg
http://squorlix.de/IMAG0077.jpg
http://squorlix.de/IMAG0078.jpg


dragon(Posted 2012) [#21]
Many thanks Mark,

but i hope you have PSM in focus... i think PSM have future.
As i understand other countries should come after initial release.
I bought Monkey to have PSM-targets...

Here are some prognoses that all next gen consoles (PS oder XBox) should come 2013 with app stores like Apple, Android or PSM.

Current situation is different. For a simply xbox-game-upgrade a publisher must pay 40.000 $ at MS - incredible... In the future such markets have no future. Max 99$ per dev account...


dopeyrulz(Posted 2012) [#22]
Great! Thanks for the Win8 and WP8 stuff!!


CopperCircle(Posted 2012) [#23]
Managed to compile and deploy to my Surface RT all worked great and good performance too.


marksibly(Posted 2012) [#24]
> Managed to compile and deploy to my Surface RT all worked great and good performance too.

Yay! That's a big relief!


marksibly(Posted 2012) [#25]
> So how can we extend existing targets, for example I want to extend the official html5 target and add some cool stuff in there. I could copy the entire folder, but is there a way I can just extend it instead?

For now, you'll have to copy the entire folder.

It's possible that more could be factored out into new modules (I don't think target modules should be able to see/extend other target modules) - eg: much of BBHtml5Game could be moved to brl.game and the target module could instead provide BBMonkeyGame Extends BBHtml5Game or something.

But this raises other issues: targets could then only use inheritance to customize existing modules, and that's sometimes not enough. The whole point of this exercise really is to allow people to customize targets in weird and often ugly ways required by add-ons like game center etc, which often require tweaking things in very specific ways.

There's probably a good case to be made for at least factoring out the loaders and so on used by Mojo graphics/audio. This way, Mojo doesn't have a magic/backwards dependency on the target, and the methods used are easily customized by overriding.

I'll think about this, but for now I'm gonna play it conservatively. Copying/pasting target code isn't particularly sexy, but it does give max flexibility when it comes to customizing modules.


therevills(Posted 2012) [#26]
@Mark - any workaround for the reflection bug?

http://www.monkeycoder.co.nz/Community/post.php?topic=4061&post=43674


marksibly(Posted 2012) [#27]
> @Mark - any workaround for the reflection bug?

Yep, I'll probably post an update later today.


Skn3(Posted 2012) [#28]
There's probably a good case to be made for at least factoring out the loaders and so on used by Mojo graphics/audio. This way, Mojo doesn't have a magic/backwards dependency on the target, and the methods used are easily customized by overriding.

I'll think about this, but for now I'm gonna play it conservatively. Copying/pasting target code isn't particularly sexy, but it does give max flexibility when it comes to customizing modules.


It's a reasonable approach, I can imagine that it would never be an issue for most users, the downside could be in say a years time when maybe some more stuff has been put into each target and then it becomes slightly more cumbersome to keep things synced... But saying that I agree the approach now as you say is conservative and practical until you really know how people will use it!


marksibly(Posted 2012) [#29]
I've had a hack at factoring out more and I think I should be able to improve things considerably.

Probably wont be an update today now though!

You can manually fix the reflection bug by changing line 165 of transcc.monkey to...

monkeydir=RealPath( ExtractDir( AppPath )+"/.." )

...and recompiling trans.


jondecker76(Posted 2012) [#30]
woohoo! I'm so psyched that Linux support is finally in! I've had monkey on the backburner all year waiting for this (i simply despise using Windows, and never cared for having to patch things in manually every update to have linux support or even using a modified version of monkey)! Thanks Mark!


devolonter(Posted 2012) [#31]
Nice update! I'll research new target system this weekend. Thanks Mark!


jondecker76(Posted 2012) [#32]
Just did some testing on Ubuntu 12.10. Everything I tested ran beautifully on the HTML5 target :)

Now to test out GLFW and Flash compiling from linux!


AdamRedwoods(Posted 2012) [#33]
Darn, no CC_OPTS in stdcpp yet.


Sammy(Posted 2012) [#34]
Darn, no CC_OPTS in stdcpp yet.
+1 on that. :(

But the rest of this update update is great, Mark puts my productivity level to shame! :P


slenkar(Posted 2012) [#35]
YO,

the fix worked, I deleted the build folder and..


Monkey Runtime Error : ReferenceError: Game is not defined

in both html5 and mingwglfw

BUT I am using Mojo

Also , how do I set which browser MServer uses in Linux?

Its an environment variable right? so its Export...something

The error of Game is not defined doesnt happen in Linux strangely


therevills(Posted 2012) [#36]
Thanks for the reflection fix Mark :)

Heres the updated transcc_winnt.exe if anyone wants it:
https://dl.dropbox.com/u/35103024/transcc_winnt.exe

Everything seems okay, apart from Diddy's externs and (now) duplicate methods (eg HideMouse).


dragon(Posted 2012) [#37]
I found a issue:

i use a full white png-image with alpha channel...
But compilied as Win8 for Desktop, i get black border around my image-objects.

I think that full transparent pixels are black on Win8 - and this should not happen...

I do not have this issue on XNA, Glfw, Flash, Html


I was not able to test Win8-Phone (i have none and emulator do not work for me)


slenkar(Posted 2012) [#38]
Just tried the breakout sample and got the same message:
Monkey Runtime Error : ReferenceError: Game is not defined

in flash:
C:\Documents and Settings\Owner\My Documents\Downloads\MonkeyPro67a\Monkey\bananas\ferdi\breakout\breakout.build\flash\MonkeyGame.as(2542): col: 8 Error: Call to a possibly undefined method Game.


therevills(Posted 2012) [#39]
I just tried the breakout demo and it works fine in Flash here on Win8.


MikeHart(Posted 2012) [#40]
Is Millisecs() on HTML5 now returning the OS-Time instead the time the app is running?


therevills(Posted 2012) [#41]
Is Millisecs() on HTML5 now returning the OS-Time instead the time the app is running?

It is different...

Old: [monkeycode]return ((new Date).getTime()-this.startMillis)|0;[/monkeycode]
New: [monkeycode]return ((new Date).getTime())|0;[/monkeycode]
And just checked Android (Java) and Flash, it looks like it is the same.

GLFW (C++) and XNA (C#) only returns 0...


AdamRedwoods(Posted 2012) [#42]
C:\Documents and Settings\Owner\My Documents\Downloads\MonkeyPro67a\Monkey\bananas\ferdi\breakout\breakout.build\flash\MonkeyGame.as(2542): col: 8 Error: Call to a possibly undefined method Game.

make sure to delete the old ".build" folder.


slenkar(Posted 2012) [#43]
Im compiling from the downloaded bananas folder, so there are no build folders in there.

:its a mystery:


jondecker76(Posted 2012) [#44]
Has anyone had a go at compiling projects for Android or Flex/flash on Linux?


Soap(Posted 2012) [#45]
>***** PSM issues *****

I managed to get the attention of someone at Sony and they will hopefully be contacting you at the e-mail you have listed on your profile soon.


Tibit(Posted 2012) [#46]
Cool update!

I'd love to hear how to think about the TARGET system from a user-prespective?

For example, I want Chartboost in my game. I make a Chartboost target or find someone elses chartboost target. I now use this target instead of the standard iOS?

What if I want to also use someone elses GameCenter ios target at the same time?

Or do I create a third Target in this case where I manually meld that Chartboost target and the GameCenter integration?

Or did I get this all wrong? :)

And how to think when developing such target specific "extensions" for easy integration by others?


Xaron(Posted 2012) [#47]
I just tried to submit an app for the WP8 store, but I get the following errors:


The Xap Processing for the package failed. Please refer to this page for troubleshooting information

Validation errors

1028: The native API api-ms-win-core-interlocked-l1-2-0.dll:InterlockedIncrement() isn’t allowed in assembly Sea Battle.exe. Update it and then try again.

1028: The native API api-ms-win-core-interlocked-l1-2-0.dll:InterlockedDecrement() isn’t allowed in assembly Sea Battle.exe. Update it and then try again.

1028: The native API api-ms-win-core-debug-l1-1-1.dll:OutputDebugStringA() isn’t allowed in assembly Sea Battle.exe. Update it and then try again.

3009: The entry point for the application specified in the image path attribute on the default task in the manifest is invalid or missing. It should point to an .exe located at the root.



It runs fine in the emulator though.


marksibly(Posted 2012) [#48]
Hi,


For example, I want Chartboost in my game. I make a Chartboost target or find someone elses chartboost target. I now use this target instead of the standard iOS?



Yep.


What if I want to also use someone elses GameCenter ios target at the same time? Or do I create a third Target in this case where I manually meld that Chartboost target and the GameCenter integratio



In general, that's about right - ie: you'd (probably) create a ios_gamecenter_chartboost target. But it depends on how gamecenter/chartboost work. Where possible, it's best to use modules - and it'll become 'more possible' as more features for importing stuff are added to trans.

But I doubt it'll ever be 100% possible to use monkey without having to resort low level trickery every now and then, and the new target system is kind of an attempt to 'localize' this messy stuff - ie: any weird interactions that gamecenter/chartboost may have on each other or with the global view controller or dispatch of touch events or the app delegate etc etc can all (hopefully) be dealt with in the gamecenter_chartboost target.

> I just tried to submit an app for the WP8 store, but I get the following errors:

Do you get the same errors if you use 'PROJECT->Open Store Test Kit->Automated Tests'?

I get the OutputDebugStringA error (which I can then fix by commenting out OutputDebugString in MonkeyGame.cpp) but none of the others.

What errors do you get on this page?

How about with bouncyaliens?


Xaron(Posted 2012) [#49]
Thanks Mark, will check that!

I guess I've used the wrong platform target anyway (Win32 instead of ARM).

But, using ARM as target I get a compiler error, not only with my project but with the bananas (I used Angelfont here), too.


cl : command line error D8048: C-File 'stb\stb_image.c' cannot compiled with option /ZW.



(Sorry that's not the exact message as I've translated it from German to English. Have to install the english language package for VS12...)


Xaron(Posted 2012) [#50]
Ok, I just tried a clean and fresh install of all tools (Monkey, VS 2012, WP8 SDK).

I compiled BouncyAlien, no problem.
I started VS12 using the created solution and rebuilt it there (Release, Win32)


I can run it in the emulator.

Then I tried to submit it to the store. I get the following:




Xaron(Posted 2012) [#51]
Then I thought, well Win32 can't be the right thing and switched to ARM.

It doesn't even compile then:



Sorry for the German VS version, I can't switch it to English, that's only possible in the professional+ version. Hmpf...


Rone(Posted 2012) [#52]
because of InterlockedIncrement:

http://msdn.microsoft.com/de-de/library/windows/desktop/ms683614(v=vs.85).aspx

Note This function is supported on Windows RT-based systems.


http://msdn.microsoft.com/en-us/library/windows/desktop/hh802935(v=vs.85).aspx#mincore

Maybe we need to link MinCore.lib?


Xaron(Posted 2012) [#53]
Maybe CopperCircle can bring some light into this? At least he was able to compile and deploy to a RT device. Don't know how though...


Ironstorm(Posted 2012) [#54]
Try the following steps:

1) Disable "Enable Windows Run Time Extensions" for the file stb_image.c. You can do so via right-click -> Properties on "stb_image.c". In the Property Pages dialog, navigate to C/C++ -> General, and look for "Enable Windows Run Time Extensions".
Also navigate to Precompiled Header and set this one to "Don't use precompiled header".

2) Right-click on the file "MonkeyGame.cpp" and "pch.cpp" -> Properties. Navigate to C/C++ -> Precompiled Header and set the Precompiled Header to "Create /Yc".

Now we have to specific additional library for the audio part.

3) Last but not least. Project Properties in Linker -> Input -> Additional Dependencies. Add to this list the following two libs:

Mfplat.lib
Xaudio2.lib

Now you should able to compile for ARM. Please, let me know if you got it working.


Ironstorm(Posted 2012) [#55]
Oh and on line 1390 just comment "OutputDebugStringA" as mark mentioned.

With these steps i can upload the bouncyalien XAP to the store without errors.


SteAbra(Posted 2012) [#56]
Thanks Ironstorm. Solution is working on my HTC 8s - Windows 8 Phone. Cool!


CopperCircle(Posted 2012) [#57]
@Xaron I compiled and deployed FirePaint to my Surface RT no probs... havent had chance to try other things yet.


CopperCircle(Posted 2012) [#58]
I just compiled another app im working on and it fails to build if the project is in my Dropbox, copied it to the Desktop and its built and deployed fine.


EdzUp(Posted 2012) [#59]
One thing that I would love to see implemented is simply compiler directives that control the outputted code for example on HTML5 we could tell trans via compiler directives that are at the top with Strict etc to set the resolution to 1024 by 768 for example instead of having to edit the HTML and javascript every time.

A simple
#IF TARGET=HTML5
   #SET_RESOLUTION=1024,768
#END


This would allow the coder to have more control over the outputted code and all trans would have to do is parse the directives given a certain platform and not compile them in the final source.

There could be loads of things that could be added as directives, this would also make Monkey completely automatic on its generation without having the user keep fluffing around with accessing javascript files or build config files as these could all be controlled by simple calls in the header of the main source file.


AdamRedwoods(Posted 2012) [#60]
set the resolution to 1024 by 768 for example instead of having to edit the HTML and javascript every time.

+1, I agree, and it's not hard to do. GLFW, XNA already do it:
GLFW_WINDOW_WIDTH:Int=640
GLFW_WINDOW_HEIGHT:Int=480



therevills(Posted 2012) [#61]
for example on HTML5 we could tell trans via compiler directives that are at the top with Strict etc to set the resolution to 1024 by 768 for example instead of having to edit the HTML and javascript every time.


You can extern a set resolution command pretty easily yourself, Diddy has the command SetNativeGraphicsSize and it works for GLFW and HTML5. But yes it would be nice if it was part of Mojo.


frank(Posted 2012) [#62]
Has anyone been able to get the toolchain (compiler/server etc) running on ARM ? Is it even possible? Ted compiles and works for me, but the rest... So now I can edit Monkey code but not compile / test it :)

(I code on my Openpandora on the road a lot and it would be great if Monkey is an option there...)


Xaron(Posted 2012) [#63]
Have you tried 67b? For 67a there is a solution in this thread.


frank(Posted 2012) [#64]
Ah I see I posted in the wrong thread :( Sorry. Shame there is no delete button here.