Limit on amount of keypresses?

Discuss about anything related to the Irrlicht Engine, or read announcements about any significant features or usage changes.
Post Reply
3DModelerMan
Posts: 1691
Joined: Sun May 18, 2008 9:42 pm

Limit on amount of keypresses?

Post by 3DModelerMan »

It seems like there's a limit to the number of keyboard events you can test at once. Although it wouldn't make since based on what I have implemented. I have a movement system and that has jumping support. But when you try to jump when traveling in the up/left direction. It doesn't register a keypress. I'll post code later.
That would be illogical captain...

My first full game:
http://www.kongregate.com/games/3DModel ... tor#tipjar
randomMesh
Posts: 1186
Joined: Fri Dec 29, 2006 12:04 am

Re: Limit on amount of keypresses?

Post by randomMesh »

This is an issue of your keyboard, try another one.
Please read about the keyboard switch matrix.
"Whoops..."
3DModelerMan
Posts: 1691
Joined: Sun May 18, 2008 9:42 pm

hmm

Post by 3DModelerMan »

Yeah but if I do the same in the up/right direction it works fine.
here's my code

Code: Select all

//{straight
if ( receiver.IsKeyDown(KEY_UP) )
{
 irrSimplePhysics->addObjectUserForce(ipObject, vector3df( +move_speed * vecForce.X, irrSimplePhysics->getGravity().Y , +move_speed * vecForce.Z ) );
}

if ( receiver.IsKeyDown(KEY_DOWN) )
{
 irrSimplePhysics->addObjectUserForce(ipObject, vector3df( -move_speed * vecForce.X, irrSimplePhysics->getGravity().Y , -move_speed * vecForce.Z ) );
}
//}

//{side

if ( receiver.IsKeyDown(KEY_RIGHT) )
{
 irrSimplePhysics->addObjectUserForce(ipObject, vector3df( +move_speed * vecForceSide.X, irrSimplePhysics->getGravity().Y , +move_speed * vecForceSide.Z ) );
}

if ( receiver.IsKeyDown(KEY_LEFT) )
{
 irrSimplePhysics->addObjectUserForce(ipObject, vector3df( -move_speed * vecForceSide.X, irrSimplePhysics->getGravity().Y , -move_speed * vecForceSide.Z ) );
}

//}
that moves the character,

Code: Select all

//{rotation

if ( receiver.IsKeyDown(KEY_UP) )
{
 render_mesh->setRotation( vector3df( 0 , cam_control->getRotation().Y-180 , 0 ) );
}

if ( receiver.IsKeyDown(KEY_RIGHT) )
{
 render_mesh->setRotation( vector3df( 0 , cam_control->getRotation().Y-90 , 0 ) );
}

if ( receiver.IsKeyDown(KEY_LEFT) )
{
 render_mesh->setRotation( vector3df( 0 , cam_control->getRotation().Y+90 , 0 ) );
}

if ( receiver.IsKeyDown(KEY_DOWN) )
{
 render_mesh->setRotation( vector3df( 0 , cam_control->getRotation().Y , 0 ) );
}

if ( receiver.IsKeyDown(KEY_RIGHT) && receiver.IsKeyDown(KEY_UP) )
{
 render_mesh->setRotation( vector3df( 0 , cam_control->getRotation().Y-135 , 0 ) );
}

if ( receiver.IsKeyDown(KEY_LEFT) && receiver.IsKeyDown(KEY_UP) )
{
 render_mesh->setRotation( vector3df( 0 , cam_control->getRotation().Y+135 , 0 ) );
}

if ( receiver.IsKeyDown(KEY_RIGHT) && receiver.IsKeyDown(KEY_DOWN) )
{
 render_mesh->setRotation( vector3df( 0 , cam_control->getRotation().Y-45 , 0 ) );
}

if ( receiver.IsKeyDown(KEY_LEFT) && receiver.IsKeyDown(KEY_DOWN) )
{
 render_mesh->setRotation( vector3df( 0 , cam_control->getRotation().Y+45 , 0 ) );
}

//}
that rotates,

Code: Select all

if ( receiver.IsKeyDown(KEY_SPACE) && jump_key_flag == true )
 {
  irrSimplePhysics->setObjectUserForce(ipObject, vector3df( 0 , jump_str , 0 ) );
  
  jump_key_flag = false;
 }

 if ( receiver.IsKeyDown(KEY_SPACE) == false )
 {
  jump_key_flag = true;
 }
That would be illogical captain...

My first full game:
http://www.kongregate.com/games/3DModel ... tor#tipjar
Lonesome Ducky
Competition winner
Posts: 1123
Joined: Sun Jun 10, 2007 11:14 pm

Post by Lonesome Ducky »

Happens on my keyboard in non-irrlicht games. I think randomMesh was right.
3DModelerMan
Posts: 1691
Joined: Sun May 18, 2008 9:42 pm

uh oh

Post by 3DModelerMan »

How can I fix it then? It still happens if I comment out the rotation stuff to. And not when I move in either up/right or down/left directions.
That would be illogical captain...

My first full game:
http://www.kongregate.com/games/3DModel ... tor#tipjar
3DModelerMan
Posts: 1691
Joined: Sun May 18, 2008 9:42 pm

joystick

Post by 3DModelerMan »

Well it works with my joystick. So it's definitely a keyboard problem.
That would be illogical captain...

My first full game:
http://www.kongregate.com/games/3DModel ... tor#tipjar
hybrid
Admin
Posts: 14143
Joined: Wed Apr 19, 2006 9:20 pm
Location: Oldenburg(Oldb), Germany
Contact:

Post by hybrid »

Well, just reading the link randomMesh gave you is not enough. You also have to *understand* it. Please, do us a favor and solve your general computer problems in other forums...
Dorth
Posts: 931
Joined: Sat May 26, 2007 11:03 pm

Post by Dorth »

The answer is honestly spelled in full letters in that link. There is no point adding to that, it's all answered.
3DModelerMan
Posts: 1691
Joined: Sun May 18, 2008 9:42 pm

Enter?

Post by 3DModelerMan »

Should I just put in the option of using ENTER to jump also? I know on
another PC SPACE works pretty well (the keyboard's wired different).
That would be illogical captain...

My first full game:
http://www.kongregate.com/games/3DModel ... tor#tipjar
wyrmmage
Posts: 204
Joined: Sun Mar 16, 2008 3:12 am
Contact:

Post by wyrmmage »

Worlds at War (Current Project) - http://www.awkward-games.com
Ganadu'r, The Eternal Sage (Other Current Project) - http://rpg.naget.com
Kojack
Posts: 67
Joined: Sun Jan 20, 2008 2:39 am

Post by Kojack »

This problem has existed as long as standard pc keyboards have.
It used to be really annoying playing Mortal Kombat 3 with 2 players on one keyboard, holding certain keys (like a diagonal jump) would block your opponent from doing certain attacks.

Some keyboards handle it better than others. The Razer Lycosa keyboard is designed so the WASD keys don't block other nearby keys, and the Razer Tarantula keyboard claims on it's feature page to allow up to 10 keys to be help at once before they start blocking each other.

The only way to avoid it (apart from using a game controller instead of a keyboard) is to use try different keys, or buy a different model of keyboard and hope. Since keyboards can handle this differently, a key combo that works for one person could fail for another.
Post Reply