UnrealOni/Documentation: Difference between revisions

From OniGalore
Jump to navigation Jump to search
(Assets, Mouse cursor)
 
m (Pause game)
Line 22: Line 22:
: '''Finetune the widget image by moving it in the upper left corner.''' If its size is 32x32 then use the half (16) for the X and Y positioning.
: '''Finetune the widget image by moving it in the upper left corner.''' If its size is 32x32 then use the half (16) for the X and Y positioning.
: Note of warning: DPI scaling doesn't seem to affect the mouse cursor at all.
: Note of warning: DPI scaling doesn't seem to affect the mouse cursor at all.
==User Input==
===Key binding===
...
===Processing===
Double check: Input like key presses shouldn't be consumed by a character because characters can be replaced while playing.
The logic should be stored inside a controller otherwise you have to duplicate a lot of code inside all the characters, not to mention to keep that code up to date.
: Movement controls might live inside the character BP.
: Player-specific controls like opening the help menu should be inside a controller.
* Create a new AI controller, name it something like OniPlayerController
* Select the character in the world outliner or viewport, Ctrl + E to open the BP
* Search for "Controller" and set the "AI Controller Class" to the new OniPlayerController
* Add logic to the player controller (see Pause game)
===Ignore inputs and pause game===
[[Image:UnrealOni_pause_game_basics.png|right|thumb|nodes for a basic]]
Since F1 is used to switch into wireframe mode in UEditor, we will bind H to pause the game.
Normally, key inputs are ignored when the game is paused.
In order to unpause the game we need to set the key to "Execute when Paused [x]" in the details panel.
A flipflop could be used to register the second key input but the game could have been paused by other means so it is better to use an variable here. Luckily Unreal provides just that as a boolean node.
To let the game behave like a typical game pause inputs for character move and look are ignored. This is actually redundant as the game is paused.
: We can recycle those ignore nodes later for game menus that don't require the game to pause.

Revision as of 10:23, 4 August 2019


Assets

Import

Unprocessed files like PNG can be imported by drag and drop in the Content Browser.

They will be saved as .uasset in the folder you dropped the original file.


Mouse cursor

Tested in v4.18, 4.22

  • create a png with transparent edges, import it
  • create a widget bp, open it
  • drag and drop the mouse cursor asset into the widget designer
  • make it 32x32 in size 0, 0 in position
  • compile and save
  • open project settings
    • Engine > User Interface > Software Cursors
    • Add a new software cursor with "Default" option and pick your newly create cursor widget as map element.
The cursor might act strange in the editor's play mode. This should go away as soon as you test it via Lunch.
Finetune the widget image by moving it in the upper left corner. If its size is 32x32 then use the half (16) for the X and Y positioning.
Note of warning: DPI scaling doesn't seem to affect the mouse cursor at all.


User Input

Key binding

...

Processing

Double check: Input like key presses shouldn't be consumed by a character because characters can be replaced while playing.

The logic should be stored inside a controller otherwise you have to duplicate a lot of code inside all the characters, not to mention to keep that code up to date.

Movement controls might live inside the character BP.
Player-specific controls like opening the help menu should be inside a controller.
  • Create a new AI controller, name it something like OniPlayerController
  • Select the character in the world outliner or viewport, Ctrl + E to open the BP
  • Search for "Controller" and set the "AI Controller Class" to the new OniPlayerController
  • Add logic to the player controller (see Pause game)


Ignore inputs and pause game

nodes for a basic

Since F1 is used to switch into wireframe mode in UEditor, we will bind H to pause the game.

Normally, key inputs are ignored when the game is paused.

In order to unpause the game we need to set the key to "Execute when Paused [x]" in the details panel.

A flipflop could be used to register the second key input but the game could have been paused by other means so it is better to use an variable here. Luckily Unreal provides just that as a boolean node.

To let the game behave like a typical game pause inputs for character move and look are ignored. This is actually redundant as the game is paused.

We can recycle those ignore nodes later for game menus that don't require the game to pause.