Thursday, 8 November 2012

Gorge

Gorge

Gorge(©Prof. Dr. rer. nat. Dr. sc. nat Klaus Peter Jantke) is a round based board game I developed at the Fraunhofer IDMT for an internship and afterwards as a research assistant. The game contains up to 4 teams, with four robots on each team. The team can be controlled by a player or by an artificial intelligence that can be configured in detail. Thus, the player can create very aggressive opponents that actively disturb the other players or more peaceful and passive opponents. The game is mainly created for children to find out which kind of opponent they prefer, but also serves to answer many different research questions.

The development was interesting from a technical perspective as well. In the first few months I created a Silverlight Version with C# with isometric graphics. In my work as a research assistant this version was ported to Unity3D. Even when Silverlight used a slightly different API than the normal .NET API, most of the code could be reused. For different parts of the API such as timers, it was easy to create wrappers so that both versions could rely on the same code base.


More about the topic: Children's Media

Sunday, 4 November 2012

Bachelor thesis: simulation of a robot in a physic engine


Abstract the bachelor thesis

The thesis starts with the definition of general terms like graphics and physics engine and provides a closer view in examples of such engines. Afterwards this concept defines and explains the build of the robot and the for him developed kind of animation called 'force animation'. This special kind of animation allows the robot to perform specific motions. The following part shows the prototypical implementation of the concept. 
Thereby it describes the construction of a virtual robot in a real-time physic simulation. This process is shown with the aid of the irrlicht engine. The robot is made from boxes which resemble the body parts and joints which connect them. It can execute 'force animations' by motors in these joints to move its body parts. 
Two different methods for creating such animations are described. The first method describes the conversion of skeletal animation, the second method the usage of artificial intelligence. With the first method the robot succeeded in performing the desired motions, but only without gravity. By applying a genetic algorithm the robot is able to acquire simple animations by itself, which were indicated through prior rules, for example, jumping and maintaining the balance on one leg.



The Robot

The planned robot had three joints per side: shoulder, hip and ankle and is simulated in the physic engine PhysX. The hip joint cannot only rotate but also stretch and thus replaces the knee joint. The shoulder joint was removed during the development due to stability problems of the physic simulation.



 The three different actions of the hip joint:
  • rotating the leg forward/backward
  • rotate the leg sideways
  • stretch the leg




There is also an animated version of the robot without the connection to the physic engine. It was created in blender and is based on a conventional bone animation. Unlike the physics version it additionally contains a knee joint. After the import into the software, the animation of the knee joint is translated to the stretching value of the hip joint.



The artificial intelligence

The project contains two different methods of machine learning. In both cases the AI is able to carry out a certain action with a certain amount of force e.g. stretch the leg with a force of 100 newton. It is able to set every 0.04 seconds (time step) a new action. The hip joint is able to carry out 3 actions and the ankle 1 action. With both sides together it is able to carry out 8 actions per time step; 200 per second. If the AI can set a force as integer for every action between 0 and 999 and it tries to learn a 1 second long animation, it has to find the best solution out of 200000 possible solutions (8 actions * 1000 possible values * 25 steps per second).

Neuronal network:
A robot created in blender carries out a given animation. The neuronal network has to learn how to move the robot body parts to change the current pose to the next pose of the animation. To do that the neuronal network gets all the information about its current joint positions and the positions about the given animation. Now it learns to create with this information a valid output to follow the animation.
The neuronal network uses the library Encog (http://www.heatonresearch.com/encog). 

Genetic algorithm:
The AI gets a task like 'you are only allowed to touch the ground with one leg'. At the start of the algorithm the software creates multiple robots with a random movement pattern. Every robot carries out its random animation and the algorithm uses a score system to checks how well every robot performs.The robots with the best score are recombined (yes, they have sex^^) to create a new robot. The new child robot contains parts of the movement pattern of the two parents as well as a small percent of mutation - new randomly created movement patterns. The algorithm follows the steps score -> recombine -> mutate repeatedly (one generation) until a good match for the problem is found.
The algorithm was developed without any libraries.

The best results are created by the genetic algorithm. The video shows how the robot learns to keep its balance on one leg. The first part shows the result after one generation and the second after many generations (after more than one hour of practise).



The software

The software is programmed in C++ and uses C++/CLI and C# to interact with Encog, a C# AI library that is used to create the neuronal network. Furthermore, it uses the physics engine PhysX to simulate the robot and the Irrlicht Engine to draw everything. 





Wednesday, 12 September 2012

My master thesis ... again!

I have completely finished my master thesis and conducted my final presentation almost two weeks ago and everything worked out well. I am a master of science in applied computer science now. :)
I spent the last few days ... having a break and doing nothing. But now it is the time to go on and plan the future, write my CV, fill my blog and find an awesome job, preferably in London. :) 


But first: the newest version of my master thesis.

This is the first working version of my simulation with nice graphics. It shows the random generation and manipulation of a terrain the size of one square kilometre. The simulation runs on a gpu.



In the next video the simulation contains a new GUI. I changed the friction of sand and water to manipulate the behaviour of the simulation.



If you have a computer with a DirectX 11 graphics card and a 64 bit windows version you can test the simulation yourself:
offline. Ask me if you are interested ;)

important keys:
right mouse button pressed + moving the mouse -> rotate the camera
W/S/A/D -> move the camera
I/K -> add/remove terrain
O/L -> add/remove water




Sunday, 5 August 2012

my masterthesis


I've finished my masterthesis about the simulation of terrain and water for computer games. Here is my abstract of the thesis and some videos. I will create a version with a better 3D presentation soon.


The use of physics simulations in computer games and virtual reality has been a constant trend. They allow for development of dynamic virtual worlds, which can change through user interaction. At first it was only possible to simulate rigid bodies. Later the increase in computational power enabled the simulation of soft bodies and cloth. However, an essential part of every 3D world is still widely unchangeable - the terrain.

This thesis describes the development of a terrain and water simulation for use in computer games and virtual reality.

It discusses not only the simulation itself but also its implementation and optimisation. Furthermore the author examines the advantages, disadvantages and duration differences of the use of the technologies SSE, OpenMP and DirectCompute.



The creation of a powerful software, capable of simulating the terrain and water surface in an area more than 16 square kilometres on a gaming pc in real time was made possible by developing an efficient algorithm and its optimisation.


The first working version with water:

with water and terrain:

The next video shows the properties of waves in detail. A big wave bounces between the end of the map and a wall with some slits in it and creates little waves because of diffraction



Thursday, 28 June 2012

Hello World :)


Hello and welcome to my blog :)


In my first post, I would like to tell you how I got into programming, and what I have learnt in my final years whilst studying applied computer science.The main purpose of this is to improve my english, however I hope that this isn't too boring for you readers out there.Later, I will be posting some details on gaming technology and how game developers trick you with cheap graphic effects. :p Although in this first post, I will be telling you about my programming history. :)

My family had their first PC when I was 6 years old. I probably even wrote my first words on a MSDOS console, and so I got my first programming experience with a little bit of shell scripting.At 14 I bought a HTML and a JavaScript book and begun to learn my first peices of programming. Around the same age I decided that I wanted to become a computer specialist. Two years later I started an apprenticeship as one. :) There I learned my first real programming language: c++  But sadly they were only the very basic things. Finally in my last year as an apprentice I learned Java by myself and became extremely obsessed with programming of any format, especially games. :)


At first I wrote quite simple games like
chess

pong



and a chat to learn more about network programming.



However I quickly lost my motivation to continue after I started my study, and had to learn a lot. ^^

In my first semester vacation I began to learn more about 3D graphics and wrote a 3D tool to visualize data about the density of pills. It was just a little exercise but the results looked kind of cool :)

Later I learned more about computer graphics at university. There I developed my first 3D game space arena with some of my fellow students. We wrote it from scratch in three or four weeks. The player has to shoot all the astroids on the map as fast as possible. The time needed was shown in a ranking on my server. Sadly the webversion doesn't work anymore as the 3D library that was used is now obsolete.


 
In the last semester of my bachelor study, we had another course about games and 3D graphics. We had to create three projects in three weeks with different people from the same course. It was not only a programming exercise but it was about team work and organistation. One of the games made turned out great and I still love it. FishMeIfYouCan is a fishing simulation. The unique idea about the game is that you can use a beamer and a laserpointer as your fishing rod. You just point at the screen and move the laserpointer to pull the rod like I did with the mouse in the video.