Page 1 of 2
Console server
Posted: Sun Jul 12, 2009 1:18 pm
by Sparx
Hi there.
I didn't run Löve on a linux system yet. My server for my game running on XP takes quite some CPU ressources, without doing much.
Is there some way seting up a console server with löve?
Sparx
Re: Console server
Posted: Sun Jul 12, 2009 2:17 pm
by bartbes
You can use
lua +
LuaSocket.
Re: Console server
Posted: Sun Jul 12, 2009 4:51 pm
by Sparx
can I sue LUBE with it?
Because my server uses it right now...
Re: Console server
Posted: Sun Jul 12, 2009 5:36 pm
by bartbes
I believe so, I don't think I use any love-specific features, if for some reasons you do get errors when running LUBE on lua+LuaSocket just contact me, I'll be happy to recreate these functions in another way. (After all, I provide support
)
Re: Console server
Posted: Sun Jul 12, 2009 5:45 pm
by Sparx
it's very hard getting my luacode to run somwhow without löve....
Now i did using luabinaries but compiling is to much for me...
Isn't there a way I can tell love to be just a console programm... if not maybee in 0.6?
I'm looking fo an easy way running the lua programm i am writing on my windows machine on a linux server starting it via console.
Re: Console server
Posted: Sun Jul 12, 2009 6:06 pm
by bartbes
If you want a fast windows install of lua (including a few libs, one of those is LuaSocket) try this url:
http://luaforwindows.luaforge.net/index.html#Download
Re: Console server
Posted: Sun Jul 12, 2009 11:19 pm
by Sparx
Ported the server to luaforwindows.
This is my main routine:
Code: Select all
load()
require "socket"
time=socket.gettime()
while(1==1) do
update(socket.gettime()-time)
time=socket.gettime()
end
and i replaced all love.timer.getTime() with socket.gettime()
the server is up and running and i can connect but alot goes very wrong, having problems with timing. And sometimes if i connect the luac file is still running but the server doesn't respond to the client....
Re: Console server
Posted: Mon Jul 13, 2009 6:29 am
by bartbes
I can't really tell what the problem is, but you might consider adding a socket.sleep at the end, is going to save you a lot of CPU time at worst, at best it also solves your other problems.
Re: Console server
Posted: Mon Jul 13, 2009 12:14 pm
by Sparx
That helped... awesome! CPU usage 0% while doing a lot of stuff....
Somehow my ping is either 0, 16 or 32..... so there is still some timing issue here. (using socket.sleep(0.001))
Now can you tell me how "require" LUBE.lua.. just now I replaced it by the actual lube code =)
And coudl you replace the 4 love.filesystem. in Lube by a lua native one?
And is there some tutorial how to port this to a linux server accessable via console?
Re: Console server
Posted: Mon Jul 13, 2009 1:10 pm
by bartbes
Yes, as easy as that. You can either manually remove the elseif where love.filesystem.exists is used or start your file like this:
Code: Select all
require "LUBE"
love = { filesystem = { function exists() return false end } }
(untested, but not too much to be wrong
)
And what do you mean by porting?
EDIT: FAIL I did mess up the code, anyway, this should work
EDIT2: Let me explain why you can just skip that elseif. That's because it is for a rarely used feature, to be precise, loading new protocols, however, I have yet to see anyone do that.