Page 1 of 2

fakelove : love in pure lua

Posted: Sun Apr 24, 2011 11:25 pm
by TsT
Why using fakelove ?

When you want running something without graphics. Like a server game, only manage network connections.
When your girl friend has left and you loose her löve :rofl:

Another use :
- I want learn more about how löve run (internally)
- You want play with emulation (emulate keyboard, mouse, joystick event ?)

Why fakelove is better than lua

fakelove is not better than the lua interpretor.
But with fakelove you should more easily use the love specific libraries.


How contribute

Post your comment ! I'm open to everything :)

Roadmap

Done recently :
- provide a love.event emulation
- provide a love.timer emulation (for dt calculation)

My next goal are :
- run a sample of network exchange between love-client and fakelove-server
- build a network things to send/receive event (like keyboard/mouse emulation)
- use LuaZip to read inside .love file.
- provide a love.thread emulation (with coroutine if it's possible)
- so much things...

Original post
TsT wrote: Hello,

I'm starting to play with network on löve.
I need to run a "server" to listen connection, and clients.
But for the server part I don't need lot of things.
One solution is to build a pure lua script, but I see LUBE using some little part of love.filesystem.* things.
For the fun I'm trying to build a pure lua script compatible with löve (0.7.1)

I have take the boot.lua from the source.

My approach is :
running fakelove.lua
it will catch the standard require() function.
load the boot.lua (exactly the same than the löve 0.7.1 one) move in embeded/
It will load the love and love.* modules that are implemented in love.lua and love/*.lua

I have put a conf.lua (usefull to disable most of the love modules)
Also a main.lua to check basic function, and see the too many functions to implement !

To check fakelove you need :
- uncompress content of fakelove*.zip somewhere
- cd fakelove
- lua fakelove.lua
(you need the lfs package, named liblua5.1-filesystem0 on debian)

Have fun!
EDIT: for information for now I think the main missing part of code is the love.event module

Re: fakelove : love in pure lua

Posted: Mon Apr 25, 2011 12:27 am
by schme16
Thia seems like an interesting project, I'll be keeping an eye on it for sure!

Re: fakelove : love in pure lua

Posted: Tue Apr 26, 2011 10:08 pm
by TsT
Done:
- provide a love.event emulation
- provide a love.timer emulation (for dt calculation)

Now fakelove 0.2 is able to manage events, and quit properly !

Re: fakelove : love in pure lua

Posted: Wed Apr 27, 2011 2:52 am
by ishkabible
LuaIL can handle textures(works ok with LuaGL, textures come out upside down :( )
LuaGL can handle graphics
LuaSDL can be used for Audio and Input (and Kinda Graphics, hard to use with LuaGL in this case)
LuaOpenAl can be used for Audio (however that will be tricky to use with LuaSDL)
you can make your own binding for anything (like Freetype and Box2D, something for file system)
threading might be tricky

i do have another Idea that while would be A LOT harder would speed things up to near C/C++ level and allow you to make bindings easier, LuaJIT. like i said, it would be very hard to make all these bindings using LuaJIT's FFI but it would be SOOOOOO COOOOOL if you could do it.

Re: fakelove : love in pure lua

Posted: Wed Apr 27, 2011 7:48 am
by TsT
ishkabible wrote:LuaIL can handle textures(works ok with LuaGL, textures come out upside down :( )
LuaGL can handle graphics
LuaSDL can be used for Audio and Input (and Kinda Graphics, hard to use with LuaGL in this case)
LuaOpenAl can be used for Audio (however that will be tricky to use with LuaSDL)
you can make your own binding for anything (like Freetype and Box2D, something for file system)
threading might be tricky

i do have another Idea that while would be A LOT harder would speed things up to near C/C++ level and allow you to make bindings easier, LuaJIT. like i said, it would be very hard to make all these bindings using LuaJIT's FFI but it would be SOOOOOO COOOOOL if you could do it.
Your information are interesting but unfortunately I have not planned to use graphics or audio library.
My goal is more "faking" or emulating than building a new love project full compatible.
Of course I'm refusing to do that just think that is hard and love already do that :)
I like playing with lua, not with C/C++ :nyu:
fakelove is able to be launched with lua or luaJIT.

I just discover luaJIT's FFI, it's really interesting !!
I search about that and found :
- Inline C http://lua-users.org/wiki/InlineCee
Define C source, compiled with gcc on runtime (linux only?). I improved it. I will release ASAP.
- luatcc http://luatcc.luaforge.net/index.html#manual
Interesting because multiplatform but have more dependencies
- c invoke http://cinvoke.teegra.net/bindings.html https://bitbucket.org/bogen/cinvoke/
You have a .so library like libc6.so, it build a interface to call the function.

Re: fakelove : love in pure lua

Posted: Wed Apr 27, 2011 8:10 am
by bartbes
We used tcc for a bit, with love.native, it was killed when we found out it wasn't portable enough though.

Re: fakelove : love in pure lua

Posted: Wed Apr 27, 2011 11:21 am
by Robin
bartbes wrote:We used tcc for a bit, with love.native, it was killed when we found out it wasn't portable enough though.
Wasn't it just PPC it couldn't handle?

Re: fakelove : love in pure lua

Posted: Wed Apr 27, 2011 2:04 pm
by bartbes
Yeah, that's what I seem to remember. Though of course this would cause problems on say arm and mips too.

Re: fakelove : love in pure lua

Posted: Wed Apr 27, 2011 10:45 pm
by ishkabible
dose Love really need to be for architectures other than x86? ...o wait is nlove's device use ARM?

Re: fakelove : love in pure lua

Posted: Thu Apr 28, 2011 8:57 am
by TsT
ishkabible wrote:dose Love really need to be for architectures other than x86? ...o wait is nlove's device use ARM?
Can be good to support Android device ;)