Results 1 to 32 of 32

Thread: Hardware Cursor

  1. #1
    MSgt. Shooter Person
    Join Date
    Jul 2010
    Posts
    43

    Default Hardware Cursor

    Hello everybody,

    we're using Scaleform for drawing an in-game mouse cursor. However, as the framerate drops down, so does the movement of the mouse cursor. Is there any possibility of drawing a hardware cursor using the UDK?

    This is what we've got:

    hwhud_mouse.fla with a MovieClip called mouseCursor and the following ActionScript code:

    Code:
    Mouse.hide();
    
    var mouseListener:Object = new Object();
    
    mouseListener.onMouseMove = function ()
    {
    	mouseCursor._x = _root._xmouse;
    	mouseCursor._y = _root._ymouse;
    };
    
    Mouse.addListener(mouseListener);
    An UnrealScript class that is set up by the HUD with the following code:

    Code:
    // ============================================================================
    // HWGFxHUD_Mouse
    // The movie clip providing a mouse cursor that is drawn on-top of the HUD.
    //
    // Related Flash content: UDKGame/Flash/HWHud/hwhud_mouse.fla
    //
    // Author:  Nick Pruehs
    // Date:    2011/05/04
    // 
    // (C) 2011 2nd Reality Studios. All Rights Reserved.
    // ============================================================================
    class HWGFxHUD_Mouse extends GFxMoviePlayer;
    
    /** The mouse cursor of the HUD. */
    var GFxObject MouseCursor;
    
    function bool Start(optional bool StartPaused = false)
    {
    	local bool bLoadErrors;
    
    	bLoadErrors = super.Start(StartPaused);
    
    	// initialize this movie clip without actually advancing the movie
            Advance(0.f);
    
    	// don't scale mouse cursor
    	SetViewScaleMode(SM_NoScale);
    
    	// ensure mouse cursor is always on top
    	MouseCursor = GetVariableObject("mouseCursor");
    	MouseCursor.SetBool("topmostLevel", true);
    
    	`log("§§§ GUI: "$self$" has been started.");
    
    	return bLoadErrors; // (b && true = b)
    }
    
    
    DefaultProperties
    {
    	MovieInfo=SwfMovie'UI_HWHud.hwhud_mouse'
    
    	bDisplayWithHudOff=false    
            TimingMode=TM_Real
    	bPauseGameWhileActive=false
    	bIgnoreMouseInput=false
    }
    Changing the TimingMode didn't fix the issue... Any further ideas?
    Nick Pruehs
    Hostile Worlds - Lead Game Designer
    http://hostile-worlds.com

  2. #2

    Default

    Hello,
    we still need a hardware cursor.
    If we want to make a strategy game with Unreal Engine we need a hardware cursor like any other strategy game or else fail.
    Daniel Thiele
    Your friendly Games Person.
    Portfolio: http://www.behance.net/dproject

  3. #3
    MSgt. Shooter Person
    Join Date
    Jun 2010
    Posts
    37

    Default

    I'm still new but since you're still suck and nobody's commented, I might as well chip in. I'm new to Scaleform, but I have a background in flash.

    I don't know if you can use a hardware mouse, but I can think of 2 alternatives that could improve the speed of your mouse.
    1. Use updateAfterEvent to temporarily boost the redraw rate.
    2. See if a Canvas HUD can be used on top of the Scaleform HUD.

    1.
    The onMouseMove event gets triggered as fast as flash can handle it, rather than once per frame. So it could be moving the mouse graphic 10 times before the screen refreshes.
    When placed inside of onMouseMove, updateAfterEvent will tell flash the redraw the screen - regardless of the frame rate. So every time the mouse moves, the screen refreshes and you shouldn't get any jerky movement.
    Code:
    onMouseMove = function (){
        mouse_mc._x = _xmouse;
        mouse_mc._y = _ymouse;
        updateAfterEvent();
    }
    Technical Note: This won't affect the rate of onEnterFrame events or the speed of other animations. This is because the 'frame rate' in flash controlls the rate of code execution, rather than the refresh rate directly (though the code tells it to refresh the screen). onMouseMove is different because it get's triggered independantly of the frame rate.

    I'm unsure of all the technical stuff behind ScaleForm, but boosting the redraw rate could be terribly inefficient if it updates the whole HUD rather than just the mouse.

    2.
    The second option I thought of is drawing the mouse with a Canvas HUD, which should be much quicker - if it's possible to do this. I think I remember seeing that the Scaleform HUD sits on top of or extends a Canvas, so maybe you can draw the mouse just fine there. Or perhaps it's possible to have a Canvas overlay the ScaleForm HUD.

    There might not be a solution here and perhaps there is a way to use a hardware mouse. But I hope I've got the ball rolling at least.
    Last edited by Captain Zazz; 07-15-2011 at 04:47 AM.

  4. #4

    Default

    Thank you very much. I'm sure Nick will take a look at it soon after a few days off. Hostile Worlds has got some huge opportunities to become a real AAA title and this might fix one of the last problems for us to make sure that our prototype and Unreal can make it.

    We might need someone like you for our project by the end of the year. So keep learning
    Daniel Thiele
    Your friendly Games Person.
    Portfolio: http://www.behance.net/dproject

  5. #5
    MSgt. Shooter Person
    Join Date
    Mar 2009
    Location
    Toronto
    Posts
    124

    Default

    hm i should have tested this half a year ago, i remember some scaleform doc was saying it converts into a hardware cursor or something

    but i just now capped the engine to 30fps & my custom cursor is indeed 30fps

    what i personally want to know is how to use the OS cursor just like borderlands (which is also a hardware cursor, unaffected by framerate)

  6. #6
    MSgt. Shooter Person
    Join Date
    Jul 2010
    Posts
    43

    Default

    Thank you for your answers!

    Unfortunately, modifying the function called on the onMouseMove event as you suggested doesn't change anything, nor does drawing the mouse cursor using the UDK Canvas (which obviously depends on the game's frame rate).

    Any other ideas?
    Nick Pruehs
    Hostile Worlds - Lead Game Designer
    http://hostile-worlds.com

  7. #7
    Prisoner 849
    Join Date
    Nov 2007
    Location
    0,0,0
    Posts
    944
    Gamer IDs

    Gamertag: BobGneu

    Default

    You may be able to render a canvas cursor along with the flash UI, but i am not entirely sure how sending the click events across would work out. I am not entirely sure you can render the Canvas UI at the same time and on top, but it should work out. The Canvas functions are still in UDK.
    About Me | My Blog | Solarity

    TechnicalHome | ScaleformTechnicalGuide | UnrealScriptReference | ReplicationHome | MasteringUnrealScriptBaptismByFire

    Kismet makes sense to me when i 'read' it seeming mostly logic based

  8. #8
    MSgt. Shooter Person
    Join Date
    Jun 2010
    Posts
    37

    Default

    Ah that's a shame. Thinking about it, updateAfterEvent will probably only boost upto the framerate of the game (not sure what the default is for UDK).
    I did a quick google and found this site where the guy's posted the source for his project. I've searched his name on the forum and found this thread about said project.
    I haven't had a look at it myself, but the comments have been good.

  9. #9
    MSgt. Shooter Person
    Join Date
    Jan 2011
    Posts
    73

    Default

    You can render a Canvas UI with a scaleform one at the same time, that's sure, and Canvas will not disappear from UDK because of the deproject functionnality. And you can render a Canvas UI over a scaleform UI, i think playing with the drawhud or postrender can do the trick, i think that for exemple, stats fps displays over scaleform

  10. #10
    MSgt. Shooter Person
    Join Date
    Jun 2010
    Posts
    37

    Default

    I think their problem is that if the cursor is rendered on a canvas, it's limited to whatever framerate the game is running at, so the mouse might appear laggy.
    A hardware mouse would be rendered independently though, so it would be very smooth.

    Here is an example of a software mouse running at 30 fps - not too bad, but sometimes it's noticable when you're trying to use it very quickly in a game.
    Here is an example of one running at (probably) 12 fps - terrible.

    Final Fantasy 14 was using a software mouse for a while and had loads of complaints. Any time you went into a busy area and the framerate dropped a little bit, the mouse became very unresponsive.

    Might be worth bringing this topic up again in the 'Programming and Unrealscript' category or something.

  11. #11
    MSgt. Shooter Person
    Join Date
    Jul 2010
    Posts
    43

    Default

    Quote Originally Posted by Captain Zazz View Post
    I did a quick google and found this site where the guy's posted the source for his project. I've searched his name on the forum and found this thread about said project.
    I haven't had a look at it myself, but the comments have been good.
    Any ideas which UDK version that one is built on? The authors don't answer that question
    Nick Pruehs
    Hostile Worlds - Lead Game Designer
    http://hostile-worlds.com

  12. #12
    Prisoner 849
    Join Date
    Nov 2007
    Location
    0,0,0
    Posts
    944
    Gamer IDs

    Gamertag: BobGneu

    Default

    why does it matter?
    About Me | My Blog | Solarity

    TechnicalHome | ScaleformTechnicalGuide | UnrealScriptReference | ReplicationHome | MasteringUnrealScriptBaptismByFire

    Kismet makes sense to me when i 'read' it seeming mostly logic based

  13. #13
    MSgt. Shooter Person
    Join Date
    Jul 2010
    Posts
    43

    Default

    First, I want to check it out above a clean UDK installation to check whether the mouse cursor is limited by the game's framerate, or not.

    And second, it not, I need to know which ActionScript version the whole project is build on.
    Nick Pruehs
    Hostile Worlds - Lead Game Designer
    http://hostile-worlds.com

  14. #14
    Prisoner 849
    Join Date
    Nov 2007
    Location
    0,0,0
    Posts
    944
    Gamer IDs

    Gamertag: BobGneu

    Default

    You can get access to both of those things without even opening up his UPK. Scaleform is requiring AS2.0, it is doubtful that anything that his package has deviates from that requirement.
    About Me | My Blog | Solarity

    TechnicalHome | ScaleformTechnicalGuide | UnrealScriptReference | ReplicationHome | MasteringUnrealScriptBaptismByFire

    Kismet makes sense to me when i 'read' it seeming mostly logic based

  15. #15
    MSgt. Shooter Person
    Join Date
    Jul 2010
    Posts
    43

    Default

    Well Scaleform is requiring AS2, but doesn't the current UDK support AS3? I'm wondering whether the mouse cursor behaviour has changed in that major release...

    Apart from that, can anybody tell if the SimLand mouse cursor movement is limited by the game's framerate, or not?
    Nick Pruehs
    Hostile Worlds - Lead Game Designer
    http://hostile-worlds.com

  16. #16
    Prisoner 849
    Join Date
    Nov 2007
    Location
    0,0,0
    Posts
    944
    Gamer IDs

    Gamertag: BobGneu

    Default

    UDK does not support ActionScript. The only route it has to getting to ActionScript is through the compiled SWF.

    Where did you hear this?

    All of the UI options are limited by the game's framerate, Including SimLand. It uses GFx to control its HUD as well. You can get into DirectX Overlays if you are really interested in this, but short of that you are going to be limited by the games framerate. Why is this a problem?
    About Me | My Blog | Solarity

    TechnicalHome | ScaleformTechnicalGuide | UnrealScriptReference | ReplicationHome | MasteringUnrealScriptBaptismByFire

    Kismet makes sense to me when i 'read' it seeming mostly logic based

  17. #17
    MSgt. Shooter Person
    Join Date
    Jul 2010
    Posts
    43

    Default

    Someone told me that newer UDK versions include newer Scaleform versions, and thus AS3 support, but I might have got that wrong.

    It's a problem if the framerate drops below 30fps, when you hardly can use the mouse to change options in order to increase the framerate again, for example.
    Nick Pruehs
    Hostile Worlds - Lead Game Designer
    http://hostile-worlds.com

  18. #18
    Prisoner 849
    Join Date
    Nov 2007
    Location
    0,0,0
    Posts
    944
    Gamer IDs

    Gamertag: BobGneu

    Default

    The newest version of scaleform is AS3 compliant - http://www.scaleform.com/4.0

    UDK uses a version of Scaleform between 2.1 and 4.0, and since they only added AS3 to 4.0 no one has that yet.

    Why are you having issues with your framerate falling off so far? If you aren't why are you worried about it? Even if you get a hardware cursor, if your frame rate drops off that far you are still bound by its willingness to accept input, which will be at the lower rate.
    About Me | My Blog | Solarity

    TechnicalHome | ScaleformTechnicalGuide | UnrealScriptReference | ReplicationHome | MasteringUnrealScriptBaptismByFire

    Kismet makes sense to me when i 'read' it seeming mostly logic based

  19. #19

    Default

    because other RTS games have it.
    http://www.youtube.com/watch?v=X33wCzyrY20

    because our alpha testerst requestet it.

    our fraerate is as "bad" as in the youtube video. rts players do not have so many problems with framerates like this as long as the mouse cursor feels good but un udk my cursor feels laggy even with much higher framerates.
    Daniel Thiele
    Your friendly Games Person.
    Portfolio: http://www.behance.net/dproject

  20. #20
    MSgt. Shooter Person
    Join Date
    Jul 2010
    Posts
    43

    Default

    Any other ideas?
    Nick Pruehs
    Hostile Worlds - Lead Game Designer
    http://hostile-worlds.com

  21. #21

    Default

    [ sorry if i made doublepost here, but my first post not shown after submit : ( ]

    Try to make research about DirectInput (part of DirectX, sometimes occurs as a dinput.dll in PC games).
    I think using this library (or newer analogue provided by DirectX) is good way to customize input handling under MS Windows.

    Also you need to read all information about UDK's DLLBind functionality what can make possible to use external C++ dlls.

    I can't check it all by myself, because my project is in beggining stage and i right now i dont have enough experience to do it fast.

  22. #22
    MSgt. Shooter Person
    Join Date
    Jun 2010
    Posts
    37

    Default

    Haven't had time to look at it, but I saw this and thought of you.

  23. #23
    Iron Guard
    Join Date
    Nov 2009
    Location
    Denver, CO
    Posts
    573
    Gamer IDs

    Gamertag: K0par

    Default

    From my experience, DLLBind is still bound by the frame rate of the game as the UDK needs to call the DLL's functions each frame.

  24. #24

    Default

    I opened another thread on this issue in programming forums Hardware Cursor.

    I opened another thread instead of writing in this one because I feel is more UDK/programming and not Sclaform issue and maybe someone with extensive programming knowledge could be of some help.
    Last edited by piotrO; 09-11-2011 at 05:08 AM.

  25. #25

    Default

    I believe you are right that this is not necessarily an issue specific to Scaleform. I do know that Scaleform does not have the ability to use a hardware cursor in the current integration. Neither does UDK I believe.
    Last edited by Matt Doyle; 09-12-2011 at 05:10 PM.

  26. #26

    Default

    Ding Ding Ding - FEATURE REQUEST - Ding Ding Ding
    Daniel Thiele
    Your friendly Games Person.
    Portfolio: http://www.behance.net/dproject

  27. #27
    MSgt. Shooter Person
    Join Date
    Oct 2010
    Posts
    79

    Default

    Hi disReGard,

    I know I'm digging this up, but I thought that I could help you, as whilst looking for something on HUD animations, I came across this. Basically, when we did the Simland game, it's the OS cursor, but limited to the UDK. So when windowed it will pick up on the actual co-ordinates in the world.

    Shortly after this I released a point and click game source code which you can follow the links in my signature to get to, it is solely UDK, and has no scaleform at all associated with it, so you should see the implementation there. It compiles in the October build, but should compile in the November build as well.

    Sorry this reply is late, but you never know, it still may be helpful,

    regards,

    H.

  28. #28

    Default

    Quote Originally Posted by Matt Doyle View Post
    I believe you are right that this is not necessarily an issue specific to Scaleform. I do know that Scaleform does not have the ability to use a hardware cursor in the current integration. Neither does UDK I believe.
    That said, isn't a Canvas-based cursor limited only to the same frame rate as the game, and so a whole world of better than limited to the flash scaleform framerate, which can be slower than the UDK engine?

    Don
    have a great day

  29. #29
    Deathless
    Join Date
    Jun 2010
    Location
    Germany
    Posts
    2,293

    Default

    thedjdragon: better late than no answer, which is what we were getting over here. thanks for sharing that with us.
    However I'm checking out your sources and it seems to me you're setting the mouse position on the 'event PlayerInput' function, which I'd assume happens every time the player moves the mouse. this however, doesn't seem to me it will run more than once per tick, am I right? meaning if the game goes slow the mouse will be slow too, which is ultimately the problem we're all trying to fix here.

  30. #30
    MSgt. Shooter Person
    Join Date
    Oct 2010
    Posts
    79

    Default

    To my knowledge, player input reads the co-ordinates from the OS UI, which means, that if the game runs slowly, the mouse will be accurate, but will stagger. I.e. it will be in the correct place on the screen but it will not be animated smoothly between positions. I could check this for you when I get a chance, by choking my graphics card, and I'll let you know, if that helps?

    In the other source code (the Simland source) the mouse cursor works in the same way, but it pushes the co-ordinates to the flash UI, as opposed to getting the co-ordinates from the UI. So if you want more accurate results from the scaleform, this is how I would recommend implementing the mouse.

  31. #31
    Deathless
    Join Date
    Jun 2010
    Location
    Germany
    Posts
    2,293

    Default

    I'm actually not sure if in a slow game the mouse just staggers or if it actually becomes slow and loses accuracy, it's kinda hard to tell.
    in any case, yes please check that for me if you have a chance. if pushing the coordinates to the scaleform UI instead of having it trying to keep up from within flash makes a difference, it'll be a welcome one even if it's not a full-blown game-fps-independent mouse

  32. #32

    Default

    Great news: in JAN 2012 build hardware mouse works flawlessly!

    It can be enabled in Kismet or in code, for example from any GFxMoviePlayer class:
    Code:
    GetGameViewportClient().bDisplayHardwareMouseCursor = true;


 

Bookmarks

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  
Copyright ©2009-2011 Epic Games, Inc. All Rights Reserved.
Digital Point modules: Sphinx-based search vBulletin skin by CompletevB.com.