Jump to content

belstgut

Members
  • Posts

    31
  • Joined

  • Last visited

  • Days Won

    2

Everything posted by belstgut

  1. Since I got this running now, I wanted to share on how to do it. u need https://github.com/siffiejoe/lua-moon/blob/master/examples/sofix.c compiled as shared Object with -DMOON_DLFIX_LIBNAME=/path/to/silent/qagame.mp.i386.so example: gcc -DMOON_DLFIX_LIBNAME='"/home/gs/wolfet/silent/qagame.mp.i386.so"' -m32 -Wall -Wextra -I.. -fpic -shared -Os -o sofix.so sofix.c Luasocket (precompiled for 32bit): https://ptpb.pw/gyb_.zip Copas: https://github.com/keplerproject/copas/tree/master/src copy/extract luasocket, sofix.so and copas to: silent/lualibs/ after that create your luamodule. example: require('sofix') -- needs to be required before any other C based module local copas = require('copas') local asynchttp = require('copas.http').request -- random callback -- makes http request at every player connect (probably not what u wanna do) function et_ClientConnect(clientNum, firstTime, isBot) copas.addthread(function() local body, c, h = asynchttp('http://example.org/') if c ~= 200 then et.G_LogPrint(("HTTP Error: %d"):format(c)) return end -- use body and headers here. eg: et.G_LogPrint(body) end) end -- "Using gameloop as event loop" function et_RunFrame(levelTime) if levelTime % 500 ~= 0 then return end copas.step() end I am currently using a structure like that and haven't experienced any lags till now.
  2. sure there are more callbacks. I mean every lua script which has the et_ClientConnect function gets called when a player connects.
  3. having threads in lua should not be a problem, since u can just bind a C module anyway. But I would like to return a ~= nil value based on the result of the request in the et_ClientConnect callback. how would I do that? I mean even if I fork the networking into a seperate thread, the function would still have to wait for that thread to finish, so I could return sth. I almost think that this would not be possible. So probably just always return nil and then kick based on the result. Still, this could be done more beautifully like calling every callback in its own thread and collecting the return values in an array. when all callbacks are finished, iterate over the results instead of calling the callbacks in a loop.
  4. So I got everything working now. One problem though, using luasocket http is blocking. Since I am using this in et_clientConnect (not always though) everytime I do the http request the server lags until the request has finished. I return nil or a string based on the result of the request. Is there any way I could make this callback nonblocking? (like let it execute for more than 1 server frame, the client has to wait for the result though)?
  5. Nvm. I got it working. Dunno what changed But I compiled luasocket again and now it works. odd
  6. Does noone has any more ideas? Or maybe its not even a problem with luasockets but with my take on it. Can someone try and check if it works for you?
  7. check the wiki. pretty much everything is documented there: http://mygamingtalk.com/wiki/SilEnT_Mod
  8. Curl works though. So sockets seem to be working. I tried lcurl which links against libcurl and it worked. I dont like the callback structure of curl though. So if anyone has a wrapper around that
  9. "libstdc++.so.6: cannot open shared object file: No such file or directory" thats exactly your problem. I think u are missing the 32 bit version of libc and libstdc++
  10. Btw, luasockets work in the systemwide lua interpreter. (5.3.1 32bit) Lua 5.3.1 Copyright © 1994-2015 Lua.org, PUC-Rio> http = require'socket.http'> print(http.request('http://127.0.0.1'))Hi there 200 table: 0x80c1600 HTTP/1.1 200 OK /usr/bin/lua5.3: ELF 32-bit LSB executable, Intel 80386, version 1 (SYSV), dynamically linked, interpreter /lib/ld-linux.so.2, for GNU/Linux 2.6.32, BuildID[sha1]=5c238fe30c288fab06fd2c3e25bbffb575a48700, stripped
  11. made a short video which hopefully explains my issue: https://ptpb.pw/yV5R.webm
  12. that seemed to be working. Lua 5.3.1 with -DLUA_32BITS -DLUA_USE_C89 still cant send stuff over a socket though
  13. yes. I have compiled it in a 32 chroot. gs@server1 ~/wolfet % file /usr/lib/i386-linux-gnu/liblua.so.5.3 /usr/lib/i386-linux-gnu/liblua.so.5.3: ELF 32-bit LSB shared object, Intel 80386, version 1 (SYSV), dynamically linked, BuildID[sha1]=e7f186a10367b9209c168d910c84ed19199f6c40, not stripped Full ELF info: https://ptpb.pw/KWmf
  14. http://www.lua.org/manual/5.3/manual.html#luaL_checkversion since this is the call which raises the error, I assume, the lua versions are NOT the same.
  15. I am using 5.3.3 I'll try with 5.3.1 edit: same with 5.3.1
  16. I'll get that panic before any lua module gets loaded. log: https://ptpb.pw/xB9r
  17. Currently trying it with the dynamic_lua qagame. but I get the following: PANIC: unprotected error in call to Lua API (core and library have incompatible numeric types) ​I am using the lib from: http://packages.ubuntu.com/xenial/i386/liblua5.3-0
  18. Am I blind or is there really no edit function for posts? well anyway, Now the module loads and works and stuff, BUT I cant do http requests. It always times out. tcpdump shows a successful TCP Handshake and after the timeout (eg 10s) I can see the TCP FIN "handshake" But I do NOT see any actual packages transmitted. any ideas? EDIT: hmm odd. I can edit this post, but not the other one. well after a bit of investigating I came to the conclusion, that while a socket:connect() works (tcp handshake and so on) nothing happens with a socket:send('some data') it just times out. So the problem is not related to the http.lua module. but already at the lowerlevel tcp module.
  19. woah thanks. linking it to the qagame shared object worked. I was trying to link it against liblua53.so. setting MOON_DLFIX_LIBNAME to qagame.i386.so worked thanks
  20. Hi, I am currently trying to get luasocket working in one of my luascripts. I got luasocket compiled against the 32bit liblua53 and moved it to silent/lualibs. I still got following problem though. It seems like silent lua extension does NOT reexport modules like lua_gettop I get: socket/core.so: undefined symbol: lua_gettop i found this: https://github.com/siffiejoe/lua-moon/ I am not sure if I just failed to compile it correctly but after requireing sofix in my lua module I still get the same error. (the require works though.)
  21. matchmaking is probably nessesary for ETlive anyway
  22. yeh i mainly meant the pdf nice to hear that you are implementing this can we also expect some kind of matchmaking system? that would be awesome ^^
  23. there is no point in reading this unless you really know your statistics and propability mathematics
  24. Maybe take a look at the TrueSkill Algorithm by microsoft for upcoming versions. TrueSkill also provides logic for matchmaking and balancing teams. http://www.moserware.com/2010/03/computing-your-skill.html http://dl.dropbox.com/u/1083108/Moserware/Skill/The%20Math%20Behind%20TrueSkill.pdf C# Implementation: https://github.com/moserware/Skills Online Calculator: http://research.microsoft.com/en-us/projects/trueskill/calculators.aspx
  25. just tested about half an hour today. Distribution: Ubuntu 12.04 LTS 64 bit didnt encountered any problems.
×
×
  • Create New...