WiiLi Wiki frontpage Include your post in the News Get links Hoteles Quito
WiiLi.org Forum Index WiiLi.org
a new revolution
 
 FAQFAQ   SearchSearch   MemberlistMemberlist   UsergroupsUsergroups   RegisterRegister 
 ProfileProfile   Log in to check your private messagesLog in to check your private messages   Log inLog in 

Ocaml script for wiimote: interesting ?

 
Post new topic   Reply to topic    WiiLi.org Forum Index -> WiiLi Development
View previous topic :: View next topic  
Author Message
Proff



Joined: 10 Apr 2007
Posts: 3

Digg It
PostPosted: Tue Apr 10, 2007 11:26 pm    Post subject: Ocaml script for wiimote: interesting ?

This is an absolutely theoretical thread. I'm not even planning on doing it. I'm just considering the idea, for now at least.

Here is the idea: making a Ocaml binder for wiimote handling.

Here is the why: in my so far limited knowledge, GlovePie is the absolute best wiimote mapping thingy. And not only wiimote. It work a hell of well. But, there are things that GlovePie can't be: glovepie can't be a real scale language. Well I said "things" but that kinda sums it up.

Scalability problem is a real one. All glovepie users are bound to what the authors (and possibly a quite small community of user) do. That is we're limited in functionalities. Plus it's very unlikely that GlovePie interpreter will be nearly as efficient as a real life language.

By using a real language we have the following benefit :
- possibility of making libraries, writing more modular (thus scalable) code and easier cooperation
- possibility of using any sort of existing libraries benefiting from a larger community (for instance, maths libraries, xml parsing libraries)
- probably more efficient execution

Ocaml has the following benefits :
- both compiled code (both native compilation and bytecode compilation actually) and interractive programming are available
- high level strongly typed langage making it reasonably easy to build large programms
- easy to bind with C (essential for driver stuff)
- can use camlp4 to parse foreign code (like GlovePie scripts) with almost unfair ease
- runs the same code (except native compiled one) in Windows, Linux, macOsX, and some other
- could also be used in ocaml applications for primitive use (not any other language obviously, but then again, who can claim that)
- ocaml compiles on any reasonable linux, so it could be useful on wiili itself
- it's my favorite real scale language :p

My idea would be to do the following :
We would first need C libraries for all the atomic operations (that is, reading an input device (aka wiimote for the most important one) and emulating an input device (keyboard, mouse, joysticks)). This is the annoying part, since we need one per system basically. The good point is that we keep that to a real minimum, all the abstraction and tools will be written in ocaml (i.e. only once)

Then we write a caml binding, one module to map the C atomic API to ocaml, then one module to provide abstract (probably object oriented) tools to manipulate them.

The third step would be to make a module that allows to turn ocaml toplevel into a sort of glovepie (indeed we wouldn't have the GUI helper of glovepie, but I found that in practice this was really not handy, and I prefered writing my scripts by hand). The user would write an ocaml program that corresponds to a loop of the mapping thing, pass it to a function (we can imagine a syntax extension to make things slightly smoother) run it, and it would to the real time input device mapping voodoo thing.

The fourth step would be to write syntax extentions for most of the script mapping language which already exist. To take advantage of all the work already done. My knowledge of these scripting languages is limited to that of glovepie, and for now, the only thing which I'm not so sure how to emulate about that is the wait function of which I'm very uncertain of the semantics (but we're not there yet).



I am about done now. As I said, it's theoretical. I don't have nearly the skills for writing the C drivers. Some people do, and if such people are interested in such a project, well we could start working these things together (if I find the motivation, that is). I am aware of such API existing or being developped, but I have absolutely no clue (despite a bit of effort to understand) how mature they are.

This whole thread would be more to present the idea, and to ask the follwowing question : would anyone be interested by such a thing ? If such a project was to be started, would there be people to help around (especially the C parts which I condider myself incapable of doing) ?

I know it was a bit of a long thread for such a small question. But in a way, I hope I can hook some interest and create a discussion. Ah dunno, I never know how to end a bloody post. I've got to stop now, but it never feels I reached a conclusion. Well, just try and not leave this thread disapear, it'd make me sad and all.
_________________
"I am not young enough to know everything" - Oscar Wilde
"Thanks but I'd rather be on my own alone" - Mowgli, the Jungle Book
Back to top
View user's profile Send private message
Display posts from previous:   
Post new topic   Reply to topic    WiiLi.org Forum Index -> WiiLi Development All times are GMT
Page 1 of 1

 
Jump to:  
You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot vote in polls in this forum


Powered by phpBB © 2001, 2005 phpBB Group