Blog 5

Weekly Roundup – http://goo.gl/ctpCdj


Well, it is the end of Week Four already! This trimester feels like it has gone by really fast, sure, we are only 1/3 the way through this Trimester, but it feels like it has only been two weeks, three at the very most. We have learnt one hell of a lot of games and general programming concepts in this short amount of time, and our bots are due on Wednesday (of Week Five).

The whole lesson on Monday was learning about how Neural Networks are very helpful and can do a lot with just a short amount of code. I am very amazed how short the code is for such a powerful concept. Like with Genetic Algorithms, Neural Networks work very similarly to how a biological function works, this time, with Neural Networks, it is the brain, or more specifically the neurons of the brain. We looked at a few different programs that use Neural Networks and I brought up Sethbling’s MarI/O, a Neural Network that over a 24 hour period, figured out how to complete a Super Mario World level, starting with it not even knowing that pressing buttons could make it move through the level.

Another Wednesday came around, and another massive day of learning was done. This week, the first period of the class was focussed on physics related stuff. We were taught how to implement Rope / String and Cloth physics. Constraints between nodes was a big key in allowing these materials to act as they should. These bendable / deformable materials use soft body algorithms to act as they should. A soft body can be simulated using a collection of rigid bodies, for example a rope can be created using many small stick-like rigid bodies joined end to end.

After lunch, the second period began. We jumped into talking about what may be expected of us for our API LO, so we looked at Math Libraries as making one is a potential tick-off for this LO. One of the advantages of C++ is easy implementation of Math Libraries. We were taught bits about how to make a GOOD Math Library, by taking advantage of technologies that are hard-coded onto the CPU. We learnt all about CPU Registers and how they have evolved over time, as well as how to take advantage of them through code, for doing calculations more efficiently.

What I was most ecstatic about, was when we touched on the subject of how the CPU reads from memory. The CPU has memory caches, Level 1, Level 2 and Level 3 (L1, L2 and L3). I was always curious as to what these meant, why the existed and why they had different sizes. What we learnt was that RAM is very slow, the CPU is very fast. It is possible for RAM to be a faster hertz rate, but it costs a LOT more to make faster RAM, so the solution is to have cached memory, of different levels. As the levels of cached memory go up, they become faster but the trade off is that the size of them becomes smaller. L1 cache is the fastest, but it is still really slow compared to the speed of the CPU. L3 cache is the slowest memory cache, but it is still a lot faster than RAM.

The CPU grabs a whole line of memory from RAM at a time, which can be quite slow if you have variables that are not aligned to memory (the variables are partially on 1 line of memory and partially on the next as it is misaligned) as the CPU will have to grab both lines of memory to read the variable. If you align variables in RAM, ahead of time, you can ask the RAM to send a line of memory, and by the time you need the variable from the line you asked for, hopefully it has gone through to L3, then L2 and finally at L1 cache, so it is reading the variables at a much higher speed than if you asked RAM for a line as you are using it. Doing this will make sure your program is faster as you are only asking for one line when your variable is aligned, instead of possibly two lines, and also since you asked for the memory to be sent in advance, reading from L1 cache instead of RAM will give you way faster read times.

This weekend I was very busy. I completed the renovation of my kitchen on Friday that I had started last week, and went to a party Friday night. I stayed up all night at the party and came home at midday on Saturday, slept till 6pm, made dinner, watched a movie and went to bed. That means that Sunday was the only day I had to do stuff, and I had promised the Designers I am working with, that I would complete what I am helping them with this weekend, so I have been doing that all day and have only just finished a couple of hours ago, had dinner, and started writing this blog. I therefore didn’t get to work on my KillBot more this weekend, so I will be working on the pathfinding for my bot in the remaining few days, as it is due on Wednesday, the day we do our final round of bot tournaments, this time through a maze, hence the need for pathfinding.


This is Daniel Jochem, signing out.

Advertisements