Penumbra: Overture goes Open Source!

Some links in this article have expired and have been removed.

It has been in our minds for quite some time and now finally it has become reality: Penumbra:Overture and the HPL1 Engine are now open source! In case that is all you need to know, then head straight to: http://GitHhub.com/FrictionalGames to get your hands on it!

For more information just keep on reading.

Penumbra: Overture

First of all I would like to stress the fact that this open source release does not make Penumbra: Overture free in anyway. All assets (except a few that are part of the engine) are still under the same copyright as before. The thing that is free is the source code for the executable which is now released under the GPL version 3 licence.

The code for Penumbra: Overture is a continuation of the one used for the tech demo + some addition for the not so long lived Robo Hatch project. It also contains some code from Unbirth, giving it quite some history. This history means that the code is far from clean and as expected quite hackish in places. That said, it should have a few interesting bits, the major probably being the physical interaction system. This system is not the latest version in the Penumbra series and misses something like rotation. These features should be fairly easily to add though.

It is also important to note that Penumbra: Oveture source will not run Black Plague or Requiem. AI for the infected, GUI elements, etc are all missing, but all needed to implement them is present in the engine code (in case anybody is up for the challenge).

HPL1 Engine

For my part, the biggest part of this release is the engine itself. This is engine that has powered all of the Penumbra games and it even includes the stuff used to create the 2D platformer Energetic. The engine code was started in December 2004 and was actively developed until early 2008. After that only smaller fixes where made to it.

The transition from 2D to 3D and the fact that it was my first stab at a full 3D engine, makes the code quite patchy (and downright horrible) in places. This is especially true for some old and low level parts like the sound and input handlers which have evolved anything but gracefully. Later parts are often cleaner and nicer, but the code is not without its share of quick-and-dirty-hacks.

When it comes to interesting features, I think the following are the most prominent:

  • Physics sound system. This is all the code that is used to play and tweak the sounds heard during physics interactions (bumping, sliding, etc). A lot of work has gone into the system and is the result of a combined effort between me and Jens (who does all sounds) for several years.
  • Stencil shadow volumes. The shadow system in the engine is quite robust and can work on pretty much any mesh, something that shadow volumes usually don’t. It is far from state of the art these days (when shadow maps rules), but should provide nice info for the curious.
  • Serialize Class system. This is code used to easily save and load classes to disk. It is very useful when creating a save system for games.

The engine contains tons of more stuff (almost 100k lines of code), but these are the most interesting stuff I could think of right now. I am sure there is more for awaiting to those brave enough to explore its dark depths!

Finally, it is also worth noting that this is the latest and final version of the HPL1 engine. It is the beast that powers all games of the Penumbra series.

OALWrapper

This library is made almost entirely by our tool programmer Luis, who actually started out doing work for us on the OpenAL sound implementation. This library is simple and easy way of accessing the OpenAL functionality and was made since there is a strange lack of free sound libraries. This is also the only part of the open source release that we will continue to update and we hope that others will find it useful and contribute themselves!

Questions and Support

As we are a small company and already swamped with work, do not expect us to do full time support on this. We will try and help as much as possible, but we also hope that a community will form helping each other out.

For more discussion on the source code please go here:

This is the place to go for more technical information and please ask any lengthy / technical question there instead this blog.

Credits

I must also stress that I am not very experience managing an Open Source project and most work in making it happen is due to Edward Rudd, who is also responsible for the Linux and Mac ports of Penumbra. So big thanks to him!

End notes

We are extremely interested in seeing what people will be able to do with this! Open source releases of other games have spawned very exciting stuff and we hope this release will do that too. This means we are very interested in what people are doing with it. So whether you plan to do a full blown mod, or just check the code for learning purposes be sure to tell us about it!

Fractional Fun

Some links in this article have expired and have been removed.

This blog post will not be totally game related, but more about the engine and a recent obsession of mine. Do not fear though! It should hopefully still be interested and I will also provide some nice images! Hopefully it will also be able to evoke a sense of wonder too. Read on to find out!

Ten years or so ago I wrote a paper for school about Fractals. These constitute a large variety of objects but what they all have in common is that they have several levels of self similarity. Nature consists of tons of fractals, for example trees and mountains. In games the term fractal landscape was quite common at time and was a way of generating terrain. Although not heard of as much today it is still a part of game making. Below are some examples of fractals, note how the same type of shape appears over and over again:

Now, while doing the paper for school I came across a weird thing called the Mandelbrot Set. This is a certain function that when iterated and mapped (drawn to screen) creates a fractal. The function for the set is very simple and is based around this formula:

N(0) = c
N(n+1) = N(n)^2 + c

What this means is that one starts of with a number c, then multiply by itself and finally add c to get the next number in the sequence. If done with normal numbers, one gets something like this:

1 + 2 + 5 + 26 + … and so on towards infinity

However, there is a twist to this formula when creating the Mandelbrot set, instead of using a normal number for c, a complex number is used. A complex number has a real and imaginary part and is written like this: c = 3 + 2i (the imaginary parts gets i behind it). When using the above formula on a complex number, it gets slightly more complicated and is (kinda) analogous to a 2d vector being rotated by itself.
Now, to get the Mandelbrot set, one “simply” checks if a certain c makes N go toward infinity or not. If it it does not, then it is part of the set. In practice one just iterates (does the same thing over and over) the formula a fixed number of times and see if it has reached a certain limit value. If it has it is said to be not part of the set.

Hopefully the math part made sense and was not too boring, but I felt it was needed for full understanding of what makes the Mandelbrot set so amazing. And to see why it is amazing one has to visualize it. This is done by letting c be a point on the screen where the x coordinate is the real part of the y coordinate the imaginary. Then one colors the pixel black if it is part of the set, and if not color it depending on how many iterations it took to reach the limit value. Doing so will generate this picture:

I gotta say that that is a pretty damn detailed picture one gets from just iterating some boring function! If someone had just shown me the formula I would never have guess it could produce such a wonderful result!

It gets even better still! If one zooms in on this image, the details just keep coming and they never repeat! As with the other fractals same kind of shapes return again and again, but never in the exact form. The beauty of it is breathtaking! Here are some examples of zoomed in parts:

When I made my own Mandelbrot program I could not stop searching the set. It felt like I was exploring some kind of alien world and it feels so weird that such a simple formula can create a cosmos of infinite detail. If you want to explore it yourself, here is a pretty nice web application for just that.

Fast forward to present day. Last Friday Luis sent me a link to this page of someone who managed to create a 3d version of the Mandelbrot set. Naturally this was irresistible for me and inspired by the works of Iñigo Quilez (I had his presentation “Rendering World with Two Triangles” as a reference throughout this project) I set out to create a real time application that could explore this world .

My idea was to use some kind of ray tracer to render out depth, then use that depth to generate normals and just plug that into the deferred shader and let it add ssao, nice light and fog. I thought about this for a while and came up with the idea to use the same method as when rendering high quality parallax. This technique is called relief mapping and works by first making a rough linear search for an intersection and then a binary search to pin the exact location down. Hopefully this would prove fast enough to do a nice 3D Mandelbrot in real time! What I ended up with was an algorithm that could render arbitrary mathematical functions, so I tested this on some functions and got pretty nice results:

Some metaballs rendered and animated. This is not the fastest way to do this, but proved that stuff worked!
Here is an animated “Sine Landscape” that is just a bunch of sine curves added together.

What was left now was to attack the Mandelbrot set! The formula for getting hold of the 3D version is a little bit different from the 2D one and is not really THE 3D Mandelbrot either, but it surely the closest I have seen! It was discovered by Daniel White and works by using spherical coordinates. Remember how I said that the 2D Mandelbrot formula was kind of like rotating a vector by itself. Well, in the 3D version one rotates a 3D vector around itself by using spherical coordinates instead of polar (skipping formula, but if anyone is interested I can give more details!). Also, to make it look good in 3D, one has to have a power of 8 in the formula, meaning that one spins the coordinate around by itself 8 times!

It took quite some time get this working as the 3D-card did not do what I want to and so on. But finally I got it all working and boy was it worth it!!! Here are some screens:

At the edge of a hole. Perhaps some strange creatures live in those burrows?
This is a 3D version of a Julia set! Looks like some alien space ship flying through the vacuum.

Once I got this far I could not stop using it! It was so much fun exploring the weird world of the 8th degree Mandelbrot fractal! Because of some limitations in the ray tracing method I added a new version of the renderer that builds up the image in slices and can use a lot more iterations when checking if it is in the set or not (more iterations = more details). It is slower, but creates more details in the images and it is fun to use it when one discovers some extra interesting shape and want it enhanced. Here is a video of me exploring the set:

Now the best of all this is that YOU can explore this strange world yourself! To do so, just download the MathFuncRenderer and get going!

(ShaderModel 3 capable card required) Windows, Mac and Linux version below.
Note that you need OpenAL installed for it to run.

Winodws:
http://unbirthgame.com/MathFuncRenderer.zip
(Link might change so please do not hotlink)

EDIT 26.11.2009: A Linux version of the MathFuncRenderer has now been built and uploaded!

All this has been possible because of our Edward Rudd who makes all porting for Frictional Games.

Linux:
http://unbirthgame.com/MathFuncRenderer-Linux.zip
(Link might change so please do not hotlink)

EDIT 27.11.2009:

Finally, to end our fractal-odyssey, the MathFuncRenderer has come to Mac!

As with the Linux version, Edward Rudd is that man behind the port.

Mac:
http://unbirthgame.com/MathFuncRenderer-Mac.zip
(Link might change so please do not hotlink)

(Also note that because of some nvidia driver issues in OSX, some nvidia card will not work properly, 7300 GT on leopard is known and there might be more.)

I am very anxious to see what kinda of strange pictures you all can take so have opened up a post for this in the forum. I have already posted more of my own images there.

Black Plague available for Mac & Linux – Windows gets Unbirth

Originally posted by Jens.
Links in this article have expired and have been removed.

Helsingborg, Sweden 13th of May

Penumbra: Black Plague for Mac OS X & Linux released!
Regardless of your computer platform of choice it is now possible to enjoy the full Penumbra: Black Plague experience. Following up on the release of the demo two weeks ago the full versions are now available for $19.99.

Mac minimum requirements:
OS: Mac OS X 10.4 or newer
Processor: 1.5Ghz
Memory: 512MB
Video Card: Radeon 9600/GeForce 4(GeForce4MX not supported)

Linux minimum requirements:
Processor: 1 Ghz
Memory: 256MB
Video Card: Radeon 8500/GeForce 3(GeForce4MX not supported)
Misc: Kernel 2.6 or higher, glibc 2.3, X11R6 with 3D acceleration, for x86_64 CPU, 32-bit environment must be installed

If you have not played the prequel, Penumbra: Overture, we would recommend it before trying Black Plague. Of course Overture is available for Mac & Linux.

A look into the past released

To all dear Windows users,

Before creating Penumbra and before founding Frictional Games, Thomas Grip worked on a game called Unbirth, unfortunately this game was never finished due to various issues. Unbirth was a game much like Penumbra, a first person real-time rendered adventure horror game, but without the nifty physics. During the past two years, players of Penumbra has continually asked if it would be possible to release any working code of the game, and well, Thomas decided that it actually is possible!

An alpha version of the game is now released as well as a short presentation about the game, how it was made and why it was, sadly, never finished. It is an unstable, but working demonstration and gives an insight into the history of the ideas and design choices that was an inspirational source in the creation of Penumbra.

Render To Texture

Links in this article have expired and have been removed.

Hi again all!

One of the things that I am planning to do in this work log is to release a demo showing off a new feature whenever I can. That way I can see how well the engine works on various machines and you readers will also be able to follow the development in a more hands-on fashion!

First out is a render to texture test. In HPL1 I never used any direct rendering to texture, but instead I copied data from the screen to a texture. This was good for the time being, but it also had a bunch of drawback most notably it could be quite slow on certain instances. For HPL2 I will have full render to texture support though and I just finished the implemenation.

Attached is a screenshot showing how it should look. If you get any strangenes while running please post a reply and report it along with a copy of hpl.log and a screenshot (taken using F8)

DEMO DETAILS
—————
Download Link:

Minimum Requirements:
Radeon 9600 / Geforce FX
Controls:
W, A, S and D: Move around
Mouse: Look around
F8: Screenshot


Comments:
If anyone wants to mess around with the pattern generated feel free to fiddle around with “texture_render_test_fp.cg” in the programs folder. If you get anything working please attach a screen!