Rhythm, Beat, Attack.

” Give yourself to the rhythm” – Lucio, Overwatch.

Yes, this week will be all about rhythm, beat, and… attacking?

Why indeed, this week we’ll focus, again, on the enemy object, its attack and the importance of math in videogame making. It’s important to note that unlike previous weeks this week was quite packed with scheduled courses. Specially math from 9-16 (9AM – 4PM) which took quite a bit of worktime as well as mental capacity. And thus, the process was slowed down a bit this week.

 

Anyway, enough blaming it on something/someone else. Time to get into what was done this week: Rhythm and beat.

As time moved on and the project evolved we’ve decided to give the game a “pulse” having everything move, attack and pulsate to a rhythm. And this too goes for the enemy object and its attacking pattern. Now, I’ve already discussed how the enemy object works and what its attack pattern looks like, the only real change was making everything move with the rhythm.

But don’t think this was easy, oh no. Having never done anything like this, finding the proper way to make not one (1), not two (2) but three (3) separate objects move and follow a rhythm was not an easy task.

Now, luckily our other programmer Pål had already worked on a similar system for another title he’d made at a Game Jam, and the rhythm system was based upon this system. Which meant if you follow the golden rule of communicating with your teammates, discussing the problem allowed for more input and to some extent, some more experience and knowledge.

But how did we solve this?

Well the Pseudo code for the logic was:

Have an iterating counter which counts from zero (0). Divide the result of this counter with the beat (or whichever timeframe you want to use). The result is a percentage of how far into the timeframe the object has iterated.

Next, use this percentage with the “Mathf.Lerp(a, b, t)” function. For anyone who has read my previous posts, yes this is the same function as the one used to “animate” the line that the enemy used to show its attack. Then, you multiply the result of the previous function with a “vectorX.Normalize(B – A) + A”. Again, yes this is the same as the line animation.

The reason for this is because this specific line of mathematical functions and work means the object will get the percentage of a timeframe, linearly interpolate this percentage and then multiply it with a simple iteration calculation.

And lastly, take the result of multiplying the two (2) functions and apply it to whatever object/logic you want to manipulate (in this case it was scale but this also works with positions and movement).

The results speak for themselves, the calculation used resulted in the object transform to point with a 0.01f (0.01 float value) difference between the given timeframe and the time taken.

 

Now if you’re not a programmer, or if you have difficulties with math, this might seem intimidating and/or confusing. But don’t fret, I did too and it’s important that anyone who reads this and feel that their math skills might be lacking (I’m including this because in all honesty, I’ve been there myself so, you know just in case):

  1. This explanation of how the mathematical formula works is really shit. But I don’t think I can explain it better without having to write a 5-page essay about it.

 

  1. No one can know everything and do everything, if you feel like you’re lacking in some skill don’t worry about it, the more you work and the more passionate you are about what you’re doing the more you’ll grow and the more you’ll learn and evolve.

 

  1. In all honesty… I’m still a bit unsure about how this all works myself so… you know, there’s that.

 

Post programming thoughts:

I’ve tried to make this part a staple in my blog-posts, allowing me to reflect over past mistakes, why they occurred and how they can be fixed. And hopefully allow you, the reader to get an insight and hopefully work to not repeat them. But this week I can’t say that there were a lot of problems.

A Better Picture.png

Sure, the fact that we had long math sessions during half of these past days meant that there was a less than desirable time spent on the project. Which will probably have to be caught up to in the next days, or over the weekend. But other than that, the communication between teammates went well, the work thus far has been done without that much problem. And everything worked out in the end (?).

So, I guess that’s it for this post. Nothing else to report on really. I hope you found it, interesting.

Advertisements

2 thoughts on “Rhythm, Beat, Attack.

  1. Hi Leon, Alexander, art director here from Team Kraken.

    Great blogpost! However at times quite hard to understand. Don’t worry though, Ill explain why.

    So this week we were tasked to reflect on team Onmoraki, your team. This was interesting, why?
    Because you don’t actually have any art students in your group. I currently study the art course and in the earlier blog posts I’ve mainly commented on Art students, because well, I can have my creative input and my knowledge around the matter to base my reflections on.

    But in this case that might be tricky, So Ill jump right into it!

    First of all, great one liner opener with the Lucio quote!
    Reading about the assignment you were given this week, unfortunately there is not much I can say. I think I followed along quite well with what you were describing and I think I’ve caught somewhat of a general idea of what was done, however here is the good part. You actually took in consideration that the reader might not be a programmer or be super experienced within math and algorithms and so forth. This is great! Makes me as a reader feel a bit less confused and quite frankly now it perhaps makes sense that I might not have understood everything you wrote.

    All in all though, interesting perspective on the task! Even though I perhaps can’t really comment on the technical aspects of what was done, I can say that the explanation was well done and even for me as an art student it was interesting to read.

    Best of luck!

    Like

  2. Yo, Jakob here.
    This Blog post overall is good and doesn’t have a lot of major issues. You go into different subjects and tell the reader the details about the subject you were talking about. When it was needed you went into detail about the pros and cons about the subjects you presented. While this may sound extremely simple, it does a great job on covering the details needed for the reader. It gives the reader a perspective on how the group works and how they solve problems. That is really good and what I believe should always be the main focus of the blog, which you have clearly done.
    I also like some aspects of how you structured your blog. More specifically your “Post programming thoughts”. Out of all the blogs I had to read, this is the first one I’ve seen that has a actual labeled section entirely based on your reflections of the week. While you didn’t mention much in that section, I feel as though it really did a good job on giving more insight to the group. You said that “this week I can’t say that there were a lot of problems”. I feel like that implies that that there isn’t a lot to reflect on that week. However despite that you went into ‘why’ that was the case. This gives a lot more insight into how your group works to the reader.

    There is, however, a few minor problems with your blog. The first thing is your grammar. While your grammar is far from bad, there are some grammatical mistakes in your sentences overall. Most of the time it was mostly just left out comas and such things of similar nature. I do also recommend that you shorten your sentences a bit. There were some times were some sentences that bothered me a lot, despite have minor grammar mistakes. I apologize if I come out as a grammar-nazi, however these things need to be addressed. For the final sentence of your blog, you said that “I hope you found it, interesting”. There’s an unnecessary coma after “found it”. While this is minor, I seemed to me that it was intentional. This is one of the only grammar mistakes where you added in the coma in a very odd place. That’s why I got the impression that you did this intentionally. The sentence could of been simply “I hope you found it interesting.”. I’m not sure if you wanted some kind of ‘pause for effect’ kind of situation, but to me it seems so out of place. This brings me into my next problem.

    You have a very casual and blunt writing style. You don’t follow a formal structure but rather write in way you would speak it. You are very straight forward and blunt in the way you write.
    In other words, you keep it real. You even said “shit”, which I think is awesome. It breaks the formality.
    Each new line if text isn’t exactly categorized into each subject but rather each new point. With each new line of text, it always seems to be about a new point you’re trying to make. That or it’s you starting to introduce a new subject while still co-relating to the point you mentioned before.

    I think it’s awesome that you do this. The blunt and casual nature of your phrases makes it a lot more relatable to the reader. There is however, a problem with your writing style. While you do try to write the way you speak, there are some parts of the blog that is nearly fucking impossible to follow. I apologize for being overly blunt but I feel like this is probably the biggest issue. You add many unnecessary word and phrases to your sentences or as statements in general. For example “Which meant if you follow the golden rule of communicating with your teammates, discussing the problem allowed for more input and to some extent, some more experience and knowledge.”. While this sentence is a bit long, there isn’t anything major to mention. However then you follow this statement up by “But how did we solve this?”. I feel as though I have missed something or an important point. Even though that sentence is starting on a new line, it doesn’t correspond to the last paragraph.
    While I did somewhat understand what you tried to say, it seems like you jump from subject to subject erratically. I assume what you meant with that statement is in reference to 2 paragraph before that statement. That paragraph is were you mentioned what difficulties you had to face when completing certain tasks. With that information it makes more sense of why you said “But how did we solve this?”, but in the wrong place.
    I also noticed that you tend to add unnecessary words in sentences. This again, may be because you are trying to write the way you speak. However it doesn’t translate very well into writing in some instances. Like “Having never done anything like this, finding the proper way to make not one (1), not two (2) but three (3) separate objects move and follow a rhythm was not an easy task”. While I do think it’s good to keep it casual, I feel like sentences like these are just long for the sake of being long. That may have not been your intention, but it sort of comes out that way in your blog. It’s a long sentence with a small point to make.
    Due to this it can feel more tiresome to readers to read long paragraphs of text, only to get a few small points from it. This didn’t happen constantly, so this blog didn’t exactly do that. However it is something to keep in mind for the future.

    I did come out as harsh about some of the comments I did. However I did it because I feel like it’s important to get the point across. Don’t take it the wrong way however. This blog is very good. Awesome even. It’s one of the better blogs I have read. Just keep in mind about the grammar you use in the blogs. It’s ok to be casual and blunt. In fact I feel like it’s awesome and that you should continue doing it. Just make sure that the overall grammar doesn’t suffer from it 😉 .

    Like

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out /  Change )

Google+ photo

You are commenting using your Google+ account. Log Out /  Change )

Twitter picture

You are commenting using your Twitter account. Log Out /  Change )

Facebook photo

You are commenting using your Facebook account. Log Out /  Change )

w

Connecting to %s