I made a Tetris game because I felt like I wanted some practise in making simple games and also wanted some more experience with OpenGL and SDL. The game is made according to the Tetris standard (colors/wall-bounce/grid size/etc) but is customizable in all of those areas. I tried to make it cross-platform by using just SDL, OpenGL and SDL_ttf.
After finishing the game I felt like making an AI for it, so I did. It is by far not the best AI there is, but it was great practise and it’s fun to watch. Initially it did not look at the next piece, but only at the best fitting position for the current piece. It also didn’t look at the height of chosen positions. At that time it worked fine, but always kept stacking stuff and eventually died because of a lack of L-blocks. This was when I recorded this video:
(Sorry about the slow motion and glitchy video, it’s youtube’s fault…)
After realising that that wasn’t a very good AI strategy, I implemented a way for it to look at the next piece. It uses weights to determine the best position for the current piece, while not screwing the next piece over. This required quite some tweaking and should really be automated, but I’ve got it to a point where it works good enough for me.
It now also looks at heights and gives negative weights for that. For example, if it would receive a constant stream of S-blocks, it would stop stacking them about halfway, and start putting them somewhere else. It always prefers lower spots, even if they don’t fit very well.
I’ll be putting a source link here soon. For now, here is a zip with windows (32 bit) executables: tetris_windows.zip
About a year ago, I made a simple 2D rigid body physics simulator in C using SDL and some other libraries. This turned out to be a bit too hard and I got stuck on the collision response part. Besides that the whole thing was not designed well and just messy and ugly.
Because of that, I recently decided to completely remake it, and this time I started with circles instead of polygons. I chose that because it’s so much easier to do collision detection and response for circles than it is for any other shape.
I also wanted to keep it cross-platform and portable, so I used OpenGL within SDL to do all the drawing.
Here are a few youtube videos showing the current capabilities of my physics engine:
The red arrows indicate the direction and size of the gravity force on each ball. In the first video you can also see that the green ball is more bouncy. It keeps gaining velocity until it shoots through the wall.
The source code of the current version (with the layout that’s visible in the first video), is downloadable here: simple2d.tar.gz. Just run ‘make’ and it will compile.
I release it under the GNU GPL, which means you can use it, change it and redistribute it, as long as you mention my name.
I’ve had my Arduino for quite a while now, and haven’t really done anything interesting with it besides simple input/output tests.
That changed a few days ago when I received my new HD44780 compatible LCD display. It’s a 16×2 character display with 5×8 dots per character. I really wanted to have one of these since it makes it so much easier and cooler to show output from an Arduino.
So after I connected my LCD, I toyed around with it and quickly found that in the Arduino IDE, there’s a built-in library for handling HD44780 compatible LCD’s. This made it really easy to communicate with it, but also really boring, and it wasn’t much of a challenge. That’s why I recently started looking into the AVR (The micro controller on the Arduino) assembly language, and the workings of the processor. This was really interesting because I now know so much more about the AVR micro controllers, and programming such a piece of hardware in direct machine code is just awesome.
The LCD.
I read some tutorials and especially the data sheet of the processor, and I was quickly able to light a led at the push of a button, and do other simple things. But of course, this wasn’t enough. I wanted to try to communicate with the LCD directly using assembly, and be able to write text to it. This was a hard task since debugging on this thing is near impossible, but in the end it worked out.
Here’s my code. All it does is display “LCD Test! ” on the display and loop infinitely.
If anyone wants to use it (which I doubt ), it’s under public domain so do with it whatever you want.
You may or may not have heard of CanSat. It’s a competition held in many countries under high school students. The challenge is to design a little “satellite” that fits in a coke can. Each team’s can will be launched to 1km height where the CanSat will start collecting data and start sending it to the ground station.
The cool thing is that this year my school is entering the Dutch CanSat competition and I’m in our team. That’s great because the CanSat is basically an arduino and I’ve always wanted to experiment with those.
Here’s a link to our team’s website (hosted by me): http://www.hnwcansat.nl (Translated English version here.)
A few days ago I finally received my new PC + monitor. These are the specs:
CPU: Intel core i7 860 quad (2.8Ghz)
GPU: nVidia GTS 250 (512MB)
RAM: 4GBB DDR3
ROM: 1TB HDD
Monitor is a 23″ LG, running at 1920 x 1080
Isn’t that awesome.
I’m dualbooting Ubuntu 9.10 and Windows 7 Ultimate at the moment, but I’m planning to run more linux distributions. (I’ve always wanted to try gentoo)
Here’s a screen capture I took showing off Ubuntu with compiz and some other stuff.
Now I can finally have a much better blender workflow because this pc renders soooo much faster than my old laptop
I’ve already rendered an animation in LuxRender, which took just 60s per frame to get this good quality:
It’s a shame that blender can’t make use of multiple cores yet while baking (I know there’s OpenMP, but I can’t find 2.49 builds for linux with it, and I don’t feel like building it myself), so I can’t make use of all my 4 cores. Still I can now bake at much higher resolutions because of my 4GB of ram. So guess what, I baked a 500 resolution fluid simulation last night
Here it is, my new blog.. I finally decided to install wordpress and pick up blogging again.
This blog will be a collection of everything on the internet that has anything to do with me, that I’ve made, like, want to talk about, etc..
Which would mostly be programming expiriments, blender tests, linux fun, and other geeky stuff.