Home Unreal Engine

Help needed to create a Grimrock style camera (dungeon crawler)

Me and my bro during our spare time are doing some graphic for a simple dungeon crawler game, but we really suck at programming. I need some help to create a camera like Dungeon Master, Eye of the Beholder, Grimrock (90 degree step-by-step camera).

I have spent some time to sort it out "bIgnoreLookInput=true and bIgnoreMoveInput=true" must have a value of 1 or 0 not true or false, because otherwise the script won't compile, however even with those properties the mouse is still 100% working. also the binded keys are not working;

i made a PlayerController like this:

Class MyPlayerController extends PlayerController;

defaultproperties
{
bIgnoreLookInput=1
bIgnoreMoveInput=1
}

simulated exec function LookRight()
{
ClientSetRotation(Rotation+MakeRotator(0, 16384, 0), true); // Add 90 degrees to your rotation
}

simulated exec function LookLeft()
{
ClientSetRotation(Rotation+MakeRotator(0, -16384, 0), true); // Subtract 90 degrees
}

simulated exec function MoveForwards()
{
Pawn.SetLocation(Pawn.Location+Vector(Rotation)*25 0); // Teleport 250 units forward in the direction you're facing
}

simulated exec function MoveBackwards()
{
Pawn.SetLocation(Pawn.Location+Vector(Rotation)*-250); // Teleport 250 units backwards in the direction you're facing
}

I added the lines to the GBA "section" in DefaultInput.ini:

.Bindings=(Name="GBA_MoveBackwards",Command="MoveBackwards")
.Bindings=(Name="GBA_MoveForwards",Command="MoveForwards")
.Bindings=(Name="GBA_LookLeft",Command="LookLeft")
.Bindings=(Name="GBA_LookRight",Command="LookRight ")

and i added these lines to "Game Keyboard/Mouse Bindings" section in the "Primary default bindings" on the same file(DefaultInput.ini):

.Bindings=(Name="D",Command="GBA_LookRight")
.Bindings=(Name="A",Command="GBA_LookLeft")
.Bindings=(Name="W",Command="GBA_MoveForwards")
.Bindings=(Name="S",Command="GBA_MoveBackwards")

Now; the script compiles perfectly but in game nothing works, how can i fix this please??:poly124:

Replies

  • Bigjohn
    Options
    Offline / Send Message
    Bigjohn polycounter lvl 11
    That's kindof a big question. You're trying to do too much all at once. Gotta take it one step at a time, that way you can tell at what point stuff breaks.

    When you say nothing works, what exactly do you mean?

    Can you tell if it's even using your PlayerController class? That should be the first step. Insert some `log() lines at key events so that you can tell if they get fired off.

    Gotta find exactly where things break.
  • SkyNet00
    Options
    Offline / Send Message
    hi, please can you show me an example of how to `log() inside MyPlayerController Class?
    i told you we suck at programming =_=.....this is our first attemps.
    we really appreciate your help^^
  • SkyNet00
    Options
    Offline / Send Message
    ooooooooookkkkk now it half works, mouse is looked and the camera turns by 90 degrees left/right, BUT it doesent move forwards and backwards.
    I accomplished this by adding a custom world info; yet i dont know how to use the logs :p
  • Bigjohn
    Options
    Offline / Send Message
    Bigjohn polycounter lvl 11
    Simply add a line like this:
    `log("========================Variable content:" @ myVar);

    Anywhere in your code. Say in your exec function, or anywhere really. The equal signs are just so the line is easier to see in the log among all the other lines. myVar is any variable you wanna keep track of. And it's optional. You could just output some text like this:
    `log("===============Some text=========");

    This will output a line in the log. This is how I do basic debugging. If I need to see what the value of a variable is when a certain function is called, etc. Or if the line doesn't appear in the log at all, then I know the place I put it in never gets called.
  • SkyNet00
    Options
    Offline / Send Message
    hi, i made a couple of logs, here the code that i compiled:

    Class MyPlayerController extends PlayerController;

    defaultproperties
    {
    bIgnoreLookInput=1
    bIgnoreMoveInput=1
    }

    simulated exec function LookRight()
    {
    ClientSetRotation(Rotation+MakeRotator(0, 16384, 0), true); // Add 90 degrees to your rotation
    }

    simulated exec function LookLeft()
    {
    ClientSetRotation(Rotation+MakeRotator(0, -16384, 0), true); // Subtract 90 degrees
    }

    simulated exec function MoveForwards()
    {
    `log(Pawn.SetLocation(Pawn.Location+Vector(Rotation)*250)); // Teleport 250 units forward in the direction you're facing
    }

    simulated exec function MoveBackwards()
    {
    `log(Pawn.SetLocation(Pawn.Location+Vector(Rotation)*-250)); // Teleport 250 units backwards in the direction you're facing
    }


    and i recaived this log:

    Log: Log file open, 06/06/13 13:46:00
    Init: WinSock: version 1.1 (2.2), MaxSocks=32767, MaxUdp=65467
    DevConfig: GConfig::Find has loaded file: ..\..\Engine\Config\ConsoleVariables.ini
    Init: Version: 10900
    Init: Epic Internal: 0
    Init: Compiled (64-bit): Feb 18 2013 19:26:12
    Init: Changelist: 1537896
    Init: Command line: editor -DX9
    Init: Base directory: C:\UDK\UDK-2013-02\Binaries\Win64\
    [0000.18] Init: Computer: SOKAAA-PC
    [0000.18] Init: User: Sokaaa
    [0000.18] Init: CPU Page size=4096, Processors=4
    [0000.18] Init: High frequency timer resolution =3.019755 MHz
    [0000.18] Init: Memory total: Physical=8.0GB (8GB approx) Pagefile=16.0GB Virtual=8192.0GB
    [0000.18] Log: Steam Client API Disabled!
    [0000.21] Init: WinSock: I am Sokaaa-PC (192.168.1.5:0)
    [0000.21] Init: Presizing for 0 objects not considered by GC, pre-allocating 0 bytes.
    [0000.21] Init: Object subsystem initialized
    [0000.21] Warning: Warning, Unknown language extension ITA. Defaulting to INT
    [0000.21] Log: Last hardware survey: Ver=10900, Date=20130605. Uploading again.
    [0002.35] Log: SystemSettings based on: SystemSettings
    [0002.54] Log: Found D3D11 adapter 0: NVIDIA GeForce GT 630
    [0002.54] Log: Adapter has 1999MB of dedicated video memory, 0MB of dedicated system memory, and 2047MB of shared system memory
    [0002.62] Log: Shader platform (RHI): PC-D3D-SM3
    [0004.63] Log: PhysX GPU Support: DISABLED
    [0004.66] Init: Initializing FaceFX...
    [0004.66] Init: FaceFX 1.7.4 initialized.
    [0004.68] Init: Version: 10900
    [0004.68] Init: Epic Internal: 0
    [0004.68] Init: Compiled (64-bit): Feb 18 2013 19:25:57
    [0004.68] Init: Command line: -DX9
    [0004.68] Init: Base directory: C:\UDK\UDK-2013-02\Binaries\Win64\
    [0004.68] Init: Character set: Unicode
    [0004.68] Log: Executing Class UnrealEd.MakeCommandlet
    [0004.68] Init: UEngine initialized
    [0004.86] Log: Successfully upload UDK hardware survey to http://et.epicgames.com/PostUDKSurveyHandler.ashx in 4.58 seconds.
    [0004.86] Heading:
    Core - Release
    [0004.86] Log: New File, Existing Package (Package Untitled_0, Package Core)
    [0004.87] Log: Loading global macros for Core
    [0004.90] Heading:
    Engine - Release
    [0004.99] Log: New File, Existing Package (Package Untitled_1, Package Engine)
    [0005.35] Log: Loading global macros for Engine
    [0006.13] Heading:
    IpDrv - Release
    [0006.13] Log: New File, Existing Package (Package Untitled_2, Package IpDrv)
    [0006.19] Log: Loading global macros for IpDrv
    [0006.30] Heading:
    GFxUI - Release
    [0006.30] Log: New File, Existing Package (Package Untitled_3, Package GFxUI)
    [0006.31] Log: Loading global macros for GFxUI
    [0006.33] Heading:
    GameFramework - Release
    [0006.34] Log: New File, Existing Package (Package Untitled_4, Package GameFramework)
    [0006.41] Log: Loading global macros for GameFramework
    [0006.53] Heading:
    UnrealEd - Release
    [0006.54] Log: New File, Existing Package (Package Untitled_5, Package UnrealEd)
    [0006.58] Log: Loading global macros for UnrealEd
    [0006.64] Heading:
    GFxUIEditor - Release
    [0006.64] Log: New File, Existing Package (Package Untitled_6, Package GFxUIEditor)
    [0006.65] Log: Loading global macros for GFxUIEditor
    [0006.65] Heading:
    WinDrv - Release
    [0006.65] Log: New File, Existing Package (Package Untitled_7, Package WinDrv)
    [0006.66] Log: Loading global macros for WinDrv
    [0006.67] Heading:
    OnlineSubsystemPC - Release
    [0006.67] Log: New File, Existing Package (Package Untitled_8, Package onlinesubsystempc)
    [0006.68] Log: Loading global macros for OnlineSubsystemPC
    [0006.71] Heading:
    OnlineSubsystemSteamworks - Release
    [0006.71] Log: New File, Existing Package (Package Untitled_9, Package OnlineSubsystemSteamworks)
    [0006.74] Log: Loading global macros for OnlineSubsystemSteamworks
    [0006.79] Heading:
    OnlineSubsystemGameCenter - Release
    [0006.79] Log: New File, Existing Package (Package Untitled_10, Package onlinesubsystemgamecenter)
    [0006.80] Log: Loading global macros for OnlineSubsystemGameCenter
    [0006.85] Heading:
    SubstanceAir - Release
    [0006.85] Log: New File, Existing Package (Package Untitled_11, Package SubstanceAir)
    [0006.87] Log: Loading global macros for SubstanceAir
    [0006.87] Heading:
    SubstanceAirEd - Release
    [0006.87] Log: New File, Existing Package (Package Untitled_12, Package SubstanceAirEd)
    [0006.87] Log: Loading global macros for SubstanceAirEd
    [0006.88] Heading:
    UDKBase - Release
    [0006.89] Log: New File, Existing Package (Package Untitled_13, Package UDKBase)
    [0007.12] Log: Loading global macros for UDKBase
    [0007.23] Heading:
    UTEditor - Release
    [0007.23] Log: New File, Existing Package (Package Untitled_14, Package UTEditor)
    [0007.23] Log: Loading global macros for UTEditor
    [0007.24] Heading:
    UTGame - Release
    [0007.27] Log: New File, Existing Package (Package Untitled_15, Package utgame)
    [0007.52] Log: Loading global macros for UTGame
    [0008.27] Heading:
    UTGameContent - Release
    [0008.28] Log: New File, Existing Package (Package Untitled_16, Package utgamecontent)
    [0008.32] Log: Loading global macros for UTGameContent
    [0008.36] Heading:
    DungeonCrawlerProject - Release
    [0008.36] Log: Package DungeonCrawlerProject changed, recompiling
    [0008.36] Log: Analyzing...
    [0008.37] Log: Loading global macros for DungeonCrawlerProject
    [0008.38] Log: Success: Compiled 34 line(s), 11 statement(s).

    [0008.38] Log: Scripts successfully compiled - saving package 'C:\UDK\UDK-2013-02\Binaries\Win64\..\..\UDKGame\Script\DungeonCrawlerProject.u'
    [0008.43] Log: Save=55.881023
    [0008.43] Log: Moving '..\..\UDKGame\Script\DungeonCrawlerProject_save.tmp' to '..\..\UDKGame\Script\DungeonCrawlerProject.u'
    [0008.49] Log:
    [0008.49] Log: Success - 0 error(s), 0 warning(s)
    [0008.49] Log:
    Execution of commandlet took: 3.80 seconds
    [0008.49] Exit: Preparing to exit.
    [0008.64] Exit: Object subsystem successfully closed.
    [0008.64] Log: Shutting down FaceFX...
    [0008.64] Log: FaceFX shutdown.
    [0008.64] Exit: Exiting.
    [0008.64] Log: Log file closed, 06/06/13 13:46:08


    but i try to log also the first two functions (the only two that are actually working) the script wont compile and i receive 2 errors.

    from the log i cant understand a single thing, can you help me to read this?
    what do you see behind the matrix?? :p
  • SkyNet00
    Options
    Offline / Send Message
    hi all, this is not a bump but an update lol....

    in order to make all things(half work)i forgot to mention that i had to add the "game rules" through a custom world info; however the whole thing is still just half working(only left/right and mouse locked).

    if you need more info i also start another conversation on UDK forum
    (sorry this is not advertising i'm doing this due the lack of documentation about this topic, sry if is against the rules just remove this link)

    http://forums.epicgames.com/threads/962950-Help-needed-to-create-a-Grimrock-style-camera-(dungeon-crawler)?p=31449026#post31449026
  • SkyNet00
    Options
    Offline / Send Message
    bump.............
  • Neavah
    Options
    Offline / Send Message
    I have a short cut for UDK that has the target set to this:
    C:\UDK\UDK-2012-05\Binaries\UDKLift.exe editor -log

    When the editor is launched it's going to launch a log window too.
    When you play in the editor the log will show all the script logs (and kismet, also some problems that might be happening in script).

    For your code, you need to isolate what is the specific problem it seems.
    To do that I would add logs throughout each function to see what's going on. For example:

    simulated exec function LookRight()
    {
    ClientSetRotation(Rotation+MakeRotator(0, 16384, 0), true); // Add 90 degrees to your rotation
    `log("LookRight function is firing");
    }

    and do that to all the ones that aren't working.
    In the play in editor (or game, if you have the short cut set-up to show the log in the game) hit d, or whatever calls 'lookright'.
    In your editor log you should see something like, "script log: LookRight function is firing"
    If you don't see this, then for whatever reason your function isn't firing (your log's not being called).

    If you do see the log, then you know the function is being called, but there's something wrong with the code.

    If that's the case, I would go through the line of code with logs finding out what all the variables values are.
    Figure out why it's not doing what it's suppose to.
    Is there a variable that isn't what I want/thought it was? what is the value of (Rotation+MakeRotator(0, -16384, 0)? Are these what they're suppose to be?

    As already mentioned you would do this to log a variable:
    `log("The variable I want is : "$VariableName);
    the script log would look something like this:
    scriptlog: The variable I want is : 30
    (3o is the value of 'variablename')

    I would basically go through and try to find out exactly what's going on until I can isolate what the root cause of the problem is.

    Hope that helps a bit :)
  • Vailias
    Options
    Offline / Send Message
    Vailias polycounter lvl 18
    Your move forward and backward arguments are calling on a pawn.
    What pawn?
    The script has to know what to move when you invoke the command.

    Take a look at the existing player-controller movement functions and see how the player pawn is passed in there.
Sign In or Register to comment.