Tuesday, June 23, 2015

Bought my First Unity3D Asset

A few days ago I bought my first asset. It is very good and I am very glad I did. I also got the benefit of buying it 50% off which is a nice Bonus!

I have a bunch/crowd/herd of Generic NPC rabbits that need to wander around my village from one POI(point of interest) to another. Stopping at each one for a time. I would also like them go around each to intimate there is size for these rabbits.

I had the POI system in the village all set up, but as my scene got more complicated I realized I needed to navigate around more and that created a dilemma for me. I could write my own A* algorithm I am sure (done it before after all), but there is more too it than that like avoiding each other etc. Well I should mention at this point that Unity does have a built in Navigation system. Only it is for the 3D and works in the X/Z planes and not the X/Y planes of the 2D system. Hmm, there are several work arounds I could do, but I simply did not want to do the work.

All I want is a simple Navigation system, that's all...

So I ended up on the asset store for some reason and lo and behold, there was a navigation 2D asset to buy. Here is the link:-

Poly|Nav is it's name by Gavalakis Vaggelis. Next up was to read some of the reviews and they looked good. Mentioned that it is simple to use, great! Now lets go check the forum to see if this is still being updated... This can be a sticking point for me as an asset that has been left to rust might not upgrade to 5.0 for example. However I was very pleased to see that there were current posts for questions and answers within the assets forum thread. Link here:-

This was great so I went to purchase it and it asked me if I wanted to download a 4.x version as it might not fully work on 5.0 Unity.. Dang, this could be a sticking point. So I posted into the assets thread, and I was shocked when 9 minutes later I had an answer saying it works fine. Woah! This guy is attentive. With that I felt so confident, as I could also see he was answering so many questions about this asset.

I bought it. Yup, it is now mine! I checked out his Demo which came with the asset then was wondering how to proceed. I imported the necessary bits into my game and then what? Hmmmm I wonder if there is a help or something.

Yes there was, in fact it is a PDF and is not very large. This PDF does have exactly what you need to get going, and then even become a super user. The asset is that easy to use... just what I needed. So I marked out the area that is navigable and then placed a few obstructions in the way.. This took me several minutes. Then to test my game I added the supplied test class (ClickToMove) to my rabbit. then I clicked around the screen and watched my rabbit glide along nicely. All good so far. I am now 10 minutes in. Yes, you read that correctly, 10 minutes in.

After 20 minutes total I had my generic rabbits wandering around the POIs I had set up. Fantastic. There a number of events you can subscribe too so you can control your game logic. Which is nice.

Finally I have expanded my NPC AIs now quite a bit, and they look pretty neat. In the end this asset saved me some good amount of time and for 15 bucks who can complain about that.

Good Luck in your asset buying :)
Da Voodoochief

Thursday, June 18, 2015

Animation Event in Unity3D

I wanted to know in an animation a few days ago when a certain animation I had transitioned to a second one. This was important to me as at the time I did not know all about the GetNextStateInfo to go along with my GetStateInfo. I ended up researching and writing code to test the current shortNameHash for the StateInfo and making sure I only changed my in code states values when the GetNextState was set to Zero. It worked great, but I really wanted to get the Animation events working, as their possibilities are endless.

Firstly lets add the event to the animation in Unity.
It is like a small pencil and it appears when clicked in the place of the active timeline marker.

Next up was to attach it to a function in my script... This is where I had my MAJOR issues.
Problem #1: Event could not see the script function
Problem #2: This happened when I solved problem #1, function would not show up.

Odd that both problems sound the same, but in fact they show up the same but required different solutions.

Solution #1: I found that the script had to be actually attached as a component at the SAME level as the Animator.
Solution #2: To get the function to show up (it didn't immediately), you have to KNOW that the function must have either an INT or FLOAT parameter. If you try to use a Vector or Bool or Array the function will not work, though it is possible you will get an error for this.

This is what the function chooser looks like for the event system. Nice when ya have a function actually show up. Finding out why it wasn't there was a bit of a bear.

This above is what my test script looked like. Placed as I said on the same level of the Object as the Animator.

Are endless with the event system like this. You could simply use it to control and edit a whole sequence of fireworks to match up to a piece of music for example. Great way to use Unity :)
You could simply use it to create footfall effects of dust etc, or perhaps play a sound when the feet hit the floor.

Good Luck with your animations events

Da Voodoochief

Tuesday, June 9, 2015

Interesting Shops from a Generic building

I have been very busy with Leilani sprucing up the Village as per my last Blog post. Gotta make it something special, a place where people feel good right from the off.

I needed shops in the Village for obvious reasons, and we did not really want to go with fully unique designs for each one. Several reasons include uniformity, meaning that a Shop should look like a shop and not say a House or Barn etc. Another reason is that saving on memory is still important if possible. So we started out with a Generic building as you can see below.
fig 1: Generic shop building artwork

As you can tell the generic shop is also grey scaled. This is very handy for colorization, so we can easily associate a yellow building with Gems for example and a Brown building with Animals etc. Giving a profession/shop a unique color scheme is nice when referring to them in game if we have too. also I would mention that color variety is very cheap on memory.

Now we currently have 4 shops within the Village space and so we needed to add them and then make them more Unique and identifiable. In the next image you will see two shops doing just that.
fig 2: Fully Unique'd shops

From the image above you can see we added the nameplate banners and then we added some in game graphics to the shops to show off exactly what they are about. We have not yet finished these shops, but they are very close to being done. In the above example you can of course see how good a simple recolor job is.
One last thing is that we needed animation and each of these shops has it in some form or other. The above ones have the gems in the window spinning, and the Ducks jumping for joy in their window.

These are in game graphics and so are already very cheap to use., and did you notice the shadow parrots painted onto the Animals shop? Another easy usage of an existing graphic that we simple colored to zero, and then alpha's to about 30%.

Have fun out there,
Da Voodoochief

Wednesday, June 3, 2015

Polish the Obvious, and first thing people see in your game

I have been looking over the VBHH game with a critical eye. Which means trying my hardest to be unbiased. It is an interesting task and one I quite like to be honest. Sort of taking the experience, knowledge and feelings about my game I have spent so many hours working on and moving them aside, then once aside I get to play the game and come away with some insights... or that is the hope anyway.

I always have a few questions ready in my mind when I do this.
  1. what is my first impression
  2. what is the first annoying thing I encounter
  3. what is the first thing I feel is missing, or wrong about the game
My first impression of the game was good, in fact I am fine with what I see for the most part, BUT I made several notes on the starting area of the game, namely the Village. It just did not feel like a village. So I talked with Leilani and we came up with several things to add to the Village. That should make the Village more complete with proper shops and layout.
NOTE: Village needs to be more complete before we can show this game off.

Number 2 is interesting as I encountered one annoyance and that was only using the space bar for 'using' and jumping both.
NOTE: Use a different button for Use, (U key).

Number 3 was an easy one as it happens, and that is not always so. This time it was of course in the village and I really felt there was not enough animation. This does go along with making the Village more village like, but making more of an animated village is extra.
NOTE: Bring the Village to life through more animations.

I have already done some addressing of these points and now we have Chimney smoke out of the houses and also we have Clouds moving continually across the backdrop.

We will keep on this track until the Village looks good to my critical eye.

Have a great one,
Da Voodoochief