Diddy

Monkey Forums/Monkey Programming/Diddy

therevills(Posted 2011) [#1]
We've started an open-source code base which adds extra functions to Monkey.

Currently Diddy (as in Diddy Kong ;)) has the following:

* New Commands (tested on most platforms, apart from iOS and Mac):
- FlushKeys()
- RealMillisecs()
- ShowMouse()
- HideMouse()

* Screen-based Framework
- Move between screens with fading

http://code.google.com/p/diddy/


Samah(Posted 2011) [#2]
Recently added:
First revision of a feature-rich Collections framework. So far ArrayList is implemented, but LinkedList is next on the agenda.


slenkar(Posted 2011) [#3]
thanks


pinete(Posted 2011) [#4]
great! :)


therevills(Posted 2011) [#5]
Update:

* Sprites/Particles
* Particle Example
* Sound Manager
* Animation Example
* Sound Example
* InputCache module


Samah(Posted 2011) [#6]
Update:

* Tweening Module
* Quicksort for ArrayLists


Loofadawg(Posted 2011) [#7]
I don't see these in the actual package http://code.google.com/p/diddy/

Update:

* Sprites/Particles
* Particle Example
* Sound Manager
* Animation Example
* Sound Example
* InputCache module


Things to come?


therevills(Posted 2011) [#8]
in the actual package


Package? You mean the download zips? Yeah, the zips are outdated - all the source is there though...

Things to come?


Samah said hes going to do a particle engine with emitters...

I think Ill add a tile engine or something...

[Edit]Just added a zip with all current updates in.[/Edit]


Loofadawg(Posted 2011) [#9]
Yeah, zips :)

I was interested in viewing the sprite, particle, and animation examples but didn't see them in the testapp.


Wagenheimer(Posted 2011) [#10]
How can I do the examples find out the src folder?


therevills(Posted 2011) [#11]
Theres a couple of ways to do it, but the fastest way is just to copy the diddy folder to your Monkey Module folder, eg:

C:\BlitzMonkey\MonkeyPro36\modules\diddy


pinete(Posted 2011) [#12]
congratulations ;) I've been dealing with it just some minutes and seems great!


Samah(Posted 2011) [#13]
Due to Monkey's issues with shared module naming, I had to get rid of the "list" module. All the collections stuff has been shifted into collections.monkey. This means you only have to "Import diddy" now.

Edit: If you have any problems or suggestions for Diddy, raise them here!
http://code.google.com/p/diddy/issues/list


slenkar(Posted 2011) [#14]
just out of interest, why are you creating collection types?


therevills(Posted 2011) [#15]
why are you creating collection types?


Extra functionality, more options, sorting etc :)


muddy_shoes(Posted 2011) [#16]
I'm curious as to why you chose the LGPL as your license for Diddy. It's hard to see how to comply with the license bearing in mind the way that Monkey works.


Samah(Posted 2011) [#17]
Which license would you have suggested? I was against the GPL because I hate the restrictions it places on you regarding commercial reuse.
We can always change the license later pending community suggestions.


muddy_shoes(Posted 2011) [#18]
BSD or MIT would seem better options if you're happy for anyone to use the library as they wish. Neither attach restrictions about the end user being able to alter or replace the library in any final product as the LGPL does.


therevills(Posted 2011) [#19]
Changed to the MIT license - thanks muddy_shoes


Canardian(Posted 2011) [#20]
zlib is also a good license, and public domain of course.
I think the difference between zlib and MIT is, that in zlib you are not allowed to say that you wrote this software if someone else wrote it.
So it's kinda like saving the creator's ownership and patent rights.


slenkar(Posted 2011) [#21]
could you create a list that doesnt crash the program when you try to use eachin, when its null?


Samah(Posted 2011) [#22]
could you create a list that doesnt crash the program when you try to use eachin, when its null?

ArrayList should already support null elements (I'll have to test it), but sorting will probably fail at the moment. Next check-in for collections.monkey will include a double-ended queue and a fix for DefaultComparator to handle nulls.


slenkar(Posted 2011) [#23]
diddy seems to be able to sort Ints in a list but what about sorting objects by one of their fields?


Samah(Posted 2011) [#24]
diddy seems to be able to sort Ints in a list but what about sorting objects by one of their fields?

Create your own comparator class so that you can tell the ArrayList how to sort it.



You should get this output:

Before sort
x,y=0,10
x,y=0,5
x,y=0,6
x,y=0,1
x,y=0,11
After sort
x,y=0,1
x,y=0,5
x,y=0,6
x,y=0,10
x,y=0,11



okee(Posted 2011) [#25]
Any ideas why i'm getting errors when compiling for flash on v37


C:\MonkeyPro37\bananas\diddy\Framework\testFramework.build\flash\MonkeyGame.as(1126): col: 4 Error: Access of undefined property bb_input_device.
bb_input_device.keyStates[i]=0;
^
TRANS Failed to execute 'mxmlc -static-link-runtime-shared-libraries=true MonkeyGame.as', return code=1





Samah(Posted 2011) [#26]
It's to do with a change Mark made in v37 to the naming of some of the modules/classes to remove underscores. This is fixed in the latest diddy source, which you can take straight out of the repository if you don't want to wait for another zip build.

You can grab the latest flash native source from here:
http://diddy.googlecode.com/svn/trunk/src/diddy/native/diddy.flash.as


okee(Posted 2011) [#27]
Thanks that fixed all the examples bar 1, the collections example


C:\MonkeyPro37\bananas\diddy\Collections\testCollections.build\flash\MonkeyGame.as(286): col: 4 Error: Access of undefined property bbinputdevice.
bbinputdevice.keyStates[i]=0;
^
TRANS Failed to execute 'mxmlc -static-link-runtime-shared-libraries=true MonkeyGame.as', return code=1





therevills(Posted 2011) [#28]
Fixed ;)

http://code.google.com/p/diddy/source/browse/trunk/examples/Collections/testCollections.monkey?spec=svn54&r=54

The problem was that the FlushKeys needs the Mojo module and the collection example didnt use Mojo at all...


jjsonick(Posted 2011) [#29]
therevills, do you plan to add a virtual resolution/auto-fit feature to Diddy? (please say yes) :)


therevills(Posted 2011) [#30]
virtual resolution/auto-fit feature to Diddy


In r60 I added support for a virtual resolution with the mouse x,y...

Im not sure whether to add it directly to Diddy, due to what if the user wants to use the native res and all the matrix pushing and poping...

Currently Im doing the following in my game:

Define the width and height I want for the game:
Strict

Import mojo
Import diddy

' Mobile phone screen size
Const WIDTH#=480
Const HEIGHT#=320


Set the SCREENX_RATIO and SCREENY_RATIO:
Class MyGame extends DiddyApp

	Method OnCreate:Int()
		Super.OnCreate()

		SCREENX_RATIO = SCREEN_WIDTH/WIDTH
		SCREENY_RATIO = SCREEN_HEIGHT/HEIGHT


And when rendering:
Class SplashScreen Extends Screen
	Method Render:Void()
		PushMatrix 
			Scale SCREENX_RATIO, SCREENY_RATIO
			DrawImage bg, 0, 0
		PopMatrix
	End


Of course this could be quickly added to Diddy... Ill have to think about it...


jjsonick(Posted 2011) [#31]
Thanks for the example code!

For adding it to Diddy, could it possibly be optional? Would it mess things up to have that matrix pushing and popping toggled by a variable (VIRTUALON or somesuch) in the Render method of Screen?


therevills(Posted 2011) [#32]
Okay Virtual Resolution support added to Diddy :)

In your app set the screen size:

Class MyGame extends DiddyApp

	Method OnCreate:Int()
		Super.OnCreate()
		SetScreenSize(480, 320)


And when rendering your screen you dont need to do anything:
Class SplashScreen Extends Screen
	Method Render:Void()
		DrawImage bg, 0, 0
	End


Added flag: virtualResOn:Bool


jjsonick(Posted 2011) [#33]
Great - thanks! :)


therevills(Posted 2011) [#34]
No problem :)

BTW Samah is currently working on a GUI system which looks pretty cool. Im working on my game and adding stuff to Diddy when I need them for my game.

Would love to see what you guys are using Diddy for.


Samah(Posted 2011) [#35]
The GUI's coming along alright, but again it's difficult without interfaces. It's hard to write an event-based system without some kind of function pointer or callback. The event forwarding method I'm using should work alright. Once it's in a releasable state I'll work on some documentation.


Dabz(Posted 2011) [#36]
First time I played with this today... Nice work therevills and Samah! :)

Dabz


therevills(Posted 2011) [#37]
Glad you like it Dabz :)

Now if you could make payment of the $1,000,000 license fees payable by cash only it would be appeciated :P


Dabz(Posted 2011) [#38]

Now if you could make payment of the $1,000,000 license fees payable by cash only it would be appeciated :P



Ah damn, you should of said earlier... Laura's now spent it on cushions, candles, boxes *grumble grumble*

Seriously, I have enough cushions in my house that'll bounce a Boeing 747-8 if it crash landed on them... And don't mention them smelly candle things , she burns that many on a night the neighbors must think we're pagens and religiously slaughter goats as soon as the Sun starts dropping into the horizon!

Boxes... {rant}

Dabz


Dabz(Posted 2011) [#39]
Cannot build on iOS, I know it isnt offically tested, but, with that failing, well... That buggered me!

Really felt this would save me a bit of grief, never mind eh! ;)

*Sleeves... rolled*

Dabz


therevills(Posted 2011) [#40]
Well Dabz, now its your time to serve Diddy :)

What error are you getting? Im guessing it the "new" commands which is causing the issues...

Can someone with access to iOS please also test Diddy.


Dabz(Posted 2011) [#41]
I'm off on me jollys (3.26am here)... Will get back to you! :D

Dabz


therevills(Posted 2011) [#42]
Installing Snow Leopard, so hopefully it'll be fixed when you get back. Enjoy your holidays :)


Xaron(Posted 2011) [#43]
I'd love to see networking in Diddy. ;)


therevills(Posted 2011) [#44]
I'd love to see networking in Diddy. ;)


Yeah me too... :P


therevills(Posted 2011) [#45]
@Dabz

Ive made the changes to get Diddy compiling for iOS... ensure you import mojo before importing diddy.

Update the diddy.ios.cpp to look like this:

http://code.google.com/p/diddy/source/browse/trunk/src/diddy/native/diddy.ios.cpp?spec=svn72&r=72


Samah(Posted 2011) [#46]
*double post*


Samah(Posted 2011) [#47]
Diddy now has a very simple serialization module, using skn3's config example. At the moment it only stores as a ConfigNode, and doesn't export to text. It'll use a full xml parser/writer once I get my hands on one (or even write one).
Note: Due to Serializable being an interface, it requires v39.
If you want to use it with v38, change the interface to a class and extend it instead.

You'll need to check out the latest source for Diddy until we put up another snapshot.

If you want to make a class serializable, you need to do the following:
* Implement the Serializable interface
* Create a default constructor to initialise your fields with default values rather than in their declarations (important!)
* Create a constructor that accepts a Serializer and initialise your fields from that.
* Serialize() should write all your fields to the Serializer.
* GetClassName() should return the name of the class as a string
* GetGenericNames() should return an empty array as it is currently unsupported.
* Extend the Serializer class and implement the abstract method CreateSerializable(). It should instantiate classes based on the class name passed in, using the New(Serializer) constructor.

Usage:
Class MyClass Implements Serializable
  Field intField:Int

  Method New()
    intField = 3
  End

  Method New(serializer:Serializer)
    intField = serializer.ReadInt("intField")
  End

  Method Serialize:Void(serializer:Serializer)
    serializer.Write("intField", intField)
  End

  Method GetClassName:String()
    Return "MyClass"
  End

  Method GetGenericNames:String[]()
    Return []
  End
End

Class MySerializer Extends Serializer
  Method CreateSerializable:Serializable(className:String)
    If className = "MyClass" Then Return New MyClass(Self)
    Return Null
  End
End

Function Main:Int()
  ' create a serializer
  Local ser:MySerializer = New MySerializer
  ' create a test object
  Local testobj:MyClass = New MyClass
  ' serialize the object to a ConfigNode
  Local node:ConfigNode = ser.SerializeObject("testobj", testobj)
  ' deserialize the object back to a new instance of MyClass with the same fields as the original
  Local newobj:MyClass = MyClass(ser.DeserializeObject(node))
  Return 0
End


*Edit: Fixed compile error.


matt(Posted 2011) [#48]
Are you guys accepting suggestions for features?

I'd love to see a super-simple touch/swipe/gesture handler.


slenkar(Posted 2011) [#49]
thanks for the serialization


Soap(Posted 2011) [#50]
Am I missing something or does Diddy's GUI system just doesn't deal with Virtual Resolutions? It breaks down when I set the TestGui example's SetScreenSize to anything other than the device's resolution.

Even so, how does Diddy handle getting an accurate touch/mouse position across all device sizes with Diddy's virtual resolutions?


therevills(Posted 2011) [#51]
@Matt... of course we are accepting suggestions - it might take awhile to actually doing anything with it though :P

@Soap... Just fixed and committed an update to GUI.monkey, the SetScissor command needed to take the ratio into account.

Diddy has two variables for the mouse position (game.mouseX, game.mouseY), as long as you use these you wont have any issues.


therevills(Posted 2011) [#52]
FYI: Diddy currently only works with Monkey v38.

v39(b) has some generic issues and the generated code has underscores back so FlushKeys etc will not work (this is an easy fix).

Once the generic issues has been fixed, we'll update Diddy.


Soap(Posted 2011) [#53]
Ah thanks. :)


Cheese(Posted 2011) [#54]
Excellent work with this module, I enjoy using it very much so far. I also second Xaron's thoughts for networking.

Once the generic issues has been fixed, we'll update Diddy.

Does that explain why I can't seem to find the example for using the GUI classes? o.0


therevills(Posted 2011) [#55]
Does that explain why I can't seem to find the example for using the GUI classes


There is an example of the GUI, if you downloaded the latest zip it only included source code for the module not the examples.


Cheese(Posted 2011) [#56]
@therevills

Existing along side the zip for the 11.05.20 version, the 11.05.06 version was the only zip with examples at the time, which didn't contain a GUI example. If I'm not mistaken, they were the only two downloads available.

Thanks for posting the updated examples! I'll be sure to make good use of them.

EDIT: The 11.05.22 GUI example appears to be very incompatible with 11.05.20.. Looking forward to the update after Monkey's issues are resolved.


Samah(Posted 2011) [#57]
Just added an XML module to do simple XML parsing. At the moment it only reads from a string, so you can just use Monkey's LoadString to read from a .xml file.
Local parser:XMLParser = New XMLParser
Local doc:XMLDocument = parser.ParseString(someXMLString)

The root node is doc.root, you use attributes with GetAttribute/SetAttribute, and you can get the children, parent, and name using the Children, Parent, and Name properties respectively.

It skips any <? ?> instructions, as well as <!-- --> comments. Please try to make your documents as well-formed as possible!


Hima(Posted 2011) [#58]
Diddy fail on GLFW target with V40. Seems like "app" and "ShowCursor" are missing

In file included from ../glfw/include/GL/glfw.h:163,
                 from /Users/Hima/DevTool/Monkey/OtherSamples/DiddyExample/examples/VirtualRes/virtual.build/glfw/xcode/../main.cpp:6:
/Developer/SDKs/MacOSX10.6.sdk/System/Library/Frameworks/OpenGL.framework/Headers/gl.h:1455:1: warning: this is the location of the previous definition
/Users/Hima/DevTool/Monkey/OtherSamples/DiddyExample/examples/VirtualRes/virtual.build/glfw/xcode/../main.cpp: In static member function 'static void diddy::flushKeys()':
/Users/Hima/DevTool/Monkey/OtherSamples/DiddyExample/examples/VirtualRes/virtual.build/glfw/xcode/../main.cpp:843: error: 'app' was not declared in this scope
/Users/Hima/DevTool/Monkey/OtherSamples/DiddyExample/examples/VirtualRes/virtual.build/glfw/xcode/../main.cpp: In static member function 'static int diddy::getUpdateRate()':
/Users/Hima/DevTool/Monkey/OtherSamples/DiddyExample/examples/VirtualRes/virtual.build/glfw/xcode/../main.cpp:848: error: 'app' was not declared in this scope
/Users/Hima/DevTool/Monkey/OtherSamples/DiddyExample/examples/VirtualRes/virtual.build/glfw/xcode/../main.cpp: In static member function 'static void diddy::showMouse()':
/Users/Hima/DevTool/Monkey/OtherSamples/DiddyExample/examples/VirtualRes/virtual.build/glfw/xcode/../main.cpp:853: error: 'ShowCursor' was not declared in this scope
/Users/Hima/DevTool/Monkey/OtherSamples/DiddyExample/examples/VirtualRes/virtual.build/glfw/xcode/../main.cpp: In static member function 'static void diddy::hideMouse()':
/Users/Hima/DevTool/Monkey/OtherSamples/DiddyExample/examples/VirtualRes/virtual.build/glfw/xcode/../main.cpp:857: error: 'ShowCursor' was not declared in this scope
/Users/Hima/DevTool/Monkey/OtherSamples/DiddyExample/examples/VirtualRes/virtual.build/glfw/xcode/../main.cpp: In member function 'virtual gxtkSample* gxtkAudio::LoadSample(String)':
/Users/Hima/DevTool/Monkey/OtherSamples/DiddyExample/examples/VirtualRes/virtual.build/glfw/xcode/../main.cpp:2188: warning: unused variable 'bytespersec'
/Users/Hima/DevTool/Monkey/OtherSamples/DiddyExample/examples/VirtualRes/virtual.build/glfw/xcode/../main.cpp:2189: warning: unused variable 'pad'
/Users/Hima/DevTool/Monkey/OtherSamples/DiddyExample/examples/VirtualRes/virtual.build/glfw/xcode/../main.cpp:2180: warning: unused variable 'len'


TRANS Failed to execute 'xcodebuild -configuration Release', return code=16640

Process Complete




therevills(Posted 2011) [#59]
Diddy fail on GLFW target with V40.


Just tested with the latest code, all works fine. What version are you using?

{edit]
Ahh just tested the virtual res example... just add Import mojo to the top of the file:

Strict

Import mojo
Import diddy



http://code.google.com/p/diddy/source/diff?spec=svn122&r=122&format=side&path=/trunk/examples/VirtualRes/virtual.monkey&old_path=/trunk/examples/VirtualRes/virtual.monkey&old=90

[/edit]

Mojo must be imported first...


Hima(Posted 2011) [#60]
Hmm I use the latest version. Just download it along with V40. I tried adding Import mojo but it still gives me the same error. :(


therevills(Posted 2011) [#61]
Hmm I use the latest version. Just download it


The latest zip? The zips are nearly always outdated - grab the source directly.


marksibly(Posted 2011) [#62]
Hi,

> Ahh just tested the virtual res example... just add Import mojo to the top of the file:

Perhaps "Import mojo" could be added at the top of diddy.monkey?


Hima(Posted 2011) [#63]
The latest zip? The zips are nearly always outdated - grab the source directly.


I just tried checking out the source for both diddy and examples but I still get the same error :(
I'm using Mac OSX by the way, and I'm using XCode4. However, before that I can only build for HTML5 but now Flash target work as well. Still GLFW doesn't work though.


therevills(Posted 2011) [#64]
Perhaps "Import mojo" could be added at the top of diddy.monkey?


Perhaps... ;)

I still get the same error


Hmmm... Ive just uploaded a new zip with the up-to-date code... can you please try it?

http://code.google.com/p/diddy/downloads/detail?name=diddy-r126.zip&can=2&q=


Hima(Posted 2011) [#65]
Same error again >_<;


therevills(Posted 2011) [#66]
Okay, looks like the Mac version of GLFW is different to the Windows version...

Yep just checked, in Windows there is the win32_windows.c file with the ShowCursor command... and of course Mac doesnt have it!


therevills(Posted 2011) [#67]
Added a GLFW version for MacOS, so no ShowMouse/HideMouse commands...

Can you please try this one:

http://code.google.com/p/diddy/downloads/detail?name=diddy-r128.zip&can=2&q=


Hima(Posted 2011) [#68]
It works! Thank you , therevills :)


therevills(Posted 2011) [#69]
Whew! Hopefully work out how to show/hide the cursor sometime for the mac.

In the GLFW user guide it says this:

4.3.4

Hiding the mouse cursor

It is possible to hide the mouse cursor with the function call:


glfwDisable( GLFW_MOUSE_CURSOR );



Hiding the mouse cursor has three effects:

1. The cursor becomes invisible.

2. The cursor is guaranteed to be con&#64257;ned to the window.

3. Mouse coordinates are not limited to the window size.

To show the mouse cursor again, call glfwEnable with the argument GLFW_MOUSE_CURSOR:


glfwEnable( GLFW_MOUSE_CURSOR );



By default the mouse cursor is hidden if a window is opened in fullscreen mode, otherwise it is not
hidden.



So I might try this...


therevills(Posted 2011) [#70]
That does work (for Windows at least):

	static void showMouse()
	{
		glfwEnable( GLFW_MOUSE_CURSOR );
	}
	static void hideMouse()
	{
		glfwDisable( GLFW_MOUSE_CURSOR );
	}


But if you are running your app in window mode and the mouse is hidden you can not get at the Window's desktop... which I dont like.

I've tried something like this:

		if (MouseX() < 0 or MouseX() > DEVICE_WIDTH or MouseY()< 0 or MouseY() > DEVICE_HEIGHT)
			ShowMouse()
		End


Which kindof works, but the mouse is shown in the middle of the window...


Soap(Posted 2011) [#71]
It is a good practice to not use custom mouse cursors by default anyway.


therevills(Posted 2011) [#72]
It is a good practice to not use custom mouse cursors


Sorry but says who?

I wanted to hide the cursor for action games etc which doesnt need the mouse cursor. And if the game is running in window mode I wanted to be able to show the mouse once the mouse posititon has left the window.


Soap(Posted 2011) [#73]
You cut off:

> default anyway.

It is better to let a user choose to have a custom cursor, enable it in the options, than to force them to use a custom cursor. This is my opinion, and I consider it in general terms a good practice for usability's sake.

>I wanted to hide the cursor for action games etc which doesnt need the mouse cursor. And if the game is running in window mode I wanted to be able to show the mouse once the mouse posititon has left the window.

I was not criticizing what you want to do in any way. I think what you want to implement is good.


therevills(Posted 2011) [#74]
Ahh, sorry, yeah I totally agree - always give the user the option to enable/disable custom cursors.

Looks like on MacOS, we are only going to be able to show/hide the cursor - which means the user can not leave the game window when in window mode...


Soap(Posted 2011) [#75]
In that case, when they go into windowed mode I would force disable the custom cursor - even have the option to enable it while in windowed mode disabled with a note explaining if they want to have it enabled they must played in fullscreen mode - for MacOS until there is a possible fix.


therevills(Posted 2011) [#76]
Added SetMouse(x, y) to Diddy - for GLFW only for the time being...

@Hima - can you please test this on your Mac?

[edit]
Looks like you cant move the mouse in Javascript (HTML5) or Actionscript (Flash)... I guess it makes sense too, so it looks like SetMouse will only be for GLFW...
[/edit]

Have a look at the testApp.monkey in the Functions example... Ive got this little bit of code:

		If Not mouseOn
			if (MouseX() < 0 or MouseX() > DEVICE_WIDTH or MouseY()< 0 or MouseY() > DEVICE_HEIGHT)
				ShowMouse()
				SetMouse(MouseX(), MouseY())
			Else
				HideMouse()
			End
		End


So when the mouse is hidden and goes outside the window, we display the mouse and set it to the last position - this is needed because hiding the mouse in GLFW actually sets the mouse to the middle of the window, but keeps track of the movement.


Hima(Posted 2011) [#77]
Show/Hide mouse work fine though there is a problem with that code you post.

For some reasons, if you move your mouse off the window from top or bottom, the mouse will never leave the window. I think this is because once it leaves the window, it enters screen coordinate instead of negative y,then you set the mouse to that position and it go backs inside the window again. Not sure if this is Mac only or not :S


Samah(Posted 2011) [#78]
Diddy now has Base64 encoding/decoding.

Local str:String = "Hello world!"
Local b64:String = EncodeBase64(str)

' Prints "SGVsbG8gd29ybGQh"
Print b64

' Prints "Hello world!"
Print DecodeBase64(b64)



Volker(Posted 2011) [#79]
Is there no way to stop a looped GameSound?
As workaround I'm stopping the last channel in SoundPlayer.


therevills(Posted 2011) [#80]
Not the best workaround there... what happens if you have played several more sounds after the looped sound?

I'll put some code in to keep track of the looping GameSounds...


Samah(Posted 2011) [#81]
Having some issues with the XML parser in Android at the moment; I'll commit changes once it's fixed.


JohnathanS(Posted 2011) [#82]
Will there eventually be a proper documentation to Diddy?


therevills(Posted 2011) [#83]
And what is proper documentation? And when will we be paid? ;)

We've added items to the Wiki and there are quite a few code samples - its a pretty easy module to use... so the question is: Is it worth spending our time doing "proper" documentation or just writing code to add more functionality and fixing bugs...

Or are you offering your services? ;)


therevills(Posted 2011) [#84]
Just uploaded r150 download zip :)

Includes a new Tile Engine written by Samah.


anawiki(Posted 2011) [#85]
@therevills: you'll be paid once you add "keyboard functions" to iOS :)


matt(Posted 2011) [#86]
Can one of the mods edit the code in this thread to be codebox? It's really slow to load for me.


pinete(Posted 2011) [#87]
Hi,
I think Diddy is impressive, great work! just to ask for a feature I think it could make sense, and its some functions to achieve some kind of connectivity via HTTP in order to write or read data from a webpage or whatever, this way you can save game status, score, money, or whatever the variables of the player or the level are..
It could be very useful, just IMHO :)
thanks a lot!


therevills(Posted 2011) [#88]
@therevills: you'll be paid once you add "keyboard functions" to iOS :)


We'll hold you to that ;)

connectivity via HTTP in order to write or read data from a webpage


Have you looked at MNet by Xaron? http://code.google.com/p/mnet/


Samah(Posted 2011) [#89]
Regarding the tile engine: It's still a work in progress and the data structure could change dramatically at any point in the near future. For now, be careful what classes you extend.

At the moment it's designed around the Tiled format, but it can technically load any file that matches the data structure. I'm looking at adding support for DAME, but it will require a lot of changes. Don't expect everything to be backward compatible!

In the end I may have to break Tiled and DAME into separate engines, however considering the difference in the editors' capabilities, this may not be a bad thing.


Cheese(Posted 2011) [#90]
Hey guys, I was wondering if there's currently any way to render outside of the virtual resolution, but still have any or all of that content fade in/out upon calling screenFade.Start().

For example: I have the game's environment rendering in a virtual resolution, GUI windows and buttons rendering outside the virtual resolution, and a custom cursor which is also rendering outside the virtual resolution. Every scene has a different GUI, so I would like to have the GUI fade along with the game's environment, but still have the cursor not be effected.

If there's no direct support for this, I would suggest adding another render method to the Screen class, effectively creating three draw layers like so:

Render() - Virtual resolution
*ExtraRenderFade() - Actual resolution
ExtraRender() - Actual Resolution

After doing this, you could simply change when the fade rectangle is drawn to be after ExtraRenderFade() and before ExtraRender():

1. Render() - Virtual resolution
2. ExtraRenderFade() - Actual resolution
3. Fade rectangle! - Whatever
4. ExtraRender() - Actual Resolution

Thanks in advance,
- Brandon.


therevills(Posted 2011) [#91]
Ah Mr Cheese... we meet in person at last ;)

Interesting, when I added the ExtraRender stuff I more so it as a debug console place, but its cool what you are trying to do with it - I'll have a look :)

[Edit... well that was easy :P]


Cheese(Posted 2011) [#92]
I noticed that you updated Screen so that ExtraRender draws before the fade rectangle, but is there any way to draw without the virtual resolution and no fading?
For example: a cursor that doesn't fade between screens?


therevills(Posted 2011) [#93]
So you want to be able to display the game in the virtual resolution, the GUI in the device resolution and the cursor on top of everything but not affected by fading... is this right?

When you are moving from different devices with differnt resolutions you might have to redo the GUI graphics to suit the device resolution. For example if you design your GUI for the iPhone then move the game to the iPad the GUI is going to be too small (or too big if you go from the iPad to the iPhone).


Cheese(Posted 2011) [#94]
That is correct. That's also a good point to bring up! Allow me to explain..

What I'm mainly doing right now is developing for the following targets:
GLFW (Windows; OS X; Emulated in GNU/Linux (Hopefully))
Android
XNA (XBox 360)

GLFW would be a little different than Android and XNA.

- With GLFW, I plan on doing exactly as I listed above; to render the environment of the game in a virtual resolution, render the GUI according to the device resolution, and render additional things such as debug info and a cursor according to the device resolution (but not fade when switching between screens).
This would allow PC users to switch between resolutions and use fullscreen mode in order to maximize 'desktop' space within the game.

- With Android (or other mobile platforms) and XNA, I plan on simply rendering both the game's environment and the GUI using a virtual resolution. This is because those platforms force users to use a single resolution to execute applications which is always fullscreen.

To meet the requirements above, I've created a class to adjust the virtual resolution according to ratio and 'optimal resolution' constants, and the GUI's layout (so far) is designed to meet a sort of happy medium between the two render methods.

Kind regards,
- Brandon.


Cheese(Posted 2011) [#95]
Hello again!

Just want to say great job on the SimpleGUI class which was just added. The example made me feel as if I was sliding down slides and climbing monkey bars at a playground.
Diddy is becoming more of a valuable must-have resource for rapid development with Mojo every day.

I always look forward to seeing new and improved features!

Thanks a lot!
- Brandon.


therevills(Posted 2011) [#96]
Cool - I really like Samah's GUI its really well designed, but for my simple games its a little too much - thats why I decided on doing the SimpleGUI.

Also I've recently added DebugRender in screen:

* Render - affected by VR and Fading
* ExtraRender - affected by Fading, not VR
* DebugRender - not afftected by Fading nor VR


luggage(Posted 2011) [#97]
I'm liking the virtual resolution stuff in Diddy. Was wondering if there's the equilavent to the mouse functions but for touch as well?

Or should I just be doing

TouchX() / SCREENX_RATIO


instead?

Thanks!


therevills(Posted 2011) [#98]
@luggage, you can do that in the short term - but yeah Diddy should have a game.touchX like the game.mouseX.


Samah(Posted 2011) [#99]
I've done some more work on the GUI (it actually has images now!)
I ripped off the Windows 7 basic theme :)

It's not checked in to the repository yet, but here's a demo:
http://users.on.net/~swoolcock/monkey/testGUI/MonkeyGame.html

No text or sounds yet, although the code is there for it.


Cheese(Posted 2011) [#100]
Awesome work on the GUI recently, Samah. Everything seems to be working very well as of r177 concerning it. (Especially enjoying the z order)

I was having some trouble figuring out the correct way to theme sliders/windows, but it looks like this should do the trick!

Also, very nice theme rip. ;)

Thanks a lot!
- Brandon.


Samah(Posted 2011) [#101]
Yeah there's a lot changed. The images are stored in one atlas image and all the styles are taken from an xml file. Hopefully it looks a little more professional now. :)

I still need to fix up text and get sounds working, then I'll upload it.


DruggedBunny(Posted 2011) [#102]
Thread's getting a bit long now, so resuming here...

Good work all!