Selecting good, non-conflicting keybindings for a game - input

PC keyboards weren't designed for gaming, compromises were made to bring the price down, so some problems occur. Most importantly, when you hold down certain keycombos, some keys don't react to pressing.
My game has two users at the same PC control two characters in realtime (i.e. not turn based). An instance of the problem: player 1 holds Up and Left to go in that diagonal direction. Player 2 is then unable to go to the right (with "D"). Beyond being merely annoying, it can give an unfair advantage to a player who opts to use the bug as a cheat. Not fun :(
The basic commands are: shooting, walking left and right, and jumping. Shooting is done with LeftControl and RightControl, which don't conflict with anything, so let's consider only the movement keys.
On my laptop, most obvious keybinding combinations fail:
WAD and arrow keys fails with Up+Left+S and Up+Left+D
IJL and arrow keys fails with Down+Right+J (though Down is technically unused, a player often holds it down anyway)
arrow keys and numpad keys fail with Down+Left+NumpadLeft
all-letter combos like WAD and IJL tend to work, but I don't like leaving the arrowkeys unused, and crowding the users' hands together.
Is there a website that list statistics of common supported keycombos on various keyboards, to help me make my decision for defaults? (they're configurable, but defaults matter.) I seem to recall a relevant site called keyboardssuck.com, but I can't find it now.
How have you dealt with this problem? Just ignored it?
Does the problem depend on the OS, the API, the mobo? On anything else? I think it only depends on the keyboard model, but gotta ask.
edit: Now I know what this is called: "rollover"

The best bet is probably to let the user choose his own keybindings.

This is a hardware-implementation issue. To me this problem presented itself as depending on
how the keyboard is wired internally.
To me it seemed to be like theres no real standard to this. A certain combination of 4 keys
at the same time worked fine on one computer (a desktop-machine) - another keyboard simply
could recognize no more than 3 of those. (laptop)
My hunch is that you can rely on all of the control-keys (ctrl,alt,shift,windows,apple-keys) because they are probably wired on another "layer". But when it comes to "normal" keys including cursor keys, numpad keys and the likes, i would say that you can probably rely on 3 keys at the same time.

Related

SCNkit: Issues with unhidden nodes

I am creating a 3-D game with a cave as the main environment. The cave is made of a large number of ring segments, one attached to the other, thus creating a currently small tunnel system.
If the Player is inside the cave, only a small part of the segments are visible. I am figuring that actually hiding the not-visible segments could save a lot of gpu time, which I need for other objects like buildings or enemies.
So what I try to do first is hiding the entire cave and then unhiding the visible segments by turning ‚node.isHidden’ true and false.
The particular nodes are being found and accessed by their names: ‚Node.childnode (withName: „XYZ003“, recursively: false).isHidden = true‘ (or false).
It works to the point where the segments are unhidden, but once I am trying to hide a previously unhidden segment, the renderer crashes with an EXC_BAD_ACCESS.
Doing the hiding on a hidden object (of course useless, but helping to understand the problem) is fine, so is unhiding unhidden segments.
Following the hint of another thread, I moved the routine into the renderer delegate so not doing the switching during the wrong time, but instead during the phase in which such changes are supposed to happen, but this did not help.
As an alternative, I did the hiding (and unhiding) by SCNActions, but I received the same result, which really puzzles me, as this would be kind of the ‚official way‘ to do it...
I also played around with the ‚recursively’ boolean, getting the same outcome (works for unhide, crashes on isHidden = true).
Then I tried to change opacity or other properties of the nodes - which worked perfectly. On the other hand, trying to remove the nodes from the parent resulted in the mentioned crash as well.
I need this to work, because older hardware could never cope with several thousand nodes (trying this, the frame rate dropped to 10fps, even without enemies around). And newer hardware might break down once the enemies appear...
My thinking is that the pointer is somehow messed up by the first unhiding (and hence the BAD_ACCESS error), so maybe an additional bonding (often seen with spritekit-routines) or another way to get the node-pointer could be the solution. On the other hand, if the pointer is broken, why can I still access all other properties? Maybe it‘s the subnodes that cause the problem - everyone of the nodes has 20 subnodes, which are supposed to change visibility, too.
Did anyone come across this behavior before me? I could not find anything during my google-research...
Hiding and unhiding nodes frequently is typically not a problem by itself. You can hide a main node and any sub-nodes of the main node will automatically hide themselves, so you shouldn't have to loop them individually.
I'm not an expert debugger and don't know your skill level, but BAD_ACCESS can mean that you tried to send a msg to a block of memory that can't execute the message or whenever the app tried to deference a corrupt pointer. Search "What Is EXC_BAD_ACCESS and How to Debug It" for a decent tutorial on some options for dealing with it.
I do my changes in the render delegate as well, but depending on the number of changes and how long they take, I sometimes use timers to control the amount of changes that can be made in a certain amount of time. That way, and after some adjustments, I'm pretty sure that I'm not bogging it down to a point where it just spirals out of control.
Structure can matter - personal preference, but I try to setup an array of classes that create individual nodes (and sub-nodes) and therefore have direct access to them. That way I'm not iterating through the whole node structure or finding nodes by name. Sometimes a lot is going on before I really have to make a modification to the node itself and so I can loop through my array of classes, check values, compare, etc. before taking action that involves the display. That also gives me a chance to remove particle systems, remove actions, set geometry = nil and update logic counters when I need to remove a node.
I'm sure opinions vary, but this has worked well for me. Once I standardized the structure, I just keep repeating the pattern.
Hope that helps

PhysX - PxRigidDynamic actors clip through other actors (CCD enabled)

I realize this may not be the perfect place to be asking a question about PhysX, but I've already tried on the official PhysX forums, as well as on gamedev.net and I haven't gotten any responses in several weeks, so I'm unsure where I can go for help. Maybe someone here has an idea.
My problem is as follows:
My PxRigidDynamic actors intersect with other actors and I can't figure out why. There are still collisions between them, but the rigid dynamic slightly clips through them and is 'pushed' back. Here's a video of it ingame/in the PVD:
http://youtu.be/X0oyDtCTsuQ
The box is a PxRigidDynamic actor.
The player is a PxCapsuleController.
All other actors are PxRigidStatic.
Having CCD disabled or enabled seems to make no difference. (CCD should only affect high-velocity objects anyway, so I doubt that's the cause here)
The collisions between the controller and the static actors are fine, so I don't see why the rigid dynamic would behave any differently.
I'm using PhysX-3.3.0_Beta-2 (16402319)
While you can never prevent interpenetration, PhysX should normally apply sufficient opposing forces to separate penetrating objects quickly.
Is there any chance that your rigid body shapes are significantly smaller than the visible geometry? If not, is it possible that changes have been made to the actor's contactOffset and restOffset attributes? This could allow interpenetration to occur before resistance to the contact is applied.
You're right that CCD isn't relevant here - CCD prevents cases where fast-moving objects pass from one side of an obstruction to the other in a single update without registering a normal contact.

Best practice when using multiple forms - vb.net

What is the best practice for having many different menus/screens/forms in a visual basic program? Would it be to just make a new form for each menu or screen that I want? Or are there other better options?
I am not trying to make this overly complicated, I have a group project to work on and we all have different skill levels. That said it has peaked my curiosity so I figured it wouldn't hurt to ask before I got started.
I can see this question being closed pretty quickly as being too open ended so allow me to get in my key gripe on this before that happens... no .Visible property for TabControl pages? Seriously, Microsoft??
Which brings me to the key point. If the forms are in some way related but not necessarily identical I prefer to use a single form with different tabs, despite that glaring shortcoming in the control. (Which you don't have to look far to find workarounds for on SO, but a workaround is still a workaround.) Dynamically manipulating controls at run time is another side of this coin, though one that I tend to use more rarely... but that's just a personal thing.
In a recent application, for instance, I had lists of several types of objects. They were related, but performed quite different functions and the user wouldn't really need to look at more than one list at once. As a result I used one form with a tab for each object list to keep the users' display less cluttered.
Similarly when doing a GL app recently I had the journal header and journal line entries (which go to different tables in the back-end database) in separate parts of the one form. On the other hand asset creation was sufficiently different that I created a different form, despite the creation process sharing some of the underlying data. (That is, journal line data.)
I don't believe in the concept of "best practice" because what's a good practice in one situation may be a very bad one in another. However the "rules of thumb" that I use are:
- Keep the number of forms to a minimum to keep overhead low and reduce maintenance BUT
- If there is no logical "tie" between two functions, don't be afraid to make a new form because trying to maintain one form which performs 7 different roles is a guaranteed path to madness and frustration, especially if you break something inadvertently.
Yes, the two rules conflict, but in a way I see this aspect of design as being akin to database normalisation; there's a sweet spot between over-normalising (a separate form for each and every display) and under-normalising (trying to shoe-horn too many unrelated functions into one form). At the very least the rules always give me pause to think "do I need this form, or does it relate to something that I've already done?"
And the third rule of thumb is, obviously... always look at it from the point of view of your user. Are they going to feel like you're bouncing them around too much? Do all of the forms share a look and feel and, more importantly, control layout so that they always know where to find something?
All of these things will vary from app to app, and there's never one size that will fit all IMHO.
In my case, when I am dealing with multiple forms, I use MDI Parent Form to avoid multiple items in the windows task bar.
Another unusual solution is to set each forms ShowInTaskbar property to false.

Unique computer ID like finger prints

Is there any unique computer ID that distinguishes a computer from other, like finger prints for human?
If yes, please advise how to get it in vb.net.
It is possible to put together info to uniquely identify a machine. This has already been done by many software vendors, most notably the Microsoft Activation service does it by sampling various bits of hardware on your system. The problem with this approach is that the identifier is not guaranteed to be persistent.
What i mean by this is:
the chances of another computer co-incidentally having the same identifiers is nil
if it becomes public knowledge which identifiers you are using it would be reasonably easy to spoof the identity of a machine
the identifiers can change over time as users change hardware, so the "fingerprint" will also change
For further reference, try these links:
Previous SO question: What's a good way to uniquely identify a computer?
MSDN forums: Uniquely identify computer
Just remember: the more points of reference you use to assemble your identifier, the greater the chance it may change at some point in time.
Try getting MAC + CPU ID + Motherboard serial. If you concatenate these then its you unique finger print of that machine until hardware changes occur.
Bear in mind, many people these days are working with dual operating systems (eg VirtualBox) and the MAC will be different. Even swapping network connectivity (ethernet hardwire vs wifi) will change the MAC. I would say MAC is not a good reference for identification.
Well it can be done in many ways.
You can try to get all kind of data about the computer, and then hash it to a string that will identify it. For example, number of drives, number of processors, the user's name, some keys in the registry.
But you have to make sure all the data you take is data that doesn't usually change.

Consistent labeling of physical keyboard keys... is it possible?

I have found that the Windows VK_OEM_X values have a tendency to refer to different physical keys, which makes them useless for localization-agnostic game controls.
I am thinking about using scan codes directly by hard-coding them, but that is my last resort.
Is there any other way to reference the physical keys on a 101-key* keyboard using Windows?
edit I also have need to work with far-eastern keyboards, which have the extra buttons next to the space bar.
For example: If I want the '/' key in my source code, I could be referring to the '!' key on a French keyboard. I don't care about what is actually printed on the key itself, nor am I trying to convert key sequences to characters. I am just looking for a standard labeling system that does not require a massive library of scan codes for different keyboards, let alone detecting the type of keyboard being used.
I don't think so. If anyone knows for sure, it is probably the author of this series.
Let the user's control the key bindings, default them for whatever 3 keyboards your users use most commonly, and prompt otherwise?