Today’s technically day 4, but I got very little done on Friday, and day 3 started by finishing up what I started then. Which was… drumroll… machine learning! Not programming machine learning, but learning how to add a second AI-controlled kart to my karting game, then set up checkpoints for the AI to follow so it could see how to go around the track. I need to neaten up my checkpoints a little – at present my AI gets frightened of a big jump halfway through and turns around to go back to the starting line, where it gets confused and has to stop.
Setting up the AI kart controls involved making a prefab object for the AI to use as a checkpoint, distributing it around the track so the AI could always locate the next one, setting all the checkpoints as a trigger event, and placing them on the ‘Training Checkpoint’ layer. And also making them invisible, so that I could see the rest of the track (turn off the Mesh Render for this bit).
Next we moved on to a bit more decoration, aka using billboards – you can set images as an object’s texture using the albedo! Still haven’t answered my question from day 2 vis-a-vis what got my colors stuck, but cool nonetheless.
Learned how to add new cameras, position them and make them follow the player – you can add them through the main scene editor, position them by aligning with the view (or moving them as you’d move anything else) and attach them to the player by putting them somewhere inside the player’s hierarchy and positioning them accordingly.
I got to learn how to make new scripts! You can write a new script by creating it as a component, then opening it with your text editor, and proceeding from there. I’m having some issues with mine, however. I copied the code directly from what they were doing, but it looks as though variables that are instantiated but not initialized are meant to be able to be set in Unity. In the tutorial, they have blanks which can be filled by other game objects, but my Unity workspace isn’t displaying them.
Update: found the issue. I had a double in my code that was meant to be a float. (Can you tell I’m writing these notes as I work through the exercises?) Running into some new issues bugtesting, though – namely, I’m very bad at driving the kart.
Animation notes: have to create an animation as an asset (apply through Window > Animation > Animation when you have something selected, then hit ‘create’). Created through keyframes – position it where you want it at a keyframe!
Also some interesting experiences with bugfixing and post processing. The first rule for bugfixing: don’t write code you don’t understand. I ran into an issue that wasn’t even a bug (on Unity’s part). I had an error that didn’t affect compiling, only a piece I had deactivated, so I was fine running the game with it, except I had Error Pause turned on, which meant any error would prevent me from playing the game. One fun bonus of following a tutorial livestream is watching people with more knowledge than me hit the same bugs I’m running into.
I actually got through the entire rest of the tutorial today, which was honestly pretty incredible. The streamers’ process started to unravel a bit towards the end, when they ran into bugs which they didn’t have time to address and started taking requests from their chat which was overambitious for their time limits, but honestly, that was pretty bolstering. It’s a good reminder not to be intimidated by people who do this professionally — everyone starts somewhere, as they reminded everyone at the end of the stream!
I’m not going to move onto making my own projects yet; I want to practice with some more tutorials and pick up more skills (especially problemsolving skills) first. I may also look for some C# tutorials so I can understand what it is I’m trying to write when I code.
As I mentioned before, this stream was located here: https://www.youtube.com/watch?v=Dweo04X7mJU
It was part of this tutorial: https://learn.unity.com/tutorial/join-your-first-game-jam-1
Give it a try — it’s much less intimidating than you’d think! And if you’d like to play my game, it’s available here: https://connect.unity.com/p/the-zoomies/ (You have to knock down the donuts; for some reason my change to ‘pins’ in the instructions didn’t take.)
Leave a Reply