Friday, December 8, 2017

TOE week 55: Deja Vu



Yeah so I kind of stopped working on this because of two letters. Last year around this time I had a very similar problem. Last year I couldn’t seem to see my way through UVs. Then I woke up one day and saw how it was supposed to work in my mind’s eye. I have yet to wake up and say ‘yep I figured out this AI thing in my sleep.’ Tomorrow maybe? 

The two letters AI have been dogging me for weeks. It just isn’t something I really ever worked on when I was in Dev. I worked with it but never made anything AI related. It isn’t really a simple topic either but fortunately I don’t need my AI to think just maybe have the illusion of thought.
One thing that the game is REALLY lacking is enemies to fight. I have a level but it is fairly empty. I worked on it from time to time over the past two months but nothing really stood out. In fact if anything stood out it was in a bad way. I switched over to painting miniatures for a board game. I did the same exact thing last year! Deja vous or what!

I came back to this here project. I can’t say it was with a vengeance or anything but I once again pressed start. 

Timers. Why isn’t there a Timer class in Unity?! Seriously. Once I started making AI objects a Timer class seemed almost essential if not required! On Tuesday I typed up a timer class and slapped it onto a test object to see if an AI script could reference multiple Timer Classes on the same object. The answer seemed to be no. Having multiples of the same Class doesn’t seem to work. OR I am doing it wrong. My Timer class seemed to work though. I can set a Timer’s time, reset the Timer or check to see if the Timer had expired.  

So I thought I little bigger. So thought it would be a good idea to make my Timer class into a dll file. For the uninitiated a dll would let me create custom C# functions for my project. I had never created a dll before. I watched a ten minute tutorial for about an half hour figuring out just how to get it done.  It was not as simple as creating a C# script because a dll had to be compiled into a file that is not readable to humans. It is a hexadecimal matrix that looks like this:

Don't run in DOS!

After I compiled my dll I had to see if my custom script would work and fun enough it did on the first time. Needed a couple of new scripts that I didn’t know about in my Test AI script but it was working. I had three Timers on one object all counting down different times. Bang! Neat! Now I’m going to make it better. So timers don’t work anymore. Usually for me it is the other way around. Most things don’t just work on the first try! Fine! I REVERTED everything because the upgrades were not worth it. 

Funny story doing all of the work to get the dll to function, I think I figured out how to have multiples of the same class on one object without the need of a dll… Go figure.

And that is why Google can tell a computer how to play Chess and I can’t.

No comments:

Post a Comment