Hello, everybody!
I'm quite new to Löve. I'm using it right know for prototyping our game project (info here: https://sites.google.com/site/anakhagame/).
I will use Raknet to program the network stuff, thus I need to export functions to Lua, I think. How do I use the Lua C API with Löve? I think that will be necessary, or is there any other way to program network with Löve?
Regards
Olle
Multiplayer using RakNet/Löve with Lua C API
Forum rules
Before you make a thread asking for help, read this.
Before you make a thread asking for help, read this.
Re: Multiplayer using RakNet/Löve with Lua C API
Welcome to the world of LÖVE, you will not regret entering it!
There is also LUBE which was developed by bartbes specifically for the use with LÖVE.
Well, normally you don't. But you can build modules using the C api and require them in your game. But this will likely break portability - you have to provide the compiled module for every platform you wish to support.olle wrote:I will use Raknet to program the network stuff, thus I need to export functions to Lua, I think. How do I use the Lua C API with Löve?
LuaSocket is bundled with LÖVE, and it is awesome. Apart from rather low level socket programming it offers a nice high level concept called LTN12.olle wrote:I think that will be necessary, or is there any other way to program network with Löve?
There is also LUBE which was developed by bartbes specifically for the use with LÖVE.
Re: Multiplayer using RakNet/Löve with Lua C API
Wouldn't that require that I start a separate Lua state from C? I can't use C functions in Lua without having a C executable running, right? Is it possible to start Löve from C?Well, normally you don't. But you can build modules using the C api and require them in your game.
Breaking portability is no biggy in this state.But this will likely break portability - you have to provide the compiled module for every platform you wish to support.
EDIT: Ok, found link http://lua-users.org/wiki/BuildingModules, I think that's what I need. Thanks!!
EDIT2: I'd still like to know if it's possible to start Löve from C, though...
- Robin
- The Omniscient
- Posts: 6506
- Joined: Fri Feb 20, 2009 4:29 pm
- Location: The Netherlands
- Contact:
Re: Multiplayer using RakNet/Löve with Lua C API
Welcome!
Is there a special reason to use RakNet instead of LuaSocket, though?
LÖVE is written as an application, and although there has been some action to make it usable as a library, but AFAIK only from the Lua side.olle wrote:EDIT2: I'd still like to know if it's possible to start Löve from C, though...
Is there a special reason to use RakNet instead of LuaSocket, though?
Help us help you: attach a .love.
Re: Multiplayer using RakNet/Löve with Lua C API
Thank you!Robin wrote:Welcome!
Using Löve as a library could work too. In that case I could use the regular C API and start up LÖVE from my own Lua state. Is there information available on this?LÖVE is written as an application, and although there has been some action to make it usable as a library, but AFAIK only from the Lua side.
Performance, I suppose. Also, the chief of the project don't know about LuaSocket (well, not yet, anyway). LÖVE will not be used in the final produc.Is there a special reason to use RakNet instead of LuaSocket, though?
If any one is interested, this is the network algorithm we will try to implement: http://www.gamasutra.com/view/feature/3 ... twork_.php
Our ambition is to make it peer-to-peer, though. Eventually.
- Robin
- The Omniscient
- Posts: 6506
- Joined: Fri Feb 20, 2009 4:29 pm
- Location: The Netherlands
- Contact:
Re: Multiplayer using RakNet/Löve with Lua C API
Not that I know of.olle wrote:Using Löve as a library could work too. In that case I could use the regular C API and start up LÖVE from my own Lua state. Is there information available on this?
I doubt performance will be affected by this. The core part of LuaSocket is implemented in C. And even if it were implemented completely in Lua, network lag poses a much larger performance issue. If you won't use LÖVE in the final product, why use RakNet in the prototype?olle wrote:Performance, I suppose.Is there a special reason to use RakNet instead of LuaSocket, though?
Help us help you: attach a .love.
Re: Multiplayer using RakNet/Löve with Lua C API
RakNet is rather high level. Implementing the network functionality with luasocket in the prototype would mean to reinvent the whole thing later. Plus you'd have to learn luasocket in addition to RakNet.
That said, it is possibly easier to make a lua module out of RakNet than to make a module out of LÖVE...
That said, it is possibly easier to make a lua module out of RakNet than to make a module out of LÖVE...
Re: Multiplayer using RakNet/Löve with Lua C API
Because I can. It will save time, too, of course.If you won't use LÖVE in the final product, why use RakNet in the prototype?
A good question is which functions in the network routine should be exported to Lua.
I think I will do like this:
1. Make a module that works on Ubuntu, with RakNet etc and LÖVE.
2. When LÖVE no longer is needed, start my own Lua state and export the functions in the former module.
Thank you for your time!
Who is online
Users browsing this forum: Bing [Bot] and 1 guest