Archive for September, 2009

General cel shader

Wednesday, September 9th, 2009

Labyrinthica features cel shaded graphics.

On the most simplistic level shading is taking a color value from the surface’s texture and multiply it by an intensity scalar, which is based on how the light source affect the surface.
The scalar value is usually a floating point that goes from 0 to an unbounded positive number.
In cel shading, we want to quantize this scalar into non continuous values.

The general cel shader is a piece of code that quantize the intensity scalar. The parameters to the function are:
a – The original intensity scalar.
n – The number of quantization cels.
f – The cel transaction factor.
Return value = The quantized intensity scalar.

There are actually n+1 cel levels, the additional cel level is for intensity values greater than 1.
I will not explain the shader in details. I hope the code will be clear enough for people to understand on their own. Though I could explain it in more details if there will be a demand.
A few screen shots with different parameter values:

Cel shade(n=2, f=0.8)

Cel shade(n=2, f=0.8)

Cel shade (n=2, f=0.5)

Cel shade (n=2, f=0.5)

Cel shade (n=3, f=0.8)

Cel shade (n=3, f=0.8)

 

One last word before the code. My older CelShade function got only one parameter, the intensity.
I made the new CelShade with 3 paramters, but then I saw I would need to update every place I called the function.
Instead I have created GeneralCelShade as the function with 3 parameters, and replaced the old function with a function that calls GeneralCelShade with appropriate parameters.
The bonus is that now changing the parameters in only one place affect the whole game/shaders.
Very simple, yet very useful.

float
Quantize (float a, float n)
{
     return floor(a*n)+1.;
}

float
Trunc (float c, float f)
{
     return (c>f)*(c-f)/(1.-f);
}

float
SubCel (float a, float n, float f)
{
     float q = Quantize(a, n);
     float c = q-a*n;
     return (q>1.)*Trunc(c, f)/n;
}

float
GeneralCelShade (float a, float n, float f)
{
     float c = Quantize(a, n)/n;
     a = c-SubCel (a, n, f);
     a = min (a, (n+1)/n)*(3./2.)/((n+1)/n);
     return a;
}

float
CelShade (float a)
{
    return GeneralCelShade (a, 2, 0.8);
}

 

Lesson from blog categories.

Tuesday, September 8th, 2009

As I posted my first blog posts, I seemed to have difficulties in creating categories for them.
Why was it so hard to decide?
Well, that is because I have very little examples to help me decide what categories I need.
It seems more logical to create categories on the go, rather than think of a category for each post, the moment I made that post.

This is very similar to software, you don’t need to think on certain problems upfront, but rather decide when the need arise. If making changes is not too difficult, you can make changes as you go, add, remove and edit.
There is no need to find the perfect solution right from the start.
The buzz word to describe this way of thinking would be lazy fattening.
That is, you don’t mind having objects with a lot of features and functionality(fat), but you only add those feature if you encounter a problem that requires you to do so.

Past projects and experience

Tuesday, September 8th, 2009

Hello everyone,

This is a short and incomplete article of my past experience at making games.

In 1996 school summer vacation, I took a class about the C programming language.
Ever since I have been trying to create games and simulators, but rarely finished any game, because I was making over ambitious games.
However, I did gain valuable experience while trying.
My first completed game, was called Fatal Wars. I started selling it at about 2003.
Fatal Wars was similar to archon, a game which looks like a chess game.
However, once two pieces enter the same square, a new screen open, and the two pieces fight in real time action.
The game was written in C(not C++!) and had a lot of bugs.
After two months that I saw I cannot help people solve their problems with the game, I decided to pull the game “off the shelves”.
I remember one guy I was exchanging emails with, he got a black screen and I couldn’t help him out. I still have his name and email, which is not valid anymore.
And if you are out there and reading this, I will be glad to talk with you again. :)

Past projects image collection


PompiPompi Fatal Wars (Past project) video – Mod DB

Fatal wars took a year to produce, but I knew I did something wrong.
I needed to figure out how to make a game that won’t crash, and if it has to crash, there should be a proper error displayed to the user, and a way for me to know where exactly the error occurred.
After Fatal Wars I went to university to study for a bachelor degree in cs.
While studying I Started to work on the first incarnation of Labyrinthica: The quest of lima.
A 2D turn based rogue game, inspired heavily by dragon crystal.
Soon university became too demanding, and I stopped working on game development.
While I was advancing torward finishing my degree, I got back to writting games.
One of the games I started and didn’t finish, was Cyclic Dimensions.
I made many attempts to create star control like games, but Cyclic Dimensions was an attempt to take star control into the 3rd dimension.
The game supposed to have several ships to pick from, and then the ships could duel each other.
The game was a first person view(from the ships cockpit), and you could fly freely in the 3D space.

The special thing about this game? Much like star control, the world you are fighting in is cyclic.
In star control when you fly enough to the left of the screen, you would eventually appear on the right side of the screen.
In Cyclic Dimension, the two spaceships are inside a 3D box, but if you would fly to one edge of the box, you would appear in the opposite edge of the box.
I have digged up my old code to capture some videos from the unfinished game.
The first two screenshots and video just show off the space ships:

Past projects image collection

Past projects image collection


PompiPompi Cyclic Dimension video(past project) video – Mod DB

The second video supposed to show the cyclic cube.
The graphics are a bit broken and some visuals and effects are missing, but I hope this will make the concept clear:

PompiPompi Cyclic Dimensions Video 2 (Past project) video – Mod DB

The reason I stopped working on this game, is that I found out the only strategy when fighting one on one in a 3D space, is just to orbit each other.
There was no point in changing direction.
I think that maybe a multiplayer game with more than two ships fighting inside a cyclic cube might make a very good game.
But it something you need to try before you know if it will be any good.

That’s it for a quick history lesson.

About PompiDev blog

Tuesday, September 8th, 2009

Welcome to the blog!

In this first post, I will tell you about this blog.

PompiDev is a game development blog by ofer rubinstein(me), an indie game developer.

I intend to post about the technical, artistic, culture and practical sides of indie game development. And maybe also other stuff, who knows.

My current project is a game called Labyrinthica: The quest of lima, from which I have learned and willing to share what I have learned with others.

Overall, I hope people will learn or gain something from this blog.

Hope you enjoy your stay here. :)