Ah, it’s so good to have two updates in subsequent weeks. It’s amazing what a holiday can do for you.
So since I had a holiday away from my programming job, what did I do? That’s right – more programming!
Since I’ve now finished the refactoring, I made a start on the AI. I have a simple seek algorithm essentially complete. “Seek” itself is very simple. It just goes “Where do I want to go? Where am I now? Find the direction I need to move.” Seek gets more complicated when you have to find a path in 3D or when there are objects in the way. For now, though, we’re using the simple version.
My current implementation is not working properly. What I expect to see, is the spaceship move towards the first spaceship (0, 0, 0) and stay there. Instead, it kind of orbits in a strange diamond shape in the Y/Z planes. Testing has shown this is related to the rotation of the object which means the AI is probably okay, and it’s my physics/rigidbody code that needs looking at.
After I fix this bug, I’ll be working on adding some slightly more complex AI patterns so that the enemy ships can have some lifelike behavior.
I’ve also started slipping in polymorphic actors into the code. At a later date, I want to have many different types of enemies. It’s a pain having to handle each enemy in a unique way. Having polymorphism allows me to tell the computer ‘Here is some bad guy, ask the bad guy what it wants to do’. Otherwise, I’d have to say ‘Here is some bad guy. If it’s (type x), do the (type x) action. If it’s (type y), do the (type y) action’ and so on, for all the letters of the alphabet or so on.
I hinted that I was going to use polymorphism on the actors a long time ago, but it didn’t make sense to do it until now.
Now that Christmas and New Year is done, my evenings are freeing up. I’m hoping I can get back to my regular schedule of one update per week.
Re: Lance and coding standards;
I generally agree with you. My issue is not that the customer has asked for this code standard to be used. My issue is that something doesn’t feel right about the standard. There are many good points raised in the standard, however the “You can’t use (this major feature of the language)” is questionable, and it’s justification seems weak, especially when there’s such a giant loophole to walk around the restriction. To me, it looks exactly like somebody’s personal opinion on ‘how to do it’ rather than an actual safety measure.
Regardless of the reason, though, the customer has requested this standard be followed. It has minimal impact on my job so that is not a problem. It’s just, the system engineer in me, dislikes hanging threads. This feels like an inelegance that should be investigated more thoroughly.
You know, if I was actually a system engineer :D
Lastly, this was yet another after-midnight update. I need to get one of those coffee cups that say “I hate