(moved from another topic)
@atilim... or any plugin expert...
on "osx" i build correclty "tntcollision.dylib" to test my plugin on osx desktop player
but where i must put the lib.. in what folder ?
tested plugin folder under "gideros studio" folder, under "plugins" folder of Gideros Player package, under "plugins" folder of gideros studio but
got always this error:
main.lua:17: module 'tntcollision' not found:
no field package.preload['tntcollision']
no file './tntcollision.lua'
no file '/usr/local/share/lua/5.1/tntcollision.lua'
no file '/usr/local/share/lua/5.1/tntcollision/init.lua'
no file '/usr/local/lib/lua/5.1/tntcollision.lua'
no file '/usr/local/lib/lua/5.1/tntcollision/init.lua'
no file './tntcollision.so'
no file '/usr/local/lib/lua/5.1/tntcollision.so'
no file '/usr/local/lib/lua/5.1/loadall.so'
stack traceback:
in my pc /user/local/share/lua or /usr/local/lib/lua do not exist!
???!
please help!
and a second question:
exist only this way to call a Gideros SDK function from C code ?
lua_getglobal(L, "stage"); // push global stage variable to the stack
lua_getfield(L, -1, "getBounds"); // push stage.getBounds function to the stack
lua_getglobal(L, "stage"); // push global stage variable to the stack
lua_getglobal(L, "stage"); // push global stage variable to the stack
lua_call(L, 2, 4); // the number of arguments is 2 (stage, stage) and the number of results is 4 (x, y, width, height)
lua_Number x = lua_tonumber(L, -4); // lua_Number is double by default
lua_Number y = lua_tonumber(L, -3);
lua_Number width = lua_tonumber(L, -2);
lua_Number height = lua_tonumber(L, -1); |
in this way we need to switch (passing data) (if i understood correctly)
from native code to -> luaVM
then call lua Gideros function from luaVM
go back to Gideros native code execute function then back to luaVM...
and finally go back to my native plugin and then return values to LuaVM !!!!!!
this is slow! ...
(some time lua function are faster than C code because of this "excessive passing data" from luaVM and C code.)
is possible a "direct" access to Gideros SDK functions from native code plugins ?
thanks.
Comments
www.tntengine.com
So, about where to put your plugin. Firstly it shows these directories:
no file './tntcollision.lua'
no file '/usr/local/share/lua/5.1/tntcollision.lua'
no file '/usr/local/share/lua/5.1/tntcollision/init.lua'
no file '/usr/local/lib/lua/5.1/tntcollision.lua'
no file '/usr/local/lib/lua/5.1/tntcollision/init.lua'
no file './tntcollision.so'
no file '/usr/local/lib/lua/5.1/tntcollision.so'
no file '/usr/local/lib/lua/5.1/loadall.so'
Do you have them on your Mac? Put plugin there, cause it's where it is looking right?
Or as with C plugin, I think you need to compile player with plugin inside.
About second question, I'm almost sure there is no better way
But as I said, don't know anything about it
i compiled my plugin tntcollision.cpp and i had now tntcollision..dylib for Mac desktop player i copied it on varius folder but nothing... i get the always the same error...
i recompiled "bitop" plugin source generate .dylib and get same error...
ps: i'm on Mountain Lion now.
www.tntengine.com
Can you write
i lost 2 days!!!!!!! for nothing!!!!
this is the output:
libtntncollision.1.dylib (compatibility version 1.0.0, current version 1.0.0)
@executable_path/../Frameworks/liblua.1.dylib (compatibility version 1.0.0, current version 1.0.0)
/usr/lib/libstdc++.6.dylib (compatibility version 7.0.0, current version 56.0.0)
/usr/lib/libgcc_s.1.dylib (compatibility version 1.0.0, current version 1669.0.0)
/usr/lib/libSystem.B.dylib (compatibility version 1.0.0, current version 169.3.0)
as you can see i named "tntncollision" not "tntcollision".... fu*ing keyboard!!!
and in my main.lua i writed
require "tntcollision"
now just used
require "tntncollision" and it works fine!!!!...
sorry guys... "mea culpa"
that's incredible!!!! i'm getting really old... !!!
www.tntengine.com
If we come back to your performance problem, you're right. Currently there's no way to access internal data of Gideros objects directly from C++. Maybe you want to design your collision detection library independent from Gideros' graphics system (as in box2d).
i designed my collision detection independent from gideros gfx...
now i try to optimize more... anyway at this time it's already really fast...
www.tntengine.com
yeeeaahhhh!!! @atilim and @all
i'm really happy with Gideros SUPER MEGA PERFORMANCES!!!!
to check 150 sprite collisions (BBOX COLLISION WITH SCALE BUT NOT ROTATIONS)
(full check collision so every Sprite-to-Sprite check) so 11175 checks at frame
100% Lua Code
took 49 millisecs so 20FPS
100% C++ CODE
9 millisecs so 111 FPS !!!!
5 times faster!!!
yeahh!!!
now i feel the power of Gideros!!!
no other "Lua" framework can do this!!!
Gideros and little C++ code and your game FLY!!!!!!!!!!!!!!!
ok- now i go to sleep... it's better!!!
ciao!
Likes: gorkem, atilim, techdojo
www.tntengine.com
as soon as it will be ready i'll release "TNT Collision Engine"
as always for free (without sources) . and if you donate i'll send with source. ;;)
www.tntengine.com