Unity Jump and Run game status

15 August, 2011 | mwebi | No Comment

If written here once before about a Unity game on which I’m working on. The plan is to produce a releasable game by June 2012. The game is done as our final project before we finish our education. The team consists of 10 artists, 4 programmers, and a project manager.
Our goal for last semester, so until june 2010, was to get the game thus far finished that the artists can create all the assets and build the levels during the next semester. The programmers will be on internships all over europe and won’t be able to assists very much.
So it was nessesary for us programmers to finish all the stuff required to be able to build levels, like the movement of the characters, several mechanics.
Unfortunatly I can’t go into detail of the game idea and mechanics, since we still want to keep that disclosed for the time being. But I can say it’s a jump and run in which you play 1 character which has 2 “modes”.

However what I can do is give you a sneak peak in form of two screenshots of the game as it is now:

A wearable binary watch with Arduino Lilypad

15 August, 2011 | mwebi | No Comment

Overview over the project

After we, that is Andreas Stallinger and me, experimented a little bit with the Arduino Duo during our class “Interface Technologies” we found the Arduino Lilypad among some hardware supplied to us. First we didn’t know what it was but after a little research we found out it’s designed to be used on clothing. The Lilypad is a tool to create wearable technologies. That cought our attention and we were excited to have this tool at our disposal. So we thought about what we could create with the Lilypad. We wanted to make something useful which wasn’t complicated the handle and could be used in everyday life. So we came up with the idea to create a watch which was sewed into a shirt. Due to the lack of a display which is comfortable to watch we used LEDs to create a binary watch.
The watch has two Buttons which increase the minutes or hour count by one every time you press it. All in all we have 14 LEDs in use. 1 LED which blinks every second. The minutes and hours are displayed like in this picture:

Planing
We started by doing some research about the arduino Lilypad and how it’s different from the arduino duo. We realised there are only small differences.
Then we came up with a basic design for the watch. After that we had a idea about what parts we were going to need and found out that all required parts were available and no extra parts needed to be ordered.
We drew a basic circuit layout of the watch we had planed so we wouldn’t get in trouble during sewing because of the tread crossing.

Implementation

For easier bug tracking and error handling we wanted to first connect all parts on a table without sewing it to some shirt. This proofed to be quite a challenge since there were many treads which had to be kept apart and connected to the Lilypad. We gave up this approach since it created too much effort for too little benefit.
So we sewed all the LEDs, the two buttons, the Lilypad and the battery module to a T-Shirt and connected the parts. The advantage of this was that all the treads were sewed into the shirt now and were more stable then when lying on a table.

Our binary watch logic is a simple determination process. We disassemble the current time in four different values: Two values for minutes, two for hours, and one four seconds. At first we thought we could only use 13 pins for the output. But the arduino can use every pin as output, if you declare a analog input as output in the setup function.

Experiences made

We learned quite a bit about handling a arduino. Also we improved our sewing skills quite a bit. I’ll now sew on that button in no time!
Our biggest problem however were our poor sewing skills. It took us quite a while to sew all the parts together. But besides that the parts weren’t sewed together very solid due to our lack of sewing technique. This creates loose connections from time to time which reset the watch or set it to a wrong time.
Also we had to find out that the AAA battery is to weak to handle this project. This might be the case because of the resistance of the tread or the power consumption of the LEDs.

RK4 – Runge Kutta order 4 integrator

20 July, 2011 | mwebi | No Comment

If you are a fellow game developer you probably heard or even implemented and used the RK4 integrator.
For those of you who haven’t here’s a quick info about it.
The Runge Kutta order 4 integrator is like the name says a integrator. You need integrators in games so you can solve differential equations which occur basicly as soon as you implement some physics.
For Example:
You want to calculate the position or velocity of a object in the next frame. The newton mechanics teach us you would do that like this:

So how would you program this?
There are several integrators like the Euler (very common) and the quadric integrator. The Euler integrator is very intuitive.

void update(float dt){

velocity += acceleration * dt;
position += velocity * dt;

}

The problem with this solution is that the Euler integrator has quite a inaccuracy if the rate of change is not constant.
So if your acceleration is constant, you don’t have a problem calculating the velocity (which is not always the case).
But even if the acceleration is constant you will get an inaccuracy when calculating the position in the next line, since velocity changes over time.
And that error will add up every time you update. This can get quite troublesome in a racing simulation for example.
To prevent that inaccuracy you can use the RK4 integrator. It’s not perfect but it’s as accurate as you will ever need it to be in a game.

What the RK4 does is basicly integrating to the fourth derivative and calculating the changes over time. That’s why it’s called order 4.
After that it takes these four sampled derivatives and builds a weighted average of them which gives you a very good approximation to the derivative.

My Euler vs RK4 implementation

Now what really interested me was exactly how different are the Euler and the RK4 integrator in practice.
So I implemented both the Euler and the RK4 integrator in a little project where you can control a spaceship (triangle) with you WASD keys.
As long as I only flew around on the screen there weren’t any differences since the thrustStrength (and therefore acceleration) were fixed.
But then I implemented a spring force which drags the spaceships back to the center of the screen. And that really showed the differences.

The Blue triangle is the Spaceship which gets it’s position integrated by the Euler integrator. The red one uses RK4 (wow that sounds like a bad commercial for toothpaste).
Both get exactly the same input and forces applied. But as you can see the difference is quite relevant.

You can try out the project itself if you want. Download the binary here: http://mwebi.multimediatechnology.at/stuff/Euler_vs_RK4.zip

If you are interested in the source code you can view it on github: https://github.com/mwebi/EulervsRK4
You will need openframeworks v 0061 and visual studio 2008 to build it.

runnersHigh android game

1 May, 2011 | mwebi | No Comment

runnersHigh has come a long way since I last wrote about it here on my blog.
It’s still a 2D Jump’n'Run for android devices. The level consists out of randomly generated blocks which move at a certain speds from right to left. You as a player have to jump from block to block to reach a better score. It’s in a way similar to the popular game canabalt.

Last time I wrote about it I had the basic mechanics implemented. So I had the movement and the level generation, sound.
Well the game has come a long way since then. The biggest step since then was to switch from the android View canvas drawing to OpenGL ES. That improved the performance quite a bit. Besides that there are quite a lot new features:

  • Obstacles (either slow you or catapult you in the air)
  • Sprite animation for the player
  • The player is now a pop tart cat. NYANNYANYANYANYANYANYANYANYANYANYANYANYA
  • Bonus objects. They fly in a circle above some blocks and give you +200 score
  • Highscore. Offline on the device as well as a online highscore which can get accesed by the device
  • A menue
  • Paralax background with 3 layers
  • The blocks have 3 tiles now and are textured
  • OpenGL ES drawing

But I still think there’s lot of performance to be gained by tweaking and refactoring. Which will be our focus over the next month. We’ll probably scale the whole game to smaller dimentions. Also we are thinking about making plattforms instead of blocks. We created a new branch for that idea.

You can still view the source code on github: https://github.com/mwebi/runnersHigh
I have to admit it’s not the cleanest code I’ve written.

For any nyan cat fans out there: You can download the nyan cat sprite here

I think a picture shows more then 1000 words so here’s a screenshot:

And a I guess a video is still better then screenshots, so here is a video of the current version:

Unity3D development

5 April, 2011 | mwebi | 3 Comments

As I wrote earlier I’m working on two 2.5D Jump’n'Run games. We are a team of about 22 students from which 8 are developers. The rest are artists from various fields like Game Design, 3D Artists, Sound, 2D Artists.
I’m lead of the Tech department. This means I manage the two developer teams with 4 students each. We have pretty much the organisation of a small company and we’re using Scrum for the project management. But I’ll do loads of programming with Unity3D as well. I wouldn’t want to miss the fun :)
Well we started coding with Unity last week and as with any new engine, you need some time to get familiar with it. Also Unity isn’t anything I’m used to. It’s interface is way more like Maya then anything else. But that was exactly why we chose Unity. It makes the workflow between programmers and artists SO much easier. A artist can work with Unity, edit Prefabs, create scenes and so on. He can’t do that with a engine like Ogre. I think Unity will prove to be the right choice for this games.

But back to the games: One is based on Shadow/Light mechanics and has Coop Elements in it. You can play two Chars. One of them can onmly exist in the light, the other only in the shadow.
In the other game you play a boy who has to carry his sister around. She hold a balloon which lets her drift away as soon as her brother let’s her go. This opens up to a lot of cool mechanics.

But enough said! Here’s a screnshot of our Unity Prototype:

Allthough it doesn’t look like much, it’s a good start for us. We were able to implement the basic movement so far, whcih is ofc very important for a Jump’n'Run.

What’s comming up in the summer term?

24 February, 2011 | mwebi | No Comment

So the winter semester is over, and a big question for me is “what happens now with lastplant”?
Well I honestly don’t know. Our plan was to continue the project in our spare time, now that the semester is over. But as it looks now I’m not to sure the spirit is still there to continue.
I would have really liked to continue LastPlant in the summer term but the work to be done on my part (the game itselfe) is just not enough to be a term project. But I’m never the less willing to continue in my spare time.

For next term I’m allready in a rather big team (~30 students) which is aiming to create two 2.5D Jump’n'Run / Puzzle games for the next 3 terms. Considering this is a project with loads of master students I’m quite sure those games will be awesome! My part will be to program the games together with a few game developer collegues.
We will probably be using Unity which will allow me to gather experience with this popular and powerful game engine. I will also have the opportunity to extend my C# skills since we are probably gonna do the skripting with C#.

Besides that we have a few interesting classes like “Realtime simulation and graphics”, “Game development 2″, “Information systems” and “Multimedia Security”

LastPlant public version updated

21 February, 2011 | mwebi | No Comment

Well now that the Mozilla GameOn is over we were allowed to update the public version of LastPlant to lastplant.com

Here is what it looks like:

We improved a lot of parts of the game and the website.
Some changes which come to my mind:
I improved the Drag&Drop mechanics. Feels much smoother now.
You can rotate the Blocks now.
Added a right “Wall” in the builder mode to prevent cheesy constructs.
Tweaked the physical attributes of the game objects.
And probably dozens of other changes.

If you are interested you can view the code on github:  https://github.com/dblaichinger/LastPlant
You can view the stuff I programmed in the master tree under: /public/javascripts/renderengine/lastplantgame

How would Twitter work with c++?

21 February, 2011 | mwebi | No Comment

How would you programm a twitter like server and client with c++?

Well a collegue of mine and I tryed by using sockets. Our first try was a iterative TCP server/client, but that of course is a problem because the server can only handle one client at a time.
So our next step was to programm a concurrent server. For this we used IO Multiplexing and some examples we found on ibm.com.
After we had the multiplexing and client handling finished we only had to implement the features like login,register, following, writing a message, receiving messages, unfollowing etc.
If you are interested you can have a look at the source files: http://mwebi.multimediatechnology.at/stuff/WS09/twitter/
You can compile it with Visual Studio 2008.

Game Development and augmented reality

21 February, 2011 | mwebi | 2 Comments

I learned so much about game development as well as augmented reality applications I don’t even know where to start.
Well I’ll just sum up what our tasks were this term:

Game Dev topics:
Tile based games
Sprites
Map Editor with XML files as maps
Asset Manager as Singleton
States with the State Pattern
NPCs with random tile based movement
Finite State machine with messaging

Source & binary files:  http://mwebi.multimediatechnology.at/stuff/WS09/game1/
To compile you will need openframeworks and VS2008

Augmented reality topics:
Marker tracking
openCV
motionbuttons
color tracking
background substraction & contour finding
programming for the kinect with openNI


Source & binary files:  http://mwebi.multimediatechnology.at/stuff/WS09/ar1/
To compile you will need openframeworks and VS2008 for the most examples.

First steps into writing scientific papers

21 February, 2011 | mwebi | No Comment

Since I’m a bachelor student i’m also expected to write a bachelor thesis about something concerning my major in game development and augmented reality.
Actually I have to write two, one about something I will work on in my internship.
This term I had to write a expose for a bachelor thesis, which I will write if we dont decide on another topic.
So I tought about what topics I’m interested in and thought about Dr. Dent and the chasing behaviour of the candys. It’s a very basic pathfinding, just following a target. I was wondering how those real pathfinding algorithms work and started researching. I found a few like dijkstra, bellman ford and the most famous A*. I had a closer look on the A* algorithm. A good page to start is http://www.policyalmanac.org/games/aStarTutorial.htm .
But to research about something new I decided it might be usefull to have a pathfinding algorithm which takes the context of a character (light, emotions, etc) into consideration.
And that’s how I got to the title “Context based pathfinding of NPCs in computer games”.

You can read the full expose (and assess my written english skills ;) ) here: Context based pathfinding of NPCs in computer games

Android Game Development

21 February, 2011 | mwebi | No Comment

I chose “Mobile Applications” as minor of my bachelor. In this course we can choose on which mobile plattform we want to develop. I chose Android because I’m not much of a Mac fan and I prefer the open source idea over proprietary software like iOS for example.

We started by developing the classic hello world example and therefor getting to know android and the development enviroment (eclipse + android SDK).

The second app me and my 2 collegues created was a text based stone,paper,scissors game.


The handicap we had while programming was that we weren’t allowed to use IF condictions.
We found two ways to solve this task. The first one is to implement a two dimentional array,  which is kind of a solution table with all possible outomes of the game. You then   use the indices(players choice) to determine the outcome. The second way is a simple formula which computes the result thourgh the player inputs. We implemented the   second way.

The next step was to create something with graphics. We developed the minigame spaceWars where you controll a crosshair by tilting your phone. The goal is to shoot a TIE fighter by clicking on the screen.
If you hit the fighter, it’s position gets reset.

You can watch a video here: SpaceWars minigame

After programming SpaceWars we felt comfortable enough to start on our “big” game project, which we will finish in June 2011. It’s called runnersHigh and it’s a 2D Jump’n'run where the level is constantly random generated.
We allready implemented the random generation of the blocks, the character with jump capability, score counter, reset button, sounds, increasing difficulty (gets faster over time), as well as basics achievments (It’s over 3000!!! :D )
You can view the source code of the game on github: https://github.com/mwebi/runnersHigh

You can also watch a video of it on Youtube: runnersHigh Video

Computer graphics

21 February, 2011 | mwebi | No Comment

OpenGL is a API for programming applications which produce 2D and 3D computer graphics. But it sure isn’t the only one. We at MMT have our focus on OpenGL in computer graphics but before I started studying game development I heard so much about DirectX. So I though, hey now that you have some programming knowledge and game dev skills, you can have a look on DirectX from a developers point of view.

And this mini example was the result:

It’s only a tiny tryout. But it was a nice experience to see what the difference between OpenGL and DirectX are.
Source and Binary: http://mwebi.multimediatechnology.at/stuff/direct3d.zip
To sum it up I would say it’s like doing the same stuff in another way. And I’m sure if you manage to develop with one of those two you won’t have any difficulties with the other.

Something else I experimented on is a blur shader which I implemented in my test project (a tile based 2D Game).

The game is programmed with OpenGL and the shader with GLSL of course.
As you can see it’s a radial blur, which is rendered for both viewports.
This is done with the help of two FBOs.

Source and Binary: http://mwebi.multimediatechnology.at/stuff/sample-source-code.zip

LastPlant updated

29 January, 2011 | mwebi | No Comment

I happy to announce that LastPlant was chose as finalist in the mozilla GameOn competition.
You can view all the finalisits here: https://gaming.mozillalabs.com/games/finalists

Furthermore we continued to work on LastPlant and now deployed the next release on: http://lastplantbeta.heroku.com
Unfortunatly we aren’t allowed to make any changes to the LastPlant version currently hosted on lastplant.com, which is why it’s hosted on the url above.

The design has been greatly improved and there have been lots of smaller game improvements as well. For example you can rotate the blocks now.

LastPlant public release

10 January, 2011 | mwebi | No Comment

Well well,

after some hard work we have finaly released the first public version of our webgame LastPlant.
You can try it at http://lastplant.com/

The Website still lacks some functionality like rating the maps, maps preview etc
And the game needs some finetuning as well…
But it’s a first step!
We will also participate at mizillas GameOn competition. I’m very excited for the feedback we will be getting from the professionals of the jury!

First steps with JS and the canvas

31 October, 2010 | mwebi | No Comment

Well well this semester my “big” project will be a game which is a mix between browser game and some real time action in the canvas. Andre and Dani will be doing the Webpage with Ruby and my part will be the real time game.

I will be using the <canvas> to draw and animate the game and probably some WebGL elements.
Up until now I was mainly developing with c++ and therefore don’t have much experience with JavaScript. But considering all the possibilitys of the combination JS+WebGL I am very motivated to learn as much as I can about it.
I mean look at it: You can develope about any game you want (except high end grafic games ala Fallout:New Vegas) and as good as every user can play them without installing anything. No plugins, downloads. It’s idiot proof. And that gives you a HUGE target audience of casual gamers and people who don’t have much expertise with computers.

Well anyway I did some first reading,learning and testing with JS and was able to get a tiny animation:
You can move the blue square with the left and right arrowkey and rotate it witht he up and down arrowkey:
http://mwebi.multimediatechnology.at/stuff/test.html

What’s camping in sweden like?

3 August, 2010 | mwebi | 1 Comment

Sweden baby!

26 July, 2010 | mwebi | No Comment

Oh yeah I’m in sweden 8-)

I’m driving around here in sweden in a motorvan with my girlfriend. We are enjoying the landscape very much and also did quite some sightseeing already. Hamburg and Kopenhagen on our way here. And here in sweden kristianstad, johannishus, karlskrona, vetlanda, linköping, and today norrköping. Tomorrow we will be visiting the biggest zoo of scandinavia, kolmarden.

I won’t write a travel blog here, but I thought you might be interested in some impressions :)

MMT semester projects

11 June, 2010 | mwebi | No Comment

Well well,

the last two days were the presentations of the MMT09 and MMT08 semester projects. And I must say the presentations blew my mind!

It was rly exciting to see all the great works which my collegues have created. Also I’m very proud about what my collegues have accomplished. Considering what little programming experience some of us had when we started studying MMT, those are astonishing results.

So I want to mention some of the projects which stuck with me:

MMT09 Games:

Paper by Christian Mayr – for the very intriguing concept.

Space Confusion 2 by Franz J. lanzendorfer – for his impressive work in 3D.

Mine3D by Eberhard Gräther – for making a solid and completed 3D game.

Quantum Jump-Run by Benjamin Medicke – for the nice style and the cool mapeditor.

MMT09 Web Apps:

MusicLib by Manuel Gottstein – for making an killer app

Unitacs by David Strauß and Francois Weber – for using very advanced technologies

Swidgets by Lorenz Paulus and Mathias Paumgarten – for the solid programming and simple design

Catfight by Andre Schweighofer – for it’s very great  potential

MMT08:

lono.me by Hubert Hölzl and Andreas Alfare – a music guess game

Liquorious by Rene Baumgartner and Fabian Bergner – for their flashy design as well as their good project realization.

Yet another Update

25 May, 2010 | mwebi | 3 Comments

Well well, if implemented lots of the grafics so far. And here are two screenshots how it looks like now:

Also the user is now able to choose the difficulty settings.

Dr. Dent update

18 May, 2010 | mwebi | No Comment

Well well. After some work on the Weekend, i implemented powerups, which randomly spawn, and created another weapon (the watergun). I rewrote some parts of my code and also restructured it partitialy.

Anyway, today my MMA colleague Petra Kettl, who volunteered for drawing grafics for my game, sent me a few candy/teeth images.

I couldn’t resist and started rescaling and implementing them right away :)

And this is what my game looks now: