Changing movement controls, cross-hair placement, and fog of war?
My friends and I are working on a top-down shooter (based off of the top-down camera from the camera technical guide) while trying to learn the Unreal engine, and I could use a little help getting our camera and player controls tweaked to our needs. I have three questions, two of which should be relatively simple to implement, I'm just not very programming minded, the last I'm not even sure is doable, but I figured I would ask.
1) How do I go about changing W, A, S, and D to be relative to the camera and not the player rotation?
Using the code from the camera technical guide, the W key will always move the player forward depending on where the camera is facing, we would like to change it so W always moves the player "up" on the screen, regardless of which way the player is facing. Extending from this, how would I disable jumping and crouching?
2) How do I set up a cross-hair to move with the mouse?
Using the code from the camera technical guide, there is no cross-hair displayed on screen, which hinders aiming. I know how to re-enable the cross-hair, but it shows up centered on the player. I want to set it up so that the cross-hair follows the mouse to make aiming easier for the player.
3) How can I enable Fog of War, and can it be based on the pawn's "vision"?
Essentially, we would like to replicate the limited field of view from a first person perspective in our top-down game by greying out the level and not rendering any players outside of a cone of vision in order to emulate only being able to see what you would in a first person perspective. I could have sworn I saw a gem for greying out anything not immediately around the player on the wiki, but for the life of me I can't find it any more, and even if I could find it, what we want to do is a bit more complicated then that.
We feel the first two questions are essential for comfortable control in game, and while we would very much like to implement the third question, we would understand if it was not doable or far too complicated for an otherwise simple project.
Thank you in advance for any help and advice, it is greatly appreciated.
1) if you are talking about what I think you are then normally the pawn normally moves with respect to where they are facing not where the camera is looking, so you would have to extend the PalyerController then you would probably have to go in and do math on the rotator of the camera with respect to the rotator of the pawn.
for jumping, and crouching those are actually just bool variables (found in pawn.uc)
2) this will take a little bit of work implementing the mouseInterface gem. it was written for an earlier release, and takes some modification to get it to work with a more recent UDK version.
3) this is actually a more recent question that has come up in the threads that I have seen. don't know if it has been resolved yet.
1) The camera will never rotate, which I hope will simplify things.
Going though UTPawn.uc I found bCanCrouch and bCanDoubleJump (but not a bCanJump, is that handled by bCanDoubleJump?) do I edit them in the UTGame UTPawn.uc file (which seems to have a lot of important stuff not listed in my custom pawn.uc file) or do I just list them with "=false" in my custom pawn.uc file?
kind of, but what you will end up doing for the is you will be comparing the rotators to modify what the buttons do, and it doesn't change the math you need to do (really it wouldn't make a difference you will still be modiffying how the pawn updates its direction vector, and all, but still doable. and those bool variables should be set in the defaultProperties of the object that they will directly relate to.
Originally Posted by MithosKuu
2+3) Alright, we can hold off on these until the gem is updated to reflect the current release.
actually those gems will probably only be updated if a major change to the way the system does calculations is done, and those changes don't happen all that often, but if you read through the posts in the gems thread you will find where I discuss it with solid_snake, and he explains how to update it. so if your holding your breath for an update to something that is several versions back you might be waiting a while.
general advise is to try what you can, and if you hit a wall ask for help that is what the community is here for, but asking for theory help can still be viable.
I have gotten good programming advise (back when I started with c++) that I feel really works, and works well: start with something that works (UDK gives that to you), make a small change, and then if that works make another small change, but if it didn't work then deside if you can fix/research/redesign it, or just throw it away, and pick something else. it might take some time, but you will always have something that works.
K for number 3, its not perfectly what you want but it could
Be a solution. If you create a black texture with an alpha that
Would show mostly black except for a spot on the middle right
You could project the playerowner.pawn location and draw that
Image on the hud. That way you would have this black image
Covering everyting but the aream around the pawn. If your camera
Is fixed you could add a plane mesh and assign a material to it
Just making sude the plane faces the camera.
See the other way would be to make other pawns mesh have
Bonlyownersee = true, then if the touch a radious actor then set
That to false and to true again if untouch. That way you can
See the level but not the enemies. The greying prob could work
With a post process and an alpha trick.