Friday, February 5, 2016

Jump on Rope and Swing, Jump off with Momentum


Here is what I have been working on for me mate. So far I have the Dude attaching to the pre-animated Rope and jumping off.

When jumping off it is important to retain some of the Ropes velocity from the position that you are attached to the rope and its swing. This was a bit tricky as the rope being an animation meant I did not have any velocities to simply inherit. So what I did was to record the last 4 frames positions of the attached segment are. I then deduct them from the current position and then average them. This gives me a curve and not too sharp a set o velocities to inherit. As you see in the video it works rather well eh :) (yeah, I am pleased with this one).

Lastly when I was jumping off the Dude was rotated on his back or front and simply landed that way. This meant I had to adjust this, as he should really land on his feet. To achieve this I record the rotation when I get onto the Rope. Then I used this Rotation as the Target, and the current Rotation to Slerp with. As you can see in the video it looks like a great acrobatic jump and landing. It worked out well I reckon.

Next up is throwing the Rope out to find the Anchor.. or not.

G'night,
Da Voodoochief

Thursday, February 4, 2016

Side Project - Rope Swing

One of my mates has been working on an AWESOME logo for Very Bunny Haha (to be revealed soon).

As a way to pay him I am working on some code for him. This is my side project now and to be honest I am rather enjoying it. I am having to learn a bunch of new stuff as I have yet to do any 3D work in Unity. Of course all my 2D experience will stand me in good stead as the same principles apply only in an extra dimension. Yeah I have a lot of previous 3D programming experience doing other games).

So that image shows what I have knocked up so far. The Rope that I have attached to the Anchor sphere does an animated swing. Of course this would all be very different if the 3D hinge joint physics worked in Unity, bah!

Ok, onto this project again. I have two pink platforms that the dude is standing on, the idea is that I am going to attach myself to the swinging Rope and swing with it... then jump off when I desire and impart some velocity from the swing to my Dude.

This is going to be fun :)

G'night
Da Voodoochief

Tuesday, February 2, 2016

Improving Code because of bugs

So here I am fixing bugs when I realize when testing that I have a major bug. This one happens when you drop a quest.

You see some quests give you an item to deliver, such as a Note to deliver to Aaron from the Mayor. Now this quest had some special code to give you the Note in your inventory when you pick up the quest. It also has some unique code to handle removing the item from your inventory when you complete the quest.

The bug was that when I chose to Drop the quest this did not have any special code to remove the item. So I was left with the item in my inventory... then if I picked up the quest again I would end up with Multiple of the quest items.

When I was looking over the quest code I realized that I already have a lot of Unique code to handle all these quests that include items. hmm, perhaps there is a better way?

YES, there is a better way. I can include the Quest item in the Quest setup data. Perfect I reckon. I can just use a standard bit of code to handle the giving and removal of the quest itmes into your inventory. Then if you drop the quest the same code can easily tell there is a Quest item associated with the quest and remove that.

Well I did it, and it works GREAT!  This is one of those times where finding a bug allowed me to remove a whole bunch of code and write a much better set of code instead.

G'night,
Da Voodoochief

Monday, February 1, 2016

Bakery Update in VBHh

Leilani has been busy and finally got those darned Cake counters created (try saying that 3 times fast!). They were a bit of trouble to create, but I think well worth the trouble. A good addition to Very Bunny Haha.


As you can see the new display cabinets with more orderly cakes (compared to me previous test cakes all over the screen) is a huge improvement to this scene. I am there on the left side about to head over to Diana to buy a Pie (I need it for a quest you see).

This screen also shows off the other element I mentioned in my previous post about the Bakery. That is the random chance that a cake (cookie etc) will be destroyed upon creation. As I can set each individual items percentage in the editor it makes it easy to make more plentiful items have a higher percentage, and rarer items (such as the Massive cakes) have lower chances of not being there. This really makes the scene feel more alive when you go in a few times and see the variation.

We have the backdrop to do something with, and Leilani has several ideas for that (which is good as I have none). Then I am wondering just what kind of Music goes into a scene like this one ? Hmmm, bakery music is not a class of music if I am correct..... research needed on that score I think (pun intended!).

Have a great day,
Da Voodoochief

Sunday, January 31, 2016

In the Mood to Debug

Oddly I have been in the mood this last week to fix bugs. Small things mostly that have been annoying me, and in fact some things I have never even seen to be wrong yet.

It is vitally important for me to take advantage of this mood. You see some programmers are primarily focused in their genetic make up to debug and fix bugs, some are more disposed to create new content. Then again some are more focused on all sorts of differing aspects of the codding jobs needed to create a finished game. For me I love to create gameplay, game balance and features that people can play and enjoy. That means that I am not disposed primarily to debugging the game.

Though of course I know that I need to fix bugs in the game to make it worth playing.

So now I am actually enjoying fixing my game. As each bug is fixed I like the more solid, reliable complete feeling game that I am creating. Leilani is helping by locating some of the bugs for me to fix as well. Which is a GOOD thing as it makes the game more hers as well. Also everyone needs help finding bugs. That is why we have testers at work, and believe me they are great at finding bugs in the stuff we work on there.

How long will this mood last me? Well that is a good question, but I do not know, but I am good right now... so onwards. Better, cleaner game... oh yeah.

Go make the most of your mood, creative, cleanup, whatever it is... use it!

G'night,
Da Voodoochief

Thursday, January 28, 2016

Overnight Coding Solutions

I have stated this before, but I will state it again.. and probably again and again.

I do some of my best coding while I am asleep!

Sounds weird doesn't it. Lets take last night as an example. I altered the way a certain system works in Very Bunny Haha. I used to have each NPC that you touched register themselves into a list using the OnTriggerEnter2D(), and then unregister with the OnTriggerLeave2D(). Somehow I was occasionally getting ghosts left in the list when combinations of the same NPC names touched and untouched the player. I really felt this was not the best way to do this and so wanted to go to a more live list instead, using the OnTriggerStay2D() function. Then each frame they register themselves and I simply have to clear the list at the beginning (or end) of each frame.

When I changed the code to do this it appeared to be working perfectly, but I knew there would be a bug somewhere from such a fundamental change. I never expected to find it where I did, duh! Terrible tester am I! haha. The bug turned up when I tried to accept a quest. I could trigger the quest offer popup but could not accept it as the list was somehow empty when it ran through that piece of code. I was clearing the list at the end of the Update() function for my player. I felt this should be ok, but it always felt dangerous.

Last night I found this issue and though I was tired from a hard days work and an excellent tennis match in the evening, I felt this should be solvable in an easy way. Nope, not at all. While I watched some TV at the same time as trying to solve the issue I failed. Went to bed instead as I was not getting anywhere after looking at it for like 1.5 hours.

This morning I awake with knowledge of how to solve it. All I had to do was move the clear to a better place in the code. Before all the Updates are called and before Events are handled. Well that seems easy... So I moved the clear to the beginning of my FixedUpdate() for my player and now it all works. The only questions remains... is there another bug waiting for me to find, hidden, seething, ready to pounce when I least expect it?

Have a great Sleep Coding night everyone :)
Da Voodoochief

Monday, January 25, 2016

Plong the Minigame for VBHH


This is new Minigame I have created for Very Bunny Haha. It is obvious where the inspiration comes from for this Minigame, but let me fill you in on a few of the more subtle design decisions.

1. The Piston. This may seems like an odd thing to add to the game, but it pushes the gameplay in an unusual twist compared to Arkanoid and Breakout games that have gone before.
2. The spawning every 10 seconds gives a beat to the game. Ramping up if you are doing well, but keeping going if you are not doing so well.
3. The 5 lives limit along with the 10 second spawning is what really controls the length of the game.
4. The accumulating scores. This is so there is some good incentive to keep the balls around as long as possible.

The game is pretty fun and turned out really well. Which is always nice when you have an idea for a game.

Hope ya liked what you saw,
Da Voodoochief