Badge

Karl Zylinski

Game programmer

A couple of months ago I implemented 3D skeletal animation in OpenGL. Since I have never implemented such a thing before, it was fairly hard! Skeletal animation is one of those things where you work in total darkness with little possibility to debug anything. Until the code is finished you barely see any graphical result at all, most of the time the screen is black or displaying a heap of broken faces.

A video of the result of my work is displayed below:

My code is written in C++ and OpenGL. I used SFML for the OpenGL window context. Skeletal animations work by having a skeleton mapped to your 3D model. The bones in this skeleton are mapped to vertices in the model. The bones are said to influence the vertices. By moving a bone, the vertices move along. Animations are made by moving bones. There are several programming challenges involved in this. First, you need to take a finished model with skeleton and import them both. You then need to import the animations clips – a series of bone transformations – and calculate new positions for the bones. One of the biggest challenges is getting the bones transformed correctly. If one bone moves, bones that are said to be children of that bone, needs to move as well. This is calculated using hierarchical transformations.

When you have calculated the animation frames correctly you need to pass your model, along with the bone transformations and information about which vertices are influenced by which bones down to a shader on your GPU. This shader then does the actual transformation of the vertices. In my vertex shader the bones simply come as a huge list of transformations (4×4 matrices). These transformations are weighted, so that a vertex can be influenced by multiple bones.

For each frame, you can either calculate the transformations of the bones on the fly, or pre-calculate them. I started with calculating them on the fly and then switched to pre-calculated transformations (I calculated 60 per second, should be nice and smooth). The pre-calculation made my implementation several times faster, my animation played at a nice 700+ FPS.

The source code, both C++ and shaders, can be found here: http://files.zylinski.se/skeletal_animation/

Leave a comment »



Before Christmas I implemented A* path finding in Snöken: Inverno. Below is a video where I test the code by click at the other side of the forest, thus having the game compute the very long path to the clicked tile.

This guide was very helpful for implementing A*: http://www.policyalmanac.org/games/aStarTutorial.htm

I tried the algorithm before putting it into the actual game by creating a small test application, which is found here: http://files.zylinski.se/astar.cpp

Have a great day!
/Karl

Leave a comment »



This is another blog entry about one of the fundamental building blocks of 3D game engines. The previous post covered loading models using an obj model loader. This post will describe how height maps can be used to create a landscape. All code shown and linked is written in C++. OpenGL is used for the 3D rendering and SFML 2 is used for OpenGL window context and image loading. A 3D maths lib by OpenGL super bible author Wright is also used.

I’ll start off by showing a video of my height map loader implementation, it features simple navigation:

Read whole post »

Leave a comment »



Me and a group of students at my university are currently working on the first game in a RPG trilogy. The trilogy is called Snöken and the first game is currently codenamed Inverno. Although the second and third games are meant to be “real” RPGs this first game is more of an action RPG.

The RPG elements are inspired by games like Fallout, Diablo and a game I (and many of the other project memers) previously made: Verdammte Strindberg (http://zylinski.se/projects/1). You play through random generated levels in different environments with a story told through beautifully painted cut-scenes.

Read whole post »

1 comment »



Hi,
Since I’m really interested in 3D engine programming I’m trying to learn all the important pieces needed in order to write one. This post is about one of them.


All games need models! I grew tired of testing my OpenGL applications against primitives, so I just of hacked together a .obj model loader. Obj is a very simple format, it does not support animation, but it’s a good starting point! The final loader is shown above with a model made by my roomie Johan Zdybal.

Read whole post »

1 comment »



Wasteland 1 was released back in 1988. It was the first successful post-apocalyptic RPG and the first RPG with a persistent world. It had a focus on cause and effect, your actions rippled through the game and had great consequences.

Brian Fargo, who founded Interplay and has been part in making games like Wasteland 1, Fallout 1 & 2, Baldur’s Gate and Planescape: Torment, has started a fan funding campaign on kickstarter for Wasteland 2. It’s now up to us, the fans, to make sure this game happens! The campaign only has about 65 hour left as I write this, so the time is nigh to show the cRPG genre your love! This is your only chance to get Wasteland 2 for $15.

On board the project are famous RPG-makers like Brian Fargo, Mark Morgan (who made music for Fallout 1, 2 and Planescape Torment) and Chris Avellone (who designed large parts of Fallout 2 and Planescape Torment).

Below are some early concept art works by Andrée Wallin and a Kickstarter progress widget (click it to get to the Kickstarter site):


Leave a comment »



Code for this implementation (also posted at bottom). This post is based on these two tutorials: http://www.codezealot.org/archives/88 & http://www.codezealot.org/archives/180, read and understand them and then come back here for this C++/SFML2.0-specific solution! :) Ask me any questions in the comments, email karl@zylinski.se or add karl.zylinski on Skype!

Hello,
I’m working on our school game project named LSD. The game is supposed to support 2D slopes using rotated rectangular collisionblocks. I first tried to solve this problem using separating axis theorem detection and some home made collision response code (for penetration depth). It kind of worked but was very buggy!

I chose to completely reimplement the collisions using the GJK (Gilbert–Johnson–Keerthi) algorithm for detection and the EPA (Expanding Polytope Algorithm) for the response handling (penetration depth). GJK is a very efficient algorithm which uses a simplified version of what’s called the minkowski difference. Minkowski differences can be used for detecting collisions like this:

  • For convex polygon A and B subtract each point of A from each point of B. These new points are the minkowski difference.
  • Create a convex hull from the newly created points (a shape using only the outer points)
  • If the convex hull contains the origin, A and B collides!

There is an applet at the bottom of this page: http://www.pfirth.co.uk/minkowski.html which nicely illustrates this!

Read whole post »

Leave a comment »



I recently participated in Global Game Jam, a world-wide event where people get together create a game in just 48 hours! It was great fun, we were a group of 2 programmers and 4 graphic artists. Our end product was Valhalla: Happy Hour, a game about beating up your immortal friends and then having a drink with them!

Here’s a gameplay video:

Also: I’m currently working hard on a school game project with 12 other students. Our game project bears the name “A Lamentable Sighting of Distortion”. It’s a story driven and quite disturbing tale about what goes on in a schizophrenic Vietnam veterans head. We’re participating in Swedish Game Awards, here’s our SGA-page: http://gameawards.se/competition_entries/691.

I really need to sleep right now, sorry for any grammarshit ~____~

Good night!
/K.Z.

Leave a comment »



Hello!
During our most recent programming course at school we got the assignment to write some kind of C++-library. I decided to make an isometric 2D engine, not the whole thing though since we only had a couple of weeks, but the basic rendering and input stuff.

The graphics are shamelessy stolen from the Internet

Here’s what works:

  • Renders tiled isometric 2D using SFML 2.0
  • Level-support
  • Reads input and controls a player character (this part is quite ugly and hard coded into the engine)
  • Dot in triangle collision for walls
  • Collision with other entities
  • It’s crossplatform, yo. Only have binary test app for PC though, but compiles on Mac with SFML 2.0 libs

The engine is far from finished and contains a lot of weird bugs, but I’m satisfied with how modular and extensible it is. The design should make extending the engine and fixing the bugs quite easy.

Things that are broken/sucks which I’m aware of:

  • Entity-collision is not reset between level (i.e. invisible collidables)
  • Something I forgot
  • Controls suck and aren’t configurable from outside the engine.
  • Standing close to some walls looks weird (behind one tile and in front of another, can be solved with a minimum distance to walls or reworking sorting algorithm)
  • The test application is very primitive, the levels are hardcoded and not read from file etc

Binary test application: http://files.zylinski.se/ZyGeneTestApp.7z
Source code for engine + test application: http://files.zylinski.se/ZyGene.7z

XOXO

Leave a comment »



PHAT CREDZ to Johan Zdybal for the graphics! His deviantART

I recently made an “Invaders-game” as an assignment for school. I figured it might be a good thing posting a link to a compiled version aswell as the source-code here.

Game: http://files.zylinski.se/Kjellvaders_beta.zip
Source: http://files.zylinski.se/Kjellvaders_source.zip

There are some weird bugs and dirty workarounds, but it works quite well overall.

Todeloo!

Leave a comment »



RSS Feed