Monkey v70f now up! [MONKEY NEWS]

Monkey Forums/Monkey Programming/Monkey v70f now up! [MONKEY NEWS]

marksibly(Posted 2013) [#1]
Hi,

I've just uploaded V70f to the 'experimental' section.

It's hopefully fairly mature...well, it would be if I hadn't added a few 'big ticket' features along the way. In particular, the translator now does a better job of auto detecting what's virtual/final etc, which allows for some nifty C++/C/Java optimizations. This was kind of simple to implement and works fine with everything I've tested so far, but it's the kind of tweak that will affect A LOT of code so it's hard to say with absolute certainty that no one will experience any problems. Actually, looking at VERSION.TXT belong, I've added a LOT of 'not strictly necessary for a minor version bump'! Which leads me to...

So when will V70 become stable? And when's V71 happening? My fault - I should have been making more 'hotfixes' (important fixes to a release version) to releases lately, but I've been a bit lazy in that respect, probably because I'm used to doing hotfixes 'manually' (ie: you just fix both the release and current versions by hand!) which has tended to make me avoid hotfixes altogether. However, git has a very cool way of handling hotfixes which I plan to try out soon, so hopefully V70G will be *it*!

There's also a little demo of a simple 'module manager' in this release. To try it out, you'll need to build/run src/modman/modman.monkey in glfw mode. Some notes:

* It's really just a simple driver for hg/git checkout/update ops. hg and/or git must be in your PATH for it to work.

* One repos=one top-level module.

* The repos list is hardcoded into modman.data/repost_list.txt.

* It doesn't handle the built in modules or the monkey package itself in any way.

* It looks for a 'modules_ext' dir in your bin/config file MODPATH to install/update modules to. I've added a default ${MONKEYDIR}/modules_ext path to MODPATH, but feel free to change this to ${SYSTEMDRIVE}/modules_ext or whatever.

Lots to be improved on and I want to give it a tidy up before general release, but I think it's pretty cool! If you've got any modules you'd like added to the repos list, please let me know here.


HttpRequest: Merged devolonter's html5 version addition.

Ted: Console utf8 friendlier.

C++ lang: Print outputs utf8.

Url: Fixed default scheme/port issue.

ios target: Fixed admob not building problem.

MServer: Fixed content type for wav files confusing Firefox.

Android: Fixed ANDRIOD_VERSON_NAME in target config.txt.

Trans: Added debug index checking for String[blah] exprs to cpp/js/as.

Mojo: Added experimental DrawPoly overload with textured image (vertex format is x,y,u,v) - undocced and only available on glfw, ios, android, win8.

Trans: Improved detection of virtual/final etc methods for C++, C# and Java translators.

Trans: Fixed float Mod op bugs.

FileStream: Fixed c++ "u" mode, added "a" for append.

IosGame: Fixed weird virtual keyboard bug.

Ted/Makedocs: Added Alias keyword.

Mojo: Fixed flash LoadState bug.

Mojo: Added Siread's magic ios code for mixing game audio with user music.

Trans: Fixed String(0)<>"0" bug.

Mojo: Fixed win8 DrawLine bug.

Makedocs: Fixed issue with camelCase module names.

Makedocs: Now searches all modules in MODPATH in bin/config.blah.txt files.

Ted: Tweaked win32 proc killer to detect cycles in procs.




AdamRedwoods(Posted 2013) [#2]
some nifty C++/C/Java optimizations

Added experimental DrawPoly overload with textured image

hot


Amon(Posted 2013) [#3]
Cool, thanks!


Paul - Taiphoz(Posted 2013) [#4]
nice. thanks.


Supertino(Posted 2013) [#5]

some nifty C++/C/Java optimizations



So on the ground is this going to make our apps noticeably faster? OR we talking about a 1-3% improvement? Needs bench-marking I guess.


Erik(Posted 2013) [#6]
Bug:
MouseX / MouseY don't get updated on Windows 8 unless you press the mousebutton.


marksibly(Posted 2013) [#7]
MouseX and MouseY are currently only emulating touch on win8 - will add mouse support soon.


Soap(Posted 2013) [#8]
Mark, I've said this a lot, but I think it can't be said enough. Thank you for working so hard on updates and improving Monkey. As long as Monkey is what I need (and I don't see anything else out there replacing it), I'll do everything I can to support you. To me that means buying more licenses and telling everyone I think would be interested about it. Will do both more in the continuing future!


semar(Posted 2013) [#9]
I definitely agree.

Simply said: Thanks Mark for your effort :)

A *very* happy Blitz and Monkey user.

Sergio.


Rone(Posted 2013) [#10]
Hey Mark,
please have a look at my windows 8 networking stuff, for full support of brl.tcpStream in WinRT and Windows Phone 8 apps ... it's really easy to adapt it

https://github.com/sascha-schmidt217/win8
https://github.com/sascha-schmidt217/pbnet-monkey


Xaron(Posted 2013) [#11]
I second that, please integrate that as well Mark!


marksibly(Posted 2013) [#12]
> please have a look at my windows 8 networking stuff,

Nice work! You certainly seem to have the hang of this new fangled winrt stuff better than I do...

But it doesn't look like brl.tcpstream - ie: it's not synchronous. It wont block if you try and read a socket without any data on it, and I'm not sure what will happen if you try and write a 'full' socket.

I've got a synchronous version in the works (it's commented out in tcpstream.cpp I think) which *almost* works and is designed to work synchronously - and also therefore asynchronously when used on a thread. Yes, it's a bit weird wrapping an async stream to make it sync, just so it can be made async again by using it on a thread(!) but, for better or worse, the basic 'contract' of tcpstream is it's synchronous.

A few other questions about your code:

* It looks like streamsocket allocates a databuffer on a different thread/task - this could be dangerous!

* Only streamsocket seems complete - what does streamsocketlistener do? How does it handle multiple connections?

* I really like the 'websocket' SendMessage/ReceiveMessage paradigm, which is pretty much what you've got there. But I think it's a bit harder than this with tcp, as tcp 'messages' can get fragmented so you may need to reassemble them. Ie: if one host sends a message of N bytes, another should expect to receive a message of N bytes too. Not sure if tcp can guarantee this (perhaps winrt Sockets do though?). tcp generally just guarantees all the bytes will get there 'eventually'. I do want to add a kind of universal 'websocket' module eventually though, and your code could be useful for that.


Nobuyuki(Posted 2013) [#13]

Ted: Console utf8 friendlier.

C++ lang: Print outputs utf8.



Excellent, this should make debugging some unicode things a bit easier.


Rone(Posted 2013) [#14]
>> But it doesn't look like brl.tcpstream - ie: it's not synchronous.

Yes, it's just a plain windows.networking wrapper...using callbacks. But the callbacks are called in the main thread, using a dispatcher...

void OnMessageReceaved(BBDataBuffer* buffer)
	{
		dispatcher->RunAsync( CoreDispatcherPriority::Normal, 
				ref new Windows::UI::Core::DispatchedHandler([this,buffer] ()
				{
					ON_MESSAGE_REVEAVED(buffer);
				}));
	}


My win8 pbnet-monkey's BBTcpSocket implemetation is synchronous and looks pretty much like brl.tcpstream.
Just a little inefficient by reading/writing per byte into a ringbuffer...
https://github.com/sascha-schmidt217/pbnet-monkey/blob/master/src/pbnet/core/native/tcpsocket.win8.cpp

>> Only streamsocket seems complete - what does streamsocketlistener do?

StreamSockertLister is used for server and StreamSocket is used for clients...
You've got me stumped....I looked at it only once, a few month ago...One forgets this new junk again quickly when you do not work more with :\

>> How does it handle multiple connections?

http://code.msdn.microsoft.com/windowsapps/StreamSocket-Sample-8c573931
http://msdn.microsoft.com/en-US/library/windows/apps/windows.networking.sockets.streamsocketlistener#methods

The StreamSocketListener class supports listening for an incoming network connection using a TCP stream socket and accepting the connection.
The typical order of operations is as follows:
Create the StreamSocketListener.
Use the Control property to retrieve a StreamSocketListenerControl object and set the socket quality of service required.
Assign the ConnectionReceived event to an event handler.
Call the BindServiceNameAsync or BindEndpointAsync method to bind to a local TCP port or service name.
When a connection is received, use the StreamSocketListenerConnectionReceivedEventArgs object to retrieve the Socket property with the StreamSocket object created.
Use the StreamSocket object to send and receive data.
Call the Close method to stop listening for and accepting incoming network connections and release all unmanaged resources associated with the StreamSocketListener object. Any StreamSocket objects created when a connection is received are unaffected and can continue to be used as needed.


You're right - StreamSocketListenerConnectionReceivedEventArgs::Socket is not wrapped

>> It looks like streamsocket allocates a databuffer on a different thread/task - this could be dangerous!

hmm...don't know. But it will only accessed in the main thread. The synchronous pattern makes things easier...


Trion(Posted 2013) [#15]
Mark - its awesome! Keep doing it :) I am counting on monkey ;)


Xaron(Posted 2013) [#16]
And I'm counting my money. LOL ;)

I've submitted my first Windows phone 8 app as well with Monkey 70f. Fingers crossed!


SLotman(Posted 2013) [#17]
HttpRequest isn't implemented on Win8? This may be the cause of the bugs I'm writing about here.

So, I have a few suggestions/requests:

1) *Please* put List.Remove back. Having to do it by hand on every release will be a pain! I just added on list.monkey this, after RemoveFirst:
Method Remove:Void( value:T)
   RemoveFirst(value)
End

The reason? Compatibility with BMax TList. I've been coding around monkey, so I can get my Monkey-code, throw it on blitzmax, change just a few things and hit 'compile'. Renaming "List" to "TList" is one of those things!


2) On GLFW target, on mojo.glfw.cpp, change the DrawOval code to this:
n=(int)( fabs( xr ) + fabs( yr ) );
- by changing abs(xr) + abs(yr) to fabs, you get rid of the warning MingW shows every time this is compiled.


3) Still on GLFW, on glfwgame.cpp make OnKey, OnChar, OnMouseButton, onMousePos, onWindowClose public, not protected. Having access to all of this outside, enables to switch from window to fullscreen!


4) Still on GLFW (lol!), on glfwgame.cpp, please add those lines on TransKey:
	case GLFW_KEY_LALT:return VKEY_LALT;
	case GLFW_KEY_RALT:return VKEY_RALT;

Yes, I also use this to check for ALT+ENTER, so I can switch from window to fullscreen anytime I want.


marksibly(Posted 2013) [#18]
> *Please* put List.Remove back

Yes, I will restore it (was supposed to) but it will call RemoveEach as it used to, not RemoveFirst.

As for your glfw target changes, I recommend you make a custom target - or perhaps even submit changes to the github repos.


SLotman(Posted 2013) [#19]
To create a custom target... I just have to copy the glfw folder and rename it to something else (Plus changing the 'TARGET.MONKEY' inside it, to have another target name)?

It appears to be working here, I just want to know if that's all it takes :)


Shagwana(Posted 2013) [#20]
Hi, thought you might like to know that in the new help files, some of the examples showing how to use generic classes, the < and > is showing as &lt; and &gt; respective.

Makes the examples not work!


CopperCircle(Posted 2013) [#21]
Hi, I have just tried V70f and noticed DisableKeyboard no longer works?! Try the keyboardtest on iOS...


marksibly(Posted 2013) [#22]
> To create a custom target... I just have to copy the glfw folder and rename it to something else (Plus changing the 'TARGET.MONKEY' inside it, to have another target name)?

Yep, that's it. You can then mess with any glfw target/lib code independently.

> Hi, thought you might like to know that in the new help files, some of the examples showing how to use generic classes, the < and > is showing as &lt; and &gt; respective.

Thanks! Will fix...

> Hi, I have just tried V70f and noticed DisableKeyboard no longer works?! Try the keyboardtest on iOS...

Expletive! Will fix ASAP...


marksibly(Posted 2013) [#23]
Ok, fix for ios DisableKeyboard is here:

https://github.com/blitz-research/monkey/blob/develop/targets/ios/modules/native/iosgame.cpp


SLotman(Posted 2013) [#24]
Mark, thanks for the help! So just to let you guys know, this is my first Monkey released game: https://play.google.com/store/apps/details?id=com.icongames.alcatraz

Now off to try it on iOS :)
(Not right now, too many stuff for University to be done this week)


therevills(Posted 2013) [#25]

Cool! Submit it to the app section of this site: http://www.monkeycoder.co.nz/Apps/submit_app.php

I've just had a quick play and it plays well... although a bit frustrating that if you get things wrong you have to start from the very beginning again.


CopperCircle(Posted 2013) [#26]
Thanks Mark :)


SLotman(Posted 2013) [#27]

I've just had a quick play and it plays well... although a bit frustrating that if you get things wrong you have to start from the very beginning again.


Thanks for trying it out! :)

As for the frustrating part, you can always save the game (pause->save game) so you don't have to start over if you make a big mistake, like not bribing the prison guard :)


golomp(Posted 2013) [#28]
Thank you Mark !


Shagwana(Posted 2013) [#29]
Dont know if you are aware but v71a is out