Page 1 of 2

problem with UP key

Posted: Wed Jun 28, 2023 3:56 am
by elbrunzy
I think maybe the problem is my keyboard, some very standard usb keyboard I would believe. It seem I can trap as many isDown events as I need using the numpad but when it come to navigation key, the UP key is problematic. For instance I can get all 4 directional key from the numpad with even the space bar, but when it come to navigation key I cannot get all key down event, the UP one wont show if there is already three key down. I'm using 10.2 and did that small program to highlight the problem.

Code: Select all

function love.load()
	love.window.setMode(320,240,{vsync=true, fullscreen=false; resizable=false})
	love.graphics.setColor( 255, 255, 255, 255)
end
function love.draw()
	if (love.keyboard.isDown( "up" )) then love.graphics.print('UP', 10, 10) end
	if (love.keyboard.isDown( "down" )) then love.graphics.print('DOWN', 10, 20) end
	if (love.keyboard.isDown( "left" )) then love.graphics.print('LEFT', 10, 30) end
	if (love.keyboard.isDown( "right" )) then love.graphics.print('RIGHT', 10, 40) end
	if (love.keyboard.isDown( "space" )) then love.graphics.print('SPACE', 10, 50) end
	if (love.keyboard.isDown( "kp6" )) then love.graphics.print('KP6 (right)', 10, 60) end
	if (love.keyboard.isDown( "kp2" )) then love.graphics.print('KP2 (down)', 10, 70) end
	if (love.keyboard.isDown( "kp8" )) then love.graphics.print('KP8 (up)', 10, 80) end
	if (love.keyboard.isDown( "kp4" )) then love.graphics.print('KP4 (left)', 10, 90) end
end
Thank you, cheers :)

Re: problem with UP key

Posted: Wed Jun 28, 2023 4:25 am
by BrotSagtMist
Thats not a Löve question.
This is simply how foil keyboards work.
Keys may collide on the matrix so they stop working if pressed together.

Re: problem with UP key

Posted: Wed Jun 28, 2023 4:29 am
by GVovkiv
I think you got here keyboard ghost.
No, seriously.
It's called keyboard ghosting, when your keyboard might not register some buttons combinations.
https://www.microsoft.com/applied-scien ... sting-demo
Also, not related, but love 10.2?
Why not currently latest 11.4?

Re: problem with UP key

Posted: Wed Jun 28, 2023 4:36 am
by MrFariator
To add to the previous answers, there really isn't much you can do to solve this. At worst, you may need to get a different keyboard, preferably one with some implementation of n-key rollover which helps with keyboard ghosting issues.

Cheap USB keyboards usually don't have this feature, since they may usually be designed for lighter use than gaming.

Re: problem with UP key

Posted: Wed Jun 28, 2023 10:49 pm
by elbrunzy
Thank you everyone for your answer. I really appreciate that quick support ! I'm glad it's just my cheap keyboard that is the culprit. I could run some test thanks to Gvovkiv link and it seem result vary quite randomly from keyboard to keyboard. I'm sorry I have asked a non love2d question but not understanding thoroughly the problem made assumptions difficult.

@GVovkiv, why I decided to remain to 10.5 is because I code my game very slowly as a hobby. I upgraded versions in the past, requiring some review of the code and many modifications, but it allowed me to use some needed new functions. I keep an eye on the what's new and if there is no new feature that appeal to my project, I don't see a reason to do it. My project is a small retro-game that I intend to give away, so unlike modern security app I don't see a reason to upgrade API for no reason, don't you agree ?

Re: problem with UP key

Posted: Thu Jun 29, 2023 7:06 am
by GVovkiv
elbrunzy wrote: Wed Jun 28, 2023 10:49 pm vary quite randomly from keyboard to keyboard.
Yes, because different keyboard models from different manufactures might implement different available combinations. Since most cheap keyboard is mostly for office usage, all they usually implement is Shift - Ctrl - Alt combinations, since they most important one when you working with software, while some W+A+S+D might not be their main priority
My project is a small retro-game that I intend to give away, so unlike modern security app I don't see a reason to upgrade API for no reason, don't you agree ?
I more keen to idea of "as new as possible" when it comes to software, so my views might be different here.
When it comes to love 10 and 11, there shouldn't be much difference, so porting wouldn't take much time and energy. (Most important change is colors now goes from 0 - 1 instead of 0 - 255)
And while you as developer, might not be interested in new features, don't forget about user side. Newer versions (especially love 11) bring newer LuaJIT, graphics support newer versions of OpenGL, faster file reading, etc (Performance boost is always nice to have).

Re: problem with UP key

Posted: Thu Jun 29, 2023 9:00 am
by zorg
GVovkiv wrote: Thu Jun 29, 2023 7:06 am And while you as developer, might not be interested in new features, don't forget about user side. Newer versions (especially love 11) bring newer LuaJIT, graphics support newer versions of OpenGL, faster file reading, etc (Performance boost is always nice to have).
- Newer LuaJIT is part of the developer side, not the user side; the user doesn't care what lua version their game runs on, in most cases.
- Supporting new graphics features is also only interesting if the developer actually coded their game to use that, so, again, developer side.
I do agree about the performance boost though, but i'd question if that actually happened between löve 10.x and 11.x...

Re: problem with UP key

Posted: Thu Jun 29, 2023 11:46 am
by GVovkiv
zorg wrote: Thu Jun 29, 2023 9:00 am - Newer LuaJIT is part of the developer side, not the user side; the user doesn't care what lua version their game runs on, in most cases.
My point here not about lua version that luajit implements.
It's about internal luajit fixes, changes, etc.
For you, as love user, this changes doesn't really bring anything new, but internal changes might be beneficial for end user, due to fact, that this luajit changes might fix occasional luajit-spicific bugs, memory leaks, etc, that wasn't caused by you, developer who use love to make game.
So, even if you don't care about new version of love, there still might be good reasons to update it.
- Supporting new graphics features is also only interesting if the developer actually coded their game to use that, so, again, developer side.
It's also not only about new version of graphics API, by their internals.
Sometimes, graphics issues happens on love side with combination of some gpu.
For example, with my amd card, i was sometimes experience weird garbage instead of graphics with love 11.3. I was not sure why and how it was happening, but upgrading to love 11.4 resolved this issues.
So I'd imagine, that there might be some users, who would experience same (probably more edge case) issues on newer hardware, because developer used older version of love, where this issue wasn't yet fixed.
I'd imagine, that there would be more this type of issues, once Vulkan support would be landed, so being up-to-date would be more beneficial.

Re: problem with UP key

Posted: Thu Jun 29, 2023 12:41 pm
by BrotSagtMist
I usually agree with no need to upgrade just for numbers sake.
I havnt done system upgrades since 2018.
But i do make an exception with Löve to stay at least at the current mayor version.
Code changes pile up if one ignores them and it just gets a greater pita to transistion all at once

Re: problem with UP key

Posted: Thu Jun 29, 2023 10:51 pm
by elbrunzy
Even though my impression of new version is that it target mobile device and I don't intend to adapt my game to those, you made me reconsider the upgrade and do some code change analysis and benchmark when I remember an important reason that hold me back. It seem the opengl implementation requirement also follow version and you cut back on older video card support when you upgrade love2d api. I can't find any precise information about that, but I remember eventually running into loading crash bug on older hardware after an upgrade. If my memory serves well it was using an intel gma4000 or one of it's variant. For what it's worth, I put a considerable amount of effort into routine optimization to keep my system requirement being an early core2duo computer. That's why I'm very considerate about upgrading.

Unsurprisingly from the love2d community, we are having a very pleasant conversation. I'm very interested into reading everyone's input as they are objective and educated. But I feel it might be misplaced under that obscure and obviously unrelated to love2d thread title 😅. Maybe I could start a new thread title and ask what's people view on that matter ?