lua framework


sewlek

Member
Joined
Jan 19, 2014
Messages
35
hi everyone.

one of the main reasons why i bought the pandora is so i can ofc play anywhere all my old games, and almost more important: to be able to code anywhere! :p so I decided to start to build a light weight framework (note, i said frame work, not engine, it wont be huge) where most stuff is implemented in lua. the game itself and some of the less important lower level code will be fully implemented in lua (and JIT, i need to figure out as I go which parts need to be "jitted").

im using atm geany and devtools (thanks for those pnds, really useful!), SDL and eh, im not yet sure which other libs im going to need (networking?). now i have seen there is quite a lot of expertize here in this forum regarding coding, so maybe some of you have an advice of what else i have to consider for the pandora. first milestone for me is getting 2d graphics working, get familiar with lua JIT and have some very basic game working

oh and most important: the whole project will be entirely done / coded on the pandora itself :)
 
Nice. You may want to have a look at Mari0 in the repos. It uses the Love2d lua engine so at some point, someones ported Love2d.
 
before i spend more time on this: did anyone manage to compile and use lua jit already? normal lua works fine for me, but i would also like to use FFI and also the benchmarks look nice: http://luajit.org/performance_arm.html

edit: luaJIT doesnt compile straight away*


> lj_ir.c:53: error: 'exp2' undeclared here (not in a function)
> lj_ir.c:53: error: 'log2' undeclared here (not in a function)
i tried to make some changes to the makefile without success yet
 
Last edited by a moderator:
I've played around with luajit a while ago. I cant remember exactly anymore but i think i had it running on the pandora. I had it compiled in sebt3's virtual box environment...


you might want to check http://en.it-usenet.org/thread/14467/1458/


i really cant remember if i had it working, it's too long ago
 
Last edited by a moderator:
before i spend more time on this: did anyone manage to compile and use lua jit already? normal lua works fine for me, but i would also like to use FFI and also the benchmarks look nice: http://luajit.org/performance_arm.html

edit: luaJIT doesnt compile straight away*

> lj_ir.c:53: error: 'exp2' undeclared here (not in a function)

> lj_ir.c:53: error: 'log2' undeclared here (not in a function)

i tried to make some changes to the makefile without success yet
Ah yes. I think I got that too (I compiled luajit some time ago). I ahve to check, but IIRC, I just #defined that 2 functions. Like#define log2(n) log(n)/log(2)

#define exp2(n) exp(n * log(2))

But maybe just add the option "-std=c99" to your compile options?
 
Last edited by a moderator:
progress so far:

luaJIT + FFI

glshim + stb_image

via FFI calling openGL and drawing GL_QUAD with textures

basic input handling (and gl context) via SDL

"class" implementation (in lua for lua,  class "Child" (Super) )

todo (before i can say i start making a game):

GUI abstraction layer

finish input handling

drawing text (bitmap and/or truetype)

shaders? (not sure if that works with glshim)

you might wonder why im using glshim (openGL) instead of GLES. doing that just for compatibility and the lua code shouldnt "know" about GLES
 
oh and just to post numbers :p

atm with one quad filling the screen in fullscreen mode runs at around 300 fps.
 
progress so far:

luaJIT + FFI

glshim + stb_image

via FFI calling openGL and drawing GL_QUAD with textures

basic input handling (and gl context) via SDL

"class" implementation (in lua for lua,  class "Child" (Super) )

todo (before i can say i start making a game):

GUI abstraction layer

finish input handling

drawing text (bitmap and/or truetype)

shaders? (not sure if that works with glshim)

you might wonder why im using glshim (openGL) instead of GLES. doing that just for compatibility and the lua code shouldnt "know" about GLES
No Shader in glshim for now. You should stick with GL1.5 max functions (there are still a handfull not emulated yet). Almost all but a few exotic ones from GL 1.3 are, with the notable exeption of glGetTexImage2D that doesn't work correctly for now.
 
ah then its ok, i wont do anything special (only draw quads with textures on them) and well, im halfway done writing code for displaying bmfonts so I hope this is doing to work out fine. network code is still a big question mark currently. i know how to use api(s) (wrote the majority of the game code for ns2 ) , i know the theory, but i never actually wrote any lower level code :) for example, i dont necessarily want lag compensation, but I think its a good exercise to deal with it, and i want that the framework is "complete". i probably do only the simple stuff in C (sync marked variables and send messages), and then have all the interpolation, compensation being done in lua
 
not too many big news yet, busy with work the last days. i could already post screenshots of animating fonts / textures but its not that impressive yet :)

but i got udp network messages working, almost done with basic gui system and a system for injecting / removing functionality at runtime of class instances (called Mixins). oh and bitmap font parsing / rendering is done (without kerning though)

so far i have to say I became a huge fan of luaJIT + FFI, the luxery of lua combined with the freedom of C
 
Check out LOAD81 as well:  http://github.com/seclorum/load81

(my fork has support for Joysticks and the Pandora hardware already..)

Its a great little Lua development environment with its own built-in editor, and you can do all sorts of things with it since it has SDL bindings built in .. A great way to get started, and as well to get joystick/nub support without too much fussing around (also, LOAD81 is in the repo as a .PND already ..)
 
i have seen load81, really nice for starters and for learning lua, but not what i need (i know lua well and i already implemented everything i need in a different way)
 
im back,

not much happened in the last month since i was on a business trip and had no time to work on the framework. i made a little bit of progress on the network part but nothing ground breaking

few decisions i made for the framework:

im going to write a new renderer with GL2.0 and GLES2.0 (so no longer be using glshim, i want GLSL ES and will use a translator for GLSL),

I will no longer write all the code on the pandora directly and instead use my desktop pc (it was a crazy fun idea, but it was slowing me down),

i upgraded to SDL2 but im unsure what that means for the pandora (i read somewhere in a header file that input wont work then?),

ill definitely stick with luajit ffi and 99,9999% of the code will be written in lua

@Farox : i dont know about luaplayer, so no idea how much work it would be. but my guess is that all what it does is simply run lua and expose some libs to lua (to display textures, play sound, network etc the basics you need). and thats what my framework does as well so one could write some wrapper (in lua) to make those games compatible. but its maybe easier/less work to simply port luaplayer?
 
I continued working on the engine (still the majority of the code is done in lua, and still using open source libs with ports for the pandora only) working on my desktop PC. quite a lot is done already. the GUI system and network system need a bit more tuning, but the engine already offers quite alot of functionality to make a game. of course i need to make a big optimization pass once more when i port this back to the pandora, but so far this is how it looks:

https://www.youtube.com/embed/Swaxy9sq5cc?feature=oembed

edit: and yes, im doing a remake of moo2 :p
 
Last edited by a moderator:
Back
Top