handling mouse input in blueprints for a top down game

hi guys,

I have a background in business application development and I want to pursue my dream (which is game development ) and started to watch and read tutorials for unreal engine. As I don’t know C++ and don’t want to learn it, I am using blueprints to do everything.

My game is a top down rpg game like ultima online (if you didnt play this game, you should!). I made a plan and wrote down everything I want to have in my game. First thing on my list is to do is handle mouse input with following features:

  • Check mouse position every tick
  • ray trace it to see if it collides with anything (i want to exclude static map objects, although need it for pathfinding so im not sure about this)
  • highlight the object or character based on characters faction (friendly or monster)
  • handle player state (idle, choose_target, choose_aoe_spell_target, choose_friendly_target, choose_an_item, and many others) and call the action according to the state
  • move player character with animation (there are different character classes with different weapons and animations, but I think this does not belong to this bp)

So my question is, how would you structure this system ? With code I would probably go for state machine but I have very little experience with game programming.

There are many different ways to think of your game’s code. And the way to structure it depends on what goal you’re pursuing.

Triple A IP (like Assassin’s Creed or Borderlands) have a highly modular code that can be iterated upon and refactored as will when building the next game.

This needs a solid code architecture from scratch.

But sometimes you just want to get something done and see how it behaves.

I think you’re on this track but I might be wrong.

  • Check mouse position every tick
    There’s a “get hit cursor” node in the Player Controller class.

  • ray trace it to see if it collides with anything (i want to exclude static map objects, although need it for pathfinding so im not sure about this)
    Same than above.

  • highlight the object or character based on characters faction (friendly or monster)
    There are different outline techniques but the one I find the quickest to implement isthis one.

  • handle player state (idle, choose_target, choose_aoe_spell_target, choose_friendly_target, choose_an_item, and many others) and call the action according to the state
    You’ll indeed have to create a solid state machine that handles what actions can be performed or not at what moment.

  • move player character with animation (there are different character classes with different weapons and animations, but I think this does not belong to this bp)
    I think it will be tied to your character state machine and also to your animation state machine (you’ll build an Animation Blueprint for that).

I think you should check out these series of tutorial if you haven’t already.- YouTube