Skip to content →

Dance Game : Project Set up (Strings Method)

That set up you saw in the last post works for one move. So, if I have 50 moves I’d have to write the same code 50 times? I discussed this with my coder friends and I got a lot of suggestion on how to make a system for these dance moves to execute when a set of buttons are pressed in the right sequence within a short duration.

I was convinced with the solution of using a data table. But what to put in the data table. I had not worked with data tables before, so this ¬†was very new for me. After reading some Unreal Engine documentation and forum post, I got a fair idea of how data tables work. However, I still didn’t know what to put in my data table.
I found an excel template online, with macros to do permutations and combinations. With this I made my data table with dance moves and the buttons to be pressed to execute the moves. The next step was to create a struct to read the row names and to create enums to for my button names. This took me a while to figure out how I’d be using them all together to get the desired result. We are looking at returning the dance move names at this point from the data table on buttons press in the right sequence in a short duration.

This set up below helped me achieve it.

Strings Method – Storing key pressed in a “Text” Array

Strings Method – Storing key pressed in a “Text” Array

Strings Method – Button Timer Function

However, if you notice this is not the best way to do it. After showing this to my coder friends I got more suggestions and feedback to make a better system. I learned that strings are heavy, they could easily be replaced by integers. Another learning was to store the data table values on “EventBeginPlay” instead of accessing the data table every time I press a button. The best solution for this was using “Bitmask” in Unreal. That’s how I got introduced to “BitMask”.

Published in Dance Game

Comments

Leave a Reply

Your email address will not be published. Required fields are marked *