This half month I iterate on my AI algorithm to guide car in tracks. In Ai programming class I learnt path following and I found my previous method has some problems. Before, I was following waypoint, which can cause problem when the waypoint is very near. Formal path following method follow a point on the path which makes car moving more smooth. After finding that I decided to change my AI in this way.
First, I need to put path onto my tracks. Fortunately, our turning track can be represented by circle which is great. So I created a base interface to represent path and a CirclePath class and a LinePath class to represent circle and straight line. I add them to prefabs. Because path is attached to track so that I need tell track system to connect these path together when track is put down. Then I wrote AI logic class which is
Raycast front and find its projected point on path. The projected point is our target. Seek that point. That’s all. After tuning some parameters, the result is better than before. The car do not turn abruptly anymore.
Thank for AI in game class a lot. I learnt steering and though it is easy to implement, it is powerful! You can do a lot of stuff using steering. Steering is not limited to ai programming. Using it smartly you can apply it to other things. For example, one assignment is flocking, which simulate behaviour of flocks. There are 3 parameters, separation, alignment and cohesion. If I let flocks separate for several second and take their position down, these positions can represent, for example, position for a group of cities in strategy games. I read a post separate random dungeon room using physics engine. Flocking can be used in a similar way.
These two weeks I am catching up with other engineers. I was not here in the summer because I was doing my internship in Blizzard. Our game experienced major changes in the summer so that it took me some time. The remaining time of these two weeks was used to writing self-driving car AI for our game.
Our Lead Engineer, Ryan Kirschman, worked with me to get the first version. It works. The car travels along the track, but it shakes occasionally. Also, it can’t pass sharp turns. I spent a day trying to solve the problem. At the beginning I tried to add rays to find obstacles and avoid them. I added one in the front and two on sides. A bit better but still not that good. Then, I tried to find the problem with our algorithm. We used a raycast in front of the car to get the nearest waypoint and let car seek it. The problem happens when the car get close to the waypoint because of this:
So the car is near-sighted. To solve this, we still cast a ray but this time we use the farthest waypoint before the ray touches tracks and improvement is apparent. But there are still problems. Car sometimes overturns. To find out the reason, I run the game a lot of times and it turns out velocity is different from heading and I considered them the same in my code. After some thinking, I made ray casted in the direction of velocity because velocity represents where the car is going to. Also, during turning the car’s heading changes so much that it may even be vertical with track. AI system controls the car’s front wheel turning and I made turning degree wrong because I used the angle between vector v and vector d in Fig1. After fixing this AI turns out to be good. Even when it enters a turning track with very high speed it can still pass.
EAE day comes and I am very excited. I introduced my group’s game to other people and played with other groups’ game. Sensory overland is the best among C5. We found problems in crash city and will change that on Thursday.
I am busy with assignments and I need to plan my time between the end of semester and internship. I still want to change my house. So many stuff to do. I am a bit stuck.
On EAE day, some people plays with Crash City and they found problems in UI. We will come to change that later.
On Friday I, Ben, Jack and Jon had a paper prototyping class in North Lab. It is very interesting, we talked a lot about positive/neutral/negative economy and downtime. We also had a lot of cookies.
For Engineering Class, I use my engine to make a breaker game, it is really quick. Once you have a engine, making games will be much easier!
Next week I will head for California for a reunion with my family. After half a month I will be at Blizzard!
I went to 2k sports for an onsite interview. I failed, the bar is just too high for me. The want the best students in the world. I need to improve myself in programming. I signed so that I cannot say about problems they gave me. There are a lot of brain teasers and algorithm problems, which are not my focus.
Next week we will do EAE days. We are preparing for that. We have been working on that build for a long time.
In Engineering class, We talked about collision and it turns to be very complicated. But with some time I think I can understand. Just get it read in vacation.
In paper prototyping, We exchanged games with others and played a lot. We found problems in other people’s game. We iterated rules and played with others for a long time. I found problems in my game. It is repeating itself and there are too many choices for players. I can limit choices for better feel.
At Friday, I learnt from Blizzard that I am admitted as Test Engineer. Good! I am very excited about that.
I play some blizzard games. I played Warcraft 3 when I was in primary school. I bought it from a game CD stall near my home with 10 yuan. For sure piracy. At that time nearly all games in China are piracy…..
I am not a good FPS player because my hand is slow, very slow. Still, I enjoyed Warcraft a lot.
I used to play Red Alert III with my roommate in undergraduate school and I suck at that game.
One day, he just left his base empty to let me destroy all the stuff. He hide two ships in the corner of the map. I didn’t notice that so he attacked with only that 2 ships and he succeeded. My base get destroyed by that two ships…..I didn’t put defense in my base…..
Also, 2k sports will give me an onsite interview next week. Hope for good result!
I am really lucky! I rushed to Chinese restaurant for a delicious meal. Not as good as that in China but still awesome.
This week is mostly the same as the last week.
We talked about resource management. I, Jonathon and Blake made a small prototype for that. It is really interesting.
Blizzard said that they will give me result quite soon. I hope I will get good result.
This week, we are still working on our project. We have good progress.
In paper prototyping class, we exchange our games with others. I got Nick Wu’s game and my game is given to Laurie.
In Engineering class, we talked about computer graphics. It is a bit hard to understand but I think with a book it will be all ok.
I interviewed with Tencent, a company in China for internship. They asked me about my work in a great detail.
I used some of my spare time to make research on Crusader Kings II. I am going to join one modding group for this game. I will use my spare time to work for this game because I love it so much.
We came back from spring break and we had a good vacation. Now, we are back to work.
I work with Leo Li on AI part. He is really an impressive programmer. We made controlling part of AI.
For paper prototyping, I am changing the game and it is becoming better and better.
I had some online test from 2k sports and I am waiting for results. If I can make it, it will be awesome.
It is a long break with 9 days. I spent 3 days in games and other time in job hunting and assignments. I should have played less, only 1 or 2 days. However, I still get most things done. I partly finished C++ assignments and make nearly no changes to paper prototyping, but no change may not be bad. I am a bit fortunate that though my game’s rule is simple, it has some depth and I tried to change some rules but seems to be no better. I am self-content, but I didn’t get a better idea now. For designing table top games, I think sometimes less is more. In fact, I cut some rules from my game, which works quite well because gameplay became more clear after changes.
Some future work plan for my paper prototype:
1. add blocking and see difference.
2. kick-over cards? (2 movement and kick ignoring blockage)
The week after this week is spring break but I am still very busy because of these:
Engineering Assignments are hard. Collision is the core part of physics. It takes me more than one day to finish the first part.
Paper Prototyping needs work. This deserves work because we will showing our games next class. My game is good and simple, but I need to add depth.
Team Project is not demanding much because the next week is spring break. However, we have no direction now and people like “Crash” better than “City”, which contracts with me. I have some concern.
These are all Ok. The most important thing is internship hunting and network building. We need to make GDC worth.
Both internship hunting and network building take some time. I emailed to everyone I get card from at GDC.
Also, I submitted applications to several companies met at GDC. Some of them are companies in China.
I had interview with Blizzard for test engineer this week, so I spent one and a half day preparing for interview. I looked through a book to boost my testing skills. Also, I reviewed C++ interview questions posted by Joe.
I will work on Engineering Assignment: Collision Part 2 the next week. Also for my paper prototype. I think my spring break has been filled up.