Karmabot for Slack: mini project

I’ve not updated the site in a while, so I thought I’d add one of the mini side projects I’ve worked on last year.

At about the same time I was looking up ways to improve our research groups communication, some of the other members of the group were keeping track of the “stupid” things that they’d done each day. Like claiming equipment was broken without properly turning it on, silly things like that.

Slack seemed like a good platform for communication, and I found out that you could write bots for it too…. so adding these two fun activities together lead to me writing a script for Hubot on Slack that keeps track of our stupidity and cleverness.

Here is the project page and the github page!

The script is simple to read and there is only a little set up for it, so please feel free to use this script on your own Slack set-ups!

Currently one of our stupid group members is sitting at -4 (4 stupid points and 0 clever points), while I’m at an even 0 (1 clever point and 1 stupid point). Although that is currently the same score as our Slack bot, known as Stupidbot…

Sorting, trees, and Reborn

I haven’t updated this site in a little while – and I should do more regularly. I thought I’d get this ball rolling by writing something short about what I’ve been up to this week.

Sorting and trees

In the world of C++ and brushing up on my coding skills, I’ve decided that I should revisit the ideas behind different sorting algorithms, as well as different implementations of tree structures. Quite some time ago I did cover this in a university course, but it was long enough ago that I have forgotten the majority of it.

The reason I’ve been looking at this is:

  1. I am always worried I’m not implementing my code in a smart way and could improve it
  2. Sorting and trees seem to crop up frequently in code tests for jobs

Implementing this in C++ has also been a great way to look at the built in libraries and the functions they provide, as well as becoming even more familiar with iterators.

There was some inspiration when someone linked me to sorting-algorithms.com too. Such an excellent website

Everything I’ve added so far is here on my github.

Software development styles

Out of interest and curiosity, I’ve been doing a small amount of research into software development style/principles, like agile, or scrum.

These are terms that I’ve seen thrown around the place, and have wondered for a while what they actually refer to. Its been interesting reading the ideas behind these methodologies and what I think I would work well with. The agile-like ones all seem very appealing to me!

The PhD

The project continues. Work would be faster if I didn’t keep finding bugs in code significant enough to have to re-do days worth of analysis. Past-me is infuriatingly bad at spotting stupid mistakes, and the tests that I currently want to run take ~6 minutes each, and are repeated 1000 times.

DOTA2 Reborn

I’ve been playing around with the new editing tools for DOTA2 – they’re quite nifty. Hoping to design some alternate 3-lane map layouts, and I’ll make another post with some of my designs!

Creating an MMO-style controller VIII: Future Improvements

So we’ve completed our programming objectives! Is there anything left to cover? The overview and list of sections is in this post.

Our controller is good, but its by no means perfect. There are a few little quirks that need to be ironed out:

Strafing not so smoothly

Something a little strange happens when we go from strafing left to quickly strafing right. The character appears to flip direction very quickly.

A potential fix for this would require looking at our animation blend spaces, which would require having some specific animations for strafing.

Fortunately there are some game examples available from the Unreal Marketplace which have some assets to pinch! The First Person shooter has some assets, such as a 2D blend space for motion, that could be re-purposed for our use.

Statically rotating

When we rotate, the character does not move. It statically rotates around on the yaw axis. Its a bit strange looking.

To fix this requires an animation update, and perhaps another boolean flag to indicate that we are rotating. We’d then feed this into the state machine that blends motion in our character, so it could perform some kind of motion while rotating.

Right and mouse click together

In some MMO games, if you click and hold both the right and left mouse buttons, your character will begin moving forwards for as long as you hold these buttons down.

This sounds easy to implement, right? Well, in that case, I’ll leave this as an “exercise for the reader”

Anything else?

If you’ve noticed anything else about the controller that is odd, or want to suggest an improvement, feel free to leave a comment! I’d love to hear about any improvements that could be made to this work, since I’ll be using it in games I make.

Creating an MMO-style controller VII: Click and Drag Camera Control

Part seven in the development of our MMO-style controller. The original specification with contents and an overview can be found in this post. Quite a lot of posts now, isn’t it!?

Now we’re moving back to our final feature in the MMO-style controller, using the mouse to move our camera around, and control the character’s orientation. All those functions we wrote earlier are really going to help us here!

Left and right click actions

Firstly, we’re going to need to set up some logic with for the when the user presses the right and left click buttons on their mouse.

First we’ll need some functions to control interaction with the UI and game world:

Function ToggleUIControlOn

Function ToggleUIControlOn, enables interaction with a UI.

Function ToggleUIControlOff

Function ToggleUIControlOff

These two functions change how we interact with the game world. We’ll use these support the mouse drag and rotate feature. When toggled off, the mouse disappears and we cannot interact with the UI. We’ll also disable mouse related events for the game. If we set UI control back on again, we’ll keep the mouse to the game window, and re-enable the things that were turned off.

Now we can add these into the left click action event:

Left Click action

Left click action

When we press left click, we set a LeftMousePressed boolean to true, and we turn off the UI Control.

When left click is released again, we’ll re-enable UI control if right click is not also pressed. If RightMousePressed is true, we do nothing.

The final node in the released chain is a little bit of polish. Once we’ve done rotating the camera using left click and drag, the next time we move, we want the character to move in the direction the camera is facing. We do this by updating the rotation of MyPlayerController.

Hoe about the right click action event?

Right click action

Right click action

This almost the same as left click, but we don’t add that final function to the released sequence. The reason for this, is that right click and drag will update rotation anyway, so we don’t need to do this twice.

Camera rotation control

The vital and missing information left out from the initial upload!

There are two functions to create which are used to control the camera:

RotateCameraLookUp

RotateCameraLookUp

RotateCameraTurn

RotateCameraTurn

This will allow us to control the position of the camera.

Left click and drag camera

We’ve done a lot of the hard work for this earlier in setting up our blueprints. EDIT: Looks like I missed adding this information when I first uploaded. It is now included in the section above.

Left click and drag blueprint

Left click and drag blueprint

Since we have the axes Turn and LookUp already set up, it is a simple task to only make these events do something is LeftMousePressed is true.

If it is true – that is the player is holding left mouse down and moving the camera – we simply rotate the camera, using our two functions CameraTurn and CameraLookUp.

Almost too easy!

Right click and drag camera

What does holding right click and drag do? We rotate the camera and the player controller. Easy.

Right click and drag

Right click and drag

Very similar to left click, except we also need to RotateCharacterToCamera, and add pitch input to the player controller. What could be simpler!?

All our hard work earlier really paid off in this section. Those re-usable functions really are worth their weight in gold, and make the blueprints a lot more readable.

Creating an MMO-style controller VI: Orient Character to Movement Direction

Development of our MMO-style controller, part six! The original specification with contents and an overview can be found in this post.

This is going to be the most complicated part so far. This section of blueprints replaces the functionality we removed in an earlier post, but adds some custom controls that we need.

This code will be added to the MyCharacter blueprint event graph.

Continue reading

Creating an MMO-style controller V: Character Rotation

Part four in the development of our MMO-style controller. The original specification with contents and an overview can be found in this post.

We’ll be adding in the options to rotate the character and camera this time, using the A and D buttons. It’s the final basic input axis for controlling the character.

We want to rotate around the character and also have the character rotate as we do so, depending on which way we go.  There is one complication: as per our design, if the right-click mouse button is held down, we want to strafe with our character instead of rotating.

Continue reading

Creating an MMO-style controller IV: Character Movement

Continuing the development of our MMO-style controller. Contents and overview can be found in this post.

Time to make our character move! This section will focus on movement on the forward/backward axis, and the left/right strafing axis.

First things first: Deletions in the default blueprint!

If you open up the default MyCharacter (or ThirdPersonCharacter) and open up the Event Graph, you will see that it is already populated by various input controls. Make sure to delete everything inside the Movement Input and Mouse Input comment boxes. We wont be able to properly control the character and camera for now, but that will be quickly remedied.

We’re actually going to code our movement controls in MyPlayerController, so open that blueprint up to add the following functions.

Continue reading