Porting love2d to other platforms

General discussion about LÖVE, Lua, game development, puns, and unicorns.
User avatar
SiENcE
Party member
Posts: 792
Joined: Thu Jul 24, 2008 2:25 pm
Location: Berlin/Germany
Contact:

Re: Porting love2d to other platforms

Post by SiENcE »

For quick & dirty you can do it like the Audio Plugin http://love2d.org/forums/viewtopic.php?f=5&t=2076 .

Make an loadable lua sdl module.
User avatar
the_leg
Prole
Posts: 25
Joined: Sun Sep 05, 2010 3:43 am

Re: Porting love2d to other platforms

Post by the_leg »

Robin wrote:how do we map the wiimote to the mouse or joystick system? (wiimode -> keyboard is simpler, of course)
You map the wiimote buttons to love joystick buttons, hats to hats, and analog data to axes.
User avatar
TechnoCat
Inner party member
Posts: 1611
Joined: Thu Jul 30, 2009 12:31 am
Location: Denver, CO
Contact:

Re: Porting love2d to other platforms

Post by TechnoCat »

the_leg wrote:
Robin wrote:how do we map the wiimote to the mouse or joystick system? (wiimode -> keyboard is simpler, of course)
You map the wiimote buttons to love joystick buttons, hats to hats, and analog data to axes.
Yeah, the wiimote control issue I think is mostly a non-issue. It has a mouse and quite a few buttons. More than enough for most games.
User avatar
Robin
The Omniscient
Posts: 6506
Joined: Fri Feb 20, 2009 4:29 pm
Location: The Netherlands
Contact:

Re: Porting love2d to other platforms

Post by Robin »

TechnoCat wrote:Yeah, the wiimote control issue I think is mostly a non-issue. It has a mouse and quite a few buttons. More than enough for most games.
No, my thinking was the other way around. You can get quite a bit of information from the controllers (even if you don't use plug-in thingies like a nunchuck), how are you going to convert that all to information love games can deal with? Sure, we could do the whole "wiimote-is-a-mouse"-thing, but isn't that rather limiting?
Help us help you: attach a .love.
Henko
Prole
Posts: 9
Joined: Sun Jan 03, 2010 12:19 pm
Location: Wyk/Föhr, Germany
Contact:

Re: Porting love2d to other platforms

Post by Henko »

Robin wrote:
TechnoCat wrote:Yeah, the wiimote control issue I think is mostly a non-issue. It has a mouse and quite a few buttons. More than enough for most games.
No, my thinking was the other way around. You can get quite a bit of information from the controllers (even if you don't use plug-in thingies like a nunchuck), how are you going to convert that all to information love games can deal with? Sure, we could do the whole "wiimote-is-a-mouse"-thing, but isn't that rather limiting?
There are several ways we could determine the mouse position and other data löve needs. For example, when talking about the mouse, the first thing that should come to our mind is to implement simple tracking of where the wiimote points at - this is basically the same as any other kind of pointing device (although I have to admit it isn't very accurate. You certainly will never reach the speed of a normal mouse when typing on the on-screen keyboard). Another possibility is to let a cursor be moved by the nunchuk's joystick. The problem with that on the other hand is that it would then be blocked for any other kind of input.

Another suggestion: why not leave it to the user? Löve might offer the way of "the cursor is where the wiimote points at" and when this behaviour is not wished by the user, the whole mouse module could simply be disabled and the user would have to implement it the way he wants it.
User avatar
Robin
The Omniscient
Posts: 6506
Joined: Fri Feb 20, 2009 4:29 pm
Location: The Netherlands
Contact:

Re: Porting love2d to other platforms

Post by Robin »

Henko wrote:Another possibility is to let a cursor be moved by the nunchuk's joystick. The problem with that on the other hand is that it would then be blocked for any other kind of input.
And wouldn't the nunchuck's joystick be more logically mapped to a joystick?
Henko wrote:Another suggestion: why not leave it to the user? Löve might offer the way of "the cursor is where the wiimote points at" and when this behaviour is not wished by the user, the whole mouse module could simply be disabled and the user would have to implement it the way he wants it.
You mean the lover? It would lose some portability, and I don't want to see platforms like Wii become LÖVE's Internet Explorer.

There is something to be said for that suggestion, though.
Help us help you: attach a .love.
Henko
Prole
Posts: 9
Joined: Sun Jan 03, 2010 12:19 pm
Location: Wyk/Föhr, Germany
Contact:

Re: Porting love2d to other platforms

Post by Henko »

Robin wrote:
Henko wrote:Another possibility is to let a cursor be moved by the nunchuk's joystick. The problem with that on the other hand is that it would then be blocked for any other kind of input.
And wouldn't the nunchuck's joystick be more logically mapped to a joystick?
That's why I spoke of a possibility. Furthermore, I'm more in favor of using the IR sensor as mouse, so that suggestion was not the best thing to do anyhow ;)
Robin wrote:
Henko wrote:Another suggestion: why not leave it to the user? Löve might offer the way of "the cursor is where the wiimote points at" and when this behaviour is not wished by the user, the whole mouse module could simply be disabled and the user would have to implement it the way he wants it.
You mean the lover? It would lose some portability, and I don't want to see platforms like Wii become LÖVE's Internet Explorer.

There is something to be said for that suggestion, though.
Yeah, the lover. I'm not yet very familiar with the terms used in this forum ;)
But why should Löve lose portability? It would be almost the same as on PC:
  • mouse.getX and mouse.getY reffer to wiimote.ir[0].x and wiimote.ir[0].y
  • mouse.isDown("l") might be mapped to wiimote.buttons.a and mouse.isDown("r") to wiimote.buttons.b, since this is the normal behaviour in most wii games
  • Turning the mouse module off would just mean we don't need to poll the data from the Wiimote frequently
  • By hiding the cursor (via mouse.setVisible), the lover would be able to implement his own idea of control mechanism, because the values are still accessible
The other controls would be left untouched. We might just need a few extra constants for all the wiimote buttons (and not even that: most of the buttons appear on keyboards aswell: up, down, left, right, plus, minus, home, one, two, a, b, c, z and so on, but I think it might be handier for them to have own constants - but that's something that might be discussed) and we would just need to implement a new module for the not-so-common stuff like accelerometers, rumble, sound (because the wiimote has an own speaker), ... the wiimote's filesystem might be accessed by the normal filesystem module. None of these possibilities need to be used, but they can. And neither do they need to be implemented, anyhow. I just think it should be due to the lover to choose which ones he wants to use - and therefore take the risk of having to change things for other systems.
User avatar
Robin
The Omniscient
Posts: 6506
Joined: Fri Feb 20, 2009 4:29 pm
Location: The Netherlands
Contact:

Re: Porting love2d to other platforms

Post by Robin »

Most of this makes sense.

I have problems with:
Henko wrote:
  • By hiding the cursor (via mouse.setVisible), the lover would be able to implement his own idea of control mechanism, because the values are still accessible
I think this makes portability doubtful at best.
Henko wrote:The other controls would be left untouched. We might just need a few extra constants for all the wiimote buttons (and not even that: most of the buttons appear on keyboards aswell: up, down, left, right, plus, minus, home, one, two, a, b, c, z and so on, but I think it might be handier for them to have own constants - but that's something that might be discussed)
This'll make it hard to make a game run on all platforms, because it means lovers will have to be aware of the different constants used.
Henko wrote:and we would just need to implement a new module for the not-so-common stuff like accelerometers, rumble, sound (because the wiimote has an own speaker)
That seems possible, as long as games don't start to depend on them, which means you can't play those on your pc. But that's not too bad, because the lover doesn't have a burden if they want to maintain portability, but only if they want to break it.
Help us help you: attach a .love.
User avatar
zac352
Party member
Posts: 496
Joined: Sat Aug 28, 2010 8:13 pm
Location: In your head.
Contact:

Re: Porting love2d to other platforms

Post by zac352 »

I would love adding a little feature with an accelerometer to life, shaking up my little cell tank if I shake my screen. It'd be very entertaining. :crazy:
Hello, I am not dead.
Henko
Prole
Posts: 9
Joined: Sun Jan 03, 2010 12:19 pm
Location: Wyk/Föhr, Germany
Contact:

Re: Porting love2d to other platforms

Post by Henko »

Robin wrote:Most of this makes sense.

I have problems with:
Henko wrote:
  • By hiding the cursor (via mouse.setVisible), the lover would be able to implement his own idea of control mechanism, because the values are still accessible
I think this makes portability doubtful at best.
I don't think so, because in about 98% of the cases, the lover will not even want to do something different than a normal cursor. In those other 2%, it will nearly be the same code for PC and Wii. Honestly: Can you think of any control mechanism that needs to be implemented differently on those systems?
Robin wrote:
Henko wrote:The other controls would be left untouched. We might just need a few extra constants for all the wiimote buttons (and not even that: most of the buttons appear on keyboards aswell: up, down, left, right, plus, minus, home, one, two, a, b, c, z and so on, but I think it might be handier for them to have own constants - but that's something that might be discussed)
This'll make it hard to make a game run on all platforms, because it means lovers will have to be aware of the different constants used.
That's true, but nonetheless I don't think there would be much work to do: instead of writing

Code: Select all

if love.keyboard.isDown("return") then
it would simply be

Code: Select all

if love.keyboard.isDown(iif(love.system == "wii", "wiihome", "return")) then
with iif() being the equivalent to C's ternary operator (or vb's iif):

Code: Select all

function iif(cond, truePart, falsePart)
   if cont then return truePart end
   return falsePart
end
Robin wrote:
Henko wrote:and we would just need to implement a new module for the not-so-common stuff like accelerometers, rumble, sound (because the wiimote has an own speaker)
That seems possible, as long as games don't start to depend on them, which means you can't play those on your pc. But that's not too bad, because the lover doesn't have a burden if they want to maintain portability, but only if they want to break it.
Even if the games began to depent on wii-only features, it is still the lover's decision. If he wants to break compatibility with PC, we should let him do that. On the other hand, those features can be extremly useful to improve the game experience. For example, hearing a gunshot out of the controller can be nice, but certainly is not neccessary. Also, lovers should always be aware that if they want to use the exclusive features of the wii, they should think of alternating mechanisms for the PC...
Post Reply

Who is online

Users browsing this forum: No registered users and 218 guests