How can I make my code control the keyboard to play another game? - keyboard-hook

There's a puzzle game called Zen Puzzle Garden, and I just wrote a program that solves the puzzles in the game. Right now, it does a brute force search for a solution, then spits out the necessary moves to solve the puzzle: up, down, left, and right.
But what I want is to run the game on my computer, and feed those moves from my program into the game, so I watch the game being solved automatically.
What is the easiest way to do this?
I should mention probably that my code is written in C.

System.Windows.Forms.SendKeys.SendWait("String you want");
Or
System.Windows.Forms.SendKeys.SendWait(Keys.Up.ToString());
Note that if you enter a string it will send the whole string. So you should probably make a switch/case to see what Key you want to compute.

Related

How to make my cinemachine stop from shooting into outer space?

Im learning game developing and am now entering the camera follow subject, scrolled through a few tutorials and learned that I need a unity built-in utility called the Cinemachine, the concept seemed easy and I was pretty excited about implementing the cool camera following mechanism, but somehow, whenever I set my cinemachine follow target to the player(after adding the pixel perfect extension), it just keeps shifting my players coordinates, whether it being the x y or z ones, once it starts it cant even be stopped, as the only solution was to keep spamming CTRL+Z and reset it...(making a 2D game btw)
I tried changing some of the tags or changing the following target but all to no avail, even with other components, as long as I made it follow smth it would just disappear literally...
Expected some changes pr at least an improvement if I put other settings, but yea, sadly it didnt work

Editor Loop delay. Is it a problem for my game?

I'm new on that thing of analisys profile of Unity. I decided to see if my player is dropping too much FPS and the I found this. Will that be a problem for my game? I don't know how that system works, but I guess 8.35 is a high number...
Not its not.
The editor loop is how long the unity editor took.
The player loop is (roughly) the performance of your game. And the big green part looks like the WaitForTargetFPS call to me. Though to tell for sure you'd have to expand the player loop and see.
If you want to measure the actual performance of your game accurately you have to make a development build and profile that one (you can select the debugging options for this in the build dialog).
Further reading: profiler documentation

VR: How to form hands around object they are holding in Unreal?

I'm working on a VR project in Unreal and I'd like my player hands to form to certain objects whenever the user grabs them. (I.e. the way our hands work) Unfortunately, I haven't really found any examples online of others doing this.
For example, I'd like when the user picks up say a hand held tool like a hammer that the hand would wrap around the handle. When the user grabs a basketball the hand shouldn't be closed but, expanded like a you would if you were to palm a basketball in real life.
I haven't done a lot of testing with this but, I'm pretty sure since the hands are based off of a Animation Blueprint that they simply ignore collisions and follow the animation.
I guess the simplest solution would probably be based off of collision where the hand plays an animation and as the fingers of the hand wrap around the object they stop at that position where they collide with the object in question. If it is even possible that is.

Unity platform pathfinding

I've been trying to find a way to do this but I'm not sure how. I've gone through A* pathfinding but could find anything on this. What I'm looking for is pathfinding for something kind of like a super smash bros level with different platforms. Can anyone point me in the right direction?
Think of the path as being made of game states instead of locations; you are looking for a gamestate in which your character is alive and on the platform. The branches of your search would be button presses.
Imagine it this way; the computer pretends it clicked a button and estimates how the game would be x milliseconds after that. Then the computer looks at the buttons it may click and chooses the best alternate reality. It then clicks that button. Lo and behold, the game turns out exactly like the computer imagined.
You will need to limit the rate at which the computer may imagine pressing new buttons (if you don't want to lose performance). In order to do this, you may limit it to only pressing a button every 10 ms in its imagination. That may lead it to stand still when it had the option to move. You may also limit the button presses by game state; it can't click 'jump' if it already has jumped.
In essence, use an A* prediction algorithm instead of an A* pathfinding algorithm. Also consider minimax, which is already a prediction algorithm.

Unity: Third Person Collision with Animated Platforms

first time posting on stack and everything looks promising so far! I had a bit of a complicated question here so I'll do my best to provide exact details of what I'd like to get accomplished. I'm working with a third person controller in unity, so far everything is going great. I've dabbled with basic up and down platforms, a little glitchy but things work. Anytime my player runs through a mesh I make sure the mesh collider is working and a 'rigid-body' is attached set to Kinematic. Here's the kicker, in my game I have turning gears which the player can jump on. This is great except for the player doesn't turn with my gear, which would make sense according to my game-play. What would be the process for getting my character to interact with this animated mesh? I imagine some sort of script which my nooby mind cannot fathom at this point in my unity career. If anyone out there knows the solution to this, I would love to have any assistance, either way I'll plugging away at a solution. Thanks again!!
This is assuming that you're using the packages that ship with Unity3D, which it sounds like you are. After importing the Character Controllers package, you'll have a bunch of scripts in the Standard Assets\Character Controllers\Sources\Scripts folder, in the project hierarchy view. There's a script in there called CharacterMotor.js, attach that to the same GameObject you're running ThirdPersonController on.
Essentially this script adds more interactivity between the character and the scene. There's several methods inside this script that automatically move the character when in contact with a moving object (as long as it has a collision mesh) basically by inheriting the object's velocity.
If your gear/cog wheel has a proper collision mesh set up, adding this script to your character should be all that you require.